app.js 1.8 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730
  1. /******/ (function(modules) { // webpackBootstrap
  2. /******/ // The module cache
  3. /******/ var installedModules = {};
  4. /******/
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/
  8. /******/ // Check if module is in cache
  9. /******/ if(installedModules[moduleId]) {
  10. /******/ return installedModules[moduleId].exports;
  11. /******/ }
  12. /******/ // Create a new module (and put it into the cache)
  13. /******/ var module = installedModules[moduleId] = {
  14. /******/ i: moduleId,
  15. /******/ l: false,
  16. /******/ exports: {}
  17. /******/ };
  18. /******/
  19. /******/ // Execute the module function
  20. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  21. /******/
  22. /******/ // Flag the module as loaded
  23. /******/ module.l = true;
  24. /******/
  25. /******/ // Return the exports of the module
  26. /******/ return module.exports;
  27. /******/ }
  28. /******/
  29. /******/
  30. /******/ // expose the modules object (__webpack_modules__)
  31. /******/ __webpack_require__.m = modules;
  32. /******/
  33. /******/ // expose the module cache
  34. /******/ __webpack_require__.c = installedModules;
  35. /******/
  36. /******/ // define getter function for harmony exports
  37. /******/ __webpack_require__.d = function(exports, name, getter) {
  38. /******/ if(!__webpack_require__.o(exports, name)) {
  39. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  40. /******/ }
  41. /******/ };
  42. /******/
  43. /******/ // define __esModule on exports
  44. /******/ __webpack_require__.r = function(exports) {
  45. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  46. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  47. /******/ }
  48. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  49. /******/ };
  50. /******/
  51. /******/ // create a fake namespace object
  52. /******/ // mode & 1: value is a module id, require it
  53. /******/ // mode & 2: merge all properties of value into the ns
  54. /******/ // mode & 4: return value when already ns object
  55. /******/ // mode & 8|1: behave like require
  56. /******/ __webpack_require__.t = function(value, mode) {
  57. /******/ if(mode & 1) value = __webpack_require__(value);
  58. /******/ if(mode & 8) return value;
  59. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  60. /******/ var ns = Object.create(null);
  61. /******/ __webpack_require__.r(ns);
  62. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  63. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  64. /******/ return ns;
  65. /******/ };
  66. /******/
  67. /******/ // getDefaultExport function for compatibility with non-harmony modules
  68. /******/ __webpack_require__.n = function(module) {
  69. /******/ var getter = module && module.__esModule ?
  70. /******/ function getDefault() { return module['default']; } :
  71. /******/ function getModuleExports() { return module; };
  72. /******/ __webpack_require__.d(getter, 'a', getter);
  73. /******/ return getter;
  74. /******/ };
  75. /******/
  76. /******/ // Object.prototype.hasOwnProperty.call
  77. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  78. /******/
  79. /******/ // __webpack_public_path__
  80. /******/ __webpack_require__.p = "/";
  81. /******/
  82. /******/
  83. /******/ // Load entry module and return exports
  84. /******/ return __webpack_require__(__webpack_require__.s = 0);
  85. /******/ })
  86. /************************************************************************/
  87. /******/ ({
  88. /***/ "./node_modules/axios/index.js":
  89. /*!*************************************!*\
  90. !*** ./node_modules/axios/index.js ***!
  91. \*************************************/
  92. /*! no static exports found */
  93. /***/ (function(module, exports, __webpack_require__) {
  94. module.exports = __webpack_require__(/*! ./lib/axios */ "./node_modules/axios/lib/axios.js");
  95. /***/ }),
  96. /***/ "./node_modules/axios/lib/adapters/xhr.js":
  97. /*!************************************************!*\
  98. !*** ./node_modules/axios/lib/adapters/xhr.js ***!
  99. \************************************************/
  100. /*! no static exports found */
  101. /***/ (function(module, exports, __webpack_require__) {
  102. "use strict";
  103. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  104. var settle = __webpack_require__(/*! ./../core/settle */ "./node_modules/axios/lib/core/settle.js");
  105. var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  106. var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./node_modules/axios/lib/core/buildFullPath.js");
  107. var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./node_modules/axios/lib/helpers/parseHeaders.js");
  108. var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./node_modules/axios/lib/helpers/isURLSameOrigin.js");
  109. var createError = __webpack_require__(/*! ../core/createError */ "./node_modules/axios/lib/core/createError.js");
  110. module.exports = function xhrAdapter(config) {
  111. return new Promise(function dispatchXhrRequest(resolve, reject) {
  112. var requestData = config.data;
  113. var requestHeaders = config.headers;
  114. if (utils.isFormData(requestData)) {
  115. delete requestHeaders['Content-Type']; // Let the browser set it
  116. }
  117. var request = new XMLHttpRequest();
  118. // HTTP basic authentication
  119. if (config.auth) {
  120. var username = config.auth.username || '';
  121. var password = config.auth.password || '';
  122. requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  123. }
  124. var fullPath = buildFullPath(config.baseURL, config.url);
  125. request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
  126. // Set the request timeout in MS
  127. request.timeout = config.timeout;
  128. // Listen for ready state
  129. request.onreadystatechange = function handleLoad() {
  130. if (!request || request.readyState !== 4) {
  131. return;
  132. }
  133. // The request errored out and we didn't get a response, this will be
  134. // handled by onerror instead
  135. // With one exception: request that using file: protocol, most browsers
  136. // will return status as 0 even though it's a successful request
  137. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  138. return;
  139. }
  140. // Prepare the response
  141. var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  142. var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
  143. var response = {
  144. data: responseData,
  145. status: request.status,
  146. statusText: request.statusText,
  147. headers: responseHeaders,
  148. config: config,
  149. request: request
  150. };
  151. settle(resolve, reject, response);
  152. // Clean up request
  153. request = null;
  154. };
  155. // Handle browser request cancellation (as opposed to a manual cancellation)
  156. request.onabort = function handleAbort() {
  157. if (!request) {
  158. return;
  159. }
  160. reject(createError('Request aborted', config, 'ECONNABORTED', request));
  161. // Clean up request
  162. request = null;
  163. };
  164. // Handle low level network errors
  165. request.onerror = function handleError() {
  166. // Real errors are hidden from us by the browser
  167. // onerror should only fire if it's a network error
  168. reject(createError('Network Error', config, null, request));
  169. // Clean up request
  170. request = null;
  171. };
  172. // Handle timeout
  173. request.ontimeout = function handleTimeout() {
  174. var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
  175. if (config.timeoutErrorMessage) {
  176. timeoutErrorMessage = config.timeoutErrorMessage;
  177. }
  178. reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
  179. request));
  180. // Clean up request
  181. request = null;
  182. };
  183. // Add xsrf header
  184. // This is only done if running in a standard browser environment.
  185. // Specifically not if we're in a web worker, or react-native.
  186. if (utils.isStandardBrowserEnv()) {
  187. var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/axios/lib/helpers/cookies.js");
  188. // Add xsrf header
  189. var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
  190. cookies.read(config.xsrfCookieName) :
  191. undefined;
  192. if (xsrfValue) {
  193. requestHeaders[config.xsrfHeaderName] = xsrfValue;
  194. }
  195. }
  196. // Add headers to the request
  197. if ('setRequestHeader' in request) {
  198. utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  199. if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  200. // Remove Content-Type if data is undefined
  201. delete requestHeaders[key];
  202. } else {
  203. // Otherwise add header to the request
  204. request.setRequestHeader(key, val);
  205. }
  206. });
  207. }
  208. // Add withCredentials to request if needed
  209. if (!utils.isUndefined(config.withCredentials)) {
  210. request.withCredentials = !!config.withCredentials;
  211. }
  212. // Add responseType to request if needed
  213. if (config.responseType) {
  214. try {
  215. request.responseType = config.responseType;
  216. } catch (e) {
  217. // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
  218. // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
  219. if (config.responseType !== 'json') {
  220. throw e;
  221. }
  222. }
  223. }
  224. // Handle progress if needed
  225. if (typeof config.onDownloadProgress === 'function') {
  226. request.addEventListener('progress', config.onDownloadProgress);
  227. }
  228. // Not all browsers support upload events
  229. if (typeof config.onUploadProgress === 'function' && request.upload) {
  230. request.upload.addEventListener('progress', config.onUploadProgress);
  231. }
  232. if (config.cancelToken) {
  233. // Handle cancellation
  234. config.cancelToken.promise.then(function onCanceled(cancel) {
  235. if (!request) {
  236. return;
  237. }
  238. request.abort();
  239. reject(cancel);
  240. // Clean up request
  241. request = null;
  242. });
  243. }
  244. if (requestData === undefined) {
  245. requestData = null;
  246. }
  247. // Send the request
  248. request.send(requestData);
  249. });
  250. };
  251. /***/ }),
  252. /***/ "./node_modules/axios/lib/axios.js":
  253. /*!*****************************************!*\
  254. !*** ./node_modules/axios/lib/axios.js ***!
  255. \*****************************************/
  256. /*! no static exports found */
  257. /***/ (function(module, exports, __webpack_require__) {
  258. "use strict";
  259. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  260. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  261. var Axios = __webpack_require__(/*! ./core/Axios */ "./node_modules/axios/lib/core/Axios.js");
  262. var mergeConfig = __webpack_require__(/*! ./core/mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  263. var defaults = __webpack_require__(/*! ./defaults */ "./node_modules/axios/lib/defaults.js");
  264. /**
  265. * Create an instance of Axios
  266. *
  267. * @param {Object} defaultConfig The default config for the instance
  268. * @return {Axios} A new instance of Axios
  269. */
  270. function createInstance(defaultConfig) {
  271. var context = new Axios(defaultConfig);
  272. var instance = bind(Axios.prototype.request, context);
  273. // Copy axios.prototype to instance
  274. utils.extend(instance, Axios.prototype, context);
  275. // Copy context to instance
  276. utils.extend(instance, context);
  277. return instance;
  278. }
  279. // Create the default instance to be exported
  280. var axios = createInstance(defaults);
  281. // Expose Axios class to allow class inheritance
  282. axios.Axios = Axios;
  283. // Factory for creating new instances
  284. axios.create = function create(instanceConfig) {
  285. return createInstance(mergeConfig(axios.defaults, instanceConfig));
  286. };
  287. // Expose Cancel & CancelToken
  288. axios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  289. axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./node_modules/axios/lib/cancel/CancelToken.js");
  290. axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  291. // Expose all/spread
  292. axios.all = function all(promises) {
  293. return Promise.all(promises);
  294. };
  295. axios.spread = __webpack_require__(/*! ./helpers/spread */ "./node_modules/axios/lib/helpers/spread.js");
  296. module.exports = axios;
  297. // Allow use of default import syntax in TypeScript
  298. module.exports.default = axios;
  299. /***/ }),
  300. /***/ "./node_modules/axios/lib/cancel/Cancel.js":
  301. /*!*************************************************!*\
  302. !*** ./node_modules/axios/lib/cancel/Cancel.js ***!
  303. \*************************************************/
  304. /*! no static exports found */
  305. /***/ (function(module, exports, __webpack_require__) {
  306. "use strict";
  307. /**
  308. * A `Cancel` is an object that is thrown when an operation is canceled.
  309. *
  310. * @class
  311. * @param {string=} message The message.
  312. */
  313. function Cancel(message) {
  314. this.message = message;
  315. }
  316. Cancel.prototype.toString = function toString() {
  317. return 'Cancel' + (this.message ? ': ' + this.message : '');
  318. };
  319. Cancel.prototype.__CANCEL__ = true;
  320. module.exports = Cancel;
  321. /***/ }),
  322. /***/ "./node_modules/axios/lib/cancel/CancelToken.js":
  323. /*!******************************************************!*\
  324. !*** ./node_modules/axios/lib/cancel/CancelToken.js ***!
  325. \******************************************************/
  326. /*! no static exports found */
  327. /***/ (function(module, exports, __webpack_require__) {
  328. "use strict";
  329. var Cancel = __webpack_require__(/*! ./Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  330. /**
  331. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  332. *
  333. * @class
  334. * @param {Function} executor The executor function.
  335. */
  336. function CancelToken(executor) {
  337. if (typeof executor !== 'function') {
  338. throw new TypeError('executor must be a function.');
  339. }
  340. var resolvePromise;
  341. this.promise = new Promise(function promiseExecutor(resolve) {
  342. resolvePromise = resolve;
  343. });
  344. var token = this;
  345. executor(function cancel(message) {
  346. if (token.reason) {
  347. // Cancellation has already been requested
  348. return;
  349. }
  350. token.reason = new Cancel(message);
  351. resolvePromise(token.reason);
  352. });
  353. }
  354. /**
  355. * Throws a `Cancel` if cancellation has been requested.
  356. */
  357. CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  358. if (this.reason) {
  359. throw this.reason;
  360. }
  361. };
  362. /**
  363. * Returns an object that contains a new `CancelToken` and a function that, when called,
  364. * cancels the `CancelToken`.
  365. */
  366. CancelToken.source = function source() {
  367. var cancel;
  368. var token = new CancelToken(function executor(c) {
  369. cancel = c;
  370. });
  371. return {
  372. token: token,
  373. cancel: cancel
  374. };
  375. };
  376. module.exports = CancelToken;
  377. /***/ }),
  378. /***/ "./node_modules/axios/lib/cancel/isCancel.js":
  379. /*!***************************************************!*\
  380. !*** ./node_modules/axios/lib/cancel/isCancel.js ***!
  381. \***************************************************/
  382. /*! no static exports found */
  383. /***/ (function(module, exports, __webpack_require__) {
  384. "use strict";
  385. module.exports = function isCancel(value) {
  386. return !!(value && value.__CANCEL__);
  387. };
  388. /***/ }),
  389. /***/ "./node_modules/axios/lib/core/Axios.js":
  390. /*!**********************************************!*\
  391. !*** ./node_modules/axios/lib/core/Axios.js ***!
  392. \**********************************************/
  393. /*! no static exports found */
  394. /***/ (function(module, exports, __webpack_require__) {
  395. "use strict";
  396. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  397. var buildURL = __webpack_require__(/*! ../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  398. var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./node_modules/axios/lib/core/InterceptorManager.js");
  399. var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./node_modules/axios/lib/core/dispatchRequest.js");
  400. var mergeConfig = __webpack_require__(/*! ./mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  401. /**
  402. * Create a new instance of Axios
  403. *
  404. * @param {Object} instanceConfig The default config for the instance
  405. */
  406. function Axios(instanceConfig) {
  407. this.defaults = instanceConfig;
  408. this.interceptors = {
  409. request: new InterceptorManager(),
  410. response: new InterceptorManager()
  411. };
  412. }
  413. /**
  414. * Dispatch a request
  415. *
  416. * @param {Object} config The config specific for this request (merged with this.defaults)
  417. */
  418. Axios.prototype.request = function request(config) {
  419. /*eslint no-param-reassign:0*/
  420. // Allow for axios('example/url'[, config]) a la fetch API
  421. if (typeof config === 'string') {
  422. config = arguments[1] || {};
  423. config.url = arguments[0];
  424. } else {
  425. config = config || {};
  426. }
  427. config = mergeConfig(this.defaults, config);
  428. // Set config.method
  429. if (config.method) {
  430. config.method = config.method.toLowerCase();
  431. } else if (this.defaults.method) {
  432. config.method = this.defaults.method.toLowerCase();
  433. } else {
  434. config.method = 'get';
  435. }
  436. // Hook up interceptors middleware
  437. var chain = [dispatchRequest, undefined];
  438. var promise = Promise.resolve(config);
  439. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  440. chain.unshift(interceptor.fulfilled, interceptor.rejected);
  441. });
  442. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  443. chain.push(interceptor.fulfilled, interceptor.rejected);
  444. });
  445. while (chain.length) {
  446. promise = promise.then(chain.shift(), chain.shift());
  447. }
  448. return promise;
  449. };
  450. Axios.prototype.getUri = function getUri(config) {
  451. config = mergeConfig(this.defaults, config);
  452. return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
  453. };
  454. // Provide aliases for supported request methods
  455. utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  456. /*eslint func-names:0*/
  457. Axios.prototype[method] = function(url, config) {
  458. return this.request(utils.merge(config || {}, {
  459. method: method,
  460. url: url
  461. }));
  462. };
  463. });
  464. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  465. /*eslint func-names:0*/
  466. Axios.prototype[method] = function(url, data, config) {
  467. return this.request(utils.merge(config || {}, {
  468. method: method,
  469. url: url,
  470. data: data
  471. }));
  472. };
  473. });
  474. module.exports = Axios;
  475. /***/ }),
  476. /***/ "./node_modules/axios/lib/core/InterceptorManager.js":
  477. /*!***********************************************************!*\
  478. !*** ./node_modules/axios/lib/core/InterceptorManager.js ***!
  479. \***********************************************************/
  480. /*! no static exports found */
  481. /***/ (function(module, exports, __webpack_require__) {
  482. "use strict";
  483. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  484. function InterceptorManager() {
  485. this.handlers = [];
  486. }
  487. /**
  488. * Add a new interceptor to the stack
  489. *
  490. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  491. * @param {Function} rejected The function to handle `reject` for a `Promise`
  492. *
  493. * @return {Number} An ID used to remove interceptor later
  494. */
  495. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  496. this.handlers.push({
  497. fulfilled: fulfilled,
  498. rejected: rejected
  499. });
  500. return this.handlers.length - 1;
  501. };
  502. /**
  503. * Remove an interceptor from the stack
  504. *
  505. * @param {Number} id The ID that was returned by `use`
  506. */
  507. InterceptorManager.prototype.eject = function eject(id) {
  508. if (this.handlers[id]) {
  509. this.handlers[id] = null;
  510. }
  511. };
  512. /**
  513. * Iterate over all the registered interceptors
  514. *
  515. * This method is particularly useful for skipping over any
  516. * interceptors that may have become `null` calling `eject`.
  517. *
  518. * @param {Function} fn The function to call for each interceptor
  519. */
  520. InterceptorManager.prototype.forEach = function forEach(fn) {
  521. utils.forEach(this.handlers, function forEachHandler(h) {
  522. if (h !== null) {
  523. fn(h);
  524. }
  525. });
  526. };
  527. module.exports = InterceptorManager;
  528. /***/ }),
  529. /***/ "./node_modules/axios/lib/core/buildFullPath.js":
  530. /*!******************************************************!*\
  531. !*** ./node_modules/axios/lib/core/buildFullPath.js ***!
  532. \******************************************************/
  533. /*! no static exports found */
  534. /***/ (function(module, exports, __webpack_require__) {
  535. "use strict";
  536. var isAbsoluteURL = __webpack_require__(/*! ../helpers/isAbsoluteURL */ "./node_modules/axios/lib/helpers/isAbsoluteURL.js");
  537. var combineURLs = __webpack_require__(/*! ../helpers/combineURLs */ "./node_modules/axios/lib/helpers/combineURLs.js");
  538. /**
  539. * Creates a new URL by combining the baseURL with the requestedURL,
  540. * only when the requestedURL is not already an absolute URL.
  541. * If the requestURL is absolute, this function returns the requestedURL untouched.
  542. *
  543. * @param {string} baseURL The base URL
  544. * @param {string} requestedURL Absolute or relative URL to combine
  545. * @returns {string} The combined full path
  546. */
  547. module.exports = function buildFullPath(baseURL, requestedURL) {
  548. if (baseURL && !isAbsoluteURL(requestedURL)) {
  549. return combineURLs(baseURL, requestedURL);
  550. }
  551. return requestedURL;
  552. };
  553. /***/ }),
  554. /***/ "./node_modules/axios/lib/core/createError.js":
  555. /*!****************************************************!*\
  556. !*** ./node_modules/axios/lib/core/createError.js ***!
  557. \****************************************************/
  558. /*! no static exports found */
  559. /***/ (function(module, exports, __webpack_require__) {
  560. "use strict";
  561. var enhanceError = __webpack_require__(/*! ./enhanceError */ "./node_modules/axios/lib/core/enhanceError.js");
  562. /**
  563. * Create an Error with the specified message, config, error code, request and response.
  564. *
  565. * @param {string} message The error message.
  566. * @param {Object} config The config.
  567. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  568. * @param {Object} [request] The request.
  569. * @param {Object} [response] The response.
  570. * @returns {Error} The created error.
  571. */
  572. module.exports = function createError(message, config, code, request, response) {
  573. var error = new Error(message);
  574. return enhanceError(error, config, code, request, response);
  575. };
  576. /***/ }),
  577. /***/ "./node_modules/axios/lib/core/dispatchRequest.js":
  578. /*!********************************************************!*\
  579. !*** ./node_modules/axios/lib/core/dispatchRequest.js ***!
  580. \********************************************************/
  581. /*! no static exports found */
  582. /***/ (function(module, exports, __webpack_require__) {
  583. "use strict";
  584. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  585. var transformData = __webpack_require__(/*! ./transformData */ "./node_modules/axios/lib/core/transformData.js");
  586. var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  587. var defaults = __webpack_require__(/*! ../defaults */ "./node_modules/axios/lib/defaults.js");
  588. /**
  589. * Throws a `Cancel` if cancellation has been requested.
  590. */
  591. function throwIfCancellationRequested(config) {
  592. if (config.cancelToken) {
  593. config.cancelToken.throwIfRequested();
  594. }
  595. }
  596. /**
  597. * Dispatch a request to the server using the configured adapter.
  598. *
  599. * @param {object} config The config that is to be used for the request
  600. * @returns {Promise} The Promise to be fulfilled
  601. */
  602. module.exports = function dispatchRequest(config) {
  603. throwIfCancellationRequested(config);
  604. // Ensure headers exist
  605. config.headers = config.headers || {};
  606. // Transform request data
  607. config.data = transformData(
  608. config.data,
  609. config.headers,
  610. config.transformRequest
  611. );
  612. // Flatten headers
  613. config.headers = utils.merge(
  614. config.headers.common || {},
  615. config.headers[config.method] || {},
  616. config.headers
  617. );
  618. utils.forEach(
  619. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  620. function cleanHeaderConfig(method) {
  621. delete config.headers[method];
  622. }
  623. );
  624. var adapter = config.adapter || defaults.adapter;
  625. return adapter(config).then(function onAdapterResolution(response) {
  626. throwIfCancellationRequested(config);
  627. // Transform response data
  628. response.data = transformData(
  629. response.data,
  630. response.headers,
  631. config.transformResponse
  632. );
  633. return response;
  634. }, function onAdapterRejection(reason) {
  635. if (!isCancel(reason)) {
  636. throwIfCancellationRequested(config);
  637. // Transform response data
  638. if (reason && reason.response) {
  639. reason.response.data = transformData(
  640. reason.response.data,
  641. reason.response.headers,
  642. config.transformResponse
  643. );
  644. }
  645. }
  646. return Promise.reject(reason);
  647. });
  648. };
  649. /***/ }),
  650. /***/ "./node_modules/axios/lib/core/enhanceError.js":
  651. /*!*****************************************************!*\
  652. !*** ./node_modules/axios/lib/core/enhanceError.js ***!
  653. \*****************************************************/
  654. /*! no static exports found */
  655. /***/ (function(module, exports, __webpack_require__) {
  656. "use strict";
  657. /**
  658. * Update an Error with the specified config, error code, and response.
  659. *
  660. * @param {Error} error The error to update.
  661. * @param {Object} config The config.
  662. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  663. * @param {Object} [request] The request.
  664. * @param {Object} [response] The response.
  665. * @returns {Error} The error.
  666. */
  667. module.exports = function enhanceError(error, config, code, request, response) {
  668. error.config = config;
  669. if (code) {
  670. error.code = code;
  671. }
  672. error.request = request;
  673. error.response = response;
  674. error.isAxiosError = true;
  675. error.toJSON = function() {
  676. return {
  677. // Standard
  678. message: this.message,
  679. name: this.name,
  680. // Microsoft
  681. description: this.description,
  682. number: this.number,
  683. // Mozilla
  684. fileName: this.fileName,
  685. lineNumber: this.lineNumber,
  686. columnNumber: this.columnNumber,
  687. stack: this.stack,
  688. // Axios
  689. config: this.config,
  690. code: this.code
  691. };
  692. };
  693. return error;
  694. };
  695. /***/ }),
  696. /***/ "./node_modules/axios/lib/core/mergeConfig.js":
  697. /*!****************************************************!*\
  698. !*** ./node_modules/axios/lib/core/mergeConfig.js ***!
  699. \****************************************************/
  700. /*! no static exports found */
  701. /***/ (function(module, exports, __webpack_require__) {
  702. "use strict";
  703. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  704. /**
  705. * Config-specific merge-function which creates a new config-object
  706. * by merging two configuration objects together.
  707. *
  708. * @param {Object} config1
  709. * @param {Object} config2
  710. * @returns {Object} New object resulting from merging config2 to config1
  711. */
  712. module.exports = function mergeConfig(config1, config2) {
  713. // eslint-disable-next-line no-param-reassign
  714. config2 = config2 || {};
  715. var config = {};
  716. var valueFromConfig2Keys = ['url', 'method', 'params', 'data'];
  717. var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy'];
  718. var defaultToConfig2Keys = [
  719. 'baseURL', 'url', 'transformRequest', 'transformResponse', 'paramsSerializer',
  720. 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
  721. 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress',
  722. 'maxContentLength', 'validateStatus', 'maxRedirects', 'httpAgent',
  723. 'httpsAgent', 'cancelToken', 'socketPath'
  724. ];
  725. utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
  726. if (typeof config2[prop] !== 'undefined') {
  727. config[prop] = config2[prop];
  728. }
  729. });
  730. utils.forEach(mergeDeepPropertiesKeys, function mergeDeepProperties(prop) {
  731. if (utils.isObject(config2[prop])) {
  732. config[prop] = utils.deepMerge(config1[prop], config2[prop]);
  733. } else if (typeof config2[prop] !== 'undefined') {
  734. config[prop] = config2[prop];
  735. } else if (utils.isObject(config1[prop])) {
  736. config[prop] = utils.deepMerge(config1[prop]);
  737. } else if (typeof config1[prop] !== 'undefined') {
  738. config[prop] = config1[prop];
  739. }
  740. });
  741. utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
  742. if (typeof config2[prop] !== 'undefined') {
  743. config[prop] = config2[prop];
  744. } else if (typeof config1[prop] !== 'undefined') {
  745. config[prop] = config1[prop];
  746. }
  747. });
  748. var axiosKeys = valueFromConfig2Keys
  749. .concat(mergeDeepPropertiesKeys)
  750. .concat(defaultToConfig2Keys);
  751. var otherKeys = Object
  752. .keys(config2)
  753. .filter(function filterAxiosKeys(key) {
  754. return axiosKeys.indexOf(key) === -1;
  755. });
  756. utils.forEach(otherKeys, function otherKeysDefaultToConfig2(prop) {
  757. if (typeof config2[prop] !== 'undefined') {
  758. config[prop] = config2[prop];
  759. } else if (typeof config1[prop] !== 'undefined') {
  760. config[prop] = config1[prop];
  761. }
  762. });
  763. return config;
  764. };
  765. /***/ }),
  766. /***/ "./node_modules/axios/lib/core/settle.js":
  767. /*!***********************************************!*\
  768. !*** ./node_modules/axios/lib/core/settle.js ***!
  769. \***********************************************/
  770. /*! no static exports found */
  771. /***/ (function(module, exports, __webpack_require__) {
  772. "use strict";
  773. var createError = __webpack_require__(/*! ./createError */ "./node_modules/axios/lib/core/createError.js");
  774. /**
  775. * Resolve or reject a Promise based on response status.
  776. *
  777. * @param {Function} resolve A function that resolves the promise.
  778. * @param {Function} reject A function that rejects the promise.
  779. * @param {object} response The response.
  780. */
  781. module.exports = function settle(resolve, reject, response) {
  782. var validateStatus = response.config.validateStatus;
  783. if (!validateStatus || validateStatus(response.status)) {
  784. resolve(response);
  785. } else {
  786. reject(createError(
  787. 'Request failed with status code ' + response.status,
  788. response.config,
  789. null,
  790. response.request,
  791. response
  792. ));
  793. }
  794. };
  795. /***/ }),
  796. /***/ "./node_modules/axios/lib/core/transformData.js":
  797. /*!******************************************************!*\
  798. !*** ./node_modules/axios/lib/core/transformData.js ***!
  799. \******************************************************/
  800. /*! no static exports found */
  801. /***/ (function(module, exports, __webpack_require__) {
  802. "use strict";
  803. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  804. /**
  805. * Transform the data for a request or a response
  806. *
  807. * @param {Object|String} data The data to be transformed
  808. * @param {Array} headers The headers for the request or response
  809. * @param {Array|Function} fns A single function or Array of functions
  810. * @returns {*} The resulting transformed data
  811. */
  812. module.exports = function transformData(data, headers, fns) {
  813. /*eslint no-param-reassign:0*/
  814. utils.forEach(fns, function transform(fn) {
  815. data = fn(data, headers);
  816. });
  817. return data;
  818. };
  819. /***/ }),
  820. /***/ "./node_modules/axios/lib/defaults.js":
  821. /*!********************************************!*\
  822. !*** ./node_modules/axios/lib/defaults.js ***!
  823. \********************************************/
  824. /*! no static exports found */
  825. /***/ (function(module, exports, __webpack_require__) {
  826. "use strict";
  827. /* WEBPACK VAR INJECTION */(function(process) {
  828. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  829. var normalizeHeaderName = __webpack_require__(/*! ./helpers/normalizeHeaderName */ "./node_modules/axios/lib/helpers/normalizeHeaderName.js");
  830. var DEFAULT_CONTENT_TYPE = {
  831. 'Content-Type': 'application/x-www-form-urlencoded'
  832. };
  833. function setContentTypeIfUnset(headers, value) {
  834. if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  835. headers['Content-Type'] = value;
  836. }
  837. }
  838. function getDefaultAdapter() {
  839. var adapter;
  840. if (typeof XMLHttpRequest !== 'undefined') {
  841. // For browsers use XHR adapter
  842. adapter = __webpack_require__(/*! ./adapters/xhr */ "./node_modules/axios/lib/adapters/xhr.js");
  843. } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
  844. // For node use HTTP adapter
  845. adapter = __webpack_require__(/*! ./adapters/http */ "./node_modules/axios/lib/adapters/xhr.js");
  846. }
  847. return adapter;
  848. }
  849. var defaults = {
  850. adapter: getDefaultAdapter(),
  851. transformRequest: [function transformRequest(data, headers) {
  852. normalizeHeaderName(headers, 'Accept');
  853. normalizeHeaderName(headers, 'Content-Type');
  854. if (utils.isFormData(data) ||
  855. utils.isArrayBuffer(data) ||
  856. utils.isBuffer(data) ||
  857. utils.isStream(data) ||
  858. utils.isFile(data) ||
  859. utils.isBlob(data)
  860. ) {
  861. return data;
  862. }
  863. if (utils.isArrayBufferView(data)) {
  864. return data.buffer;
  865. }
  866. if (utils.isURLSearchParams(data)) {
  867. setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  868. return data.toString();
  869. }
  870. if (utils.isObject(data)) {
  871. setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
  872. return JSON.stringify(data);
  873. }
  874. return data;
  875. }],
  876. transformResponse: [function transformResponse(data) {
  877. /*eslint no-param-reassign:0*/
  878. if (typeof data === 'string') {
  879. try {
  880. data = JSON.parse(data);
  881. } catch (e) { /* Ignore */ }
  882. }
  883. return data;
  884. }],
  885. /**
  886. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  887. * timeout is not created.
  888. */
  889. timeout: 0,
  890. xsrfCookieName: 'XSRF-TOKEN',
  891. xsrfHeaderName: 'X-XSRF-TOKEN',
  892. maxContentLength: -1,
  893. validateStatus: function validateStatus(status) {
  894. return status >= 200 && status < 300;
  895. }
  896. };
  897. defaults.headers = {
  898. common: {
  899. 'Accept': 'application/json, text/plain, */*'
  900. }
  901. };
  902. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  903. defaults.headers[method] = {};
  904. });
  905. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  906. defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
  907. });
  908. module.exports = defaults;
  909. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js")))
  910. /***/ }),
  911. /***/ "./node_modules/axios/lib/helpers/bind.js":
  912. /*!************************************************!*\
  913. !*** ./node_modules/axios/lib/helpers/bind.js ***!
  914. \************************************************/
  915. /*! no static exports found */
  916. /***/ (function(module, exports, __webpack_require__) {
  917. "use strict";
  918. module.exports = function bind(fn, thisArg) {
  919. return function wrap() {
  920. var args = new Array(arguments.length);
  921. for (var i = 0; i < args.length; i++) {
  922. args[i] = arguments[i];
  923. }
  924. return fn.apply(thisArg, args);
  925. };
  926. };
  927. /***/ }),
  928. /***/ "./node_modules/axios/lib/helpers/buildURL.js":
  929. /*!****************************************************!*\
  930. !*** ./node_modules/axios/lib/helpers/buildURL.js ***!
  931. \****************************************************/
  932. /*! no static exports found */
  933. /***/ (function(module, exports, __webpack_require__) {
  934. "use strict";
  935. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  936. function encode(val) {
  937. return encodeURIComponent(val).
  938. replace(/%40/gi, '@').
  939. replace(/%3A/gi, ':').
  940. replace(/%24/g, '$').
  941. replace(/%2C/gi, ',').
  942. replace(/%20/g, '+').
  943. replace(/%5B/gi, '[').
  944. replace(/%5D/gi, ']');
  945. }
  946. /**
  947. * Build a URL by appending params to the end
  948. *
  949. * @param {string} url The base of the url (e.g., http://www.google.com)
  950. * @param {object} [params] The params to be appended
  951. * @returns {string} The formatted url
  952. */
  953. module.exports = function buildURL(url, params, paramsSerializer) {
  954. /*eslint no-param-reassign:0*/
  955. if (!params) {
  956. return url;
  957. }
  958. var serializedParams;
  959. if (paramsSerializer) {
  960. serializedParams = paramsSerializer(params);
  961. } else if (utils.isURLSearchParams(params)) {
  962. serializedParams = params.toString();
  963. } else {
  964. var parts = [];
  965. utils.forEach(params, function serialize(val, key) {
  966. if (val === null || typeof val === 'undefined') {
  967. return;
  968. }
  969. if (utils.isArray(val)) {
  970. key = key + '[]';
  971. } else {
  972. val = [val];
  973. }
  974. utils.forEach(val, function parseValue(v) {
  975. if (utils.isDate(v)) {
  976. v = v.toISOString();
  977. } else if (utils.isObject(v)) {
  978. v = JSON.stringify(v);
  979. }
  980. parts.push(encode(key) + '=' + encode(v));
  981. });
  982. });
  983. serializedParams = parts.join('&');
  984. }
  985. if (serializedParams) {
  986. var hashmarkIndex = url.indexOf('#');
  987. if (hashmarkIndex !== -1) {
  988. url = url.slice(0, hashmarkIndex);
  989. }
  990. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  991. }
  992. return url;
  993. };
  994. /***/ }),
  995. /***/ "./node_modules/axios/lib/helpers/combineURLs.js":
  996. /*!*******************************************************!*\
  997. !*** ./node_modules/axios/lib/helpers/combineURLs.js ***!
  998. \*******************************************************/
  999. /*! no static exports found */
  1000. /***/ (function(module, exports, __webpack_require__) {
  1001. "use strict";
  1002. /**
  1003. * Creates a new URL by combining the specified URLs
  1004. *
  1005. * @param {string} baseURL The base URL
  1006. * @param {string} relativeURL The relative URL
  1007. * @returns {string} The combined URL
  1008. */
  1009. module.exports = function combineURLs(baseURL, relativeURL) {
  1010. return relativeURL
  1011. ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
  1012. : baseURL;
  1013. };
  1014. /***/ }),
  1015. /***/ "./node_modules/axios/lib/helpers/cookies.js":
  1016. /*!***************************************************!*\
  1017. !*** ./node_modules/axios/lib/helpers/cookies.js ***!
  1018. \***************************************************/
  1019. /*! no static exports found */
  1020. /***/ (function(module, exports, __webpack_require__) {
  1021. "use strict";
  1022. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1023. module.exports = (
  1024. utils.isStandardBrowserEnv() ?
  1025. // Standard browser envs support document.cookie
  1026. (function standardBrowserEnv() {
  1027. return {
  1028. write: function write(name, value, expires, path, domain, secure) {
  1029. var cookie = [];
  1030. cookie.push(name + '=' + encodeURIComponent(value));
  1031. if (utils.isNumber(expires)) {
  1032. cookie.push('expires=' + new Date(expires).toGMTString());
  1033. }
  1034. if (utils.isString(path)) {
  1035. cookie.push('path=' + path);
  1036. }
  1037. if (utils.isString(domain)) {
  1038. cookie.push('domain=' + domain);
  1039. }
  1040. if (secure === true) {
  1041. cookie.push('secure');
  1042. }
  1043. document.cookie = cookie.join('; ');
  1044. },
  1045. read: function read(name) {
  1046. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  1047. return (match ? decodeURIComponent(match[3]) : null);
  1048. },
  1049. remove: function remove(name) {
  1050. this.write(name, '', Date.now() - 86400000);
  1051. }
  1052. };
  1053. })() :
  1054. // Non standard browser env (web workers, react-native) lack needed support.
  1055. (function nonStandardBrowserEnv() {
  1056. return {
  1057. write: function write() {},
  1058. read: function read() { return null; },
  1059. remove: function remove() {}
  1060. };
  1061. })()
  1062. );
  1063. /***/ }),
  1064. /***/ "./node_modules/axios/lib/helpers/isAbsoluteURL.js":
  1065. /*!*********************************************************!*\
  1066. !*** ./node_modules/axios/lib/helpers/isAbsoluteURL.js ***!
  1067. \*********************************************************/
  1068. /*! no static exports found */
  1069. /***/ (function(module, exports, __webpack_require__) {
  1070. "use strict";
  1071. /**
  1072. * Determines whether the specified URL is absolute
  1073. *
  1074. * @param {string} url The URL to test
  1075. * @returns {boolean} True if the specified URL is absolute, otherwise false
  1076. */
  1077. module.exports = function isAbsoluteURL(url) {
  1078. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  1079. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  1080. // by any combination of letters, digits, plus, period, or hyphen.
  1081. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  1082. };
  1083. /***/ }),
  1084. /***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js":
  1085. /*!***********************************************************!*\
  1086. !*** ./node_modules/axios/lib/helpers/isURLSameOrigin.js ***!
  1087. \***********************************************************/
  1088. /*! no static exports found */
  1089. /***/ (function(module, exports, __webpack_require__) {
  1090. "use strict";
  1091. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1092. module.exports = (
  1093. utils.isStandardBrowserEnv() ?
  1094. // Standard browser envs have full support of the APIs needed to test
  1095. // whether the request URL is of the same origin as current location.
  1096. (function standardBrowserEnv() {
  1097. var msie = /(msie|trident)/i.test(navigator.userAgent);
  1098. var urlParsingNode = document.createElement('a');
  1099. var originURL;
  1100. /**
  1101. * Parse a URL to discover it's components
  1102. *
  1103. * @param {String} url The URL to be parsed
  1104. * @returns {Object}
  1105. */
  1106. function resolveURL(url) {
  1107. var href = url;
  1108. if (msie) {
  1109. // IE needs attribute set twice to normalize properties
  1110. urlParsingNode.setAttribute('href', href);
  1111. href = urlParsingNode.href;
  1112. }
  1113. urlParsingNode.setAttribute('href', href);
  1114. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  1115. return {
  1116. href: urlParsingNode.href,
  1117. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  1118. host: urlParsingNode.host,
  1119. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  1120. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  1121. hostname: urlParsingNode.hostname,
  1122. port: urlParsingNode.port,
  1123. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  1124. urlParsingNode.pathname :
  1125. '/' + urlParsingNode.pathname
  1126. };
  1127. }
  1128. originURL = resolveURL(window.location.href);
  1129. /**
  1130. * Determine if a URL shares the same origin as the current location
  1131. *
  1132. * @param {String} requestURL The URL to test
  1133. * @returns {boolean} True if URL shares the same origin, otherwise false
  1134. */
  1135. return function isURLSameOrigin(requestURL) {
  1136. var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  1137. return (parsed.protocol === originURL.protocol &&
  1138. parsed.host === originURL.host);
  1139. };
  1140. })() :
  1141. // Non standard browser envs (web workers, react-native) lack needed support.
  1142. (function nonStandardBrowserEnv() {
  1143. return function isURLSameOrigin() {
  1144. return true;
  1145. };
  1146. })()
  1147. );
  1148. /***/ }),
  1149. /***/ "./node_modules/axios/lib/helpers/normalizeHeaderName.js":
  1150. /*!***************************************************************!*\
  1151. !*** ./node_modules/axios/lib/helpers/normalizeHeaderName.js ***!
  1152. \***************************************************************/
  1153. /*! no static exports found */
  1154. /***/ (function(module, exports, __webpack_require__) {
  1155. "use strict";
  1156. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  1157. module.exports = function normalizeHeaderName(headers, normalizedName) {
  1158. utils.forEach(headers, function processHeader(value, name) {
  1159. if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  1160. headers[normalizedName] = value;
  1161. delete headers[name];
  1162. }
  1163. });
  1164. };
  1165. /***/ }),
  1166. /***/ "./node_modules/axios/lib/helpers/parseHeaders.js":
  1167. /*!********************************************************!*\
  1168. !*** ./node_modules/axios/lib/helpers/parseHeaders.js ***!
  1169. \********************************************************/
  1170. /*! no static exports found */
  1171. /***/ (function(module, exports, __webpack_require__) {
  1172. "use strict";
  1173. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1174. // Headers whose duplicates are ignored by node
  1175. // c.f. https://nodejs.org/api/http.html#http_message_headers
  1176. var ignoreDuplicateOf = [
  1177. 'age', 'authorization', 'content-length', 'content-type', 'etag',
  1178. 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
  1179. 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
  1180. 'referer', 'retry-after', 'user-agent'
  1181. ];
  1182. /**
  1183. * Parse headers into an object
  1184. *
  1185. * ```
  1186. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  1187. * Content-Type: application/json
  1188. * Connection: keep-alive
  1189. * Transfer-Encoding: chunked
  1190. * ```
  1191. *
  1192. * @param {String} headers Headers needing to be parsed
  1193. * @returns {Object} Headers parsed into an object
  1194. */
  1195. module.exports = function parseHeaders(headers) {
  1196. var parsed = {};
  1197. var key;
  1198. var val;
  1199. var i;
  1200. if (!headers) { return parsed; }
  1201. utils.forEach(headers.split('\n'), function parser(line) {
  1202. i = line.indexOf(':');
  1203. key = utils.trim(line.substr(0, i)).toLowerCase();
  1204. val = utils.trim(line.substr(i + 1));
  1205. if (key) {
  1206. if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
  1207. return;
  1208. }
  1209. if (key === 'set-cookie') {
  1210. parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
  1211. } else {
  1212. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  1213. }
  1214. }
  1215. });
  1216. return parsed;
  1217. };
  1218. /***/ }),
  1219. /***/ "./node_modules/axios/lib/helpers/spread.js":
  1220. /*!**************************************************!*\
  1221. !*** ./node_modules/axios/lib/helpers/spread.js ***!
  1222. \**************************************************/
  1223. /*! no static exports found */
  1224. /***/ (function(module, exports, __webpack_require__) {
  1225. "use strict";
  1226. /**
  1227. * Syntactic sugar for invoking a function and expanding an array for arguments.
  1228. *
  1229. * Common use case would be to use `Function.prototype.apply`.
  1230. *
  1231. * ```js
  1232. * function f(x, y, z) {}
  1233. * var args = [1, 2, 3];
  1234. * f.apply(null, args);
  1235. * ```
  1236. *
  1237. * With `spread` this example can be re-written.
  1238. *
  1239. * ```js
  1240. * spread(function(x, y, z) {})([1, 2, 3]);
  1241. * ```
  1242. *
  1243. * @param {Function} callback
  1244. * @returns {Function}
  1245. */
  1246. module.exports = function spread(callback) {
  1247. return function wrap(arr) {
  1248. return callback.apply(null, arr);
  1249. };
  1250. };
  1251. /***/ }),
  1252. /***/ "./node_modules/axios/lib/utils.js":
  1253. /*!*****************************************!*\
  1254. !*** ./node_modules/axios/lib/utils.js ***!
  1255. \*****************************************/
  1256. /*! no static exports found */
  1257. /***/ (function(module, exports, __webpack_require__) {
  1258. "use strict";
  1259. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  1260. /*global toString:true*/
  1261. // utils is a library of generic helper functions non-specific to axios
  1262. var toString = Object.prototype.toString;
  1263. /**
  1264. * Determine if a value is an Array
  1265. *
  1266. * @param {Object} val The value to test
  1267. * @returns {boolean} True if value is an Array, otherwise false
  1268. */
  1269. function isArray(val) {
  1270. return toString.call(val) === '[object Array]';
  1271. }
  1272. /**
  1273. * Determine if a value is undefined
  1274. *
  1275. * @param {Object} val The value to test
  1276. * @returns {boolean} True if the value is undefined, otherwise false
  1277. */
  1278. function isUndefined(val) {
  1279. return typeof val === 'undefined';
  1280. }
  1281. /**
  1282. * Determine if a value is a Buffer
  1283. *
  1284. * @param {Object} val The value to test
  1285. * @returns {boolean} True if value is a Buffer, otherwise false
  1286. */
  1287. function isBuffer(val) {
  1288. return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
  1289. && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
  1290. }
  1291. /**
  1292. * Determine if a value is an ArrayBuffer
  1293. *
  1294. * @param {Object} val The value to test
  1295. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  1296. */
  1297. function isArrayBuffer(val) {
  1298. return toString.call(val) === '[object ArrayBuffer]';
  1299. }
  1300. /**
  1301. * Determine if a value is a FormData
  1302. *
  1303. * @param {Object} val The value to test
  1304. * @returns {boolean} True if value is an FormData, otherwise false
  1305. */
  1306. function isFormData(val) {
  1307. return (typeof FormData !== 'undefined') && (val instanceof FormData);
  1308. }
  1309. /**
  1310. * Determine if a value is a view on an ArrayBuffer
  1311. *
  1312. * @param {Object} val The value to test
  1313. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  1314. */
  1315. function isArrayBufferView(val) {
  1316. var result;
  1317. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  1318. result = ArrayBuffer.isView(val);
  1319. } else {
  1320. result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
  1321. }
  1322. return result;
  1323. }
  1324. /**
  1325. * Determine if a value is a String
  1326. *
  1327. * @param {Object} val The value to test
  1328. * @returns {boolean} True if value is a String, otherwise false
  1329. */
  1330. function isString(val) {
  1331. return typeof val === 'string';
  1332. }
  1333. /**
  1334. * Determine if a value is a Number
  1335. *
  1336. * @param {Object} val The value to test
  1337. * @returns {boolean} True if value is a Number, otherwise false
  1338. */
  1339. function isNumber(val) {
  1340. return typeof val === 'number';
  1341. }
  1342. /**
  1343. * Determine if a value is an Object
  1344. *
  1345. * @param {Object} val The value to test
  1346. * @returns {boolean} True if value is an Object, otherwise false
  1347. */
  1348. function isObject(val) {
  1349. return val !== null && typeof val === 'object';
  1350. }
  1351. /**
  1352. * Determine if a value is a Date
  1353. *
  1354. * @param {Object} val The value to test
  1355. * @returns {boolean} True if value is a Date, otherwise false
  1356. */
  1357. function isDate(val) {
  1358. return toString.call(val) === '[object Date]';
  1359. }
  1360. /**
  1361. * Determine if a value is a File
  1362. *
  1363. * @param {Object} val The value to test
  1364. * @returns {boolean} True if value is a File, otherwise false
  1365. */
  1366. function isFile(val) {
  1367. return toString.call(val) === '[object File]';
  1368. }
  1369. /**
  1370. * Determine if a value is a Blob
  1371. *
  1372. * @param {Object} val The value to test
  1373. * @returns {boolean} True if value is a Blob, otherwise false
  1374. */
  1375. function isBlob(val) {
  1376. return toString.call(val) === '[object Blob]';
  1377. }
  1378. /**
  1379. * Determine if a value is a Function
  1380. *
  1381. * @param {Object} val The value to test
  1382. * @returns {boolean} True if value is a Function, otherwise false
  1383. */
  1384. function isFunction(val) {
  1385. return toString.call(val) === '[object Function]';
  1386. }
  1387. /**
  1388. * Determine if a value is a Stream
  1389. *
  1390. * @param {Object} val The value to test
  1391. * @returns {boolean} True if value is a Stream, otherwise false
  1392. */
  1393. function isStream(val) {
  1394. return isObject(val) && isFunction(val.pipe);
  1395. }
  1396. /**
  1397. * Determine if a value is a URLSearchParams object
  1398. *
  1399. * @param {Object} val The value to test
  1400. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  1401. */
  1402. function isURLSearchParams(val) {
  1403. return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
  1404. }
  1405. /**
  1406. * Trim excess whitespace off the beginning and end of a string
  1407. *
  1408. * @param {String} str The String to trim
  1409. * @returns {String} The String freed of excess whitespace
  1410. */
  1411. function trim(str) {
  1412. return str.replace(/^\s*/, '').replace(/\s*$/, '');
  1413. }
  1414. /**
  1415. * Determine if we're running in a standard browser environment
  1416. *
  1417. * This allows axios to run in a web worker, and react-native.
  1418. * Both environments support XMLHttpRequest, but not fully standard globals.
  1419. *
  1420. * web workers:
  1421. * typeof window -> undefined
  1422. * typeof document -> undefined
  1423. *
  1424. * react-native:
  1425. * navigator.product -> 'ReactNative'
  1426. * nativescript
  1427. * navigator.product -> 'NativeScript' or 'NS'
  1428. */
  1429. function isStandardBrowserEnv() {
  1430. if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
  1431. navigator.product === 'NativeScript' ||
  1432. navigator.product === 'NS')) {
  1433. return false;
  1434. }
  1435. return (
  1436. typeof window !== 'undefined' &&
  1437. typeof document !== 'undefined'
  1438. );
  1439. }
  1440. /**
  1441. * Iterate over an Array or an Object invoking a function for each item.
  1442. *
  1443. * If `obj` is an Array callback will be called passing
  1444. * the value, index, and complete array for each item.
  1445. *
  1446. * If 'obj' is an Object callback will be called passing
  1447. * the value, key, and complete object for each property.
  1448. *
  1449. * @param {Object|Array} obj The object to iterate
  1450. * @param {Function} fn The callback to invoke for each item
  1451. */
  1452. function forEach(obj, fn) {
  1453. // Don't bother if no value provided
  1454. if (obj === null || typeof obj === 'undefined') {
  1455. return;
  1456. }
  1457. // Force an array if not already something iterable
  1458. if (typeof obj !== 'object') {
  1459. /*eslint no-param-reassign:0*/
  1460. obj = [obj];
  1461. }
  1462. if (isArray(obj)) {
  1463. // Iterate over array values
  1464. for (var i = 0, l = obj.length; i < l; i++) {
  1465. fn.call(null, obj[i], i, obj);
  1466. }
  1467. } else {
  1468. // Iterate over object keys
  1469. for (var key in obj) {
  1470. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  1471. fn.call(null, obj[key], key, obj);
  1472. }
  1473. }
  1474. }
  1475. }
  1476. /**
  1477. * Accepts varargs expecting each argument to be an object, then
  1478. * immutably merges the properties of each object and returns result.
  1479. *
  1480. * When multiple objects contain the same key the later object in
  1481. * the arguments list will take precedence.
  1482. *
  1483. * Example:
  1484. *
  1485. * ```js
  1486. * var result = merge({foo: 123}, {foo: 456});
  1487. * console.log(result.foo); // outputs 456
  1488. * ```
  1489. *
  1490. * @param {Object} obj1 Object to merge
  1491. * @returns {Object} Result of all merge properties
  1492. */
  1493. function merge(/* obj1, obj2, obj3, ... */) {
  1494. var result = {};
  1495. function assignValue(val, key) {
  1496. if (typeof result[key] === 'object' && typeof val === 'object') {
  1497. result[key] = merge(result[key], val);
  1498. } else {
  1499. result[key] = val;
  1500. }
  1501. }
  1502. for (var i = 0, l = arguments.length; i < l; i++) {
  1503. forEach(arguments[i], assignValue);
  1504. }
  1505. return result;
  1506. }
  1507. /**
  1508. * Function equal to merge with the difference being that no reference
  1509. * to original objects is kept.
  1510. *
  1511. * @see merge
  1512. * @param {Object} obj1 Object to merge
  1513. * @returns {Object} Result of all merge properties
  1514. */
  1515. function deepMerge(/* obj1, obj2, obj3, ... */) {
  1516. var result = {};
  1517. function assignValue(val, key) {
  1518. if (typeof result[key] === 'object' && typeof val === 'object') {
  1519. result[key] = deepMerge(result[key], val);
  1520. } else if (typeof val === 'object') {
  1521. result[key] = deepMerge({}, val);
  1522. } else {
  1523. result[key] = val;
  1524. }
  1525. }
  1526. for (var i = 0, l = arguments.length; i < l; i++) {
  1527. forEach(arguments[i], assignValue);
  1528. }
  1529. return result;
  1530. }
  1531. /**
  1532. * Extends object a by mutably adding to it the properties of object b.
  1533. *
  1534. * @param {Object} a The object to be extended
  1535. * @param {Object} b The object to copy properties from
  1536. * @param {Object} thisArg The object to bind function to
  1537. * @return {Object} The resulting value of object a
  1538. */
  1539. function extend(a, b, thisArg) {
  1540. forEach(b, function assignValue(val, key) {
  1541. if (thisArg && typeof val === 'function') {
  1542. a[key] = bind(val, thisArg);
  1543. } else {
  1544. a[key] = val;
  1545. }
  1546. });
  1547. return a;
  1548. }
  1549. module.exports = {
  1550. isArray: isArray,
  1551. isArrayBuffer: isArrayBuffer,
  1552. isBuffer: isBuffer,
  1553. isFormData: isFormData,
  1554. isArrayBufferView: isArrayBufferView,
  1555. isString: isString,
  1556. isNumber: isNumber,
  1557. isObject: isObject,
  1558. isUndefined: isUndefined,
  1559. isDate: isDate,
  1560. isFile: isFile,
  1561. isBlob: isBlob,
  1562. isFunction: isFunction,
  1563. isStream: isStream,
  1564. isURLSearchParams: isURLSearchParams,
  1565. isStandardBrowserEnv: isStandardBrowserEnv,
  1566. forEach: forEach,
  1567. merge: merge,
  1568. deepMerge: deepMerge,
  1569. extend: extend,
  1570. trim: trim
  1571. };
  1572. /***/ }),
  1573. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  1574. /*!***************************************************************************************************************************************************************************!*\
  1575. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  1576. \***************************************************************************************************************************************************************************/
  1577. /*! exports provided: default */
  1578. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1579. "use strict";
  1580. __webpack_require__.r(__webpack_exports__);
  1581. //
  1582. //
  1583. //
  1584. //
  1585. //
  1586. //
  1587. //
  1588. //
  1589. //
  1590. //
  1591. //
  1592. //
  1593. //
  1594. //
  1595. //
  1596. //
  1597. /* harmony default export */ __webpack_exports__["default"] = ({
  1598. mounted: function mounted() {
  1599. console.log('Component mounted.');
  1600. }
  1601. });
  1602. /***/ }),
  1603. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  1604. /*!********************************************************************************************************************************************************************!*\
  1605. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  1606. \********************************************************************************************************************************************************************/
  1607. /*! exports provided: default */
  1608. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1609. "use strict";
  1610. __webpack_require__.r(__webpack_exports__);
  1611. //
  1612. //
  1613. //
  1614. //
  1615. //
  1616. //
  1617. //
  1618. //
  1619. //
  1620. //
  1621. //
  1622. //
  1623. //
  1624. //
  1625. //
  1626. //
  1627. //
  1628. //
  1629. //
  1630. //
  1631. //
  1632. //
  1633. //
  1634. //
  1635. //
  1636. //
  1637. //
  1638. //
  1639. //
  1640. //
  1641. //
  1642. //
  1643. //
  1644. //
  1645. //
  1646. //
  1647. //
  1648. //
  1649. //
  1650. //
  1651. //
  1652. //
  1653. //
  1654. //
  1655. //
  1656. //
  1657. //
  1658. //
  1659. //
  1660. //
  1661. //
  1662. //
  1663. //
  1664. //
  1665. //
  1666. //
  1667. /* harmony default export */ __webpack_exports__["default"] = ({
  1668. props: ['asset', 'pcextraStart'],
  1669. data: function data() {
  1670. return {
  1671. data: JSON.parse(this.asset),
  1672. pcextra: JSON.parse(this.pcextraStart)
  1673. };
  1674. },
  1675. mounted: function mounted() {
  1676. var _this = this;
  1677. Echo.channel('assets').listen('AssetUpdated', function (e) {
  1678. _this.data = JSON.parse(e.data);
  1679. _this.pcextra = JSON.parse(e.pcextra);
  1680. });
  1681. },
  1682. methods: {
  1683. updateAsset: function updateAsset() {
  1684. this.data.pcextra = this.pcextra;
  1685. axios.put('/api/assets/' + this.data.pcid, this.data).then(function (response) {})["catch"](function (error) {});
  1686. $('#asseteditModal').modal('hide');
  1687. }
  1688. }
  1689. });
  1690. /***/ }),
  1691. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&":
  1692. /*!***************************************************************************************************************************************************************************************!*\
  1693. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js& ***!
  1694. \***************************************************************************************************************************************************************************************/
  1695. /*! exports provided: default */
  1696. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1697. "use strict";
  1698. __webpack_require__.r(__webpack_exports__);
  1699. //
  1700. //
  1701. //
  1702. //
  1703. //
  1704. //
  1705. //
  1706. //
  1707. //
  1708. //
  1709. //
  1710. //
  1711. //
  1712. //
  1713. //
  1714. //
  1715. //
  1716. //
  1717. //
  1718. //
  1719. //
  1720. /* harmony default export */ __webpack_exports__["default"] = ({
  1721. props: {
  1722. value: null,
  1723. // An object with the following format
  1724. // {
  1725. // key: value,
  1726. // key: value,
  1727. // }
  1728. options: {
  1729. type: Object,
  1730. required: true
  1731. },
  1732. allowCustom: {
  1733. type: Boolean,
  1734. "default": false
  1735. }
  1736. },
  1737. data: function data() {
  1738. return {
  1739. searchText: '',
  1740. selectedOption: null,
  1741. open: false,
  1742. // allows for checking whether button was clicked or text was typed.
  1743. // If button was clicked, we show all options without having to clear
  1744. // out any searchText that was autofilled when page loaded.
  1745. isSearching: false
  1746. };
  1747. },
  1748. computed: {
  1749. matches: function matches() {
  1750. var _this = this;
  1751. // If button was clicked, show all options, if typing, filter
  1752. // options based on searchText
  1753. return Object.entries(this.options).filter(function (option) {
  1754. var optionText = option[1].toUpperCase();
  1755. if (_this.isSearching) {
  1756. return optionText.match(_this.searchText.toUpperCase());
  1757. } else {
  1758. return optionText.match('');
  1759. }
  1760. });
  1761. }
  1762. },
  1763. methods: {
  1764. // if button is clicked, show all options
  1765. setOpen: function setOpen(isOpen) {
  1766. this.open = isOpen;
  1767. this.isSearching = false;
  1768. },
  1769. // if typing in the box, start filtering options
  1770. searchChanged: function searchChanged() {
  1771. if (!this.open) {
  1772. this.open = true;
  1773. }
  1774. if (!this.isSearching) {
  1775. this.isSearching = true;
  1776. } // If custom values are allowed, emits {id: 'custom', name: searchtext}
  1777. if (this.allowCustom) {
  1778. this.$emit('input', {
  1779. 'id': 'custom',
  1780. 'name': this.searchText
  1781. });
  1782. }
  1783. },
  1784. // emits { id: suggestion_id, name: suggestion_name} to v-model when
  1785. // a suggestion is selected
  1786. suggestionSelected: function suggestionSelected(suggestion) {
  1787. this.open = false;
  1788. this.searchText = suggestion[1];
  1789. this.$emit('input', {
  1790. 'id': suggestion[0],
  1791. 'name': suggestion[1]
  1792. });
  1793. },
  1794. updateComponentWithValue: function updateComponentWithValue(newValue) {
  1795. if (this.allowCustom) {
  1796. this.searchText = this.value.name;
  1797. } else {
  1798. if (newValue.id > -1) {
  1799. // Find the matching text for the supplied option value
  1800. for (var id in this.options) {
  1801. if (this.options.hasOwnProperty(id)) {
  1802. if (this.options[id] === this.options[newValue.id]) {
  1803. this.searchText = this.options[id];
  1804. }
  1805. }
  1806. }
  1807. }
  1808. }
  1809. }
  1810. },
  1811. mounted: function mounted() {
  1812. this.updateComponentWithValue(this.value);
  1813. },
  1814. watch: {
  1815. value: function value(newValue) {
  1816. this.updateComponentWithValue(newValue);
  1817. }
  1818. }
  1819. });
  1820. /***/ }),
  1821. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&":
  1822. /*!********************************************************************************************************************************************************************************!*\
  1823. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js& ***!
  1824. \********************************************************************************************************************************************************************************/
  1825. /*! exports provided: default */
  1826. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1827. "use strict";
  1828. __webpack_require__.r(__webpack_exports__);
  1829. //
  1830. //
  1831. //
  1832. //
  1833. //
  1834. //
  1835. //
  1836. //
  1837. //
  1838. //
  1839. //
  1840. //
  1841. //
  1842. //
  1843. //
  1844. //
  1845. //
  1846. //
  1847. //
  1848. //
  1849. //
  1850. //
  1851. //
  1852. //
  1853. //
  1854. //
  1855. /* harmony default export */ __webpack_exports__["default"] = ({
  1856. props: {
  1857. populateWith: {
  1858. type: Object,
  1859. "default": function _default() {
  1860. return {
  1861. creddesc: null,
  1862. creduser: null,
  1863. credpass: null,
  1864. groupid: null,
  1865. pcid: null,
  1866. credtype: null
  1867. };
  1868. }
  1869. },
  1870. modalId: {
  1871. type: String,
  1872. required: true
  1873. },
  1874. descriptions: {
  1875. type: Object,
  1876. required: true
  1877. },
  1878. create: {
  1879. type: Boolean
  1880. },
  1881. pcid: {
  1882. type: Number
  1883. },
  1884. groupid: {
  1885. type: Number
  1886. }
  1887. },
  1888. data: function data() {
  1889. return {
  1890. data: JSON.parse(JSON.stringify(this.populateWith)),
  1891. creddesc: {},
  1892. id: this.modalId,
  1893. errors: []
  1894. };
  1895. },
  1896. mounted: function mounted() {
  1897. this.creddesc = {
  1898. 'id': this.data.credtype,
  1899. 'name': this.data.creddesc
  1900. };
  1901. },
  1902. methods: {
  1903. rndStr: function rndStr(len) {
  1904. var text = "";
  1905. var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%";
  1906. for (var i = 0; i < len; i++) {
  1907. text += chars.charAt(Math.floor(Math.random() * chars.length));
  1908. }
  1909. return text;
  1910. },
  1911. getRandomPassword: function getRandomPassword(id) {
  1912. this.data.credpass = this.rndStr(16);
  1913. },
  1914. updateCredential: function updateCredential() {
  1915. var _this = this;
  1916. if (this.creddesc.id === "custom") {
  1917. this.data.credtype = 1;
  1918. this.data.creddesc = this.creddesc.name;
  1919. } else {
  1920. this.data.credtype = this.creddesc.id;
  1921. this.data.creddesc = this.creddesc.name;
  1922. }
  1923. if (this.create) {
  1924. if (this.pcid) {
  1925. this.data.pcid = this.pcid;
  1926. }
  1927. if (this.groupid) {
  1928. this.data.groupid = this.groupid;
  1929. }
  1930. axios.post('/api/credentials/', this.data).then(function (response) {
  1931. $('#' + _this.id).modal('hide');
  1932. });
  1933. } else {
  1934. axios.put('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  1935. $('#' + _this.id).modal('hide');
  1936. })["catch"](function (error) {
  1937. console.error(error);
  1938. });
  1939. }
  1940. }
  1941. }
  1942. });
  1943. /***/ }),
  1944. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-list.vue?vue&type=script&lang=js&":
  1945. /*!**************************************************************************************************************************************************************************!*\
  1946. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential-list.vue?vue&type=script&lang=js& ***!
  1947. \**************************************************************************************************************************************************************************/
  1948. /*! exports provided: default */
  1949. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1950. "use strict";
  1951. __webpack_require__.r(__webpack_exports__);
  1952. //
  1953. //
  1954. //
  1955. //
  1956. //
  1957. //
  1958. //
  1959. //
  1960. //
  1961. /* harmony default export */ __webpack_exports__["default"] = ({
  1962. props: {
  1963. credentialList: {
  1964. type: Array,
  1965. required: true
  1966. },
  1967. descriptions: {
  1968. type: Array,
  1969. required: true
  1970. },
  1971. pcid: {
  1972. type: Number
  1973. },
  1974. groupid: {
  1975. type: Number
  1976. }
  1977. },
  1978. data: function data() {
  1979. return {
  1980. credentials: this.credentialList
  1981. };
  1982. },
  1983. computed: {
  1984. creddescList: function creddescList() {
  1985. var list = {};
  1986. this.descriptions.map(function (val) {
  1987. list[val.creddescid] = val.credtitle;
  1988. });
  1989. return list;
  1990. }
  1991. }
  1992. });
  1993. /***/ }),
  1994. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=script&lang=js&":
  1995. /*!*********************************************************************************************************************************************************************!*\
  1996. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential.vue?vue&type=script&lang=js& ***!
  1997. \*********************************************************************************************************************************************************************/
  1998. /*! exports provided: default */
  1999. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2000. "use strict";
  2001. __webpack_require__.r(__webpack_exports__);
  2002. //
  2003. //
  2004. //
  2005. //
  2006. //
  2007. //
  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. /* harmony default export */ __webpack_exports__["default"] = ({
  2046. props: ['credential', 'descriptions'],
  2047. data: function data() {
  2048. return {
  2049. data: this.credential,
  2050. creddescList: this.descriptions
  2051. };
  2052. },
  2053. mounted: function mounted() {
  2054. var _this = this;
  2055. console.log('credential.' + this.data.credid);
  2056. Echo.channel('credential.' + this.data.credid).listen('CredentialUpdated', function (e) {
  2057. _this.data = e.credential;
  2058. });
  2059. },
  2060. methods: {
  2061. deleteCredential: function deleteCredential() {
  2062. var _this2 = this;
  2063. axios["delete"]('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  2064. $('#credential' + _this2.data.credid + 'deleteModal').modal('hide');
  2065. })["catch"](function (error) {
  2066. console.error(error);
  2067. });
  2068. }
  2069. }
  2070. });
  2071. /***/ }),
  2072. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  2073. /*!********************************************************************************************************************************************************************!*\
  2074. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/errorlist.vue?vue&type=script&lang=js& ***!
  2075. \********************************************************************************************************************************************************************/
  2076. /*! exports provided: default */
  2077. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2078. "use strict";
  2079. __webpack_require__.r(__webpack_exports__);
  2080. //
  2081. //
  2082. //
  2083. //
  2084. //
  2085. /* harmony default export */ __webpack_exports__["default"] = ({
  2086. props: ['errors'],
  2087. data: function data() {
  2088. return {
  2089. errorList: this.errors
  2090. };
  2091. },
  2092. watch: {
  2093. errors: function errors(newErrors) {
  2094. this.errorList = newErrors;
  2095. }
  2096. }
  2097. });
  2098. /***/ }),
  2099. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=script&lang=js&":
  2100. /*!****************************************************************************************************************************************************************!*\
  2101. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/notes.vue?vue&type=script&lang=js& ***!
  2102. \****************************************************************************************************************************************************************/
  2103. /*! exports provided: default */
  2104. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2105. "use strict";
  2106. __webpack_require__.r(__webpack_exports__);
  2107. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2108. //
  2109. //
  2110. //
  2111. //
  2112. //
  2113. //
  2114. //
  2115. //
  2116. //
  2117. //
  2118. //
  2119. //
  2120. //
  2121. //
  2122. //
  2123. //
  2124. //
  2125. //
  2126. //
  2127. //
  2128. //
  2129. //
  2130. //
  2131. //
  2132. //
  2133. //
  2134. //
  2135. //
  2136. //
  2137. //
  2138. //
  2139. //
  2140. //
  2141. //
  2142. //
  2143. //
  2144. //
  2145. //
  2146. //
  2147. /* harmony default export */ __webpack_exports__["default"] = ({
  2148. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2149. props: ['initialnotes', 'authusername'],
  2150. data: function data() {
  2151. return {
  2152. notes: this.initialnotes
  2153. };
  2154. }
  2155. });
  2156. /***/ }),
  2157. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js&":
  2158. /*!****************************************************************************************************************************************************************************!*\
  2159. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js& ***!
  2160. \****************************************************************************************************************************************************************************/
  2161. /*! exports provided: default */
  2162. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2163. "use strict";
  2164. __webpack_require__.r(__webpack_exports__);
  2165. //
  2166. //
  2167. //
  2168. //
  2169. //
  2170. //
  2171. //
  2172. //
  2173. //
  2174. //
  2175. //
  2176. //
  2177. //
  2178. //
  2179. //
  2180. //
  2181. //
  2182. //
  2183. //
  2184. //
  2185. //
  2186. //
  2187. //
  2188. //
  2189. //
  2190. //
  2191. //
  2192. //
  2193. //
  2194. //
  2195. //
  2196. //
  2197. //
  2198. /* harmony default export */ __webpack_exports__["default"] = ({
  2199. props: ['populateWith', 'storeList', 'modalId'],
  2200. data: function data() {
  2201. return {
  2202. // Copies object from prop, so it doesn't mutate the object
  2203. // from the parent component. Parent component will be updated via
  2204. // Websocket if updateWorkOrder is successful.
  2205. data: JSON.parse(JSON.stringify(this.populateWith)),
  2206. id: this.modalId,
  2207. store: {},
  2208. errors: []
  2209. };
  2210. },
  2211. mounted: function mounted() {
  2212. this.store = {
  2213. 'id': this.data.storeid,
  2214. 'name': this.storeList[this.data.storeid]
  2215. };
  2216. },
  2217. methods: {
  2218. updateWorkOrder: function updateWorkOrder() {
  2219. var _this = this;
  2220. this.data.storeid = this.store.id;
  2221. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {
  2222. $('#workordereditModal').modal('hide');
  2223. })["catch"](function (error) {
  2224. _this.errors = JSON.parse(error.response.request.response).errors;
  2225. });
  2226. }
  2227. }
  2228. });
  2229. /***/ }),
  2230. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  2231. /*!*****************************************************************************************************************************************************************!*\
  2232. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/woinfo.vue?vue&type=script&lang=js& ***!
  2233. \*****************************************************************************************************************************************************************/
  2234. /*! exports provided: default */
  2235. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2236. "use strict";
  2237. __webpack_require__.r(__webpack_exports__);
  2238. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2239. //
  2240. //
  2241. //
  2242. //
  2243. //
  2244. //
  2245. //
  2246. //
  2247. //
  2248. //
  2249. //
  2250. //
  2251. //
  2252. //
  2253. //
  2254. //
  2255. //
  2256. //
  2257. //
  2258. //
  2259. /* harmony default export */ __webpack_exports__["default"] = ({
  2260. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2261. props: ['workOrder', 'stores'],
  2262. data: function data() {
  2263. return {
  2264. data: JSON.parse(this.workOrder)
  2265. };
  2266. },
  2267. computed: {
  2268. storeList: function storeList() {
  2269. var list = {};
  2270. JSON.parse(this.stores).map(function (val) {
  2271. list[val.storeid] = val.storesname;
  2272. });
  2273. return list;
  2274. }
  2275. },
  2276. mounted: function mounted() {
  2277. var _this = this;
  2278. Echo.channel('work-orders').listen('WorkOrderUpdated', function (e) {
  2279. _this.data = JSON.parse(e.data);
  2280. });
  2281. }
  2282. });
  2283. /***/ }),
  2284. /***/ "./node_modules/base64-js/index.js":
  2285. /*!*****************************************!*\
  2286. !*** ./node_modules/base64-js/index.js ***!
  2287. \*****************************************/
  2288. /*! no static exports found */
  2289. /***/ (function(module, exports, __webpack_require__) {
  2290. "use strict";
  2291. exports.byteLength = byteLength
  2292. exports.toByteArray = toByteArray
  2293. exports.fromByteArray = fromByteArray
  2294. var lookup = []
  2295. var revLookup = []
  2296. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  2297. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  2298. for (var i = 0, len = code.length; i < len; ++i) {
  2299. lookup[i] = code[i]
  2300. revLookup[code.charCodeAt(i)] = i
  2301. }
  2302. // Support decoding URL-safe base64 strings, as Node.js does.
  2303. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  2304. revLookup['-'.charCodeAt(0)] = 62
  2305. revLookup['_'.charCodeAt(0)] = 63
  2306. function getLens (b64) {
  2307. var len = b64.length
  2308. if (len % 4 > 0) {
  2309. throw new Error('Invalid string. Length must be a multiple of 4')
  2310. }
  2311. // Trim off extra bytes after placeholder bytes are found
  2312. // See: https://github.com/beatgammit/base64-js/issues/42
  2313. var validLen = b64.indexOf('=')
  2314. if (validLen === -1) validLen = len
  2315. var placeHoldersLen = validLen === len
  2316. ? 0
  2317. : 4 - (validLen % 4)
  2318. return [validLen, placeHoldersLen]
  2319. }
  2320. // base64 is 4/3 + up to two characters of the original data
  2321. function byteLength (b64) {
  2322. var lens = getLens(b64)
  2323. var validLen = lens[0]
  2324. var placeHoldersLen = lens[1]
  2325. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2326. }
  2327. function _byteLength (b64, validLen, placeHoldersLen) {
  2328. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2329. }
  2330. function toByteArray (b64) {
  2331. var tmp
  2332. var lens = getLens(b64)
  2333. var validLen = lens[0]
  2334. var placeHoldersLen = lens[1]
  2335. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  2336. var curByte = 0
  2337. // if there are placeholders, only get up to the last complete 4 chars
  2338. var len = placeHoldersLen > 0
  2339. ? validLen - 4
  2340. : validLen
  2341. var i
  2342. for (i = 0; i < len; i += 4) {
  2343. tmp =
  2344. (revLookup[b64.charCodeAt(i)] << 18) |
  2345. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  2346. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  2347. revLookup[b64.charCodeAt(i + 3)]
  2348. arr[curByte++] = (tmp >> 16) & 0xFF
  2349. arr[curByte++] = (tmp >> 8) & 0xFF
  2350. arr[curByte++] = tmp & 0xFF
  2351. }
  2352. if (placeHoldersLen === 2) {
  2353. tmp =
  2354. (revLookup[b64.charCodeAt(i)] << 2) |
  2355. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  2356. arr[curByte++] = tmp & 0xFF
  2357. }
  2358. if (placeHoldersLen === 1) {
  2359. tmp =
  2360. (revLookup[b64.charCodeAt(i)] << 10) |
  2361. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  2362. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  2363. arr[curByte++] = (tmp >> 8) & 0xFF
  2364. arr[curByte++] = tmp & 0xFF
  2365. }
  2366. return arr
  2367. }
  2368. function tripletToBase64 (num) {
  2369. return lookup[num >> 18 & 0x3F] +
  2370. lookup[num >> 12 & 0x3F] +
  2371. lookup[num >> 6 & 0x3F] +
  2372. lookup[num & 0x3F]
  2373. }
  2374. function encodeChunk (uint8, start, end) {
  2375. var tmp
  2376. var output = []
  2377. for (var i = start; i < end; i += 3) {
  2378. tmp =
  2379. ((uint8[i] << 16) & 0xFF0000) +
  2380. ((uint8[i + 1] << 8) & 0xFF00) +
  2381. (uint8[i + 2] & 0xFF)
  2382. output.push(tripletToBase64(tmp))
  2383. }
  2384. return output.join('')
  2385. }
  2386. function fromByteArray (uint8) {
  2387. var tmp
  2388. var len = uint8.length
  2389. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  2390. var parts = []
  2391. var maxChunkLength = 16383 // must be multiple of 3
  2392. // go through the array every three bytes, we'll deal with trailing stuff later
  2393. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  2394. parts.push(encodeChunk(
  2395. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  2396. ))
  2397. }
  2398. // pad the end with zeros, but make sure to not forget the extra bytes
  2399. if (extraBytes === 1) {
  2400. tmp = uint8[len - 1]
  2401. parts.push(
  2402. lookup[tmp >> 2] +
  2403. lookup[(tmp << 4) & 0x3F] +
  2404. '=='
  2405. )
  2406. } else if (extraBytes === 2) {
  2407. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  2408. parts.push(
  2409. lookup[tmp >> 10] +
  2410. lookup[(tmp >> 4) & 0x3F] +
  2411. lookup[(tmp << 2) & 0x3F] +
  2412. '='
  2413. )
  2414. }
  2415. return parts.join('')
  2416. }
  2417. /***/ }),
  2418. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  2419. /*!*****************************************************!*\
  2420. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  2421. \*****************************************************/
  2422. /*! no static exports found */
  2423. /***/ (function(module, exports, __webpack_require__) {
  2424. /*!
  2425. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  2426. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  2427. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2428. */
  2429. (function (global, factory) {
  2430. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  2431. undefined;
  2432. }(this, (function (exports, $, Popper) { 'use strict';
  2433. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  2434. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  2435. function _defineProperties(target, props) {
  2436. for (var i = 0; i < props.length; i++) {
  2437. var descriptor = props[i];
  2438. descriptor.enumerable = descriptor.enumerable || false;
  2439. descriptor.configurable = true;
  2440. if ("value" in descriptor) descriptor.writable = true;
  2441. Object.defineProperty(target, descriptor.key, descriptor);
  2442. }
  2443. }
  2444. function _createClass(Constructor, protoProps, staticProps) {
  2445. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2446. if (staticProps) _defineProperties(Constructor, staticProps);
  2447. return Constructor;
  2448. }
  2449. function _defineProperty(obj, key, value) {
  2450. if (key in obj) {
  2451. Object.defineProperty(obj, key, {
  2452. value: value,
  2453. enumerable: true,
  2454. configurable: true,
  2455. writable: true
  2456. });
  2457. } else {
  2458. obj[key] = value;
  2459. }
  2460. return obj;
  2461. }
  2462. function ownKeys(object, enumerableOnly) {
  2463. var keys = Object.keys(object);
  2464. if (Object.getOwnPropertySymbols) {
  2465. var symbols = Object.getOwnPropertySymbols(object);
  2466. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2467. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2468. });
  2469. keys.push.apply(keys, symbols);
  2470. }
  2471. return keys;
  2472. }
  2473. function _objectSpread2(target) {
  2474. for (var i = 1; i < arguments.length; i++) {
  2475. var source = arguments[i] != null ? arguments[i] : {};
  2476. if (i % 2) {
  2477. ownKeys(Object(source), true).forEach(function (key) {
  2478. _defineProperty(target, key, source[key]);
  2479. });
  2480. } else if (Object.getOwnPropertyDescriptors) {
  2481. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2482. } else {
  2483. ownKeys(Object(source)).forEach(function (key) {
  2484. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2485. });
  2486. }
  2487. }
  2488. return target;
  2489. }
  2490. function _inheritsLoose(subClass, superClass) {
  2491. subClass.prototype = Object.create(superClass.prototype);
  2492. subClass.prototype.constructor = subClass;
  2493. subClass.__proto__ = superClass;
  2494. }
  2495. /**
  2496. * --------------------------------------------------------------------------
  2497. * Bootstrap (v4.4.1): util.js
  2498. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2499. * --------------------------------------------------------------------------
  2500. */
  2501. /**
  2502. * ------------------------------------------------------------------------
  2503. * Private TransitionEnd Helpers
  2504. * ------------------------------------------------------------------------
  2505. */
  2506. var TRANSITION_END = 'transitionend';
  2507. var MAX_UID = 1000000;
  2508. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  2509. function toType(obj) {
  2510. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  2511. }
  2512. function getSpecialTransitionEndEvent() {
  2513. return {
  2514. bindType: TRANSITION_END,
  2515. delegateType: TRANSITION_END,
  2516. handle: function handle(event) {
  2517. if ($(event.target).is(this)) {
  2518. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  2519. }
  2520. return undefined; // eslint-disable-line no-undefined
  2521. }
  2522. };
  2523. }
  2524. function transitionEndEmulator(duration) {
  2525. var _this = this;
  2526. var called = false;
  2527. $(this).one(Util.TRANSITION_END, function () {
  2528. called = true;
  2529. });
  2530. setTimeout(function () {
  2531. if (!called) {
  2532. Util.triggerTransitionEnd(_this);
  2533. }
  2534. }, duration);
  2535. return this;
  2536. }
  2537. function setTransitionEndSupport() {
  2538. $.fn.emulateTransitionEnd = transitionEndEmulator;
  2539. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  2540. }
  2541. /**
  2542. * --------------------------------------------------------------------------
  2543. * Public Util Api
  2544. * --------------------------------------------------------------------------
  2545. */
  2546. var Util = {
  2547. TRANSITION_END: 'bsTransitionEnd',
  2548. getUID: function getUID(prefix) {
  2549. do {
  2550. // eslint-disable-next-line no-bitwise
  2551. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  2552. } while (document.getElementById(prefix));
  2553. return prefix;
  2554. },
  2555. getSelectorFromElement: function getSelectorFromElement(element) {
  2556. var selector = element.getAttribute('data-target');
  2557. if (!selector || selector === '#') {
  2558. var hrefAttr = element.getAttribute('href');
  2559. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2560. }
  2561. try {
  2562. return document.querySelector(selector) ? selector : null;
  2563. } catch (err) {
  2564. return null;
  2565. }
  2566. },
  2567. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2568. if (!element) {
  2569. return 0;
  2570. } // Get transition-duration of the element
  2571. var transitionDuration = $(element).css('transition-duration');
  2572. var transitionDelay = $(element).css('transition-delay');
  2573. var floatTransitionDuration = parseFloat(transitionDuration);
  2574. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2575. if (!floatTransitionDuration && !floatTransitionDelay) {
  2576. return 0;
  2577. } // If multiple durations are defined, take the first
  2578. transitionDuration = transitionDuration.split(',')[0];
  2579. transitionDelay = transitionDelay.split(',')[0];
  2580. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2581. },
  2582. reflow: function reflow(element) {
  2583. return element.offsetHeight;
  2584. },
  2585. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2586. $(element).trigger(TRANSITION_END);
  2587. },
  2588. // TODO: Remove in v5
  2589. supportsTransitionEnd: function supportsTransitionEnd() {
  2590. return Boolean(TRANSITION_END);
  2591. },
  2592. isElement: function isElement(obj) {
  2593. return (obj[0] || obj).nodeType;
  2594. },
  2595. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2596. for (var property in configTypes) {
  2597. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2598. var expectedTypes = configTypes[property];
  2599. var value = config[property];
  2600. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2601. if (!new RegExp(expectedTypes).test(valueType)) {
  2602. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2603. }
  2604. }
  2605. }
  2606. },
  2607. findShadowRoot: function findShadowRoot(element) {
  2608. if (!document.documentElement.attachShadow) {
  2609. return null;
  2610. } // Can find the shadow root otherwise it'll return the document
  2611. if (typeof element.getRootNode === 'function') {
  2612. var root = element.getRootNode();
  2613. return root instanceof ShadowRoot ? root : null;
  2614. }
  2615. if (element instanceof ShadowRoot) {
  2616. return element;
  2617. } // when we don't find a shadow root
  2618. if (!element.parentNode) {
  2619. return null;
  2620. }
  2621. return Util.findShadowRoot(element.parentNode);
  2622. },
  2623. jQueryDetection: function jQueryDetection() {
  2624. if (typeof $ === 'undefined') {
  2625. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2626. }
  2627. var version = $.fn.jquery.split(' ')[0].split('.');
  2628. var minMajor = 1;
  2629. var ltMajor = 2;
  2630. var minMinor = 9;
  2631. var minPatch = 1;
  2632. var maxMajor = 4;
  2633. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2634. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2635. }
  2636. }
  2637. };
  2638. Util.jQueryDetection();
  2639. setTransitionEndSupport();
  2640. /**
  2641. * ------------------------------------------------------------------------
  2642. * Constants
  2643. * ------------------------------------------------------------------------
  2644. */
  2645. var NAME = 'alert';
  2646. var VERSION = '4.4.1';
  2647. var DATA_KEY = 'bs.alert';
  2648. var EVENT_KEY = "." + DATA_KEY;
  2649. var DATA_API_KEY = '.data-api';
  2650. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2651. var Selector = {
  2652. DISMISS: '[data-dismiss="alert"]'
  2653. };
  2654. var Event = {
  2655. CLOSE: "close" + EVENT_KEY,
  2656. CLOSED: "closed" + EVENT_KEY,
  2657. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  2658. };
  2659. var ClassName = {
  2660. ALERT: 'alert',
  2661. FADE: 'fade',
  2662. SHOW: 'show'
  2663. };
  2664. /**
  2665. * ------------------------------------------------------------------------
  2666. * Class Definition
  2667. * ------------------------------------------------------------------------
  2668. */
  2669. var Alert =
  2670. /*#__PURE__*/
  2671. function () {
  2672. function Alert(element) {
  2673. this._element = element;
  2674. } // Getters
  2675. var _proto = Alert.prototype;
  2676. // Public
  2677. _proto.close = function close(element) {
  2678. var rootElement = this._element;
  2679. if (element) {
  2680. rootElement = this._getRootElement(element);
  2681. }
  2682. var customEvent = this._triggerCloseEvent(rootElement);
  2683. if (customEvent.isDefaultPrevented()) {
  2684. return;
  2685. }
  2686. this._removeElement(rootElement);
  2687. };
  2688. _proto.dispose = function dispose() {
  2689. $.removeData(this._element, DATA_KEY);
  2690. this._element = null;
  2691. } // Private
  2692. ;
  2693. _proto._getRootElement = function _getRootElement(element) {
  2694. var selector = Util.getSelectorFromElement(element);
  2695. var parent = false;
  2696. if (selector) {
  2697. parent = document.querySelector(selector);
  2698. }
  2699. if (!parent) {
  2700. parent = $(element).closest("." + ClassName.ALERT)[0];
  2701. }
  2702. return parent;
  2703. };
  2704. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2705. var closeEvent = $.Event(Event.CLOSE);
  2706. $(element).trigger(closeEvent);
  2707. return closeEvent;
  2708. };
  2709. _proto._removeElement = function _removeElement(element) {
  2710. var _this = this;
  2711. $(element).removeClass(ClassName.SHOW);
  2712. if (!$(element).hasClass(ClassName.FADE)) {
  2713. this._destroyElement(element);
  2714. return;
  2715. }
  2716. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2717. $(element).one(Util.TRANSITION_END, function (event) {
  2718. return _this._destroyElement(element, event);
  2719. }).emulateTransitionEnd(transitionDuration);
  2720. };
  2721. _proto._destroyElement = function _destroyElement(element) {
  2722. $(element).detach().trigger(Event.CLOSED).remove();
  2723. } // Static
  2724. ;
  2725. Alert._jQueryInterface = function _jQueryInterface(config) {
  2726. return this.each(function () {
  2727. var $element = $(this);
  2728. var data = $element.data(DATA_KEY);
  2729. if (!data) {
  2730. data = new Alert(this);
  2731. $element.data(DATA_KEY, data);
  2732. }
  2733. if (config === 'close') {
  2734. data[config](this);
  2735. }
  2736. });
  2737. };
  2738. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2739. return function (event) {
  2740. if (event) {
  2741. event.preventDefault();
  2742. }
  2743. alertInstance.close(this);
  2744. };
  2745. };
  2746. _createClass(Alert, null, [{
  2747. key: "VERSION",
  2748. get: function get() {
  2749. return VERSION;
  2750. }
  2751. }]);
  2752. return Alert;
  2753. }();
  2754. /**
  2755. * ------------------------------------------------------------------------
  2756. * Data Api implementation
  2757. * ------------------------------------------------------------------------
  2758. */
  2759. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  2760. /**
  2761. * ------------------------------------------------------------------------
  2762. * jQuery
  2763. * ------------------------------------------------------------------------
  2764. */
  2765. $.fn[NAME] = Alert._jQueryInterface;
  2766. $.fn[NAME].Constructor = Alert;
  2767. $.fn[NAME].noConflict = function () {
  2768. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2769. return Alert._jQueryInterface;
  2770. };
  2771. /**
  2772. * ------------------------------------------------------------------------
  2773. * Constants
  2774. * ------------------------------------------------------------------------
  2775. */
  2776. var NAME$1 = 'button';
  2777. var VERSION$1 = '4.4.1';
  2778. var DATA_KEY$1 = 'bs.button';
  2779. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2780. var DATA_API_KEY$1 = '.data-api';
  2781. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2782. var ClassName$1 = {
  2783. ACTIVE: 'active',
  2784. BUTTON: 'btn',
  2785. FOCUS: 'focus'
  2786. };
  2787. var Selector$1 = {
  2788. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  2789. DATA_TOGGLES: '[data-toggle="buttons"]',
  2790. DATA_TOGGLE: '[data-toggle="button"]',
  2791. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  2792. INPUT: 'input:not([type="hidden"])',
  2793. ACTIVE: '.active',
  2794. BUTTON: '.btn'
  2795. };
  2796. var Event$1 = {
  2797. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  2798. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  2799. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  2800. };
  2801. /**
  2802. * ------------------------------------------------------------------------
  2803. * Class Definition
  2804. * ------------------------------------------------------------------------
  2805. */
  2806. var Button =
  2807. /*#__PURE__*/
  2808. function () {
  2809. function Button(element) {
  2810. this._element = element;
  2811. } // Getters
  2812. var _proto = Button.prototype;
  2813. // Public
  2814. _proto.toggle = function toggle() {
  2815. var triggerChangeEvent = true;
  2816. var addAriaPressed = true;
  2817. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2818. if (rootElement) {
  2819. var input = this._element.querySelector(Selector$1.INPUT);
  2820. if (input) {
  2821. if (input.type === 'radio') {
  2822. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2823. triggerChangeEvent = false;
  2824. } else {
  2825. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  2826. if (activeElement) {
  2827. $(activeElement).removeClass(ClassName$1.ACTIVE);
  2828. }
  2829. }
  2830. } else if (input.type === 'checkbox') {
  2831. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  2832. triggerChangeEvent = false;
  2833. }
  2834. } else {
  2835. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  2836. triggerChangeEvent = false;
  2837. }
  2838. if (triggerChangeEvent) {
  2839. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  2840. $(input).trigger('change');
  2841. }
  2842. input.focus();
  2843. addAriaPressed = false;
  2844. }
  2845. }
  2846. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  2847. if (addAriaPressed) {
  2848. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  2849. }
  2850. if (triggerChangeEvent) {
  2851. $(this._element).toggleClass(ClassName$1.ACTIVE);
  2852. }
  2853. }
  2854. };
  2855. _proto.dispose = function dispose() {
  2856. $.removeData(this._element, DATA_KEY$1);
  2857. this._element = null;
  2858. } // Static
  2859. ;
  2860. Button._jQueryInterface = function _jQueryInterface(config) {
  2861. return this.each(function () {
  2862. var data = $(this).data(DATA_KEY$1);
  2863. if (!data) {
  2864. data = new Button(this);
  2865. $(this).data(DATA_KEY$1, data);
  2866. }
  2867. if (config === 'toggle') {
  2868. data[config]();
  2869. }
  2870. });
  2871. };
  2872. _createClass(Button, null, [{
  2873. key: "VERSION",
  2874. get: function get() {
  2875. return VERSION$1;
  2876. }
  2877. }]);
  2878. return Button;
  2879. }();
  2880. /**
  2881. * ------------------------------------------------------------------------
  2882. * Data Api implementation
  2883. * ------------------------------------------------------------------------
  2884. */
  2885. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2886. var button = event.target;
  2887. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  2888. button = $(button).closest(Selector$1.BUTTON)[0];
  2889. }
  2890. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  2891. event.preventDefault(); // work around Firefox bug #1540995
  2892. } else {
  2893. var inputBtn = button.querySelector(Selector$1.INPUT);
  2894. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  2895. event.preventDefault(); // work around Firefox bug #1540995
  2896. return;
  2897. }
  2898. Button._jQueryInterface.call($(button), 'toggle');
  2899. }
  2900. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2901. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  2902. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  2903. });
  2904. $(window).on(Event$1.LOAD_DATA_API, function () {
  2905. // ensure correct active class is set to match the controls' actual values/states
  2906. // find all checkboxes/readio buttons inside data-toggle groups
  2907. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  2908. for (var i = 0, len = buttons.length; i < len; i++) {
  2909. var button = buttons[i];
  2910. var input = button.querySelector(Selector$1.INPUT);
  2911. if (input.checked || input.hasAttribute('checked')) {
  2912. button.classList.add(ClassName$1.ACTIVE);
  2913. } else {
  2914. button.classList.remove(ClassName$1.ACTIVE);
  2915. }
  2916. } // find all button toggles
  2917. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  2918. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  2919. var _button = buttons[_i];
  2920. if (_button.getAttribute('aria-pressed') === 'true') {
  2921. _button.classList.add(ClassName$1.ACTIVE);
  2922. } else {
  2923. _button.classList.remove(ClassName$1.ACTIVE);
  2924. }
  2925. }
  2926. });
  2927. /**
  2928. * ------------------------------------------------------------------------
  2929. * jQuery
  2930. * ------------------------------------------------------------------------
  2931. */
  2932. $.fn[NAME$1] = Button._jQueryInterface;
  2933. $.fn[NAME$1].Constructor = Button;
  2934. $.fn[NAME$1].noConflict = function () {
  2935. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  2936. return Button._jQueryInterface;
  2937. };
  2938. /**
  2939. * ------------------------------------------------------------------------
  2940. * Constants
  2941. * ------------------------------------------------------------------------
  2942. */
  2943. var NAME$2 = 'carousel';
  2944. var VERSION$2 = '4.4.1';
  2945. var DATA_KEY$2 = 'bs.carousel';
  2946. var EVENT_KEY$2 = "." + DATA_KEY$2;
  2947. var DATA_API_KEY$2 = '.data-api';
  2948. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  2949. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  2950. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  2951. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  2952. var SWIPE_THRESHOLD = 40;
  2953. var Default = {
  2954. interval: 5000,
  2955. keyboard: true,
  2956. slide: false,
  2957. pause: 'hover',
  2958. wrap: true,
  2959. touch: true
  2960. };
  2961. var DefaultType = {
  2962. interval: '(number|boolean)',
  2963. keyboard: 'boolean',
  2964. slide: '(boolean|string)',
  2965. pause: '(string|boolean)',
  2966. wrap: 'boolean',
  2967. touch: 'boolean'
  2968. };
  2969. var Direction = {
  2970. NEXT: 'next',
  2971. PREV: 'prev',
  2972. LEFT: 'left',
  2973. RIGHT: 'right'
  2974. };
  2975. var Event$2 = {
  2976. SLIDE: "slide" + EVENT_KEY$2,
  2977. SLID: "slid" + EVENT_KEY$2,
  2978. KEYDOWN: "keydown" + EVENT_KEY$2,
  2979. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  2980. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  2981. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  2982. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  2983. TOUCHEND: "touchend" + EVENT_KEY$2,
  2984. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  2985. POINTERUP: "pointerup" + EVENT_KEY$2,
  2986. DRAG_START: "dragstart" + EVENT_KEY$2,
  2987. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  2988. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  2989. };
  2990. var ClassName$2 = {
  2991. CAROUSEL: 'carousel',
  2992. ACTIVE: 'active',
  2993. SLIDE: 'slide',
  2994. RIGHT: 'carousel-item-right',
  2995. LEFT: 'carousel-item-left',
  2996. NEXT: 'carousel-item-next',
  2997. PREV: 'carousel-item-prev',
  2998. ITEM: 'carousel-item',
  2999. POINTER_EVENT: 'pointer-event'
  3000. };
  3001. var Selector$2 = {
  3002. ACTIVE: '.active',
  3003. ACTIVE_ITEM: '.active.carousel-item',
  3004. ITEM: '.carousel-item',
  3005. ITEM_IMG: '.carousel-item img',
  3006. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  3007. INDICATORS: '.carousel-indicators',
  3008. DATA_SLIDE: '[data-slide], [data-slide-to]',
  3009. DATA_RIDE: '[data-ride="carousel"]'
  3010. };
  3011. var PointerType = {
  3012. TOUCH: 'touch',
  3013. PEN: 'pen'
  3014. };
  3015. /**
  3016. * ------------------------------------------------------------------------
  3017. * Class Definition
  3018. * ------------------------------------------------------------------------
  3019. */
  3020. var Carousel =
  3021. /*#__PURE__*/
  3022. function () {
  3023. function Carousel(element, config) {
  3024. this._items = null;
  3025. this._interval = null;
  3026. this._activeElement = null;
  3027. this._isPaused = false;
  3028. this._isSliding = false;
  3029. this.touchTimeout = null;
  3030. this.touchStartX = 0;
  3031. this.touchDeltaX = 0;
  3032. this._config = this._getConfig(config);
  3033. this._element = element;
  3034. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  3035. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  3036. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  3037. this._addEventListeners();
  3038. } // Getters
  3039. var _proto = Carousel.prototype;
  3040. // Public
  3041. _proto.next = function next() {
  3042. if (!this._isSliding) {
  3043. this._slide(Direction.NEXT);
  3044. }
  3045. };
  3046. _proto.nextWhenVisible = function nextWhenVisible() {
  3047. // Don't call next when the page isn't visible
  3048. // or the carousel or its parent isn't visible
  3049. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  3050. this.next();
  3051. }
  3052. };
  3053. _proto.prev = function prev() {
  3054. if (!this._isSliding) {
  3055. this._slide(Direction.PREV);
  3056. }
  3057. };
  3058. _proto.pause = function pause(event) {
  3059. if (!event) {
  3060. this._isPaused = true;
  3061. }
  3062. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  3063. Util.triggerTransitionEnd(this._element);
  3064. this.cycle(true);
  3065. }
  3066. clearInterval(this._interval);
  3067. this._interval = null;
  3068. };
  3069. _proto.cycle = function cycle(event) {
  3070. if (!event) {
  3071. this._isPaused = false;
  3072. }
  3073. if (this._interval) {
  3074. clearInterval(this._interval);
  3075. this._interval = null;
  3076. }
  3077. if (this._config.interval && !this._isPaused) {
  3078. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  3079. }
  3080. };
  3081. _proto.to = function to(index) {
  3082. var _this = this;
  3083. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3084. var activeIndex = this._getItemIndex(this._activeElement);
  3085. if (index > this._items.length - 1 || index < 0) {
  3086. return;
  3087. }
  3088. if (this._isSliding) {
  3089. $(this._element).one(Event$2.SLID, function () {
  3090. return _this.to(index);
  3091. });
  3092. return;
  3093. }
  3094. if (activeIndex === index) {
  3095. this.pause();
  3096. this.cycle();
  3097. return;
  3098. }
  3099. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  3100. this._slide(direction, this._items[index]);
  3101. };
  3102. _proto.dispose = function dispose() {
  3103. $(this._element).off(EVENT_KEY$2);
  3104. $.removeData(this._element, DATA_KEY$2);
  3105. this._items = null;
  3106. this._config = null;
  3107. this._element = null;
  3108. this._interval = null;
  3109. this._isPaused = null;
  3110. this._isSliding = null;
  3111. this._activeElement = null;
  3112. this._indicatorsElement = null;
  3113. } // Private
  3114. ;
  3115. _proto._getConfig = function _getConfig(config) {
  3116. config = _objectSpread2({}, Default, {}, config);
  3117. Util.typeCheckConfig(NAME$2, config, DefaultType);
  3118. return config;
  3119. };
  3120. _proto._handleSwipe = function _handleSwipe() {
  3121. var absDeltax = Math.abs(this.touchDeltaX);
  3122. if (absDeltax <= SWIPE_THRESHOLD) {
  3123. return;
  3124. }
  3125. var direction = absDeltax / this.touchDeltaX;
  3126. this.touchDeltaX = 0; // swipe left
  3127. if (direction > 0) {
  3128. this.prev();
  3129. } // swipe right
  3130. if (direction < 0) {
  3131. this.next();
  3132. }
  3133. };
  3134. _proto._addEventListeners = function _addEventListeners() {
  3135. var _this2 = this;
  3136. if (this._config.keyboard) {
  3137. $(this._element).on(Event$2.KEYDOWN, function (event) {
  3138. return _this2._keydown(event);
  3139. });
  3140. }
  3141. if (this._config.pause === 'hover') {
  3142. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  3143. return _this2.pause(event);
  3144. }).on(Event$2.MOUSELEAVE, function (event) {
  3145. return _this2.cycle(event);
  3146. });
  3147. }
  3148. if (this._config.touch) {
  3149. this._addTouchEventListeners();
  3150. }
  3151. };
  3152. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  3153. var _this3 = this;
  3154. if (!this._touchSupported) {
  3155. return;
  3156. }
  3157. var start = function start(event) {
  3158. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3159. _this3.touchStartX = event.originalEvent.clientX;
  3160. } else if (!_this3._pointerEvent) {
  3161. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  3162. }
  3163. };
  3164. var move = function move(event) {
  3165. // ensure swiping with one touch and not pinching
  3166. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  3167. _this3.touchDeltaX = 0;
  3168. } else {
  3169. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  3170. }
  3171. };
  3172. var end = function end(event) {
  3173. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3174. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  3175. }
  3176. _this3._handleSwipe();
  3177. if (_this3._config.pause === 'hover') {
  3178. // If it's a touch-enabled device, mouseenter/leave are fired as
  3179. // part of the mouse compatibility events on first tap - the carousel
  3180. // would stop cycling until user tapped out of it;
  3181. // here, we listen for touchend, explicitly pause the carousel
  3182. // (as if it's the second time we tap on it, mouseenter compat event
  3183. // is NOT fired) and after a timeout (to allow for mouse compatibility
  3184. // events to fire) we explicitly restart cycling
  3185. _this3.pause();
  3186. if (_this3.touchTimeout) {
  3187. clearTimeout(_this3.touchTimeout);
  3188. }
  3189. _this3.touchTimeout = setTimeout(function (event) {
  3190. return _this3.cycle(event);
  3191. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  3192. }
  3193. };
  3194. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  3195. return e.preventDefault();
  3196. });
  3197. if (this._pointerEvent) {
  3198. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  3199. return start(event);
  3200. });
  3201. $(this._element).on(Event$2.POINTERUP, function (event) {
  3202. return end(event);
  3203. });
  3204. this._element.classList.add(ClassName$2.POINTER_EVENT);
  3205. } else {
  3206. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  3207. return start(event);
  3208. });
  3209. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  3210. return move(event);
  3211. });
  3212. $(this._element).on(Event$2.TOUCHEND, function (event) {
  3213. return end(event);
  3214. });
  3215. }
  3216. };
  3217. _proto._keydown = function _keydown(event) {
  3218. if (/input|textarea/i.test(event.target.tagName)) {
  3219. return;
  3220. }
  3221. switch (event.which) {
  3222. case ARROW_LEFT_KEYCODE:
  3223. event.preventDefault();
  3224. this.prev();
  3225. break;
  3226. case ARROW_RIGHT_KEYCODE:
  3227. event.preventDefault();
  3228. this.next();
  3229. break;
  3230. }
  3231. };
  3232. _proto._getItemIndex = function _getItemIndex(element) {
  3233. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  3234. return this._items.indexOf(element);
  3235. };
  3236. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  3237. var isNextDirection = direction === Direction.NEXT;
  3238. var isPrevDirection = direction === Direction.PREV;
  3239. var activeIndex = this._getItemIndex(activeElement);
  3240. var lastItemIndex = this._items.length - 1;
  3241. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  3242. if (isGoingToWrap && !this._config.wrap) {
  3243. return activeElement;
  3244. }
  3245. var delta = direction === Direction.PREV ? -1 : 1;
  3246. var itemIndex = (activeIndex + delta) % this._items.length;
  3247. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  3248. };
  3249. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  3250. var targetIndex = this._getItemIndex(relatedTarget);
  3251. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  3252. var slideEvent = $.Event(Event$2.SLIDE, {
  3253. relatedTarget: relatedTarget,
  3254. direction: eventDirectionName,
  3255. from: fromIndex,
  3256. to: targetIndex
  3257. });
  3258. $(this._element).trigger(slideEvent);
  3259. return slideEvent;
  3260. };
  3261. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  3262. if (this._indicatorsElement) {
  3263. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  3264. $(indicators).removeClass(ClassName$2.ACTIVE);
  3265. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  3266. if (nextIndicator) {
  3267. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  3268. }
  3269. }
  3270. };
  3271. _proto._slide = function _slide(direction, element) {
  3272. var _this4 = this;
  3273. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3274. var activeElementIndex = this._getItemIndex(activeElement);
  3275. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  3276. var nextElementIndex = this._getItemIndex(nextElement);
  3277. var isCycling = Boolean(this._interval);
  3278. var directionalClassName;
  3279. var orderClassName;
  3280. var eventDirectionName;
  3281. if (direction === Direction.NEXT) {
  3282. directionalClassName = ClassName$2.LEFT;
  3283. orderClassName = ClassName$2.NEXT;
  3284. eventDirectionName = Direction.LEFT;
  3285. } else {
  3286. directionalClassName = ClassName$2.RIGHT;
  3287. orderClassName = ClassName$2.PREV;
  3288. eventDirectionName = Direction.RIGHT;
  3289. }
  3290. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  3291. this._isSliding = false;
  3292. return;
  3293. }
  3294. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  3295. if (slideEvent.isDefaultPrevented()) {
  3296. return;
  3297. }
  3298. if (!activeElement || !nextElement) {
  3299. // Some weirdness is happening, so we bail
  3300. return;
  3301. }
  3302. this._isSliding = true;
  3303. if (isCycling) {
  3304. this.pause();
  3305. }
  3306. this._setActiveIndicatorElement(nextElement);
  3307. var slidEvent = $.Event(Event$2.SLID, {
  3308. relatedTarget: nextElement,
  3309. direction: eventDirectionName,
  3310. from: activeElementIndex,
  3311. to: nextElementIndex
  3312. });
  3313. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  3314. $(nextElement).addClass(orderClassName);
  3315. Util.reflow(nextElement);
  3316. $(activeElement).addClass(directionalClassName);
  3317. $(nextElement).addClass(directionalClassName);
  3318. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  3319. if (nextElementInterval) {
  3320. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  3321. this._config.interval = nextElementInterval;
  3322. } else {
  3323. this._config.interval = this._config.defaultInterval || this._config.interval;
  3324. }
  3325. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  3326. $(activeElement).one(Util.TRANSITION_END, function () {
  3327. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  3328. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  3329. _this4._isSliding = false;
  3330. setTimeout(function () {
  3331. return $(_this4._element).trigger(slidEvent);
  3332. }, 0);
  3333. }).emulateTransitionEnd(transitionDuration);
  3334. } else {
  3335. $(activeElement).removeClass(ClassName$2.ACTIVE);
  3336. $(nextElement).addClass(ClassName$2.ACTIVE);
  3337. this._isSliding = false;
  3338. $(this._element).trigger(slidEvent);
  3339. }
  3340. if (isCycling) {
  3341. this.cycle();
  3342. }
  3343. } // Static
  3344. ;
  3345. Carousel._jQueryInterface = function _jQueryInterface(config) {
  3346. return this.each(function () {
  3347. var data = $(this).data(DATA_KEY$2);
  3348. var _config = _objectSpread2({}, Default, {}, $(this).data());
  3349. if (typeof config === 'object') {
  3350. _config = _objectSpread2({}, _config, {}, config);
  3351. }
  3352. var action = typeof config === 'string' ? config : _config.slide;
  3353. if (!data) {
  3354. data = new Carousel(this, _config);
  3355. $(this).data(DATA_KEY$2, data);
  3356. }
  3357. if (typeof config === 'number') {
  3358. data.to(config);
  3359. } else if (typeof action === 'string') {
  3360. if (typeof data[action] === 'undefined') {
  3361. throw new TypeError("No method named \"" + action + "\"");
  3362. }
  3363. data[action]();
  3364. } else if (_config.interval && _config.ride) {
  3365. data.pause();
  3366. data.cycle();
  3367. }
  3368. });
  3369. };
  3370. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  3371. var selector = Util.getSelectorFromElement(this);
  3372. if (!selector) {
  3373. return;
  3374. }
  3375. var target = $(selector)[0];
  3376. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  3377. return;
  3378. }
  3379. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  3380. var slideIndex = this.getAttribute('data-slide-to');
  3381. if (slideIndex) {
  3382. config.interval = false;
  3383. }
  3384. Carousel._jQueryInterface.call($(target), config);
  3385. if (slideIndex) {
  3386. $(target).data(DATA_KEY$2).to(slideIndex);
  3387. }
  3388. event.preventDefault();
  3389. };
  3390. _createClass(Carousel, null, [{
  3391. key: "VERSION",
  3392. get: function get() {
  3393. return VERSION$2;
  3394. }
  3395. }, {
  3396. key: "Default",
  3397. get: function get() {
  3398. return Default;
  3399. }
  3400. }]);
  3401. return Carousel;
  3402. }();
  3403. /**
  3404. * ------------------------------------------------------------------------
  3405. * Data Api implementation
  3406. * ------------------------------------------------------------------------
  3407. */
  3408. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  3409. $(window).on(Event$2.LOAD_DATA_API, function () {
  3410. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  3411. for (var i = 0, len = carousels.length; i < len; i++) {
  3412. var $carousel = $(carousels[i]);
  3413. Carousel._jQueryInterface.call($carousel, $carousel.data());
  3414. }
  3415. });
  3416. /**
  3417. * ------------------------------------------------------------------------
  3418. * jQuery
  3419. * ------------------------------------------------------------------------
  3420. */
  3421. $.fn[NAME$2] = Carousel._jQueryInterface;
  3422. $.fn[NAME$2].Constructor = Carousel;
  3423. $.fn[NAME$2].noConflict = function () {
  3424. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  3425. return Carousel._jQueryInterface;
  3426. };
  3427. /**
  3428. * ------------------------------------------------------------------------
  3429. * Constants
  3430. * ------------------------------------------------------------------------
  3431. */
  3432. var NAME$3 = 'collapse';
  3433. var VERSION$3 = '4.4.1';
  3434. var DATA_KEY$3 = 'bs.collapse';
  3435. var EVENT_KEY$3 = "." + DATA_KEY$3;
  3436. var DATA_API_KEY$3 = '.data-api';
  3437. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  3438. var Default$1 = {
  3439. toggle: true,
  3440. parent: ''
  3441. };
  3442. var DefaultType$1 = {
  3443. toggle: 'boolean',
  3444. parent: '(string|element)'
  3445. };
  3446. var Event$3 = {
  3447. SHOW: "show" + EVENT_KEY$3,
  3448. SHOWN: "shown" + EVENT_KEY$3,
  3449. HIDE: "hide" + EVENT_KEY$3,
  3450. HIDDEN: "hidden" + EVENT_KEY$3,
  3451. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  3452. };
  3453. var ClassName$3 = {
  3454. SHOW: 'show',
  3455. COLLAPSE: 'collapse',
  3456. COLLAPSING: 'collapsing',
  3457. COLLAPSED: 'collapsed'
  3458. };
  3459. var Dimension = {
  3460. WIDTH: 'width',
  3461. HEIGHT: 'height'
  3462. };
  3463. var Selector$3 = {
  3464. ACTIVES: '.show, .collapsing',
  3465. DATA_TOGGLE: '[data-toggle="collapse"]'
  3466. };
  3467. /**
  3468. * ------------------------------------------------------------------------
  3469. * Class Definition
  3470. * ------------------------------------------------------------------------
  3471. */
  3472. var Collapse =
  3473. /*#__PURE__*/
  3474. function () {
  3475. function Collapse(element, config) {
  3476. this._isTransitioning = false;
  3477. this._element = element;
  3478. this._config = this._getConfig(config);
  3479. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  3480. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  3481. for (var i = 0, len = toggleList.length; i < len; i++) {
  3482. var elem = toggleList[i];
  3483. var selector = Util.getSelectorFromElement(elem);
  3484. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3485. return foundElem === element;
  3486. });
  3487. if (selector !== null && filterElement.length > 0) {
  3488. this._selector = selector;
  3489. this._triggerArray.push(elem);
  3490. }
  3491. }
  3492. this._parent = this._config.parent ? this._getParent() : null;
  3493. if (!this._config.parent) {
  3494. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3495. }
  3496. if (this._config.toggle) {
  3497. this.toggle();
  3498. }
  3499. } // Getters
  3500. var _proto = Collapse.prototype;
  3501. // Public
  3502. _proto.toggle = function toggle() {
  3503. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  3504. this.hide();
  3505. } else {
  3506. this.show();
  3507. }
  3508. };
  3509. _proto.show = function show() {
  3510. var _this = this;
  3511. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  3512. return;
  3513. }
  3514. var actives;
  3515. var activesData;
  3516. if (this._parent) {
  3517. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  3518. if (typeof _this._config.parent === 'string') {
  3519. return elem.getAttribute('data-parent') === _this._config.parent;
  3520. }
  3521. return elem.classList.contains(ClassName$3.COLLAPSE);
  3522. });
  3523. if (actives.length === 0) {
  3524. actives = null;
  3525. }
  3526. }
  3527. if (actives) {
  3528. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  3529. if (activesData && activesData._isTransitioning) {
  3530. return;
  3531. }
  3532. }
  3533. var startEvent = $.Event(Event$3.SHOW);
  3534. $(this._element).trigger(startEvent);
  3535. if (startEvent.isDefaultPrevented()) {
  3536. return;
  3537. }
  3538. if (actives) {
  3539. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  3540. if (!activesData) {
  3541. $(actives).data(DATA_KEY$3, null);
  3542. }
  3543. }
  3544. var dimension = this._getDimension();
  3545. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  3546. this._element.style[dimension] = 0;
  3547. if (this._triggerArray.length) {
  3548. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  3549. }
  3550. this.setTransitioning(true);
  3551. var complete = function complete() {
  3552. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  3553. _this._element.style[dimension] = '';
  3554. _this.setTransitioning(false);
  3555. $(_this._element).trigger(Event$3.SHOWN);
  3556. };
  3557. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3558. var scrollSize = "scroll" + capitalizedDimension;
  3559. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3560. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3561. this._element.style[dimension] = this._element[scrollSize] + "px";
  3562. };
  3563. _proto.hide = function hide() {
  3564. var _this2 = this;
  3565. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  3566. return;
  3567. }
  3568. var startEvent = $.Event(Event$3.HIDE);
  3569. $(this._element).trigger(startEvent);
  3570. if (startEvent.isDefaultPrevented()) {
  3571. return;
  3572. }
  3573. var dimension = this._getDimension();
  3574. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3575. Util.reflow(this._element);
  3576. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  3577. var triggerArrayLength = this._triggerArray.length;
  3578. if (triggerArrayLength > 0) {
  3579. for (var i = 0; i < triggerArrayLength; i++) {
  3580. var trigger = this._triggerArray[i];
  3581. var selector = Util.getSelectorFromElement(trigger);
  3582. if (selector !== null) {
  3583. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3584. if (!$elem.hasClass(ClassName$3.SHOW)) {
  3585. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  3586. }
  3587. }
  3588. }
  3589. }
  3590. this.setTransitioning(true);
  3591. var complete = function complete() {
  3592. _this2.setTransitioning(false);
  3593. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  3594. };
  3595. this._element.style[dimension] = '';
  3596. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3597. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3598. };
  3599. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3600. this._isTransitioning = isTransitioning;
  3601. };
  3602. _proto.dispose = function dispose() {
  3603. $.removeData(this._element, DATA_KEY$3);
  3604. this._config = null;
  3605. this._parent = null;
  3606. this._element = null;
  3607. this._triggerArray = null;
  3608. this._isTransitioning = null;
  3609. } // Private
  3610. ;
  3611. _proto._getConfig = function _getConfig(config) {
  3612. config = _objectSpread2({}, Default$1, {}, config);
  3613. config.toggle = Boolean(config.toggle); // Coerce string values
  3614. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3615. return config;
  3616. };
  3617. _proto._getDimension = function _getDimension() {
  3618. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  3619. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  3620. };
  3621. _proto._getParent = function _getParent() {
  3622. var _this3 = this;
  3623. var parent;
  3624. if (Util.isElement(this._config.parent)) {
  3625. parent = this._config.parent; // It's a jQuery object
  3626. if (typeof this._config.parent.jquery !== 'undefined') {
  3627. parent = this._config.parent[0];
  3628. }
  3629. } else {
  3630. parent = document.querySelector(this._config.parent);
  3631. }
  3632. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3633. var children = [].slice.call(parent.querySelectorAll(selector));
  3634. $(children).each(function (i, element) {
  3635. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3636. });
  3637. return parent;
  3638. };
  3639. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3640. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  3641. if (triggerArray.length) {
  3642. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3643. }
  3644. } // Static
  3645. ;
  3646. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3647. var selector = Util.getSelectorFromElement(element);
  3648. return selector ? document.querySelector(selector) : null;
  3649. };
  3650. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3651. return this.each(function () {
  3652. var $this = $(this);
  3653. var data = $this.data(DATA_KEY$3);
  3654. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  3655. if (!data && _config.toggle && /show|hide/.test(config)) {
  3656. _config.toggle = false;
  3657. }
  3658. if (!data) {
  3659. data = new Collapse(this, _config);
  3660. $this.data(DATA_KEY$3, data);
  3661. }
  3662. if (typeof config === 'string') {
  3663. if (typeof data[config] === 'undefined') {
  3664. throw new TypeError("No method named \"" + config + "\"");
  3665. }
  3666. data[config]();
  3667. }
  3668. });
  3669. };
  3670. _createClass(Collapse, null, [{
  3671. key: "VERSION",
  3672. get: function get() {
  3673. return VERSION$3;
  3674. }
  3675. }, {
  3676. key: "Default",
  3677. get: function get() {
  3678. return Default$1;
  3679. }
  3680. }]);
  3681. return Collapse;
  3682. }();
  3683. /**
  3684. * ------------------------------------------------------------------------
  3685. * Data Api implementation
  3686. * ------------------------------------------------------------------------
  3687. */
  3688. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  3689. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3690. if (event.currentTarget.tagName === 'A') {
  3691. event.preventDefault();
  3692. }
  3693. var $trigger = $(this);
  3694. var selector = Util.getSelectorFromElement(this);
  3695. var selectors = [].slice.call(document.querySelectorAll(selector));
  3696. $(selectors).each(function () {
  3697. var $target = $(this);
  3698. var data = $target.data(DATA_KEY$3);
  3699. var config = data ? 'toggle' : $trigger.data();
  3700. Collapse._jQueryInterface.call($target, config);
  3701. });
  3702. });
  3703. /**
  3704. * ------------------------------------------------------------------------
  3705. * jQuery
  3706. * ------------------------------------------------------------------------
  3707. */
  3708. $.fn[NAME$3] = Collapse._jQueryInterface;
  3709. $.fn[NAME$3].Constructor = Collapse;
  3710. $.fn[NAME$3].noConflict = function () {
  3711. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3712. return Collapse._jQueryInterface;
  3713. };
  3714. /**
  3715. * ------------------------------------------------------------------------
  3716. * Constants
  3717. * ------------------------------------------------------------------------
  3718. */
  3719. var NAME$4 = 'dropdown';
  3720. var VERSION$4 = '4.4.1';
  3721. var DATA_KEY$4 = 'bs.dropdown';
  3722. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3723. var DATA_API_KEY$4 = '.data-api';
  3724. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3725. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3726. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3727. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3728. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3729. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3730. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3731. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3732. var Event$4 = {
  3733. HIDE: "hide" + EVENT_KEY$4,
  3734. HIDDEN: "hidden" + EVENT_KEY$4,
  3735. SHOW: "show" + EVENT_KEY$4,
  3736. SHOWN: "shown" + EVENT_KEY$4,
  3737. CLICK: "click" + EVENT_KEY$4,
  3738. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3739. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3740. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3741. };
  3742. var ClassName$4 = {
  3743. DISABLED: 'disabled',
  3744. SHOW: 'show',
  3745. DROPUP: 'dropup',
  3746. DROPRIGHT: 'dropright',
  3747. DROPLEFT: 'dropleft',
  3748. MENURIGHT: 'dropdown-menu-right',
  3749. MENULEFT: 'dropdown-menu-left',
  3750. POSITION_STATIC: 'position-static'
  3751. };
  3752. var Selector$4 = {
  3753. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3754. FORM_CHILD: '.dropdown form',
  3755. MENU: '.dropdown-menu',
  3756. NAVBAR_NAV: '.navbar-nav',
  3757. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3758. };
  3759. var AttachmentMap = {
  3760. TOP: 'top-start',
  3761. TOPEND: 'top-end',
  3762. BOTTOM: 'bottom-start',
  3763. BOTTOMEND: 'bottom-end',
  3764. RIGHT: 'right-start',
  3765. RIGHTEND: 'right-end',
  3766. LEFT: 'left-start',
  3767. LEFTEND: 'left-end'
  3768. };
  3769. var Default$2 = {
  3770. offset: 0,
  3771. flip: true,
  3772. boundary: 'scrollParent',
  3773. reference: 'toggle',
  3774. display: 'dynamic',
  3775. popperConfig: null
  3776. };
  3777. var DefaultType$2 = {
  3778. offset: '(number|string|function)',
  3779. flip: 'boolean',
  3780. boundary: '(string|element)',
  3781. reference: '(string|element)',
  3782. display: 'string',
  3783. popperConfig: '(null|object)'
  3784. };
  3785. /**
  3786. * ------------------------------------------------------------------------
  3787. * Class Definition
  3788. * ------------------------------------------------------------------------
  3789. */
  3790. var Dropdown =
  3791. /*#__PURE__*/
  3792. function () {
  3793. function Dropdown(element, config) {
  3794. this._element = element;
  3795. this._popper = null;
  3796. this._config = this._getConfig(config);
  3797. this._menu = this._getMenuElement();
  3798. this._inNavbar = this._detectNavbar();
  3799. this._addEventListeners();
  3800. } // Getters
  3801. var _proto = Dropdown.prototype;
  3802. // Public
  3803. _proto.toggle = function toggle() {
  3804. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3805. return;
  3806. }
  3807. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3808. Dropdown._clearMenus();
  3809. if (isActive) {
  3810. return;
  3811. }
  3812. this.show(true);
  3813. };
  3814. _proto.show = function show(usePopper) {
  3815. if (usePopper === void 0) {
  3816. usePopper = false;
  3817. }
  3818. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3819. return;
  3820. }
  3821. var relatedTarget = {
  3822. relatedTarget: this._element
  3823. };
  3824. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3825. var parent = Dropdown._getParentFromElement(this._element);
  3826. $(parent).trigger(showEvent);
  3827. if (showEvent.isDefaultPrevented()) {
  3828. return;
  3829. } // Disable totally Popper.js for Dropdown in Navbar
  3830. if (!this._inNavbar && usePopper) {
  3831. /**
  3832. * Check for Popper dependency
  3833. * Popper - https://popper.js.org
  3834. */
  3835. if (typeof Popper === 'undefined') {
  3836. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3837. }
  3838. var referenceElement = this._element;
  3839. if (this._config.reference === 'parent') {
  3840. referenceElement = parent;
  3841. } else if (Util.isElement(this._config.reference)) {
  3842. referenceElement = this._config.reference; // Check if it's jQuery element
  3843. if (typeof this._config.reference.jquery !== 'undefined') {
  3844. referenceElement = this._config.reference[0];
  3845. }
  3846. } // If boundary is not `scrollParent`, then set position to `static`
  3847. // to allow the menu to "escape" the scroll parent's boundaries
  3848. // https://github.com/twbs/bootstrap/issues/24251
  3849. if (this._config.boundary !== 'scrollParent') {
  3850. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3851. }
  3852. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3853. } // If this is a touch-enabled device we add extra
  3854. // empty mouseover listeners to the body's immediate children;
  3855. // only needed because of broken event delegation on iOS
  3856. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3857. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  3858. $(document.body).children().on('mouseover', null, $.noop);
  3859. }
  3860. this._element.focus();
  3861. this._element.setAttribute('aria-expanded', true);
  3862. $(this._menu).toggleClass(ClassName$4.SHOW);
  3863. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3864. };
  3865. _proto.hide = function hide() {
  3866. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  3867. return;
  3868. }
  3869. var relatedTarget = {
  3870. relatedTarget: this._element
  3871. };
  3872. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3873. var parent = Dropdown._getParentFromElement(this._element);
  3874. $(parent).trigger(hideEvent);
  3875. if (hideEvent.isDefaultPrevented()) {
  3876. return;
  3877. }
  3878. if (this._popper) {
  3879. this._popper.destroy();
  3880. }
  3881. $(this._menu).toggleClass(ClassName$4.SHOW);
  3882. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3883. };
  3884. _proto.dispose = function dispose() {
  3885. $.removeData(this._element, DATA_KEY$4);
  3886. $(this._element).off(EVENT_KEY$4);
  3887. this._element = null;
  3888. this._menu = null;
  3889. if (this._popper !== null) {
  3890. this._popper.destroy();
  3891. this._popper = null;
  3892. }
  3893. };
  3894. _proto.update = function update() {
  3895. this._inNavbar = this._detectNavbar();
  3896. if (this._popper !== null) {
  3897. this._popper.scheduleUpdate();
  3898. }
  3899. } // Private
  3900. ;
  3901. _proto._addEventListeners = function _addEventListeners() {
  3902. var _this = this;
  3903. $(this._element).on(Event$4.CLICK, function (event) {
  3904. event.preventDefault();
  3905. event.stopPropagation();
  3906. _this.toggle();
  3907. });
  3908. };
  3909. _proto._getConfig = function _getConfig(config) {
  3910. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  3911. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3912. return config;
  3913. };
  3914. _proto._getMenuElement = function _getMenuElement() {
  3915. if (!this._menu) {
  3916. var parent = Dropdown._getParentFromElement(this._element);
  3917. if (parent) {
  3918. this._menu = parent.querySelector(Selector$4.MENU);
  3919. }
  3920. }
  3921. return this._menu;
  3922. };
  3923. _proto._getPlacement = function _getPlacement() {
  3924. var $parentDropdown = $(this._element.parentNode);
  3925. var placement = AttachmentMap.BOTTOM; // Handle dropup
  3926. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  3927. placement = AttachmentMap.TOP;
  3928. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3929. placement = AttachmentMap.TOPEND;
  3930. }
  3931. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  3932. placement = AttachmentMap.RIGHT;
  3933. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  3934. placement = AttachmentMap.LEFT;
  3935. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3936. placement = AttachmentMap.BOTTOMEND;
  3937. }
  3938. return placement;
  3939. };
  3940. _proto._detectNavbar = function _detectNavbar() {
  3941. return $(this._element).closest('.navbar').length > 0;
  3942. };
  3943. _proto._getOffset = function _getOffset() {
  3944. var _this2 = this;
  3945. var offset = {};
  3946. if (typeof this._config.offset === 'function') {
  3947. offset.fn = function (data) {
  3948. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  3949. return data;
  3950. };
  3951. } else {
  3952. offset.offset = this._config.offset;
  3953. }
  3954. return offset;
  3955. };
  3956. _proto._getPopperConfig = function _getPopperConfig() {
  3957. var popperConfig = {
  3958. placement: this._getPlacement(),
  3959. modifiers: {
  3960. offset: this._getOffset(),
  3961. flip: {
  3962. enabled: this._config.flip
  3963. },
  3964. preventOverflow: {
  3965. boundariesElement: this._config.boundary
  3966. }
  3967. }
  3968. }; // Disable Popper.js if we have a static display
  3969. if (this._config.display === 'static') {
  3970. popperConfig.modifiers.applyStyle = {
  3971. enabled: false
  3972. };
  3973. }
  3974. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  3975. } // Static
  3976. ;
  3977. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  3978. return this.each(function () {
  3979. var data = $(this).data(DATA_KEY$4);
  3980. var _config = typeof config === 'object' ? config : null;
  3981. if (!data) {
  3982. data = new Dropdown(this, _config);
  3983. $(this).data(DATA_KEY$4, data);
  3984. }
  3985. if (typeof config === 'string') {
  3986. if (typeof data[config] === 'undefined') {
  3987. throw new TypeError("No method named \"" + config + "\"");
  3988. }
  3989. data[config]();
  3990. }
  3991. });
  3992. };
  3993. Dropdown._clearMenus = function _clearMenus(event) {
  3994. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  3995. return;
  3996. }
  3997. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  3998. for (var i = 0, len = toggles.length; i < len; i++) {
  3999. var parent = Dropdown._getParentFromElement(toggles[i]);
  4000. var context = $(toggles[i]).data(DATA_KEY$4);
  4001. var relatedTarget = {
  4002. relatedTarget: toggles[i]
  4003. };
  4004. if (event && event.type === 'click') {
  4005. relatedTarget.clickEvent = event;
  4006. }
  4007. if (!context) {
  4008. continue;
  4009. }
  4010. var dropdownMenu = context._menu;
  4011. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  4012. continue;
  4013. }
  4014. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  4015. continue;
  4016. }
  4017. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4018. $(parent).trigger(hideEvent);
  4019. if (hideEvent.isDefaultPrevented()) {
  4020. continue;
  4021. } // If this is a touch-enabled device we remove the extra
  4022. // empty mouseover listeners we added for iOS support
  4023. if ('ontouchstart' in document.documentElement) {
  4024. $(document.body).children().off('mouseover', null, $.noop);
  4025. }
  4026. toggles[i].setAttribute('aria-expanded', 'false');
  4027. if (context._popper) {
  4028. context._popper.destroy();
  4029. }
  4030. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  4031. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4032. }
  4033. };
  4034. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  4035. var parent;
  4036. var selector = Util.getSelectorFromElement(element);
  4037. if (selector) {
  4038. parent = document.querySelector(selector);
  4039. }
  4040. return parent || element.parentNode;
  4041. } // eslint-disable-next-line complexity
  4042. ;
  4043. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  4044. // If not input/textarea:
  4045. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  4046. // If input/textarea:
  4047. // - If space key => not a dropdown command
  4048. // - If key is other than escape
  4049. // - If key is not up or down => not a dropdown command
  4050. // - If trigger inside the menu => not a dropdown command
  4051. 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)) {
  4052. return;
  4053. }
  4054. event.preventDefault();
  4055. event.stopPropagation();
  4056. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  4057. return;
  4058. }
  4059. var parent = Dropdown._getParentFromElement(this);
  4060. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  4061. if (!isActive && event.which === ESCAPE_KEYCODE) {
  4062. return;
  4063. }
  4064. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  4065. if (event.which === ESCAPE_KEYCODE) {
  4066. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  4067. $(toggle).trigger('focus');
  4068. }
  4069. $(this).trigger('click');
  4070. return;
  4071. }
  4072. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  4073. return $(item).is(':visible');
  4074. });
  4075. if (items.length === 0) {
  4076. return;
  4077. }
  4078. var index = items.indexOf(event.target);
  4079. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  4080. // Up
  4081. index--;
  4082. }
  4083. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  4084. // Down
  4085. index++;
  4086. }
  4087. if (index < 0) {
  4088. index = 0;
  4089. }
  4090. items[index].focus();
  4091. };
  4092. _createClass(Dropdown, null, [{
  4093. key: "VERSION",
  4094. get: function get() {
  4095. return VERSION$4;
  4096. }
  4097. }, {
  4098. key: "Default",
  4099. get: function get() {
  4100. return Default$2;
  4101. }
  4102. }, {
  4103. key: "DefaultType",
  4104. get: function get() {
  4105. return DefaultType$2;
  4106. }
  4107. }]);
  4108. return Dropdown;
  4109. }();
  4110. /**
  4111. * ------------------------------------------------------------------------
  4112. * Data Api implementation
  4113. * ------------------------------------------------------------------------
  4114. */
  4115. $(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) {
  4116. event.preventDefault();
  4117. event.stopPropagation();
  4118. Dropdown._jQueryInterface.call($(this), 'toggle');
  4119. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  4120. e.stopPropagation();
  4121. });
  4122. /**
  4123. * ------------------------------------------------------------------------
  4124. * jQuery
  4125. * ------------------------------------------------------------------------
  4126. */
  4127. $.fn[NAME$4] = Dropdown._jQueryInterface;
  4128. $.fn[NAME$4].Constructor = Dropdown;
  4129. $.fn[NAME$4].noConflict = function () {
  4130. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  4131. return Dropdown._jQueryInterface;
  4132. };
  4133. /**
  4134. * ------------------------------------------------------------------------
  4135. * Constants
  4136. * ------------------------------------------------------------------------
  4137. */
  4138. var NAME$5 = 'modal';
  4139. var VERSION$5 = '4.4.1';
  4140. var DATA_KEY$5 = 'bs.modal';
  4141. var EVENT_KEY$5 = "." + DATA_KEY$5;
  4142. var DATA_API_KEY$5 = '.data-api';
  4143. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  4144. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  4145. var Default$3 = {
  4146. backdrop: true,
  4147. keyboard: true,
  4148. focus: true,
  4149. show: true
  4150. };
  4151. var DefaultType$3 = {
  4152. backdrop: '(boolean|string)',
  4153. keyboard: 'boolean',
  4154. focus: 'boolean',
  4155. show: 'boolean'
  4156. };
  4157. var Event$5 = {
  4158. HIDE: "hide" + EVENT_KEY$5,
  4159. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  4160. HIDDEN: "hidden" + EVENT_KEY$5,
  4161. SHOW: "show" + EVENT_KEY$5,
  4162. SHOWN: "shown" + EVENT_KEY$5,
  4163. FOCUSIN: "focusin" + EVENT_KEY$5,
  4164. RESIZE: "resize" + EVENT_KEY$5,
  4165. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  4166. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  4167. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  4168. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  4169. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  4170. };
  4171. var ClassName$5 = {
  4172. SCROLLABLE: 'modal-dialog-scrollable',
  4173. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  4174. BACKDROP: 'modal-backdrop',
  4175. OPEN: 'modal-open',
  4176. FADE: 'fade',
  4177. SHOW: 'show',
  4178. STATIC: 'modal-static'
  4179. };
  4180. var Selector$5 = {
  4181. DIALOG: '.modal-dialog',
  4182. MODAL_BODY: '.modal-body',
  4183. DATA_TOGGLE: '[data-toggle="modal"]',
  4184. DATA_DISMISS: '[data-dismiss="modal"]',
  4185. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  4186. STICKY_CONTENT: '.sticky-top'
  4187. };
  4188. /**
  4189. * ------------------------------------------------------------------------
  4190. * Class Definition
  4191. * ------------------------------------------------------------------------
  4192. */
  4193. var Modal =
  4194. /*#__PURE__*/
  4195. function () {
  4196. function Modal(element, config) {
  4197. this._config = this._getConfig(config);
  4198. this._element = element;
  4199. this._dialog = element.querySelector(Selector$5.DIALOG);
  4200. this._backdrop = null;
  4201. this._isShown = false;
  4202. this._isBodyOverflowing = false;
  4203. this._ignoreBackdropClick = false;
  4204. this._isTransitioning = false;
  4205. this._scrollbarWidth = 0;
  4206. } // Getters
  4207. var _proto = Modal.prototype;
  4208. // Public
  4209. _proto.toggle = function toggle(relatedTarget) {
  4210. return this._isShown ? this.hide() : this.show(relatedTarget);
  4211. };
  4212. _proto.show = function show(relatedTarget) {
  4213. var _this = this;
  4214. if (this._isShown || this._isTransitioning) {
  4215. return;
  4216. }
  4217. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4218. this._isTransitioning = true;
  4219. }
  4220. var showEvent = $.Event(Event$5.SHOW, {
  4221. relatedTarget: relatedTarget
  4222. });
  4223. $(this._element).trigger(showEvent);
  4224. if (this._isShown || showEvent.isDefaultPrevented()) {
  4225. return;
  4226. }
  4227. this._isShown = true;
  4228. this._checkScrollbar();
  4229. this._setScrollbar();
  4230. this._adjustDialog();
  4231. this._setEscapeEvent();
  4232. this._setResizeEvent();
  4233. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  4234. return _this.hide(event);
  4235. });
  4236. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  4237. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  4238. if ($(event.target).is(_this._element)) {
  4239. _this._ignoreBackdropClick = true;
  4240. }
  4241. });
  4242. });
  4243. this._showBackdrop(function () {
  4244. return _this._showElement(relatedTarget);
  4245. });
  4246. };
  4247. _proto.hide = function hide(event) {
  4248. var _this2 = this;
  4249. if (event) {
  4250. event.preventDefault();
  4251. }
  4252. if (!this._isShown || this._isTransitioning) {
  4253. return;
  4254. }
  4255. var hideEvent = $.Event(Event$5.HIDE);
  4256. $(this._element).trigger(hideEvent);
  4257. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  4258. return;
  4259. }
  4260. this._isShown = false;
  4261. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4262. if (transition) {
  4263. this._isTransitioning = true;
  4264. }
  4265. this._setEscapeEvent();
  4266. this._setResizeEvent();
  4267. $(document).off(Event$5.FOCUSIN);
  4268. $(this._element).removeClass(ClassName$5.SHOW);
  4269. $(this._element).off(Event$5.CLICK_DISMISS);
  4270. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  4271. if (transition) {
  4272. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4273. $(this._element).one(Util.TRANSITION_END, function (event) {
  4274. return _this2._hideModal(event);
  4275. }).emulateTransitionEnd(transitionDuration);
  4276. } else {
  4277. this._hideModal();
  4278. }
  4279. };
  4280. _proto.dispose = function dispose() {
  4281. [window, this._element, this._dialog].forEach(function (htmlElement) {
  4282. return $(htmlElement).off(EVENT_KEY$5);
  4283. });
  4284. /**
  4285. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  4286. * Do not move `document` in `htmlElements` array
  4287. * It will remove `Event.CLICK_DATA_API` event that should remain
  4288. */
  4289. $(document).off(Event$5.FOCUSIN);
  4290. $.removeData(this._element, DATA_KEY$5);
  4291. this._config = null;
  4292. this._element = null;
  4293. this._dialog = null;
  4294. this._backdrop = null;
  4295. this._isShown = null;
  4296. this._isBodyOverflowing = null;
  4297. this._ignoreBackdropClick = null;
  4298. this._isTransitioning = null;
  4299. this._scrollbarWidth = null;
  4300. };
  4301. _proto.handleUpdate = function handleUpdate() {
  4302. this._adjustDialog();
  4303. } // Private
  4304. ;
  4305. _proto._getConfig = function _getConfig(config) {
  4306. config = _objectSpread2({}, Default$3, {}, config);
  4307. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  4308. return config;
  4309. };
  4310. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  4311. var _this3 = this;
  4312. if (this._config.backdrop === 'static') {
  4313. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  4314. $(this._element).trigger(hideEventPrevented);
  4315. if (hideEventPrevented.defaultPrevented) {
  4316. return;
  4317. }
  4318. this._element.classList.add(ClassName$5.STATIC);
  4319. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  4320. $(this._element).one(Util.TRANSITION_END, function () {
  4321. _this3._element.classList.remove(ClassName$5.STATIC);
  4322. }).emulateTransitionEnd(modalTransitionDuration);
  4323. this._element.focus();
  4324. } else {
  4325. this.hide();
  4326. }
  4327. };
  4328. _proto._showElement = function _showElement(relatedTarget) {
  4329. var _this4 = this;
  4330. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4331. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  4332. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  4333. // Don't move modal's DOM position
  4334. document.body.appendChild(this._element);
  4335. }
  4336. this._element.style.display = 'block';
  4337. this._element.removeAttribute('aria-hidden');
  4338. this._element.setAttribute('aria-modal', true);
  4339. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  4340. modalBody.scrollTop = 0;
  4341. } else {
  4342. this._element.scrollTop = 0;
  4343. }
  4344. if (transition) {
  4345. Util.reflow(this._element);
  4346. }
  4347. $(this._element).addClass(ClassName$5.SHOW);
  4348. if (this._config.focus) {
  4349. this._enforceFocus();
  4350. }
  4351. var shownEvent = $.Event(Event$5.SHOWN, {
  4352. relatedTarget: relatedTarget
  4353. });
  4354. var transitionComplete = function transitionComplete() {
  4355. if (_this4._config.focus) {
  4356. _this4._element.focus();
  4357. }
  4358. _this4._isTransitioning = false;
  4359. $(_this4._element).trigger(shownEvent);
  4360. };
  4361. if (transition) {
  4362. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  4363. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  4364. } else {
  4365. transitionComplete();
  4366. }
  4367. };
  4368. _proto._enforceFocus = function _enforceFocus() {
  4369. var _this5 = this;
  4370. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  4371. .on(Event$5.FOCUSIN, function (event) {
  4372. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  4373. _this5._element.focus();
  4374. }
  4375. });
  4376. };
  4377. _proto._setEscapeEvent = function _setEscapeEvent() {
  4378. var _this6 = this;
  4379. if (this._isShown && this._config.keyboard) {
  4380. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  4381. if (event.which === ESCAPE_KEYCODE$1) {
  4382. _this6._triggerBackdropTransition();
  4383. }
  4384. });
  4385. } else if (!this._isShown) {
  4386. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  4387. }
  4388. };
  4389. _proto._setResizeEvent = function _setResizeEvent() {
  4390. var _this7 = this;
  4391. if (this._isShown) {
  4392. $(window).on(Event$5.RESIZE, function (event) {
  4393. return _this7.handleUpdate(event);
  4394. });
  4395. } else {
  4396. $(window).off(Event$5.RESIZE);
  4397. }
  4398. };
  4399. _proto._hideModal = function _hideModal() {
  4400. var _this8 = this;
  4401. this._element.style.display = 'none';
  4402. this._element.setAttribute('aria-hidden', true);
  4403. this._element.removeAttribute('aria-modal');
  4404. this._isTransitioning = false;
  4405. this._showBackdrop(function () {
  4406. $(document.body).removeClass(ClassName$5.OPEN);
  4407. _this8._resetAdjustments();
  4408. _this8._resetScrollbar();
  4409. $(_this8._element).trigger(Event$5.HIDDEN);
  4410. });
  4411. };
  4412. _proto._removeBackdrop = function _removeBackdrop() {
  4413. if (this._backdrop) {
  4414. $(this._backdrop).remove();
  4415. this._backdrop = null;
  4416. }
  4417. };
  4418. _proto._showBackdrop = function _showBackdrop(callback) {
  4419. var _this9 = this;
  4420. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4421. if (this._isShown && this._config.backdrop) {
  4422. this._backdrop = document.createElement('div');
  4423. this._backdrop.className = ClassName$5.BACKDROP;
  4424. if (animate) {
  4425. this._backdrop.classList.add(animate);
  4426. }
  4427. $(this._backdrop).appendTo(document.body);
  4428. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4429. if (_this9._ignoreBackdropClick) {
  4430. _this9._ignoreBackdropClick = false;
  4431. return;
  4432. }
  4433. if (event.target !== event.currentTarget) {
  4434. return;
  4435. }
  4436. _this9._triggerBackdropTransition();
  4437. });
  4438. if (animate) {
  4439. Util.reflow(this._backdrop);
  4440. }
  4441. $(this._backdrop).addClass(ClassName$5.SHOW);
  4442. if (!callback) {
  4443. return;
  4444. }
  4445. if (!animate) {
  4446. callback();
  4447. return;
  4448. }
  4449. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4450. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4451. } else if (!this._isShown && this._backdrop) {
  4452. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4453. var callbackRemove = function callbackRemove() {
  4454. _this9._removeBackdrop();
  4455. if (callback) {
  4456. callback();
  4457. }
  4458. };
  4459. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4460. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4461. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4462. } else {
  4463. callbackRemove();
  4464. }
  4465. } else if (callback) {
  4466. callback();
  4467. }
  4468. } // ----------------------------------------------------------------------
  4469. // the following methods are used to handle overflowing modals
  4470. // todo (fat): these should probably be refactored out of modal.js
  4471. // ----------------------------------------------------------------------
  4472. ;
  4473. _proto._adjustDialog = function _adjustDialog() {
  4474. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4475. if (!this._isBodyOverflowing && isModalOverflowing) {
  4476. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4477. }
  4478. if (this._isBodyOverflowing && !isModalOverflowing) {
  4479. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4480. }
  4481. };
  4482. _proto._resetAdjustments = function _resetAdjustments() {
  4483. this._element.style.paddingLeft = '';
  4484. this._element.style.paddingRight = '';
  4485. };
  4486. _proto._checkScrollbar = function _checkScrollbar() {
  4487. var rect = document.body.getBoundingClientRect();
  4488. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4489. this._scrollbarWidth = this._getScrollbarWidth();
  4490. };
  4491. _proto._setScrollbar = function _setScrollbar() {
  4492. var _this10 = this;
  4493. if (this._isBodyOverflowing) {
  4494. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4495. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4496. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4497. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4498. $(fixedContent).each(function (index, element) {
  4499. var actualPadding = element.style.paddingRight;
  4500. var calculatedPadding = $(element).css('padding-right');
  4501. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4502. }); // Adjust sticky content margin
  4503. $(stickyContent).each(function (index, element) {
  4504. var actualMargin = element.style.marginRight;
  4505. var calculatedMargin = $(element).css('margin-right');
  4506. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4507. }); // Adjust body padding
  4508. var actualPadding = document.body.style.paddingRight;
  4509. var calculatedPadding = $(document.body).css('padding-right');
  4510. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4511. }
  4512. $(document.body).addClass(ClassName$5.OPEN);
  4513. };
  4514. _proto._resetScrollbar = function _resetScrollbar() {
  4515. // Restore fixed content padding
  4516. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4517. $(fixedContent).each(function (index, element) {
  4518. var padding = $(element).data('padding-right');
  4519. $(element).removeData('padding-right');
  4520. element.style.paddingRight = padding ? padding : '';
  4521. }); // Restore sticky content
  4522. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4523. $(elements).each(function (index, element) {
  4524. var margin = $(element).data('margin-right');
  4525. if (typeof margin !== 'undefined') {
  4526. $(element).css('margin-right', margin).removeData('margin-right');
  4527. }
  4528. }); // Restore body padding
  4529. var padding = $(document.body).data('padding-right');
  4530. $(document.body).removeData('padding-right');
  4531. document.body.style.paddingRight = padding ? padding : '';
  4532. };
  4533. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4534. // thx d.walsh
  4535. var scrollDiv = document.createElement('div');
  4536. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4537. document.body.appendChild(scrollDiv);
  4538. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4539. document.body.removeChild(scrollDiv);
  4540. return scrollbarWidth;
  4541. } // Static
  4542. ;
  4543. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4544. return this.each(function () {
  4545. var data = $(this).data(DATA_KEY$5);
  4546. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  4547. if (!data) {
  4548. data = new Modal(this, _config);
  4549. $(this).data(DATA_KEY$5, data);
  4550. }
  4551. if (typeof config === 'string') {
  4552. if (typeof data[config] === 'undefined') {
  4553. throw new TypeError("No method named \"" + config + "\"");
  4554. }
  4555. data[config](relatedTarget);
  4556. } else if (_config.show) {
  4557. data.show(relatedTarget);
  4558. }
  4559. });
  4560. };
  4561. _createClass(Modal, null, [{
  4562. key: "VERSION",
  4563. get: function get() {
  4564. return VERSION$5;
  4565. }
  4566. }, {
  4567. key: "Default",
  4568. get: function get() {
  4569. return Default$3;
  4570. }
  4571. }]);
  4572. return Modal;
  4573. }();
  4574. /**
  4575. * ------------------------------------------------------------------------
  4576. * Data Api implementation
  4577. * ------------------------------------------------------------------------
  4578. */
  4579. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4580. var _this11 = this;
  4581. var target;
  4582. var selector = Util.getSelectorFromElement(this);
  4583. if (selector) {
  4584. target = document.querySelector(selector);
  4585. }
  4586. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  4587. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4588. event.preventDefault();
  4589. }
  4590. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4591. if (showEvent.isDefaultPrevented()) {
  4592. // Only register focus restorer if modal will actually get shown
  4593. return;
  4594. }
  4595. $target.one(Event$5.HIDDEN, function () {
  4596. if ($(_this11).is(':visible')) {
  4597. _this11.focus();
  4598. }
  4599. });
  4600. });
  4601. Modal._jQueryInterface.call($(target), config, this);
  4602. });
  4603. /**
  4604. * ------------------------------------------------------------------------
  4605. * jQuery
  4606. * ------------------------------------------------------------------------
  4607. */
  4608. $.fn[NAME$5] = Modal._jQueryInterface;
  4609. $.fn[NAME$5].Constructor = Modal;
  4610. $.fn[NAME$5].noConflict = function () {
  4611. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4612. return Modal._jQueryInterface;
  4613. };
  4614. /**
  4615. * --------------------------------------------------------------------------
  4616. * Bootstrap (v4.4.1): tools/sanitizer.js
  4617. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4618. * --------------------------------------------------------------------------
  4619. */
  4620. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4621. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4622. var DefaultWhitelist = {
  4623. // Global attributes allowed on any supplied element below.
  4624. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4625. a: ['target', 'href', 'title', 'rel'],
  4626. area: [],
  4627. b: [],
  4628. br: [],
  4629. col: [],
  4630. code: [],
  4631. div: [],
  4632. em: [],
  4633. hr: [],
  4634. h1: [],
  4635. h2: [],
  4636. h3: [],
  4637. h4: [],
  4638. h5: [],
  4639. h6: [],
  4640. i: [],
  4641. img: ['src', 'alt', 'title', 'width', 'height'],
  4642. li: [],
  4643. ol: [],
  4644. p: [],
  4645. pre: [],
  4646. s: [],
  4647. small: [],
  4648. span: [],
  4649. sub: [],
  4650. sup: [],
  4651. strong: [],
  4652. u: [],
  4653. ul: []
  4654. };
  4655. /**
  4656. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4657. *
  4658. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4659. */
  4660. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4661. /**
  4662. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4663. *
  4664. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4665. */
  4666. 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;
  4667. function allowedAttribute(attr, allowedAttributeList) {
  4668. var attrName = attr.nodeName.toLowerCase();
  4669. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4670. if (uriAttrs.indexOf(attrName) !== -1) {
  4671. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4672. }
  4673. return true;
  4674. }
  4675. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4676. return attrRegex instanceof RegExp;
  4677. }); // Check if a regular expression validates the attribute.
  4678. for (var i = 0, l = regExp.length; i < l; i++) {
  4679. if (attrName.match(regExp[i])) {
  4680. return true;
  4681. }
  4682. }
  4683. return false;
  4684. }
  4685. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4686. if (unsafeHtml.length === 0) {
  4687. return unsafeHtml;
  4688. }
  4689. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4690. return sanitizeFn(unsafeHtml);
  4691. }
  4692. var domParser = new window.DOMParser();
  4693. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4694. var whitelistKeys = Object.keys(whiteList);
  4695. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4696. var _loop = function _loop(i, len) {
  4697. var el = elements[i];
  4698. var elName = el.nodeName.toLowerCase();
  4699. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4700. el.parentNode.removeChild(el);
  4701. return "continue";
  4702. }
  4703. var attributeList = [].slice.call(el.attributes);
  4704. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4705. attributeList.forEach(function (attr) {
  4706. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4707. el.removeAttribute(attr.nodeName);
  4708. }
  4709. });
  4710. };
  4711. for (var i = 0, len = elements.length; i < len; i++) {
  4712. var _ret = _loop(i);
  4713. if (_ret === "continue") continue;
  4714. }
  4715. return createdDocument.body.innerHTML;
  4716. }
  4717. /**
  4718. * ------------------------------------------------------------------------
  4719. * Constants
  4720. * ------------------------------------------------------------------------
  4721. */
  4722. var NAME$6 = 'tooltip';
  4723. var VERSION$6 = '4.4.1';
  4724. var DATA_KEY$6 = 'bs.tooltip';
  4725. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4726. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4727. var CLASS_PREFIX = 'bs-tooltip';
  4728. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4729. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4730. var DefaultType$4 = {
  4731. animation: 'boolean',
  4732. template: 'string',
  4733. title: '(string|element|function)',
  4734. trigger: 'string',
  4735. delay: '(number|object)',
  4736. html: 'boolean',
  4737. selector: '(string|boolean)',
  4738. placement: '(string|function)',
  4739. offset: '(number|string|function)',
  4740. container: '(string|element|boolean)',
  4741. fallbackPlacement: '(string|array)',
  4742. boundary: '(string|element)',
  4743. sanitize: 'boolean',
  4744. sanitizeFn: '(null|function)',
  4745. whiteList: 'object',
  4746. popperConfig: '(null|object)'
  4747. };
  4748. var AttachmentMap$1 = {
  4749. AUTO: 'auto',
  4750. TOP: 'top',
  4751. RIGHT: 'right',
  4752. BOTTOM: 'bottom',
  4753. LEFT: 'left'
  4754. };
  4755. var Default$4 = {
  4756. animation: true,
  4757. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4758. trigger: 'hover focus',
  4759. title: '',
  4760. delay: 0,
  4761. html: false,
  4762. selector: false,
  4763. placement: 'top',
  4764. offset: 0,
  4765. container: false,
  4766. fallbackPlacement: 'flip',
  4767. boundary: 'scrollParent',
  4768. sanitize: true,
  4769. sanitizeFn: null,
  4770. whiteList: DefaultWhitelist,
  4771. popperConfig: null
  4772. };
  4773. var HoverState = {
  4774. SHOW: 'show',
  4775. OUT: 'out'
  4776. };
  4777. var Event$6 = {
  4778. HIDE: "hide" + EVENT_KEY$6,
  4779. HIDDEN: "hidden" + EVENT_KEY$6,
  4780. SHOW: "show" + EVENT_KEY$6,
  4781. SHOWN: "shown" + EVENT_KEY$6,
  4782. INSERTED: "inserted" + EVENT_KEY$6,
  4783. CLICK: "click" + EVENT_KEY$6,
  4784. FOCUSIN: "focusin" + EVENT_KEY$6,
  4785. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4786. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4787. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4788. };
  4789. var ClassName$6 = {
  4790. FADE: 'fade',
  4791. SHOW: 'show'
  4792. };
  4793. var Selector$6 = {
  4794. TOOLTIP: '.tooltip',
  4795. TOOLTIP_INNER: '.tooltip-inner',
  4796. ARROW: '.arrow'
  4797. };
  4798. var Trigger = {
  4799. HOVER: 'hover',
  4800. FOCUS: 'focus',
  4801. CLICK: 'click',
  4802. MANUAL: 'manual'
  4803. };
  4804. /**
  4805. * ------------------------------------------------------------------------
  4806. * Class Definition
  4807. * ------------------------------------------------------------------------
  4808. */
  4809. var Tooltip =
  4810. /*#__PURE__*/
  4811. function () {
  4812. function Tooltip(element, config) {
  4813. if (typeof Popper === 'undefined') {
  4814. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4815. } // private
  4816. this._isEnabled = true;
  4817. this._timeout = 0;
  4818. this._hoverState = '';
  4819. this._activeTrigger = {};
  4820. this._popper = null; // Protected
  4821. this.element = element;
  4822. this.config = this._getConfig(config);
  4823. this.tip = null;
  4824. this._setListeners();
  4825. } // Getters
  4826. var _proto = Tooltip.prototype;
  4827. // Public
  4828. _proto.enable = function enable() {
  4829. this._isEnabled = true;
  4830. };
  4831. _proto.disable = function disable() {
  4832. this._isEnabled = false;
  4833. };
  4834. _proto.toggleEnabled = function toggleEnabled() {
  4835. this._isEnabled = !this._isEnabled;
  4836. };
  4837. _proto.toggle = function toggle(event) {
  4838. if (!this._isEnabled) {
  4839. return;
  4840. }
  4841. if (event) {
  4842. var dataKey = this.constructor.DATA_KEY;
  4843. var context = $(event.currentTarget).data(dataKey);
  4844. if (!context) {
  4845. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4846. $(event.currentTarget).data(dataKey, context);
  4847. }
  4848. context._activeTrigger.click = !context._activeTrigger.click;
  4849. if (context._isWithActiveTrigger()) {
  4850. context._enter(null, context);
  4851. } else {
  4852. context._leave(null, context);
  4853. }
  4854. } else {
  4855. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  4856. this._leave(null, this);
  4857. return;
  4858. }
  4859. this._enter(null, this);
  4860. }
  4861. };
  4862. _proto.dispose = function dispose() {
  4863. clearTimeout(this._timeout);
  4864. $.removeData(this.element, this.constructor.DATA_KEY);
  4865. $(this.element).off(this.constructor.EVENT_KEY);
  4866. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  4867. if (this.tip) {
  4868. $(this.tip).remove();
  4869. }
  4870. this._isEnabled = null;
  4871. this._timeout = null;
  4872. this._hoverState = null;
  4873. this._activeTrigger = null;
  4874. if (this._popper) {
  4875. this._popper.destroy();
  4876. }
  4877. this._popper = null;
  4878. this.element = null;
  4879. this.config = null;
  4880. this.tip = null;
  4881. };
  4882. _proto.show = function show() {
  4883. var _this = this;
  4884. if ($(this.element).css('display') === 'none') {
  4885. throw new Error('Please use show on visible elements');
  4886. }
  4887. var showEvent = $.Event(this.constructor.Event.SHOW);
  4888. if (this.isWithContent() && this._isEnabled) {
  4889. $(this.element).trigger(showEvent);
  4890. var shadowRoot = Util.findShadowRoot(this.element);
  4891. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  4892. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  4893. return;
  4894. }
  4895. var tip = this.getTipElement();
  4896. var tipId = Util.getUID(this.constructor.NAME);
  4897. tip.setAttribute('id', tipId);
  4898. this.element.setAttribute('aria-describedby', tipId);
  4899. this.setContent();
  4900. if (this.config.animation) {
  4901. $(tip).addClass(ClassName$6.FADE);
  4902. }
  4903. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  4904. var attachment = this._getAttachment(placement);
  4905. this.addAttachmentClass(attachment);
  4906. var container = this._getContainer();
  4907. $(tip).data(this.constructor.DATA_KEY, this);
  4908. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  4909. $(tip).appendTo(container);
  4910. }
  4911. $(this.element).trigger(this.constructor.Event.INSERTED);
  4912. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  4913. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  4914. // empty mouseover listeners to the body's immediate children;
  4915. // only needed because of broken event delegation on iOS
  4916. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4917. if ('ontouchstart' in document.documentElement) {
  4918. $(document.body).children().on('mouseover', null, $.noop);
  4919. }
  4920. var complete = function complete() {
  4921. if (_this.config.animation) {
  4922. _this._fixTransition();
  4923. }
  4924. var prevHoverState = _this._hoverState;
  4925. _this._hoverState = null;
  4926. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  4927. if (prevHoverState === HoverState.OUT) {
  4928. _this._leave(null, _this);
  4929. }
  4930. };
  4931. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4932. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  4933. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4934. } else {
  4935. complete();
  4936. }
  4937. }
  4938. };
  4939. _proto.hide = function hide(callback) {
  4940. var _this2 = this;
  4941. var tip = this.getTipElement();
  4942. var hideEvent = $.Event(this.constructor.Event.HIDE);
  4943. var complete = function complete() {
  4944. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  4945. tip.parentNode.removeChild(tip);
  4946. }
  4947. _this2._cleanTipClass();
  4948. _this2.element.removeAttribute('aria-describedby');
  4949. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  4950. if (_this2._popper !== null) {
  4951. _this2._popper.destroy();
  4952. }
  4953. if (callback) {
  4954. callback();
  4955. }
  4956. };
  4957. $(this.element).trigger(hideEvent);
  4958. if (hideEvent.isDefaultPrevented()) {
  4959. return;
  4960. }
  4961. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  4962. // empty mouseover listeners we added for iOS support
  4963. if ('ontouchstart' in document.documentElement) {
  4964. $(document.body).children().off('mouseover', null, $.noop);
  4965. }
  4966. this._activeTrigger[Trigger.CLICK] = false;
  4967. this._activeTrigger[Trigger.FOCUS] = false;
  4968. this._activeTrigger[Trigger.HOVER] = false;
  4969. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4970. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  4971. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4972. } else {
  4973. complete();
  4974. }
  4975. this._hoverState = '';
  4976. };
  4977. _proto.update = function update() {
  4978. if (this._popper !== null) {
  4979. this._popper.scheduleUpdate();
  4980. }
  4981. } // Protected
  4982. ;
  4983. _proto.isWithContent = function isWithContent() {
  4984. return Boolean(this.getTitle());
  4985. };
  4986. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4987. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  4988. };
  4989. _proto.getTipElement = function getTipElement() {
  4990. this.tip = this.tip || $(this.config.template)[0];
  4991. return this.tip;
  4992. };
  4993. _proto.setContent = function setContent() {
  4994. var tip = this.getTipElement();
  4995. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  4996. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  4997. };
  4998. _proto.setElementContent = function setElementContent($element, content) {
  4999. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  5000. // Content is a DOM node or a jQuery
  5001. if (this.config.html) {
  5002. if (!$(content).parent().is($element)) {
  5003. $element.empty().append(content);
  5004. }
  5005. } else {
  5006. $element.text($(content).text());
  5007. }
  5008. return;
  5009. }
  5010. if (this.config.html) {
  5011. if (this.config.sanitize) {
  5012. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  5013. }
  5014. $element.html(content);
  5015. } else {
  5016. $element.text(content);
  5017. }
  5018. };
  5019. _proto.getTitle = function getTitle() {
  5020. var title = this.element.getAttribute('data-original-title');
  5021. if (!title) {
  5022. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  5023. }
  5024. return title;
  5025. } // Private
  5026. ;
  5027. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  5028. var _this3 = this;
  5029. var defaultBsConfig = {
  5030. placement: attachment,
  5031. modifiers: {
  5032. offset: this._getOffset(),
  5033. flip: {
  5034. behavior: this.config.fallbackPlacement
  5035. },
  5036. arrow: {
  5037. element: Selector$6.ARROW
  5038. },
  5039. preventOverflow: {
  5040. boundariesElement: this.config.boundary
  5041. }
  5042. },
  5043. onCreate: function onCreate(data) {
  5044. if (data.originalPlacement !== data.placement) {
  5045. _this3._handlePopperPlacementChange(data);
  5046. }
  5047. },
  5048. onUpdate: function onUpdate(data) {
  5049. return _this3._handlePopperPlacementChange(data);
  5050. }
  5051. };
  5052. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  5053. };
  5054. _proto._getOffset = function _getOffset() {
  5055. var _this4 = this;
  5056. var offset = {};
  5057. if (typeof this.config.offset === 'function') {
  5058. offset.fn = function (data) {
  5059. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  5060. return data;
  5061. };
  5062. } else {
  5063. offset.offset = this.config.offset;
  5064. }
  5065. return offset;
  5066. };
  5067. _proto._getContainer = function _getContainer() {
  5068. if (this.config.container === false) {
  5069. return document.body;
  5070. }
  5071. if (Util.isElement(this.config.container)) {
  5072. return $(this.config.container);
  5073. }
  5074. return $(document).find(this.config.container);
  5075. };
  5076. _proto._getAttachment = function _getAttachment(placement) {
  5077. return AttachmentMap$1[placement.toUpperCase()];
  5078. };
  5079. _proto._setListeners = function _setListeners() {
  5080. var _this5 = this;
  5081. var triggers = this.config.trigger.split(' ');
  5082. triggers.forEach(function (trigger) {
  5083. if (trigger === 'click') {
  5084. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  5085. return _this5.toggle(event);
  5086. });
  5087. } else if (trigger !== Trigger.MANUAL) {
  5088. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  5089. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  5090. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  5091. return _this5._enter(event);
  5092. }).on(eventOut, _this5.config.selector, function (event) {
  5093. return _this5._leave(event);
  5094. });
  5095. }
  5096. });
  5097. this._hideModalHandler = function () {
  5098. if (_this5.element) {
  5099. _this5.hide();
  5100. }
  5101. };
  5102. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  5103. if (this.config.selector) {
  5104. this.config = _objectSpread2({}, this.config, {
  5105. trigger: 'manual',
  5106. selector: ''
  5107. });
  5108. } else {
  5109. this._fixTitle();
  5110. }
  5111. };
  5112. _proto._fixTitle = function _fixTitle() {
  5113. var titleType = typeof this.element.getAttribute('data-original-title');
  5114. if (this.element.getAttribute('title') || titleType !== 'string') {
  5115. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  5116. this.element.setAttribute('title', '');
  5117. }
  5118. };
  5119. _proto._enter = function _enter(event, context) {
  5120. var dataKey = this.constructor.DATA_KEY;
  5121. context = context || $(event.currentTarget).data(dataKey);
  5122. if (!context) {
  5123. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5124. $(event.currentTarget).data(dataKey, context);
  5125. }
  5126. if (event) {
  5127. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  5128. }
  5129. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  5130. context._hoverState = HoverState.SHOW;
  5131. return;
  5132. }
  5133. clearTimeout(context._timeout);
  5134. context._hoverState = HoverState.SHOW;
  5135. if (!context.config.delay || !context.config.delay.show) {
  5136. context.show();
  5137. return;
  5138. }
  5139. context._timeout = setTimeout(function () {
  5140. if (context._hoverState === HoverState.SHOW) {
  5141. context.show();
  5142. }
  5143. }, context.config.delay.show);
  5144. };
  5145. _proto._leave = function _leave(event, context) {
  5146. var dataKey = this.constructor.DATA_KEY;
  5147. context = context || $(event.currentTarget).data(dataKey);
  5148. if (!context) {
  5149. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5150. $(event.currentTarget).data(dataKey, context);
  5151. }
  5152. if (event) {
  5153. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  5154. }
  5155. if (context._isWithActiveTrigger()) {
  5156. return;
  5157. }
  5158. clearTimeout(context._timeout);
  5159. context._hoverState = HoverState.OUT;
  5160. if (!context.config.delay || !context.config.delay.hide) {
  5161. context.hide();
  5162. return;
  5163. }
  5164. context._timeout = setTimeout(function () {
  5165. if (context._hoverState === HoverState.OUT) {
  5166. context.hide();
  5167. }
  5168. }, context.config.delay.hide);
  5169. };
  5170. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  5171. for (var trigger in this._activeTrigger) {
  5172. if (this._activeTrigger[trigger]) {
  5173. return true;
  5174. }
  5175. }
  5176. return false;
  5177. };
  5178. _proto._getConfig = function _getConfig(config) {
  5179. var dataAttributes = $(this.element).data();
  5180. Object.keys(dataAttributes).forEach(function (dataAttr) {
  5181. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  5182. delete dataAttributes[dataAttr];
  5183. }
  5184. });
  5185. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  5186. if (typeof config.delay === 'number') {
  5187. config.delay = {
  5188. show: config.delay,
  5189. hide: config.delay
  5190. };
  5191. }
  5192. if (typeof config.title === 'number') {
  5193. config.title = config.title.toString();
  5194. }
  5195. if (typeof config.content === 'number') {
  5196. config.content = config.content.toString();
  5197. }
  5198. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  5199. if (config.sanitize) {
  5200. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  5201. }
  5202. return config;
  5203. };
  5204. _proto._getDelegateConfig = function _getDelegateConfig() {
  5205. var config = {};
  5206. if (this.config) {
  5207. for (var key in this.config) {
  5208. if (this.constructor.Default[key] !== this.config[key]) {
  5209. config[key] = this.config[key];
  5210. }
  5211. }
  5212. }
  5213. return config;
  5214. };
  5215. _proto._cleanTipClass = function _cleanTipClass() {
  5216. var $tip = $(this.getTipElement());
  5217. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  5218. if (tabClass !== null && tabClass.length) {
  5219. $tip.removeClass(tabClass.join(''));
  5220. }
  5221. };
  5222. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  5223. var popperInstance = popperData.instance;
  5224. this.tip = popperInstance.popper;
  5225. this._cleanTipClass();
  5226. this.addAttachmentClass(this._getAttachment(popperData.placement));
  5227. };
  5228. _proto._fixTransition = function _fixTransition() {
  5229. var tip = this.getTipElement();
  5230. var initConfigAnimation = this.config.animation;
  5231. if (tip.getAttribute('x-placement') !== null) {
  5232. return;
  5233. }
  5234. $(tip).removeClass(ClassName$6.FADE);
  5235. this.config.animation = false;
  5236. this.hide();
  5237. this.show();
  5238. this.config.animation = initConfigAnimation;
  5239. } // Static
  5240. ;
  5241. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  5242. return this.each(function () {
  5243. var data = $(this).data(DATA_KEY$6);
  5244. var _config = typeof config === 'object' && config;
  5245. if (!data && /dispose|hide/.test(config)) {
  5246. return;
  5247. }
  5248. if (!data) {
  5249. data = new Tooltip(this, _config);
  5250. $(this).data(DATA_KEY$6, data);
  5251. }
  5252. if (typeof config === 'string') {
  5253. if (typeof data[config] === 'undefined') {
  5254. throw new TypeError("No method named \"" + config + "\"");
  5255. }
  5256. data[config]();
  5257. }
  5258. });
  5259. };
  5260. _createClass(Tooltip, null, [{
  5261. key: "VERSION",
  5262. get: function get() {
  5263. return VERSION$6;
  5264. }
  5265. }, {
  5266. key: "Default",
  5267. get: function get() {
  5268. return Default$4;
  5269. }
  5270. }, {
  5271. key: "NAME",
  5272. get: function get() {
  5273. return NAME$6;
  5274. }
  5275. }, {
  5276. key: "DATA_KEY",
  5277. get: function get() {
  5278. return DATA_KEY$6;
  5279. }
  5280. }, {
  5281. key: "Event",
  5282. get: function get() {
  5283. return Event$6;
  5284. }
  5285. }, {
  5286. key: "EVENT_KEY",
  5287. get: function get() {
  5288. return EVENT_KEY$6;
  5289. }
  5290. }, {
  5291. key: "DefaultType",
  5292. get: function get() {
  5293. return DefaultType$4;
  5294. }
  5295. }]);
  5296. return Tooltip;
  5297. }();
  5298. /**
  5299. * ------------------------------------------------------------------------
  5300. * jQuery
  5301. * ------------------------------------------------------------------------
  5302. */
  5303. $.fn[NAME$6] = Tooltip._jQueryInterface;
  5304. $.fn[NAME$6].Constructor = Tooltip;
  5305. $.fn[NAME$6].noConflict = function () {
  5306. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  5307. return Tooltip._jQueryInterface;
  5308. };
  5309. /**
  5310. * ------------------------------------------------------------------------
  5311. * Constants
  5312. * ------------------------------------------------------------------------
  5313. */
  5314. var NAME$7 = 'popover';
  5315. var VERSION$7 = '4.4.1';
  5316. var DATA_KEY$7 = 'bs.popover';
  5317. var EVENT_KEY$7 = "." + DATA_KEY$7;
  5318. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  5319. var CLASS_PREFIX$1 = 'bs-popover';
  5320. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  5321. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  5322. placement: 'right',
  5323. trigger: 'click',
  5324. content: '',
  5325. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  5326. });
  5327. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  5328. content: '(string|element|function)'
  5329. });
  5330. var ClassName$7 = {
  5331. FADE: 'fade',
  5332. SHOW: 'show'
  5333. };
  5334. var Selector$7 = {
  5335. TITLE: '.popover-header',
  5336. CONTENT: '.popover-body'
  5337. };
  5338. var Event$7 = {
  5339. HIDE: "hide" + EVENT_KEY$7,
  5340. HIDDEN: "hidden" + EVENT_KEY$7,
  5341. SHOW: "show" + EVENT_KEY$7,
  5342. SHOWN: "shown" + EVENT_KEY$7,
  5343. INSERTED: "inserted" + EVENT_KEY$7,
  5344. CLICK: "click" + EVENT_KEY$7,
  5345. FOCUSIN: "focusin" + EVENT_KEY$7,
  5346. FOCUSOUT: "focusout" + EVENT_KEY$7,
  5347. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  5348. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  5349. };
  5350. /**
  5351. * ------------------------------------------------------------------------
  5352. * Class Definition
  5353. * ------------------------------------------------------------------------
  5354. */
  5355. var Popover =
  5356. /*#__PURE__*/
  5357. function (_Tooltip) {
  5358. _inheritsLoose(Popover, _Tooltip);
  5359. function Popover() {
  5360. return _Tooltip.apply(this, arguments) || this;
  5361. }
  5362. var _proto = Popover.prototype;
  5363. // Overrides
  5364. _proto.isWithContent = function isWithContent() {
  5365. return this.getTitle() || this._getContent();
  5366. };
  5367. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5368. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  5369. };
  5370. _proto.getTipElement = function getTipElement() {
  5371. this.tip = this.tip || $(this.config.template)[0];
  5372. return this.tip;
  5373. };
  5374. _proto.setContent = function setContent() {
  5375. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  5376. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  5377. var content = this._getContent();
  5378. if (typeof content === 'function') {
  5379. content = content.call(this.element);
  5380. }
  5381. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  5382. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  5383. } // Private
  5384. ;
  5385. _proto._getContent = function _getContent() {
  5386. return this.element.getAttribute('data-content') || this.config.content;
  5387. };
  5388. _proto._cleanTipClass = function _cleanTipClass() {
  5389. var $tip = $(this.getTipElement());
  5390. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  5391. if (tabClass !== null && tabClass.length > 0) {
  5392. $tip.removeClass(tabClass.join(''));
  5393. }
  5394. } // Static
  5395. ;
  5396. Popover._jQueryInterface = function _jQueryInterface(config) {
  5397. return this.each(function () {
  5398. var data = $(this).data(DATA_KEY$7);
  5399. var _config = typeof config === 'object' ? config : null;
  5400. if (!data && /dispose|hide/.test(config)) {
  5401. return;
  5402. }
  5403. if (!data) {
  5404. data = new Popover(this, _config);
  5405. $(this).data(DATA_KEY$7, data);
  5406. }
  5407. if (typeof config === 'string') {
  5408. if (typeof data[config] === 'undefined') {
  5409. throw new TypeError("No method named \"" + config + "\"");
  5410. }
  5411. data[config]();
  5412. }
  5413. });
  5414. };
  5415. _createClass(Popover, null, [{
  5416. key: "VERSION",
  5417. // Getters
  5418. get: function get() {
  5419. return VERSION$7;
  5420. }
  5421. }, {
  5422. key: "Default",
  5423. get: function get() {
  5424. return Default$5;
  5425. }
  5426. }, {
  5427. key: "NAME",
  5428. get: function get() {
  5429. return NAME$7;
  5430. }
  5431. }, {
  5432. key: "DATA_KEY",
  5433. get: function get() {
  5434. return DATA_KEY$7;
  5435. }
  5436. }, {
  5437. key: "Event",
  5438. get: function get() {
  5439. return Event$7;
  5440. }
  5441. }, {
  5442. key: "EVENT_KEY",
  5443. get: function get() {
  5444. return EVENT_KEY$7;
  5445. }
  5446. }, {
  5447. key: "DefaultType",
  5448. get: function get() {
  5449. return DefaultType$5;
  5450. }
  5451. }]);
  5452. return Popover;
  5453. }(Tooltip);
  5454. /**
  5455. * ------------------------------------------------------------------------
  5456. * jQuery
  5457. * ------------------------------------------------------------------------
  5458. */
  5459. $.fn[NAME$7] = Popover._jQueryInterface;
  5460. $.fn[NAME$7].Constructor = Popover;
  5461. $.fn[NAME$7].noConflict = function () {
  5462. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5463. return Popover._jQueryInterface;
  5464. };
  5465. /**
  5466. * ------------------------------------------------------------------------
  5467. * Constants
  5468. * ------------------------------------------------------------------------
  5469. */
  5470. var NAME$8 = 'scrollspy';
  5471. var VERSION$8 = '4.4.1';
  5472. var DATA_KEY$8 = 'bs.scrollspy';
  5473. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5474. var DATA_API_KEY$6 = '.data-api';
  5475. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5476. var Default$6 = {
  5477. offset: 10,
  5478. method: 'auto',
  5479. target: ''
  5480. };
  5481. var DefaultType$6 = {
  5482. offset: 'number',
  5483. method: 'string',
  5484. target: '(string|element)'
  5485. };
  5486. var Event$8 = {
  5487. ACTIVATE: "activate" + EVENT_KEY$8,
  5488. SCROLL: "scroll" + EVENT_KEY$8,
  5489. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5490. };
  5491. var ClassName$8 = {
  5492. DROPDOWN_ITEM: 'dropdown-item',
  5493. DROPDOWN_MENU: 'dropdown-menu',
  5494. ACTIVE: 'active'
  5495. };
  5496. var Selector$8 = {
  5497. DATA_SPY: '[data-spy="scroll"]',
  5498. ACTIVE: '.active',
  5499. NAV_LIST_GROUP: '.nav, .list-group',
  5500. NAV_LINKS: '.nav-link',
  5501. NAV_ITEMS: '.nav-item',
  5502. LIST_ITEMS: '.list-group-item',
  5503. DROPDOWN: '.dropdown',
  5504. DROPDOWN_ITEMS: '.dropdown-item',
  5505. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5506. };
  5507. var OffsetMethod = {
  5508. OFFSET: 'offset',
  5509. POSITION: 'position'
  5510. };
  5511. /**
  5512. * ------------------------------------------------------------------------
  5513. * Class Definition
  5514. * ------------------------------------------------------------------------
  5515. */
  5516. var ScrollSpy =
  5517. /*#__PURE__*/
  5518. function () {
  5519. function ScrollSpy(element, config) {
  5520. var _this = this;
  5521. this._element = element;
  5522. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5523. this._config = this._getConfig(config);
  5524. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5525. this._offsets = [];
  5526. this._targets = [];
  5527. this._activeTarget = null;
  5528. this._scrollHeight = 0;
  5529. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5530. return _this._process(event);
  5531. });
  5532. this.refresh();
  5533. this._process();
  5534. } // Getters
  5535. var _proto = ScrollSpy.prototype;
  5536. // Public
  5537. _proto.refresh = function refresh() {
  5538. var _this2 = this;
  5539. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5540. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5541. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5542. this._offsets = [];
  5543. this._targets = [];
  5544. this._scrollHeight = this._getScrollHeight();
  5545. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5546. targets.map(function (element) {
  5547. var target;
  5548. var targetSelector = Util.getSelectorFromElement(element);
  5549. if (targetSelector) {
  5550. target = document.querySelector(targetSelector);
  5551. }
  5552. if (target) {
  5553. var targetBCR = target.getBoundingClientRect();
  5554. if (targetBCR.width || targetBCR.height) {
  5555. // TODO (fat): remove sketch reliance on jQuery position/offset
  5556. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5557. }
  5558. }
  5559. return null;
  5560. }).filter(function (item) {
  5561. return item;
  5562. }).sort(function (a, b) {
  5563. return a[0] - b[0];
  5564. }).forEach(function (item) {
  5565. _this2._offsets.push(item[0]);
  5566. _this2._targets.push(item[1]);
  5567. });
  5568. };
  5569. _proto.dispose = function dispose() {
  5570. $.removeData(this._element, DATA_KEY$8);
  5571. $(this._scrollElement).off(EVENT_KEY$8);
  5572. this._element = null;
  5573. this._scrollElement = null;
  5574. this._config = null;
  5575. this._selector = null;
  5576. this._offsets = null;
  5577. this._targets = null;
  5578. this._activeTarget = null;
  5579. this._scrollHeight = null;
  5580. } // Private
  5581. ;
  5582. _proto._getConfig = function _getConfig(config) {
  5583. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  5584. if (typeof config.target !== 'string') {
  5585. var id = $(config.target).attr('id');
  5586. if (!id) {
  5587. id = Util.getUID(NAME$8);
  5588. $(config.target).attr('id', id);
  5589. }
  5590. config.target = "#" + id;
  5591. }
  5592. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5593. return config;
  5594. };
  5595. _proto._getScrollTop = function _getScrollTop() {
  5596. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5597. };
  5598. _proto._getScrollHeight = function _getScrollHeight() {
  5599. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5600. };
  5601. _proto._getOffsetHeight = function _getOffsetHeight() {
  5602. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5603. };
  5604. _proto._process = function _process() {
  5605. var scrollTop = this._getScrollTop() + this._config.offset;
  5606. var scrollHeight = this._getScrollHeight();
  5607. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5608. if (this._scrollHeight !== scrollHeight) {
  5609. this.refresh();
  5610. }
  5611. if (scrollTop >= maxScroll) {
  5612. var target = this._targets[this._targets.length - 1];
  5613. if (this._activeTarget !== target) {
  5614. this._activate(target);
  5615. }
  5616. return;
  5617. }
  5618. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5619. this._activeTarget = null;
  5620. this._clear();
  5621. return;
  5622. }
  5623. var offsetLength = this._offsets.length;
  5624. for (var i = offsetLength; i--;) {
  5625. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5626. if (isActiveTarget) {
  5627. this._activate(this._targets[i]);
  5628. }
  5629. }
  5630. };
  5631. _proto._activate = function _activate(target) {
  5632. this._activeTarget = target;
  5633. this._clear();
  5634. var queries = this._selector.split(',').map(function (selector) {
  5635. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5636. });
  5637. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5638. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5639. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5640. $link.addClass(ClassName$8.ACTIVE);
  5641. } else {
  5642. // Set triggered link as active
  5643. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5644. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5645. $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
  5646. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5647. }
  5648. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5649. relatedTarget: target
  5650. });
  5651. };
  5652. _proto._clear = function _clear() {
  5653. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5654. return node.classList.contains(ClassName$8.ACTIVE);
  5655. }).forEach(function (node) {
  5656. return node.classList.remove(ClassName$8.ACTIVE);
  5657. });
  5658. } // Static
  5659. ;
  5660. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5661. return this.each(function () {
  5662. var data = $(this).data(DATA_KEY$8);
  5663. var _config = typeof config === 'object' && config;
  5664. if (!data) {
  5665. data = new ScrollSpy(this, _config);
  5666. $(this).data(DATA_KEY$8, data);
  5667. }
  5668. if (typeof config === 'string') {
  5669. if (typeof data[config] === 'undefined') {
  5670. throw new TypeError("No method named \"" + config + "\"");
  5671. }
  5672. data[config]();
  5673. }
  5674. });
  5675. };
  5676. _createClass(ScrollSpy, null, [{
  5677. key: "VERSION",
  5678. get: function get() {
  5679. return VERSION$8;
  5680. }
  5681. }, {
  5682. key: "Default",
  5683. get: function get() {
  5684. return Default$6;
  5685. }
  5686. }]);
  5687. return ScrollSpy;
  5688. }();
  5689. /**
  5690. * ------------------------------------------------------------------------
  5691. * Data Api implementation
  5692. * ------------------------------------------------------------------------
  5693. */
  5694. $(window).on(Event$8.LOAD_DATA_API, function () {
  5695. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5696. var scrollSpysLength = scrollSpys.length;
  5697. for (var i = scrollSpysLength; i--;) {
  5698. var $spy = $(scrollSpys[i]);
  5699. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5700. }
  5701. });
  5702. /**
  5703. * ------------------------------------------------------------------------
  5704. * jQuery
  5705. * ------------------------------------------------------------------------
  5706. */
  5707. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5708. $.fn[NAME$8].Constructor = ScrollSpy;
  5709. $.fn[NAME$8].noConflict = function () {
  5710. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5711. return ScrollSpy._jQueryInterface;
  5712. };
  5713. /**
  5714. * ------------------------------------------------------------------------
  5715. * Constants
  5716. * ------------------------------------------------------------------------
  5717. */
  5718. var NAME$9 = 'tab';
  5719. var VERSION$9 = '4.4.1';
  5720. var DATA_KEY$9 = 'bs.tab';
  5721. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5722. var DATA_API_KEY$7 = '.data-api';
  5723. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5724. var Event$9 = {
  5725. HIDE: "hide" + EVENT_KEY$9,
  5726. HIDDEN: "hidden" + EVENT_KEY$9,
  5727. SHOW: "show" + EVENT_KEY$9,
  5728. SHOWN: "shown" + EVENT_KEY$9,
  5729. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5730. };
  5731. var ClassName$9 = {
  5732. DROPDOWN_MENU: 'dropdown-menu',
  5733. ACTIVE: 'active',
  5734. DISABLED: 'disabled',
  5735. FADE: 'fade',
  5736. SHOW: 'show'
  5737. };
  5738. var Selector$9 = {
  5739. DROPDOWN: '.dropdown',
  5740. NAV_LIST_GROUP: '.nav, .list-group',
  5741. ACTIVE: '.active',
  5742. ACTIVE_UL: '> li > .active',
  5743. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5744. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5745. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5746. };
  5747. /**
  5748. * ------------------------------------------------------------------------
  5749. * Class Definition
  5750. * ------------------------------------------------------------------------
  5751. */
  5752. var Tab =
  5753. /*#__PURE__*/
  5754. function () {
  5755. function Tab(element) {
  5756. this._element = element;
  5757. } // Getters
  5758. var _proto = Tab.prototype;
  5759. // Public
  5760. _proto.show = function show() {
  5761. var _this = this;
  5762. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5763. return;
  5764. }
  5765. var target;
  5766. var previous;
  5767. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5768. var selector = Util.getSelectorFromElement(this._element);
  5769. if (listElement) {
  5770. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5771. previous = $.makeArray($(listElement).find(itemSelector));
  5772. previous = previous[previous.length - 1];
  5773. }
  5774. var hideEvent = $.Event(Event$9.HIDE, {
  5775. relatedTarget: this._element
  5776. });
  5777. var showEvent = $.Event(Event$9.SHOW, {
  5778. relatedTarget: previous
  5779. });
  5780. if (previous) {
  5781. $(previous).trigger(hideEvent);
  5782. }
  5783. $(this._element).trigger(showEvent);
  5784. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5785. return;
  5786. }
  5787. if (selector) {
  5788. target = document.querySelector(selector);
  5789. }
  5790. this._activate(this._element, listElement);
  5791. var complete = function complete() {
  5792. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5793. relatedTarget: _this._element
  5794. });
  5795. var shownEvent = $.Event(Event$9.SHOWN, {
  5796. relatedTarget: previous
  5797. });
  5798. $(previous).trigger(hiddenEvent);
  5799. $(_this._element).trigger(shownEvent);
  5800. };
  5801. if (target) {
  5802. this._activate(target, target.parentNode, complete);
  5803. } else {
  5804. complete();
  5805. }
  5806. };
  5807. _proto.dispose = function dispose() {
  5808. $.removeData(this._element, DATA_KEY$9);
  5809. this._element = null;
  5810. } // Private
  5811. ;
  5812. _proto._activate = function _activate(element, container, callback) {
  5813. var _this2 = this;
  5814. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5815. var active = activeElements[0];
  5816. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5817. var complete = function complete() {
  5818. return _this2._transitionComplete(element, active, callback);
  5819. };
  5820. if (active && isTransitioning) {
  5821. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5822. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5823. } else {
  5824. complete();
  5825. }
  5826. };
  5827. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5828. if (active) {
  5829. $(active).removeClass(ClassName$9.ACTIVE);
  5830. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5831. if (dropdownChild) {
  5832. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5833. }
  5834. if (active.getAttribute('role') === 'tab') {
  5835. active.setAttribute('aria-selected', false);
  5836. }
  5837. }
  5838. $(element).addClass(ClassName$9.ACTIVE);
  5839. if (element.getAttribute('role') === 'tab') {
  5840. element.setAttribute('aria-selected', true);
  5841. }
  5842. Util.reflow(element);
  5843. if (element.classList.contains(ClassName$9.FADE)) {
  5844. element.classList.add(ClassName$9.SHOW);
  5845. }
  5846. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5847. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5848. if (dropdownElement) {
  5849. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5850. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5851. }
  5852. element.setAttribute('aria-expanded', true);
  5853. }
  5854. if (callback) {
  5855. callback();
  5856. }
  5857. } // Static
  5858. ;
  5859. Tab._jQueryInterface = function _jQueryInterface(config) {
  5860. return this.each(function () {
  5861. var $this = $(this);
  5862. var data = $this.data(DATA_KEY$9);
  5863. if (!data) {
  5864. data = new Tab(this);
  5865. $this.data(DATA_KEY$9, data);
  5866. }
  5867. if (typeof config === 'string') {
  5868. if (typeof data[config] === 'undefined') {
  5869. throw new TypeError("No method named \"" + config + "\"");
  5870. }
  5871. data[config]();
  5872. }
  5873. });
  5874. };
  5875. _createClass(Tab, null, [{
  5876. key: "VERSION",
  5877. get: function get() {
  5878. return VERSION$9;
  5879. }
  5880. }]);
  5881. return Tab;
  5882. }();
  5883. /**
  5884. * ------------------------------------------------------------------------
  5885. * Data Api implementation
  5886. * ------------------------------------------------------------------------
  5887. */
  5888. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  5889. event.preventDefault();
  5890. Tab._jQueryInterface.call($(this), 'show');
  5891. });
  5892. /**
  5893. * ------------------------------------------------------------------------
  5894. * jQuery
  5895. * ------------------------------------------------------------------------
  5896. */
  5897. $.fn[NAME$9] = Tab._jQueryInterface;
  5898. $.fn[NAME$9].Constructor = Tab;
  5899. $.fn[NAME$9].noConflict = function () {
  5900. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  5901. return Tab._jQueryInterface;
  5902. };
  5903. /**
  5904. * ------------------------------------------------------------------------
  5905. * Constants
  5906. * ------------------------------------------------------------------------
  5907. */
  5908. var NAME$a = 'toast';
  5909. var VERSION$a = '4.4.1';
  5910. var DATA_KEY$a = 'bs.toast';
  5911. var EVENT_KEY$a = "." + DATA_KEY$a;
  5912. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  5913. var Event$a = {
  5914. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  5915. HIDE: "hide" + EVENT_KEY$a,
  5916. HIDDEN: "hidden" + EVENT_KEY$a,
  5917. SHOW: "show" + EVENT_KEY$a,
  5918. SHOWN: "shown" + EVENT_KEY$a
  5919. };
  5920. var ClassName$a = {
  5921. FADE: 'fade',
  5922. HIDE: 'hide',
  5923. SHOW: 'show',
  5924. SHOWING: 'showing'
  5925. };
  5926. var DefaultType$7 = {
  5927. animation: 'boolean',
  5928. autohide: 'boolean',
  5929. delay: 'number'
  5930. };
  5931. var Default$7 = {
  5932. animation: true,
  5933. autohide: true,
  5934. delay: 500
  5935. };
  5936. var Selector$a = {
  5937. DATA_DISMISS: '[data-dismiss="toast"]'
  5938. };
  5939. /**
  5940. * ------------------------------------------------------------------------
  5941. * Class Definition
  5942. * ------------------------------------------------------------------------
  5943. */
  5944. var Toast =
  5945. /*#__PURE__*/
  5946. function () {
  5947. function Toast(element, config) {
  5948. this._element = element;
  5949. this._config = this._getConfig(config);
  5950. this._timeout = null;
  5951. this._setListeners();
  5952. } // Getters
  5953. var _proto = Toast.prototype;
  5954. // Public
  5955. _proto.show = function show() {
  5956. var _this = this;
  5957. var showEvent = $.Event(Event$a.SHOW);
  5958. $(this._element).trigger(showEvent);
  5959. if (showEvent.isDefaultPrevented()) {
  5960. return;
  5961. }
  5962. if (this._config.animation) {
  5963. this._element.classList.add(ClassName$a.FADE);
  5964. }
  5965. var complete = function complete() {
  5966. _this._element.classList.remove(ClassName$a.SHOWING);
  5967. _this._element.classList.add(ClassName$a.SHOW);
  5968. $(_this._element).trigger(Event$a.SHOWN);
  5969. if (_this._config.autohide) {
  5970. _this._timeout = setTimeout(function () {
  5971. _this.hide();
  5972. }, _this._config.delay);
  5973. }
  5974. };
  5975. this._element.classList.remove(ClassName$a.HIDE);
  5976. Util.reflow(this._element);
  5977. this._element.classList.add(ClassName$a.SHOWING);
  5978. if (this._config.animation) {
  5979. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5980. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5981. } else {
  5982. complete();
  5983. }
  5984. };
  5985. _proto.hide = function hide() {
  5986. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  5987. return;
  5988. }
  5989. var hideEvent = $.Event(Event$a.HIDE);
  5990. $(this._element).trigger(hideEvent);
  5991. if (hideEvent.isDefaultPrevented()) {
  5992. return;
  5993. }
  5994. this._close();
  5995. };
  5996. _proto.dispose = function dispose() {
  5997. clearTimeout(this._timeout);
  5998. this._timeout = null;
  5999. if (this._element.classList.contains(ClassName$a.SHOW)) {
  6000. this._element.classList.remove(ClassName$a.SHOW);
  6001. }
  6002. $(this._element).off(Event$a.CLICK_DISMISS);
  6003. $.removeData(this._element, DATA_KEY$a);
  6004. this._element = null;
  6005. this._config = null;
  6006. } // Private
  6007. ;
  6008. _proto._getConfig = function _getConfig(config) {
  6009. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  6010. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  6011. return config;
  6012. };
  6013. _proto._setListeners = function _setListeners() {
  6014. var _this2 = this;
  6015. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  6016. return _this2.hide();
  6017. });
  6018. };
  6019. _proto._close = function _close() {
  6020. var _this3 = this;
  6021. var complete = function complete() {
  6022. _this3._element.classList.add(ClassName$a.HIDE);
  6023. $(_this3._element).trigger(Event$a.HIDDEN);
  6024. };
  6025. this._element.classList.remove(ClassName$a.SHOW);
  6026. if (this._config.animation) {
  6027. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6028. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6029. } else {
  6030. complete();
  6031. }
  6032. } // Static
  6033. ;
  6034. Toast._jQueryInterface = function _jQueryInterface(config) {
  6035. return this.each(function () {
  6036. var $element = $(this);
  6037. var data = $element.data(DATA_KEY$a);
  6038. var _config = typeof config === 'object' && config;
  6039. if (!data) {
  6040. data = new Toast(this, _config);
  6041. $element.data(DATA_KEY$a, 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](this);
  6048. }
  6049. });
  6050. };
  6051. _createClass(Toast, null, [{
  6052. key: "VERSION",
  6053. get: function get() {
  6054. return VERSION$a;
  6055. }
  6056. }, {
  6057. key: "DefaultType",
  6058. get: function get() {
  6059. return DefaultType$7;
  6060. }
  6061. }, {
  6062. key: "Default",
  6063. get: function get() {
  6064. return Default$7;
  6065. }
  6066. }]);
  6067. return Toast;
  6068. }();
  6069. /**
  6070. * ------------------------------------------------------------------------
  6071. * jQuery
  6072. * ------------------------------------------------------------------------
  6073. */
  6074. $.fn[NAME$a] = Toast._jQueryInterface;
  6075. $.fn[NAME$a].Constructor = Toast;
  6076. $.fn[NAME$a].noConflict = function () {
  6077. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  6078. return Toast._jQueryInterface;
  6079. };
  6080. exports.Alert = Alert;
  6081. exports.Button = Button;
  6082. exports.Carousel = Carousel;
  6083. exports.Collapse = Collapse;
  6084. exports.Dropdown = Dropdown;
  6085. exports.Modal = Modal;
  6086. exports.Popover = Popover;
  6087. exports.Scrollspy = ScrollSpy;
  6088. exports.Tab = Tab;
  6089. exports.Toast = Toast;
  6090. exports.Tooltip = Tooltip;
  6091. exports.Util = Util;
  6092. Object.defineProperty(exports, '__esModule', { value: true });
  6093. })));
  6094. //# sourceMappingURL=bootstrap.js.map
  6095. /***/ }),
  6096. /***/ "./node_modules/buffer/index.js":
  6097. /*!**************************************!*\
  6098. !*** ./node_modules/buffer/index.js ***!
  6099. \**************************************/
  6100. /*! no static exports found */
  6101. /***/ (function(module, exports, __webpack_require__) {
  6102. "use strict";
  6103. /* WEBPACK VAR INJECTION */(function(global) {/*!
  6104. * The buffer module from node.js, for the browser.
  6105. *
  6106. * @author Feross Aboukhadijeh <http://feross.org>
  6107. * @license MIT
  6108. */
  6109. /* eslint-disable no-proto */
  6110. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  6111. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  6112. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  6113. exports.Buffer = Buffer
  6114. exports.SlowBuffer = SlowBuffer
  6115. exports.INSPECT_MAX_BYTES = 50
  6116. /**
  6117. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  6118. * === true Use Uint8Array implementation (fastest)
  6119. * === false Use Object implementation (most compatible, even IE6)
  6120. *
  6121. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  6122. * Opera 11.6+, iOS 4.2+.
  6123. *
  6124. * Due to various browser bugs, sometimes the Object implementation will be used even
  6125. * when the browser supports typed arrays.
  6126. *
  6127. * Note:
  6128. *
  6129. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  6130. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  6131. *
  6132. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  6133. *
  6134. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  6135. * incorrect length in some situations.
  6136. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  6137. * get the Object implementation, which is slower but behaves correctly.
  6138. */
  6139. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  6140. ? global.TYPED_ARRAY_SUPPORT
  6141. : typedArraySupport()
  6142. /*
  6143. * Export kMaxLength after typed array support is determined.
  6144. */
  6145. exports.kMaxLength = kMaxLength()
  6146. function typedArraySupport () {
  6147. try {
  6148. var arr = new Uint8Array(1)
  6149. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  6150. return arr.foo() === 42 && // typed array instances can be augmented
  6151. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  6152. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  6153. } catch (e) {
  6154. return false
  6155. }
  6156. }
  6157. function kMaxLength () {
  6158. return Buffer.TYPED_ARRAY_SUPPORT
  6159. ? 0x7fffffff
  6160. : 0x3fffffff
  6161. }
  6162. function createBuffer (that, length) {
  6163. if (kMaxLength() < length) {
  6164. throw new RangeError('Invalid typed array length')
  6165. }
  6166. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6167. // Return an augmented `Uint8Array` instance, for best performance
  6168. that = new Uint8Array(length)
  6169. that.__proto__ = Buffer.prototype
  6170. } else {
  6171. // Fallback: Return an object instance of the Buffer class
  6172. if (that === null) {
  6173. that = new Buffer(length)
  6174. }
  6175. that.length = length
  6176. }
  6177. return that
  6178. }
  6179. /**
  6180. * The Buffer constructor returns instances of `Uint8Array` that have their
  6181. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  6182. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  6183. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  6184. * returns a single octet.
  6185. *
  6186. * The `Uint8Array` prototype remains unmodified.
  6187. */
  6188. function Buffer (arg, encodingOrOffset, length) {
  6189. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  6190. return new Buffer(arg, encodingOrOffset, length)
  6191. }
  6192. // Common case.
  6193. if (typeof arg === 'number') {
  6194. if (typeof encodingOrOffset === 'string') {
  6195. throw new Error(
  6196. 'If encoding is specified then the first argument must be a string'
  6197. )
  6198. }
  6199. return allocUnsafe(this, arg)
  6200. }
  6201. return from(this, arg, encodingOrOffset, length)
  6202. }
  6203. Buffer.poolSize = 8192 // not used by this implementation
  6204. // TODO: Legacy, not needed anymore. Remove in next major version.
  6205. Buffer._augment = function (arr) {
  6206. arr.__proto__ = Buffer.prototype
  6207. return arr
  6208. }
  6209. function from (that, value, encodingOrOffset, length) {
  6210. if (typeof value === 'number') {
  6211. throw new TypeError('"value" argument must not be a number')
  6212. }
  6213. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  6214. return fromArrayBuffer(that, value, encodingOrOffset, length)
  6215. }
  6216. if (typeof value === 'string') {
  6217. return fromString(that, value, encodingOrOffset)
  6218. }
  6219. return fromObject(that, value)
  6220. }
  6221. /**
  6222. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  6223. * if value is a number.
  6224. * Buffer.from(str[, encoding])
  6225. * Buffer.from(array)
  6226. * Buffer.from(buffer)
  6227. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  6228. **/
  6229. Buffer.from = function (value, encodingOrOffset, length) {
  6230. return from(null, value, encodingOrOffset, length)
  6231. }
  6232. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6233. Buffer.prototype.__proto__ = Uint8Array.prototype
  6234. Buffer.__proto__ = Uint8Array
  6235. if (typeof Symbol !== 'undefined' && Symbol.species &&
  6236. Buffer[Symbol.species] === Buffer) {
  6237. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  6238. Object.defineProperty(Buffer, Symbol.species, {
  6239. value: null,
  6240. configurable: true
  6241. })
  6242. }
  6243. }
  6244. function assertSize (size) {
  6245. if (typeof size !== 'number') {
  6246. throw new TypeError('"size" argument must be a number')
  6247. } else if (size < 0) {
  6248. throw new RangeError('"size" argument must not be negative')
  6249. }
  6250. }
  6251. function alloc (that, size, fill, encoding) {
  6252. assertSize(size)
  6253. if (size <= 0) {
  6254. return createBuffer(that, size)
  6255. }
  6256. if (fill !== undefined) {
  6257. // Only pay attention to encoding if it's a string. This
  6258. // prevents accidentally sending in a number that would
  6259. // be interpretted as a start offset.
  6260. return typeof encoding === 'string'
  6261. ? createBuffer(that, size).fill(fill, encoding)
  6262. : createBuffer(that, size).fill(fill)
  6263. }
  6264. return createBuffer(that, size)
  6265. }
  6266. /**
  6267. * Creates a new filled Buffer instance.
  6268. * alloc(size[, fill[, encoding]])
  6269. **/
  6270. Buffer.alloc = function (size, fill, encoding) {
  6271. return alloc(null, size, fill, encoding)
  6272. }
  6273. function allocUnsafe (that, size) {
  6274. assertSize(size)
  6275. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  6276. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  6277. for (var i = 0; i < size; ++i) {
  6278. that[i] = 0
  6279. }
  6280. }
  6281. return that
  6282. }
  6283. /**
  6284. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  6285. * */
  6286. Buffer.allocUnsafe = function (size) {
  6287. return allocUnsafe(null, size)
  6288. }
  6289. /**
  6290. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  6291. */
  6292. Buffer.allocUnsafeSlow = function (size) {
  6293. return allocUnsafe(null, size)
  6294. }
  6295. function fromString (that, string, encoding) {
  6296. if (typeof encoding !== 'string' || encoding === '') {
  6297. encoding = 'utf8'
  6298. }
  6299. if (!Buffer.isEncoding(encoding)) {
  6300. throw new TypeError('"encoding" must be a valid string encoding')
  6301. }
  6302. var length = byteLength(string, encoding) | 0
  6303. that = createBuffer(that, length)
  6304. var actual = that.write(string, encoding)
  6305. if (actual !== length) {
  6306. // Writing a hex string, for example, that contains invalid characters will
  6307. // cause everything after the first invalid character to be ignored. (e.g.
  6308. // 'abxxcd' will be treated as 'ab')
  6309. that = that.slice(0, actual)
  6310. }
  6311. return that
  6312. }
  6313. function fromArrayLike (that, array) {
  6314. var length = array.length < 0 ? 0 : checked(array.length) | 0
  6315. that = createBuffer(that, length)
  6316. for (var i = 0; i < length; i += 1) {
  6317. that[i] = array[i] & 255
  6318. }
  6319. return that
  6320. }
  6321. function fromArrayBuffer (that, array, byteOffset, length) {
  6322. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  6323. if (byteOffset < 0 || array.byteLength < byteOffset) {
  6324. throw new RangeError('\'offset\' is out of bounds')
  6325. }
  6326. if (array.byteLength < byteOffset + (length || 0)) {
  6327. throw new RangeError('\'length\' is out of bounds')
  6328. }
  6329. if (byteOffset === undefined && length === undefined) {
  6330. array = new Uint8Array(array)
  6331. } else if (length === undefined) {
  6332. array = new Uint8Array(array, byteOffset)
  6333. } else {
  6334. array = new Uint8Array(array, byteOffset, length)
  6335. }
  6336. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6337. // Return an augmented `Uint8Array` instance, for best performance
  6338. that = array
  6339. that.__proto__ = Buffer.prototype
  6340. } else {
  6341. // Fallback: Return an object instance of the Buffer class
  6342. that = fromArrayLike(that, array)
  6343. }
  6344. return that
  6345. }
  6346. function fromObject (that, obj) {
  6347. if (Buffer.isBuffer(obj)) {
  6348. var len = checked(obj.length) | 0
  6349. that = createBuffer(that, len)
  6350. if (that.length === 0) {
  6351. return that
  6352. }
  6353. obj.copy(that, 0, 0, len)
  6354. return that
  6355. }
  6356. if (obj) {
  6357. if ((typeof ArrayBuffer !== 'undefined' &&
  6358. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  6359. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  6360. return createBuffer(that, 0)
  6361. }
  6362. return fromArrayLike(that, obj)
  6363. }
  6364. if (obj.type === 'Buffer' && isArray(obj.data)) {
  6365. return fromArrayLike(that, obj.data)
  6366. }
  6367. }
  6368. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  6369. }
  6370. function checked (length) {
  6371. // Note: cannot use `length < kMaxLength()` here because that fails when
  6372. // length is NaN (which is otherwise coerced to zero.)
  6373. if (length >= kMaxLength()) {
  6374. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  6375. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  6376. }
  6377. return length | 0
  6378. }
  6379. function SlowBuffer (length) {
  6380. if (+length != length) { // eslint-disable-line eqeqeq
  6381. length = 0
  6382. }
  6383. return Buffer.alloc(+length)
  6384. }
  6385. Buffer.isBuffer = function isBuffer (b) {
  6386. return !!(b != null && b._isBuffer)
  6387. }
  6388. Buffer.compare = function compare (a, b) {
  6389. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  6390. throw new TypeError('Arguments must be Buffers')
  6391. }
  6392. if (a === b) return 0
  6393. var x = a.length
  6394. var y = b.length
  6395. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  6396. if (a[i] !== b[i]) {
  6397. x = a[i]
  6398. y = b[i]
  6399. break
  6400. }
  6401. }
  6402. if (x < y) return -1
  6403. if (y < x) return 1
  6404. return 0
  6405. }
  6406. Buffer.isEncoding = function isEncoding (encoding) {
  6407. switch (String(encoding).toLowerCase()) {
  6408. case 'hex':
  6409. case 'utf8':
  6410. case 'utf-8':
  6411. case 'ascii':
  6412. case 'latin1':
  6413. case 'binary':
  6414. case 'base64':
  6415. case 'ucs2':
  6416. case 'ucs-2':
  6417. case 'utf16le':
  6418. case 'utf-16le':
  6419. return true
  6420. default:
  6421. return false
  6422. }
  6423. }
  6424. Buffer.concat = function concat (list, length) {
  6425. if (!isArray(list)) {
  6426. throw new TypeError('"list" argument must be an Array of Buffers')
  6427. }
  6428. if (list.length === 0) {
  6429. return Buffer.alloc(0)
  6430. }
  6431. var i
  6432. if (length === undefined) {
  6433. length = 0
  6434. for (i = 0; i < list.length; ++i) {
  6435. length += list[i].length
  6436. }
  6437. }
  6438. var buffer = Buffer.allocUnsafe(length)
  6439. var pos = 0
  6440. for (i = 0; i < list.length; ++i) {
  6441. var buf = list[i]
  6442. if (!Buffer.isBuffer(buf)) {
  6443. throw new TypeError('"list" argument must be an Array of Buffers')
  6444. }
  6445. buf.copy(buffer, pos)
  6446. pos += buf.length
  6447. }
  6448. return buffer
  6449. }
  6450. function byteLength (string, encoding) {
  6451. if (Buffer.isBuffer(string)) {
  6452. return string.length
  6453. }
  6454. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  6455. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  6456. return string.byteLength
  6457. }
  6458. if (typeof string !== 'string') {
  6459. string = '' + string
  6460. }
  6461. var len = string.length
  6462. if (len === 0) return 0
  6463. // Use a for loop to avoid recursion
  6464. var loweredCase = false
  6465. for (;;) {
  6466. switch (encoding) {
  6467. case 'ascii':
  6468. case 'latin1':
  6469. case 'binary':
  6470. return len
  6471. case 'utf8':
  6472. case 'utf-8':
  6473. case undefined:
  6474. return utf8ToBytes(string).length
  6475. case 'ucs2':
  6476. case 'ucs-2':
  6477. case 'utf16le':
  6478. case 'utf-16le':
  6479. return len * 2
  6480. case 'hex':
  6481. return len >>> 1
  6482. case 'base64':
  6483. return base64ToBytes(string).length
  6484. default:
  6485. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  6486. encoding = ('' + encoding).toLowerCase()
  6487. loweredCase = true
  6488. }
  6489. }
  6490. }
  6491. Buffer.byteLength = byteLength
  6492. function slowToString (encoding, start, end) {
  6493. var loweredCase = false
  6494. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  6495. // property of a typed array.
  6496. // This behaves neither like String nor Uint8Array in that we set start/end
  6497. // to their upper/lower bounds if the value passed is out of range.
  6498. // undefined is handled specially as per ECMA-262 6th Edition,
  6499. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  6500. if (start === undefined || start < 0) {
  6501. start = 0
  6502. }
  6503. // Return early if start > this.length. Done here to prevent potential uint32
  6504. // coercion fail below.
  6505. if (start > this.length) {
  6506. return ''
  6507. }
  6508. if (end === undefined || end > this.length) {
  6509. end = this.length
  6510. }
  6511. if (end <= 0) {
  6512. return ''
  6513. }
  6514. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  6515. end >>>= 0
  6516. start >>>= 0
  6517. if (end <= start) {
  6518. return ''
  6519. }
  6520. if (!encoding) encoding = 'utf8'
  6521. while (true) {
  6522. switch (encoding) {
  6523. case 'hex':
  6524. return hexSlice(this, start, end)
  6525. case 'utf8':
  6526. case 'utf-8':
  6527. return utf8Slice(this, start, end)
  6528. case 'ascii':
  6529. return asciiSlice(this, start, end)
  6530. case 'latin1':
  6531. case 'binary':
  6532. return latin1Slice(this, start, end)
  6533. case 'base64':
  6534. return base64Slice(this, start, end)
  6535. case 'ucs2':
  6536. case 'ucs-2':
  6537. case 'utf16le':
  6538. case 'utf-16le':
  6539. return utf16leSlice(this, start, end)
  6540. default:
  6541. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6542. encoding = (encoding + '').toLowerCase()
  6543. loweredCase = true
  6544. }
  6545. }
  6546. }
  6547. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  6548. // Buffer instances.
  6549. Buffer.prototype._isBuffer = true
  6550. function swap (b, n, m) {
  6551. var i = b[n]
  6552. b[n] = b[m]
  6553. b[m] = i
  6554. }
  6555. Buffer.prototype.swap16 = function swap16 () {
  6556. var len = this.length
  6557. if (len % 2 !== 0) {
  6558. throw new RangeError('Buffer size must be a multiple of 16-bits')
  6559. }
  6560. for (var i = 0; i < len; i += 2) {
  6561. swap(this, i, i + 1)
  6562. }
  6563. return this
  6564. }
  6565. Buffer.prototype.swap32 = function swap32 () {
  6566. var len = this.length
  6567. if (len % 4 !== 0) {
  6568. throw new RangeError('Buffer size must be a multiple of 32-bits')
  6569. }
  6570. for (var i = 0; i < len; i += 4) {
  6571. swap(this, i, i + 3)
  6572. swap(this, i + 1, i + 2)
  6573. }
  6574. return this
  6575. }
  6576. Buffer.prototype.swap64 = function swap64 () {
  6577. var len = this.length
  6578. if (len % 8 !== 0) {
  6579. throw new RangeError('Buffer size must be a multiple of 64-bits')
  6580. }
  6581. for (var i = 0; i < len; i += 8) {
  6582. swap(this, i, i + 7)
  6583. swap(this, i + 1, i + 6)
  6584. swap(this, i + 2, i + 5)
  6585. swap(this, i + 3, i + 4)
  6586. }
  6587. return this
  6588. }
  6589. Buffer.prototype.toString = function toString () {
  6590. var length = this.length | 0
  6591. if (length === 0) return ''
  6592. if (arguments.length === 0) return utf8Slice(this, 0, length)
  6593. return slowToString.apply(this, arguments)
  6594. }
  6595. Buffer.prototype.equals = function equals (b) {
  6596. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  6597. if (this === b) return true
  6598. return Buffer.compare(this, b) === 0
  6599. }
  6600. Buffer.prototype.inspect = function inspect () {
  6601. var str = ''
  6602. var max = exports.INSPECT_MAX_BYTES
  6603. if (this.length > 0) {
  6604. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  6605. if (this.length > max) str += ' ... '
  6606. }
  6607. return '<Buffer ' + str + '>'
  6608. }
  6609. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  6610. if (!Buffer.isBuffer(target)) {
  6611. throw new TypeError('Argument must be a Buffer')
  6612. }
  6613. if (start === undefined) {
  6614. start = 0
  6615. }
  6616. if (end === undefined) {
  6617. end = target ? target.length : 0
  6618. }
  6619. if (thisStart === undefined) {
  6620. thisStart = 0
  6621. }
  6622. if (thisEnd === undefined) {
  6623. thisEnd = this.length
  6624. }
  6625. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  6626. throw new RangeError('out of range index')
  6627. }
  6628. if (thisStart >= thisEnd && start >= end) {
  6629. return 0
  6630. }
  6631. if (thisStart >= thisEnd) {
  6632. return -1
  6633. }
  6634. if (start >= end) {
  6635. return 1
  6636. }
  6637. start >>>= 0
  6638. end >>>= 0
  6639. thisStart >>>= 0
  6640. thisEnd >>>= 0
  6641. if (this === target) return 0
  6642. var x = thisEnd - thisStart
  6643. var y = end - start
  6644. var len = Math.min(x, y)
  6645. var thisCopy = this.slice(thisStart, thisEnd)
  6646. var targetCopy = target.slice(start, end)
  6647. for (var i = 0; i < len; ++i) {
  6648. if (thisCopy[i] !== targetCopy[i]) {
  6649. x = thisCopy[i]
  6650. y = targetCopy[i]
  6651. break
  6652. }
  6653. }
  6654. if (x < y) return -1
  6655. if (y < x) return 1
  6656. return 0
  6657. }
  6658. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  6659. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  6660. //
  6661. // Arguments:
  6662. // - buffer - a Buffer to search
  6663. // - val - a string, Buffer, or number
  6664. // - byteOffset - an index into `buffer`; will be clamped to an int32
  6665. // - encoding - an optional encoding, relevant is val is a string
  6666. // - dir - true for indexOf, false for lastIndexOf
  6667. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  6668. // Empty buffer means no match
  6669. if (buffer.length === 0) return -1
  6670. // Normalize byteOffset
  6671. if (typeof byteOffset === 'string') {
  6672. encoding = byteOffset
  6673. byteOffset = 0
  6674. } else if (byteOffset > 0x7fffffff) {
  6675. byteOffset = 0x7fffffff
  6676. } else if (byteOffset < -0x80000000) {
  6677. byteOffset = -0x80000000
  6678. }
  6679. byteOffset = +byteOffset // Coerce to Number.
  6680. if (isNaN(byteOffset)) {
  6681. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  6682. byteOffset = dir ? 0 : (buffer.length - 1)
  6683. }
  6684. // Normalize byteOffset: negative offsets start from the end of the buffer
  6685. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  6686. if (byteOffset >= buffer.length) {
  6687. if (dir) return -1
  6688. else byteOffset = buffer.length - 1
  6689. } else if (byteOffset < 0) {
  6690. if (dir) byteOffset = 0
  6691. else return -1
  6692. }
  6693. // Normalize val
  6694. if (typeof val === 'string') {
  6695. val = Buffer.from(val, encoding)
  6696. }
  6697. // Finally, search either indexOf (if dir is true) or lastIndexOf
  6698. if (Buffer.isBuffer(val)) {
  6699. // Special case: looking for empty string/buffer always fails
  6700. if (val.length === 0) {
  6701. return -1
  6702. }
  6703. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  6704. } else if (typeof val === 'number') {
  6705. val = val & 0xFF // Search for a byte value [0-255]
  6706. if (Buffer.TYPED_ARRAY_SUPPORT &&
  6707. typeof Uint8Array.prototype.indexOf === 'function') {
  6708. if (dir) {
  6709. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  6710. } else {
  6711. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  6712. }
  6713. }
  6714. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  6715. }
  6716. throw new TypeError('val must be string, number or Buffer')
  6717. }
  6718. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  6719. var indexSize = 1
  6720. var arrLength = arr.length
  6721. var valLength = val.length
  6722. if (encoding !== undefined) {
  6723. encoding = String(encoding).toLowerCase()
  6724. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  6725. encoding === 'utf16le' || encoding === 'utf-16le') {
  6726. if (arr.length < 2 || val.length < 2) {
  6727. return -1
  6728. }
  6729. indexSize = 2
  6730. arrLength /= 2
  6731. valLength /= 2
  6732. byteOffset /= 2
  6733. }
  6734. }
  6735. function read (buf, i) {
  6736. if (indexSize === 1) {
  6737. return buf[i]
  6738. } else {
  6739. return buf.readUInt16BE(i * indexSize)
  6740. }
  6741. }
  6742. var i
  6743. if (dir) {
  6744. var foundIndex = -1
  6745. for (i = byteOffset; i < arrLength; i++) {
  6746. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  6747. if (foundIndex === -1) foundIndex = i
  6748. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  6749. } else {
  6750. if (foundIndex !== -1) i -= i - foundIndex
  6751. foundIndex = -1
  6752. }
  6753. }
  6754. } else {
  6755. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  6756. for (i = byteOffset; i >= 0; i--) {
  6757. var found = true
  6758. for (var j = 0; j < valLength; j++) {
  6759. if (read(arr, i + j) !== read(val, j)) {
  6760. found = false
  6761. break
  6762. }
  6763. }
  6764. if (found) return i
  6765. }
  6766. }
  6767. return -1
  6768. }
  6769. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  6770. return this.indexOf(val, byteOffset, encoding) !== -1
  6771. }
  6772. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  6773. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  6774. }
  6775. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  6776. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  6777. }
  6778. function hexWrite (buf, string, offset, length) {
  6779. offset = Number(offset) || 0
  6780. var remaining = buf.length - offset
  6781. if (!length) {
  6782. length = remaining
  6783. } else {
  6784. length = Number(length)
  6785. if (length > remaining) {
  6786. length = remaining
  6787. }
  6788. }
  6789. // must be an even number of digits
  6790. var strLen = string.length
  6791. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  6792. if (length > strLen / 2) {
  6793. length = strLen / 2
  6794. }
  6795. for (var i = 0; i < length; ++i) {
  6796. var parsed = parseInt(string.substr(i * 2, 2), 16)
  6797. if (isNaN(parsed)) return i
  6798. buf[offset + i] = parsed
  6799. }
  6800. return i
  6801. }
  6802. function utf8Write (buf, string, offset, length) {
  6803. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  6804. }
  6805. function asciiWrite (buf, string, offset, length) {
  6806. return blitBuffer(asciiToBytes(string), buf, offset, length)
  6807. }
  6808. function latin1Write (buf, string, offset, length) {
  6809. return asciiWrite(buf, string, offset, length)
  6810. }
  6811. function base64Write (buf, string, offset, length) {
  6812. return blitBuffer(base64ToBytes(string), buf, offset, length)
  6813. }
  6814. function ucs2Write (buf, string, offset, length) {
  6815. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  6816. }
  6817. Buffer.prototype.write = function write (string, offset, length, encoding) {
  6818. // Buffer#write(string)
  6819. if (offset === undefined) {
  6820. encoding = 'utf8'
  6821. length = this.length
  6822. offset = 0
  6823. // Buffer#write(string, encoding)
  6824. } else if (length === undefined && typeof offset === 'string') {
  6825. encoding = offset
  6826. length = this.length
  6827. offset = 0
  6828. // Buffer#write(string, offset[, length][, encoding])
  6829. } else if (isFinite(offset)) {
  6830. offset = offset | 0
  6831. if (isFinite(length)) {
  6832. length = length | 0
  6833. if (encoding === undefined) encoding = 'utf8'
  6834. } else {
  6835. encoding = length
  6836. length = undefined
  6837. }
  6838. // legacy write(string, encoding, offset, length) - remove in v0.13
  6839. } else {
  6840. throw new Error(
  6841. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  6842. )
  6843. }
  6844. var remaining = this.length - offset
  6845. if (length === undefined || length > remaining) length = remaining
  6846. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  6847. throw new RangeError('Attempt to write outside buffer bounds')
  6848. }
  6849. if (!encoding) encoding = 'utf8'
  6850. var loweredCase = false
  6851. for (;;) {
  6852. switch (encoding) {
  6853. case 'hex':
  6854. return hexWrite(this, string, offset, length)
  6855. case 'utf8':
  6856. case 'utf-8':
  6857. return utf8Write(this, string, offset, length)
  6858. case 'ascii':
  6859. return asciiWrite(this, string, offset, length)
  6860. case 'latin1':
  6861. case 'binary':
  6862. return latin1Write(this, string, offset, length)
  6863. case 'base64':
  6864. // Warning: maxLength not taken into account in base64Write
  6865. return base64Write(this, string, offset, length)
  6866. case 'ucs2':
  6867. case 'ucs-2':
  6868. case 'utf16le':
  6869. case 'utf-16le':
  6870. return ucs2Write(this, string, offset, length)
  6871. default:
  6872. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6873. encoding = ('' + encoding).toLowerCase()
  6874. loweredCase = true
  6875. }
  6876. }
  6877. }
  6878. Buffer.prototype.toJSON = function toJSON () {
  6879. return {
  6880. type: 'Buffer',
  6881. data: Array.prototype.slice.call(this._arr || this, 0)
  6882. }
  6883. }
  6884. function base64Slice (buf, start, end) {
  6885. if (start === 0 && end === buf.length) {
  6886. return base64.fromByteArray(buf)
  6887. } else {
  6888. return base64.fromByteArray(buf.slice(start, end))
  6889. }
  6890. }
  6891. function utf8Slice (buf, start, end) {
  6892. end = Math.min(buf.length, end)
  6893. var res = []
  6894. var i = start
  6895. while (i < end) {
  6896. var firstByte = buf[i]
  6897. var codePoint = null
  6898. var bytesPerSequence = (firstByte > 0xEF) ? 4
  6899. : (firstByte > 0xDF) ? 3
  6900. : (firstByte > 0xBF) ? 2
  6901. : 1
  6902. if (i + bytesPerSequence <= end) {
  6903. var secondByte, thirdByte, fourthByte, tempCodePoint
  6904. switch (bytesPerSequence) {
  6905. case 1:
  6906. if (firstByte < 0x80) {
  6907. codePoint = firstByte
  6908. }
  6909. break
  6910. case 2:
  6911. secondByte = buf[i + 1]
  6912. if ((secondByte & 0xC0) === 0x80) {
  6913. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  6914. if (tempCodePoint > 0x7F) {
  6915. codePoint = tempCodePoint
  6916. }
  6917. }
  6918. break
  6919. case 3:
  6920. secondByte = buf[i + 1]
  6921. thirdByte = buf[i + 2]
  6922. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  6923. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  6924. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  6925. codePoint = tempCodePoint
  6926. }
  6927. }
  6928. break
  6929. case 4:
  6930. secondByte = buf[i + 1]
  6931. thirdByte = buf[i + 2]
  6932. fourthByte = buf[i + 3]
  6933. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  6934. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  6935. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  6936. codePoint = tempCodePoint
  6937. }
  6938. }
  6939. }
  6940. }
  6941. if (codePoint === null) {
  6942. // we did not generate a valid codePoint so insert a
  6943. // replacement char (U+FFFD) and advance only 1 byte
  6944. codePoint = 0xFFFD
  6945. bytesPerSequence = 1
  6946. } else if (codePoint > 0xFFFF) {
  6947. // encode to utf16 (surrogate pair dance)
  6948. codePoint -= 0x10000
  6949. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  6950. codePoint = 0xDC00 | codePoint & 0x3FF
  6951. }
  6952. res.push(codePoint)
  6953. i += bytesPerSequence
  6954. }
  6955. return decodeCodePointsArray(res)
  6956. }
  6957. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  6958. // the lowest limit is Chrome, with 0x10000 args.
  6959. // We go 1 magnitude less, for safety
  6960. var MAX_ARGUMENTS_LENGTH = 0x1000
  6961. function decodeCodePointsArray (codePoints) {
  6962. var len = codePoints.length
  6963. if (len <= MAX_ARGUMENTS_LENGTH) {
  6964. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  6965. }
  6966. // Decode in chunks to avoid "call stack size exceeded".
  6967. var res = ''
  6968. var i = 0
  6969. while (i < len) {
  6970. res += String.fromCharCode.apply(
  6971. String,
  6972. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  6973. )
  6974. }
  6975. return res
  6976. }
  6977. function asciiSlice (buf, start, end) {
  6978. var ret = ''
  6979. end = Math.min(buf.length, end)
  6980. for (var i = start; i < end; ++i) {
  6981. ret += String.fromCharCode(buf[i] & 0x7F)
  6982. }
  6983. return ret
  6984. }
  6985. function latin1Slice (buf, start, end) {
  6986. var ret = ''
  6987. end = Math.min(buf.length, end)
  6988. for (var i = start; i < end; ++i) {
  6989. ret += String.fromCharCode(buf[i])
  6990. }
  6991. return ret
  6992. }
  6993. function hexSlice (buf, start, end) {
  6994. var len = buf.length
  6995. if (!start || start < 0) start = 0
  6996. if (!end || end < 0 || end > len) end = len
  6997. var out = ''
  6998. for (var i = start; i < end; ++i) {
  6999. out += toHex(buf[i])
  7000. }
  7001. return out
  7002. }
  7003. function utf16leSlice (buf, start, end) {
  7004. var bytes = buf.slice(start, end)
  7005. var res = ''
  7006. for (var i = 0; i < bytes.length; i += 2) {
  7007. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  7008. }
  7009. return res
  7010. }
  7011. Buffer.prototype.slice = function slice (start, end) {
  7012. var len = this.length
  7013. start = ~~start
  7014. end = end === undefined ? len : ~~end
  7015. if (start < 0) {
  7016. start += len
  7017. if (start < 0) start = 0
  7018. } else if (start > len) {
  7019. start = len
  7020. }
  7021. if (end < 0) {
  7022. end += len
  7023. if (end < 0) end = 0
  7024. } else if (end > len) {
  7025. end = len
  7026. }
  7027. if (end < start) end = start
  7028. var newBuf
  7029. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7030. newBuf = this.subarray(start, end)
  7031. newBuf.__proto__ = Buffer.prototype
  7032. } else {
  7033. var sliceLen = end - start
  7034. newBuf = new Buffer(sliceLen, undefined)
  7035. for (var i = 0; i < sliceLen; ++i) {
  7036. newBuf[i] = this[i + start]
  7037. }
  7038. }
  7039. return newBuf
  7040. }
  7041. /*
  7042. * Need to make sure that buffer isn't trying to write out of bounds.
  7043. */
  7044. function checkOffset (offset, ext, length) {
  7045. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  7046. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  7047. }
  7048. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  7049. offset = offset | 0
  7050. byteLength = byteLength | 0
  7051. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7052. var val = this[offset]
  7053. var mul = 1
  7054. var i = 0
  7055. while (++i < byteLength && (mul *= 0x100)) {
  7056. val += this[offset + i] * mul
  7057. }
  7058. return val
  7059. }
  7060. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  7061. offset = offset | 0
  7062. byteLength = byteLength | 0
  7063. if (!noAssert) {
  7064. checkOffset(offset, byteLength, this.length)
  7065. }
  7066. var val = this[offset + --byteLength]
  7067. var mul = 1
  7068. while (byteLength > 0 && (mul *= 0x100)) {
  7069. val += this[offset + --byteLength] * mul
  7070. }
  7071. return val
  7072. }
  7073. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  7074. if (!noAssert) checkOffset(offset, 1, this.length)
  7075. return this[offset]
  7076. }
  7077. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  7078. if (!noAssert) checkOffset(offset, 2, this.length)
  7079. return this[offset] | (this[offset + 1] << 8)
  7080. }
  7081. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  7082. if (!noAssert) checkOffset(offset, 2, this.length)
  7083. return (this[offset] << 8) | this[offset + 1]
  7084. }
  7085. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  7086. if (!noAssert) checkOffset(offset, 4, this.length)
  7087. return ((this[offset]) |
  7088. (this[offset + 1] << 8) |
  7089. (this[offset + 2] << 16)) +
  7090. (this[offset + 3] * 0x1000000)
  7091. }
  7092. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  7093. if (!noAssert) checkOffset(offset, 4, this.length)
  7094. return (this[offset] * 0x1000000) +
  7095. ((this[offset + 1] << 16) |
  7096. (this[offset + 2] << 8) |
  7097. this[offset + 3])
  7098. }
  7099. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  7100. offset = offset | 0
  7101. byteLength = byteLength | 0
  7102. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7103. var val = this[offset]
  7104. var mul = 1
  7105. var i = 0
  7106. while (++i < byteLength && (mul *= 0x100)) {
  7107. val += this[offset + i] * mul
  7108. }
  7109. mul *= 0x80
  7110. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7111. return val
  7112. }
  7113. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  7114. offset = offset | 0
  7115. byteLength = byteLength | 0
  7116. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7117. var i = byteLength
  7118. var mul = 1
  7119. var val = this[offset + --i]
  7120. while (i > 0 && (mul *= 0x100)) {
  7121. val += this[offset + --i] * mul
  7122. }
  7123. mul *= 0x80
  7124. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7125. return val
  7126. }
  7127. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  7128. if (!noAssert) checkOffset(offset, 1, this.length)
  7129. if (!(this[offset] & 0x80)) return (this[offset])
  7130. return ((0xff - this[offset] + 1) * -1)
  7131. }
  7132. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  7133. if (!noAssert) checkOffset(offset, 2, this.length)
  7134. var val = this[offset] | (this[offset + 1] << 8)
  7135. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7136. }
  7137. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  7138. if (!noAssert) checkOffset(offset, 2, this.length)
  7139. var val = this[offset + 1] | (this[offset] << 8)
  7140. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7141. }
  7142. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  7143. if (!noAssert) checkOffset(offset, 4, this.length)
  7144. return (this[offset]) |
  7145. (this[offset + 1] << 8) |
  7146. (this[offset + 2] << 16) |
  7147. (this[offset + 3] << 24)
  7148. }
  7149. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  7150. if (!noAssert) checkOffset(offset, 4, this.length)
  7151. return (this[offset] << 24) |
  7152. (this[offset + 1] << 16) |
  7153. (this[offset + 2] << 8) |
  7154. (this[offset + 3])
  7155. }
  7156. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  7157. if (!noAssert) checkOffset(offset, 4, this.length)
  7158. return ieee754.read(this, offset, true, 23, 4)
  7159. }
  7160. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  7161. if (!noAssert) checkOffset(offset, 4, this.length)
  7162. return ieee754.read(this, offset, false, 23, 4)
  7163. }
  7164. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  7165. if (!noAssert) checkOffset(offset, 8, this.length)
  7166. return ieee754.read(this, offset, true, 52, 8)
  7167. }
  7168. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  7169. if (!noAssert) checkOffset(offset, 8, this.length)
  7170. return ieee754.read(this, offset, false, 52, 8)
  7171. }
  7172. function checkInt (buf, value, offset, ext, max, min) {
  7173. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  7174. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  7175. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7176. }
  7177. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  7178. value = +value
  7179. offset = offset | 0
  7180. byteLength = byteLength | 0
  7181. if (!noAssert) {
  7182. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7183. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7184. }
  7185. var mul = 1
  7186. var i = 0
  7187. this[offset] = value & 0xFF
  7188. while (++i < byteLength && (mul *= 0x100)) {
  7189. this[offset + i] = (value / mul) & 0xFF
  7190. }
  7191. return offset + byteLength
  7192. }
  7193. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  7194. value = +value
  7195. offset = offset | 0
  7196. byteLength = byteLength | 0
  7197. if (!noAssert) {
  7198. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7199. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7200. }
  7201. var i = byteLength - 1
  7202. var mul = 1
  7203. this[offset + i] = value & 0xFF
  7204. while (--i >= 0 && (mul *= 0x100)) {
  7205. this[offset + i] = (value / mul) & 0xFF
  7206. }
  7207. return offset + byteLength
  7208. }
  7209. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  7210. value = +value
  7211. offset = offset | 0
  7212. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  7213. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7214. this[offset] = (value & 0xff)
  7215. return offset + 1
  7216. }
  7217. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  7218. if (value < 0) value = 0xffff + value + 1
  7219. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  7220. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  7221. (littleEndian ? i : 1 - i) * 8
  7222. }
  7223. }
  7224. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  7225. value = +value
  7226. offset = offset | 0
  7227. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7228. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7229. this[offset] = (value & 0xff)
  7230. this[offset + 1] = (value >>> 8)
  7231. } else {
  7232. objectWriteUInt16(this, value, offset, true)
  7233. }
  7234. return offset + 2
  7235. }
  7236. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  7237. value = +value
  7238. offset = offset | 0
  7239. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7240. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7241. this[offset] = (value >>> 8)
  7242. this[offset + 1] = (value & 0xff)
  7243. } else {
  7244. objectWriteUInt16(this, value, offset, false)
  7245. }
  7246. return offset + 2
  7247. }
  7248. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  7249. if (value < 0) value = 0xffffffff + value + 1
  7250. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  7251. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  7252. }
  7253. }
  7254. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  7255. value = +value
  7256. offset = offset | 0
  7257. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7258. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7259. this[offset + 3] = (value >>> 24)
  7260. this[offset + 2] = (value >>> 16)
  7261. this[offset + 1] = (value >>> 8)
  7262. this[offset] = (value & 0xff)
  7263. } else {
  7264. objectWriteUInt32(this, value, offset, true)
  7265. }
  7266. return offset + 4
  7267. }
  7268. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  7269. value = +value
  7270. offset = offset | 0
  7271. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7272. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7273. this[offset] = (value >>> 24)
  7274. this[offset + 1] = (value >>> 16)
  7275. this[offset + 2] = (value >>> 8)
  7276. this[offset + 3] = (value & 0xff)
  7277. } else {
  7278. objectWriteUInt32(this, value, offset, false)
  7279. }
  7280. return offset + 4
  7281. }
  7282. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  7283. value = +value
  7284. offset = offset | 0
  7285. if (!noAssert) {
  7286. var limit = Math.pow(2, 8 * byteLength - 1)
  7287. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7288. }
  7289. var i = 0
  7290. var mul = 1
  7291. var sub = 0
  7292. this[offset] = value & 0xFF
  7293. while (++i < byteLength && (mul *= 0x100)) {
  7294. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  7295. sub = 1
  7296. }
  7297. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7298. }
  7299. return offset + byteLength
  7300. }
  7301. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  7302. value = +value
  7303. offset = offset | 0
  7304. if (!noAssert) {
  7305. var limit = Math.pow(2, 8 * byteLength - 1)
  7306. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7307. }
  7308. var i = byteLength - 1
  7309. var mul = 1
  7310. var sub = 0
  7311. this[offset + i] = value & 0xFF
  7312. while (--i >= 0 && (mul *= 0x100)) {
  7313. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  7314. sub = 1
  7315. }
  7316. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7317. }
  7318. return offset + byteLength
  7319. }
  7320. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  7321. value = +value
  7322. offset = offset | 0
  7323. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  7324. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7325. if (value < 0) value = 0xff + value + 1
  7326. this[offset] = (value & 0xff)
  7327. return offset + 1
  7328. }
  7329. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  7330. value = +value
  7331. offset = offset | 0
  7332. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7333. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7334. this[offset] = (value & 0xff)
  7335. this[offset + 1] = (value >>> 8)
  7336. } else {
  7337. objectWriteUInt16(this, value, offset, true)
  7338. }
  7339. return offset + 2
  7340. }
  7341. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  7342. value = +value
  7343. offset = offset | 0
  7344. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7345. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7346. this[offset] = (value >>> 8)
  7347. this[offset + 1] = (value & 0xff)
  7348. } else {
  7349. objectWriteUInt16(this, value, offset, false)
  7350. }
  7351. return offset + 2
  7352. }
  7353. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  7354. value = +value
  7355. offset = offset | 0
  7356. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7357. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7358. this[offset] = (value & 0xff)
  7359. this[offset + 1] = (value >>> 8)
  7360. this[offset + 2] = (value >>> 16)
  7361. this[offset + 3] = (value >>> 24)
  7362. } else {
  7363. objectWriteUInt32(this, value, offset, true)
  7364. }
  7365. return offset + 4
  7366. }
  7367. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  7368. value = +value
  7369. offset = offset | 0
  7370. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7371. if (value < 0) value = 0xffffffff + value + 1
  7372. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7373. this[offset] = (value >>> 24)
  7374. this[offset + 1] = (value >>> 16)
  7375. this[offset + 2] = (value >>> 8)
  7376. this[offset + 3] = (value & 0xff)
  7377. } else {
  7378. objectWriteUInt32(this, value, offset, false)
  7379. }
  7380. return offset + 4
  7381. }
  7382. function checkIEEE754 (buf, value, offset, ext, max, min) {
  7383. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7384. if (offset < 0) throw new RangeError('Index out of range')
  7385. }
  7386. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  7387. if (!noAssert) {
  7388. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  7389. }
  7390. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  7391. return offset + 4
  7392. }
  7393. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  7394. return writeFloat(this, value, offset, true, noAssert)
  7395. }
  7396. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  7397. return writeFloat(this, value, offset, false, noAssert)
  7398. }
  7399. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  7400. if (!noAssert) {
  7401. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  7402. }
  7403. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  7404. return offset + 8
  7405. }
  7406. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  7407. return writeDouble(this, value, offset, true, noAssert)
  7408. }
  7409. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  7410. return writeDouble(this, value, offset, false, noAssert)
  7411. }
  7412. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  7413. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  7414. if (!start) start = 0
  7415. if (!end && end !== 0) end = this.length
  7416. if (targetStart >= target.length) targetStart = target.length
  7417. if (!targetStart) targetStart = 0
  7418. if (end > 0 && end < start) end = start
  7419. // Copy 0 bytes; we're done
  7420. if (end === start) return 0
  7421. if (target.length === 0 || this.length === 0) return 0
  7422. // Fatal error conditions
  7423. if (targetStart < 0) {
  7424. throw new RangeError('targetStart out of bounds')
  7425. }
  7426. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  7427. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  7428. // Are we oob?
  7429. if (end > this.length) end = this.length
  7430. if (target.length - targetStart < end - start) {
  7431. end = target.length - targetStart + start
  7432. }
  7433. var len = end - start
  7434. var i
  7435. if (this === target && start < targetStart && targetStart < end) {
  7436. // descending copy from end
  7437. for (i = len - 1; i >= 0; --i) {
  7438. target[i + targetStart] = this[i + start]
  7439. }
  7440. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  7441. // ascending copy from start
  7442. for (i = 0; i < len; ++i) {
  7443. target[i + targetStart] = this[i + start]
  7444. }
  7445. } else {
  7446. Uint8Array.prototype.set.call(
  7447. target,
  7448. this.subarray(start, start + len),
  7449. targetStart
  7450. )
  7451. }
  7452. return len
  7453. }
  7454. // Usage:
  7455. // buffer.fill(number[, offset[, end]])
  7456. // buffer.fill(buffer[, offset[, end]])
  7457. // buffer.fill(string[, offset[, end]][, encoding])
  7458. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  7459. // Handle string cases:
  7460. if (typeof val === 'string') {
  7461. if (typeof start === 'string') {
  7462. encoding = start
  7463. start = 0
  7464. end = this.length
  7465. } else if (typeof end === 'string') {
  7466. encoding = end
  7467. end = this.length
  7468. }
  7469. if (val.length === 1) {
  7470. var code = val.charCodeAt(0)
  7471. if (code < 256) {
  7472. val = code
  7473. }
  7474. }
  7475. if (encoding !== undefined && typeof encoding !== 'string') {
  7476. throw new TypeError('encoding must be a string')
  7477. }
  7478. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  7479. throw new TypeError('Unknown encoding: ' + encoding)
  7480. }
  7481. } else if (typeof val === 'number') {
  7482. val = val & 255
  7483. }
  7484. // Invalid ranges are not set to a default, so can range check early.
  7485. if (start < 0 || this.length < start || this.length < end) {
  7486. throw new RangeError('Out of range index')
  7487. }
  7488. if (end <= start) {
  7489. return this
  7490. }
  7491. start = start >>> 0
  7492. end = end === undefined ? this.length : end >>> 0
  7493. if (!val) val = 0
  7494. var i
  7495. if (typeof val === 'number') {
  7496. for (i = start; i < end; ++i) {
  7497. this[i] = val
  7498. }
  7499. } else {
  7500. var bytes = Buffer.isBuffer(val)
  7501. ? val
  7502. : utf8ToBytes(new Buffer(val, encoding).toString())
  7503. var len = bytes.length
  7504. for (i = 0; i < end - start; ++i) {
  7505. this[i + start] = bytes[i % len]
  7506. }
  7507. }
  7508. return this
  7509. }
  7510. // HELPER FUNCTIONS
  7511. // ================
  7512. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  7513. function base64clean (str) {
  7514. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  7515. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  7516. // Node converts strings with length < 2 to ''
  7517. if (str.length < 2) return ''
  7518. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  7519. while (str.length % 4 !== 0) {
  7520. str = str + '='
  7521. }
  7522. return str
  7523. }
  7524. function stringtrim (str) {
  7525. if (str.trim) return str.trim()
  7526. return str.replace(/^\s+|\s+$/g, '')
  7527. }
  7528. function toHex (n) {
  7529. if (n < 16) return '0' + n.toString(16)
  7530. return n.toString(16)
  7531. }
  7532. function utf8ToBytes (string, units) {
  7533. units = units || Infinity
  7534. var codePoint
  7535. var length = string.length
  7536. var leadSurrogate = null
  7537. var bytes = []
  7538. for (var i = 0; i < length; ++i) {
  7539. codePoint = string.charCodeAt(i)
  7540. // is surrogate component
  7541. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  7542. // last char was a lead
  7543. if (!leadSurrogate) {
  7544. // no lead yet
  7545. if (codePoint > 0xDBFF) {
  7546. // unexpected trail
  7547. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7548. continue
  7549. } else if (i + 1 === length) {
  7550. // unpaired lead
  7551. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7552. continue
  7553. }
  7554. // valid lead
  7555. leadSurrogate = codePoint
  7556. continue
  7557. }
  7558. // 2 leads in a row
  7559. if (codePoint < 0xDC00) {
  7560. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7561. leadSurrogate = codePoint
  7562. continue
  7563. }
  7564. // valid surrogate pair
  7565. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  7566. } else if (leadSurrogate) {
  7567. // valid bmp char, but last char was a lead
  7568. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7569. }
  7570. leadSurrogate = null
  7571. // encode utf8
  7572. if (codePoint < 0x80) {
  7573. if ((units -= 1) < 0) break
  7574. bytes.push(codePoint)
  7575. } else if (codePoint < 0x800) {
  7576. if ((units -= 2) < 0) break
  7577. bytes.push(
  7578. codePoint >> 0x6 | 0xC0,
  7579. codePoint & 0x3F | 0x80
  7580. )
  7581. } else if (codePoint < 0x10000) {
  7582. if ((units -= 3) < 0) break
  7583. bytes.push(
  7584. codePoint >> 0xC | 0xE0,
  7585. codePoint >> 0x6 & 0x3F | 0x80,
  7586. codePoint & 0x3F | 0x80
  7587. )
  7588. } else if (codePoint < 0x110000) {
  7589. if ((units -= 4) < 0) break
  7590. bytes.push(
  7591. codePoint >> 0x12 | 0xF0,
  7592. codePoint >> 0xC & 0x3F | 0x80,
  7593. codePoint >> 0x6 & 0x3F | 0x80,
  7594. codePoint & 0x3F | 0x80
  7595. )
  7596. } else {
  7597. throw new Error('Invalid code point')
  7598. }
  7599. }
  7600. return bytes
  7601. }
  7602. function asciiToBytes (str) {
  7603. var byteArray = []
  7604. for (var i = 0; i < str.length; ++i) {
  7605. // Node's code seems to be doing this and not & 0x7F..
  7606. byteArray.push(str.charCodeAt(i) & 0xFF)
  7607. }
  7608. return byteArray
  7609. }
  7610. function utf16leToBytes (str, units) {
  7611. var c, hi, lo
  7612. var byteArray = []
  7613. for (var i = 0; i < str.length; ++i) {
  7614. if ((units -= 2) < 0) break
  7615. c = str.charCodeAt(i)
  7616. hi = c >> 8
  7617. lo = c % 256
  7618. byteArray.push(lo)
  7619. byteArray.push(hi)
  7620. }
  7621. return byteArray
  7622. }
  7623. function base64ToBytes (str) {
  7624. return base64.toByteArray(base64clean(str))
  7625. }
  7626. function blitBuffer (src, dst, offset, length) {
  7627. for (var i = 0; i < length; ++i) {
  7628. if ((i + offset >= dst.length) || (i >= src.length)) break
  7629. dst[i + offset] = src[i]
  7630. }
  7631. return i
  7632. }
  7633. function isnan (val) {
  7634. return val !== val // eslint-disable-line no-self-compare
  7635. }
  7636. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  7637. /***/ }),
  7638. /***/ "./node_modules/clipboard/dist/clipboard.js":
  7639. /*!**************************************************!*\
  7640. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  7641. \**************************************************/
  7642. /*! no static exports found */
  7643. /***/ (function(module, exports, __webpack_require__) {
  7644. /*!
  7645. * clipboard.js v2.0.4
  7646. * https://zenorocha.github.io/clipboard.js
  7647. *
  7648. * Licensed MIT © Zeno Rocha
  7649. */
  7650. (function webpackUniversalModuleDefinition(root, factory) {
  7651. if(true)
  7652. module.exports = factory();
  7653. else {}
  7654. })(this, function() {
  7655. return /******/ (function(modules) { // webpackBootstrap
  7656. /******/ // The module cache
  7657. /******/ var installedModules = {};
  7658. /******/
  7659. /******/ // The require function
  7660. /******/ function __webpack_require__(moduleId) {
  7661. /******/
  7662. /******/ // Check if module is in cache
  7663. /******/ if(installedModules[moduleId]) {
  7664. /******/ return installedModules[moduleId].exports;
  7665. /******/ }
  7666. /******/ // Create a new module (and put it into the cache)
  7667. /******/ var module = installedModules[moduleId] = {
  7668. /******/ i: moduleId,
  7669. /******/ l: false,
  7670. /******/ exports: {}
  7671. /******/ };
  7672. /******/
  7673. /******/ // Execute the module function
  7674. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7675. /******/
  7676. /******/ // Flag the module as loaded
  7677. /******/ module.l = true;
  7678. /******/
  7679. /******/ // Return the exports of the module
  7680. /******/ return module.exports;
  7681. /******/ }
  7682. /******/
  7683. /******/
  7684. /******/ // expose the modules object (__webpack_modules__)
  7685. /******/ __webpack_require__.m = modules;
  7686. /******/
  7687. /******/ // expose the module cache
  7688. /******/ __webpack_require__.c = installedModules;
  7689. /******/
  7690. /******/ // define getter function for harmony exports
  7691. /******/ __webpack_require__.d = function(exports, name, getter) {
  7692. /******/ if(!__webpack_require__.o(exports, name)) {
  7693. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  7694. /******/ }
  7695. /******/ };
  7696. /******/
  7697. /******/ // define __esModule on exports
  7698. /******/ __webpack_require__.r = function(exports) {
  7699. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  7700. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  7701. /******/ }
  7702. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  7703. /******/ };
  7704. /******/
  7705. /******/ // create a fake namespace object
  7706. /******/ // mode & 1: value is a module id, require it
  7707. /******/ // mode & 2: merge all properties of value into the ns
  7708. /******/ // mode & 4: return value when already ns object
  7709. /******/ // mode & 8|1: behave like require
  7710. /******/ __webpack_require__.t = function(value, mode) {
  7711. /******/ if(mode & 1) value = __webpack_require__(value);
  7712. /******/ if(mode & 8) return value;
  7713. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  7714. /******/ var ns = Object.create(null);
  7715. /******/ __webpack_require__.r(ns);
  7716. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  7717. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  7718. /******/ return ns;
  7719. /******/ };
  7720. /******/
  7721. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7722. /******/ __webpack_require__.n = function(module) {
  7723. /******/ var getter = module && module.__esModule ?
  7724. /******/ function getDefault() { return module['default']; } :
  7725. /******/ function getModuleExports() { return module; };
  7726. /******/ __webpack_require__.d(getter, 'a', getter);
  7727. /******/ return getter;
  7728. /******/ };
  7729. /******/
  7730. /******/ // Object.prototype.hasOwnProperty.call
  7731. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  7732. /******/
  7733. /******/ // __webpack_public_path__
  7734. /******/ __webpack_require__.p = "";
  7735. /******/
  7736. /******/
  7737. /******/ // Load entry module and return exports
  7738. /******/ return __webpack_require__(__webpack_require__.s = 0);
  7739. /******/ })
  7740. /************************************************************************/
  7741. /******/ ([
  7742. /* 0 */
  7743. /***/ (function(module, exports, __webpack_require__) {
  7744. "use strict";
  7745. 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; };
  7746. 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; }; }();
  7747. var _clipboardAction = __webpack_require__(1);
  7748. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  7749. var _tinyEmitter = __webpack_require__(3);
  7750. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  7751. var _goodListener = __webpack_require__(4);
  7752. var _goodListener2 = _interopRequireDefault(_goodListener);
  7753. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7754. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7755. 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; }
  7756. 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; }
  7757. /**
  7758. * Base class which takes one or more elements, adds event listeners to them,
  7759. * and instantiates a new `ClipboardAction` on each click.
  7760. */
  7761. var Clipboard = function (_Emitter) {
  7762. _inherits(Clipboard, _Emitter);
  7763. /**
  7764. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7765. * @param {Object} options
  7766. */
  7767. function Clipboard(trigger, options) {
  7768. _classCallCheck(this, Clipboard);
  7769. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  7770. _this.resolveOptions(options);
  7771. _this.listenClick(trigger);
  7772. return _this;
  7773. }
  7774. /**
  7775. * Defines if attributes would be resolved using internal setter functions
  7776. * or custom functions that were passed in the constructor.
  7777. * @param {Object} options
  7778. */
  7779. _createClass(Clipboard, [{
  7780. key: 'resolveOptions',
  7781. value: function resolveOptions() {
  7782. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7783. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  7784. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  7785. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  7786. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  7787. }
  7788. /**
  7789. * Adds a click event listener to the passed trigger.
  7790. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7791. */
  7792. }, {
  7793. key: 'listenClick',
  7794. value: function listenClick(trigger) {
  7795. var _this2 = this;
  7796. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  7797. return _this2.onClick(e);
  7798. });
  7799. }
  7800. /**
  7801. * Defines a new `ClipboardAction` on each click event.
  7802. * @param {Event} e
  7803. */
  7804. }, {
  7805. key: 'onClick',
  7806. value: function onClick(e) {
  7807. var trigger = e.delegateTarget || e.currentTarget;
  7808. if (this.clipboardAction) {
  7809. this.clipboardAction = null;
  7810. }
  7811. this.clipboardAction = new _clipboardAction2.default({
  7812. action: this.action(trigger),
  7813. target: this.target(trigger),
  7814. text: this.text(trigger),
  7815. container: this.container,
  7816. trigger: trigger,
  7817. emitter: this
  7818. });
  7819. }
  7820. /**
  7821. * Default `action` lookup function.
  7822. * @param {Element} trigger
  7823. */
  7824. }, {
  7825. key: 'defaultAction',
  7826. value: function defaultAction(trigger) {
  7827. return getAttributeValue('action', trigger);
  7828. }
  7829. /**
  7830. * Default `target` lookup function.
  7831. * @param {Element} trigger
  7832. */
  7833. }, {
  7834. key: 'defaultTarget',
  7835. value: function defaultTarget(trigger) {
  7836. var selector = getAttributeValue('target', trigger);
  7837. if (selector) {
  7838. return document.querySelector(selector);
  7839. }
  7840. }
  7841. /**
  7842. * Returns the support of the given action, or all actions if no action is
  7843. * given.
  7844. * @param {String} [action]
  7845. */
  7846. }, {
  7847. key: 'defaultText',
  7848. /**
  7849. * Default `text` lookup function.
  7850. * @param {Element} trigger
  7851. */
  7852. value: function defaultText(trigger) {
  7853. return getAttributeValue('text', trigger);
  7854. }
  7855. /**
  7856. * Destroy lifecycle.
  7857. */
  7858. }, {
  7859. key: 'destroy',
  7860. value: function destroy() {
  7861. this.listener.destroy();
  7862. if (this.clipboardAction) {
  7863. this.clipboardAction.destroy();
  7864. this.clipboardAction = null;
  7865. }
  7866. }
  7867. }], [{
  7868. key: 'isSupported',
  7869. value: function isSupported() {
  7870. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  7871. var actions = typeof action === 'string' ? [action] : action;
  7872. var support = !!document.queryCommandSupported;
  7873. actions.forEach(function (action) {
  7874. support = support && !!document.queryCommandSupported(action);
  7875. });
  7876. return support;
  7877. }
  7878. }]);
  7879. return Clipboard;
  7880. }(_tinyEmitter2.default);
  7881. /**
  7882. * Helper function to retrieve attribute value.
  7883. * @param {String} suffix
  7884. * @param {Element} element
  7885. */
  7886. function getAttributeValue(suffix, element) {
  7887. var attribute = 'data-clipboard-' + suffix;
  7888. if (!element.hasAttribute(attribute)) {
  7889. return;
  7890. }
  7891. return element.getAttribute(attribute);
  7892. }
  7893. module.exports = Clipboard;
  7894. /***/ }),
  7895. /* 1 */
  7896. /***/ (function(module, exports, __webpack_require__) {
  7897. "use strict";
  7898. 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; };
  7899. 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; }; }();
  7900. var _select = __webpack_require__(2);
  7901. var _select2 = _interopRequireDefault(_select);
  7902. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7903. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7904. /**
  7905. * Inner class which performs selection from either `text` or `target`
  7906. * properties and then executes copy or cut operations.
  7907. */
  7908. var ClipboardAction = function () {
  7909. /**
  7910. * @param {Object} options
  7911. */
  7912. function ClipboardAction(options) {
  7913. _classCallCheck(this, ClipboardAction);
  7914. this.resolveOptions(options);
  7915. this.initSelection();
  7916. }
  7917. /**
  7918. * Defines base properties passed from constructor.
  7919. * @param {Object} options
  7920. */
  7921. _createClass(ClipboardAction, [{
  7922. key: 'resolveOptions',
  7923. value: function resolveOptions() {
  7924. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7925. this.action = options.action;
  7926. this.container = options.container;
  7927. this.emitter = options.emitter;
  7928. this.target = options.target;
  7929. this.text = options.text;
  7930. this.trigger = options.trigger;
  7931. this.selectedText = '';
  7932. }
  7933. /**
  7934. * Decides which selection strategy is going to be applied based
  7935. * on the existence of `text` and `target` properties.
  7936. */
  7937. }, {
  7938. key: 'initSelection',
  7939. value: function initSelection() {
  7940. if (this.text) {
  7941. this.selectFake();
  7942. } else if (this.target) {
  7943. this.selectTarget();
  7944. }
  7945. }
  7946. /**
  7947. * Creates a fake textarea element, sets its value from `text` property,
  7948. * and makes a selection on it.
  7949. */
  7950. }, {
  7951. key: 'selectFake',
  7952. value: function selectFake() {
  7953. var _this = this;
  7954. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  7955. this.removeFake();
  7956. this.fakeHandlerCallback = function () {
  7957. return _this.removeFake();
  7958. };
  7959. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  7960. this.fakeElem = document.createElement('textarea');
  7961. // Prevent zooming on iOS
  7962. this.fakeElem.style.fontSize = '12pt';
  7963. // Reset box model
  7964. this.fakeElem.style.border = '0';
  7965. this.fakeElem.style.padding = '0';
  7966. this.fakeElem.style.margin = '0';
  7967. // Move element out of screen horizontally
  7968. this.fakeElem.style.position = 'absolute';
  7969. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  7970. // Move element to the same position vertically
  7971. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  7972. this.fakeElem.style.top = yPosition + 'px';
  7973. this.fakeElem.setAttribute('readonly', '');
  7974. this.fakeElem.value = this.text;
  7975. this.container.appendChild(this.fakeElem);
  7976. this.selectedText = (0, _select2.default)(this.fakeElem);
  7977. this.copyText();
  7978. }
  7979. /**
  7980. * Only removes the fake element after another click event, that way
  7981. * a user can hit `Ctrl+C` to copy because selection still exists.
  7982. */
  7983. }, {
  7984. key: 'removeFake',
  7985. value: function removeFake() {
  7986. if (this.fakeHandler) {
  7987. this.container.removeEventListener('click', this.fakeHandlerCallback);
  7988. this.fakeHandler = null;
  7989. this.fakeHandlerCallback = null;
  7990. }
  7991. if (this.fakeElem) {
  7992. this.container.removeChild(this.fakeElem);
  7993. this.fakeElem = null;
  7994. }
  7995. }
  7996. /**
  7997. * Selects the content from element passed on `target` property.
  7998. */
  7999. }, {
  8000. key: 'selectTarget',
  8001. value: function selectTarget() {
  8002. this.selectedText = (0, _select2.default)(this.target);
  8003. this.copyText();
  8004. }
  8005. /**
  8006. * Executes the copy operation based on the current selection.
  8007. */
  8008. }, {
  8009. key: 'copyText',
  8010. value: function copyText() {
  8011. var succeeded = void 0;
  8012. try {
  8013. succeeded = document.execCommand(this.action);
  8014. } catch (err) {
  8015. succeeded = false;
  8016. }
  8017. this.handleResult(succeeded);
  8018. }
  8019. /**
  8020. * Fires an event based on the copy operation result.
  8021. * @param {Boolean} succeeded
  8022. */
  8023. }, {
  8024. key: 'handleResult',
  8025. value: function handleResult(succeeded) {
  8026. this.emitter.emit(succeeded ? 'success' : 'error', {
  8027. action: this.action,
  8028. text: this.selectedText,
  8029. trigger: this.trigger,
  8030. clearSelection: this.clearSelection.bind(this)
  8031. });
  8032. }
  8033. /**
  8034. * Moves focus away from `target` and back to the trigger, removes current selection.
  8035. */
  8036. }, {
  8037. key: 'clearSelection',
  8038. value: function clearSelection() {
  8039. if (this.trigger) {
  8040. this.trigger.focus();
  8041. }
  8042. window.getSelection().removeAllRanges();
  8043. }
  8044. /**
  8045. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  8046. * @param {String} action
  8047. */
  8048. }, {
  8049. key: 'destroy',
  8050. /**
  8051. * Destroy lifecycle.
  8052. */
  8053. value: function destroy() {
  8054. this.removeFake();
  8055. }
  8056. }, {
  8057. key: 'action',
  8058. set: function set() {
  8059. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  8060. this._action = action;
  8061. if (this._action !== 'copy' && this._action !== 'cut') {
  8062. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  8063. }
  8064. }
  8065. /**
  8066. * Gets the `action` property.
  8067. * @return {String}
  8068. */
  8069. ,
  8070. get: function get() {
  8071. return this._action;
  8072. }
  8073. /**
  8074. * Sets the `target` property using an element
  8075. * that will be have its content copied.
  8076. * @param {Element} target
  8077. */
  8078. }, {
  8079. key: 'target',
  8080. set: function set(target) {
  8081. if (target !== undefined) {
  8082. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  8083. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  8084. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  8085. }
  8086. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  8087. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  8088. }
  8089. this._target = target;
  8090. } else {
  8091. throw new Error('Invalid "target" value, use a valid Element');
  8092. }
  8093. }
  8094. }
  8095. /**
  8096. * Gets the `target` property.
  8097. * @return {String|HTMLElement}
  8098. */
  8099. ,
  8100. get: function get() {
  8101. return this._target;
  8102. }
  8103. }]);
  8104. return ClipboardAction;
  8105. }();
  8106. module.exports = ClipboardAction;
  8107. /***/ }),
  8108. /* 2 */
  8109. /***/ (function(module, exports) {
  8110. function select(element) {
  8111. var selectedText;
  8112. if (element.nodeName === 'SELECT') {
  8113. element.focus();
  8114. selectedText = element.value;
  8115. }
  8116. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  8117. var isReadOnly = element.hasAttribute('readonly');
  8118. if (!isReadOnly) {
  8119. element.setAttribute('readonly', '');
  8120. }
  8121. element.select();
  8122. element.setSelectionRange(0, element.value.length);
  8123. if (!isReadOnly) {
  8124. element.removeAttribute('readonly');
  8125. }
  8126. selectedText = element.value;
  8127. }
  8128. else {
  8129. if (element.hasAttribute('contenteditable')) {
  8130. element.focus();
  8131. }
  8132. var selection = window.getSelection();
  8133. var range = document.createRange();
  8134. range.selectNodeContents(element);
  8135. selection.removeAllRanges();
  8136. selection.addRange(range);
  8137. selectedText = selection.toString();
  8138. }
  8139. return selectedText;
  8140. }
  8141. module.exports = select;
  8142. /***/ }),
  8143. /* 3 */
  8144. /***/ (function(module, exports) {
  8145. function E () {
  8146. // Keep this empty so it's easier to inherit from
  8147. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  8148. }
  8149. E.prototype = {
  8150. on: function (name, callback, ctx) {
  8151. var e = this.e || (this.e = {});
  8152. (e[name] || (e[name] = [])).push({
  8153. fn: callback,
  8154. ctx: ctx
  8155. });
  8156. return this;
  8157. },
  8158. once: function (name, callback, ctx) {
  8159. var self = this;
  8160. function listener () {
  8161. self.off(name, listener);
  8162. callback.apply(ctx, arguments);
  8163. };
  8164. listener._ = callback
  8165. return this.on(name, listener, ctx);
  8166. },
  8167. emit: function (name) {
  8168. var data = [].slice.call(arguments, 1);
  8169. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  8170. var i = 0;
  8171. var len = evtArr.length;
  8172. for (i; i < len; i++) {
  8173. evtArr[i].fn.apply(evtArr[i].ctx, data);
  8174. }
  8175. return this;
  8176. },
  8177. off: function (name, callback) {
  8178. var e = this.e || (this.e = {});
  8179. var evts = e[name];
  8180. var liveEvents = [];
  8181. if (evts && callback) {
  8182. for (var i = 0, len = evts.length; i < len; i++) {
  8183. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  8184. liveEvents.push(evts[i]);
  8185. }
  8186. }
  8187. // Remove event from queue to prevent memory leak
  8188. // Suggested by https://github.com/lazd
  8189. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  8190. (liveEvents.length)
  8191. ? e[name] = liveEvents
  8192. : delete e[name];
  8193. return this;
  8194. }
  8195. };
  8196. module.exports = E;
  8197. /***/ }),
  8198. /* 4 */
  8199. /***/ (function(module, exports, __webpack_require__) {
  8200. var is = __webpack_require__(5);
  8201. var delegate = __webpack_require__(6);
  8202. /**
  8203. * Validates all params and calls the right
  8204. * listener function based on its target type.
  8205. *
  8206. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  8207. * @param {String} type
  8208. * @param {Function} callback
  8209. * @return {Object}
  8210. */
  8211. function listen(target, type, callback) {
  8212. if (!target && !type && !callback) {
  8213. throw new Error('Missing required arguments');
  8214. }
  8215. if (!is.string(type)) {
  8216. throw new TypeError('Second argument must be a String');
  8217. }
  8218. if (!is.fn(callback)) {
  8219. throw new TypeError('Third argument must be a Function');
  8220. }
  8221. if (is.node(target)) {
  8222. return listenNode(target, type, callback);
  8223. }
  8224. else if (is.nodeList(target)) {
  8225. return listenNodeList(target, type, callback);
  8226. }
  8227. else if (is.string(target)) {
  8228. return listenSelector(target, type, callback);
  8229. }
  8230. else {
  8231. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  8232. }
  8233. }
  8234. /**
  8235. * Adds an event listener to a HTML element
  8236. * and returns a remove listener function.
  8237. *
  8238. * @param {HTMLElement} node
  8239. * @param {String} type
  8240. * @param {Function} callback
  8241. * @return {Object}
  8242. */
  8243. function listenNode(node, type, callback) {
  8244. node.addEventListener(type, callback);
  8245. return {
  8246. destroy: function() {
  8247. node.removeEventListener(type, callback);
  8248. }
  8249. }
  8250. }
  8251. /**
  8252. * Add an event listener to a list of HTML elements
  8253. * and returns a remove listener function.
  8254. *
  8255. * @param {NodeList|HTMLCollection} nodeList
  8256. * @param {String} type
  8257. * @param {Function} callback
  8258. * @return {Object}
  8259. */
  8260. function listenNodeList(nodeList, type, callback) {
  8261. Array.prototype.forEach.call(nodeList, function(node) {
  8262. node.addEventListener(type, callback);
  8263. });
  8264. return {
  8265. destroy: function() {
  8266. Array.prototype.forEach.call(nodeList, function(node) {
  8267. node.removeEventListener(type, callback);
  8268. });
  8269. }
  8270. }
  8271. }
  8272. /**
  8273. * Add an event listener to a selector
  8274. * and returns a remove listener function.
  8275. *
  8276. * @param {String} selector
  8277. * @param {String} type
  8278. * @param {Function} callback
  8279. * @return {Object}
  8280. */
  8281. function listenSelector(selector, type, callback) {
  8282. return delegate(document.body, selector, type, callback);
  8283. }
  8284. module.exports = listen;
  8285. /***/ }),
  8286. /* 5 */
  8287. /***/ (function(module, exports) {
  8288. /**
  8289. * Check if argument is a HTML element.
  8290. *
  8291. * @param {Object} value
  8292. * @return {Boolean}
  8293. */
  8294. exports.node = function(value) {
  8295. return value !== undefined
  8296. && value instanceof HTMLElement
  8297. && value.nodeType === 1;
  8298. };
  8299. /**
  8300. * Check if argument is a list of HTML elements.
  8301. *
  8302. * @param {Object} value
  8303. * @return {Boolean}
  8304. */
  8305. exports.nodeList = function(value) {
  8306. var type = Object.prototype.toString.call(value);
  8307. return value !== undefined
  8308. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  8309. && ('length' in value)
  8310. && (value.length === 0 || exports.node(value[0]));
  8311. };
  8312. /**
  8313. * Check if argument is a string.
  8314. *
  8315. * @param {Object} value
  8316. * @return {Boolean}
  8317. */
  8318. exports.string = function(value) {
  8319. return typeof value === 'string'
  8320. || value instanceof String;
  8321. };
  8322. /**
  8323. * Check if argument is a function.
  8324. *
  8325. * @param {Object} value
  8326. * @return {Boolean}
  8327. */
  8328. exports.fn = function(value) {
  8329. var type = Object.prototype.toString.call(value);
  8330. return type === '[object Function]';
  8331. };
  8332. /***/ }),
  8333. /* 6 */
  8334. /***/ (function(module, exports, __webpack_require__) {
  8335. var closest = __webpack_require__(7);
  8336. /**
  8337. * Delegates event to a selector.
  8338. *
  8339. * @param {Element} element
  8340. * @param {String} selector
  8341. * @param {String} type
  8342. * @param {Function} callback
  8343. * @param {Boolean} useCapture
  8344. * @return {Object}
  8345. */
  8346. function _delegate(element, selector, type, callback, useCapture) {
  8347. var listenerFn = listener.apply(this, arguments);
  8348. element.addEventListener(type, listenerFn, useCapture);
  8349. return {
  8350. destroy: function() {
  8351. element.removeEventListener(type, listenerFn, useCapture);
  8352. }
  8353. }
  8354. }
  8355. /**
  8356. * Delegates event to a selector.
  8357. *
  8358. * @param {Element|String|Array} [elements]
  8359. * @param {String} selector
  8360. * @param {String} type
  8361. * @param {Function} callback
  8362. * @param {Boolean} useCapture
  8363. * @return {Object}
  8364. */
  8365. function delegate(elements, selector, type, callback, useCapture) {
  8366. // Handle the regular Element usage
  8367. if (typeof elements.addEventListener === 'function') {
  8368. return _delegate.apply(null, arguments);
  8369. }
  8370. // Handle Element-less usage, it defaults to global delegation
  8371. if (typeof type === 'function') {
  8372. // Use `document` as the first parameter, then apply arguments
  8373. // This is a short way to .unshift `arguments` without running into deoptimizations
  8374. return _delegate.bind(null, document).apply(null, arguments);
  8375. }
  8376. // Handle Selector-based usage
  8377. if (typeof elements === 'string') {
  8378. elements = document.querySelectorAll(elements);
  8379. }
  8380. // Handle Array-like based usage
  8381. return Array.prototype.map.call(elements, function (element) {
  8382. return _delegate(element, selector, type, callback, useCapture);
  8383. });
  8384. }
  8385. /**
  8386. * Finds closest match and invokes callback.
  8387. *
  8388. * @param {Element} element
  8389. * @param {String} selector
  8390. * @param {String} type
  8391. * @param {Function} callback
  8392. * @return {Function}
  8393. */
  8394. function listener(element, selector, type, callback) {
  8395. return function(e) {
  8396. e.delegateTarget = closest(e.target, selector);
  8397. if (e.delegateTarget) {
  8398. callback.call(element, e);
  8399. }
  8400. }
  8401. }
  8402. module.exports = delegate;
  8403. /***/ }),
  8404. /* 7 */
  8405. /***/ (function(module, exports) {
  8406. var DOCUMENT_NODE_TYPE = 9;
  8407. /**
  8408. * A polyfill for Element.matches()
  8409. */
  8410. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  8411. var proto = Element.prototype;
  8412. proto.matches = proto.matchesSelector ||
  8413. proto.mozMatchesSelector ||
  8414. proto.msMatchesSelector ||
  8415. proto.oMatchesSelector ||
  8416. proto.webkitMatchesSelector;
  8417. }
  8418. /**
  8419. * Finds the closest parent that matches a selector.
  8420. *
  8421. * @param {Element} element
  8422. * @param {String} selector
  8423. * @return {Function}
  8424. */
  8425. function closest (element, selector) {
  8426. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  8427. if (typeof element.matches === 'function' &&
  8428. element.matches(selector)) {
  8429. return element;
  8430. }
  8431. element = element.parentNode;
  8432. }
  8433. }
  8434. module.exports = closest;
  8435. /***/ })
  8436. /******/ ]);
  8437. });
  8438. /***/ }),
  8439. /***/ "./node_modules/ieee754/index.js":
  8440. /*!***************************************!*\
  8441. !*** ./node_modules/ieee754/index.js ***!
  8442. \***************************************/
  8443. /*! no static exports found */
  8444. /***/ (function(module, exports) {
  8445. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  8446. var e, m
  8447. var eLen = (nBytes * 8) - mLen - 1
  8448. var eMax = (1 << eLen) - 1
  8449. var eBias = eMax >> 1
  8450. var nBits = -7
  8451. var i = isLE ? (nBytes - 1) : 0
  8452. var d = isLE ? -1 : 1
  8453. var s = buffer[offset + i]
  8454. i += d
  8455. e = s & ((1 << (-nBits)) - 1)
  8456. s >>= (-nBits)
  8457. nBits += eLen
  8458. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8459. m = e & ((1 << (-nBits)) - 1)
  8460. e >>= (-nBits)
  8461. nBits += mLen
  8462. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8463. if (e === 0) {
  8464. e = 1 - eBias
  8465. } else if (e === eMax) {
  8466. return m ? NaN : ((s ? -1 : 1) * Infinity)
  8467. } else {
  8468. m = m + Math.pow(2, mLen)
  8469. e = e - eBias
  8470. }
  8471. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  8472. }
  8473. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  8474. var e, m, c
  8475. var eLen = (nBytes * 8) - mLen - 1
  8476. var eMax = (1 << eLen) - 1
  8477. var eBias = eMax >> 1
  8478. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  8479. var i = isLE ? 0 : (nBytes - 1)
  8480. var d = isLE ? 1 : -1
  8481. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  8482. value = Math.abs(value)
  8483. if (isNaN(value) || value === Infinity) {
  8484. m = isNaN(value) ? 1 : 0
  8485. e = eMax
  8486. } else {
  8487. e = Math.floor(Math.log(value) / Math.LN2)
  8488. if (value * (c = Math.pow(2, -e)) < 1) {
  8489. e--
  8490. c *= 2
  8491. }
  8492. if (e + eBias >= 1) {
  8493. value += rt / c
  8494. } else {
  8495. value += rt * Math.pow(2, 1 - eBias)
  8496. }
  8497. if (value * c >= 2) {
  8498. e++
  8499. c /= 2
  8500. }
  8501. if (e + eBias >= eMax) {
  8502. m = 0
  8503. e = eMax
  8504. } else if (e + eBias >= 1) {
  8505. m = ((value * c) - 1) * Math.pow(2, mLen)
  8506. e = e + eBias
  8507. } else {
  8508. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  8509. e = 0
  8510. }
  8511. }
  8512. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  8513. e = (e << mLen) | m
  8514. eLen += mLen
  8515. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  8516. buffer[offset + i - d] |= s * 128
  8517. }
  8518. /***/ }),
  8519. /***/ "./node_modules/isarray/index.js":
  8520. /*!***************************************!*\
  8521. !*** ./node_modules/isarray/index.js ***!
  8522. \***************************************/
  8523. /*! no static exports found */
  8524. /***/ (function(module, exports) {
  8525. var toString = {}.toString;
  8526. module.exports = Array.isArray || function (arr) {
  8527. return toString.call(arr) == '[object Array]';
  8528. };
  8529. /***/ }),
  8530. /***/ "./node_modules/jquery/dist/jquery.js":
  8531. /*!********************************************!*\
  8532. !*** ./node_modules/jquery/dist/jquery.js ***!
  8533. \********************************************/
  8534. /*! no static exports found */
  8535. /***/ (function(module, exports, __webpack_require__) {
  8536. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  8537. * jQuery JavaScript Library v3.4.1
  8538. * https://jquery.com/
  8539. *
  8540. * Includes Sizzle.js
  8541. * https://sizzlejs.com/
  8542. *
  8543. * Copyright JS Foundation and other contributors
  8544. * Released under the MIT license
  8545. * https://jquery.org/license
  8546. *
  8547. * Date: 2019-05-01T21:04Z
  8548. */
  8549. ( function( global, factory ) {
  8550. "use strict";
  8551. if ( true && typeof module.exports === "object" ) {
  8552. // For CommonJS and CommonJS-like environments where a proper `window`
  8553. // is present, execute the factory and get jQuery.
  8554. // For environments that do not have a `window` with a `document`
  8555. // (such as Node.js), expose a factory as module.exports.
  8556. // This accentuates the need for the creation of a real `window`.
  8557. // e.g. var jQuery = require("jquery")(window);
  8558. // See ticket #14549 for more info.
  8559. module.exports = global.document ?
  8560. factory( global, true ) :
  8561. function( w ) {
  8562. if ( !w.document ) {
  8563. throw new Error( "jQuery requires a window with a document" );
  8564. }
  8565. return factory( w );
  8566. };
  8567. } else {
  8568. factory( global );
  8569. }
  8570. // Pass this if window is not defined yet
  8571. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  8572. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  8573. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  8574. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  8575. // enough that all such attempts are guarded in a try block.
  8576. "use strict";
  8577. var arr = [];
  8578. var document = window.document;
  8579. var getProto = Object.getPrototypeOf;
  8580. var slice = arr.slice;
  8581. var concat = arr.concat;
  8582. var push = arr.push;
  8583. var indexOf = arr.indexOf;
  8584. var class2type = {};
  8585. var toString = class2type.toString;
  8586. var hasOwn = class2type.hasOwnProperty;
  8587. var fnToString = hasOwn.toString;
  8588. var ObjectFunctionString = fnToString.call( Object );
  8589. var support = {};
  8590. var isFunction = function isFunction( obj ) {
  8591. // Support: Chrome <=57, Firefox <=52
  8592. // In some browsers, typeof returns "function" for HTML <object> elements
  8593. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  8594. // We don't want to classify *any* DOM node as a function.
  8595. return typeof obj === "function" && typeof obj.nodeType !== "number";
  8596. };
  8597. var isWindow = function isWindow( obj ) {
  8598. return obj != null && obj === obj.window;
  8599. };
  8600. var preservedScriptAttributes = {
  8601. type: true,
  8602. src: true,
  8603. nonce: true,
  8604. noModule: true
  8605. };
  8606. function DOMEval( code, node, doc ) {
  8607. doc = doc || document;
  8608. var i, val,
  8609. script = doc.createElement( "script" );
  8610. script.text = code;
  8611. if ( node ) {
  8612. for ( i in preservedScriptAttributes ) {
  8613. // Support: Firefox 64+, Edge 18+
  8614. // Some browsers don't support the "nonce" property on scripts.
  8615. // On the other hand, just using `getAttribute` is not enough as
  8616. // the `nonce` attribute is reset to an empty string whenever it
  8617. // becomes browsing-context connected.
  8618. // See https://github.com/whatwg/html/issues/2369
  8619. // See https://html.spec.whatwg.org/#nonce-attributes
  8620. // The `node.getAttribute` check was added for the sake of
  8621. // `jQuery.globalEval` so that it can fake a nonce-containing node
  8622. // via an object.
  8623. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  8624. if ( val ) {
  8625. script.setAttribute( i, val );
  8626. }
  8627. }
  8628. }
  8629. doc.head.appendChild( script ).parentNode.removeChild( script );
  8630. }
  8631. function toType( obj ) {
  8632. if ( obj == null ) {
  8633. return obj + "";
  8634. }
  8635. // Support: Android <=2.3 only (functionish RegExp)
  8636. return typeof obj === "object" || typeof obj === "function" ?
  8637. class2type[ toString.call( obj ) ] || "object" :
  8638. typeof obj;
  8639. }
  8640. /* global Symbol */
  8641. // Defining this global in .eslintrc.json would create a danger of using the global
  8642. // unguarded in another place, it seems safer to define global only for this module
  8643. var
  8644. version = "3.4.1",
  8645. // Define a local copy of jQuery
  8646. jQuery = function( selector, context ) {
  8647. // The jQuery object is actually just the init constructor 'enhanced'
  8648. // Need init if jQuery is called (just allow error to be thrown if not included)
  8649. return new jQuery.fn.init( selector, context );
  8650. },
  8651. // Support: Android <=4.0 only
  8652. // Make sure we trim BOM and NBSP
  8653. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  8654. jQuery.fn = jQuery.prototype = {
  8655. // The current version of jQuery being used
  8656. jquery: version,
  8657. constructor: jQuery,
  8658. // The default length of a jQuery object is 0
  8659. length: 0,
  8660. toArray: function() {
  8661. return slice.call( this );
  8662. },
  8663. // Get the Nth element in the matched element set OR
  8664. // Get the whole matched element set as a clean array
  8665. get: function( num ) {
  8666. // Return all the elements in a clean array
  8667. if ( num == null ) {
  8668. return slice.call( this );
  8669. }
  8670. // Return just the one element from the set
  8671. return num < 0 ? this[ num + this.length ] : this[ num ];
  8672. },
  8673. // Take an array of elements and push it onto the stack
  8674. // (returning the new matched element set)
  8675. pushStack: function( elems ) {
  8676. // Build a new jQuery matched element set
  8677. var ret = jQuery.merge( this.constructor(), elems );
  8678. // Add the old object onto the stack (as a reference)
  8679. ret.prevObject = this;
  8680. // Return the newly-formed element set
  8681. return ret;
  8682. },
  8683. // Execute a callback for every element in the matched set.
  8684. each: function( callback ) {
  8685. return jQuery.each( this, callback );
  8686. },
  8687. map: function( callback ) {
  8688. return this.pushStack( jQuery.map( this, function( elem, i ) {
  8689. return callback.call( elem, i, elem );
  8690. } ) );
  8691. },
  8692. slice: function() {
  8693. return this.pushStack( slice.apply( this, arguments ) );
  8694. },
  8695. first: function() {
  8696. return this.eq( 0 );
  8697. },
  8698. last: function() {
  8699. return this.eq( -1 );
  8700. },
  8701. eq: function( i ) {
  8702. var len = this.length,
  8703. j = +i + ( i < 0 ? len : 0 );
  8704. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  8705. },
  8706. end: function() {
  8707. return this.prevObject || this.constructor();
  8708. },
  8709. // For internal use only.
  8710. // Behaves like an Array's method, not like a jQuery method.
  8711. push: push,
  8712. sort: arr.sort,
  8713. splice: arr.splice
  8714. };
  8715. jQuery.extend = jQuery.fn.extend = function() {
  8716. var options, name, src, copy, copyIsArray, clone,
  8717. target = arguments[ 0 ] || {},
  8718. i = 1,
  8719. length = arguments.length,
  8720. deep = false;
  8721. // Handle a deep copy situation
  8722. if ( typeof target === "boolean" ) {
  8723. deep = target;
  8724. // Skip the boolean and the target
  8725. target = arguments[ i ] || {};
  8726. i++;
  8727. }
  8728. // Handle case when target is a string or something (possible in deep copy)
  8729. if ( typeof target !== "object" && !isFunction( target ) ) {
  8730. target = {};
  8731. }
  8732. // Extend jQuery itself if only one argument is passed
  8733. if ( i === length ) {
  8734. target = this;
  8735. i--;
  8736. }
  8737. for ( ; i < length; i++ ) {
  8738. // Only deal with non-null/undefined values
  8739. if ( ( options = arguments[ i ] ) != null ) {
  8740. // Extend the base object
  8741. for ( name in options ) {
  8742. copy = options[ name ];
  8743. // Prevent Object.prototype pollution
  8744. // Prevent never-ending loop
  8745. if ( name === "__proto__" || target === copy ) {
  8746. continue;
  8747. }
  8748. // Recurse if we're merging plain objects or arrays
  8749. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  8750. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  8751. src = target[ name ];
  8752. // Ensure proper type for the source value
  8753. if ( copyIsArray && !Array.isArray( src ) ) {
  8754. clone = [];
  8755. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  8756. clone = {};
  8757. } else {
  8758. clone = src;
  8759. }
  8760. copyIsArray = false;
  8761. // Never move original objects, clone them
  8762. target[ name ] = jQuery.extend( deep, clone, copy );
  8763. // Don't bring in undefined values
  8764. } else if ( copy !== undefined ) {
  8765. target[ name ] = copy;
  8766. }
  8767. }
  8768. }
  8769. }
  8770. // Return the modified object
  8771. return target;
  8772. };
  8773. jQuery.extend( {
  8774. // Unique for each copy of jQuery on the page
  8775. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  8776. // Assume jQuery is ready without the ready module
  8777. isReady: true,
  8778. error: function( msg ) {
  8779. throw new Error( msg );
  8780. },
  8781. noop: function() {},
  8782. isPlainObject: function( obj ) {
  8783. var proto, Ctor;
  8784. // Detect obvious negatives
  8785. // Use toString instead of jQuery.type to catch host objects
  8786. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  8787. return false;
  8788. }
  8789. proto = getProto( obj );
  8790. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  8791. if ( !proto ) {
  8792. return true;
  8793. }
  8794. // Objects with prototype are plain iff they were constructed by a global Object function
  8795. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  8796. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  8797. },
  8798. isEmptyObject: function( obj ) {
  8799. var name;
  8800. for ( name in obj ) {
  8801. return false;
  8802. }
  8803. return true;
  8804. },
  8805. // Evaluates a script in a global context
  8806. globalEval: function( code, options ) {
  8807. DOMEval( code, { nonce: options && options.nonce } );
  8808. },
  8809. each: function( obj, callback ) {
  8810. var length, i = 0;
  8811. if ( isArrayLike( obj ) ) {
  8812. length = obj.length;
  8813. for ( ; i < length; i++ ) {
  8814. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8815. break;
  8816. }
  8817. }
  8818. } else {
  8819. for ( i in obj ) {
  8820. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8821. break;
  8822. }
  8823. }
  8824. }
  8825. return obj;
  8826. },
  8827. // Support: Android <=4.0 only
  8828. trim: function( text ) {
  8829. return text == null ?
  8830. "" :
  8831. ( text + "" ).replace( rtrim, "" );
  8832. },
  8833. // results is for internal usage only
  8834. makeArray: function( arr, results ) {
  8835. var ret = results || [];
  8836. if ( arr != null ) {
  8837. if ( isArrayLike( Object( arr ) ) ) {
  8838. jQuery.merge( ret,
  8839. typeof arr === "string" ?
  8840. [ arr ] : arr
  8841. );
  8842. } else {
  8843. push.call( ret, arr );
  8844. }
  8845. }
  8846. return ret;
  8847. },
  8848. inArray: function( elem, arr, i ) {
  8849. return arr == null ? -1 : indexOf.call( arr, elem, i );
  8850. },
  8851. // Support: Android <=4.0 only, PhantomJS 1 only
  8852. // push.apply(_, arraylike) throws on ancient WebKit
  8853. merge: function( first, second ) {
  8854. var len = +second.length,
  8855. j = 0,
  8856. i = first.length;
  8857. for ( ; j < len; j++ ) {
  8858. first[ i++ ] = second[ j ];
  8859. }
  8860. first.length = i;
  8861. return first;
  8862. },
  8863. grep: function( elems, callback, invert ) {
  8864. var callbackInverse,
  8865. matches = [],
  8866. i = 0,
  8867. length = elems.length,
  8868. callbackExpect = !invert;
  8869. // Go through the array, only saving the items
  8870. // that pass the validator function
  8871. for ( ; i < length; i++ ) {
  8872. callbackInverse = !callback( elems[ i ], i );
  8873. if ( callbackInverse !== callbackExpect ) {
  8874. matches.push( elems[ i ] );
  8875. }
  8876. }
  8877. return matches;
  8878. },
  8879. // arg is for internal usage only
  8880. map: function( elems, callback, arg ) {
  8881. var length, value,
  8882. i = 0,
  8883. ret = [];
  8884. // Go through the array, translating each of the items to their new values
  8885. if ( isArrayLike( elems ) ) {
  8886. length = elems.length;
  8887. for ( ; i < length; i++ ) {
  8888. value = callback( elems[ i ], i, arg );
  8889. if ( value != null ) {
  8890. ret.push( value );
  8891. }
  8892. }
  8893. // Go through every key on the object,
  8894. } else {
  8895. for ( i in elems ) {
  8896. value = callback( elems[ i ], i, arg );
  8897. if ( value != null ) {
  8898. ret.push( value );
  8899. }
  8900. }
  8901. }
  8902. // Flatten any nested arrays
  8903. return concat.apply( [], ret );
  8904. },
  8905. // A global GUID counter for objects
  8906. guid: 1,
  8907. // jQuery.support is not used in Core but other projects attach their
  8908. // properties to it so it needs to exist.
  8909. support: support
  8910. } );
  8911. if ( typeof Symbol === "function" ) {
  8912. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  8913. }
  8914. // Populate the class2type map
  8915. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  8916. function( i, name ) {
  8917. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  8918. } );
  8919. function isArrayLike( obj ) {
  8920. // Support: real iOS 8.2 only (not reproducible in simulator)
  8921. // `in` check used to prevent JIT error (gh-2145)
  8922. // hasOwn isn't used here due to false negatives
  8923. // regarding Nodelist length in IE
  8924. var length = !!obj && "length" in obj && obj.length,
  8925. type = toType( obj );
  8926. if ( isFunction( obj ) || isWindow( obj ) ) {
  8927. return false;
  8928. }
  8929. return type === "array" || length === 0 ||
  8930. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  8931. }
  8932. var Sizzle =
  8933. /*!
  8934. * Sizzle CSS Selector Engine v2.3.4
  8935. * https://sizzlejs.com/
  8936. *
  8937. * Copyright JS Foundation and other contributors
  8938. * Released under the MIT license
  8939. * https://js.foundation/
  8940. *
  8941. * Date: 2019-04-08
  8942. */
  8943. (function( window ) {
  8944. var i,
  8945. support,
  8946. Expr,
  8947. getText,
  8948. isXML,
  8949. tokenize,
  8950. compile,
  8951. select,
  8952. outermostContext,
  8953. sortInput,
  8954. hasDuplicate,
  8955. // Local document vars
  8956. setDocument,
  8957. document,
  8958. docElem,
  8959. documentIsHTML,
  8960. rbuggyQSA,
  8961. rbuggyMatches,
  8962. matches,
  8963. contains,
  8964. // Instance-specific data
  8965. expando = "sizzle" + 1 * new Date(),
  8966. preferredDoc = window.document,
  8967. dirruns = 0,
  8968. done = 0,
  8969. classCache = createCache(),
  8970. tokenCache = createCache(),
  8971. compilerCache = createCache(),
  8972. nonnativeSelectorCache = createCache(),
  8973. sortOrder = function( a, b ) {
  8974. if ( a === b ) {
  8975. hasDuplicate = true;
  8976. }
  8977. return 0;
  8978. },
  8979. // Instance methods
  8980. hasOwn = ({}).hasOwnProperty,
  8981. arr = [],
  8982. pop = arr.pop,
  8983. push_native = arr.push,
  8984. push = arr.push,
  8985. slice = arr.slice,
  8986. // Use a stripped-down indexOf as it's faster than native
  8987. // https://jsperf.com/thor-indexof-vs-for/5
  8988. indexOf = function( list, elem ) {
  8989. var i = 0,
  8990. len = list.length;
  8991. for ( ; i < len; i++ ) {
  8992. if ( list[i] === elem ) {
  8993. return i;
  8994. }
  8995. }
  8996. return -1;
  8997. },
  8998. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  8999. // Regular expressions
  9000. // http://www.w3.org/TR/css3-selectors/#whitespace
  9001. whitespace = "[\\x20\\t\\r\\n\\f]",
  9002. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  9003. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  9004. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  9005. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  9006. // Operator (capture 2)
  9007. "*([*^$|!~]?=)" + whitespace +
  9008. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  9009. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  9010. "*\\]",
  9011. pseudos = ":(" + identifier + ")(?:\\((" +
  9012. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  9013. // 1. quoted (capture 3; capture 4 or capture 5)
  9014. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  9015. // 2. simple (capture 6)
  9016. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  9017. // 3. anything else (capture 2)
  9018. ".*" +
  9019. ")\\)|)",
  9020. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  9021. rwhitespace = new RegExp( whitespace + "+", "g" ),
  9022. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  9023. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  9024. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  9025. rdescend = new RegExp( whitespace + "|>" ),
  9026. rpseudo = new RegExp( pseudos ),
  9027. ridentifier = new RegExp( "^" + identifier + "$" ),
  9028. matchExpr = {
  9029. "ID": new RegExp( "^#(" + identifier + ")" ),
  9030. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  9031. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  9032. "ATTR": new RegExp( "^" + attributes ),
  9033. "PSEUDO": new RegExp( "^" + pseudos ),
  9034. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  9035. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  9036. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  9037. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  9038. // For use in libraries implementing .is()
  9039. // We use this for POS matching in `select`
  9040. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  9041. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  9042. },
  9043. rhtml = /HTML$/i,
  9044. rinputs = /^(?:input|select|textarea|button)$/i,
  9045. rheader = /^h\d$/i,
  9046. rnative = /^[^{]+\{\s*\[native \w/,
  9047. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  9048. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  9049. rsibling = /[+~]/,
  9050. // CSS escapes
  9051. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  9052. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  9053. funescape = function( _, escaped, escapedWhitespace ) {
  9054. var high = "0x" + escaped - 0x10000;
  9055. // NaN means non-codepoint
  9056. // Support: Firefox<24
  9057. // Workaround erroneous numeric interpretation of +"0x"
  9058. return high !== high || escapedWhitespace ?
  9059. escaped :
  9060. high < 0 ?
  9061. // BMP codepoint
  9062. String.fromCharCode( high + 0x10000 ) :
  9063. // Supplemental Plane codepoint (surrogate pair)
  9064. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  9065. },
  9066. // CSS string/identifier serialization
  9067. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  9068. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  9069. fcssescape = function( ch, asCodePoint ) {
  9070. if ( asCodePoint ) {
  9071. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  9072. if ( ch === "\0" ) {
  9073. return "\uFFFD";
  9074. }
  9075. // Control characters and (dependent upon position) numbers get escaped as code points
  9076. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  9077. }
  9078. // Other potentially-special ASCII characters get backslash-escaped
  9079. return "\\" + ch;
  9080. },
  9081. // Used for iframes
  9082. // See setDocument()
  9083. // Removing the function wrapper causes a "Permission Denied"
  9084. // error in IE
  9085. unloadHandler = function() {
  9086. setDocument();
  9087. },
  9088. inDisabledFieldset = addCombinator(
  9089. function( elem ) {
  9090. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  9091. },
  9092. { dir: "parentNode", next: "legend" }
  9093. );
  9094. // Optimize for push.apply( _, NodeList )
  9095. try {
  9096. push.apply(
  9097. (arr = slice.call( preferredDoc.childNodes )),
  9098. preferredDoc.childNodes
  9099. );
  9100. // Support: Android<4.0
  9101. // Detect silently failing push.apply
  9102. arr[ preferredDoc.childNodes.length ].nodeType;
  9103. } catch ( e ) {
  9104. push = { apply: arr.length ?
  9105. // Leverage slice if possible
  9106. function( target, els ) {
  9107. push_native.apply( target, slice.call(els) );
  9108. } :
  9109. // Support: IE<9
  9110. // Otherwise append directly
  9111. function( target, els ) {
  9112. var j = target.length,
  9113. i = 0;
  9114. // Can't trust NodeList.length
  9115. while ( (target[j++] = els[i++]) ) {}
  9116. target.length = j - 1;
  9117. }
  9118. };
  9119. }
  9120. function Sizzle( selector, context, results, seed ) {
  9121. var m, i, elem, nid, match, groups, newSelector,
  9122. newContext = context && context.ownerDocument,
  9123. // nodeType defaults to 9, since context defaults to document
  9124. nodeType = context ? context.nodeType : 9;
  9125. results = results || [];
  9126. // Return early from calls with invalid selector or context
  9127. if ( typeof selector !== "string" || !selector ||
  9128. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  9129. return results;
  9130. }
  9131. // Try to shortcut find operations (as opposed to filters) in HTML documents
  9132. if ( !seed ) {
  9133. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  9134. setDocument( context );
  9135. }
  9136. context = context || document;
  9137. if ( documentIsHTML ) {
  9138. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  9139. // (excepting DocumentFragment context, where the methods don't exist)
  9140. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  9141. // ID selector
  9142. if ( (m = match[1]) ) {
  9143. // Document context
  9144. if ( nodeType === 9 ) {
  9145. if ( (elem = context.getElementById( m )) ) {
  9146. // Support: IE, Opera, Webkit
  9147. // TODO: identify versions
  9148. // getElementById can match elements by name instead of ID
  9149. if ( elem.id === m ) {
  9150. results.push( elem );
  9151. return results;
  9152. }
  9153. } else {
  9154. return results;
  9155. }
  9156. // Element context
  9157. } else {
  9158. // Support: IE, Opera, Webkit
  9159. // TODO: identify versions
  9160. // getElementById can match elements by name instead of ID
  9161. if ( newContext && (elem = newContext.getElementById( m )) &&
  9162. contains( context, elem ) &&
  9163. elem.id === m ) {
  9164. results.push( elem );
  9165. return results;
  9166. }
  9167. }
  9168. // Type selector
  9169. } else if ( match[2] ) {
  9170. push.apply( results, context.getElementsByTagName( selector ) );
  9171. return results;
  9172. // Class selector
  9173. } else if ( (m = match[3]) && support.getElementsByClassName &&
  9174. context.getElementsByClassName ) {
  9175. push.apply( results, context.getElementsByClassName( m ) );
  9176. return results;
  9177. }
  9178. }
  9179. // Take advantage of querySelectorAll
  9180. if ( support.qsa &&
  9181. !nonnativeSelectorCache[ selector + " " ] &&
  9182. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  9183. // Support: IE 8 only
  9184. // Exclude object elements
  9185. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  9186. newSelector = selector;
  9187. newContext = context;
  9188. // qSA considers elements outside a scoping root when evaluating child or
  9189. // descendant combinators, which is not what we want.
  9190. // In such cases, we work around the behavior by prefixing every selector in the
  9191. // list with an ID selector referencing the scope context.
  9192. // Thanks to Andrew Dupont for this technique.
  9193. if ( nodeType === 1 && rdescend.test( selector ) ) {
  9194. // Capture the context ID, setting it first if necessary
  9195. if ( (nid = context.getAttribute( "id" )) ) {
  9196. nid = nid.replace( rcssescape, fcssescape );
  9197. } else {
  9198. context.setAttribute( "id", (nid = expando) );
  9199. }
  9200. // Prefix every selector in the list
  9201. groups = tokenize( selector );
  9202. i = groups.length;
  9203. while ( i-- ) {
  9204. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  9205. }
  9206. newSelector = groups.join( "," );
  9207. // Expand context for sibling selectors
  9208. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  9209. context;
  9210. }
  9211. try {
  9212. push.apply( results,
  9213. newContext.querySelectorAll( newSelector )
  9214. );
  9215. return results;
  9216. } catch ( qsaError ) {
  9217. nonnativeSelectorCache( selector, true );
  9218. } finally {
  9219. if ( nid === expando ) {
  9220. context.removeAttribute( "id" );
  9221. }
  9222. }
  9223. }
  9224. }
  9225. }
  9226. // All others
  9227. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  9228. }
  9229. /**
  9230. * Create key-value caches of limited size
  9231. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  9232. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  9233. * deleting the oldest entry
  9234. */
  9235. function createCache() {
  9236. var keys = [];
  9237. function cache( key, value ) {
  9238. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  9239. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  9240. // Only keep the most recent entries
  9241. delete cache[ keys.shift() ];
  9242. }
  9243. return (cache[ key + " " ] = value);
  9244. }
  9245. return cache;
  9246. }
  9247. /**
  9248. * Mark a function for special use by Sizzle
  9249. * @param {Function} fn The function to mark
  9250. */
  9251. function markFunction( fn ) {
  9252. fn[ expando ] = true;
  9253. return fn;
  9254. }
  9255. /**
  9256. * Support testing using an element
  9257. * @param {Function} fn Passed the created element and returns a boolean result
  9258. */
  9259. function assert( fn ) {
  9260. var el = document.createElement("fieldset");
  9261. try {
  9262. return !!fn( el );
  9263. } catch (e) {
  9264. return false;
  9265. } finally {
  9266. // Remove from its parent by default
  9267. if ( el.parentNode ) {
  9268. el.parentNode.removeChild( el );
  9269. }
  9270. // release memory in IE
  9271. el = null;
  9272. }
  9273. }
  9274. /**
  9275. * Adds the same handler for all of the specified attrs
  9276. * @param {String} attrs Pipe-separated list of attributes
  9277. * @param {Function} handler The method that will be applied
  9278. */
  9279. function addHandle( attrs, handler ) {
  9280. var arr = attrs.split("|"),
  9281. i = arr.length;
  9282. while ( i-- ) {
  9283. Expr.attrHandle[ arr[i] ] = handler;
  9284. }
  9285. }
  9286. /**
  9287. * Checks document order of two siblings
  9288. * @param {Element} a
  9289. * @param {Element} b
  9290. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  9291. */
  9292. function siblingCheck( a, b ) {
  9293. var cur = b && a,
  9294. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  9295. a.sourceIndex - b.sourceIndex;
  9296. // Use IE sourceIndex if available on both nodes
  9297. if ( diff ) {
  9298. return diff;
  9299. }
  9300. // Check if b follows a
  9301. if ( cur ) {
  9302. while ( (cur = cur.nextSibling) ) {
  9303. if ( cur === b ) {
  9304. return -1;
  9305. }
  9306. }
  9307. }
  9308. return a ? 1 : -1;
  9309. }
  9310. /**
  9311. * Returns a function to use in pseudos for input types
  9312. * @param {String} type
  9313. */
  9314. function createInputPseudo( type ) {
  9315. return function( elem ) {
  9316. var name = elem.nodeName.toLowerCase();
  9317. return name === "input" && elem.type === type;
  9318. };
  9319. }
  9320. /**
  9321. * Returns a function to use in pseudos for buttons
  9322. * @param {String} type
  9323. */
  9324. function createButtonPseudo( type ) {
  9325. return function( elem ) {
  9326. var name = elem.nodeName.toLowerCase();
  9327. return (name === "input" || name === "button") && elem.type === type;
  9328. };
  9329. }
  9330. /**
  9331. * Returns a function to use in pseudos for :enabled/:disabled
  9332. * @param {Boolean} disabled true for :disabled; false for :enabled
  9333. */
  9334. function createDisabledPseudo( disabled ) {
  9335. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  9336. return function( elem ) {
  9337. // Only certain elements can match :enabled or :disabled
  9338. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  9339. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  9340. if ( "form" in elem ) {
  9341. // Check for inherited disabledness on relevant non-disabled elements:
  9342. // * listed form-associated elements in a disabled fieldset
  9343. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  9344. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  9345. // * option elements in a disabled optgroup
  9346. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  9347. // All such elements have a "form" property.
  9348. if ( elem.parentNode && elem.disabled === false ) {
  9349. // Option elements defer to a parent optgroup if present
  9350. if ( "label" in elem ) {
  9351. if ( "label" in elem.parentNode ) {
  9352. return elem.parentNode.disabled === disabled;
  9353. } else {
  9354. return elem.disabled === disabled;
  9355. }
  9356. }
  9357. // Support: IE 6 - 11
  9358. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  9359. return elem.isDisabled === disabled ||
  9360. // Where there is no isDisabled, check manually
  9361. /* jshint -W018 */
  9362. elem.isDisabled !== !disabled &&
  9363. inDisabledFieldset( elem ) === disabled;
  9364. }
  9365. return elem.disabled === disabled;
  9366. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  9367. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  9368. // even exist on them, let alone have a boolean value.
  9369. } else if ( "label" in elem ) {
  9370. return elem.disabled === disabled;
  9371. }
  9372. // Remaining elements are neither :enabled nor :disabled
  9373. return false;
  9374. };
  9375. }
  9376. /**
  9377. * Returns a function to use in pseudos for positionals
  9378. * @param {Function} fn
  9379. */
  9380. function createPositionalPseudo( fn ) {
  9381. return markFunction(function( argument ) {
  9382. argument = +argument;
  9383. return markFunction(function( seed, matches ) {
  9384. var j,
  9385. matchIndexes = fn( [], seed.length, argument ),
  9386. i = matchIndexes.length;
  9387. // Match elements found at the specified indexes
  9388. while ( i-- ) {
  9389. if ( seed[ (j = matchIndexes[i]) ] ) {
  9390. seed[j] = !(matches[j] = seed[j]);
  9391. }
  9392. }
  9393. });
  9394. });
  9395. }
  9396. /**
  9397. * Checks a node for validity as a Sizzle context
  9398. * @param {Element|Object=} context
  9399. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  9400. */
  9401. function testContext( context ) {
  9402. return context && typeof context.getElementsByTagName !== "undefined" && context;
  9403. }
  9404. // Expose support vars for convenience
  9405. support = Sizzle.support = {};
  9406. /**
  9407. * Detects XML nodes
  9408. * @param {Element|Object} elem An element or a document
  9409. * @returns {Boolean} True iff elem is a non-HTML XML node
  9410. */
  9411. isXML = Sizzle.isXML = function( elem ) {
  9412. var namespace = elem.namespaceURI,
  9413. docElem = (elem.ownerDocument || elem).documentElement;
  9414. // Support: IE <=8
  9415. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  9416. // https://bugs.jquery.com/ticket/4833
  9417. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  9418. };
  9419. /**
  9420. * Sets document-related variables once based on the current document
  9421. * @param {Element|Object} [doc] An element or document object to use to set the document
  9422. * @returns {Object} Returns the current document
  9423. */
  9424. setDocument = Sizzle.setDocument = function( node ) {
  9425. var hasCompare, subWindow,
  9426. doc = node ? node.ownerDocument || node : preferredDoc;
  9427. // Return early if doc is invalid or already selected
  9428. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  9429. return document;
  9430. }
  9431. // Update global variables
  9432. document = doc;
  9433. docElem = document.documentElement;
  9434. documentIsHTML = !isXML( document );
  9435. // Support: IE 9-11, Edge
  9436. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  9437. if ( preferredDoc !== document &&
  9438. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  9439. // Support: IE 11, Edge
  9440. if ( subWindow.addEventListener ) {
  9441. subWindow.addEventListener( "unload", unloadHandler, false );
  9442. // Support: IE 9 - 10 only
  9443. } else if ( subWindow.attachEvent ) {
  9444. subWindow.attachEvent( "onunload", unloadHandler );
  9445. }
  9446. }
  9447. /* Attributes
  9448. ---------------------------------------------------------------------- */
  9449. // Support: IE<8
  9450. // Verify that getAttribute really returns attributes and not properties
  9451. // (excepting IE8 booleans)
  9452. support.attributes = assert(function( el ) {
  9453. el.className = "i";
  9454. return !el.getAttribute("className");
  9455. });
  9456. /* getElement(s)By*
  9457. ---------------------------------------------------------------------- */
  9458. // Check if getElementsByTagName("*") returns only elements
  9459. support.getElementsByTagName = assert(function( el ) {
  9460. el.appendChild( document.createComment("") );
  9461. return !el.getElementsByTagName("*").length;
  9462. });
  9463. // Support: IE<9
  9464. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  9465. // Support: IE<10
  9466. // Check if getElementById returns elements by name
  9467. // The broken getElementById methods don't pick up programmatically-set names,
  9468. // so use a roundabout getElementsByName test
  9469. support.getById = assert(function( el ) {
  9470. docElem.appendChild( el ).id = expando;
  9471. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  9472. });
  9473. // ID filter and find
  9474. if ( support.getById ) {
  9475. Expr.filter["ID"] = function( id ) {
  9476. var attrId = id.replace( runescape, funescape );
  9477. return function( elem ) {
  9478. return elem.getAttribute("id") === attrId;
  9479. };
  9480. };
  9481. Expr.find["ID"] = function( id, context ) {
  9482. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9483. var elem = context.getElementById( id );
  9484. return elem ? [ elem ] : [];
  9485. }
  9486. };
  9487. } else {
  9488. Expr.filter["ID"] = function( id ) {
  9489. var attrId = id.replace( runescape, funescape );
  9490. return function( elem ) {
  9491. var node = typeof elem.getAttributeNode !== "undefined" &&
  9492. elem.getAttributeNode("id");
  9493. return node && node.value === attrId;
  9494. };
  9495. };
  9496. // Support: IE 6 - 7 only
  9497. // getElementById is not reliable as a find shortcut
  9498. Expr.find["ID"] = function( id, context ) {
  9499. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9500. var node, i, elems,
  9501. elem = context.getElementById( id );
  9502. if ( elem ) {
  9503. // Verify the id attribute
  9504. node = elem.getAttributeNode("id");
  9505. if ( node && node.value === id ) {
  9506. return [ elem ];
  9507. }
  9508. // Fall back on getElementsByName
  9509. elems = context.getElementsByName( id );
  9510. i = 0;
  9511. while ( (elem = elems[i++]) ) {
  9512. node = elem.getAttributeNode("id");
  9513. if ( node && node.value === id ) {
  9514. return [ elem ];
  9515. }
  9516. }
  9517. }
  9518. return [];
  9519. }
  9520. };
  9521. }
  9522. // Tag
  9523. Expr.find["TAG"] = support.getElementsByTagName ?
  9524. function( tag, context ) {
  9525. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9526. return context.getElementsByTagName( tag );
  9527. // DocumentFragment nodes don't have gEBTN
  9528. } else if ( support.qsa ) {
  9529. return context.querySelectorAll( tag );
  9530. }
  9531. } :
  9532. function( tag, context ) {
  9533. var elem,
  9534. tmp = [],
  9535. i = 0,
  9536. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  9537. results = context.getElementsByTagName( tag );
  9538. // Filter out possible comments
  9539. if ( tag === "*" ) {
  9540. while ( (elem = results[i++]) ) {
  9541. if ( elem.nodeType === 1 ) {
  9542. tmp.push( elem );
  9543. }
  9544. }
  9545. return tmp;
  9546. }
  9547. return results;
  9548. };
  9549. // Class
  9550. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  9551. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  9552. return context.getElementsByClassName( className );
  9553. }
  9554. };
  9555. /* QSA/matchesSelector
  9556. ---------------------------------------------------------------------- */
  9557. // QSA and matchesSelector support
  9558. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  9559. rbuggyMatches = [];
  9560. // qSa(:focus) reports false when true (Chrome 21)
  9561. // We allow this because of a bug in IE8/9 that throws an error
  9562. // whenever `document.activeElement` is accessed on an iframe
  9563. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  9564. // See https://bugs.jquery.com/ticket/13378
  9565. rbuggyQSA = [];
  9566. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  9567. // Build QSA regex
  9568. // Regex strategy adopted from Diego Perini
  9569. assert(function( el ) {
  9570. // Select is set to empty string on purpose
  9571. // This is to test IE's treatment of not explicitly
  9572. // setting a boolean content attribute,
  9573. // since its presence should be enough
  9574. // https://bugs.jquery.com/ticket/12359
  9575. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  9576. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  9577. "<option selected=''></option></select>";
  9578. // Support: IE8, Opera 11-12.16
  9579. // Nothing should be selected when empty strings follow ^= or $= or *=
  9580. // The test attribute must be unknown in Opera but "safe" for WinRT
  9581. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  9582. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  9583. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  9584. }
  9585. // Support: IE8
  9586. // Boolean attributes and "value" are not treated correctly
  9587. if ( !el.querySelectorAll("[selected]").length ) {
  9588. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  9589. }
  9590. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  9591. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  9592. rbuggyQSA.push("~=");
  9593. }
  9594. // Webkit/Opera - :checked should return selected option elements
  9595. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9596. // IE8 throws error here and will not see later tests
  9597. if ( !el.querySelectorAll(":checked").length ) {
  9598. rbuggyQSA.push(":checked");
  9599. }
  9600. // Support: Safari 8+, iOS 8+
  9601. // https://bugs.webkit.org/show_bug.cgi?id=136851
  9602. // In-page `selector#id sibling-combinator selector` fails
  9603. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  9604. rbuggyQSA.push(".#.+[+~]");
  9605. }
  9606. });
  9607. assert(function( el ) {
  9608. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  9609. "<select disabled='disabled'><option/></select>";
  9610. // Support: Windows 8 Native Apps
  9611. // The type and name attributes are restricted during .innerHTML assignment
  9612. var input = document.createElement("input");
  9613. input.setAttribute( "type", "hidden" );
  9614. el.appendChild( input ).setAttribute( "name", "D" );
  9615. // Support: IE8
  9616. // Enforce case-sensitivity of name attribute
  9617. if ( el.querySelectorAll("[name=d]").length ) {
  9618. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  9619. }
  9620. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  9621. // IE8 throws error here and will not see later tests
  9622. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  9623. rbuggyQSA.push( ":enabled", ":disabled" );
  9624. }
  9625. // Support: IE9-11+
  9626. // IE's :disabled selector does not pick up the children of disabled fieldsets
  9627. docElem.appendChild( el ).disabled = true;
  9628. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  9629. rbuggyQSA.push( ":enabled", ":disabled" );
  9630. }
  9631. // Opera 10-11 does not throw on post-comma invalid pseudos
  9632. el.querySelectorAll("*,:x");
  9633. rbuggyQSA.push(",.*:");
  9634. });
  9635. }
  9636. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  9637. docElem.webkitMatchesSelector ||
  9638. docElem.mozMatchesSelector ||
  9639. docElem.oMatchesSelector ||
  9640. docElem.msMatchesSelector) )) ) {
  9641. assert(function( el ) {
  9642. // Check to see if it's possible to do matchesSelector
  9643. // on a disconnected node (IE 9)
  9644. support.disconnectedMatch = matches.call( el, "*" );
  9645. // This should fail with an exception
  9646. // Gecko does not error, returns false instead
  9647. matches.call( el, "[s!='']:x" );
  9648. rbuggyMatches.push( "!=", pseudos );
  9649. });
  9650. }
  9651. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  9652. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  9653. /* Contains
  9654. ---------------------------------------------------------------------- */
  9655. hasCompare = rnative.test( docElem.compareDocumentPosition );
  9656. // Element contains another
  9657. // Purposefully self-exclusive
  9658. // As in, an element does not contain itself
  9659. contains = hasCompare || rnative.test( docElem.contains ) ?
  9660. function( a, b ) {
  9661. var adown = a.nodeType === 9 ? a.documentElement : a,
  9662. bup = b && b.parentNode;
  9663. return a === bup || !!( bup && bup.nodeType === 1 && (
  9664. adown.contains ?
  9665. adown.contains( bup ) :
  9666. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  9667. ));
  9668. } :
  9669. function( a, b ) {
  9670. if ( b ) {
  9671. while ( (b = b.parentNode) ) {
  9672. if ( b === a ) {
  9673. return true;
  9674. }
  9675. }
  9676. }
  9677. return false;
  9678. };
  9679. /* Sorting
  9680. ---------------------------------------------------------------------- */
  9681. // Document order sorting
  9682. sortOrder = hasCompare ?
  9683. function( a, b ) {
  9684. // Flag for duplicate removal
  9685. if ( a === b ) {
  9686. hasDuplicate = true;
  9687. return 0;
  9688. }
  9689. // Sort on method existence if only one input has compareDocumentPosition
  9690. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  9691. if ( compare ) {
  9692. return compare;
  9693. }
  9694. // Calculate position if both inputs belong to the same document
  9695. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  9696. a.compareDocumentPosition( b ) :
  9697. // Otherwise we know they are disconnected
  9698. 1;
  9699. // Disconnected nodes
  9700. if ( compare & 1 ||
  9701. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  9702. // Choose the first element that is related to our preferred document
  9703. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  9704. return -1;
  9705. }
  9706. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  9707. return 1;
  9708. }
  9709. // Maintain original order
  9710. return sortInput ?
  9711. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9712. 0;
  9713. }
  9714. return compare & 4 ? -1 : 1;
  9715. } :
  9716. function( a, b ) {
  9717. // Exit early if the nodes are identical
  9718. if ( a === b ) {
  9719. hasDuplicate = true;
  9720. return 0;
  9721. }
  9722. var cur,
  9723. i = 0,
  9724. aup = a.parentNode,
  9725. bup = b.parentNode,
  9726. ap = [ a ],
  9727. bp = [ b ];
  9728. // Parentless nodes are either documents or disconnected
  9729. if ( !aup || !bup ) {
  9730. return a === document ? -1 :
  9731. b === document ? 1 :
  9732. aup ? -1 :
  9733. bup ? 1 :
  9734. sortInput ?
  9735. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9736. 0;
  9737. // If the nodes are siblings, we can do a quick check
  9738. } else if ( aup === bup ) {
  9739. return siblingCheck( a, b );
  9740. }
  9741. // Otherwise we need full lists of their ancestors for comparison
  9742. cur = a;
  9743. while ( (cur = cur.parentNode) ) {
  9744. ap.unshift( cur );
  9745. }
  9746. cur = b;
  9747. while ( (cur = cur.parentNode) ) {
  9748. bp.unshift( cur );
  9749. }
  9750. // Walk down the tree looking for a discrepancy
  9751. while ( ap[i] === bp[i] ) {
  9752. i++;
  9753. }
  9754. return i ?
  9755. // Do a sibling check if the nodes have a common ancestor
  9756. siblingCheck( ap[i], bp[i] ) :
  9757. // Otherwise nodes in our document sort first
  9758. ap[i] === preferredDoc ? -1 :
  9759. bp[i] === preferredDoc ? 1 :
  9760. 0;
  9761. };
  9762. return document;
  9763. };
  9764. Sizzle.matches = function( expr, elements ) {
  9765. return Sizzle( expr, null, null, elements );
  9766. };
  9767. Sizzle.matchesSelector = function( elem, expr ) {
  9768. // Set document vars if needed
  9769. if ( ( elem.ownerDocument || elem ) !== document ) {
  9770. setDocument( elem );
  9771. }
  9772. if ( support.matchesSelector && documentIsHTML &&
  9773. !nonnativeSelectorCache[ expr + " " ] &&
  9774. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  9775. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  9776. try {
  9777. var ret = matches.call( elem, expr );
  9778. // IE 9's matchesSelector returns false on disconnected nodes
  9779. if ( ret || support.disconnectedMatch ||
  9780. // As well, disconnected nodes are said to be in a document
  9781. // fragment in IE 9
  9782. elem.document && elem.document.nodeType !== 11 ) {
  9783. return ret;
  9784. }
  9785. } catch (e) {
  9786. nonnativeSelectorCache( expr, true );
  9787. }
  9788. }
  9789. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  9790. };
  9791. Sizzle.contains = function( context, elem ) {
  9792. // Set document vars if needed
  9793. if ( ( context.ownerDocument || context ) !== document ) {
  9794. setDocument( context );
  9795. }
  9796. return contains( context, elem );
  9797. };
  9798. Sizzle.attr = function( elem, name ) {
  9799. // Set document vars if needed
  9800. if ( ( elem.ownerDocument || elem ) !== document ) {
  9801. setDocument( elem );
  9802. }
  9803. var fn = Expr.attrHandle[ name.toLowerCase() ],
  9804. // Don't get fooled by Object.prototype properties (jQuery #13807)
  9805. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  9806. fn( elem, name, !documentIsHTML ) :
  9807. undefined;
  9808. return val !== undefined ?
  9809. val :
  9810. support.attributes || !documentIsHTML ?
  9811. elem.getAttribute( name ) :
  9812. (val = elem.getAttributeNode(name)) && val.specified ?
  9813. val.value :
  9814. null;
  9815. };
  9816. Sizzle.escape = function( sel ) {
  9817. return (sel + "").replace( rcssescape, fcssescape );
  9818. };
  9819. Sizzle.error = function( msg ) {
  9820. throw new Error( "Syntax error, unrecognized expression: " + msg );
  9821. };
  9822. /**
  9823. * Document sorting and removing duplicates
  9824. * @param {ArrayLike} results
  9825. */
  9826. Sizzle.uniqueSort = function( results ) {
  9827. var elem,
  9828. duplicates = [],
  9829. j = 0,
  9830. i = 0;
  9831. // Unless we *know* we can detect duplicates, assume their presence
  9832. hasDuplicate = !support.detectDuplicates;
  9833. sortInput = !support.sortStable && results.slice( 0 );
  9834. results.sort( sortOrder );
  9835. if ( hasDuplicate ) {
  9836. while ( (elem = results[i++]) ) {
  9837. if ( elem === results[ i ] ) {
  9838. j = duplicates.push( i );
  9839. }
  9840. }
  9841. while ( j-- ) {
  9842. results.splice( duplicates[ j ], 1 );
  9843. }
  9844. }
  9845. // Clear input after sorting to release objects
  9846. // See https://github.com/jquery/sizzle/pull/225
  9847. sortInput = null;
  9848. return results;
  9849. };
  9850. /**
  9851. * Utility function for retrieving the text value of an array of DOM nodes
  9852. * @param {Array|Element} elem
  9853. */
  9854. getText = Sizzle.getText = function( elem ) {
  9855. var node,
  9856. ret = "",
  9857. i = 0,
  9858. nodeType = elem.nodeType;
  9859. if ( !nodeType ) {
  9860. // If no nodeType, this is expected to be an array
  9861. while ( (node = elem[i++]) ) {
  9862. // Do not traverse comment nodes
  9863. ret += getText( node );
  9864. }
  9865. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  9866. // Use textContent for elements
  9867. // innerText usage removed for consistency of new lines (jQuery #11153)
  9868. if ( typeof elem.textContent === "string" ) {
  9869. return elem.textContent;
  9870. } else {
  9871. // Traverse its children
  9872. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9873. ret += getText( elem );
  9874. }
  9875. }
  9876. } else if ( nodeType === 3 || nodeType === 4 ) {
  9877. return elem.nodeValue;
  9878. }
  9879. // Do not include comment or processing instruction nodes
  9880. return ret;
  9881. };
  9882. Expr = Sizzle.selectors = {
  9883. // Can be adjusted by the user
  9884. cacheLength: 50,
  9885. createPseudo: markFunction,
  9886. match: matchExpr,
  9887. attrHandle: {},
  9888. find: {},
  9889. relative: {
  9890. ">": { dir: "parentNode", first: true },
  9891. " ": { dir: "parentNode" },
  9892. "+": { dir: "previousSibling", first: true },
  9893. "~": { dir: "previousSibling" }
  9894. },
  9895. preFilter: {
  9896. "ATTR": function( match ) {
  9897. match[1] = match[1].replace( runescape, funescape );
  9898. // Move the given value to match[3] whether quoted or unquoted
  9899. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  9900. if ( match[2] === "~=" ) {
  9901. match[3] = " " + match[3] + " ";
  9902. }
  9903. return match.slice( 0, 4 );
  9904. },
  9905. "CHILD": function( match ) {
  9906. /* matches from matchExpr["CHILD"]
  9907. 1 type (only|nth|...)
  9908. 2 what (child|of-type)
  9909. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  9910. 4 xn-component of xn+y argument ([+-]?\d*n|)
  9911. 5 sign of xn-component
  9912. 6 x of xn-component
  9913. 7 sign of y-component
  9914. 8 y of y-component
  9915. */
  9916. match[1] = match[1].toLowerCase();
  9917. if ( match[1].slice( 0, 3 ) === "nth" ) {
  9918. // nth-* requires argument
  9919. if ( !match[3] ) {
  9920. Sizzle.error( match[0] );
  9921. }
  9922. // numeric x and y parameters for Expr.filter.CHILD
  9923. // remember that false/true cast respectively to 0/1
  9924. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  9925. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  9926. // other types prohibit arguments
  9927. } else if ( match[3] ) {
  9928. Sizzle.error( match[0] );
  9929. }
  9930. return match;
  9931. },
  9932. "PSEUDO": function( match ) {
  9933. var excess,
  9934. unquoted = !match[6] && match[2];
  9935. if ( matchExpr["CHILD"].test( match[0] ) ) {
  9936. return null;
  9937. }
  9938. // Accept quoted arguments as-is
  9939. if ( match[3] ) {
  9940. match[2] = match[4] || match[5] || "";
  9941. // Strip excess characters from unquoted arguments
  9942. } else if ( unquoted && rpseudo.test( unquoted ) &&
  9943. // Get excess from tokenize (recursively)
  9944. (excess = tokenize( unquoted, true )) &&
  9945. // advance to the next closing parenthesis
  9946. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  9947. // excess is a negative index
  9948. match[0] = match[0].slice( 0, excess );
  9949. match[2] = unquoted.slice( 0, excess );
  9950. }
  9951. // Return only captures needed by the pseudo filter method (type and argument)
  9952. return match.slice( 0, 3 );
  9953. }
  9954. },
  9955. filter: {
  9956. "TAG": function( nodeNameSelector ) {
  9957. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  9958. return nodeNameSelector === "*" ?
  9959. function() { return true; } :
  9960. function( elem ) {
  9961. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  9962. };
  9963. },
  9964. "CLASS": function( className ) {
  9965. var pattern = classCache[ className + " " ];
  9966. return pattern ||
  9967. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  9968. classCache( className, function( elem ) {
  9969. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  9970. });
  9971. },
  9972. "ATTR": function( name, operator, check ) {
  9973. return function( elem ) {
  9974. var result = Sizzle.attr( elem, name );
  9975. if ( result == null ) {
  9976. return operator === "!=";
  9977. }
  9978. if ( !operator ) {
  9979. return true;
  9980. }
  9981. result += "";
  9982. return operator === "=" ? result === check :
  9983. operator === "!=" ? result !== check :
  9984. operator === "^=" ? check && result.indexOf( check ) === 0 :
  9985. operator === "*=" ? check && result.indexOf( check ) > -1 :
  9986. operator === "$=" ? check && result.slice( -check.length ) === check :
  9987. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  9988. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  9989. false;
  9990. };
  9991. },
  9992. "CHILD": function( type, what, argument, first, last ) {
  9993. var simple = type.slice( 0, 3 ) !== "nth",
  9994. forward = type.slice( -4 ) !== "last",
  9995. ofType = what === "of-type";
  9996. return first === 1 && last === 0 ?
  9997. // Shortcut for :nth-*(n)
  9998. function( elem ) {
  9999. return !!elem.parentNode;
  10000. } :
  10001. function( elem, context, xml ) {
  10002. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  10003. dir = simple !== forward ? "nextSibling" : "previousSibling",
  10004. parent = elem.parentNode,
  10005. name = ofType && elem.nodeName.toLowerCase(),
  10006. useCache = !xml && !ofType,
  10007. diff = false;
  10008. if ( parent ) {
  10009. // :(first|last|only)-(child|of-type)
  10010. if ( simple ) {
  10011. while ( dir ) {
  10012. node = elem;
  10013. while ( (node = node[ dir ]) ) {
  10014. if ( ofType ?
  10015. node.nodeName.toLowerCase() === name :
  10016. node.nodeType === 1 ) {
  10017. return false;
  10018. }
  10019. }
  10020. // Reverse direction for :only-* (if we haven't yet done so)
  10021. start = dir = type === "only" && !start && "nextSibling";
  10022. }
  10023. return true;
  10024. }
  10025. start = [ forward ? parent.firstChild : parent.lastChild ];
  10026. // non-xml :nth-child(...) stores cache data on `parent`
  10027. if ( forward && useCache ) {
  10028. // Seek `elem` from a previously-cached index
  10029. // ...in a gzip-friendly way
  10030. node = parent;
  10031. outerCache = node[ expando ] || (node[ expando ] = {});
  10032. // Support: IE <9 only
  10033. // Defend against cloned attroperties (jQuery gh-1709)
  10034. uniqueCache = outerCache[ node.uniqueID ] ||
  10035. (outerCache[ node.uniqueID ] = {});
  10036. cache = uniqueCache[ type ] || [];
  10037. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10038. diff = nodeIndex && cache[ 2 ];
  10039. node = nodeIndex && parent.childNodes[ nodeIndex ];
  10040. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10041. // Fallback to seeking `elem` from the start
  10042. (diff = nodeIndex = 0) || start.pop()) ) {
  10043. // When found, cache indexes on `parent` and break
  10044. if ( node.nodeType === 1 && ++diff && node === elem ) {
  10045. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  10046. break;
  10047. }
  10048. }
  10049. } else {
  10050. // Use previously-cached element index if available
  10051. if ( useCache ) {
  10052. // ...in a gzip-friendly way
  10053. node = elem;
  10054. outerCache = node[ expando ] || (node[ expando ] = {});
  10055. // Support: IE <9 only
  10056. // Defend against cloned attroperties (jQuery gh-1709)
  10057. uniqueCache = outerCache[ node.uniqueID ] ||
  10058. (outerCache[ node.uniqueID ] = {});
  10059. cache = uniqueCache[ type ] || [];
  10060. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10061. diff = nodeIndex;
  10062. }
  10063. // xml :nth-child(...)
  10064. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  10065. if ( diff === false ) {
  10066. // Use the same loop as above to seek `elem` from the start
  10067. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10068. (diff = nodeIndex = 0) || start.pop()) ) {
  10069. if ( ( ofType ?
  10070. node.nodeName.toLowerCase() === name :
  10071. node.nodeType === 1 ) &&
  10072. ++diff ) {
  10073. // Cache the index of each encountered element
  10074. if ( useCache ) {
  10075. outerCache = node[ expando ] || (node[ expando ] = {});
  10076. // Support: IE <9 only
  10077. // Defend against cloned attroperties (jQuery gh-1709)
  10078. uniqueCache = outerCache[ node.uniqueID ] ||
  10079. (outerCache[ node.uniqueID ] = {});
  10080. uniqueCache[ type ] = [ dirruns, diff ];
  10081. }
  10082. if ( node === elem ) {
  10083. break;
  10084. }
  10085. }
  10086. }
  10087. }
  10088. }
  10089. // Incorporate the offset, then check against cycle size
  10090. diff -= last;
  10091. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  10092. }
  10093. };
  10094. },
  10095. "PSEUDO": function( pseudo, argument ) {
  10096. // pseudo-class names are case-insensitive
  10097. // http://www.w3.org/TR/selectors/#pseudo-classes
  10098. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  10099. // Remember that setFilters inherits from pseudos
  10100. var args,
  10101. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  10102. Sizzle.error( "unsupported pseudo: " + pseudo );
  10103. // The user may use createPseudo to indicate that
  10104. // arguments are needed to create the filter function
  10105. // just as Sizzle does
  10106. if ( fn[ expando ] ) {
  10107. return fn( argument );
  10108. }
  10109. // But maintain support for old signatures
  10110. if ( fn.length > 1 ) {
  10111. args = [ pseudo, pseudo, "", argument ];
  10112. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  10113. markFunction(function( seed, matches ) {
  10114. var idx,
  10115. matched = fn( seed, argument ),
  10116. i = matched.length;
  10117. while ( i-- ) {
  10118. idx = indexOf( seed, matched[i] );
  10119. seed[ idx ] = !( matches[ idx ] = matched[i] );
  10120. }
  10121. }) :
  10122. function( elem ) {
  10123. return fn( elem, 0, args );
  10124. };
  10125. }
  10126. return fn;
  10127. }
  10128. },
  10129. pseudos: {
  10130. // Potentially complex pseudos
  10131. "not": markFunction(function( selector ) {
  10132. // Trim the selector passed to compile
  10133. // to avoid treating leading and trailing
  10134. // spaces as combinators
  10135. var input = [],
  10136. results = [],
  10137. matcher = compile( selector.replace( rtrim, "$1" ) );
  10138. return matcher[ expando ] ?
  10139. markFunction(function( seed, matches, context, xml ) {
  10140. var elem,
  10141. unmatched = matcher( seed, null, xml, [] ),
  10142. i = seed.length;
  10143. // Match elements unmatched by `matcher`
  10144. while ( i-- ) {
  10145. if ( (elem = unmatched[i]) ) {
  10146. seed[i] = !(matches[i] = elem);
  10147. }
  10148. }
  10149. }) :
  10150. function( elem, context, xml ) {
  10151. input[0] = elem;
  10152. matcher( input, null, xml, results );
  10153. // Don't keep the element (issue #299)
  10154. input[0] = null;
  10155. return !results.pop();
  10156. };
  10157. }),
  10158. "has": markFunction(function( selector ) {
  10159. return function( elem ) {
  10160. return Sizzle( selector, elem ).length > 0;
  10161. };
  10162. }),
  10163. "contains": markFunction(function( text ) {
  10164. text = text.replace( runescape, funescape );
  10165. return function( elem ) {
  10166. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  10167. };
  10168. }),
  10169. // "Whether an element is represented by a :lang() selector
  10170. // is based solely on the element's language value
  10171. // being equal to the identifier C,
  10172. // or beginning with the identifier C immediately followed by "-".
  10173. // The matching of C against the element's language value is performed case-insensitively.
  10174. // The identifier C does not have to be a valid language name."
  10175. // http://www.w3.org/TR/selectors/#lang-pseudo
  10176. "lang": markFunction( function( lang ) {
  10177. // lang value must be a valid identifier
  10178. if ( !ridentifier.test(lang || "") ) {
  10179. Sizzle.error( "unsupported lang: " + lang );
  10180. }
  10181. lang = lang.replace( runescape, funescape ).toLowerCase();
  10182. return function( elem ) {
  10183. var elemLang;
  10184. do {
  10185. if ( (elemLang = documentIsHTML ?
  10186. elem.lang :
  10187. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  10188. elemLang = elemLang.toLowerCase();
  10189. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  10190. }
  10191. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  10192. return false;
  10193. };
  10194. }),
  10195. // Miscellaneous
  10196. "target": function( elem ) {
  10197. var hash = window.location && window.location.hash;
  10198. return hash && hash.slice( 1 ) === elem.id;
  10199. },
  10200. "root": function( elem ) {
  10201. return elem === docElem;
  10202. },
  10203. "focus": function( elem ) {
  10204. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  10205. },
  10206. // Boolean properties
  10207. "enabled": createDisabledPseudo( false ),
  10208. "disabled": createDisabledPseudo( true ),
  10209. "checked": function( elem ) {
  10210. // In CSS3, :checked should return both checked and selected elements
  10211. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  10212. var nodeName = elem.nodeName.toLowerCase();
  10213. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  10214. },
  10215. "selected": function( elem ) {
  10216. // Accessing this property makes selected-by-default
  10217. // options in Safari work properly
  10218. if ( elem.parentNode ) {
  10219. elem.parentNode.selectedIndex;
  10220. }
  10221. return elem.selected === true;
  10222. },
  10223. // Contents
  10224. "empty": function( elem ) {
  10225. // http://www.w3.org/TR/selectors/#empty-pseudo
  10226. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  10227. // but not by others (comment: 8; processing instruction: 7; etc.)
  10228. // nodeType < 6 works because attributes (2) do not appear as children
  10229. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10230. if ( elem.nodeType < 6 ) {
  10231. return false;
  10232. }
  10233. }
  10234. return true;
  10235. },
  10236. "parent": function( elem ) {
  10237. return !Expr.pseudos["empty"]( elem );
  10238. },
  10239. // Element/input types
  10240. "header": function( elem ) {
  10241. return rheader.test( elem.nodeName );
  10242. },
  10243. "input": function( elem ) {
  10244. return rinputs.test( elem.nodeName );
  10245. },
  10246. "button": function( elem ) {
  10247. var name = elem.nodeName.toLowerCase();
  10248. return name === "input" && elem.type === "button" || name === "button";
  10249. },
  10250. "text": function( elem ) {
  10251. var attr;
  10252. return elem.nodeName.toLowerCase() === "input" &&
  10253. elem.type === "text" &&
  10254. // Support: IE<8
  10255. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  10256. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  10257. },
  10258. // Position-in-collection
  10259. "first": createPositionalPseudo(function() {
  10260. return [ 0 ];
  10261. }),
  10262. "last": createPositionalPseudo(function( matchIndexes, length ) {
  10263. return [ length - 1 ];
  10264. }),
  10265. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10266. return [ argument < 0 ? argument + length : argument ];
  10267. }),
  10268. "even": createPositionalPseudo(function( matchIndexes, length ) {
  10269. var i = 0;
  10270. for ( ; i < length; i += 2 ) {
  10271. matchIndexes.push( i );
  10272. }
  10273. return matchIndexes;
  10274. }),
  10275. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  10276. var i = 1;
  10277. for ( ; i < length; i += 2 ) {
  10278. matchIndexes.push( i );
  10279. }
  10280. return matchIndexes;
  10281. }),
  10282. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10283. var i = argument < 0 ?
  10284. argument + length :
  10285. argument > length ?
  10286. length :
  10287. argument;
  10288. for ( ; --i >= 0; ) {
  10289. matchIndexes.push( i );
  10290. }
  10291. return matchIndexes;
  10292. }),
  10293. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10294. var i = argument < 0 ? argument + length : argument;
  10295. for ( ; ++i < length; ) {
  10296. matchIndexes.push( i );
  10297. }
  10298. return matchIndexes;
  10299. })
  10300. }
  10301. };
  10302. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  10303. // Add button/input type pseudos
  10304. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  10305. Expr.pseudos[ i ] = createInputPseudo( i );
  10306. }
  10307. for ( i in { submit: true, reset: true } ) {
  10308. Expr.pseudos[ i ] = createButtonPseudo( i );
  10309. }
  10310. // Easy API for creating new setFilters
  10311. function setFilters() {}
  10312. setFilters.prototype = Expr.filters = Expr.pseudos;
  10313. Expr.setFilters = new setFilters();
  10314. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  10315. var matched, match, tokens, type,
  10316. soFar, groups, preFilters,
  10317. cached = tokenCache[ selector + " " ];
  10318. if ( cached ) {
  10319. return parseOnly ? 0 : cached.slice( 0 );
  10320. }
  10321. soFar = selector;
  10322. groups = [];
  10323. preFilters = Expr.preFilter;
  10324. while ( soFar ) {
  10325. // Comma and first run
  10326. if ( !matched || (match = rcomma.exec( soFar )) ) {
  10327. if ( match ) {
  10328. // Don't consume trailing commas as valid
  10329. soFar = soFar.slice( match[0].length ) || soFar;
  10330. }
  10331. groups.push( (tokens = []) );
  10332. }
  10333. matched = false;
  10334. // Combinators
  10335. if ( (match = rcombinators.exec( soFar )) ) {
  10336. matched = match.shift();
  10337. tokens.push({
  10338. value: matched,
  10339. // Cast descendant combinators to space
  10340. type: match[0].replace( rtrim, " " )
  10341. });
  10342. soFar = soFar.slice( matched.length );
  10343. }
  10344. // Filters
  10345. for ( type in Expr.filter ) {
  10346. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  10347. (match = preFilters[ type ]( match ))) ) {
  10348. matched = match.shift();
  10349. tokens.push({
  10350. value: matched,
  10351. type: type,
  10352. matches: match
  10353. });
  10354. soFar = soFar.slice( matched.length );
  10355. }
  10356. }
  10357. if ( !matched ) {
  10358. break;
  10359. }
  10360. }
  10361. // Return the length of the invalid excess
  10362. // if we're just parsing
  10363. // Otherwise, throw an error or return tokens
  10364. return parseOnly ?
  10365. soFar.length :
  10366. soFar ?
  10367. Sizzle.error( selector ) :
  10368. // Cache the tokens
  10369. tokenCache( selector, groups ).slice( 0 );
  10370. };
  10371. function toSelector( tokens ) {
  10372. var i = 0,
  10373. len = tokens.length,
  10374. selector = "";
  10375. for ( ; i < len; i++ ) {
  10376. selector += tokens[i].value;
  10377. }
  10378. return selector;
  10379. }
  10380. function addCombinator( matcher, combinator, base ) {
  10381. var dir = combinator.dir,
  10382. skip = combinator.next,
  10383. key = skip || dir,
  10384. checkNonElements = base && key === "parentNode",
  10385. doneName = done++;
  10386. return combinator.first ?
  10387. // Check against closest ancestor/preceding element
  10388. function( elem, context, xml ) {
  10389. while ( (elem = elem[ dir ]) ) {
  10390. if ( elem.nodeType === 1 || checkNonElements ) {
  10391. return matcher( elem, context, xml );
  10392. }
  10393. }
  10394. return false;
  10395. } :
  10396. // Check against all ancestor/preceding elements
  10397. function( elem, context, xml ) {
  10398. var oldCache, uniqueCache, outerCache,
  10399. newCache = [ dirruns, doneName ];
  10400. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  10401. if ( xml ) {
  10402. while ( (elem = elem[ dir ]) ) {
  10403. if ( elem.nodeType === 1 || checkNonElements ) {
  10404. if ( matcher( elem, context, xml ) ) {
  10405. return true;
  10406. }
  10407. }
  10408. }
  10409. } else {
  10410. while ( (elem = elem[ dir ]) ) {
  10411. if ( elem.nodeType === 1 || checkNonElements ) {
  10412. outerCache = elem[ expando ] || (elem[ expando ] = {});
  10413. // Support: IE <9 only
  10414. // Defend against cloned attroperties (jQuery gh-1709)
  10415. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  10416. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  10417. elem = elem[ dir ] || elem;
  10418. } else if ( (oldCache = uniqueCache[ key ]) &&
  10419. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  10420. // Assign to newCache so results back-propagate to previous elements
  10421. return (newCache[ 2 ] = oldCache[ 2 ]);
  10422. } else {
  10423. // Reuse newcache so results back-propagate to previous elements
  10424. uniqueCache[ key ] = newCache;
  10425. // A match means we're done; a fail means we have to keep checking
  10426. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  10427. return true;
  10428. }
  10429. }
  10430. }
  10431. }
  10432. }
  10433. return false;
  10434. };
  10435. }
  10436. function elementMatcher( matchers ) {
  10437. return matchers.length > 1 ?
  10438. function( elem, context, xml ) {
  10439. var i = matchers.length;
  10440. while ( i-- ) {
  10441. if ( !matchers[i]( elem, context, xml ) ) {
  10442. return false;
  10443. }
  10444. }
  10445. return true;
  10446. } :
  10447. matchers[0];
  10448. }
  10449. function multipleContexts( selector, contexts, results ) {
  10450. var i = 0,
  10451. len = contexts.length;
  10452. for ( ; i < len; i++ ) {
  10453. Sizzle( selector, contexts[i], results );
  10454. }
  10455. return results;
  10456. }
  10457. function condense( unmatched, map, filter, context, xml ) {
  10458. var elem,
  10459. newUnmatched = [],
  10460. i = 0,
  10461. len = unmatched.length,
  10462. mapped = map != null;
  10463. for ( ; i < len; i++ ) {
  10464. if ( (elem = unmatched[i]) ) {
  10465. if ( !filter || filter( elem, context, xml ) ) {
  10466. newUnmatched.push( elem );
  10467. if ( mapped ) {
  10468. map.push( i );
  10469. }
  10470. }
  10471. }
  10472. }
  10473. return newUnmatched;
  10474. }
  10475. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  10476. if ( postFilter && !postFilter[ expando ] ) {
  10477. postFilter = setMatcher( postFilter );
  10478. }
  10479. if ( postFinder && !postFinder[ expando ] ) {
  10480. postFinder = setMatcher( postFinder, postSelector );
  10481. }
  10482. return markFunction(function( seed, results, context, xml ) {
  10483. var temp, i, elem,
  10484. preMap = [],
  10485. postMap = [],
  10486. preexisting = results.length,
  10487. // Get initial elements from seed or context
  10488. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  10489. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  10490. matcherIn = preFilter && ( seed || !selector ) ?
  10491. condense( elems, preMap, preFilter, context, xml ) :
  10492. elems,
  10493. matcherOut = matcher ?
  10494. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  10495. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  10496. // ...intermediate processing is necessary
  10497. [] :
  10498. // ...otherwise use results directly
  10499. results :
  10500. matcherIn;
  10501. // Find primary matches
  10502. if ( matcher ) {
  10503. matcher( matcherIn, matcherOut, context, xml );
  10504. }
  10505. // Apply postFilter
  10506. if ( postFilter ) {
  10507. temp = condense( matcherOut, postMap );
  10508. postFilter( temp, [], context, xml );
  10509. // Un-match failing elements by moving them back to matcherIn
  10510. i = temp.length;
  10511. while ( i-- ) {
  10512. if ( (elem = temp[i]) ) {
  10513. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  10514. }
  10515. }
  10516. }
  10517. if ( seed ) {
  10518. if ( postFinder || preFilter ) {
  10519. if ( postFinder ) {
  10520. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  10521. temp = [];
  10522. i = matcherOut.length;
  10523. while ( i-- ) {
  10524. if ( (elem = matcherOut[i]) ) {
  10525. // Restore matcherIn since elem is not yet a final match
  10526. temp.push( (matcherIn[i] = elem) );
  10527. }
  10528. }
  10529. postFinder( null, (matcherOut = []), temp, xml );
  10530. }
  10531. // Move matched elements from seed to results to keep them synchronized
  10532. i = matcherOut.length;
  10533. while ( i-- ) {
  10534. if ( (elem = matcherOut[i]) &&
  10535. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  10536. seed[temp] = !(results[temp] = elem);
  10537. }
  10538. }
  10539. }
  10540. // Add elements to results, through postFinder if defined
  10541. } else {
  10542. matcherOut = condense(
  10543. matcherOut === results ?
  10544. matcherOut.splice( preexisting, matcherOut.length ) :
  10545. matcherOut
  10546. );
  10547. if ( postFinder ) {
  10548. postFinder( null, results, matcherOut, xml );
  10549. } else {
  10550. push.apply( results, matcherOut );
  10551. }
  10552. }
  10553. });
  10554. }
  10555. function matcherFromTokens( tokens ) {
  10556. var checkContext, matcher, j,
  10557. len = tokens.length,
  10558. leadingRelative = Expr.relative[ tokens[0].type ],
  10559. implicitRelative = leadingRelative || Expr.relative[" "],
  10560. i = leadingRelative ? 1 : 0,
  10561. // The foundational matcher ensures that elements are reachable from top-level context(s)
  10562. matchContext = addCombinator( function( elem ) {
  10563. return elem === checkContext;
  10564. }, implicitRelative, true ),
  10565. matchAnyContext = addCombinator( function( elem ) {
  10566. return indexOf( checkContext, elem ) > -1;
  10567. }, implicitRelative, true ),
  10568. matchers = [ function( elem, context, xml ) {
  10569. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  10570. (checkContext = context).nodeType ?
  10571. matchContext( elem, context, xml ) :
  10572. matchAnyContext( elem, context, xml ) );
  10573. // Avoid hanging onto element (issue #299)
  10574. checkContext = null;
  10575. return ret;
  10576. } ];
  10577. for ( ; i < len; i++ ) {
  10578. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  10579. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  10580. } else {
  10581. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  10582. // Return special upon seeing a positional matcher
  10583. if ( matcher[ expando ] ) {
  10584. // Find the next relative operator (if any) for proper handling
  10585. j = ++i;
  10586. for ( ; j < len; j++ ) {
  10587. if ( Expr.relative[ tokens[j].type ] ) {
  10588. break;
  10589. }
  10590. }
  10591. return setMatcher(
  10592. i > 1 && elementMatcher( matchers ),
  10593. i > 1 && toSelector(
  10594. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  10595. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  10596. ).replace( rtrim, "$1" ),
  10597. matcher,
  10598. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  10599. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  10600. j < len && toSelector( tokens )
  10601. );
  10602. }
  10603. matchers.push( matcher );
  10604. }
  10605. }
  10606. return elementMatcher( matchers );
  10607. }
  10608. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  10609. var bySet = setMatchers.length > 0,
  10610. byElement = elementMatchers.length > 0,
  10611. superMatcher = function( seed, context, xml, results, outermost ) {
  10612. var elem, j, matcher,
  10613. matchedCount = 0,
  10614. i = "0",
  10615. unmatched = seed && [],
  10616. setMatched = [],
  10617. contextBackup = outermostContext,
  10618. // We must always have either seed elements or outermost context
  10619. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  10620. // Use integer dirruns iff this is the outermost matcher
  10621. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  10622. len = elems.length;
  10623. if ( outermost ) {
  10624. outermostContext = context === document || context || outermost;
  10625. }
  10626. // Add elements passing elementMatchers directly to results
  10627. // Support: IE<9, Safari
  10628. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  10629. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  10630. if ( byElement && elem ) {
  10631. j = 0;
  10632. if ( !context && elem.ownerDocument !== document ) {
  10633. setDocument( elem );
  10634. xml = !documentIsHTML;
  10635. }
  10636. while ( (matcher = elementMatchers[j++]) ) {
  10637. if ( matcher( elem, context || document, xml) ) {
  10638. results.push( elem );
  10639. break;
  10640. }
  10641. }
  10642. if ( outermost ) {
  10643. dirruns = dirrunsUnique;
  10644. }
  10645. }
  10646. // Track unmatched elements for set filters
  10647. if ( bySet ) {
  10648. // They will have gone through all possible matchers
  10649. if ( (elem = !matcher && elem) ) {
  10650. matchedCount--;
  10651. }
  10652. // Lengthen the array for every element, matched or not
  10653. if ( seed ) {
  10654. unmatched.push( elem );
  10655. }
  10656. }
  10657. }
  10658. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  10659. // makes the latter nonnegative.
  10660. matchedCount += i;
  10661. // Apply set filters to unmatched elements
  10662. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  10663. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  10664. // no element matchers and no seed.
  10665. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  10666. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  10667. // numerically zero.
  10668. if ( bySet && i !== matchedCount ) {
  10669. j = 0;
  10670. while ( (matcher = setMatchers[j++]) ) {
  10671. matcher( unmatched, setMatched, context, xml );
  10672. }
  10673. if ( seed ) {
  10674. // Reintegrate element matches to eliminate the need for sorting
  10675. if ( matchedCount > 0 ) {
  10676. while ( i-- ) {
  10677. if ( !(unmatched[i] || setMatched[i]) ) {
  10678. setMatched[i] = pop.call( results );
  10679. }
  10680. }
  10681. }
  10682. // Discard index placeholder values to get only actual matches
  10683. setMatched = condense( setMatched );
  10684. }
  10685. // Add matches to results
  10686. push.apply( results, setMatched );
  10687. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  10688. if ( outermost && !seed && setMatched.length > 0 &&
  10689. ( matchedCount + setMatchers.length ) > 1 ) {
  10690. Sizzle.uniqueSort( results );
  10691. }
  10692. }
  10693. // Override manipulation of globals by nested matchers
  10694. if ( outermost ) {
  10695. dirruns = dirrunsUnique;
  10696. outermostContext = contextBackup;
  10697. }
  10698. return unmatched;
  10699. };
  10700. return bySet ?
  10701. markFunction( superMatcher ) :
  10702. superMatcher;
  10703. }
  10704. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  10705. var i,
  10706. setMatchers = [],
  10707. elementMatchers = [],
  10708. cached = compilerCache[ selector + " " ];
  10709. if ( !cached ) {
  10710. // Generate a function of recursive functions that can be used to check each element
  10711. if ( !match ) {
  10712. match = tokenize( selector );
  10713. }
  10714. i = match.length;
  10715. while ( i-- ) {
  10716. cached = matcherFromTokens( match[i] );
  10717. if ( cached[ expando ] ) {
  10718. setMatchers.push( cached );
  10719. } else {
  10720. elementMatchers.push( cached );
  10721. }
  10722. }
  10723. // Cache the compiled function
  10724. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  10725. // Save selector and tokenization
  10726. cached.selector = selector;
  10727. }
  10728. return cached;
  10729. };
  10730. /**
  10731. * A low-level selection function that works with Sizzle's compiled
  10732. * selector functions
  10733. * @param {String|Function} selector A selector or a pre-compiled
  10734. * selector function built with Sizzle.compile
  10735. * @param {Element} context
  10736. * @param {Array} [results]
  10737. * @param {Array} [seed] A set of elements to match against
  10738. */
  10739. select = Sizzle.select = function( selector, context, results, seed ) {
  10740. var i, tokens, token, type, find,
  10741. compiled = typeof selector === "function" && selector,
  10742. match = !seed && tokenize( (selector = compiled.selector || selector) );
  10743. results = results || [];
  10744. // Try to minimize operations if there is only one selector in the list and no seed
  10745. // (the latter of which guarantees us context)
  10746. if ( match.length === 1 ) {
  10747. // Reduce context if the leading compound selector is an ID
  10748. tokens = match[0] = match[0].slice( 0 );
  10749. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  10750. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  10751. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  10752. if ( !context ) {
  10753. return results;
  10754. // Precompiled matchers will still verify ancestry, so step up a level
  10755. } else if ( compiled ) {
  10756. context = context.parentNode;
  10757. }
  10758. selector = selector.slice( tokens.shift().value.length );
  10759. }
  10760. // Fetch a seed set for right-to-left matching
  10761. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  10762. while ( i-- ) {
  10763. token = tokens[i];
  10764. // Abort if we hit a combinator
  10765. if ( Expr.relative[ (type = token.type) ] ) {
  10766. break;
  10767. }
  10768. if ( (find = Expr.find[ type ]) ) {
  10769. // Search, expanding context for leading sibling combinators
  10770. if ( (seed = find(
  10771. token.matches[0].replace( runescape, funescape ),
  10772. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  10773. )) ) {
  10774. // If seed is empty or no tokens remain, we can return early
  10775. tokens.splice( i, 1 );
  10776. selector = seed.length && toSelector( tokens );
  10777. if ( !selector ) {
  10778. push.apply( results, seed );
  10779. return results;
  10780. }
  10781. break;
  10782. }
  10783. }
  10784. }
  10785. }
  10786. // Compile and execute a filtering function if one is not provided
  10787. // Provide `match` to avoid retokenization if we modified the selector above
  10788. ( compiled || compile( selector, match ) )(
  10789. seed,
  10790. context,
  10791. !documentIsHTML,
  10792. results,
  10793. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  10794. );
  10795. return results;
  10796. };
  10797. // One-time assignments
  10798. // Sort stability
  10799. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  10800. // Support: Chrome 14-35+
  10801. // Always assume duplicates if they aren't passed to the comparison function
  10802. support.detectDuplicates = !!hasDuplicate;
  10803. // Initialize against the default document
  10804. setDocument();
  10805. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  10806. // Detached nodes confoundingly follow *each other*
  10807. support.sortDetached = assert(function( el ) {
  10808. // Should return 1, but returns 4 (following)
  10809. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  10810. });
  10811. // Support: IE<8
  10812. // Prevent attribute/property "interpolation"
  10813. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  10814. if ( !assert(function( el ) {
  10815. el.innerHTML = "<a href='#'></a>";
  10816. return el.firstChild.getAttribute("href") === "#" ;
  10817. }) ) {
  10818. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  10819. if ( !isXML ) {
  10820. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  10821. }
  10822. });
  10823. }
  10824. // Support: IE<9
  10825. // Use defaultValue in place of getAttribute("value")
  10826. if ( !support.attributes || !assert(function( el ) {
  10827. el.innerHTML = "<input/>";
  10828. el.firstChild.setAttribute( "value", "" );
  10829. return el.firstChild.getAttribute( "value" ) === "";
  10830. }) ) {
  10831. addHandle( "value", function( elem, name, isXML ) {
  10832. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  10833. return elem.defaultValue;
  10834. }
  10835. });
  10836. }
  10837. // Support: IE<9
  10838. // Use getAttributeNode to fetch booleans when getAttribute lies
  10839. if ( !assert(function( el ) {
  10840. return el.getAttribute("disabled") == null;
  10841. }) ) {
  10842. addHandle( booleans, function( elem, name, isXML ) {
  10843. var val;
  10844. if ( !isXML ) {
  10845. return elem[ name ] === true ? name.toLowerCase() :
  10846. (val = elem.getAttributeNode( name )) && val.specified ?
  10847. val.value :
  10848. null;
  10849. }
  10850. });
  10851. }
  10852. return Sizzle;
  10853. })( window );
  10854. jQuery.find = Sizzle;
  10855. jQuery.expr = Sizzle.selectors;
  10856. // Deprecated
  10857. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  10858. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  10859. jQuery.text = Sizzle.getText;
  10860. jQuery.isXMLDoc = Sizzle.isXML;
  10861. jQuery.contains = Sizzle.contains;
  10862. jQuery.escapeSelector = Sizzle.escape;
  10863. var dir = function( elem, dir, until ) {
  10864. var matched = [],
  10865. truncate = until !== undefined;
  10866. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  10867. if ( elem.nodeType === 1 ) {
  10868. if ( truncate && jQuery( elem ).is( until ) ) {
  10869. break;
  10870. }
  10871. matched.push( elem );
  10872. }
  10873. }
  10874. return matched;
  10875. };
  10876. var siblings = function( n, elem ) {
  10877. var matched = [];
  10878. for ( ; n; n = n.nextSibling ) {
  10879. if ( n.nodeType === 1 && n !== elem ) {
  10880. matched.push( n );
  10881. }
  10882. }
  10883. return matched;
  10884. };
  10885. var rneedsContext = jQuery.expr.match.needsContext;
  10886. function nodeName( elem, name ) {
  10887. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  10888. };
  10889. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  10890. // Implement the identical functionality for filter and not
  10891. function winnow( elements, qualifier, not ) {
  10892. if ( isFunction( qualifier ) ) {
  10893. return jQuery.grep( elements, function( elem, i ) {
  10894. return !!qualifier.call( elem, i, elem ) !== not;
  10895. } );
  10896. }
  10897. // Single element
  10898. if ( qualifier.nodeType ) {
  10899. return jQuery.grep( elements, function( elem ) {
  10900. return ( elem === qualifier ) !== not;
  10901. } );
  10902. }
  10903. // Arraylike of elements (jQuery, arguments, Array)
  10904. if ( typeof qualifier !== "string" ) {
  10905. return jQuery.grep( elements, function( elem ) {
  10906. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  10907. } );
  10908. }
  10909. // Filtered directly for both simple and complex selectors
  10910. return jQuery.filter( qualifier, elements, not );
  10911. }
  10912. jQuery.filter = function( expr, elems, not ) {
  10913. var elem = elems[ 0 ];
  10914. if ( not ) {
  10915. expr = ":not(" + expr + ")";
  10916. }
  10917. if ( elems.length === 1 && elem.nodeType === 1 ) {
  10918. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  10919. }
  10920. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  10921. return elem.nodeType === 1;
  10922. } ) );
  10923. };
  10924. jQuery.fn.extend( {
  10925. find: function( selector ) {
  10926. var i, ret,
  10927. len = this.length,
  10928. self = this;
  10929. if ( typeof selector !== "string" ) {
  10930. return this.pushStack( jQuery( selector ).filter( function() {
  10931. for ( i = 0; i < len; i++ ) {
  10932. if ( jQuery.contains( self[ i ], this ) ) {
  10933. return true;
  10934. }
  10935. }
  10936. } ) );
  10937. }
  10938. ret = this.pushStack( [] );
  10939. for ( i = 0; i < len; i++ ) {
  10940. jQuery.find( selector, self[ i ], ret );
  10941. }
  10942. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  10943. },
  10944. filter: function( selector ) {
  10945. return this.pushStack( winnow( this, selector || [], false ) );
  10946. },
  10947. not: function( selector ) {
  10948. return this.pushStack( winnow( this, selector || [], true ) );
  10949. },
  10950. is: function( selector ) {
  10951. return !!winnow(
  10952. this,
  10953. // If this is a positional/relative selector, check membership in the returned set
  10954. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  10955. typeof selector === "string" && rneedsContext.test( selector ) ?
  10956. jQuery( selector ) :
  10957. selector || [],
  10958. false
  10959. ).length;
  10960. }
  10961. } );
  10962. // Initialize a jQuery object
  10963. // A central reference to the root jQuery(document)
  10964. var rootjQuery,
  10965. // A simple way to check for HTML strings
  10966. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  10967. // Strict HTML recognition (#11290: must start with <)
  10968. // Shortcut simple #id case for speed
  10969. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  10970. init = jQuery.fn.init = function( selector, context, root ) {
  10971. var match, elem;
  10972. // HANDLE: $(""), $(null), $(undefined), $(false)
  10973. if ( !selector ) {
  10974. return this;
  10975. }
  10976. // Method init() accepts an alternate rootjQuery
  10977. // so migrate can support jQuery.sub (gh-2101)
  10978. root = root || rootjQuery;
  10979. // Handle HTML strings
  10980. if ( typeof selector === "string" ) {
  10981. if ( selector[ 0 ] === "<" &&
  10982. selector[ selector.length - 1 ] === ">" &&
  10983. selector.length >= 3 ) {
  10984. // Assume that strings that start and end with <> are HTML and skip the regex check
  10985. match = [ null, selector, null ];
  10986. } else {
  10987. match = rquickExpr.exec( selector );
  10988. }
  10989. // Match html or make sure no context is specified for #id
  10990. if ( match && ( match[ 1 ] || !context ) ) {
  10991. // HANDLE: $(html) -> $(array)
  10992. if ( match[ 1 ] ) {
  10993. context = context instanceof jQuery ? context[ 0 ] : context;
  10994. // Option to run scripts is true for back-compat
  10995. // Intentionally let the error be thrown if parseHTML is not present
  10996. jQuery.merge( this, jQuery.parseHTML(
  10997. match[ 1 ],
  10998. context && context.nodeType ? context.ownerDocument || context : document,
  10999. true
  11000. ) );
  11001. // HANDLE: $(html, props)
  11002. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  11003. for ( match in context ) {
  11004. // Properties of context are called as methods if possible
  11005. if ( isFunction( this[ match ] ) ) {
  11006. this[ match ]( context[ match ] );
  11007. // ...and otherwise set as attributes
  11008. } else {
  11009. this.attr( match, context[ match ] );
  11010. }
  11011. }
  11012. }
  11013. return this;
  11014. // HANDLE: $(#id)
  11015. } else {
  11016. elem = document.getElementById( match[ 2 ] );
  11017. if ( elem ) {
  11018. // Inject the element directly into the jQuery object
  11019. this[ 0 ] = elem;
  11020. this.length = 1;
  11021. }
  11022. return this;
  11023. }
  11024. // HANDLE: $(expr, $(...))
  11025. } else if ( !context || context.jquery ) {
  11026. return ( context || root ).find( selector );
  11027. // HANDLE: $(expr, context)
  11028. // (which is just equivalent to: $(context).find(expr)
  11029. } else {
  11030. return this.constructor( context ).find( selector );
  11031. }
  11032. // HANDLE: $(DOMElement)
  11033. } else if ( selector.nodeType ) {
  11034. this[ 0 ] = selector;
  11035. this.length = 1;
  11036. return this;
  11037. // HANDLE: $(function)
  11038. // Shortcut for document ready
  11039. } else if ( isFunction( selector ) ) {
  11040. return root.ready !== undefined ?
  11041. root.ready( selector ) :
  11042. // Execute immediately if ready is not present
  11043. selector( jQuery );
  11044. }
  11045. return jQuery.makeArray( selector, this );
  11046. };
  11047. // Give the init function the jQuery prototype for later instantiation
  11048. init.prototype = jQuery.fn;
  11049. // Initialize central reference
  11050. rootjQuery = jQuery( document );
  11051. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  11052. // Methods guaranteed to produce a unique set when starting from a unique set
  11053. guaranteedUnique = {
  11054. children: true,
  11055. contents: true,
  11056. next: true,
  11057. prev: true
  11058. };
  11059. jQuery.fn.extend( {
  11060. has: function( target ) {
  11061. var targets = jQuery( target, this ),
  11062. l = targets.length;
  11063. return this.filter( function() {
  11064. var i = 0;
  11065. for ( ; i < l; i++ ) {
  11066. if ( jQuery.contains( this, targets[ i ] ) ) {
  11067. return true;
  11068. }
  11069. }
  11070. } );
  11071. },
  11072. closest: function( selectors, context ) {
  11073. var cur,
  11074. i = 0,
  11075. l = this.length,
  11076. matched = [],
  11077. targets = typeof selectors !== "string" && jQuery( selectors );
  11078. // Positional selectors never match, since there's no _selection_ context
  11079. if ( !rneedsContext.test( selectors ) ) {
  11080. for ( ; i < l; i++ ) {
  11081. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  11082. // Always skip document fragments
  11083. if ( cur.nodeType < 11 && ( targets ?
  11084. targets.index( cur ) > -1 :
  11085. // Don't pass non-elements to Sizzle
  11086. cur.nodeType === 1 &&
  11087. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  11088. matched.push( cur );
  11089. break;
  11090. }
  11091. }
  11092. }
  11093. }
  11094. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  11095. },
  11096. // Determine the position of an element within the set
  11097. index: function( elem ) {
  11098. // No argument, return index in parent
  11099. if ( !elem ) {
  11100. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  11101. }
  11102. // Index in selector
  11103. if ( typeof elem === "string" ) {
  11104. return indexOf.call( jQuery( elem ), this[ 0 ] );
  11105. }
  11106. // Locate the position of the desired element
  11107. return indexOf.call( this,
  11108. // If it receives a jQuery object, the first element is used
  11109. elem.jquery ? elem[ 0 ] : elem
  11110. );
  11111. },
  11112. add: function( selector, context ) {
  11113. return this.pushStack(
  11114. jQuery.uniqueSort(
  11115. jQuery.merge( this.get(), jQuery( selector, context ) )
  11116. )
  11117. );
  11118. },
  11119. addBack: function( selector ) {
  11120. return this.add( selector == null ?
  11121. this.prevObject : this.prevObject.filter( selector )
  11122. );
  11123. }
  11124. } );
  11125. function sibling( cur, dir ) {
  11126. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  11127. return cur;
  11128. }
  11129. jQuery.each( {
  11130. parent: function( elem ) {
  11131. var parent = elem.parentNode;
  11132. return parent && parent.nodeType !== 11 ? parent : null;
  11133. },
  11134. parents: function( elem ) {
  11135. return dir( elem, "parentNode" );
  11136. },
  11137. parentsUntil: function( elem, i, until ) {
  11138. return dir( elem, "parentNode", until );
  11139. },
  11140. next: function( elem ) {
  11141. return sibling( elem, "nextSibling" );
  11142. },
  11143. prev: function( elem ) {
  11144. return sibling( elem, "previousSibling" );
  11145. },
  11146. nextAll: function( elem ) {
  11147. return dir( elem, "nextSibling" );
  11148. },
  11149. prevAll: function( elem ) {
  11150. return dir( elem, "previousSibling" );
  11151. },
  11152. nextUntil: function( elem, i, until ) {
  11153. return dir( elem, "nextSibling", until );
  11154. },
  11155. prevUntil: function( elem, i, until ) {
  11156. return dir( elem, "previousSibling", until );
  11157. },
  11158. siblings: function( elem ) {
  11159. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  11160. },
  11161. children: function( elem ) {
  11162. return siblings( elem.firstChild );
  11163. },
  11164. contents: function( elem ) {
  11165. if ( typeof elem.contentDocument !== "undefined" ) {
  11166. return elem.contentDocument;
  11167. }
  11168. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  11169. // Treat the template element as a regular one in browsers that
  11170. // don't support it.
  11171. if ( nodeName( elem, "template" ) ) {
  11172. elem = elem.content || elem;
  11173. }
  11174. return jQuery.merge( [], elem.childNodes );
  11175. }
  11176. }, function( name, fn ) {
  11177. jQuery.fn[ name ] = function( until, selector ) {
  11178. var matched = jQuery.map( this, fn, until );
  11179. if ( name.slice( -5 ) !== "Until" ) {
  11180. selector = until;
  11181. }
  11182. if ( selector && typeof selector === "string" ) {
  11183. matched = jQuery.filter( selector, matched );
  11184. }
  11185. if ( this.length > 1 ) {
  11186. // Remove duplicates
  11187. if ( !guaranteedUnique[ name ] ) {
  11188. jQuery.uniqueSort( matched );
  11189. }
  11190. // Reverse order for parents* and prev-derivatives
  11191. if ( rparentsprev.test( name ) ) {
  11192. matched.reverse();
  11193. }
  11194. }
  11195. return this.pushStack( matched );
  11196. };
  11197. } );
  11198. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  11199. // Convert String-formatted options into Object-formatted ones
  11200. function createOptions( options ) {
  11201. var object = {};
  11202. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  11203. object[ flag ] = true;
  11204. } );
  11205. return object;
  11206. }
  11207. /*
  11208. * Create a callback list using the following parameters:
  11209. *
  11210. * options: an optional list of space-separated options that will change how
  11211. * the callback list behaves or a more traditional option object
  11212. *
  11213. * By default a callback list will act like an event callback list and can be
  11214. * "fired" multiple times.
  11215. *
  11216. * Possible options:
  11217. *
  11218. * once: will ensure the callback list can only be fired once (like a Deferred)
  11219. *
  11220. * memory: will keep track of previous values and will call any callback added
  11221. * after the list has been fired right away with the latest "memorized"
  11222. * values (like a Deferred)
  11223. *
  11224. * unique: will ensure a callback can only be added once (no duplicate in the list)
  11225. *
  11226. * stopOnFalse: interrupt callings when a callback returns false
  11227. *
  11228. */
  11229. jQuery.Callbacks = function( options ) {
  11230. // Convert options from String-formatted to Object-formatted if needed
  11231. // (we check in cache first)
  11232. options = typeof options === "string" ?
  11233. createOptions( options ) :
  11234. jQuery.extend( {}, options );
  11235. var // Flag to know if list is currently firing
  11236. firing,
  11237. // Last fire value for non-forgettable lists
  11238. memory,
  11239. // Flag to know if list was already fired
  11240. fired,
  11241. // Flag to prevent firing
  11242. locked,
  11243. // Actual callback list
  11244. list = [],
  11245. // Queue of execution data for repeatable lists
  11246. queue = [],
  11247. // Index of currently firing callback (modified by add/remove as needed)
  11248. firingIndex = -1,
  11249. // Fire callbacks
  11250. fire = function() {
  11251. // Enforce single-firing
  11252. locked = locked || options.once;
  11253. // Execute callbacks for all pending executions,
  11254. // respecting firingIndex overrides and runtime changes
  11255. fired = firing = true;
  11256. for ( ; queue.length; firingIndex = -1 ) {
  11257. memory = queue.shift();
  11258. while ( ++firingIndex < list.length ) {
  11259. // Run callback and check for early termination
  11260. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  11261. options.stopOnFalse ) {
  11262. // Jump to end and forget the data so .add doesn't re-fire
  11263. firingIndex = list.length;
  11264. memory = false;
  11265. }
  11266. }
  11267. }
  11268. // Forget the data if we're done with it
  11269. if ( !options.memory ) {
  11270. memory = false;
  11271. }
  11272. firing = false;
  11273. // Clean up if we're done firing for good
  11274. if ( locked ) {
  11275. // Keep an empty list if we have data for future add calls
  11276. if ( memory ) {
  11277. list = [];
  11278. // Otherwise, this object is spent
  11279. } else {
  11280. list = "";
  11281. }
  11282. }
  11283. },
  11284. // Actual Callbacks object
  11285. self = {
  11286. // Add a callback or a collection of callbacks to the list
  11287. add: function() {
  11288. if ( list ) {
  11289. // If we have memory from a past run, we should fire after adding
  11290. if ( memory && !firing ) {
  11291. firingIndex = list.length - 1;
  11292. queue.push( memory );
  11293. }
  11294. ( function add( args ) {
  11295. jQuery.each( args, function( _, arg ) {
  11296. if ( isFunction( arg ) ) {
  11297. if ( !options.unique || !self.has( arg ) ) {
  11298. list.push( arg );
  11299. }
  11300. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  11301. // Inspect recursively
  11302. add( arg );
  11303. }
  11304. } );
  11305. } )( arguments );
  11306. if ( memory && !firing ) {
  11307. fire();
  11308. }
  11309. }
  11310. return this;
  11311. },
  11312. // Remove a callback from the list
  11313. remove: function() {
  11314. jQuery.each( arguments, function( _, arg ) {
  11315. var index;
  11316. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  11317. list.splice( index, 1 );
  11318. // Handle firing indexes
  11319. if ( index <= firingIndex ) {
  11320. firingIndex--;
  11321. }
  11322. }
  11323. } );
  11324. return this;
  11325. },
  11326. // Check if a given callback is in the list.
  11327. // If no argument is given, return whether or not list has callbacks attached.
  11328. has: function( fn ) {
  11329. return fn ?
  11330. jQuery.inArray( fn, list ) > -1 :
  11331. list.length > 0;
  11332. },
  11333. // Remove all callbacks from the list
  11334. empty: function() {
  11335. if ( list ) {
  11336. list = [];
  11337. }
  11338. return this;
  11339. },
  11340. // Disable .fire and .add
  11341. // Abort any current/pending executions
  11342. // Clear all callbacks and values
  11343. disable: function() {
  11344. locked = queue = [];
  11345. list = memory = "";
  11346. return this;
  11347. },
  11348. disabled: function() {
  11349. return !list;
  11350. },
  11351. // Disable .fire
  11352. // Also disable .add unless we have memory (since it would have no effect)
  11353. // Abort any pending executions
  11354. lock: function() {
  11355. locked = queue = [];
  11356. if ( !memory && !firing ) {
  11357. list = memory = "";
  11358. }
  11359. return this;
  11360. },
  11361. locked: function() {
  11362. return !!locked;
  11363. },
  11364. // Call all callbacks with the given context and arguments
  11365. fireWith: function( context, args ) {
  11366. if ( !locked ) {
  11367. args = args || [];
  11368. args = [ context, args.slice ? args.slice() : args ];
  11369. queue.push( args );
  11370. if ( !firing ) {
  11371. fire();
  11372. }
  11373. }
  11374. return this;
  11375. },
  11376. // Call all the callbacks with the given arguments
  11377. fire: function() {
  11378. self.fireWith( this, arguments );
  11379. return this;
  11380. },
  11381. // To know if the callbacks have already been called at least once
  11382. fired: function() {
  11383. return !!fired;
  11384. }
  11385. };
  11386. return self;
  11387. };
  11388. function Identity( v ) {
  11389. return v;
  11390. }
  11391. function Thrower( ex ) {
  11392. throw ex;
  11393. }
  11394. function adoptValue( value, resolve, reject, noValue ) {
  11395. var method;
  11396. try {
  11397. // Check for promise aspect first to privilege synchronous behavior
  11398. if ( value && isFunction( ( method = value.promise ) ) ) {
  11399. method.call( value ).done( resolve ).fail( reject );
  11400. // Other thenables
  11401. } else if ( value && isFunction( ( method = value.then ) ) ) {
  11402. method.call( value, resolve, reject );
  11403. // Other non-thenables
  11404. } else {
  11405. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  11406. // * false: [ value ].slice( 0 ) => resolve( value )
  11407. // * true: [ value ].slice( 1 ) => resolve()
  11408. resolve.apply( undefined, [ value ].slice( noValue ) );
  11409. }
  11410. // For Promises/A+, convert exceptions into rejections
  11411. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  11412. // Deferred#then to conditionally suppress rejection.
  11413. } catch ( value ) {
  11414. // Support: Android 4.0 only
  11415. // Strict mode functions invoked without .call/.apply get global-object context
  11416. reject.apply( undefined, [ value ] );
  11417. }
  11418. }
  11419. jQuery.extend( {
  11420. Deferred: function( func ) {
  11421. var tuples = [
  11422. // action, add listener, callbacks,
  11423. // ... .then handlers, argument index, [final state]
  11424. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  11425. jQuery.Callbacks( "memory" ), 2 ],
  11426. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  11427. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  11428. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  11429. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  11430. ],
  11431. state = "pending",
  11432. promise = {
  11433. state: function() {
  11434. return state;
  11435. },
  11436. always: function() {
  11437. deferred.done( arguments ).fail( arguments );
  11438. return this;
  11439. },
  11440. "catch": function( fn ) {
  11441. return promise.then( null, fn );
  11442. },
  11443. // Keep pipe for back-compat
  11444. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  11445. var fns = arguments;
  11446. return jQuery.Deferred( function( newDefer ) {
  11447. jQuery.each( tuples, function( i, tuple ) {
  11448. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  11449. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  11450. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  11451. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  11452. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  11453. deferred[ tuple[ 1 ] ]( function() {
  11454. var returned = fn && fn.apply( this, arguments );
  11455. if ( returned && isFunction( returned.promise ) ) {
  11456. returned.promise()
  11457. .progress( newDefer.notify )
  11458. .done( newDefer.resolve )
  11459. .fail( newDefer.reject );
  11460. } else {
  11461. newDefer[ tuple[ 0 ] + "With" ](
  11462. this,
  11463. fn ? [ returned ] : arguments
  11464. );
  11465. }
  11466. } );
  11467. } );
  11468. fns = null;
  11469. } ).promise();
  11470. },
  11471. then: function( onFulfilled, onRejected, onProgress ) {
  11472. var maxDepth = 0;
  11473. function resolve( depth, deferred, handler, special ) {
  11474. return function() {
  11475. var that = this,
  11476. args = arguments,
  11477. mightThrow = function() {
  11478. var returned, then;
  11479. // Support: Promises/A+ section 2.3.3.3.3
  11480. // https://promisesaplus.com/#point-59
  11481. // Ignore double-resolution attempts
  11482. if ( depth < maxDepth ) {
  11483. return;
  11484. }
  11485. returned = handler.apply( that, args );
  11486. // Support: Promises/A+ section 2.3.1
  11487. // https://promisesaplus.com/#point-48
  11488. if ( returned === deferred.promise() ) {
  11489. throw new TypeError( "Thenable self-resolution" );
  11490. }
  11491. // Support: Promises/A+ sections 2.3.3.1, 3.5
  11492. // https://promisesaplus.com/#point-54
  11493. // https://promisesaplus.com/#point-75
  11494. // Retrieve `then` only once
  11495. then = returned &&
  11496. // Support: Promises/A+ section 2.3.4
  11497. // https://promisesaplus.com/#point-64
  11498. // Only check objects and functions for thenability
  11499. ( typeof returned === "object" ||
  11500. typeof returned === "function" ) &&
  11501. returned.then;
  11502. // Handle a returned thenable
  11503. if ( isFunction( then ) ) {
  11504. // Special processors (notify) just wait for resolution
  11505. if ( special ) {
  11506. then.call(
  11507. returned,
  11508. resolve( maxDepth, deferred, Identity, special ),
  11509. resolve( maxDepth, deferred, Thrower, special )
  11510. );
  11511. // Normal processors (resolve) also hook into progress
  11512. } else {
  11513. // ...and disregard older resolution values
  11514. maxDepth++;
  11515. then.call(
  11516. returned,
  11517. resolve( maxDepth, deferred, Identity, special ),
  11518. resolve( maxDepth, deferred, Thrower, special ),
  11519. resolve( maxDepth, deferred, Identity,
  11520. deferred.notifyWith )
  11521. );
  11522. }
  11523. // Handle all other returned values
  11524. } else {
  11525. // Only substitute handlers pass on context
  11526. // and multiple values (non-spec behavior)
  11527. if ( handler !== Identity ) {
  11528. that = undefined;
  11529. args = [ returned ];
  11530. }
  11531. // Process the value(s)
  11532. // Default process is resolve
  11533. ( special || deferred.resolveWith )( that, args );
  11534. }
  11535. },
  11536. // Only normal processors (resolve) catch and reject exceptions
  11537. process = special ?
  11538. mightThrow :
  11539. function() {
  11540. try {
  11541. mightThrow();
  11542. } catch ( e ) {
  11543. if ( jQuery.Deferred.exceptionHook ) {
  11544. jQuery.Deferred.exceptionHook( e,
  11545. process.stackTrace );
  11546. }
  11547. // Support: Promises/A+ section 2.3.3.3.4.1
  11548. // https://promisesaplus.com/#point-61
  11549. // Ignore post-resolution exceptions
  11550. if ( depth + 1 >= maxDepth ) {
  11551. // Only substitute handlers pass on context
  11552. // and multiple values (non-spec behavior)
  11553. if ( handler !== Thrower ) {
  11554. that = undefined;
  11555. args = [ e ];
  11556. }
  11557. deferred.rejectWith( that, args );
  11558. }
  11559. }
  11560. };
  11561. // Support: Promises/A+ section 2.3.3.3.1
  11562. // https://promisesaplus.com/#point-57
  11563. // Re-resolve promises immediately to dodge false rejection from
  11564. // subsequent errors
  11565. if ( depth ) {
  11566. process();
  11567. } else {
  11568. // Call an optional hook to record the stack, in case of exception
  11569. // since it's otherwise lost when execution goes async
  11570. if ( jQuery.Deferred.getStackHook ) {
  11571. process.stackTrace = jQuery.Deferred.getStackHook();
  11572. }
  11573. window.setTimeout( process );
  11574. }
  11575. };
  11576. }
  11577. return jQuery.Deferred( function( newDefer ) {
  11578. // progress_handlers.add( ... )
  11579. tuples[ 0 ][ 3 ].add(
  11580. resolve(
  11581. 0,
  11582. newDefer,
  11583. isFunction( onProgress ) ?
  11584. onProgress :
  11585. Identity,
  11586. newDefer.notifyWith
  11587. )
  11588. );
  11589. // fulfilled_handlers.add( ... )
  11590. tuples[ 1 ][ 3 ].add(
  11591. resolve(
  11592. 0,
  11593. newDefer,
  11594. isFunction( onFulfilled ) ?
  11595. onFulfilled :
  11596. Identity
  11597. )
  11598. );
  11599. // rejected_handlers.add( ... )
  11600. tuples[ 2 ][ 3 ].add(
  11601. resolve(
  11602. 0,
  11603. newDefer,
  11604. isFunction( onRejected ) ?
  11605. onRejected :
  11606. Thrower
  11607. )
  11608. );
  11609. } ).promise();
  11610. },
  11611. // Get a promise for this deferred
  11612. // If obj is provided, the promise aspect is added to the object
  11613. promise: function( obj ) {
  11614. return obj != null ? jQuery.extend( obj, promise ) : promise;
  11615. }
  11616. },
  11617. deferred = {};
  11618. // Add list-specific methods
  11619. jQuery.each( tuples, function( i, tuple ) {
  11620. var list = tuple[ 2 ],
  11621. stateString = tuple[ 5 ];
  11622. // promise.progress = list.add
  11623. // promise.done = list.add
  11624. // promise.fail = list.add
  11625. promise[ tuple[ 1 ] ] = list.add;
  11626. // Handle state
  11627. if ( stateString ) {
  11628. list.add(
  11629. function() {
  11630. // state = "resolved" (i.e., fulfilled)
  11631. // state = "rejected"
  11632. state = stateString;
  11633. },
  11634. // rejected_callbacks.disable
  11635. // fulfilled_callbacks.disable
  11636. tuples[ 3 - i ][ 2 ].disable,
  11637. // rejected_handlers.disable
  11638. // fulfilled_handlers.disable
  11639. tuples[ 3 - i ][ 3 ].disable,
  11640. // progress_callbacks.lock
  11641. tuples[ 0 ][ 2 ].lock,
  11642. // progress_handlers.lock
  11643. tuples[ 0 ][ 3 ].lock
  11644. );
  11645. }
  11646. // progress_handlers.fire
  11647. // fulfilled_handlers.fire
  11648. // rejected_handlers.fire
  11649. list.add( tuple[ 3 ].fire );
  11650. // deferred.notify = function() { deferred.notifyWith(...) }
  11651. // deferred.resolve = function() { deferred.resolveWith(...) }
  11652. // deferred.reject = function() { deferred.rejectWith(...) }
  11653. deferred[ tuple[ 0 ] ] = function() {
  11654. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  11655. return this;
  11656. };
  11657. // deferred.notifyWith = list.fireWith
  11658. // deferred.resolveWith = list.fireWith
  11659. // deferred.rejectWith = list.fireWith
  11660. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  11661. } );
  11662. // Make the deferred a promise
  11663. promise.promise( deferred );
  11664. // Call given func if any
  11665. if ( func ) {
  11666. func.call( deferred, deferred );
  11667. }
  11668. // All done!
  11669. return deferred;
  11670. },
  11671. // Deferred helper
  11672. when: function( singleValue ) {
  11673. var
  11674. // count of uncompleted subordinates
  11675. remaining = arguments.length,
  11676. // count of unprocessed arguments
  11677. i = remaining,
  11678. // subordinate fulfillment data
  11679. resolveContexts = Array( i ),
  11680. resolveValues = slice.call( arguments ),
  11681. // the master Deferred
  11682. master = jQuery.Deferred(),
  11683. // subordinate callback factory
  11684. updateFunc = function( i ) {
  11685. return function( value ) {
  11686. resolveContexts[ i ] = this;
  11687. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  11688. if ( !( --remaining ) ) {
  11689. master.resolveWith( resolveContexts, resolveValues );
  11690. }
  11691. };
  11692. };
  11693. // Single- and empty arguments are adopted like Promise.resolve
  11694. if ( remaining <= 1 ) {
  11695. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  11696. !remaining );
  11697. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  11698. if ( master.state() === "pending" ||
  11699. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  11700. return master.then();
  11701. }
  11702. }
  11703. // Multiple arguments are aggregated like Promise.all array elements
  11704. while ( i-- ) {
  11705. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  11706. }
  11707. return master.promise();
  11708. }
  11709. } );
  11710. // These usually indicate a programmer mistake during development,
  11711. // warn about them ASAP rather than swallowing them by default.
  11712. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  11713. jQuery.Deferred.exceptionHook = function( error, stack ) {
  11714. // Support: IE 8 - 9 only
  11715. // Console exists when dev tools are open, which can happen at any time
  11716. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  11717. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  11718. }
  11719. };
  11720. jQuery.readyException = function( error ) {
  11721. window.setTimeout( function() {
  11722. throw error;
  11723. } );
  11724. };
  11725. // The deferred used on DOM ready
  11726. var readyList = jQuery.Deferred();
  11727. jQuery.fn.ready = function( fn ) {
  11728. readyList
  11729. .then( fn )
  11730. // Wrap jQuery.readyException in a function so that the lookup
  11731. // happens at the time of error handling instead of callback
  11732. // registration.
  11733. .catch( function( error ) {
  11734. jQuery.readyException( error );
  11735. } );
  11736. return this;
  11737. };
  11738. jQuery.extend( {
  11739. // Is the DOM ready to be used? Set to true once it occurs.
  11740. isReady: false,
  11741. // A counter to track how many items to wait for before
  11742. // the ready event fires. See #6781
  11743. readyWait: 1,
  11744. // Handle when the DOM is ready
  11745. ready: function( wait ) {
  11746. // Abort if there are pending holds or we're already ready
  11747. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  11748. return;
  11749. }
  11750. // Remember that the DOM is ready
  11751. jQuery.isReady = true;
  11752. // If a normal DOM Ready event fired, decrement, and wait if need be
  11753. if ( wait !== true && --jQuery.readyWait > 0 ) {
  11754. return;
  11755. }
  11756. // If there are functions bound, to execute
  11757. readyList.resolveWith( document, [ jQuery ] );
  11758. }
  11759. } );
  11760. jQuery.ready.then = readyList.then;
  11761. // The ready event handler and self cleanup method
  11762. function completed() {
  11763. document.removeEventListener( "DOMContentLoaded", completed );
  11764. window.removeEventListener( "load", completed );
  11765. jQuery.ready();
  11766. }
  11767. // Catch cases where $(document).ready() is called
  11768. // after the browser event has already occurred.
  11769. // Support: IE <=9 - 10 only
  11770. // Older IE sometimes signals "interactive" too soon
  11771. if ( document.readyState === "complete" ||
  11772. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  11773. // Handle it asynchronously to allow scripts the opportunity to delay ready
  11774. window.setTimeout( jQuery.ready );
  11775. } else {
  11776. // Use the handy event callback
  11777. document.addEventListener( "DOMContentLoaded", completed );
  11778. // A fallback to window.onload, that will always work
  11779. window.addEventListener( "load", completed );
  11780. }
  11781. // Multifunctional method to get and set values of a collection
  11782. // The value/s can optionally be executed if it's a function
  11783. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  11784. var i = 0,
  11785. len = elems.length,
  11786. bulk = key == null;
  11787. // Sets many values
  11788. if ( toType( key ) === "object" ) {
  11789. chainable = true;
  11790. for ( i in key ) {
  11791. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  11792. }
  11793. // Sets one value
  11794. } else if ( value !== undefined ) {
  11795. chainable = true;
  11796. if ( !isFunction( value ) ) {
  11797. raw = true;
  11798. }
  11799. if ( bulk ) {
  11800. // Bulk operations run against the entire set
  11801. if ( raw ) {
  11802. fn.call( elems, value );
  11803. fn = null;
  11804. // ...except when executing function values
  11805. } else {
  11806. bulk = fn;
  11807. fn = function( elem, key, value ) {
  11808. return bulk.call( jQuery( elem ), value );
  11809. };
  11810. }
  11811. }
  11812. if ( fn ) {
  11813. for ( ; i < len; i++ ) {
  11814. fn(
  11815. elems[ i ], key, raw ?
  11816. value :
  11817. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  11818. );
  11819. }
  11820. }
  11821. }
  11822. if ( chainable ) {
  11823. return elems;
  11824. }
  11825. // Gets
  11826. if ( bulk ) {
  11827. return fn.call( elems );
  11828. }
  11829. return len ? fn( elems[ 0 ], key ) : emptyGet;
  11830. };
  11831. // Matches dashed string for camelizing
  11832. var rmsPrefix = /^-ms-/,
  11833. rdashAlpha = /-([a-z])/g;
  11834. // Used by camelCase as callback to replace()
  11835. function fcamelCase( all, letter ) {
  11836. return letter.toUpperCase();
  11837. }
  11838. // Convert dashed to camelCase; used by the css and data modules
  11839. // Support: IE <=9 - 11, Edge 12 - 15
  11840. // Microsoft forgot to hump their vendor prefix (#9572)
  11841. function camelCase( string ) {
  11842. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  11843. }
  11844. var acceptData = function( owner ) {
  11845. // Accepts only:
  11846. // - Node
  11847. // - Node.ELEMENT_NODE
  11848. // - Node.DOCUMENT_NODE
  11849. // - Object
  11850. // - Any
  11851. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  11852. };
  11853. function Data() {
  11854. this.expando = jQuery.expando + Data.uid++;
  11855. }
  11856. Data.uid = 1;
  11857. Data.prototype = {
  11858. cache: function( owner ) {
  11859. // Check if the owner object already has a cache
  11860. var value = owner[ this.expando ];
  11861. // If not, create one
  11862. if ( !value ) {
  11863. value = {};
  11864. // We can accept data for non-element nodes in modern browsers,
  11865. // but we should not, see #8335.
  11866. // Always return an empty object.
  11867. if ( acceptData( owner ) ) {
  11868. // If it is a node unlikely to be stringify-ed or looped over
  11869. // use plain assignment
  11870. if ( owner.nodeType ) {
  11871. owner[ this.expando ] = value;
  11872. // Otherwise secure it in a non-enumerable property
  11873. // configurable must be true to allow the property to be
  11874. // deleted when data is removed
  11875. } else {
  11876. Object.defineProperty( owner, this.expando, {
  11877. value: value,
  11878. configurable: true
  11879. } );
  11880. }
  11881. }
  11882. }
  11883. return value;
  11884. },
  11885. set: function( owner, data, value ) {
  11886. var prop,
  11887. cache = this.cache( owner );
  11888. // Handle: [ owner, key, value ] args
  11889. // Always use camelCase key (gh-2257)
  11890. if ( typeof data === "string" ) {
  11891. cache[ camelCase( data ) ] = value;
  11892. // Handle: [ owner, { properties } ] args
  11893. } else {
  11894. // Copy the properties one-by-one to the cache object
  11895. for ( prop in data ) {
  11896. cache[ camelCase( prop ) ] = data[ prop ];
  11897. }
  11898. }
  11899. return cache;
  11900. },
  11901. get: function( owner, key ) {
  11902. return key === undefined ?
  11903. this.cache( owner ) :
  11904. // Always use camelCase key (gh-2257)
  11905. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  11906. },
  11907. access: function( owner, key, value ) {
  11908. // In cases where either:
  11909. //
  11910. // 1. No key was specified
  11911. // 2. A string key was specified, but no value provided
  11912. //
  11913. // Take the "read" path and allow the get method to determine
  11914. // which value to return, respectively either:
  11915. //
  11916. // 1. The entire cache object
  11917. // 2. The data stored at the key
  11918. //
  11919. if ( key === undefined ||
  11920. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  11921. return this.get( owner, key );
  11922. }
  11923. // When the key is not a string, or both a key and value
  11924. // are specified, set or extend (existing objects) with either:
  11925. //
  11926. // 1. An object of properties
  11927. // 2. A key and value
  11928. //
  11929. this.set( owner, key, value );
  11930. // Since the "set" path can have two possible entry points
  11931. // return the expected data based on which path was taken[*]
  11932. return value !== undefined ? value : key;
  11933. },
  11934. remove: function( owner, key ) {
  11935. var i,
  11936. cache = owner[ this.expando ];
  11937. if ( cache === undefined ) {
  11938. return;
  11939. }
  11940. if ( key !== undefined ) {
  11941. // Support array or space separated string of keys
  11942. if ( Array.isArray( key ) ) {
  11943. // If key is an array of keys...
  11944. // We always set camelCase keys, so remove that.
  11945. key = key.map( camelCase );
  11946. } else {
  11947. key = camelCase( key );
  11948. // If a key with the spaces exists, use it.
  11949. // Otherwise, create an array by matching non-whitespace
  11950. key = key in cache ?
  11951. [ key ] :
  11952. ( key.match( rnothtmlwhite ) || [] );
  11953. }
  11954. i = key.length;
  11955. while ( i-- ) {
  11956. delete cache[ key[ i ] ];
  11957. }
  11958. }
  11959. // Remove the expando if there's no more data
  11960. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  11961. // Support: Chrome <=35 - 45
  11962. // Webkit & Blink performance suffers when deleting properties
  11963. // from DOM nodes, so set to undefined instead
  11964. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  11965. if ( owner.nodeType ) {
  11966. owner[ this.expando ] = undefined;
  11967. } else {
  11968. delete owner[ this.expando ];
  11969. }
  11970. }
  11971. },
  11972. hasData: function( owner ) {
  11973. var cache = owner[ this.expando ];
  11974. return cache !== undefined && !jQuery.isEmptyObject( cache );
  11975. }
  11976. };
  11977. var dataPriv = new Data();
  11978. var dataUser = new Data();
  11979. // Implementation Summary
  11980. //
  11981. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  11982. // 2. Improve the module's maintainability by reducing the storage
  11983. // paths to a single mechanism.
  11984. // 3. Use the same single mechanism to support "private" and "user" data.
  11985. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  11986. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  11987. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  11988. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  11989. rmultiDash = /[A-Z]/g;
  11990. function getData( data ) {
  11991. if ( data === "true" ) {
  11992. return true;
  11993. }
  11994. if ( data === "false" ) {
  11995. return false;
  11996. }
  11997. if ( data === "null" ) {
  11998. return null;
  11999. }
  12000. // Only convert to a number if it doesn't change the string
  12001. if ( data === +data + "" ) {
  12002. return +data;
  12003. }
  12004. if ( rbrace.test( data ) ) {
  12005. return JSON.parse( data );
  12006. }
  12007. return data;
  12008. }
  12009. function dataAttr( elem, key, data ) {
  12010. var name;
  12011. // If nothing was found internally, try to fetch any
  12012. // data from the HTML5 data-* attribute
  12013. if ( data === undefined && elem.nodeType === 1 ) {
  12014. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  12015. data = elem.getAttribute( name );
  12016. if ( typeof data === "string" ) {
  12017. try {
  12018. data = getData( data );
  12019. } catch ( e ) {}
  12020. // Make sure we set the data so it isn't changed later
  12021. dataUser.set( elem, key, data );
  12022. } else {
  12023. data = undefined;
  12024. }
  12025. }
  12026. return data;
  12027. }
  12028. jQuery.extend( {
  12029. hasData: function( elem ) {
  12030. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  12031. },
  12032. data: function( elem, name, data ) {
  12033. return dataUser.access( elem, name, data );
  12034. },
  12035. removeData: function( elem, name ) {
  12036. dataUser.remove( elem, name );
  12037. },
  12038. // TODO: Now that all calls to _data and _removeData have been replaced
  12039. // with direct calls to dataPriv methods, these can be deprecated.
  12040. _data: function( elem, name, data ) {
  12041. return dataPriv.access( elem, name, data );
  12042. },
  12043. _removeData: function( elem, name ) {
  12044. dataPriv.remove( elem, name );
  12045. }
  12046. } );
  12047. jQuery.fn.extend( {
  12048. data: function( key, value ) {
  12049. var i, name, data,
  12050. elem = this[ 0 ],
  12051. attrs = elem && elem.attributes;
  12052. // Gets all values
  12053. if ( key === undefined ) {
  12054. if ( this.length ) {
  12055. data = dataUser.get( elem );
  12056. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  12057. i = attrs.length;
  12058. while ( i-- ) {
  12059. // Support: IE 11 only
  12060. // The attrs elements can be null (#14894)
  12061. if ( attrs[ i ] ) {
  12062. name = attrs[ i ].name;
  12063. if ( name.indexOf( "data-" ) === 0 ) {
  12064. name = camelCase( name.slice( 5 ) );
  12065. dataAttr( elem, name, data[ name ] );
  12066. }
  12067. }
  12068. }
  12069. dataPriv.set( elem, "hasDataAttrs", true );
  12070. }
  12071. }
  12072. return data;
  12073. }
  12074. // Sets multiple values
  12075. if ( typeof key === "object" ) {
  12076. return this.each( function() {
  12077. dataUser.set( this, key );
  12078. } );
  12079. }
  12080. return access( this, function( value ) {
  12081. var data;
  12082. // The calling jQuery object (element matches) is not empty
  12083. // (and therefore has an element appears at this[ 0 ]) and the
  12084. // `value` parameter was not undefined. An empty jQuery object
  12085. // will result in `undefined` for elem = this[ 0 ] which will
  12086. // throw an exception if an attempt to read a data cache is made.
  12087. if ( elem && value === undefined ) {
  12088. // Attempt to get data from the cache
  12089. // The key will always be camelCased in Data
  12090. data = dataUser.get( elem, key );
  12091. if ( data !== undefined ) {
  12092. return data;
  12093. }
  12094. // Attempt to "discover" the data in
  12095. // HTML5 custom data-* attrs
  12096. data = dataAttr( elem, key );
  12097. if ( data !== undefined ) {
  12098. return data;
  12099. }
  12100. // We tried really hard, but the data doesn't exist.
  12101. return;
  12102. }
  12103. // Set the data...
  12104. this.each( function() {
  12105. // We always store the camelCased key
  12106. dataUser.set( this, key, value );
  12107. } );
  12108. }, null, value, arguments.length > 1, null, true );
  12109. },
  12110. removeData: function( key ) {
  12111. return this.each( function() {
  12112. dataUser.remove( this, key );
  12113. } );
  12114. }
  12115. } );
  12116. jQuery.extend( {
  12117. queue: function( elem, type, data ) {
  12118. var queue;
  12119. if ( elem ) {
  12120. type = ( type || "fx" ) + "queue";
  12121. queue = dataPriv.get( elem, type );
  12122. // Speed up dequeue by getting out quickly if this is just a lookup
  12123. if ( data ) {
  12124. if ( !queue || Array.isArray( data ) ) {
  12125. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  12126. } else {
  12127. queue.push( data );
  12128. }
  12129. }
  12130. return queue || [];
  12131. }
  12132. },
  12133. dequeue: function( elem, type ) {
  12134. type = type || "fx";
  12135. var queue = jQuery.queue( elem, type ),
  12136. startLength = queue.length,
  12137. fn = queue.shift(),
  12138. hooks = jQuery._queueHooks( elem, type ),
  12139. next = function() {
  12140. jQuery.dequeue( elem, type );
  12141. };
  12142. // If the fx queue is dequeued, always remove the progress sentinel
  12143. if ( fn === "inprogress" ) {
  12144. fn = queue.shift();
  12145. startLength--;
  12146. }
  12147. if ( fn ) {
  12148. // Add a progress sentinel to prevent the fx queue from being
  12149. // automatically dequeued
  12150. if ( type === "fx" ) {
  12151. queue.unshift( "inprogress" );
  12152. }
  12153. // Clear up the last queue stop function
  12154. delete hooks.stop;
  12155. fn.call( elem, next, hooks );
  12156. }
  12157. if ( !startLength && hooks ) {
  12158. hooks.empty.fire();
  12159. }
  12160. },
  12161. // Not public - generate a queueHooks object, or return the current one
  12162. _queueHooks: function( elem, type ) {
  12163. var key = type + "queueHooks";
  12164. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  12165. empty: jQuery.Callbacks( "once memory" ).add( function() {
  12166. dataPriv.remove( elem, [ type + "queue", key ] );
  12167. } )
  12168. } );
  12169. }
  12170. } );
  12171. jQuery.fn.extend( {
  12172. queue: function( type, data ) {
  12173. var setter = 2;
  12174. if ( typeof type !== "string" ) {
  12175. data = type;
  12176. type = "fx";
  12177. setter--;
  12178. }
  12179. if ( arguments.length < setter ) {
  12180. return jQuery.queue( this[ 0 ], type );
  12181. }
  12182. return data === undefined ?
  12183. this :
  12184. this.each( function() {
  12185. var queue = jQuery.queue( this, type, data );
  12186. // Ensure a hooks for this queue
  12187. jQuery._queueHooks( this, type );
  12188. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  12189. jQuery.dequeue( this, type );
  12190. }
  12191. } );
  12192. },
  12193. dequeue: function( type ) {
  12194. return this.each( function() {
  12195. jQuery.dequeue( this, type );
  12196. } );
  12197. },
  12198. clearQueue: function( type ) {
  12199. return this.queue( type || "fx", [] );
  12200. },
  12201. // Get a promise resolved when queues of a certain type
  12202. // are emptied (fx is the type by default)
  12203. promise: function( type, obj ) {
  12204. var tmp,
  12205. count = 1,
  12206. defer = jQuery.Deferred(),
  12207. elements = this,
  12208. i = this.length,
  12209. resolve = function() {
  12210. if ( !( --count ) ) {
  12211. defer.resolveWith( elements, [ elements ] );
  12212. }
  12213. };
  12214. if ( typeof type !== "string" ) {
  12215. obj = type;
  12216. type = undefined;
  12217. }
  12218. type = type || "fx";
  12219. while ( i-- ) {
  12220. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  12221. if ( tmp && tmp.empty ) {
  12222. count++;
  12223. tmp.empty.add( resolve );
  12224. }
  12225. }
  12226. resolve();
  12227. return defer.promise( obj );
  12228. }
  12229. } );
  12230. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  12231. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  12232. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  12233. var documentElement = document.documentElement;
  12234. var isAttached = function( elem ) {
  12235. return jQuery.contains( elem.ownerDocument, elem );
  12236. },
  12237. composed = { composed: true };
  12238. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  12239. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  12240. // Support: iOS 10.0-10.2 only
  12241. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  12242. // leading to errors. We need to check for `getRootNode`.
  12243. if ( documentElement.getRootNode ) {
  12244. isAttached = function( elem ) {
  12245. return jQuery.contains( elem.ownerDocument, elem ) ||
  12246. elem.getRootNode( composed ) === elem.ownerDocument;
  12247. };
  12248. }
  12249. var isHiddenWithinTree = function( elem, el ) {
  12250. // isHiddenWithinTree might be called from jQuery#filter function;
  12251. // in that case, element will be second argument
  12252. elem = el || elem;
  12253. // Inline style trumps all
  12254. return elem.style.display === "none" ||
  12255. elem.style.display === "" &&
  12256. // Otherwise, check computed style
  12257. // Support: Firefox <=43 - 45
  12258. // Disconnected elements can have computed display: none, so first confirm that elem is
  12259. // in the document.
  12260. isAttached( elem ) &&
  12261. jQuery.css( elem, "display" ) === "none";
  12262. };
  12263. var swap = function( elem, options, callback, args ) {
  12264. var ret, name,
  12265. old = {};
  12266. // Remember the old values, and insert the new ones
  12267. for ( name in options ) {
  12268. old[ name ] = elem.style[ name ];
  12269. elem.style[ name ] = options[ name ];
  12270. }
  12271. ret = callback.apply( elem, args || [] );
  12272. // Revert the old values
  12273. for ( name in options ) {
  12274. elem.style[ name ] = old[ name ];
  12275. }
  12276. return ret;
  12277. };
  12278. function adjustCSS( elem, prop, valueParts, tween ) {
  12279. var adjusted, scale,
  12280. maxIterations = 20,
  12281. currentValue = tween ?
  12282. function() {
  12283. return tween.cur();
  12284. } :
  12285. function() {
  12286. return jQuery.css( elem, prop, "" );
  12287. },
  12288. initial = currentValue(),
  12289. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  12290. // Starting value computation is required for potential unit mismatches
  12291. initialInUnit = elem.nodeType &&
  12292. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  12293. rcssNum.exec( jQuery.css( elem, prop ) );
  12294. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  12295. // Support: Firefox <=54
  12296. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  12297. initial = initial / 2;
  12298. // Trust units reported by jQuery.css
  12299. unit = unit || initialInUnit[ 3 ];
  12300. // Iteratively approximate from a nonzero starting point
  12301. initialInUnit = +initial || 1;
  12302. while ( maxIterations-- ) {
  12303. // Evaluate and update our best guess (doubling guesses that zero out).
  12304. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  12305. jQuery.style( elem, prop, initialInUnit + unit );
  12306. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  12307. maxIterations = 0;
  12308. }
  12309. initialInUnit = initialInUnit / scale;
  12310. }
  12311. initialInUnit = initialInUnit * 2;
  12312. jQuery.style( elem, prop, initialInUnit + unit );
  12313. // Make sure we update the tween properties later on
  12314. valueParts = valueParts || [];
  12315. }
  12316. if ( valueParts ) {
  12317. initialInUnit = +initialInUnit || +initial || 0;
  12318. // Apply relative offset (+=/-=) if specified
  12319. adjusted = valueParts[ 1 ] ?
  12320. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  12321. +valueParts[ 2 ];
  12322. if ( tween ) {
  12323. tween.unit = unit;
  12324. tween.start = initialInUnit;
  12325. tween.end = adjusted;
  12326. }
  12327. }
  12328. return adjusted;
  12329. }
  12330. var defaultDisplayMap = {};
  12331. function getDefaultDisplay( elem ) {
  12332. var temp,
  12333. doc = elem.ownerDocument,
  12334. nodeName = elem.nodeName,
  12335. display = defaultDisplayMap[ nodeName ];
  12336. if ( display ) {
  12337. return display;
  12338. }
  12339. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  12340. display = jQuery.css( temp, "display" );
  12341. temp.parentNode.removeChild( temp );
  12342. if ( display === "none" ) {
  12343. display = "block";
  12344. }
  12345. defaultDisplayMap[ nodeName ] = display;
  12346. return display;
  12347. }
  12348. function showHide( elements, show ) {
  12349. var display, elem,
  12350. values = [],
  12351. index = 0,
  12352. length = elements.length;
  12353. // Determine new display value for elements that need to change
  12354. for ( ; index < length; index++ ) {
  12355. elem = elements[ index ];
  12356. if ( !elem.style ) {
  12357. continue;
  12358. }
  12359. display = elem.style.display;
  12360. if ( show ) {
  12361. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  12362. // check is required in this first loop unless we have a nonempty display value (either
  12363. // inline or about-to-be-restored)
  12364. if ( display === "none" ) {
  12365. values[ index ] = dataPriv.get( elem, "display" ) || null;
  12366. if ( !values[ index ] ) {
  12367. elem.style.display = "";
  12368. }
  12369. }
  12370. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  12371. values[ index ] = getDefaultDisplay( elem );
  12372. }
  12373. } else {
  12374. if ( display !== "none" ) {
  12375. values[ index ] = "none";
  12376. // Remember what we're overwriting
  12377. dataPriv.set( elem, "display", display );
  12378. }
  12379. }
  12380. }
  12381. // Set the display of the elements in a second loop to avoid constant reflow
  12382. for ( index = 0; index < length; index++ ) {
  12383. if ( values[ index ] != null ) {
  12384. elements[ index ].style.display = values[ index ];
  12385. }
  12386. }
  12387. return elements;
  12388. }
  12389. jQuery.fn.extend( {
  12390. show: function() {
  12391. return showHide( this, true );
  12392. },
  12393. hide: function() {
  12394. return showHide( this );
  12395. },
  12396. toggle: function( state ) {
  12397. if ( typeof state === "boolean" ) {
  12398. return state ? this.show() : this.hide();
  12399. }
  12400. return this.each( function() {
  12401. if ( isHiddenWithinTree( this ) ) {
  12402. jQuery( this ).show();
  12403. } else {
  12404. jQuery( this ).hide();
  12405. }
  12406. } );
  12407. }
  12408. } );
  12409. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  12410. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  12411. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  12412. // We have to close these tags to support XHTML (#13200)
  12413. var wrapMap = {
  12414. // Support: IE <=9 only
  12415. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  12416. // XHTML parsers do not magically insert elements in the
  12417. // same way that tag soup parsers do. So we cannot shorten
  12418. // this by omitting <tbody> or other required elements.
  12419. thead: [ 1, "<table>", "</table>" ],
  12420. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  12421. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  12422. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  12423. _default: [ 0, "", "" ]
  12424. };
  12425. // Support: IE <=9 only
  12426. wrapMap.optgroup = wrapMap.option;
  12427. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  12428. wrapMap.th = wrapMap.td;
  12429. function getAll( context, tag ) {
  12430. // Support: IE <=9 - 11 only
  12431. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  12432. var ret;
  12433. if ( typeof context.getElementsByTagName !== "undefined" ) {
  12434. ret = context.getElementsByTagName( tag || "*" );
  12435. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  12436. ret = context.querySelectorAll( tag || "*" );
  12437. } else {
  12438. ret = [];
  12439. }
  12440. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  12441. return jQuery.merge( [ context ], ret );
  12442. }
  12443. return ret;
  12444. }
  12445. // Mark scripts as having already been evaluated
  12446. function setGlobalEval( elems, refElements ) {
  12447. var i = 0,
  12448. l = elems.length;
  12449. for ( ; i < l; i++ ) {
  12450. dataPriv.set(
  12451. elems[ i ],
  12452. "globalEval",
  12453. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  12454. );
  12455. }
  12456. }
  12457. var rhtml = /<|&#?\w+;/;
  12458. function buildFragment( elems, context, scripts, selection, ignored ) {
  12459. var elem, tmp, tag, wrap, attached, j,
  12460. fragment = context.createDocumentFragment(),
  12461. nodes = [],
  12462. i = 0,
  12463. l = elems.length;
  12464. for ( ; i < l; i++ ) {
  12465. elem = elems[ i ];
  12466. if ( elem || elem === 0 ) {
  12467. // Add nodes directly
  12468. if ( toType( elem ) === "object" ) {
  12469. // Support: Android <=4.0 only, PhantomJS 1 only
  12470. // push.apply(_, arraylike) throws on ancient WebKit
  12471. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  12472. // Convert non-html into a text node
  12473. } else if ( !rhtml.test( elem ) ) {
  12474. nodes.push( context.createTextNode( elem ) );
  12475. // Convert html into DOM nodes
  12476. } else {
  12477. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  12478. // Deserialize a standard representation
  12479. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  12480. wrap = wrapMap[ tag ] || wrapMap._default;
  12481. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  12482. // Descend through wrappers to the right content
  12483. j = wrap[ 0 ];
  12484. while ( j-- ) {
  12485. tmp = tmp.lastChild;
  12486. }
  12487. // Support: Android <=4.0 only, PhantomJS 1 only
  12488. // push.apply(_, arraylike) throws on ancient WebKit
  12489. jQuery.merge( nodes, tmp.childNodes );
  12490. // Remember the top-level container
  12491. tmp = fragment.firstChild;
  12492. // Ensure the created nodes are orphaned (#12392)
  12493. tmp.textContent = "";
  12494. }
  12495. }
  12496. }
  12497. // Remove wrapper from fragment
  12498. fragment.textContent = "";
  12499. i = 0;
  12500. while ( ( elem = nodes[ i++ ] ) ) {
  12501. // Skip elements already in the context collection (trac-4087)
  12502. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  12503. if ( ignored ) {
  12504. ignored.push( elem );
  12505. }
  12506. continue;
  12507. }
  12508. attached = isAttached( elem );
  12509. // Append to fragment
  12510. tmp = getAll( fragment.appendChild( elem ), "script" );
  12511. // Preserve script evaluation history
  12512. if ( attached ) {
  12513. setGlobalEval( tmp );
  12514. }
  12515. // Capture executables
  12516. if ( scripts ) {
  12517. j = 0;
  12518. while ( ( elem = tmp[ j++ ] ) ) {
  12519. if ( rscriptType.test( elem.type || "" ) ) {
  12520. scripts.push( elem );
  12521. }
  12522. }
  12523. }
  12524. }
  12525. return fragment;
  12526. }
  12527. ( function() {
  12528. var fragment = document.createDocumentFragment(),
  12529. div = fragment.appendChild( document.createElement( "div" ) ),
  12530. input = document.createElement( "input" );
  12531. // Support: Android 4.0 - 4.3 only
  12532. // Check state lost if the name is set (#11217)
  12533. // Support: Windows Web Apps (WWA)
  12534. // `name` and `type` must use .setAttribute for WWA (#14901)
  12535. input.setAttribute( "type", "radio" );
  12536. input.setAttribute( "checked", "checked" );
  12537. input.setAttribute( "name", "t" );
  12538. div.appendChild( input );
  12539. // Support: Android <=4.1 only
  12540. // Older WebKit doesn't clone checked state correctly in fragments
  12541. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  12542. // Support: IE <=11 only
  12543. // Make sure textarea (and checkbox) defaultValue is properly cloned
  12544. div.innerHTML = "<textarea>x</textarea>";
  12545. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  12546. } )();
  12547. var
  12548. rkeyEvent = /^key/,
  12549. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  12550. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  12551. function returnTrue() {
  12552. return true;
  12553. }
  12554. function returnFalse() {
  12555. return false;
  12556. }
  12557. // Support: IE <=9 - 11+
  12558. // focus() and blur() are asynchronous, except when they are no-op.
  12559. // So expect focus to be synchronous when the element is already active,
  12560. // and blur to be synchronous when the element is not already active.
  12561. // (focus and blur are always synchronous in other supported browsers,
  12562. // this just defines when we can count on it).
  12563. function expectSync( elem, type ) {
  12564. return ( elem === safeActiveElement() ) === ( type === "focus" );
  12565. }
  12566. // Support: IE <=9 only
  12567. // Accessing document.activeElement can throw unexpectedly
  12568. // https://bugs.jquery.com/ticket/13393
  12569. function safeActiveElement() {
  12570. try {
  12571. return document.activeElement;
  12572. } catch ( err ) { }
  12573. }
  12574. function on( elem, types, selector, data, fn, one ) {
  12575. var origFn, type;
  12576. // Types can be a map of types/handlers
  12577. if ( typeof types === "object" ) {
  12578. // ( types-Object, selector, data )
  12579. if ( typeof selector !== "string" ) {
  12580. // ( types-Object, data )
  12581. data = data || selector;
  12582. selector = undefined;
  12583. }
  12584. for ( type in types ) {
  12585. on( elem, type, selector, data, types[ type ], one );
  12586. }
  12587. return elem;
  12588. }
  12589. if ( data == null && fn == null ) {
  12590. // ( types, fn )
  12591. fn = selector;
  12592. data = selector = undefined;
  12593. } else if ( fn == null ) {
  12594. if ( typeof selector === "string" ) {
  12595. // ( types, selector, fn )
  12596. fn = data;
  12597. data = undefined;
  12598. } else {
  12599. // ( types, data, fn )
  12600. fn = data;
  12601. data = selector;
  12602. selector = undefined;
  12603. }
  12604. }
  12605. if ( fn === false ) {
  12606. fn = returnFalse;
  12607. } else if ( !fn ) {
  12608. return elem;
  12609. }
  12610. if ( one === 1 ) {
  12611. origFn = fn;
  12612. fn = function( event ) {
  12613. // Can use an empty set, since event contains the info
  12614. jQuery().off( event );
  12615. return origFn.apply( this, arguments );
  12616. };
  12617. // Use same guid so caller can remove using origFn
  12618. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  12619. }
  12620. return elem.each( function() {
  12621. jQuery.event.add( this, types, fn, data, selector );
  12622. } );
  12623. }
  12624. /*
  12625. * Helper functions for managing events -- not part of the public interface.
  12626. * Props to Dean Edwards' addEvent library for many of the ideas.
  12627. */
  12628. jQuery.event = {
  12629. global: {},
  12630. add: function( elem, types, handler, data, selector ) {
  12631. var handleObjIn, eventHandle, tmp,
  12632. events, t, handleObj,
  12633. special, handlers, type, namespaces, origType,
  12634. elemData = dataPriv.get( elem );
  12635. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  12636. if ( !elemData ) {
  12637. return;
  12638. }
  12639. // Caller can pass in an object of custom data in lieu of the handler
  12640. if ( handler.handler ) {
  12641. handleObjIn = handler;
  12642. handler = handleObjIn.handler;
  12643. selector = handleObjIn.selector;
  12644. }
  12645. // Ensure that invalid selectors throw exceptions at attach time
  12646. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  12647. if ( selector ) {
  12648. jQuery.find.matchesSelector( documentElement, selector );
  12649. }
  12650. // Make sure that the handler has a unique ID, used to find/remove it later
  12651. if ( !handler.guid ) {
  12652. handler.guid = jQuery.guid++;
  12653. }
  12654. // Init the element's event structure and main handler, if this is the first
  12655. if ( !( events = elemData.events ) ) {
  12656. events = elemData.events = {};
  12657. }
  12658. if ( !( eventHandle = elemData.handle ) ) {
  12659. eventHandle = elemData.handle = function( e ) {
  12660. // Discard the second event of a jQuery.event.trigger() and
  12661. // when an event is called after a page has unloaded
  12662. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  12663. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  12664. };
  12665. }
  12666. // Handle multiple events separated by a space
  12667. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12668. t = types.length;
  12669. while ( t-- ) {
  12670. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12671. type = origType = tmp[ 1 ];
  12672. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12673. // There *must* be a type, no attaching namespace-only handlers
  12674. if ( !type ) {
  12675. continue;
  12676. }
  12677. // If event changes its type, use the special event handlers for the changed type
  12678. special = jQuery.event.special[ type ] || {};
  12679. // If selector defined, determine special event api type, otherwise given type
  12680. type = ( selector ? special.delegateType : special.bindType ) || type;
  12681. // Update special based on newly reset type
  12682. special = jQuery.event.special[ type ] || {};
  12683. // handleObj is passed to all event handlers
  12684. handleObj = jQuery.extend( {
  12685. type: type,
  12686. origType: origType,
  12687. data: data,
  12688. handler: handler,
  12689. guid: handler.guid,
  12690. selector: selector,
  12691. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  12692. namespace: namespaces.join( "." )
  12693. }, handleObjIn );
  12694. // Init the event handler queue if we're the first
  12695. if ( !( handlers = events[ type ] ) ) {
  12696. handlers = events[ type ] = [];
  12697. handlers.delegateCount = 0;
  12698. // Only use addEventListener if the special events handler returns false
  12699. if ( !special.setup ||
  12700. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  12701. if ( elem.addEventListener ) {
  12702. elem.addEventListener( type, eventHandle );
  12703. }
  12704. }
  12705. }
  12706. if ( special.add ) {
  12707. special.add.call( elem, handleObj );
  12708. if ( !handleObj.handler.guid ) {
  12709. handleObj.handler.guid = handler.guid;
  12710. }
  12711. }
  12712. // Add to the element's handler list, delegates in front
  12713. if ( selector ) {
  12714. handlers.splice( handlers.delegateCount++, 0, handleObj );
  12715. } else {
  12716. handlers.push( handleObj );
  12717. }
  12718. // Keep track of which events have ever been used, for event optimization
  12719. jQuery.event.global[ type ] = true;
  12720. }
  12721. },
  12722. // Detach an event or set of events from an element
  12723. remove: function( elem, types, handler, selector, mappedTypes ) {
  12724. var j, origCount, tmp,
  12725. events, t, handleObj,
  12726. special, handlers, type, namespaces, origType,
  12727. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  12728. if ( !elemData || !( events = elemData.events ) ) {
  12729. return;
  12730. }
  12731. // Once for each type.namespace in types; type may be omitted
  12732. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12733. t = types.length;
  12734. while ( t-- ) {
  12735. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12736. type = origType = tmp[ 1 ];
  12737. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12738. // Unbind all events (on this namespace, if provided) for the element
  12739. if ( !type ) {
  12740. for ( type in events ) {
  12741. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  12742. }
  12743. continue;
  12744. }
  12745. special = jQuery.event.special[ type ] || {};
  12746. type = ( selector ? special.delegateType : special.bindType ) || type;
  12747. handlers = events[ type ] || [];
  12748. tmp = tmp[ 2 ] &&
  12749. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  12750. // Remove matching events
  12751. origCount = j = handlers.length;
  12752. while ( j-- ) {
  12753. handleObj = handlers[ j ];
  12754. if ( ( mappedTypes || origType === handleObj.origType ) &&
  12755. ( !handler || handler.guid === handleObj.guid ) &&
  12756. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  12757. ( !selector || selector === handleObj.selector ||
  12758. selector === "**" && handleObj.selector ) ) {
  12759. handlers.splice( j, 1 );
  12760. if ( handleObj.selector ) {
  12761. handlers.delegateCount--;
  12762. }
  12763. if ( special.remove ) {
  12764. special.remove.call( elem, handleObj );
  12765. }
  12766. }
  12767. }
  12768. // Remove generic event handler if we removed something and no more handlers exist
  12769. // (avoids potential for endless recursion during removal of special event handlers)
  12770. if ( origCount && !handlers.length ) {
  12771. if ( !special.teardown ||
  12772. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  12773. jQuery.removeEvent( elem, type, elemData.handle );
  12774. }
  12775. delete events[ type ];
  12776. }
  12777. }
  12778. // Remove data and the expando if it's no longer used
  12779. if ( jQuery.isEmptyObject( events ) ) {
  12780. dataPriv.remove( elem, "handle events" );
  12781. }
  12782. },
  12783. dispatch: function( nativeEvent ) {
  12784. // Make a writable jQuery.Event from the native event object
  12785. var event = jQuery.event.fix( nativeEvent );
  12786. var i, j, ret, matched, handleObj, handlerQueue,
  12787. args = new Array( arguments.length ),
  12788. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  12789. special = jQuery.event.special[ event.type ] || {};
  12790. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  12791. args[ 0 ] = event;
  12792. for ( i = 1; i < arguments.length; i++ ) {
  12793. args[ i ] = arguments[ i ];
  12794. }
  12795. event.delegateTarget = this;
  12796. // Call the preDispatch hook for the mapped type, and let it bail if desired
  12797. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  12798. return;
  12799. }
  12800. // Determine handlers
  12801. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  12802. // Run delegates first; they may want to stop propagation beneath us
  12803. i = 0;
  12804. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  12805. event.currentTarget = matched.elem;
  12806. j = 0;
  12807. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  12808. !event.isImmediatePropagationStopped() ) {
  12809. // If the event is namespaced, then each handler is only invoked if it is
  12810. // specially universal or its namespaces are a superset of the event's.
  12811. if ( !event.rnamespace || handleObj.namespace === false ||
  12812. event.rnamespace.test( handleObj.namespace ) ) {
  12813. event.handleObj = handleObj;
  12814. event.data = handleObj.data;
  12815. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  12816. handleObj.handler ).apply( matched.elem, args );
  12817. if ( ret !== undefined ) {
  12818. if ( ( event.result = ret ) === false ) {
  12819. event.preventDefault();
  12820. event.stopPropagation();
  12821. }
  12822. }
  12823. }
  12824. }
  12825. }
  12826. // Call the postDispatch hook for the mapped type
  12827. if ( special.postDispatch ) {
  12828. special.postDispatch.call( this, event );
  12829. }
  12830. return event.result;
  12831. },
  12832. handlers: function( event, handlers ) {
  12833. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  12834. handlerQueue = [],
  12835. delegateCount = handlers.delegateCount,
  12836. cur = event.target;
  12837. // Find delegate handlers
  12838. if ( delegateCount &&
  12839. // Support: IE <=9
  12840. // Black-hole SVG <use> instance trees (trac-13180)
  12841. cur.nodeType &&
  12842. // Support: Firefox <=42
  12843. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  12844. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  12845. // Support: IE 11 only
  12846. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  12847. !( event.type === "click" && event.button >= 1 ) ) {
  12848. for ( ; cur !== this; cur = cur.parentNode || this ) {
  12849. // Don't check non-elements (#13208)
  12850. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  12851. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  12852. matchedHandlers = [];
  12853. matchedSelectors = {};
  12854. for ( i = 0; i < delegateCount; i++ ) {
  12855. handleObj = handlers[ i ];
  12856. // Don't conflict with Object.prototype properties (#13203)
  12857. sel = handleObj.selector + " ";
  12858. if ( matchedSelectors[ sel ] === undefined ) {
  12859. matchedSelectors[ sel ] = handleObj.needsContext ?
  12860. jQuery( sel, this ).index( cur ) > -1 :
  12861. jQuery.find( sel, this, null, [ cur ] ).length;
  12862. }
  12863. if ( matchedSelectors[ sel ] ) {
  12864. matchedHandlers.push( handleObj );
  12865. }
  12866. }
  12867. if ( matchedHandlers.length ) {
  12868. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  12869. }
  12870. }
  12871. }
  12872. }
  12873. // Add the remaining (directly-bound) handlers
  12874. cur = this;
  12875. if ( delegateCount < handlers.length ) {
  12876. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  12877. }
  12878. return handlerQueue;
  12879. },
  12880. addProp: function( name, hook ) {
  12881. Object.defineProperty( jQuery.Event.prototype, name, {
  12882. enumerable: true,
  12883. configurable: true,
  12884. get: isFunction( hook ) ?
  12885. function() {
  12886. if ( this.originalEvent ) {
  12887. return hook( this.originalEvent );
  12888. }
  12889. } :
  12890. function() {
  12891. if ( this.originalEvent ) {
  12892. return this.originalEvent[ name ];
  12893. }
  12894. },
  12895. set: function( value ) {
  12896. Object.defineProperty( this, name, {
  12897. enumerable: true,
  12898. configurable: true,
  12899. writable: true,
  12900. value: value
  12901. } );
  12902. }
  12903. } );
  12904. },
  12905. fix: function( originalEvent ) {
  12906. return originalEvent[ jQuery.expando ] ?
  12907. originalEvent :
  12908. new jQuery.Event( originalEvent );
  12909. },
  12910. special: {
  12911. load: {
  12912. // Prevent triggered image.load events from bubbling to window.load
  12913. noBubble: true
  12914. },
  12915. click: {
  12916. // Utilize native event to ensure correct state for checkable inputs
  12917. setup: function( data ) {
  12918. // For mutual compressibility with _default, replace `this` access with a local var.
  12919. // `|| data` is dead code meant only to preserve the variable through minification.
  12920. var el = this || data;
  12921. // Claim the first handler
  12922. if ( rcheckableType.test( el.type ) &&
  12923. el.click && nodeName( el, "input" ) ) {
  12924. // dataPriv.set( el, "click", ... )
  12925. leverageNative( el, "click", returnTrue );
  12926. }
  12927. // Return false to allow normal processing in the caller
  12928. return false;
  12929. },
  12930. trigger: function( data ) {
  12931. // For mutual compressibility with _default, replace `this` access with a local var.
  12932. // `|| data` is dead code meant only to preserve the variable through minification.
  12933. var el = this || data;
  12934. // Force setup before triggering a click
  12935. if ( rcheckableType.test( el.type ) &&
  12936. el.click && nodeName( el, "input" ) ) {
  12937. leverageNative( el, "click" );
  12938. }
  12939. // Return non-false to allow normal event-path propagation
  12940. return true;
  12941. },
  12942. // For cross-browser consistency, suppress native .click() on links
  12943. // Also prevent it if we're currently inside a leveraged native-event stack
  12944. _default: function( event ) {
  12945. var target = event.target;
  12946. return rcheckableType.test( target.type ) &&
  12947. target.click && nodeName( target, "input" ) &&
  12948. dataPriv.get( target, "click" ) ||
  12949. nodeName( target, "a" );
  12950. }
  12951. },
  12952. beforeunload: {
  12953. postDispatch: function( event ) {
  12954. // Support: Firefox 20+
  12955. // Firefox doesn't alert if the returnValue field is not set.
  12956. if ( event.result !== undefined && event.originalEvent ) {
  12957. event.originalEvent.returnValue = event.result;
  12958. }
  12959. }
  12960. }
  12961. }
  12962. };
  12963. // Ensure the presence of an event listener that handles manually-triggered
  12964. // synthetic events by interrupting progress until reinvoked in response to
  12965. // *native* events that it fires directly, ensuring that state changes have
  12966. // already occurred before other listeners are invoked.
  12967. function leverageNative( el, type, expectSync ) {
  12968. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  12969. if ( !expectSync ) {
  12970. if ( dataPriv.get( el, type ) === undefined ) {
  12971. jQuery.event.add( el, type, returnTrue );
  12972. }
  12973. return;
  12974. }
  12975. // Register the controller as a special universal handler for all event namespaces
  12976. dataPriv.set( el, type, false );
  12977. jQuery.event.add( el, type, {
  12978. namespace: false,
  12979. handler: function( event ) {
  12980. var notAsync, result,
  12981. saved = dataPriv.get( this, type );
  12982. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  12983. // Interrupt processing of the outer synthetic .trigger()ed event
  12984. // Saved data should be false in such cases, but might be a leftover capture object
  12985. // from an async native handler (gh-4350)
  12986. if ( !saved.length ) {
  12987. // Store arguments for use when handling the inner native event
  12988. // There will always be at least one argument (an event object), so this array
  12989. // will not be confused with a leftover capture object.
  12990. saved = slice.call( arguments );
  12991. dataPriv.set( this, type, saved );
  12992. // Trigger the native event and capture its result
  12993. // Support: IE <=9 - 11+
  12994. // focus() and blur() are asynchronous
  12995. notAsync = expectSync( this, type );
  12996. this[ type ]();
  12997. result = dataPriv.get( this, type );
  12998. if ( saved !== result || notAsync ) {
  12999. dataPriv.set( this, type, false );
  13000. } else {
  13001. result = {};
  13002. }
  13003. if ( saved !== result ) {
  13004. // Cancel the outer synthetic event
  13005. event.stopImmediatePropagation();
  13006. event.preventDefault();
  13007. return result.value;
  13008. }
  13009. // If this is an inner synthetic event for an event with a bubbling surrogate
  13010. // (focus or blur), assume that the surrogate already propagated from triggering the
  13011. // native event and prevent that from happening again here.
  13012. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  13013. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  13014. // less bad than duplication.
  13015. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  13016. event.stopPropagation();
  13017. }
  13018. // If this is a native event triggered above, everything is now in order
  13019. // Fire an inner synthetic event with the original arguments
  13020. } else if ( saved.length ) {
  13021. // ...and capture the result
  13022. dataPriv.set( this, type, {
  13023. value: jQuery.event.trigger(
  13024. // Support: IE <=9 - 11+
  13025. // Extend with the prototype to reset the above stopImmediatePropagation()
  13026. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  13027. saved.slice( 1 ),
  13028. this
  13029. )
  13030. } );
  13031. // Abort handling of the native event
  13032. event.stopImmediatePropagation();
  13033. }
  13034. }
  13035. } );
  13036. }
  13037. jQuery.removeEvent = function( elem, type, handle ) {
  13038. // This "if" is needed for plain objects
  13039. if ( elem.removeEventListener ) {
  13040. elem.removeEventListener( type, handle );
  13041. }
  13042. };
  13043. jQuery.Event = function( src, props ) {
  13044. // Allow instantiation without the 'new' keyword
  13045. if ( !( this instanceof jQuery.Event ) ) {
  13046. return new jQuery.Event( src, props );
  13047. }
  13048. // Event object
  13049. if ( src && src.type ) {
  13050. this.originalEvent = src;
  13051. this.type = src.type;
  13052. // Events bubbling up the document may have been marked as prevented
  13053. // by a handler lower down the tree; reflect the correct value.
  13054. this.isDefaultPrevented = src.defaultPrevented ||
  13055. src.defaultPrevented === undefined &&
  13056. // Support: Android <=2.3 only
  13057. src.returnValue === false ?
  13058. returnTrue :
  13059. returnFalse;
  13060. // Create target properties
  13061. // Support: Safari <=6 - 7 only
  13062. // Target should not be a text node (#504, #13143)
  13063. this.target = ( src.target && src.target.nodeType === 3 ) ?
  13064. src.target.parentNode :
  13065. src.target;
  13066. this.currentTarget = src.currentTarget;
  13067. this.relatedTarget = src.relatedTarget;
  13068. // Event type
  13069. } else {
  13070. this.type = src;
  13071. }
  13072. // Put explicitly provided properties onto the event object
  13073. if ( props ) {
  13074. jQuery.extend( this, props );
  13075. }
  13076. // Create a timestamp if incoming event doesn't have one
  13077. this.timeStamp = src && src.timeStamp || Date.now();
  13078. // Mark it as fixed
  13079. this[ jQuery.expando ] = true;
  13080. };
  13081. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  13082. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  13083. jQuery.Event.prototype = {
  13084. constructor: jQuery.Event,
  13085. isDefaultPrevented: returnFalse,
  13086. isPropagationStopped: returnFalse,
  13087. isImmediatePropagationStopped: returnFalse,
  13088. isSimulated: false,
  13089. preventDefault: function() {
  13090. var e = this.originalEvent;
  13091. this.isDefaultPrevented = returnTrue;
  13092. if ( e && !this.isSimulated ) {
  13093. e.preventDefault();
  13094. }
  13095. },
  13096. stopPropagation: function() {
  13097. var e = this.originalEvent;
  13098. this.isPropagationStopped = returnTrue;
  13099. if ( e && !this.isSimulated ) {
  13100. e.stopPropagation();
  13101. }
  13102. },
  13103. stopImmediatePropagation: function() {
  13104. var e = this.originalEvent;
  13105. this.isImmediatePropagationStopped = returnTrue;
  13106. if ( e && !this.isSimulated ) {
  13107. e.stopImmediatePropagation();
  13108. }
  13109. this.stopPropagation();
  13110. }
  13111. };
  13112. // Includes all common event props including KeyEvent and MouseEvent specific props
  13113. jQuery.each( {
  13114. altKey: true,
  13115. bubbles: true,
  13116. cancelable: true,
  13117. changedTouches: true,
  13118. ctrlKey: true,
  13119. detail: true,
  13120. eventPhase: true,
  13121. metaKey: true,
  13122. pageX: true,
  13123. pageY: true,
  13124. shiftKey: true,
  13125. view: true,
  13126. "char": true,
  13127. code: true,
  13128. charCode: true,
  13129. key: true,
  13130. keyCode: true,
  13131. button: true,
  13132. buttons: true,
  13133. clientX: true,
  13134. clientY: true,
  13135. offsetX: true,
  13136. offsetY: true,
  13137. pointerId: true,
  13138. pointerType: true,
  13139. screenX: true,
  13140. screenY: true,
  13141. targetTouches: true,
  13142. toElement: true,
  13143. touches: true,
  13144. which: function( event ) {
  13145. var button = event.button;
  13146. // Add which for key events
  13147. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  13148. return event.charCode != null ? event.charCode : event.keyCode;
  13149. }
  13150. // Add which for click: 1 === left; 2 === middle; 3 === right
  13151. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  13152. if ( button & 1 ) {
  13153. return 1;
  13154. }
  13155. if ( button & 2 ) {
  13156. return 3;
  13157. }
  13158. if ( button & 4 ) {
  13159. return 2;
  13160. }
  13161. return 0;
  13162. }
  13163. return event.which;
  13164. }
  13165. }, jQuery.event.addProp );
  13166. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  13167. jQuery.event.special[ type ] = {
  13168. // Utilize native event if possible so blur/focus sequence is correct
  13169. setup: function() {
  13170. // Claim the first handler
  13171. // dataPriv.set( this, "focus", ... )
  13172. // dataPriv.set( this, "blur", ... )
  13173. leverageNative( this, type, expectSync );
  13174. // Return false to allow normal processing in the caller
  13175. return false;
  13176. },
  13177. trigger: function() {
  13178. // Force setup before trigger
  13179. leverageNative( this, type );
  13180. // Return non-false to allow normal event-path propagation
  13181. return true;
  13182. },
  13183. delegateType: delegateType
  13184. };
  13185. } );
  13186. // Create mouseenter/leave events using mouseover/out and event-time checks
  13187. // so that event delegation works in jQuery.
  13188. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  13189. //
  13190. // Support: Safari 7 only
  13191. // Safari sends mouseenter too often; see:
  13192. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  13193. // for the description of the bug (it existed in older Chrome versions as well).
  13194. jQuery.each( {
  13195. mouseenter: "mouseover",
  13196. mouseleave: "mouseout",
  13197. pointerenter: "pointerover",
  13198. pointerleave: "pointerout"
  13199. }, function( orig, fix ) {
  13200. jQuery.event.special[ orig ] = {
  13201. delegateType: fix,
  13202. bindType: fix,
  13203. handle: function( event ) {
  13204. var ret,
  13205. target = this,
  13206. related = event.relatedTarget,
  13207. handleObj = event.handleObj;
  13208. // For mouseenter/leave call the handler if related is outside the target.
  13209. // NB: No relatedTarget if the mouse left/entered the browser window
  13210. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  13211. event.type = handleObj.origType;
  13212. ret = handleObj.handler.apply( this, arguments );
  13213. event.type = fix;
  13214. }
  13215. return ret;
  13216. }
  13217. };
  13218. } );
  13219. jQuery.fn.extend( {
  13220. on: function( types, selector, data, fn ) {
  13221. return on( this, types, selector, data, fn );
  13222. },
  13223. one: function( types, selector, data, fn ) {
  13224. return on( this, types, selector, data, fn, 1 );
  13225. },
  13226. off: function( types, selector, fn ) {
  13227. var handleObj, type;
  13228. if ( types && types.preventDefault && types.handleObj ) {
  13229. // ( event ) dispatched jQuery.Event
  13230. handleObj = types.handleObj;
  13231. jQuery( types.delegateTarget ).off(
  13232. handleObj.namespace ?
  13233. handleObj.origType + "." + handleObj.namespace :
  13234. handleObj.origType,
  13235. handleObj.selector,
  13236. handleObj.handler
  13237. );
  13238. return this;
  13239. }
  13240. if ( typeof types === "object" ) {
  13241. // ( types-object [, selector] )
  13242. for ( type in types ) {
  13243. this.off( type, selector, types[ type ] );
  13244. }
  13245. return this;
  13246. }
  13247. if ( selector === false || typeof selector === "function" ) {
  13248. // ( types [, fn] )
  13249. fn = selector;
  13250. selector = undefined;
  13251. }
  13252. if ( fn === false ) {
  13253. fn = returnFalse;
  13254. }
  13255. return this.each( function() {
  13256. jQuery.event.remove( this, types, fn, selector );
  13257. } );
  13258. }
  13259. } );
  13260. var
  13261. /* eslint-disable max-len */
  13262. // See https://github.com/eslint/eslint/issues/3229
  13263. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  13264. /* eslint-enable */
  13265. // Support: IE <=10 - 11, Edge 12 - 13 only
  13266. // In IE/Edge using regex groups here causes severe slowdowns.
  13267. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  13268. rnoInnerhtml = /<script|<style|<link/i,
  13269. // checked="checked" or checked
  13270. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  13271. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  13272. // Prefer a tbody over its parent table for containing new rows
  13273. function manipulationTarget( elem, content ) {
  13274. if ( nodeName( elem, "table" ) &&
  13275. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  13276. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  13277. }
  13278. return elem;
  13279. }
  13280. // Replace/restore the type attribute of script elements for safe DOM manipulation
  13281. function disableScript( elem ) {
  13282. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  13283. return elem;
  13284. }
  13285. function restoreScript( elem ) {
  13286. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  13287. elem.type = elem.type.slice( 5 );
  13288. } else {
  13289. elem.removeAttribute( "type" );
  13290. }
  13291. return elem;
  13292. }
  13293. function cloneCopyEvent( src, dest ) {
  13294. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  13295. if ( dest.nodeType !== 1 ) {
  13296. return;
  13297. }
  13298. // 1. Copy private data: events, handlers, etc.
  13299. if ( dataPriv.hasData( src ) ) {
  13300. pdataOld = dataPriv.access( src );
  13301. pdataCur = dataPriv.set( dest, pdataOld );
  13302. events = pdataOld.events;
  13303. if ( events ) {
  13304. delete pdataCur.handle;
  13305. pdataCur.events = {};
  13306. for ( type in events ) {
  13307. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  13308. jQuery.event.add( dest, type, events[ type ][ i ] );
  13309. }
  13310. }
  13311. }
  13312. }
  13313. // 2. Copy user data
  13314. if ( dataUser.hasData( src ) ) {
  13315. udataOld = dataUser.access( src );
  13316. udataCur = jQuery.extend( {}, udataOld );
  13317. dataUser.set( dest, udataCur );
  13318. }
  13319. }
  13320. // Fix IE bugs, see support tests
  13321. function fixInput( src, dest ) {
  13322. var nodeName = dest.nodeName.toLowerCase();
  13323. // Fails to persist the checked state of a cloned checkbox or radio button.
  13324. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  13325. dest.checked = src.checked;
  13326. // Fails to return the selected option to the default selected state when cloning options
  13327. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  13328. dest.defaultValue = src.defaultValue;
  13329. }
  13330. }
  13331. function domManip( collection, args, callback, ignored ) {
  13332. // Flatten any nested arrays
  13333. args = concat.apply( [], args );
  13334. var fragment, first, scripts, hasScripts, node, doc,
  13335. i = 0,
  13336. l = collection.length,
  13337. iNoClone = l - 1,
  13338. value = args[ 0 ],
  13339. valueIsFunction = isFunction( value );
  13340. // We can't cloneNode fragments that contain checked, in WebKit
  13341. if ( valueIsFunction ||
  13342. ( l > 1 && typeof value === "string" &&
  13343. !support.checkClone && rchecked.test( value ) ) ) {
  13344. return collection.each( function( index ) {
  13345. var self = collection.eq( index );
  13346. if ( valueIsFunction ) {
  13347. args[ 0 ] = value.call( this, index, self.html() );
  13348. }
  13349. domManip( self, args, callback, ignored );
  13350. } );
  13351. }
  13352. if ( l ) {
  13353. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  13354. first = fragment.firstChild;
  13355. if ( fragment.childNodes.length === 1 ) {
  13356. fragment = first;
  13357. }
  13358. // Require either new content or an interest in ignored elements to invoke the callback
  13359. if ( first || ignored ) {
  13360. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  13361. hasScripts = scripts.length;
  13362. // Use the original fragment for the last item
  13363. // instead of the first because it can end up
  13364. // being emptied incorrectly in certain situations (#8070).
  13365. for ( ; i < l; i++ ) {
  13366. node = fragment;
  13367. if ( i !== iNoClone ) {
  13368. node = jQuery.clone( node, true, true );
  13369. // Keep references to cloned scripts for later restoration
  13370. if ( hasScripts ) {
  13371. // Support: Android <=4.0 only, PhantomJS 1 only
  13372. // push.apply(_, arraylike) throws on ancient WebKit
  13373. jQuery.merge( scripts, getAll( node, "script" ) );
  13374. }
  13375. }
  13376. callback.call( collection[ i ], node, i );
  13377. }
  13378. if ( hasScripts ) {
  13379. doc = scripts[ scripts.length - 1 ].ownerDocument;
  13380. // Reenable scripts
  13381. jQuery.map( scripts, restoreScript );
  13382. // Evaluate executable scripts on first document insertion
  13383. for ( i = 0; i < hasScripts; i++ ) {
  13384. node = scripts[ i ];
  13385. if ( rscriptType.test( node.type || "" ) &&
  13386. !dataPriv.access( node, "globalEval" ) &&
  13387. jQuery.contains( doc, node ) ) {
  13388. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  13389. // Optional AJAX dependency, but won't run scripts if not present
  13390. if ( jQuery._evalUrl && !node.noModule ) {
  13391. jQuery._evalUrl( node.src, {
  13392. nonce: node.nonce || node.getAttribute( "nonce" )
  13393. } );
  13394. }
  13395. } else {
  13396. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  13397. }
  13398. }
  13399. }
  13400. }
  13401. }
  13402. }
  13403. return collection;
  13404. }
  13405. function remove( elem, selector, keepData ) {
  13406. var node,
  13407. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  13408. i = 0;
  13409. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  13410. if ( !keepData && node.nodeType === 1 ) {
  13411. jQuery.cleanData( getAll( node ) );
  13412. }
  13413. if ( node.parentNode ) {
  13414. if ( keepData && isAttached( node ) ) {
  13415. setGlobalEval( getAll( node, "script" ) );
  13416. }
  13417. node.parentNode.removeChild( node );
  13418. }
  13419. }
  13420. return elem;
  13421. }
  13422. jQuery.extend( {
  13423. htmlPrefilter: function( html ) {
  13424. return html.replace( rxhtmlTag, "<$1></$2>" );
  13425. },
  13426. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  13427. var i, l, srcElements, destElements,
  13428. clone = elem.cloneNode( true ),
  13429. inPage = isAttached( elem );
  13430. // Fix IE cloning issues
  13431. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  13432. !jQuery.isXMLDoc( elem ) ) {
  13433. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  13434. destElements = getAll( clone );
  13435. srcElements = getAll( elem );
  13436. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13437. fixInput( srcElements[ i ], destElements[ i ] );
  13438. }
  13439. }
  13440. // Copy the events from the original to the clone
  13441. if ( dataAndEvents ) {
  13442. if ( deepDataAndEvents ) {
  13443. srcElements = srcElements || getAll( elem );
  13444. destElements = destElements || getAll( clone );
  13445. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13446. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  13447. }
  13448. } else {
  13449. cloneCopyEvent( elem, clone );
  13450. }
  13451. }
  13452. // Preserve script evaluation history
  13453. destElements = getAll( clone, "script" );
  13454. if ( destElements.length > 0 ) {
  13455. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  13456. }
  13457. // Return the cloned set
  13458. return clone;
  13459. },
  13460. cleanData: function( elems ) {
  13461. var data, elem, type,
  13462. special = jQuery.event.special,
  13463. i = 0;
  13464. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  13465. if ( acceptData( elem ) ) {
  13466. if ( ( data = elem[ dataPriv.expando ] ) ) {
  13467. if ( data.events ) {
  13468. for ( type in data.events ) {
  13469. if ( special[ type ] ) {
  13470. jQuery.event.remove( elem, type );
  13471. // This is a shortcut to avoid jQuery.event.remove's overhead
  13472. } else {
  13473. jQuery.removeEvent( elem, type, data.handle );
  13474. }
  13475. }
  13476. }
  13477. // Support: Chrome <=35 - 45+
  13478. // Assign undefined instead of using delete, see Data#remove
  13479. elem[ dataPriv.expando ] = undefined;
  13480. }
  13481. if ( elem[ dataUser.expando ] ) {
  13482. // Support: Chrome <=35 - 45+
  13483. // Assign undefined instead of using delete, see Data#remove
  13484. elem[ dataUser.expando ] = undefined;
  13485. }
  13486. }
  13487. }
  13488. }
  13489. } );
  13490. jQuery.fn.extend( {
  13491. detach: function( selector ) {
  13492. return remove( this, selector, true );
  13493. },
  13494. remove: function( selector ) {
  13495. return remove( this, selector );
  13496. },
  13497. text: function( value ) {
  13498. return access( this, function( value ) {
  13499. return value === undefined ?
  13500. jQuery.text( this ) :
  13501. this.empty().each( function() {
  13502. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13503. this.textContent = value;
  13504. }
  13505. } );
  13506. }, null, value, arguments.length );
  13507. },
  13508. append: function() {
  13509. return domManip( this, arguments, function( elem ) {
  13510. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13511. var target = manipulationTarget( this, elem );
  13512. target.appendChild( elem );
  13513. }
  13514. } );
  13515. },
  13516. prepend: function() {
  13517. return domManip( this, arguments, function( elem ) {
  13518. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13519. var target = manipulationTarget( this, elem );
  13520. target.insertBefore( elem, target.firstChild );
  13521. }
  13522. } );
  13523. },
  13524. before: function() {
  13525. return domManip( this, arguments, function( elem ) {
  13526. if ( this.parentNode ) {
  13527. this.parentNode.insertBefore( elem, this );
  13528. }
  13529. } );
  13530. },
  13531. after: function() {
  13532. return domManip( this, arguments, function( elem ) {
  13533. if ( this.parentNode ) {
  13534. this.parentNode.insertBefore( elem, this.nextSibling );
  13535. }
  13536. } );
  13537. },
  13538. empty: function() {
  13539. var elem,
  13540. i = 0;
  13541. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  13542. if ( elem.nodeType === 1 ) {
  13543. // Prevent memory leaks
  13544. jQuery.cleanData( getAll( elem, false ) );
  13545. // Remove any remaining nodes
  13546. elem.textContent = "";
  13547. }
  13548. }
  13549. return this;
  13550. },
  13551. clone: function( dataAndEvents, deepDataAndEvents ) {
  13552. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  13553. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  13554. return this.map( function() {
  13555. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  13556. } );
  13557. },
  13558. html: function( value ) {
  13559. return access( this, function( value ) {
  13560. var elem = this[ 0 ] || {},
  13561. i = 0,
  13562. l = this.length;
  13563. if ( value === undefined && elem.nodeType === 1 ) {
  13564. return elem.innerHTML;
  13565. }
  13566. // See if we can take a shortcut and just use innerHTML
  13567. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  13568. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  13569. value = jQuery.htmlPrefilter( value );
  13570. try {
  13571. for ( ; i < l; i++ ) {
  13572. elem = this[ i ] || {};
  13573. // Remove element nodes and prevent memory leaks
  13574. if ( elem.nodeType === 1 ) {
  13575. jQuery.cleanData( getAll( elem, false ) );
  13576. elem.innerHTML = value;
  13577. }
  13578. }
  13579. elem = 0;
  13580. // If using innerHTML throws an exception, use the fallback method
  13581. } catch ( e ) {}
  13582. }
  13583. if ( elem ) {
  13584. this.empty().append( value );
  13585. }
  13586. }, null, value, arguments.length );
  13587. },
  13588. replaceWith: function() {
  13589. var ignored = [];
  13590. // Make the changes, replacing each non-ignored context element with the new content
  13591. return domManip( this, arguments, function( elem ) {
  13592. var parent = this.parentNode;
  13593. if ( jQuery.inArray( this, ignored ) < 0 ) {
  13594. jQuery.cleanData( getAll( this ) );
  13595. if ( parent ) {
  13596. parent.replaceChild( elem, this );
  13597. }
  13598. }
  13599. // Force callback invocation
  13600. }, ignored );
  13601. }
  13602. } );
  13603. jQuery.each( {
  13604. appendTo: "append",
  13605. prependTo: "prepend",
  13606. insertBefore: "before",
  13607. insertAfter: "after",
  13608. replaceAll: "replaceWith"
  13609. }, function( name, original ) {
  13610. jQuery.fn[ name ] = function( selector ) {
  13611. var elems,
  13612. ret = [],
  13613. insert = jQuery( selector ),
  13614. last = insert.length - 1,
  13615. i = 0;
  13616. for ( ; i <= last; i++ ) {
  13617. elems = i === last ? this : this.clone( true );
  13618. jQuery( insert[ i ] )[ original ]( elems );
  13619. // Support: Android <=4.0 only, PhantomJS 1 only
  13620. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  13621. push.apply( ret, elems.get() );
  13622. }
  13623. return this.pushStack( ret );
  13624. };
  13625. } );
  13626. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  13627. var getStyles = function( elem ) {
  13628. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  13629. // IE throws on elements created in popups
  13630. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  13631. var view = elem.ownerDocument.defaultView;
  13632. if ( !view || !view.opener ) {
  13633. view = window;
  13634. }
  13635. return view.getComputedStyle( elem );
  13636. };
  13637. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  13638. ( function() {
  13639. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  13640. // so they're executed at the same time to save the second computation.
  13641. function computeStyleTests() {
  13642. // This is a singleton, we need to execute it only once
  13643. if ( !div ) {
  13644. return;
  13645. }
  13646. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  13647. "margin-top:1px;padding:0;border:0";
  13648. div.style.cssText =
  13649. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  13650. "margin:auto;border:1px;padding:1px;" +
  13651. "width:60%;top:1%";
  13652. documentElement.appendChild( container ).appendChild( div );
  13653. var divStyle = window.getComputedStyle( div );
  13654. pixelPositionVal = divStyle.top !== "1%";
  13655. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  13656. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  13657. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  13658. // Some styles come back with percentage values, even though they shouldn't
  13659. div.style.right = "60%";
  13660. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  13661. // Support: IE 9 - 11 only
  13662. // Detect misreporting of content dimensions for box-sizing:border-box elements
  13663. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  13664. // Support: IE 9 only
  13665. // Detect overflow:scroll screwiness (gh-3699)
  13666. // Support: Chrome <=64
  13667. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  13668. div.style.position = "absolute";
  13669. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  13670. documentElement.removeChild( container );
  13671. // Nullify the div so it wouldn't be stored in the memory and
  13672. // it will also be a sign that checks already performed
  13673. div = null;
  13674. }
  13675. function roundPixelMeasures( measure ) {
  13676. return Math.round( parseFloat( measure ) );
  13677. }
  13678. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  13679. reliableMarginLeftVal,
  13680. container = document.createElement( "div" ),
  13681. div = document.createElement( "div" );
  13682. // Finish early in limited (non-browser) environments
  13683. if ( !div.style ) {
  13684. return;
  13685. }
  13686. // Support: IE <=9 - 11 only
  13687. // Style of cloned element affects source element cloned (#8908)
  13688. div.style.backgroundClip = "content-box";
  13689. div.cloneNode( true ).style.backgroundClip = "";
  13690. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  13691. jQuery.extend( support, {
  13692. boxSizingReliable: function() {
  13693. computeStyleTests();
  13694. return boxSizingReliableVal;
  13695. },
  13696. pixelBoxStyles: function() {
  13697. computeStyleTests();
  13698. return pixelBoxStylesVal;
  13699. },
  13700. pixelPosition: function() {
  13701. computeStyleTests();
  13702. return pixelPositionVal;
  13703. },
  13704. reliableMarginLeft: function() {
  13705. computeStyleTests();
  13706. return reliableMarginLeftVal;
  13707. },
  13708. scrollboxSize: function() {
  13709. computeStyleTests();
  13710. return scrollboxSizeVal;
  13711. }
  13712. } );
  13713. } )();
  13714. function curCSS( elem, name, computed ) {
  13715. var width, minWidth, maxWidth, ret,
  13716. // Support: Firefox 51+
  13717. // Retrieving style before computed somehow
  13718. // fixes an issue with getting wrong values
  13719. // on detached elements
  13720. style = elem.style;
  13721. computed = computed || getStyles( elem );
  13722. // getPropertyValue is needed for:
  13723. // .css('filter') (IE 9 only, #12537)
  13724. // .css('--customProperty) (#3144)
  13725. if ( computed ) {
  13726. ret = computed.getPropertyValue( name ) || computed[ name ];
  13727. if ( ret === "" && !isAttached( elem ) ) {
  13728. ret = jQuery.style( elem, name );
  13729. }
  13730. // A tribute to the "awesome hack by Dean Edwards"
  13731. // Android Browser returns percentage for some values,
  13732. // but width seems to be reliably pixels.
  13733. // This is against the CSSOM draft spec:
  13734. // https://drafts.csswg.org/cssom/#resolved-values
  13735. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  13736. // Remember the original values
  13737. width = style.width;
  13738. minWidth = style.minWidth;
  13739. maxWidth = style.maxWidth;
  13740. // Put in the new values to get a computed value out
  13741. style.minWidth = style.maxWidth = style.width = ret;
  13742. ret = computed.width;
  13743. // Revert the changed values
  13744. style.width = width;
  13745. style.minWidth = minWidth;
  13746. style.maxWidth = maxWidth;
  13747. }
  13748. }
  13749. return ret !== undefined ?
  13750. // Support: IE <=9 - 11 only
  13751. // IE returns zIndex value as an integer.
  13752. ret + "" :
  13753. ret;
  13754. }
  13755. function addGetHookIf( conditionFn, hookFn ) {
  13756. // Define the hook, we'll check on the first run if it's really needed.
  13757. return {
  13758. get: function() {
  13759. if ( conditionFn() ) {
  13760. // Hook not needed (or it's not possible to use it due
  13761. // to missing dependency), remove it.
  13762. delete this.get;
  13763. return;
  13764. }
  13765. // Hook needed; redefine it so that the support test is not executed again.
  13766. return ( this.get = hookFn ).apply( this, arguments );
  13767. }
  13768. };
  13769. }
  13770. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  13771. emptyStyle = document.createElement( "div" ).style,
  13772. vendorProps = {};
  13773. // Return a vendor-prefixed property or undefined
  13774. function vendorPropName( name ) {
  13775. // Check for vendor prefixed names
  13776. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  13777. i = cssPrefixes.length;
  13778. while ( i-- ) {
  13779. name = cssPrefixes[ i ] + capName;
  13780. if ( name in emptyStyle ) {
  13781. return name;
  13782. }
  13783. }
  13784. }
  13785. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  13786. function finalPropName( name ) {
  13787. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  13788. if ( final ) {
  13789. return final;
  13790. }
  13791. if ( name in emptyStyle ) {
  13792. return name;
  13793. }
  13794. return vendorProps[ name ] = vendorPropName( name ) || name;
  13795. }
  13796. var
  13797. // Swappable if display is none or starts with table
  13798. // except "table", "table-cell", or "table-caption"
  13799. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  13800. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  13801. rcustomProp = /^--/,
  13802. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  13803. cssNormalTransform = {
  13804. letterSpacing: "0",
  13805. fontWeight: "400"
  13806. };
  13807. function setPositiveNumber( elem, value, subtract ) {
  13808. // Any relative (+/-) values have already been
  13809. // normalized at this point
  13810. var matches = rcssNum.exec( value );
  13811. return matches ?
  13812. // Guard against undefined "subtract", e.g., when used as in cssHooks
  13813. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  13814. value;
  13815. }
  13816. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  13817. var i = dimension === "width" ? 1 : 0,
  13818. extra = 0,
  13819. delta = 0;
  13820. // Adjustment may not be necessary
  13821. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  13822. return 0;
  13823. }
  13824. for ( ; i < 4; i += 2 ) {
  13825. // Both box models exclude margin
  13826. if ( box === "margin" ) {
  13827. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  13828. }
  13829. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  13830. if ( !isBorderBox ) {
  13831. // Add padding
  13832. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13833. // For "border" or "margin", add border
  13834. if ( box !== "padding" ) {
  13835. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13836. // But still keep track of it otherwise
  13837. } else {
  13838. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13839. }
  13840. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  13841. // "padding" or "margin"
  13842. } else {
  13843. // For "content", subtract padding
  13844. if ( box === "content" ) {
  13845. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13846. }
  13847. // For "content" or "padding", subtract border
  13848. if ( box !== "margin" ) {
  13849. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13850. }
  13851. }
  13852. }
  13853. // Account for positive content-box scroll gutter when requested by providing computedVal
  13854. if ( !isBorderBox && computedVal >= 0 ) {
  13855. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  13856. // Assuming integer scroll gutter, subtract the rest and round down
  13857. delta += Math.max( 0, Math.ceil(
  13858. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13859. computedVal -
  13860. delta -
  13861. extra -
  13862. 0.5
  13863. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  13864. // Use an explicit zero to avoid NaN (gh-3964)
  13865. ) ) || 0;
  13866. }
  13867. return delta;
  13868. }
  13869. function getWidthOrHeight( elem, dimension, extra ) {
  13870. // Start with computed style
  13871. var styles = getStyles( elem ),
  13872. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  13873. // Fake content-box until we know it's needed to know the true value.
  13874. boxSizingNeeded = !support.boxSizingReliable() || extra,
  13875. isBorderBox = boxSizingNeeded &&
  13876. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13877. valueIsBorderBox = isBorderBox,
  13878. val = curCSS( elem, dimension, styles ),
  13879. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  13880. // Support: Firefox <=54
  13881. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  13882. if ( rnumnonpx.test( val ) ) {
  13883. if ( !extra ) {
  13884. return val;
  13885. }
  13886. val = "auto";
  13887. }
  13888. // Fall back to offsetWidth/offsetHeight when value is "auto"
  13889. // This happens for inline elements with no explicit setting (gh-3571)
  13890. // Support: Android <=4.1 - 4.3 only
  13891. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  13892. // Support: IE 9-11 only
  13893. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  13894. // We use getClientRects() to check for hidden/disconnected.
  13895. // In those cases, the computed value can be trusted to be border-box
  13896. if ( ( !support.boxSizingReliable() && isBorderBox ||
  13897. val === "auto" ||
  13898. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  13899. elem.getClientRects().length ) {
  13900. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  13901. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  13902. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  13903. // retrieved value as a content box dimension.
  13904. valueIsBorderBox = offsetProp in elem;
  13905. if ( valueIsBorderBox ) {
  13906. val = elem[ offsetProp ];
  13907. }
  13908. }
  13909. // Normalize "" and auto
  13910. val = parseFloat( val ) || 0;
  13911. // Adjust for the element's box model
  13912. return ( val +
  13913. boxModelAdjustment(
  13914. elem,
  13915. dimension,
  13916. extra || ( isBorderBox ? "border" : "content" ),
  13917. valueIsBorderBox,
  13918. styles,
  13919. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  13920. val
  13921. )
  13922. ) + "px";
  13923. }
  13924. jQuery.extend( {
  13925. // Add in style property hooks for overriding the default
  13926. // behavior of getting and setting a style property
  13927. cssHooks: {
  13928. opacity: {
  13929. get: function( elem, computed ) {
  13930. if ( computed ) {
  13931. // We should always get a number back from opacity
  13932. var ret = curCSS( elem, "opacity" );
  13933. return ret === "" ? "1" : ret;
  13934. }
  13935. }
  13936. }
  13937. },
  13938. // Don't automatically add "px" to these possibly-unitless properties
  13939. cssNumber: {
  13940. "animationIterationCount": true,
  13941. "columnCount": true,
  13942. "fillOpacity": true,
  13943. "flexGrow": true,
  13944. "flexShrink": true,
  13945. "fontWeight": true,
  13946. "gridArea": true,
  13947. "gridColumn": true,
  13948. "gridColumnEnd": true,
  13949. "gridColumnStart": true,
  13950. "gridRow": true,
  13951. "gridRowEnd": true,
  13952. "gridRowStart": true,
  13953. "lineHeight": true,
  13954. "opacity": true,
  13955. "order": true,
  13956. "orphans": true,
  13957. "widows": true,
  13958. "zIndex": true,
  13959. "zoom": true
  13960. },
  13961. // Add in properties whose names you wish to fix before
  13962. // setting or getting the value
  13963. cssProps: {},
  13964. // Get and set the style property on a DOM Node
  13965. style: function( elem, name, value, extra ) {
  13966. // Don't set styles on text and comment nodes
  13967. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  13968. return;
  13969. }
  13970. // Make sure that we're working with the right name
  13971. var ret, type, hooks,
  13972. origName = camelCase( name ),
  13973. isCustomProp = rcustomProp.test( name ),
  13974. style = elem.style;
  13975. // Make sure that we're working with the right name. We don't
  13976. // want to query the value if it is a CSS custom property
  13977. // since they are user-defined.
  13978. if ( !isCustomProp ) {
  13979. name = finalPropName( origName );
  13980. }
  13981. // Gets hook for the prefixed version, then unprefixed version
  13982. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  13983. // Check if we're setting a value
  13984. if ( value !== undefined ) {
  13985. type = typeof value;
  13986. // Convert "+=" or "-=" to relative numbers (#7345)
  13987. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  13988. value = adjustCSS( elem, name, ret );
  13989. // Fixes bug #9237
  13990. type = "number";
  13991. }
  13992. // Make sure that null and NaN values aren't set (#7116)
  13993. if ( value == null || value !== value ) {
  13994. return;
  13995. }
  13996. // If a number was passed in, add the unit (except for certain CSS properties)
  13997. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  13998. // "px" to a few hardcoded values.
  13999. if ( type === "number" && !isCustomProp ) {
  14000. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  14001. }
  14002. // background-* props affect original clone's values
  14003. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  14004. style[ name ] = "inherit";
  14005. }
  14006. // If a hook was provided, use that value, otherwise just set the specified value
  14007. if ( !hooks || !( "set" in hooks ) ||
  14008. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  14009. if ( isCustomProp ) {
  14010. style.setProperty( name, value );
  14011. } else {
  14012. style[ name ] = value;
  14013. }
  14014. }
  14015. } else {
  14016. // If a hook was provided get the non-computed value from there
  14017. if ( hooks && "get" in hooks &&
  14018. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  14019. return ret;
  14020. }
  14021. // Otherwise just get the value from the style object
  14022. return style[ name ];
  14023. }
  14024. },
  14025. css: function( elem, name, extra, styles ) {
  14026. var val, num, hooks,
  14027. origName = camelCase( name ),
  14028. isCustomProp = rcustomProp.test( name );
  14029. // Make sure that we're working with the right name. We don't
  14030. // want to modify the value if it is a CSS custom property
  14031. // since they are user-defined.
  14032. if ( !isCustomProp ) {
  14033. name = finalPropName( origName );
  14034. }
  14035. // Try prefixed name followed by the unprefixed name
  14036. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14037. // If a hook was provided get the computed value from there
  14038. if ( hooks && "get" in hooks ) {
  14039. val = hooks.get( elem, true, extra );
  14040. }
  14041. // Otherwise, if a way to get the computed value exists, use that
  14042. if ( val === undefined ) {
  14043. val = curCSS( elem, name, styles );
  14044. }
  14045. // Convert "normal" to computed value
  14046. if ( val === "normal" && name in cssNormalTransform ) {
  14047. val = cssNormalTransform[ name ];
  14048. }
  14049. // Make numeric if forced or a qualifier was provided and val looks numeric
  14050. if ( extra === "" || extra ) {
  14051. num = parseFloat( val );
  14052. return extra === true || isFinite( num ) ? num || 0 : val;
  14053. }
  14054. return val;
  14055. }
  14056. } );
  14057. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  14058. jQuery.cssHooks[ dimension ] = {
  14059. get: function( elem, computed, extra ) {
  14060. if ( computed ) {
  14061. // Certain elements can have dimension info if we invisibly show them
  14062. // but it must have a current display style that would benefit
  14063. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  14064. // Support: Safari 8+
  14065. // Table columns in Safari have non-zero offsetWidth & zero
  14066. // getBoundingClientRect().width unless display is changed.
  14067. // Support: IE <=11 only
  14068. // Running getBoundingClientRect on a disconnected node
  14069. // in IE throws an error.
  14070. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  14071. swap( elem, cssShow, function() {
  14072. return getWidthOrHeight( elem, dimension, extra );
  14073. } ) :
  14074. getWidthOrHeight( elem, dimension, extra );
  14075. }
  14076. },
  14077. set: function( elem, value, extra ) {
  14078. var matches,
  14079. styles = getStyles( elem ),
  14080. // Only read styles.position if the test has a chance to fail
  14081. // to avoid forcing a reflow.
  14082. scrollboxSizeBuggy = !support.scrollboxSize() &&
  14083. styles.position === "absolute",
  14084. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  14085. boxSizingNeeded = scrollboxSizeBuggy || extra,
  14086. isBorderBox = boxSizingNeeded &&
  14087. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14088. subtract = extra ?
  14089. boxModelAdjustment(
  14090. elem,
  14091. dimension,
  14092. extra,
  14093. isBorderBox,
  14094. styles
  14095. ) :
  14096. 0;
  14097. // Account for unreliable border-box dimensions by comparing offset* to computed and
  14098. // faking a content-box to get border and padding (gh-3699)
  14099. if ( isBorderBox && scrollboxSizeBuggy ) {
  14100. subtract -= Math.ceil(
  14101. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14102. parseFloat( styles[ dimension ] ) -
  14103. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  14104. 0.5
  14105. );
  14106. }
  14107. // Convert to pixels if value adjustment is needed
  14108. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  14109. ( matches[ 3 ] || "px" ) !== "px" ) {
  14110. elem.style[ dimension ] = value;
  14111. value = jQuery.css( elem, dimension );
  14112. }
  14113. return setPositiveNumber( elem, value, subtract );
  14114. }
  14115. };
  14116. } );
  14117. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  14118. function( elem, computed ) {
  14119. if ( computed ) {
  14120. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  14121. elem.getBoundingClientRect().left -
  14122. swap( elem, { marginLeft: 0 }, function() {
  14123. return elem.getBoundingClientRect().left;
  14124. } )
  14125. ) + "px";
  14126. }
  14127. }
  14128. );
  14129. // These hooks are used by animate to expand properties
  14130. jQuery.each( {
  14131. margin: "",
  14132. padding: "",
  14133. border: "Width"
  14134. }, function( prefix, suffix ) {
  14135. jQuery.cssHooks[ prefix + suffix ] = {
  14136. expand: function( value ) {
  14137. var i = 0,
  14138. expanded = {},
  14139. // Assumes a single number if not a string
  14140. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  14141. for ( ; i < 4; i++ ) {
  14142. expanded[ prefix + cssExpand[ i ] + suffix ] =
  14143. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  14144. }
  14145. return expanded;
  14146. }
  14147. };
  14148. if ( prefix !== "margin" ) {
  14149. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  14150. }
  14151. } );
  14152. jQuery.fn.extend( {
  14153. css: function( name, value ) {
  14154. return access( this, function( elem, name, value ) {
  14155. var styles, len,
  14156. map = {},
  14157. i = 0;
  14158. if ( Array.isArray( name ) ) {
  14159. styles = getStyles( elem );
  14160. len = name.length;
  14161. for ( ; i < len; i++ ) {
  14162. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  14163. }
  14164. return map;
  14165. }
  14166. return value !== undefined ?
  14167. jQuery.style( elem, name, value ) :
  14168. jQuery.css( elem, name );
  14169. }, name, value, arguments.length > 1 );
  14170. }
  14171. } );
  14172. function Tween( elem, options, prop, end, easing ) {
  14173. return new Tween.prototype.init( elem, options, prop, end, easing );
  14174. }
  14175. jQuery.Tween = Tween;
  14176. Tween.prototype = {
  14177. constructor: Tween,
  14178. init: function( elem, options, prop, end, easing, unit ) {
  14179. this.elem = elem;
  14180. this.prop = prop;
  14181. this.easing = easing || jQuery.easing._default;
  14182. this.options = options;
  14183. this.start = this.now = this.cur();
  14184. this.end = end;
  14185. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  14186. },
  14187. cur: function() {
  14188. var hooks = Tween.propHooks[ this.prop ];
  14189. return hooks && hooks.get ?
  14190. hooks.get( this ) :
  14191. Tween.propHooks._default.get( this );
  14192. },
  14193. run: function( percent ) {
  14194. var eased,
  14195. hooks = Tween.propHooks[ this.prop ];
  14196. if ( this.options.duration ) {
  14197. this.pos = eased = jQuery.easing[ this.easing ](
  14198. percent, this.options.duration * percent, 0, 1, this.options.duration
  14199. );
  14200. } else {
  14201. this.pos = eased = percent;
  14202. }
  14203. this.now = ( this.end - this.start ) * eased + this.start;
  14204. if ( this.options.step ) {
  14205. this.options.step.call( this.elem, this.now, this );
  14206. }
  14207. if ( hooks && hooks.set ) {
  14208. hooks.set( this );
  14209. } else {
  14210. Tween.propHooks._default.set( this );
  14211. }
  14212. return this;
  14213. }
  14214. };
  14215. Tween.prototype.init.prototype = Tween.prototype;
  14216. Tween.propHooks = {
  14217. _default: {
  14218. get: function( tween ) {
  14219. var result;
  14220. // Use a property on the element directly when it is not a DOM element,
  14221. // or when there is no matching style property that exists.
  14222. if ( tween.elem.nodeType !== 1 ||
  14223. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  14224. return tween.elem[ tween.prop ];
  14225. }
  14226. // Passing an empty string as a 3rd parameter to .css will automatically
  14227. // attempt a parseFloat and fallback to a string if the parse fails.
  14228. // Simple values such as "10px" are parsed to Float;
  14229. // complex values such as "rotate(1rad)" are returned as-is.
  14230. result = jQuery.css( tween.elem, tween.prop, "" );
  14231. // Empty strings, null, undefined and "auto" are converted to 0.
  14232. return !result || result === "auto" ? 0 : result;
  14233. },
  14234. set: function( tween ) {
  14235. // Use step hook for back compat.
  14236. // Use cssHook if its there.
  14237. // Use .style if available and use plain properties where available.
  14238. if ( jQuery.fx.step[ tween.prop ] ) {
  14239. jQuery.fx.step[ tween.prop ]( tween );
  14240. } else if ( tween.elem.nodeType === 1 && (
  14241. jQuery.cssHooks[ tween.prop ] ||
  14242. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  14243. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  14244. } else {
  14245. tween.elem[ tween.prop ] = tween.now;
  14246. }
  14247. }
  14248. }
  14249. };
  14250. // Support: IE <=9 only
  14251. // Panic based approach to setting things on disconnected nodes
  14252. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  14253. set: function( tween ) {
  14254. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  14255. tween.elem[ tween.prop ] = tween.now;
  14256. }
  14257. }
  14258. };
  14259. jQuery.easing = {
  14260. linear: function( p ) {
  14261. return p;
  14262. },
  14263. swing: function( p ) {
  14264. return 0.5 - Math.cos( p * Math.PI ) / 2;
  14265. },
  14266. _default: "swing"
  14267. };
  14268. jQuery.fx = Tween.prototype.init;
  14269. // Back compat <1.8 extension point
  14270. jQuery.fx.step = {};
  14271. var
  14272. fxNow, inProgress,
  14273. rfxtypes = /^(?:toggle|show|hide)$/,
  14274. rrun = /queueHooks$/;
  14275. function schedule() {
  14276. if ( inProgress ) {
  14277. if ( document.hidden === false && window.requestAnimationFrame ) {
  14278. window.requestAnimationFrame( schedule );
  14279. } else {
  14280. window.setTimeout( schedule, jQuery.fx.interval );
  14281. }
  14282. jQuery.fx.tick();
  14283. }
  14284. }
  14285. // Animations created synchronously will run synchronously
  14286. function createFxNow() {
  14287. window.setTimeout( function() {
  14288. fxNow = undefined;
  14289. } );
  14290. return ( fxNow = Date.now() );
  14291. }
  14292. // Generate parameters to create a standard animation
  14293. function genFx( type, includeWidth ) {
  14294. var which,
  14295. i = 0,
  14296. attrs = { height: type };
  14297. // If we include width, step value is 1 to do all cssExpand values,
  14298. // otherwise step value is 2 to skip over Left and Right
  14299. includeWidth = includeWidth ? 1 : 0;
  14300. for ( ; i < 4; i += 2 - includeWidth ) {
  14301. which = cssExpand[ i ];
  14302. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  14303. }
  14304. if ( includeWidth ) {
  14305. attrs.opacity = attrs.width = type;
  14306. }
  14307. return attrs;
  14308. }
  14309. function createTween( value, prop, animation ) {
  14310. var tween,
  14311. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  14312. index = 0,
  14313. length = collection.length;
  14314. for ( ; index < length; index++ ) {
  14315. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  14316. // We're done with this property
  14317. return tween;
  14318. }
  14319. }
  14320. }
  14321. function defaultPrefilter( elem, props, opts ) {
  14322. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  14323. isBox = "width" in props || "height" in props,
  14324. anim = this,
  14325. orig = {},
  14326. style = elem.style,
  14327. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  14328. dataShow = dataPriv.get( elem, "fxshow" );
  14329. // Queue-skipping animations hijack the fx hooks
  14330. if ( !opts.queue ) {
  14331. hooks = jQuery._queueHooks( elem, "fx" );
  14332. if ( hooks.unqueued == null ) {
  14333. hooks.unqueued = 0;
  14334. oldfire = hooks.empty.fire;
  14335. hooks.empty.fire = function() {
  14336. if ( !hooks.unqueued ) {
  14337. oldfire();
  14338. }
  14339. };
  14340. }
  14341. hooks.unqueued++;
  14342. anim.always( function() {
  14343. // Ensure the complete handler is called before this completes
  14344. anim.always( function() {
  14345. hooks.unqueued--;
  14346. if ( !jQuery.queue( elem, "fx" ).length ) {
  14347. hooks.empty.fire();
  14348. }
  14349. } );
  14350. } );
  14351. }
  14352. // Detect show/hide animations
  14353. for ( prop in props ) {
  14354. value = props[ prop ];
  14355. if ( rfxtypes.test( value ) ) {
  14356. delete props[ prop ];
  14357. toggle = toggle || value === "toggle";
  14358. if ( value === ( hidden ? "hide" : "show" ) ) {
  14359. // Pretend to be hidden if this is a "show" and
  14360. // there is still data from a stopped show/hide
  14361. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  14362. hidden = true;
  14363. // Ignore all other no-op show/hide data
  14364. } else {
  14365. continue;
  14366. }
  14367. }
  14368. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  14369. }
  14370. }
  14371. // Bail out if this is a no-op like .hide().hide()
  14372. propTween = !jQuery.isEmptyObject( props );
  14373. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  14374. return;
  14375. }
  14376. // Restrict "overflow" and "display" styles during box animations
  14377. if ( isBox && elem.nodeType === 1 ) {
  14378. // Support: IE <=9 - 11, Edge 12 - 15
  14379. // Record all 3 overflow attributes because IE does not infer the shorthand
  14380. // from identically-valued overflowX and overflowY and Edge just mirrors
  14381. // the overflowX value there.
  14382. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  14383. // Identify a display type, preferring old show/hide data over the CSS cascade
  14384. restoreDisplay = dataShow && dataShow.display;
  14385. if ( restoreDisplay == null ) {
  14386. restoreDisplay = dataPriv.get( elem, "display" );
  14387. }
  14388. display = jQuery.css( elem, "display" );
  14389. if ( display === "none" ) {
  14390. if ( restoreDisplay ) {
  14391. display = restoreDisplay;
  14392. } else {
  14393. // Get nonempty value(s) by temporarily forcing visibility
  14394. showHide( [ elem ], true );
  14395. restoreDisplay = elem.style.display || restoreDisplay;
  14396. display = jQuery.css( elem, "display" );
  14397. showHide( [ elem ] );
  14398. }
  14399. }
  14400. // Animate inline elements as inline-block
  14401. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  14402. if ( jQuery.css( elem, "float" ) === "none" ) {
  14403. // Restore the original display value at the end of pure show/hide animations
  14404. if ( !propTween ) {
  14405. anim.done( function() {
  14406. style.display = restoreDisplay;
  14407. } );
  14408. if ( restoreDisplay == null ) {
  14409. display = style.display;
  14410. restoreDisplay = display === "none" ? "" : display;
  14411. }
  14412. }
  14413. style.display = "inline-block";
  14414. }
  14415. }
  14416. }
  14417. if ( opts.overflow ) {
  14418. style.overflow = "hidden";
  14419. anim.always( function() {
  14420. style.overflow = opts.overflow[ 0 ];
  14421. style.overflowX = opts.overflow[ 1 ];
  14422. style.overflowY = opts.overflow[ 2 ];
  14423. } );
  14424. }
  14425. // Implement show/hide animations
  14426. propTween = false;
  14427. for ( prop in orig ) {
  14428. // General show/hide setup for this element animation
  14429. if ( !propTween ) {
  14430. if ( dataShow ) {
  14431. if ( "hidden" in dataShow ) {
  14432. hidden = dataShow.hidden;
  14433. }
  14434. } else {
  14435. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  14436. }
  14437. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  14438. if ( toggle ) {
  14439. dataShow.hidden = !hidden;
  14440. }
  14441. // Show elements before animating them
  14442. if ( hidden ) {
  14443. showHide( [ elem ], true );
  14444. }
  14445. /* eslint-disable no-loop-func */
  14446. anim.done( function() {
  14447. /* eslint-enable no-loop-func */
  14448. // The final step of a "hide" animation is actually hiding the element
  14449. if ( !hidden ) {
  14450. showHide( [ elem ] );
  14451. }
  14452. dataPriv.remove( elem, "fxshow" );
  14453. for ( prop in orig ) {
  14454. jQuery.style( elem, prop, orig[ prop ] );
  14455. }
  14456. } );
  14457. }
  14458. // Per-property setup
  14459. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  14460. if ( !( prop in dataShow ) ) {
  14461. dataShow[ prop ] = propTween.start;
  14462. if ( hidden ) {
  14463. propTween.end = propTween.start;
  14464. propTween.start = 0;
  14465. }
  14466. }
  14467. }
  14468. }
  14469. function propFilter( props, specialEasing ) {
  14470. var index, name, easing, value, hooks;
  14471. // camelCase, specialEasing and expand cssHook pass
  14472. for ( index in props ) {
  14473. name = camelCase( index );
  14474. easing = specialEasing[ name ];
  14475. value = props[ index ];
  14476. if ( Array.isArray( value ) ) {
  14477. easing = value[ 1 ];
  14478. value = props[ index ] = value[ 0 ];
  14479. }
  14480. if ( index !== name ) {
  14481. props[ name ] = value;
  14482. delete props[ index ];
  14483. }
  14484. hooks = jQuery.cssHooks[ name ];
  14485. if ( hooks && "expand" in hooks ) {
  14486. value = hooks.expand( value );
  14487. delete props[ name ];
  14488. // Not quite $.extend, this won't overwrite existing keys.
  14489. // Reusing 'index' because we have the correct "name"
  14490. for ( index in value ) {
  14491. if ( !( index in props ) ) {
  14492. props[ index ] = value[ index ];
  14493. specialEasing[ index ] = easing;
  14494. }
  14495. }
  14496. } else {
  14497. specialEasing[ name ] = easing;
  14498. }
  14499. }
  14500. }
  14501. function Animation( elem, properties, options ) {
  14502. var result,
  14503. stopped,
  14504. index = 0,
  14505. length = Animation.prefilters.length,
  14506. deferred = jQuery.Deferred().always( function() {
  14507. // Don't match elem in the :animated selector
  14508. delete tick.elem;
  14509. } ),
  14510. tick = function() {
  14511. if ( stopped ) {
  14512. return false;
  14513. }
  14514. var currentTime = fxNow || createFxNow(),
  14515. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  14516. // Support: Android 2.3 only
  14517. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  14518. temp = remaining / animation.duration || 0,
  14519. percent = 1 - temp,
  14520. index = 0,
  14521. length = animation.tweens.length;
  14522. for ( ; index < length; index++ ) {
  14523. animation.tweens[ index ].run( percent );
  14524. }
  14525. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  14526. // If there's more to do, yield
  14527. if ( percent < 1 && length ) {
  14528. return remaining;
  14529. }
  14530. // If this was an empty animation, synthesize a final progress notification
  14531. if ( !length ) {
  14532. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14533. }
  14534. // Resolve the animation and report its conclusion
  14535. deferred.resolveWith( elem, [ animation ] );
  14536. return false;
  14537. },
  14538. animation = deferred.promise( {
  14539. elem: elem,
  14540. props: jQuery.extend( {}, properties ),
  14541. opts: jQuery.extend( true, {
  14542. specialEasing: {},
  14543. easing: jQuery.easing._default
  14544. }, options ),
  14545. originalProperties: properties,
  14546. originalOptions: options,
  14547. startTime: fxNow || createFxNow(),
  14548. duration: options.duration,
  14549. tweens: [],
  14550. createTween: function( prop, end ) {
  14551. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  14552. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  14553. animation.tweens.push( tween );
  14554. return tween;
  14555. },
  14556. stop: function( gotoEnd ) {
  14557. var index = 0,
  14558. // If we are going to the end, we want to run all the tweens
  14559. // otherwise we skip this part
  14560. length = gotoEnd ? animation.tweens.length : 0;
  14561. if ( stopped ) {
  14562. return this;
  14563. }
  14564. stopped = true;
  14565. for ( ; index < length; index++ ) {
  14566. animation.tweens[ index ].run( 1 );
  14567. }
  14568. // Resolve when we played the last frame; otherwise, reject
  14569. if ( gotoEnd ) {
  14570. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14571. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  14572. } else {
  14573. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  14574. }
  14575. return this;
  14576. }
  14577. } ),
  14578. props = animation.props;
  14579. propFilter( props, animation.opts.specialEasing );
  14580. for ( ; index < length; index++ ) {
  14581. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  14582. if ( result ) {
  14583. if ( isFunction( result.stop ) ) {
  14584. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  14585. result.stop.bind( result );
  14586. }
  14587. return result;
  14588. }
  14589. }
  14590. jQuery.map( props, createTween, animation );
  14591. if ( isFunction( animation.opts.start ) ) {
  14592. animation.opts.start.call( elem, animation );
  14593. }
  14594. // Attach callbacks from options
  14595. animation
  14596. .progress( animation.opts.progress )
  14597. .done( animation.opts.done, animation.opts.complete )
  14598. .fail( animation.opts.fail )
  14599. .always( animation.opts.always );
  14600. jQuery.fx.timer(
  14601. jQuery.extend( tick, {
  14602. elem: elem,
  14603. anim: animation,
  14604. queue: animation.opts.queue
  14605. } )
  14606. );
  14607. return animation;
  14608. }
  14609. jQuery.Animation = jQuery.extend( Animation, {
  14610. tweeners: {
  14611. "*": [ function( prop, value ) {
  14612. var tween = this.createTween( prop, value );
  14613. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  14614. return tween;
  14615. } ]
  14616. },
  14617. tweener: function( props, callback ) {
  14618. if ( isFunction( props ) ) {
  14619. callback = props;
  14620. props = [ "*" ];
  14621. } else {
  14622. props = props.match( rnothtmlwhite );
  14623. }
  14624. var prop,
  14625. index = 0,
  14626. length = props.length;
  14627. for ( ; index < length; index++ ) {
  14628. prop = props[ index ];
  14629. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  14630. Animation.tweeners[ prop ].unshift( callback );
  14631. }
  14632. },
  14633. prefilters: [ defaultPrefilter ],
  14634. prefilter: function( callback, prepend ) {
  14635. if ( prepend ) {
  14636. Animation.prefilters.unshift( callback );
  14637. } else {
  14638. Animation.prefilters.push( callback );
  14639. }
  14640. }
  14641. } );
  14642. jQuery.speed = function( speed, easing, fn ) {
  14643. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  14644. complete: fn || !fn && easing ||
  14645. isFunction( speed ) && speed,
  14646. duration: speed,
  14647. easing: fn && easing || easing && !isFunction( easing ) && easing
  14648. };
  14649. // Go to the end state if fx are off
  14650. if ( jQuery.fx.off ) {
  14651. opt.duration = 0;
  14652. } else {
  14653. if ( typeof opt.duration !== "number" ) {
  14654. if ( opt.duration in jQuery.fx.speeds ) {
  14655. opt.duration = jQuery.fx.speeds[ opt.duration ];
  14656. } else {
  14657. opt.duration = jQuery.fx.speeds._default;
  14658. }
  14659. }
  14660. }
  14661. // Normalize opt.queue - true/undefined/null -> "fx"
  14662. if ( opt.queue == null || opt.queue === true ) {
  14663. opt.queue = "fx";
  14664. }
  14665. // Queueing
  14666. opt.old = opt.complete;
  14667. opt.complete = function() {
  14668. if ( isFunction( opt.old ) ) {
  14669. opt.old.call( this );
  14670. }
  14671. if ( opt.queue ) {
  14672. jQuery.dequeue( this, opt.queue );
  14673. }
  14674. };
  14675. return opt;
  14676. };
  14677. jQuery.fn.extend( {
  14678. fadeTo: function( speed, to, easing, callback ) {
  14679. // Show any hidden elements after setting opacity to 0
  14680. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  14681. // Animate to the value specified
  14682. .end().animate( { opacity: to }, speed, easing, callback );
  14683. },
  14684. animate: function( prop, speed, easing, callback ) {
  14685. var empty = jQuery.isEmptyObject( prop ),
  14686. optall = jQuery.speed( speed, easing, callback ),
  14687. doAnimation = function() {
  14688. // Operate on a copy of prop so per-property easing won't be lost
  14689. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  14690. // Empty animations, or finishing resolves immediately
  14691. if ( empty || dataPriv.get( this, "finish" ) ) {
  14692. anim.stop( true );
  14693. }
  14694. };
  14695. doAnimation.finish = doAnimation;
  14696. return empty || optall.queue === false ?
  14697. this.each( doAnimation ) :
  14698. this.queue( optall.queue, doAnimation );
  14699. },
  14700. stop: function( type, clearQueue, gotoEnd ) {
  14701. var stopQueue = function( hooks ) {
  14702. var stop = hooks.stop;
  14703. delete hooks.stop;
  14704. stop( gotoEnd );
  14705. };
  14706. if ( typeof type !== "string" ) {
  14707. gotoEnd = clearQueue;
  14708. clearQueue = type;
  14709. type = undefined;
  14710. }
  14711. if ( clearQueue && type !== false ) {
  14712. this.queue( type || "fx", [] );
  14713. }
  14714. return this.each( function() {
  14715. var dequeue = true,
  14716. index = type != null && type + "queueHooks",
  14717. timers = jQuery.timers,
  14718. data = dataPriv.get( this );
  14719. if ( index ) {
  14720. if ( data[ index ] && data[ index ].stop ) {
  14721. stopQueue( data[ index ] );
  14722. }
  14723. } else {
  14724. for ( index in data ) {
  14725. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  14726. stopQueue( data[ index ] );
  14727. }
  14728. }
  14729. }
  14730. for ( index = timers.length; index--; ) {
  14731. if ( timers[ index ].elem === this &&
  14732. ( type == null || timers[ index ].queue === type ) ) {
  14733. timers[ index ].anim.stop( gotoEnd );
  14734. dequeue = false;
  14735. timers.splice( index, 1 );
  14736. }
  14737. }
  14738. // Start the next in the queue if the last step wasn't forced.
  14739. // Timers currently will call their complete callbacks, which
  14740. // will dequeue but only if they were gotoEnd.
  14741. if ( dequeue || !gotoEnd ) {
  14742. jQuery.dequeue( this, type );
  14743. }
  14744. } );
  14745. },
  14746. finish: function( type ) {
  14747. if ( type !== false ) {
  14748. type = type || "fx";
  14749. }
  14750. return this.each( function() {
  14751. var index,
  14752. data = dataPriv.get( this ),
  14753. queue = data[ type + "queue" ],
  14754. hooks = data[ type + "queueHooks" ],
  14755. timers = jQuery.timers,
  14756. length = queue ? queue.length : 0;
  14757. // Enable finishing flag on private data
  14758. data.finish = true;
  14759. // Empty the queue first
  14760. jQuery.queue( this, type, [] );
  14761. if ( hooks && hooks.stop ) {
  14762. hooks.stop.call( this, true );
  14763. }
  14764. // Look for any active animations, and finish them
  14765. for ( index = timers.length; index--; ) {
  14766. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  14767. timers[ index ].anim.stop( true );
  14768. timers.splice( index, 1 );
  14769. }
  14770. }
  14771. // Look for any animations in the old queue and finish them
  14772. for ( index = 0; index < length; index++ ) {
  14773. if ( queue[ index ] && queue[ index ].finish ) {
  14774. queue[ index ].finish.call( this );
  14775. }
  14776. }
  14777. // Turn off finishing flag
  14778. delete data.finish;
  14779. } );
  14780. }
  14781. } );
  14782. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  14783. var cssFn = jQuery.fn[ name ];
  14784. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14785. return speed == null || typeof speed === "boolean" ?
  14786. cssFn.apply( this, arguments ) :
  14787. this.animate( genFx( name, true ), speed, easing, callback );
  14788. };
  14789. } );
  14790. // Generate shortcuts for custom animations
  14791. jQuery.each( {
  14792. slideDown: genFx( "show" ),
  14793. slideUp: genFx( "hide" ),
  14794. slideToggle: genFx( "toggle" ),
  14795. fadeIn: { opacity: "show" },
  14796. fadeOut: { opacity: "hide" },
  14797. fadeToggle: { opacity: "toggle" }
  14798. }, function( name, props ) {
  14799. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14800. return this.animate( props, speed, easing, callback );
  14801. };
  14802. } );
  14803. jQuery.timers = [];
  14804. jQuery.fx.tick = function() {
  14805. var timer,
  14806. i = 0,
  14807. timers = jQuery.timers;
  14808. fxNow = Date.now();
  14809. for ( ; i < timers.length; i++ ) {
  14810. timer = timers[ i ];
  14811. // Run the timer and safely remove it when done (allowing for external removal)
  14812. if ( !timer() && timers[ i ] === timer ) {
  14813. timers.splice( i--, 1 );
  14814. }
  14815. }
  14816. if ( !timers.length ) {
  14817. jQuery.fx.stop();
  14818. }
  14819. fxNow = undefined;
  14820. };
  14821. jQuery.fx.timer = function( timer ) {
  14822. jQuery.timers.push( timer );
  14823. jQuery.fx.start();
  14824. };
  14825. jQuery.fx.interval = 13;
  14826. jQuery.fx.start = function() {
  14827. if ( inProgress ) {
  14828. return;
  14829. }
  14830. inProgress = true;
  14831. schedule();
  14832. };
  14833. jQuery.fx.stop = function() {
  14834. inProgress = null;
  14835. };
  14836. jQuery.fx.speeds = {
  14837. slow: 600,
  14838. fast: 200,
  14839. // Default speed
  14840. _default: 400
  14841. };
  14842. // Based off of the plugin by Clint Helfers, with permission.
  14843. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  14844. jQuery.fn.delay = function( time, type ) {
  14845. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  14846. type = type || "fx";
  14847. return this.queue( type, function( next, hooks ) {
  14848. var timeout = window.setTimeout( next, time );
  14849. hooks.stop = function() {
  14850. window.clearTimeout( timeout );
  14851. };
  14852. } );
  14853. };
  14854. ( function() {
  14855. var input = document.createElement( "input" ),
  14856. select = document.createElement( "select" ),
  14857. opt = select.appendChild( document.createElement( "option" ) );
  14858. input.type = "checkbox";
  14859. // Support: Android <=4.3 only
  14860. // Default value for a checkbox should be "on"
  14861. support.checkOn = input.value !== "";
  14862. // Support: IE <=11 only
  14863. // Must access selectedIndex to make default options select
  14864. support.optSelected = opt.selected;
  14865. // Support: IE <=11 only
  14866. // An input loses its value after becoming a radio
  14867. input = document.createElement( "input" );
  14868. input.value = "t";
  14869. input.type = "radio";
  14870. support.radioValue = input.value === "t";
  14871. } )();
  14872. var boolHook,
  14873. attrHandle = jQuery.expr.attrHandle;
  14874. jQuery.fn.extend( {
  14875. attr: function( name, value ) {
  14876. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  14877. },
  14878. removeAttr: function( name ) {
  14879. return this.each( function() {
  14880. jQuery.removeAttr( this, name );
  14881. } );
  14882. }
  14883. } );
  14884. jQuery.extend( {
  14885. attr: function( elem, name, value ) {
  14886. var ret, hooks,
  14887. nType = elem.nodeType;
  14888. // Don't get/set attributes on text, comment and attribute nodes
  14889. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14890. return;
  14891. }
  14892. // Fallback to prop when attributes are not supported
  14893. if ( typeof elem.getAttribute === "undefined" ) {
  14894. return jQuery.prop( elem, name, value );
  14895. }
  14896. // Attribute hooks are determined by the lowercase version
  14897. // Grab necessary hook if one is defined
  14898. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14899. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  14900. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  14901. }
  14902. if ( value !== undefined ) {
  14903. if ( value === null ) {
  14904. jQuery.removeAttr( elem, name );
  14905. return;
  14906. }
  14907. if ( hooks && "set" in hooks &&
  14908. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14909. return ret;
  14910. }
  14911. elem.setAttribute( name, value + "" );
  14912. return value;
  14913. }
  14914. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  14915. return ret;
  14916. }
  14917. ret = jQuery.find.attr( elem, name );
  14918. // Non-existent attributes return null, we normalize to undefined
  14919. return ret == null ? undefined : ret;
  14920. },
  14921. attrHooks: {
  14922. type: {
  14923. set: function( elem, value ) {
  14924. if ( !support.radioValue && value === "radio" &&
  14925. nodeName( elem, "input" ) ) {
  14926. var val = elem.value;
  14927. elem.setAttribute( "type", value );
  14928. if ( val ) {
  14929. elem.value = val;
  14930. }
  14931. return value;
  14932. }
  14933. }
  14934. }
  14935. },
  14936. removeAttr: function( elem, value ) {
  14937. var name,
  14938. i = 0,
  14939. // Attribute names can contain non-HTML whitespace characters
  14940. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  14941. attrNames = value && value.match( rnothtmlwhite );
  14942. if ( attrNames && elem.nodeType === 1 ) {
  14943. while ( ( name = attrNames[ i++ ] ) ) {
  14944. elem.removeAttribute( name );
  14945. }
  14946. }
  14947. }
  14948. } );
  14949. // Hooks for boolean attributes
  14950. boolHook = {
  14951. set: function( elem, value, name ) {
  14952. if ( value === false ) {
  14953. // Remove boolean attributes when set to false
  14954. jQuery.removeAttr( elem, name );
  14955. } else {
  14956. elem.setAttribute( name, name );
  14957. }
  14958. return name;
  14959. }
  14960. };
  14961. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  14962. var getter = attrHandle[ name ] || jQuery.find.attr;
  14963. attrHandle[ name ] = function( elem, name, isXML ) {
  14964. var ret, handle,
  14965. lowercaseName = name.toLowerCase();
  14966. if ( !isXML ) {
  14967. // Avoid an infinite loop by temporarily removing this function from the getter
  14968. handle = attrHandle[ lowercaseName ];
  14969. attrHandle[ lowercaseName ] = ret;
  14970. ret = getter( elem, name, isXML ) != null ?
  14971. lowercaseName :
  14972. null;
  14973. attrHandle[ lowercaseName ] = handle;
  14974. }
  14975. return ret;
  14976. };
  14977. } );
  14978. var rfocusable = /^(?:input|select|textarea|button)$/i,
  14979. rclickable = /^(?:a|area)$/i;
  14980. jQuery.fn.extend( {
  14981. prop: function( name, value ) {
  14982. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  14983. },
  14984. removeProp: function( name ) {
  14985. return this.each( function() {
  14986. delete this[ jQuery.propFix[ name ] || name ];
  14987. } );
  14988. }
  14989. } );
  14990. jQuery.extend( {
  14991. prop: function( elem, name, value ) {
  14992. var ret, hooks,
  14993. nType = elem.nodeType;
  14994. // Don't get/set properties on text, comment and attribute nodes
  14995. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14996. return;
  14997. }
  14998. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14999. // Fix name and attach hooks
  15000. name = jQuery.propFix[ name ] || name;
  15001. hooks = jQuery.propHooks[ name ];
  15002. }
  15003. if ( value !== undefined ) {
  15004. if ( hooks && "set" in hooks &&
  15005. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15006. return ret;
  15007. }
  15008. return ( elem[ name ] = value );
  15009. }
  15010. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15011. return ret;
  15012. }
  15013. return elem[ name ];
  15014. },
  15015. propHooks: {
  15016. tabIndex: {
  15017. get: function( elem ) {
  15018. // Support: IE <=9 - 11 only
  15019. // elem.tabIndex doesn't always return the
  15020. // correct value when it hasn't been explicitly set
  15021. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  15022. // Use proper attribute retrieval(#12072)
  15023. var tabindex = jQuery.find.attr( elem, "tabindex" );
  15024. if ( tabindex ) {
  15025. return parseInt( tabindex, 10 );
  15026. }
  15027. if (
  15028. rfocusable.test( elem.nodeName ) ||
  15029. rclickable.test( elem.nodeName ) &&
  15030. elem.href
  15031. ) {
  15032. return 0;
  15033. }
  15034. return -1;
  15035. }
  15036. }
  15037. },
  15038. propFix: {
  15039. "for": "htmlFor",
  15040. "class": "className"
  15041. }
  15042. } );
  15043. // Support: IE <=11 only
  15044. // Accessing the selectedIndex property
  15045. // forces the browser to respect setting selected
  15046. // on the option
  15047. // The getter ensures a default option is selected
  15048. // when in an optgroup
  15049. // eslint rule "no-unused-expressions" is disabled for this code
  15050. // since it considers such accessions noop
  15051. if ( !support.optSelected ) {
  15052. jQuery.propHooks.selected = {
  15053. get: function( elem ) {
  15054. /* eslint no-unused-expressions: "off" */
  15055. var parent = elem.parentNode;
  15056. if ( parent && parent.parentNode ) {
  15057. parent.parentNode.selectedIndex;
  15058. }
  15059. return null;
  15060. },
  15061. set: function( elem ) {
  15062. /* eslint no-unused-expressions: "off" */
  15063. var parent = elem.parentNode;
  15064. if ( parent ) {
  15065. parent.selectedIndex;
  15066. if ( parent.parentNode ) {
  15067. parent.parentNode.selectedIndex;
  15068. }
  15069. }
  15070. }
  15071. };
  15072. }
  15073. jQuery.each( [
  15074. "tabIndex",
  15075. "readOnly",
  15076. "maxLength",
  15077. "cellSpacing",
  15078. "cellPadding",
  15079. "rowSpan",
  15080. "colSpan",
  15081. "useMap",
  15082. "frameBorder",
  15083. "contentEditable"
  15084. ], function() {
  15085. jQuery.propFix[ this.toLowerCase() ] = this;
  15086. } );
  15087. // Strip and collapse whitespace according to HTML spec
  15088. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  15089. function stripAndCollapse( value ) {
  15090. var tokens = value.match( rnothtmlwhite ) || [];
  15091. return tokens.join( " " );
  15092. }
  15093. function getClass( elem ) {
  15094. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  15095. }
  15096. function classesToArray( value ) {
  15097. if ( Array.isArray( value ) ) {
  15098. return value;
  15099. }
  15100. if ( typeof value === "string" ) {
  15101. return value.match( rnothtmlwhite ) || [];
  15102. }
  15103. return [];
  15104. }
  15105. jQuery.fn.extend( {
  15106. addClass: function( value ) {
  15107. var classes, elem, cur, curValue, clazz, j, finalValue,
  15108. i = 0;
  15109. if ( isFunction( value ) ) {
  15110. return this.each( function( j ) {
  15111. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  15112. } );
  15113. }
  15114. classes = classesToArray( value );
  15115. if ( classes.length ) {
  15116. while ( ( elem = this[ i++ ] ) ) {
  15117. curValue = getClass( elem );
  15118. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15119. if ( cur ) {
  15120. j = 0;
  15121. while ( ( clazz = classes[ j++ ] ) ) {
  15122. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  15123. cur += clazz + " ";
  15124. }
  15125. }
  15126. // Only assign if different to avoid unneeded rendering.
  15127. finalValue = stripAndCollapse( cur );
  15128. if ( curValue !== finalValue ) {
  15129. elem.setAttribute( "class", finalValue );
  15130. }
  15131. }
  15132. }
  15133. }
  15134. return this;
  15135. },
  15136. removeClass: function( value ) {
  15137. var classes, elem, cur, curValue, clazz, j, finalValue,
  15138. i = 0;
  15139. if ( isFunction( value ) ) {
  15140. return this.each( function( j ) {
  15141. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  15142. } );
  15143. }
  15144. if ( !arguments.length ) {
  15145. return this.attr( "class", "" );
  15146. }
  15147. classes = classesToArray( value );
  15148. if ( classes.length ) {
  15149. while ( ( elem = this[ i++ ] ) ) {
  15150. curValue = getClass( elem );
  15151. // This expression is here for better compressibility (see addClass)
  15152. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15153. if ( cur ) {
  15154. j = 0;
  15155. while ( ( clazz = classes[ j++ ] ) ) {
  15156. // Remove *all* instances
  15157. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  15158. cur = cur.replace( " " + clazz + " ", " " );
  15159. }
  15160. }
  15161. // Only assign if different to avoid unneeded rendering.
  15162. finalValue = stripAndCollapse( cur );
  15163. if ( curValue !== finalValue ) {
  15164. elem.setAttribute( "class", finalValue );
  15165. }
  15166. }
  15167. }
  15168. }
  15169. return this;
  15170. },
  15171. toggleClass: function( value, stateVal ) {
  15172. var type = typeof value,
  15173. isValidValue = type === "string" || Array.isArray( value );
  15174. if ( typeof stateVal === "boolean" && isValidValue ) {
  15175. return stateVal ? this.addClass( value ) : this.removeClass( value );
  15176. }
  15177. if ( isFunction( value ) ) {
  15178. return this.each( function( i ) {
  15179. jQuery( this ).toggleClass(
  15180. value.call( this, i, getClass( this ), stateVal ),
  15181. stateVal
  15182. );
  15183. } );
  15184. }
  15185. return this.each( function() {
  15186. var className, i, self, classNames;
  15187. if ( isValidValue ) {
  15188. // Toggle individual class names
  15189. i = 0;
  15190. self = jQuery( this );
  15191. classNames = classesToArray( value );
  15192. while ( ( className = classNames[ i++ ] ) ) {
  15193. // Check each className given, space separated list
  15194. if ( self.hasClass( className ) ) {
  15195. self.removeClass( className );
  15196. } else {
  15197. self.addClass( className );
  15198. }
  15199. }
  15200. // Toggle whole class name
  15201. } else if ( value === undefined || type === "boolean" ) {
  15202. className = getClass( this );
  15203. if ( className ) {
  15204. // Store className if set
  15205. dataPriv.set( this, "__className__", className );
  15206. }
  15207. // If the element has a class name or if we're passed `false`,
  15208. // then remove the whole classname (if there was one, the above saved it).
  15209. // Otherwise bring back whatever was previously saved (if anything),
  15210. // falling back to the empty string if nothing was stored.
  15211. if ( this.setAttribute ) {
  15212. this.setAttribute( "class",
  15213. className || value === false ?
  15214. "" :
  15215. dataPriv.get( this, "__className__" ) || ""
  15216. );
  15217. }
  15218. }
  15219. } );
  15220. },
  15221. hasClass: function( selector ) {
  15222. var className, elem,
  15223. i = 0;
  15224. className = " " + selector + " ";
  15225. while ( ( elem = this[ i++ ] ) ) {
  15226. if ( elem.nodeType === 1 &&
  15227. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  15228. return true;
  15229. }
  15230. }
  15231. return false;
  15232. }
  15233. } );
  15234. var rreturn = /\r/g;
  15235. jQuery.fn.extend( {
  15236. val: function( value ) {
  15237. var hooks, ret, valueIsFunction,
  15238. elem = this[ 0 ];
  15239. if ( !arguments.length ) {
  15240. if ( elem ) {
  15241. hooks = jQuery.valHooks[ elem.type ] ||
  15242. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  15243. if ( hooks &&
  15244. "get" in hooks &&
  15245. ( ret = hooks.get( elem, "value" ) ) !== undefined
  15246. ) {
  15247. return ret;
  15248. }
  15249. ret = elem.value;
  15250. // Handle most common string cases
  15251. if ( typeof ret === "string" ) {
  15252. return ret.replace( rreturn, "" );
  15253. }
  15254. // Handle cases where value is null/undef or number
  15255. return ret == null ? "" : ret;
  15256. }
  15257. return;
  15258. }
  15259. valueIsFunction = isFunction( value );
  15260. return this.each( function( i ) {
  15261. var val;
  15262. if ( this.nodeType !== 1 ) {
  15263. return;
  15264. }
  15265. if ( valueIsFunction ) {
  15266. val = value.call( this, i, jQuery( this ).val() );
  15267. } else {
  15268. val = value;
  15269. }
  15270. // Treat null/undefined as ""; convert numbers to string
  15271. if ( val == null ) {
  15272. val = "";
  15273. } else if ( typeof val === "number" ) {
  15274. val += "";
  15275. } else if ( Array.isArray( val ) ) {
  15276. val = jQuery.map( val, function( value ) {
  15277. return value == null ? "" : value + "";
  15278. } );
  15279. }
  15280. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  15281. // If set returns undefined, fall back to normal setting
  15282. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  15283. this.value = val;
  15284. }
  15285. } );
  15286. }
  15287. } );
  15288. jQuery.extend( {
  15289. valHooks: {
  15290. option: {
  15291. get: function( elem ) {
  15292. var val = jQuery.find.attr( elem, "value" );
  15293. return val != null ?
  15294. val :
  15295. // Support: IE <=10 - 11 only
  15296. // option.text throws exceptions (#14686, #14858)
  15297. // Strip and collapse whitespace
  15298. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  15299. stripAndCollapse( jQuery.text( elem ) );
  15300. }
  15301. },
  15302. select: {
  15303. get: function( elem ) {
  15304. var value, option, i,
  15305. options = elem.options,
  15306. index = elem.selectedIndex,
  15307. one = elem.type === "select-one",
  15308. values = one ? null : [],
  15309. max = one ? index + 1 : options.length;
  15310. if ( index < 0 ) {
  15311. i = max;
  15312. } else {
  15313. i = one ? index : 0;
  15314. }
  15315. // Loop through all the selected options
  15316. for ( ; i < max; i++ ) {
  15317. option = options[ i ];
  15318. // Support: IE <=9 only
  15319. // IE8-9 doesn't update selected after form reset (#2551)
  15320. if ( ( option.selected || i === index ) &&
  15321. // Don't return options that are disabled or in a disabled optgroup
  15322. !option.disabled &&
  15323. ( !option.parentNode.disabled ||
  15324. !nodeName( option.parentNode, "optgroup" ) ) ) {
  15325. // Get the specific value for the option
  15326. value = jQuery( option ).val();
  15327. // We don't need an array for one selects
  15328. if ( one ) {
  15329. return value;
  15330. }
  15331. // Multi-Selects return an array
  15332. values.push( value );
  15333. }
  15334. }
  15335. return values;
  15336. },
  15337. set: function( elem, value ) {
  15338. var optionSet, option,
  15339. options = elem.options,
  15340. values = jQuery.makeArray( value ),
  15341. i = options.length;
  15342. while ( i-- ) {
  15343. option = options[ i ];
  15344. /* eslint-disable no-cond-assign */
  15345. if ( option.selected =
  15346. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  15347. ) {
  15348. optionSet = true;
  15349. }
  15350. /* eslint-enable no-cond-assign */
  15351. }
  15352. // Force browsers to behave consistently when non-matching value is set
  15353. if ( !optionSet ) {
  15354. elem.selectedIndex = -1;
  15355. }
  15356. return values;
  15357. }
  15358. }
  15359. }
  15360. } );
  15361. // Radios and checkboxes getter/setter
  15362. jQuery.each( [ "radio", "checkbox" ], function() {
  15363. jQuery.valHooks[ this ] = {
  15364. set: function( elem, value ) {
  15365. if ( Array.isArray( value ) ) {
  15366. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  15367. }
  15368. }
  15369. };
  15370. if ( !support.checkOn ) {
  15371. jQuery.valHooks[ this ].get = function( elem ) {
  15372. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  15373. };
  15374. }
  15375. } );
  15376. // Return jQuery for attributes-only inclusion
  15377. support.focusin = "onfocusin" in window;
  15378. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  15379. stopPropagationCallback = function( e ) {
  15380. e.stopPropagation();
  15381. };
  15382. jQuery.extend( jQuery.event, {
  15383. trigger: function( event, data, elem, onlyHandlers ) {
  15384. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  15385. eventPath = [ elem || document ],
  15386. type = hasOwn.call( event, "type" ) ? event.type : event,
  15387. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  15388. cur = lastElement = tmp = elem = elem || document;
  15389. // Don't do events on text and comment nodes
  15390. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  15391. return;
  15392. }
  15393. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  15394. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  15395. return;
  15396. }
  15397. if ( type.indexOf( "." ) > -1 ) {
  15398. // Namespaced trigger; create a regexp to match event type in handle()
  15399. namespaces = type.split( "." );
  15400. type = namespaces.shift();
  15401. namespaces.sort();
  15402. }
  15403. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  15404. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  15405. event = event[ jQuery.expando ] ?
  15406. event :
  15407. new jQuery.Event( type, typeof event === "object" && event );
  15408. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  15409. event.isTrigger = onlyHandlers ? 2 : 3;
  15410. event.namespace = namespaces.join( "." );
  15411. event.rnamespace = event.namespace ?
  15412. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  15413. null;
  15414. // Clean up the event in case it is being reused
  15415. event.result = undefined;
  15416. if ( !event.target ) {
  15417. event.target = elem;
  15418. }
  15419. // Clone any incoming data and prepend the event, creating the handler arg list
  15420. data = data == null ?
  15421. [ event ] :
  15422. jQuery.makeArray( data, [ event ] );
  15423. // Allow special events to draw outside the lines
  15424. special = jQuery.event.special[ type ] || {};
  15425. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  15426. return;
  15427. }
  15428. // Determine event propagation path in advance, per W3C events spec (#9951)
  15429. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  15430. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  15431. bubbleType = special.delegateType || type;
  15432. if ( !rfocusMorph.test( bubbleType + type ) ) {
  15433. cur = cur.parentNode;
  15434. }
  15435. for ( ; cur; cur = cur.parentNode ) {
  15436. eventPath.push( cur );
  15437. tmp = cur;
  15438. }
  15439. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  15440. if ( tmp === ( elem.ownerDocument || document ) ) {
  15441. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  15442. }
  15443. }
  15444. // Fire handlers on the event path
  15445. i = 0;
  15446. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  15447. lastElement = cur;
  15448. event.type = i > 1 ?
  15449. bubbleType :
  15450. special.bindType || type;
  15451. // jQuery handler
  15452. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  15453. dataPriv.get( cur, "handle" );
  15454. if ( handle ) {
  15455. handle.apply( cur, data );
  15456. }
  15457. // Native handler
  15458. handle = ontype && cur[ ontype ];
  15459. if ( handle && handle.apply && acceptData( cur ) ) {
  15460. event.result = handle.apply( cur, data );
  15461. if ( event.result === false ) {
  15462. event.preventDefault();
  15463. }
  15464. }
  15465. }
  15466. event.type = type;
  15467. // If nobody prevented the default action, do it now
  15468. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  15469. if ( ( !special._default ||
  15470. special._default.apply( eventPath.pop(), data ) === false ) &&
  15471. acceptData( elem ) ) {
  15472. // Call a native DOM method on the target with the same name as the event.
  15473. // Don't do default actions on window, that's where global variables be (#6170)
  15474. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  15475. // Don't re-trigger an onFOO event when we call its FOO() method
  15476. tmp = elem[ ontype ];
  15477. if ( tmp ) {
  15478. elem[ ontype ] = null;
  15479. }
  15480. // Prevent re-triggering of the same event, since we already bubbled it above
  15481. jQuery.event.triggered = type;
  15482. if ( event.isPropagationStopped() ) {
  15483. lastElement.addEventListener( type, stopPropagationCallback );
  15484. }
  15485. elem[ type ]();
  15486. if ( event.isPropagationStopped() ) {
  15487. lastElement.removeEventListener( type, stopPropagationCallback );
  15488. }
  15489. jQuery.event.triggered = undefined;
  15490. if ( tmp ) {
  15491. elem[ ontype ] = tmp;
  15492. }
  15493. }
  15494. }
  15495. }
  15496. return event.result;
  15497. },
  15498. // Piggyback on a donor event to simulate a different one
  15499. // Used only for `focus(in | out)` events
  15500. simulate: function( type, elem, event ) {
  15501. var e = jQuery.extend(
  15502. new jQuery.Event(),
  15503. event,
  15504. {
  15505. type: type,
  15506. isSimulated: true
  15507. }
  15508. );
  15509. jQuery.event.trigger( e, null, elem );
  15510. }
  15511. } );
  15512. jQuery.fn.extend( {
  15513. trigger: function( type, data ) {
  15514. return this.each( function() {
  15515. jQuery.event.trigger( type, data, this );
  15516. } );
  15517. },
  15518. triggerHandler: function( type, data ) {
  15519. var elem = this[ 0 ];
  15520. if ( elem ) {
  15521. return jQuery.event.trigger( type, data, elem, true );
  15522. }
  15523. }
  15524. } );
  15525. // Support: Firefox <=44
  15526. // Firefox doesn't have focus(in | out) events
  15527. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  15528. //
  15529. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  15530. // focus(in | out) events fire after focus & blur events,
  15531. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  15532. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  15533. if ( !support.focusin ) {
  15534. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  15535. // Attach a single capturing handler on the document while someone wants focusin/focusout
  15536. var handler = function( event ) {
  15537. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  15538. };
  15539. jQuery.event.special[ fix ] = {
  15540. setup: function() {
  15541. var doc = this.ownerDocument || this,
  15542. attaches = dataPriv.access( doc, fix );
  15543. if ( !attaches ) {
  15544. doc.addEventListener( orig, handler, true );
  15545. }
  15546. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  15547. },
  15548. teardown: function() {
  15549. var doc = this.ownerDocument || this,
  15550. attaches = dataPriv.access( doc, fix ) - 1;
  15551. if ( !attaches ) {
  15552. doc.removeEventListener( orig, handler, true );
  15553. dataPriv.remove( doc, fix );
  15554. } else {
  15555. dataPriv.access( doc, fix, attaches );
  15556. }
  15557. }
  15558. };
  15559. } );
  15560. }
  15561. var location = window.location;
  15562. var nonce = Date.now();
  15563. var rquery = ( /\?/ );
  15564. // Cross-browser xml parsing
  15565. jQuery.parseXML = function( data ) {
  15566. var xml;
  15567. if ( !data || typeof data !== "string" ) {
  15568. return null;
  15569. }
  15570. // Support: IE 9 - 11 only
  15571. // IE throws on parseFromString with invalid input.
  15572. try {
  15573. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  15574. } catch ( e ) {
  15575. xml = undefined;
  15576. }
  15577. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  15578. jQuery.error( "Invalid XML: " + data );
  15579. }
  15580. return xml;
  15581. };
  15582. var
  15583. rbracket = /\[\]$/,
  15584. rCRLF = /\r?\n/g,
  15585. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  15586. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  15587. function buildParams( prefix, obj, traditional, add ) {
  15588. var name;
  15589. if ( Array.isArray( obj ) ) {
  15590. // Serialize array item.
  15591. jQuery.each( obj, function( i, v ) {
  15592. if ( traditional || rbracket.test( prefix ) ) {
  15593. // Treat each array item as a scalar.
  15594. add( prefix, v );
  15595. } else {
  15596. // Item is non-scalar (array or object), encode its numeric index.
  15597. buildParams(
  15598. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  15599. v,
  15600. traditional,
  15601. add
  15602. );
  15603. }
  15604. } );
  15605. } else if ( !traditional && toType( obj ) === "object" ) {
  15606. // Serialize object item.
  15607. for ( name in obj ) {
  15608. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  15609. }
  15610. } else {
  15611. // Serialize scalar item.
  15612. add( prefix, obj );
  15613. }
  15614. }
  15615. // Serialize an array of form elements or a set of
  15616. // key/values into a query string
  15617. jQuery.param = function( a, traditional ) {
  15618. var prefix,
  15619. s = [],
  15620. add = function( key, valueOrFunction ) {
  15621. // If value is a function, invoke it and use its return value
  15622. var value = isFunction( valueOrFunction ) ?
  15623. valueOrFunction() :
  15624. valueOrFunction;
  15625. s[ s.length ] = encodeURIComponent( key ) + "=" +
  15626. encodeURIComponent( value == null ? "" : value );
  15627. };
  15628. if ( a == null ) {
  15629. return "";
  15630. }
  15631. // If an array was passed in, assume that it is an array of form elements.
  15632. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  15633. // Serialize the form elements
  15634. jQuery.each( a, function() {
  15635. add( this.name, this.value );
  15636. } );
  15637. } else {
  15638. // If traditional, encode the "old" way (the way 1.3.2 or older
  15639. // did it), otherwise encode params recursively.
  15640. for ( prefix in a ) {
  15641. buildParams( prefix, a[ prefix ], traditional, add );
  15642. }
  15643. }
  15644. // Return the resulting serialization
  15645. return s.join( "&" );
  15646. };
  15647. jQuery.fn.extend( {
  15648. serialize: function() {
  15649. return jQuery.param( this.serializeArray() );
  15650. },
  15651. serializeArray: function() {
  15652. return this.map( function() {
  15653. // Can add propHook for "elements" to filter or add form elements
  15654. var elements = jQuery.prop( this, "elements" );
  15655. return elements ? jQuery.makeArray( elements ) : this;
  15656. } )
  15657. .filter( function() {
  15658. var type = this.type;
  15659. // Use .is( ":disabled" ) so that fieldset[disabled] works
  15660. return this.name && !jQuery( this ).is( ":disabled" ) &&
  15661. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  15662. ( this.checked || !rcheckableType.test( type ) );
  15663. } )
  15664. .map( function( i, elem ) {
  15665. var val = jQuery( this ).val();
  15666. if ( val == null ) {
  15667. return null;
  15668. }
  15669. if ( Array.isArray( val ) ) {
  15670. return jQuery.map( val, function( val ) {
  15671. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15672. } );
  15673. }
  15674. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15675. } ).get();
  15676. }
  15677. } );
  15678. var
  15679. r20 = /%20/g,
  15680. rhash = /#.*$/,
  15681. rantiCache = /([?&])_=[^&]*/,
  15682. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  15683. // #7653, #8125, #8152: local protocol detection
  15684. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  15685. rnoContent = /^(?:GET|HEAD)$/,
  15686. rprotocol = /^\/\//,
  15687. /* Prefilters
  15688. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  15689. * 2) These are called:
  15690. * - BEFORE asking for a transport
  15691. * - AFTER param serialization (s.data is a string if s.processData is true)
  15692. * 3) key is the dataType
  15693. * 4) the catchall symbol "*" can be used
  15694. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  15695. */
  15696. prefilters = {},
  15697. /* Transports bindings
  15698. * 1) key is the dataType
  15699. * 2) the catchall symbol "*" can be used
  15700. * 3) selection will start with transport dataType and THEN go to "*" if needed
  15701. */
  15702. transports = {},
  15703. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  15704. allTypes = "*/".concat( "*" ),
  15705. // Anchor tag for parsing the document origin
  15706. originAnchor = document.createElement( "a" );
  15707. originAnchor.href = location.href;
  15708. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  15709. function addToPrefiltersOrTransports( structure ) {
  15710. // dataTypeExpression is optional and defaults to "*"
  15711. return function( dataTypeExpression, func ) {
  15712. if ( typeof dataTypeExpression !== "string" ) {
  15713. func = dataTypeExpression;
  15714. dataTypeExpression = "*";
  15715. }
  15716. var dataType,
  15717. i = 0,
  15718. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  15719. if ( isFunction( func ) ) {
  15720. // For each dataType in the dataTypeExpression
  15721. while ( ( dataType = dataTypes[ i++ ] ) ) {
  15722. // Prepend if requested
  15723. if ( dataType[ 0 ] === "+" ) {
  15724. dataType = dataType.slice( 1 ) || "*";
  15725. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  15726. // Otherwise append
  15727. } else {
  15728. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  15729. }
  15730. }
  15731. }
  15732. };
  15733. }
  15734. // Base inspection function for prefilters and transports
  15735. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  15736. var inspected = {},
  15737. seekingTransport = ( structure === transports );
  15738. function inspect( dataType ) {
  15739. var selected;
  15740. inspected[ dataType ] = true;
  15741. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  15742. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  15743. if ( typeof dataTypeOrTransport === "string" &&
  15744. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  15745. options.dataTypes.unshift( dataTypeOrTransport );
  15746. inspect( dataTypeOrTransport );
  15747. return false;
  15748. } else if ( seekingTransport ) {
  15749. return !( selected = dataTypeOrTransport );
  15750. }
  15751. } );
  15752. return selected;
  15753. }
  15754. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  15755. }
  15756. // A special extend for ajax options
  15757. // that takes "flat" options (not to be deep extended)
  15758. // Fixes #9887
  15759. function ajaxExtend( target, src ) {
  15760. var key, deep,
  15761. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  15762. for ( key in src ) {
  15763. if ( src[ key ] !== undefined ) {
  15764. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  15765. }
  15766. }
  15767. if ( deep ) {
  15768. jQuery.extend( true, target, deep );
  15769. }
  15770. return target;
  15771. }
  15772. /* Handles responses to an ajax request:
  15773. * - finds the right dataType (mediates between content-type and expected dataType)
  15774. * - returns the corresponding response
  15775. */
  15776. function ajaxHandleResponses( s, jqXHR, responses ) {
  15777. var ct, type, finalDataType, firstDataType,
  15778. contents = s.contents,
  15779. dataTypes = s.dataTypes;
  15780. // Remove auto dataType and get content-type in the process
  15781. while ( dataTypes[ 0 ] === "*" ) {
  15782. dataTypes.shift();
  15783. if ( ct === undefined ) {
  15784. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  15785. }
  15786. }
  15787. // Check if we're dealing with a known content-type
  15788. if ( ct ) {
  15789. for ( type in contents ) {
  15790. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  15791. dataTypes.unshift( type );
  15792. break;
  15793. }
  15794. }
  15795. }
  15796. // Check to see if we have a response for the expected dataType
  15797. if ( dataTypes[ 0 ] in responses ) {
  15798. finalDataType = dataTypes[ 0 ];
  15799. } else {
  15800. // Try convertible dataTypes
  15801. for ( type in responses ) {
  15802. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  15803. finalDataType = type;
  15804. break;
  15805. }
  15806. if ( !firstDataType ) {
  15807. firstDataType = type;
  15808. }
  15809. }
  15810. // Or just use first one
  15811. finalDataType = finalDataType || firstDataType;
  15812. }
  15813. // If we found a dataType
  15814. // We add the dataType to the list if needed
  15815. // and return the corresponding response
  15816. if ( finalDataType ) {
  15817. if ( finalDataType !== dataTypes[ 0 ] ) {
  15818. dataTypes.unshift( finalDataType );
  15819. }
  15820. return responses[ finalDataType ];
  15821. }
  15822. }
  15823. /* Chain conversions given the request and the original response
  15824. * Also sets the responseXXX fields on the jqXHR instance
  15825. */
  15826. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  15827. var conv2, current, conv, tmp, prev,
  15828. converters = {},
  15829. // Work with a copy of dataTypes in case we need to modify it for conversion
  15830. dataTypes = s.dataTypes.slice();
  15831. // Create converters map with lowercased keys
  15832. if ( dataTypes[ 1 ] ) {
  15833. for ( conv in s.converters ) {
  15834. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  15835. }
  15836. }
  15837. current = dataTypes.shift();
  15838. // Convert to each sequential dataType
  15839. while ( current ) {
  15840. if ( s.responseFields[ current ] ) {
  15841. jqXHR[ s.responseFields[ current ] ] = response;
  15842. }
  15843. // Apply the dataFilter if provided
  15844. if ( !prev && isSuccess && s.dataFilter ) {
  15845. response = s.dataFilter( response, s.dataType );
  15846. }
  15847. prev = current;
  15848. current = dataTypes.shift();
  15849. if ( current ) {
  15850. // There's only work to do if current dataType is non-auto
  15851. if ( current === "*" ) {
  15852. current = prev;
  15853. // Convert response if prev dataType is non-auto and differs from current
  15854. } else if ( prev !== "*" && prev !== current ) {
  15855. // Seek a direct converter
  15856. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  15857. // If none found, seek a pair
  15858. if ( !conv ) {
  15859. for ( conv2 in converters ) {
  15860. // If conv2 outputs current
  15861. tmp = conv2.split( " " );
  15862. if ( tmp[ 1 ] === current ) {
  15863. // If prev can be converted to accepted input
  15864. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  15865. converters[ "* " + tmp[ 0 ] ];
  15866. if ( conv ) {
  15867. // Condense equivalence converters
  15868. if ( conv === true ) {
  15869. conv = converters[ conv2 ];
  15870. // Otherwise, insert the intermediate dataType
  15871. } else if ( converters[ conv2 ] !== true ) {
  15872. current = tmp[ 0 ];
  15873. dataTypes.unshift( tmp[ 1 ] );
  15874. }
  15875. break;
  15876. }
  15877. }
  15878. }
  15879. }
  15880. // Apply converter (if not an equivalence)
  15881. if ( conv !== true ) {
  15882. // Unless errors are allowed to bubble, catch and return them
  15883. if ( conv && s.throws ) {
  15884. response = conv( response );
  15885. } else {
  15886. try {
  15887. response = conv( response );
  15888. } catch ( e ) {
  15889. return {
  15890. state: "parsererror",
  15891. error: conv ? e : "No conversion from " + prev + " to " + current
  15892. };
  15893. }
  15894. }
  15895. }
  15896. }
  15897. }
  15898. }
  15899. return { state: "success", data: response };
  15900. }
  15901. jQuery.extend( {
  15902. // Counter for holding the number of active queries
  15903. active: 0,
  15904. // Last-Modified header cache for next request
  15905. lastModified: {},
  15906. etag: {},
  15907. ajaxSettings: {
  15908. url: location.href,
  15909. type: "GET",
  15910. isLocal: rlocalProtocol.test( location.protocol ),
  15911. global: true,
  15912. processData: true,
  15913. async: true,
  15914. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  15915. /*
  15916. timeout: 0,
  15917. data: null,
  15918. dataType: null,
  15919. username: null,
  15920. password: null,
  15921. cache: null,
  15922. throws: false,
  15923. traditional: false,
  15924. headers: {},
  15925. */
  15926. accepts: {
  15927. "*": allTypes,
  15928. text: "text/plain",
  15929. html: "text/html",
  15930. xml: "application/xml, text/xml",
  15931. json: "application/json, text/javascript"
  15932. },
  15933. contents: {
  15934. xml: /\bxml\b/,
  15935. html: /\bhtml/,
  15936. json: /\bjson\b/
  15937. },
  15938. responseFields: {
  15939. xml: "responseXML",
  15940. text: "responseText",
  15941. json: "responseJSON"
  15942. },
  15943. // Data converters
  15944. // Keys separate source (or catchall "*") and destination types with a single space
  15945. converters: {
  15946. // Convert anything to text
  15947. "* text": String,
  15948. // Text to html (true = no transformation)
  15949. "text html": true,
  15950. // Evaluate text as a json expression
  15951. "text json": JSON.parse,
  15952. // Parse text as xml
  15953. "text xml": jQuery.parseXML
  15954. },
  15955. // For options that shouldn't be deep extended:
  15956. // you can add your own custom options here if
  15957. // and when you create one that shouldn't be
  15958. // deep extended (see ajaxExtend)
  15959. flatOptions: {
  15960. url: true,
  15961. context: true
  15962. }
  15963. },
  15964. // Creates a full fledged settings object into target
  15965. // with both ajaxSettings and settings fields.
  15966. // If target is omitted, writes into ajaxSettings.
  15967. ajaxSetup: function( target, settings ) {
  15968. return settings ?
  15969. // Building a settings object
  15970. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  15971. // Extending ajaxSettings
  15972. ajaxExtend( jQuery.ajaxSettings, target );
  15973. },
  15974. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  15975. ajaxTransport: addToPrefiltersOrTransports( transports ),
  15976. // Main method
  15977. ajax: function( url, options ) {
  15978. // If url is an object, simulate pre-1.5 signature
  15979. if ( typeof url === "object" ) {
  15980. options = url;
  15981. url = undefined;
  15982. }
  15983. // Force options to be an object
  15984. options = options || {};
  15985. var transport,
  15986. // URL without anti-cache param
  15987. cacheURL,
  15988. // Response headers
  15989. responseHeadersString,
  15990. responseHeaders,
  15991. // timeout handle
  15992. timeoutTimer,
  15993. // Url cleanup var
  15994. urlAnchor,
  15995. // Request state (becomes false upon send and true upon completion)
  15996. completed,
  15997. // To know if global events are to be dispatched
  15998. fireGlobals,
  15999. // Loop variable
  16000. i,
  16001. // uncached part of the url
  16002. uncached,
  16003. // Create the final options object
  16004. s = jQuery.ajaxSetup( {}, options ),
  16005. // Callbacks context
  16006. callbackContext = s.context || s,
  16007. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  16008. globalEventContext = s.context &&
  16009. ( callbackContext.nodeType || callbackContext.jquery ) ?
  16010. jQuery( callbackContext ) :
  16011. jQuery.event,
  16012. // Deferreds
  16013. deferred = jQuery.Deferred(),
  16014. completeDeferred = jQuery.Callbacks( "once memory" ),
  16015. // Status-dependent callbacks
  16016. statusCode = s.statusCode || {},
  16017. // Headers (they are sent all at once)
  16018. requestHeaders = {},
  16019. requestHeadersNames = {},
  16020. // Default abort message
  16021. strAbort = "canceled",
  16022. // Fake xhr
  16023. jqXHR = {
  16024. readyState: 0,
  16025. // Builds headers hashtable if needed
  16026. getResponseHeader: function( key ) {
  16027. var match;
  16028. if ( completed ) {
  16029. if ( !responseHeaders ) {
  16030. responseHeaders = {};
  16031. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  16032. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  16033. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  16034. .concat( match[ 2 ] );
  16035. }
  16036. }
  16037. match = responseHeaders[ key.toLowerCase() + " " ];
  16038. }
  16039. return match == null ? null : match.join( ", " );
  16040. },
  16041. // Raw string
  16042. getAllResponseHeaders: function() {
  16043. return completed ? responseHeadersString : null;
  16044. },
  16045. // Caches the header
  16046. setRequestHeader: function( name, value ) {
  16047. if ( completed == null ) {
  16048. name = requestHeadersNames[ name.toLowerCase() ] =
  16049. requestHeadersNames[ name.toLowerCase() ] || name;
  16050. requestHeaders[ name ] = value;
  16051. }
  16052. return this;
  16053. },
  16054. // Overrides response content-type header
  16055. overrideMimeType: function( type ) {
  16056. if ( completed == null ) {
  16057. s.mimeType = type;
  16058. }
  16059. return this;
  16060. },
  16061. // Status-dependent callbacks
  16062. statusCode: function( map ) {
  16063. var code;
  16064. if ( map ) {
  16065. if ( completed ) {
  16066. // Execute the appropriate callbacks
  16067. jqXHR.always( map[ jqXHR.status ] );
  16068. } else {
  16069. // Lazy-add the new callbacks in a way that preserves old ones
  16070. for ( code in map ) {
  16071. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  16072. }
  16073. }
  16074. }
  16075. return this;
  16076. },
  16077. // Cancel the request
  16078. abort: function( statusText ) {
  16079. var finalText = statusText || strAbort;
  16080. if ( transport ) {
  16081. transport.abort( finalText );
  16082. }
  16083. done( 0, finalText );
  16084. return this;
  16085. }
  16086. };
  16087. // Attach deferreds
  16088. deferred.promise( jqXHR );
  16089. // Add protocol if not provided (prefilters might expect it)
  16090. // Handle falsy url in the settings object (#10093: consistency with old signature)
  16091. // We also use the url parameter if available
  16092. s.url = ( ( url || s.url || location.href ) + "" )
  16093. .replace( rprotocol, location.protocol + "//" );
  16094. // Alias method option to type as per ticket #12004
  16095. s.type = options.method || options.type || s.method || s.type;
  16096. // Extract dataTypes list
  16097. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  16098. // A cross-domain request is in order when the origin doesn't match the current origin.
  16099. if ( s.crossDomain == null ) {
  16100. urlAnchor = document.createElement( "a" );
  16101. // Support: IE <=8 - 11, Edge 12 - 15
  16102. // IE throws exception on accessing the href property if url is malformed,
  16103. // e.g. http://example.com:80x/
  16104. try {
  16105. urlAnchor.href = s.url;
  16106. // Support: IE <=8 - 11 only
  16107. // Anchor's host property isn't correctly set when s.url is relative
  16108. urlAnchor.href = urlAnchor.href;
  16109. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  16110. urlAnchor.protocol + "//" + urlAnchor.host;
  16111. } catch ( e ) {
  16112. // If there is an error parsing the URL, assume it is crossDomain,
  16113. // it can be rejected by the transport if it is invalid
  16114. s.crossDomain = true;
  16115. }
  16116. }
  16117. // Convert data if not already a string
  16118. if ( s.data && s.processData && typeof s.data !== "string" ) {
  16119. s.data = jQuery.param( s.data, s.traditional );
  16120. }
  16121. // Apply prefilters
  16122. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  16123. // If request was aborted inside a prefilter, stop there
  16124. if ( completed ) {
  16125. return jqXHR;
  16126. }
  16127. // We can fire global events as of now if asked to
  16128. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  16129. fireGlobals = jQuery.event && s.global;
  16130. // Watch for a new set of requests
  16131. if ( fireGlobals && jQuery.active++ === 0 ) {
  16132. jQuery.event.trigger( "ajaxStart" );
  16133. }
  16134. // Uppercase the type
  16135. s.type = s.type.toUpperCase();
  16136. // Determine if request has content
  16137. s.hasContent = !rnoContent.test( s.type );
  16138. // Save the URL in case we're toying with the If-Modified-Since
  16139. // and/or If-None-Match header later on
  16140. // Remove hash to simplify url manipulation
  16141. cacheURL = s.url.replace( rhash, "" );
  16142. // More options handling for requests with no content
  16143. if ( !s.hasContent ) {
  16144. // Remember the hash so we can put it back
  16145. uncached = s.url.slice( cacheURL.length );
  16146. // If data is available and should be processed, append data to url
  16147. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  16148. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  16149. // #9682: remove data so that it's not used in an eventual retry
  16150. delete s.data;
  16151. }
  16152. // Add or update anti-cache param if needed
  16153. if ( s.cache === false ) {
  16154. cacheURL = cacheURL.replace( rantiCache, "$1" );
  16155. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  16156. }
  16157. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  16158. s.url = cacheURL + uncached;
  16159. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  16160. } else if ( s.data && s.processData &&
  16161. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  16162. s.data = s.data.replace( r20, "+" );
  16163. }
  16164. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16165. if ( s.ifModified ) {
  16166. if ( jQuery.lastModified[ cacheURL ] ) {
  16167. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  16168. }
  16169. if ( jQuery.etag[ cacheURL ] ) {
  16170. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  16171. }
  16172. }
  16173. // Set the correct header, if data is being sent
  16174. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  16175. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  16176. }
  16177. // Set the Accepts header for the server, depending on the dataType
  16178. jqXHR.setRequestHeader(
  16179. "Accept",
  16180. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  16181. s.accepts[ s.dataTypes[ 0 ] ] +
  16182. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  16183. s.accepts[ "*" ]
  16184. );
  16185. // Check for headers option
  16186. for ( i in s.headers ) {
  16187. jqXHR.setRequestHeader( i, s.headers[ i ] );
  16188. }
  16189. // Allow custom headers/mimetypes and early abort
  16190. if ( s.beforeSend &&
  16191. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  16192. // Abort if not done already and return
  16193. return jqXHR.abort();
  16194. }
  16195. // Aborting is no longer a cancellation
  16196. strAbort = "abort";
  16197. // Install callbacks on deferreds
  16198. completeDeferred.add( s.complete );
  16199. jqXHR.done( s.success );
  16200. jqXHR.fail( s.error );
  16201. // Get transport
  16202. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  16203. // If no transport, we auto-abort
  16204. if ( !transport ) {
  16205. done( -1, "No Transport" );
  16206. } else {
  16207. jqXHR.readyState = 1;
  16208. // Send global event
  16209. if ( fireGlobals ) {
  16210. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  16211. }
  16212. // If request was aborted inside ajaxSend, stop there
  16213. if ( completed ) {
  16214. return jqXHR;
  16215. }
  16216. // Timeout
  16217. if ( s.async && s.timeout > 0 ) {
  16218. timeoutTimer = window.setTimeout( function() {
  16219. jqXHR.abort( "timeout" );
  16220. }, s.timeout );
  16221. }
  16222. try {
  16223. completed = false;
  16224. transport.send( requestHeaders, done );
  16225. } catch ( e ) {
  16226. // Rethrow post-completion exceptions
  16227. if ( completed ) {
  16228. throw e;
  16229. }
  16230. // Propagate others as results
  16231. done( -1, e );
  16232. }
  16233. }
  16234. // Callback for when everything is done
  16235. function done( status, nativeStatusText, responses, headers ) {
  16236. var isSuccess, success, error, response, modified,
  16237. statusText = nativeStatusText;
  16238. // Ignore repeat invocations
  16239. if ( completed ) {
  16240. return;
  16241. }
  16242. completed = true;
  16243. // Clear timeout if it exists
  16244. if ( timeoutTimer ) {
  16245. window.clearTimeout( timeoutTimer );
  16246. }
  16247. // Dereference transport for early garbage collection
  16248. // (no matter how long the jqXHR object will be used)
  16249. transport = undefined;
  16250. // Cache response headers
  16251. responseHeadersString = headers || "";
  16252. // Set readyState
  16253. jqXHR.readyState = status > 0 ? 4 : 0;
  16254. // Determine if successful
  16255. isSuccess = status >= 200 && status < 300 || status === 304;
  16256. // Get response data
  16257. if ( responses ) {
  16258. response = ajaxHandleResponses( s, jqXHR, responses );
  16259. }
  16260. // Convert no matter what (that way responseXXX fields are always set)
  16261. response = ajaxConvert( s, response, jqXHR, isSuccess );
  16262. // If successful, handle type chaining
  16263. if ( isSuccess ) {
  16264. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16265. if ( s.ifModified ) {
  16266. modified = jqXHR.getResponseHeader( "Last-Modified" );
  16267. if ( modified ) {
  16268. jQuery.lastModified[ cacheURL ] = modified;
  16269. }
  16270. modified = jqXHR.getResponseHeader( "etag" );
  16271. if ( modified ) {
  16272. jQuery.etag[ cacheURL ] = modified;
  16273. }
  16274. }
  16275. // if no content
  16276. if ( status === 204 || s.type === "HEAD" ) {
  16277. statusText = "nocontent";
  16278. // if not modified
  16279. } else if ( status === 304 ) {
  16280. statusText = "notmodified";
  16281. // If we have data, let's convert it
  16282. } else {
  16283. statusText = response.state;
  16284. success = response.data;
  16285. error = response.error;
  16286. isSuccess = !error;
  16287. }
  16288. } else {
  16289. // Extract error from statusText and normalize for non-aborts
  16290. error = statusText;
  16291. if ( status || !statusText ) {
  16292. statusText = "error";
  16293. if ( status < 0 ) {
  16294. status = 0;
  16295. }
  16296. }
  16297. }
  16298. // Set data for the fake xhr object
  16299. jqXHR.status = status;
  16300. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  16301. // Success/Error
  16302. if ( isSuccess ) {
  16303. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  16304. } else {
  16305. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  16306. }
  16307. // Status-dependent callbacks
  16308. jqXHR.statusCode( statusCode );
  16309. statusCode = undefined;
  16310. if ( fireGlobals ) {
  16311. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  16312. [ jqXHR, s, isSuccess ? success : error ] );
  16313. }
  16314. // Complete
  16315. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  16316. if ( fireGlobals ) {
  16317. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  16318. // Handle the global AJAX counter
  16319. if ( !( --jQuery.active ) ) {
  16320. jQuery.event.trigger( "ajaxStop" );
  16321. }
  16322. }
  16323. }
  16324. return jqXHR;
  16325. },
  16326. getJSON: function( url, data, callback ) {
  16327. return jQuery.get( url, data, callback, "json" );
  16328. },
  16329. getScript: function( url, callback ) {
  16330. return jQuery.get( url, undefined, callback, "script" );
  16331. }
  16332. } );
  16333. jQuery.each( [ "get", "post" ], function( i, method ) {
  16334. jQuery[ method ] = function( url, data, callback, type ) {
  16335. // Shift arguments if data argument was omitted
  16336. if ( isFunction( data ) ) {
  16337. type = type || callback;
  16338. callback = data;
  16339. data = undefined;
  16340. }
  16341. // The url can be an options object (which then must have .url)
  16342. return jQuery.ajax( jQuery.extend( {
  16343. url: url,
  16344. type: method,
  16345. dataType: type,
  16346. data: data,
  16347. success: callback
  16348. }, jQuery.isPlainObject( url ) && url ) );
  16349. };
  16350. } );
  16351. jQuery._evalUrl = function( url, options ) {
  16352. return jQuery.ajax( {
  16353. url: url,
  16354. // Make this explicit, since user can override this through ajaxSetup (#11264)
  16355. type: "GET",
  16356. dataType: "script",
  16357. cache: true,
  16358. async: false,
  16359. global: false,
  16360. // Only evaluate the response if it is successful (gh-4126)
  16361. // dataFilter is not invoked for failure responses, so using it instead
  16362. // of the default converter is kludgy but it works.
  16363. converters: {
  16364. "text script": function() {}
  16365. },
  16366. dataFilter: function( response ) {
  16367. jQuery.globalEval( response, options );
  16368. }
  16369. } );
  16370. };
  16371. jQuery.fn.extend( {
  16372. wrapAll: function( html ) {
  16373. var wrap;
  16374. if ( this[ 0 ] ) {
  16375. if ( isFunction( html ) ) {
  16376. html = html.call( this[ 0 ] );
  16377. }
  16378. // The elements to wrap the target around
  16379. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  16380. if ( this[ 0 ].parentNode ) {
  16381. wrap.insertBefore( this[ 0 ] );
  16382. }
  16383. wrap.map( function() {
  16384. var elem = this;
  16385. while ( elem.firstElementChild ) {
  16386. elem = elem.firstElementChild;
  16387. }
  16388. return elem;
  16389. } ).append( this );
  16390. }
  16391. return this;
  16392. },
  16393. wrapInner: function( html ) {
  16394. if ( isFunction( html ) ) {
  16395. return this.each( function( i ) {
  16396. jQuery( this ).wrapInner( html.call( this, i ) );
  16397. } );
  16398. }
  16399. return this.each( function() {
  16400. var self = jQuery( this ),
  16401. contents = self.contents();
  16402. if ( contents.length ) {
  16403. contents.wrapAll( html );
  16404. } else {
  16405. self.append( html );
  16406. }
  16407. } );
  16408. },
  16409. wrap: function( html ) {
  16410. var htmlIsFunction = isFunction( html );
  16411. return this.each( function( i ) {
  16412. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  16413. } );
  16414. },
  16415. unwrap: function( selector ) {
  16416. this.parent( selector ).not( "body" ).each( function() {
  16417. jQuery( this ).replaceWith( this.childNodes );
  16418. } );
  16419. return this;
  16420. }
  16421. } );
  16422. jQuery.expr.pseudos.hidden = function( elem ) {
  16423. return !jQuery.expr.pseudos.visible( elem );
  16424. };
  16425. jQuery.expr.pseudos.visible = function( elem ) {
  16426. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  16427. };
  16428. jQuery.ajaxSettings.xhr = function() {
  16429. try {
  16430. return new window.XMLHttpRequest();
  16431. } catch ( e ) {}
  16432. };
  16433. var xhrSuccessStatus = {
  16434. // File protocol always yields status code 0, assume 200
  16435. 0: 200,
  16436. // Support: IE <=9 only
  16437. // #1450: sometimes IE returns 1223 when it should be 204
  16438. 1223: 204
  16439. },
  16440. xhrSupported = jQuery.ajaxSettings.xhr();
  16441. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  16442. support.ajax = xhrSupported = !!xhrSupported;
  16443. jQuery.ajaxTransport( function( options ) {
  16444. var callback, errorCallback;
  16445. // Cross domain only allowed if supported through XMLHttpRequest
  16446. if ( support.cors || xhrSupported && !options.crossDomain ) {
  16447. return {
  16448. send: function( headers, complete ) {
  16449. var i,
  16450. xhr = options.xhr();
  16451. xhr.open(
  16452. options.type,
  16453. options.url,
  16454. options.async,
  16455. options.username,
  16456. options.password
  16457. );
  16458. // Apply custom fields if provided
  16459. if ( options.xhrFields ) {
  16460. for ( i in options.xhrFields ) {
  16461. xhr[ i ] = options.xhrFields[ i ];
  16462. }
  16463. }
  16464. // Override mime type if needed
  16465. if ( options.mimeType && xhr.overrideMimeType ) {
  16466. xhr.overrideMimeType( options.mimeType );
  16467. }
  16468. // X-Requested-With header
  16469. // For cross-domain requests, seeing as conditions for a preflight are
  16470. // akin to a jigsaw puzzle, we simply never set it to be sure.
  16471. // (it can always be set on a per-request basis or even using ajaxSetup)
  16472. // For same-domain requests, won't change header if already provided.
  16473. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  16474. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  16475. }
  16476. // Set headers
  16477. for ( i in headers ) {
  16478. xhr.setRequestHeader( i, headers[ i ] );
  16479. }
  16480. // Callback
  16481. callback = function( type ) {
  16482. return function() {
  16483. if ( callback ) {
  16484. callback = errorCallback = xhr.onload =
  16485. xhr.onerror = xhr.onabort = xhr.ontimeout =
  16486. xhr.onreadystatechange = null;
  16487. if ( type === "abort" ) {
  16488. xhr.abort();
  16489. } else if ( type === "error" ) {
  16490. // Support: IE <=9 only
  16491. // On a manual native abort, IE9 throws
  16492. // errors on any property access that is not readyState
  16493. if ( typeof xhr.status !== "number" ) {
  16494. complete( 0, "error" );
  16495. } else {
  16496. complete(
  16497. // File: protocol always yields status 0; see #8605, #14207
  16498. xhr.status,
  16499. xhr.statusText
  16500. );
  16501. }
  16502. } else {
  16503. complete(
  16504. xhrSuccessStatus[ xhr.status ] || xhr.status,
  16505. xhr.statusText,
  16506. // Support: IE <=9 only
  16507. // IE9 has no XHR2 but throws on binary (trac-11426)
  16508. // For XHR2 non-text, let the caller handle it (gh-2498)
  16509. ( xhr.responseType || "text" ) !== "text" ||
  16510. typeof xhr.responseText !== "string" ?
  16511. { binary: xhr.response } :
  16512. { text: xhr.responseText },
  16513. xhr.getAllResponseHeaders()
  16514. );
  16515. }
  16516. }
  16517. };
  16518. };
  16519. // Listen to events
  16520. xhr.onload = callback();
  16521. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  16522. // Support: IE 9 only
  16523. // Use onreadystatechange to replace onabort
  16524. // to handle uncaught aborts
  16525. if ( xhr.onabort !== undefined ) {
  16526. xhr.onabort = errorCallback;
  16527. } else {
  16528. xhr.onreadystatechange = function() {
  16529. // Check readyState before timeout as it changes
  16530. if ( xhr.readyState === 4 ) {
  16531. // Allow onerror to be called first,
  16532. // but that will not handle a native abort
  16533. // Also, save errorCallback to a variable
  16534. // as xhr.onerror cannot be accessed
  16535. window.setTimeout( function() {
  16536. if ( callback ) {
  16537. errorCallback();
  16538. }
  16539. } );
  16540. }
  16541. };
  16542. }
  16543. // Create the abort callback
  16544. callback = callback( "abort" );
  16545. try {
  16546. // Do send the request (this may raise an exception)
  16547. xhr.send( options.hasContent && options.data || null );
  16548. } catch ( e ) {
  16549. // #14683: Only rethrow if this hasn't been notified as an error yet
  16550. if ( callback ) {
  16551. throw e;
  16552. }
  16553. }
  16554. },
  16555. abort: function() {
  16556. if ( callback ) {
  16557. callback();
  16558. }
  16559. }
  16560. };
  16561. }
  16562. } );
  16563. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  16564. jQuery.ajaxPrefilter( function( s ) {
  16565. if ( s.crossDomain ) {
  16566. s.contents.script = false;
  16567. }
  16568. } );
  16569. // Install script dataType
  16570. jQuery.ajaxSetup( {
  16571. accepts: {
  16572. script: "text/javascript, application/javascript, " +
  16573. "application/ecmascript, application/x-ecmascript"
  16574. },
  16575. contents: {
  16576. script: /\b(?:java|ecma)script\b/
  16577. },
  16578. converters: {
  16579. "text script": function( text ) {
  16580. jQuery.globalEval( text );
  16581. return text;
  16582. }
  16583. }
  16584. } );
  16585. // Handle cache's special case and crossDomain
  16586. jQuery.ajaxPrefilter( "script", function( s ) {
  16587. if ( s.cache === undefined ) {
  16588. s.cache = false;
  16589. }
  16590. if ( s.crossDomain ) {
  16591. s.type = "GET";
  16592. }
  16593. } );
  16594. // Bind script tag hack transport
  16595. jQuery.ajaxTransport( "script", function( s ) {
  16596. // This transport only deals with cross domain or forced-by-attrs requests
  16597. if ( s.crossDomain || s.scriptAttrs ) {
  16598. var script, callback;
  16599. return {
  16600. send: function( _, complete ) {
  16601. script = jQuery( "<script>" )
  16602. .attr( s.scriptAttrs || {} )
  16603. .prop( { charset: s.scriptCharset, src: s.url } )
  16604. .on( "load error", callback = function( evt ) {
  16605. script.remove();
  16606. callback = null;
  16607. if ( evt ) {
  16608. complete( evt.type === "error" ? 404 : 200, evt.type );
  16609. }
  16610. } );
  16611. // Use native DOM manipulation to avoid our domManip AJAX trickery
  16612. document.head.appendChild( script[ 0 ] );
  16613. },
  16614. abort: function() {
  16615. if ( callback ) {
  16616. callback();
  16617. }
  16618. }
  16619. };
  16620. }
  16621. } );
  16622. var oldCallbacks = [],
  16623. rjsonp = /(=)\?(?=&|$)|\?\?/;
  16624. // Default jsonp settings
  16625. jQuery.ajaxSetup( {
  16626. jsonp: "callback",
  16627. jsonpCallback: function() {
  16628. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  16629. this[ callback ] = true;
  16630. return callback;
  16631. }
  16632. } );
  16633. // Detect, normalize options and install callbacks for jsonp requests
  16634. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  16635. var callbackName, overwritten, responseContainer,
  16636. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  16637. "url" :
  16638. typeof s.data === "string" &&
  16639. ( s.contentType || "" )
  16640. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  16641. rjsonp.test( s.data ) && "data"
  16642. );
  16643. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  16644. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  16645. // Get callback name, remembering preexisting value associated with it
  16646. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  16647. s.jsonpCallback() :
  16648. s.jsonpCallback;
  16649. // Insert callback into url or form data
  16650. if ( jsonProp ) {
  16651. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  16652. } else if ( s.jsonp !== false ) {
  16653. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  16654. }
  16655. // Use data converter to retrieve json after script execution
  16656. s.converters[ "script json" ] = function() {
  16657. if ( !responseContainer ) {
  16658. jQuery.error( callbackName + " was not called" );
  16659. }
  16660. return responseContainer[ 0 ];
  16661. };
  16662. // Force json dataType
  16663. s.dataTypes[ 0 ] = "json";
  16664. // Install callback
  16665. overwritten = window[ callbackName ];
  16666. window[ callbackName ] = function() {
  16667. responseContainer = arguments;
  16668. };
  16669. // Clean-up function (fires after converters)
  16670. jqXHR.always( function() {
  16671. // If previous value didn't exist - remove it
  16672. if ( overwritten === undefined ) {
  16673. jQuery( window ).removeProp( callbackName );
  16674. // Otherwise restore preexisting value
  16675. } else {
  16676. window[ callbackName ] = overwritten;
  16677. }
  16678. // Save back as free
  16679. if ( s[ callbackName ] ) {
  16680. // Make sure that re-using the options doesn't screw things around
  16681. s.jsonpCallback = originalSettings.jsonpCallback;
  16682. // Save the callback name for future use
  16683. oldCallbacks.push( callbackName );
  16684. }
  16685. // Call if it was a function and we have a response
  16686. if ( responseContainer && isFunction( overwritten ) ) {
  16687. overwritten( responseContainer[ 0 ] );
  16688. }
  16689. responseContainer = overwritten = undefined;
  16690. } );
  16691. // Delegate to script
  16692. return "script";
  16693. }
  16694. } );
  16695. // Support: Safari 8 only
  16696. // In Safari 8 documents created via document.implementation.createHTMLDocument
  16697. // collapse sibling forms: the second one becomes a child of the first one.
  16698. // Because of that, this security measure has to be disabled in Safari 8.
  16699. // https://bugs.webkit.org/show_bug.cgi?id=137337
  16700. support.createHTMLDocument = ( function() {
  16701. var body = document.implementation.createHTMLDocument( "" ).body;
  16702. body.innerHTML = "<form></form><form></form>";
  16703. return body.childNodes.length === 2;
  16704. } )();
  16705. // Argument "data" should be string of html
  16706. // context (optional): If specified, the fragment will be created in this context,
  16707. // defaults to document
  16708. // keepScripts (optional): If true, will include scripts passed in the html string
  16709. jQuery.parseHTML = function( data, context, keepScripts ) {
  16710. if ( typeof data !== "string" ) {
  16711. return [];
  16712. }
  16713. if ( typeof context === "boolean" ) {
  16714. keepScripts = context;
  16715. context = false;
  16716. }
  16717. var base, parsed, scripts;
  16718. if ( !context ) {
  16719. // Stop scripts or inline event handlers from being executed immediately
  16720. // by using document.implementation
  16721. if ( support.createHTMLDocument ) {
  16722. context = document.implementation.createHTMLDocument( "" );
  16723. // Set the base href for the created document
  16724. // so any parsed elements with URLs
  16725. // are based on the document's URL (gh-2965)
  16726. base = context.createElement( "base" );
  16727. base.href = document.location.href;
  16728. context.head.appendChild( base );
  16729. } else {
  16730. context = document;
  16731. }
  16732. }
  16733. parsed = rsingleTag.exec( data );
  16734. scripts = !keepScripts && [];
  16735. // Single tag
  16736. if ( parsed ) {
  16737. return [ context.createElement( parsed[ 1 ] ) ];
  16738. }
  16739. parsed = buildFragment( [ data ], context, scripts );
  16740. if ( scripts && scripts.length ) {
  16741. jQuery( scripts ).remove();
  16742. }
  16743. return jQuery.merge( [], parsed.childNodes );
  16744. };
  16745. /**
  16746. * Load a url into a page
  16747. */
  16748. jQuery.fn.load = function( url, params, callback ) {
  16749. var selector, type, response,
  16750. self = this,
  16751. off = url.indexOf( " " );
  16752. if ( off > -1 ) {
  16753. selector = stripAndCollapse( url.slice( off ) );
  16754. url = url.slice( 0, off );
  16755. }
  16756. // If it's a function
  16757. if ( isFunction( params ) ) {
  16758. // We assume that it's the callback
  16759. callback = params;
  16760. params = undefined;
  16761. // Otherwise, build a param string
  16762. } else if ( params && typeof params === "object" ) {
  16763. type = "POST";
  16764. }
  16765. // If we have elements to modify, make the request
  16766. if ( self.length > 0 ) {
  16767. jQuery.ajax( {
  16768. url: url,
  16769. // If "type" variable is undefined, then "GET" method will be used.
  16770. // Make value of this field explicit since
  16771. // user can override it through ajaxSetup method
  16772. type: type || "GET",
  16773. dataType: "html",
  16774. data: params
  16775. } ).done( function( responseText ) {
  16776. // Save response for use in complete callback
  16777. response = arguments;
  16778. self.html( selector ?
  16779. // If a selector was specified, locate the right elements in a dummy div
  16780. // Exclude scripts to avoid IE 'Permission Denied' errors
  16781. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  16782. // Otherwise use the full result
  16783. responseText );
  16784. // If the request succeeds, this function gets "data", "status", "jqXHR"
  16785. // but they are ignored because response was set above.
  16786. // If it fails, this function gets "jqXHR", "status", "error"
  16787. } ).always( callback && function( jqXHR, status ) {
  16788. self.each( function() {
  16789. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  16790. } );
  16791. } );
  16792. }
  16793. return this;
  16794. };
  16795. // Attach a bunch of functions for handling common AJAX events
  16796. jQuery.each( [
  16797. "ajaxStart",
  16798. "ajaxStop",
  16799. "ajaxComplete",
  16800. "ajaxError",
  16801. "ajaxSuccess",
  16802. "ajaxSend"
  16803. ], function( i, type ) {
  16804. jQuery.fn[ type ] = function( fn ) {
  16805. return this.on( type, fn );
  16806. };
  16807. } );
  16808. jQuery.expr.pseudos.animated = function( elem ) {
  16809. return jQuery.grep( jQuery.timers, function( fn ) {
  16810. return elem === fn.elem;
  16811. } ).length;
  16812. };
  16813. jQuery.offset = {
  16814. setOffset: function( elem, options, i ) {
  16815. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  16816. position = jQuery.css( elem, "position" ),
  16817. curElem = jQuery( elem ),
  16818. props = {};
  16819. // Set position first, in-case top/left are set even on static elem
  16820. if ( position === "static" ) {
  16821. elem.style.position = "relative";
  16822. }
  16823. curOffset = curElem.offset();
  16824. curCSSTop = jQuery.css( elem, "top" );
  16825. curCSSLeft = jQuery.css( elem, "left" );
  16826. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  16827. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  16828. // Need to be able to calculate position if either
  16829. // top or left is auto and position is either absolute or fixed
  16830. if ( calculatePosition ) {
  16831. curPosition = curElem.position();
  16832. curTop = curPosition.top;
  16833. curLeft = curPosition.left;
  16834. } else {
  16835. curTop = parseFloat( curCSSTop ) || 0;
  16836. curLeft = parseFloat( curCSSLeft ) || 0;
  16837. }
  16838. if ( isFunction( options ) ) {
  16839. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  16840. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  16841. }
  16842. if ( options.top != null ) {
  16843. props.top = ( options.top - curOffset.top ) + curTop;
  16844. }
  16845. if ( options.left != null ) {
  16846. props.left = ( options.left - curOffset.left ) + curLeft;
  16847. }
  16848. if ( "using" in options ) {
  16849. options.using.call( elem, props );
  16850. } else {
  16851. curElem.css( props );
  16852. }
  16853. }
  16854. };
  16855. jQuery.fn.extend( {
  16856. // offset() relates an element's border box to the document origin
  16857. offset: function( options ) {
  16858. // Preserve chaining for setter
  16859. if ( arguments.length ) {
  16860. return options === undefined ?
  16861. this :
  16862. this.each( function( i ) {
  16863. jQuery.offset.setOffset( this, options, i );
  16864. } );
  16865. }
  16866. var rect, win,
  16867. elem = this[ 0 ];
  16868. if ( !elem ) {
  16869. return;
  16870. }
  16871. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  16872. // Support: IE <=11 only
  16873. // Running getBoundingClientRect on a
  16874. // disconnected node in IE throws an error
  16875. if ( !elem.getClientRects().length ) {
  16876. return { top: 0, left: 0 };
  16877. }
  16878. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  16879. rect = elem.getBoundingClientRect();
  16880. win = elem.ownerDocument.defaultView;
  16881. return {
  16882. top: rect.top + win.pageYOffset,
  16883. left: rect.left + win.pageXOffset
  16884. };
  16885. },
  16886. // position() relates an element's margin box to its offset parent's padding box
  16887. // This corresponds to the behavior of CSS absolute positioning
  16888. position: function() {
  16889. if ( !this[ 0 ] ) {
  16890. return;
  16891. }
  16892. var offsetParent, offset, doc,
  16893. elem = this[ 0 ],
  16894. parentOffset = { top: 0, left: 0 };
  16895. // position:fixed elements are offset from the viewport, which itself always has zero offset
  16896. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  16897. // Assume position:fixed implies availability of getBoundingClientRect
  16898. offset = elem.getBoundingClientRect();
  16899. } else {
  16900. offset = this.offset();
  16901. // Account for the *real* offset parent, which can be the document or its root element
  16902. // when a statically positioned element is identified
  16903. doc = elem.ownerDocument;
  16904. offsetParent = elem.offsetParent || doc.documentElement;
  16905. while ( offsetParent &&
  16906. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  16907. jQuery.css( offsetParent, "position" ) === "static" ) {
  16908. offsetParent = offsetParent.parentNode;
  16909. }
  16910. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  16911. // Incorporate borders into its offset, since they are outside its content origin
  16912. parentOffset = jQuery( offsetParent ).offset();
  16913. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  16914. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  16915. }
  16916. }
  16917. // Subtract parent offsets and element margins
  16918. return {
  16919. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  16920. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  16921. };
  16922. },
  16923. // This method will return documentElement in the following cases:
  16924. // 1) For the element inside the iframe without offsetParent, this method will return
  16925. // documentElement of the parent window
  16926. // 2) For the hidden or detached element
  16927. // 3) For body or html element, i.e. in case of the html node - it will return itself
  16928. //
  16929. // but those exceptions were never presented as a real life use-cases
  16930. // and might be considered as more preferable results.
  16931. //
  16932. // This logic, however, is not guaranteed and can change at any point in the future
  16933. offsetParent: function() {
  16934. return this.map( function() {
  16935. var offsetParent = this.offsetParent;
  16936. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  16937. offsetParent = offsetParent.offsetParent;
  16938. }
  16939. return offsetParent || documentElement;
  16940. } );
  16941. }
  16942. } );
  16943. // Create scrollLeft and scrollTop methods
  16944. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  16945. var top = "pageYOffset" === prop;
  16946. jQuery.fn[ method ] = function( val ) {
  16947. return access( this, function( elem, method, val ) {
  16948. // Coalesce documents and windows
  16949. var win;
  16950. if ( isWindow( elem ) ) {
  16951. win = elem;
  16952. } else if ( elem.nodeType === 9 ) {
  16953. win = elem.defaultView;
  16954. }
  16955. if ( val === undefined ) {
  16956. return win ? win[ prop ] : elem[ method ];
  16957. }
  16958. if ( win ) {
  16959. win.scrollTo(
  16960. !top ? val : win.pageXOffset,
  16961. top ? val : win.pageYOffset
  16962. );
  16963. } else {
  16964. elem[ method ] = val;
  16965. }
  16966. }, method, val, arguments.length );
  16967. };
  16968. } );
  16969. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  16970. // Add the top/left cssHooks using jQuery.fn.position
  16971. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  16972. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  16973. // getComputedStyle returns percent when specified for top/left/bottom/right;
  16974. // rather than make the css module depend on the offset module, just check for it here
  16975. jQuery.each( [ "top", "left" ], function( i, prop ) {
  16976. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  16977. function( elem, computed ) {
  16978. if ( computed ) {
  16979. computed = curCSS( elem, prop );
  16980. // If curCSS returns percentage, fallback to offset
  16981. return rnumnonpx.test( computed ) ?
  16982. jQuery( elem ).position()[ prop ] + "px" :
  16983. computed;
  16984. }
  16985. }
  16986. );
  16987. } );
  16988. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  16989. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  16990. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  16991. function( defaultExtra, funcName ) {
  16992. // Margin is only for outerHeight, outerWidth
  16993. jQuery.fn[ funcName ] = function( margin, value ) {
  16994. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  16995. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  16996. return access( this, function( elem, type, value ) {
  16997. var doc;
  16998. if ( isWindow( elem ) ) {
  16999. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  17000. return funcName.indexOf( "outer" ) === 0 ?
  17001. elem[ "inner" + name ] :
  17002. elem.document.documentElement[ "client" + name ];
  17003. }
  17004. // Get document width or height
  17005. if ( elem.nodeType === 9 ) {
  17006. doc = elem.documentElement;
  17007. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  17008. // whichever is greatest
  17009. return Math.max(
  17010. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  17011. elem.body[ "offset" + name ], doc[ "offset" + name ],
  17012. doc[ "client" + name ]
  17013. );
  17014. }
  17015. return value === undefined ?
  17016. // Get width or height on the element, requesting but not forcing parseFloat
  17017. jQuery.css( elem, type, extra ) :
  17018. // Set width or height on the element
  17019. jQuery.style( elem, type, value, extra );
  17020. }, type, chainable ? margin : undefined, chainable );
  17021. };
  17022. } );
  17023. } );
  17024. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  17025. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  17026. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  17027. function( i, name ) {
  17028. // Handle event binding
  17029. jQuery.fn[ name ] = function( data, fn ) {
  17030. return arguments.length > 0 ?
  17031. this.on( name, null, data, fn ) :
  17032. this.trigger( name );
  17033. };
  17034. } );
  17035. jQuery.fn.extend( {
  17036. hover: function( fnOver, fnOut ) {
  17037. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  17038. }
  17039. } );
  17040. jQuery.fn.extend( {
  17041. bind: function( types, data, fn ) {
  17042. return this.on( types, null, data, fn );
  17043. },
  17044. unbind: function( types, fn ) {
  17045. return this.off( types, null, fn );
  17046. },
  17047. delegate: function( selector, types, data, fn ) {
  17048. return this.on( types, selector, data, fn );
  17049. },
  17050. undelegate: function( selector, types, fn ) {
  17051. // ( namespace ) or ( selector, types [, fn] )
  17052. return arguments.length === 1 ?
  17053. this.off( selector, "**" ) :
  17054. this.off( types, selector || "**", fn );
  17055. }
  17056. } );
  17057. // Bind a function to a context, optionally partially applying any
  17058. // arguments.
  17059. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  17060. // However, it is not slated for removal any time soon
  17061. jQuery.proxy = function( fn, context ) {
  17062. var tmp, args, proxy;
  17063. if ( typeof context === "string" ) {
  17064. tmp = fn[ context ];
  17065. context = fn;
  17066. fn = tmp;
  17067. }
  17068. // Quick check to determine if target is callable, in the spec
  17069. // this throws a TypeError, but we will just return undefined.
  17070. if ( !isFunction( fn ) ) {
  17071. return undefined;
  17072. }
  17073. // Simulated bind
  17074. args = slice.call( arguments, 2 );
  17075. proxy = function() {
  17076. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  17077. };
  17078. // Set the guid of unique handler to the same of original handler, so it can be removed
  17079. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  17080. return proxy;
  17081. };
  17082. jQuery.holdReady = function( hold ) {
  17083. if ( hold ) {
  17084. jQuery.readyWait++;
  17085. } else {
  17086. jQuery.ready( true );
  17087. }
  17088. };
  17089. jQuery.isArray = Array.isArray;
  17090. jQuery.parseJSON = JSON.parse;
  17091. jQuery.nodeName = nodeName;
  17092. jQuery.isFunction = isFunction;
  17093. jQuery.isWindow = isWindow;
  17094. jQuery.camelCase = camelCase;
  17095. jQuery.type = toType;
  17096. jQuery.now = Date.now;
  17097. jQuery.isNumeric = function( obj ) {
  17098. // As of jQuery 3.0, isNumeric is limited to
  17099. // strings and numbers (primitives or objects)
  17100. // that can be coerced to finite numbers (gh-2662)
  17101. var type = jQuery.type( obj );
  17102. return ( type === "number" || type === "string" ) &&
  17103. // parseFloat NaNs numeric-cast false positives ("")
  17104. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  17105. // subtraction forces infinities to NaN
  17106. !isNaN( obj - parseFloat( obj ) );
  17107. };
  17108. // Register as a named AMD module, since jQuery can be concatenated with other
  17109. // files that may use define, but not via a proper concatenation script that
  17110. // understands anonymous AMD modules. A named AMD is safest and most robust
  17111. // way to register. Lowercase jquery is used because AMD module names are
  17112. // derived from file names, and jQuery is normally delivered in a lowercase
  17113. // file name. Do this after creating the global so that if an AMD module wants
  17114. // to call noConflict to hide this version of jQuery, it will work.
  17115. // Note that for maximum portability, libraries that are not jQuery should
  17116. // declare themselves as anonymous modules, and avoid setting a global if an
  17117. // AMD loader is present. jQuery is a special case. For more information, see
  17118. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  17119. if ( true ) {
  17120. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  17121. return jQuery;
  17122. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  17123. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17124. }
  17125. var
  17126. // Map over jQuery in case of overwrite
  17127. _jQuery = window.jQuery,
  17128. // Map over the $ in case of overwrite
  17129. _$ = window.$;
  17130. jQuery.noConflict = function( deep ) {
  17131. if ( window.$ === jQuery ) {
  17132. window.$ = _$;
  17133. }
  17134. if ( deep && window.jQuery === jQuery ) {
  17135. window.jQuery = _jQuery;
  17136. }
  17137. return jQuery;
  17138. };
  17139. // Expose jQuery and $ identifiers, even in AMD
  17140. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  17141. // and CommonJS for browser emulators (#13566)
  17142. if ( !noGlobal ) {
  17143. window.jQuery = window.$ = jQuery;
  17144. }
  17145. return jQuery;
  17146. } );
  17147. /***/ }),
  17148. /***/ "./node_modules/laravel-echo/dist/echo.js":
  17149. /*!************************************************!*\
  17150. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  17151. \************************************************/
  17152. /*! exports provided: default */
  17153. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  17154. "use strict";
  17155. __webpack_require__.r(__webpack_exports__);
  17156. var classCallCheck = function (instance, Constructor) {
  17157. if (!(instance instanceof Constructor)) {
  17158. throw new TypeError("Cannot call a class as a function");
  17159. }
  17160. };
  17161. var createClass = function () {
  17162. function defineProperties(target, props) {
  17163. for (var i = 0; i < props.length; i++) {
  17164. var descriptor = props[i];
  17165. descriptor.enumerable = descriptor.enumerable || false;
  17166. descriptor.configurable = true;
  17167. if ("value" in descriptor) descriptor.writable = true;
  17168. Object.defineProperty(target, descriptor.key, descriptor);
  17169. }
  17170. }
  17171. return function (Constructor, protoProps, staticProps) {
  17172. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  17173. if (staticProps) defineProperties(Constructor, staticProps);
  17174. return Constructor;
  17175. };
  17176. }();
  17177. var _extends = Object.assign || function (target) {
  17178. for (var i = 1; i < arguments.length; i++) {
  17179. var source = arguments[i];
  17180. for (var key in source) {
  17181. if (Object.prototype.hasOwnProperty.call(source, key)) {
  17182. target[key] = source[key];
  17183. }
  17184. }
  17185. }
  17186. return target;
  17187. };
  17188. var inherits = function (subClass, superClass) {
  17189. if (typeof superClass !== "function" && superClass !== null) {
  17190. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  17191. }
  17192. subClass.prototype = Object.create(superClass && superClass.prototype, {
  17193. constructor: {
  17194. value: subClass,
  17195. enumerable: false,
  17196. writable: true,
  17197. configurable: true
  17198. }
  17199. });
  17200. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  17201. };
  17202. var possibleConstructorReturn = function (self, call) {
  17203. if (!self) {
  17204. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  17205. }
  17206. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  17207. };
  17208. var Connector = function () {
  17209. /**
  17210. * Create a new class instance.
  17211. */
  17212. function Connector(options) {
  17213. classCallCheck(this, Connector);
  17214. /**
  17215. * Default connector options.
  17216. */
  17217. this._defaultOptions = {
  17218. auth: {
  17219. headers: {}
  17220. },
  17221. authEndpoint: '/broadcasting/auth',
  17222. broadcaster: 'pusher',
  17223. csrfToken: null,
  17224. host: null,
  17225. key: null,
  17226. namespace: 'App.Events'
  17227. };
  17228. this.setOptions(options);
  17229. this.connect();
  17230. }
  17231. /**
  17232. * Merge the custom options with the defaults.
  17233. */
  17234. createClass(Connector, [{
  17235. key: 'setOptions',
  17236. value: function setOptions(options) {
  17237. this.options = _extends(this._defaultOptions, options);
  17238. if (this.csrfToken()) {
  17239. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  17240. }
  17241. return options;
  17242. }
  17243. /**
  17244. * Extract the CSRF token from the page.
  17245. */
  17246. }, {
  17247. key: 'csrfToken',
  17248. value: function csrfToken() {
  17249. var selector = void 0;
  17250. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  17251. return window['Laravel'].csrfToken;
  17252. } else if (this.options.csrfToken) {
  17253. return this.options.csrfToken;
  17254. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  17255. return selector.getAttribute('content');
  17256. }
  17257. return null;
  17258. }
  17259. }]);
  17260. return Connector;
  17261. }();
  17262. /**
  17263. * This class represents a basic channel.
  17264. */
  17265. var Channel = function () {
  17266. function Channel() {
  17267. classCallCheck(this, Channel);
  17268. }
  17269. createClass(Channel, [{
  17270. key: 'listenForWhisper',
  17271. /**
  17272. * Listen for a whisper event on the channel instance.
  17273. */
  17274. value: function listenForWhisper(event, callback) {
  17275. return this.listen('.client-' + event, callback);
  17276. }
  17277. /**
  17278. * Listen for an event on the channel instance.
  17279. */
  17280. }, {
  17281. key: 'notification',
  17282. value: function notification(callback) {
  17283. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  17284. }
  17285. /**
  17286. * Stop listening for a whispser event on the channel instance.
  17287. */
  17288. }, {
  17289. key: 'stopListeningForWhisper',
  17290. value: function stopListeningForWhisper(event) {
  17291. return this.stopListening('.client-' + event);
  17292. }
  17293. }]);
  17294. return Channel;
  17295. }();
  17296. /**
  17297. * Event name formatter
  17298. */
  17299. var EventFormatter = function () {
  17300. /**
  17301. * Create a new class instance.
  17302. */
  17303. function EventFormatter(namespace) {
  17304. classCallCheck(this, EventFormatter);
  17305. this.setNamespace(namespace);
  17306. }
  17307. /**
  17308. * Format the given event name.
  17309. */
  17310. createClass(EventFormatter, [{
  17311. key: 'format',
  17312. value: function format(event) {
  17313. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  17314. return event.substr(1);
  17315. } else if (this.namespace) {
  17316. event = this.namespace + '.' + event;
  17317. }
  17318. return event.replace(/\./g, '\\');
  17319. }
  17320. /**
  17321. * Set the event namespace.
  17322. */
  17323. }, {
  17324. key: 'setNamespace',
  17325. value: function setNamespace(value) {
  17326. this.namespace = value;
  17327. }
  17328. }]);
  17329. return EventFormatter;
  17330. }();
  17331. /**
  17332. * This class represents a Pusher channel.
  17333. */
  17334. var PusherChannel = function (_Channel) {
  17335. inherits(PusherChannel, _Channel);
  17336. /**
  17337. * Create a new class instance.
  17338. */
  17339. function PusherChannel(pusher, name, options) {
  17340. classCallCheck(this, PusherChannel);
  17341. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  17342. _this.name = name;
  17343. _this.pusher = pusher;
  17344. _this.options = options;
  17345. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17346. _this.subscribe();
  17347. return _this;
  17348. }
  17349. /**
  17350. * Subscribe to a Pusher channel.
  17351. */
  17352. createClass(PusherChannel, [{
  17353. key: 'subscribe',
  17354. value: function subscribe() {
  17355. this.subscription = this.pusher.subscribe(this.name);
  17356. }
  17357. /**
  17358. * Unsubscribe from a Pusher channel.
  17359. */
  17360. }, {
  17361. key: 'unsubscribe',
  17362. value: function unsubscribe() {
  17363. this.pusher.unsubscribe(this.name);
  17364. }
  17365. /**
  17366. * Listen for an event on the channel instance.
  17367. */
  17368. }, {
  17369. key: 'listen',
  17370. value: function listen(event, callback) {
  17371. this.on(this.eventFormatter.format(event), callback);
  17372. return this;
  17373. }
  17374. /**
  17375. * Stop listening for an event on the channel instance.
  17376. */
  17377. }, {
  17378. key: 'stopListening',
  17379. value: function stopListening(event) {
  17380. this.subscription.unbind(this.eventFormatter.format(event));
  17381. return this;
  17382. }
  17383. /**
  17384. * Bind a channel to an event.
  17385. */
  17386. }, {
  17387. key: 'on',
  17388. value: function on(event, callback) {
  17389. this.subscription.bind(event, callback);
  17390. return this;
  17391. }
  17392. }]);
  17393. return PusherChannel;
  17394. }(Channel);
  17395. /**
  17396. * This class represents a Pusher private channel.
  17397. */
  17398. var PusherPrivateChannel = function (_PusherChannel) {
  17399. inherits(PusherPrivateChannel, _PusherChannel);
  17400. function PusherPrivateChannel() {
  17401. classCallCheck(this, PusherPrivateChannel);
  17402. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  17403. }
  17404. createClass(PusherPrivateChannel, [{
  17405. key: 'whisper',
  17406. /**
  17407. * Trigger client event on the channel.
  17408. */
  17409. value: function whisper(eventName, data) {
  17410. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17411. return this;
  17412. }
  17413. }]);
  17414. return PusherPrivateChannel;
  17415. }(PusherChannel);
  17416. /**
  17417. * This class represents a Pusher presence channel.
  17418. */
  17419. var PusherPresenceChannel = function (_PusherChannel) {
  17420. inherits(PusherPresenceChannel, _PusherChannel);
  17421. function PusherPresenceChannel() {
  17422. classCallCheck(this, PusherPresenceChannel);
  17423. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  17424. }
  17425. createClass(PusherPresenceChannel, [{
  17426. key: 'here',
  17427. /**
  17428. * Register a callback to be called anytime the member list changes.
  17429. */
  17430. value: function here(callback) {
  17431. this.on('pusher:subscription_succeeded', function (data) {
  17432. callback(Object.keys(data.members).map(function (k) {
  17433. return data.members[k];
  17434. }));
  17435. });
  17436. return this;
  17437. }
  17438. /**
  17439. * Listen for someone joining the channel.
  17440. */
  17441. }, {
  17442. key: 'joining',
  17443. value: function joining(callback) {
  17444. this.on('pusher:member_added', function (member) {
  17445. callback(member.info);
  17446. });
  17447. return this;
  17448. }
  17449. /**
  17450. * Listen for someone leaving the channel.
  17451. */
  17452. }, {
  17453. key: 'leaving',
  17454. value: function leaving(callback) {
  17455. this.on('pusher:member_removed', function (member) {
  17456. callback(member.info);
  17457. });
  17458. return this;
  17459. }
  17460. /**
  17461. * Trigger client event on the channel.
  17462. */
  17463. }, {
  17464. key: 'whisper',
  17465. value: function whisper(eventName, data) {
  17466. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17467. return this;
  17468. }
  17469. }]);
  17470. return PusherPresenceChannel;
  17471. }(PusherChannel);
  17472. /**
  17473. * This class represents a Socket.io channel.
  17474. */
  17475. var SocketIoChannel = function (_Channel) {
  17476. inherits(SocketIoChannel, _Channel);
  17477. /**
  17478. * Create a new class instance.
  17479. */
  17480. function SocketIoChannel(socket, name, options) {
  17481. classCallCheck(this, SocketIoChannel);
  17482. /**
  17483. * The event callbacks applied to the channel.
  17484. */
  17485. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  17486. _this.events = {};
  17487. _this.name = name;
  17488. _this.socket = socket;
  17489. _this.options = options;
  17490. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17491. _this.subscribe();
  17492. _this.configureReconnector();
  17493. return _this;
  17494. }
  17495. /**
  17496. * Subscribe to a Socket.io channel.
  17497. */
  17498. createClass(SocketIoChannel, [{
  17499. key: 'subscribe',
  17500. value: function subscribe() {
  17501. this.socket.emit('subscribe', {
  17502. channel: this.name,
  17503. auth: this.options.auth || {}
  17504. });
  17505. }
  17506. /**
  17507. * Unsubscribe from channel and ubind event callbacks.
  17508. */
  17509. }, {
  17510. key: 'unsubscribe',
  17511. value: function unsubscribe() {
  17512. this.unbind();
  17513. this.socket.emit('unsubscribe', {
  17514. channel: this.name,
  17515. auth: this.options.auth || {}
  17516. });
  17517. }
  17518. /**
  17519. * Listen for an event on the channel instance.
  17520. */
  17521. }, {
  17522. key: 'listen',
  17523. value: function listen(event, callback) {
  17524. this.on(this.eventFormatter.format(event), callback);
  17525. return this;
  17526. }
  17527. /**
  17528. * Stop listening for an event on the channel instance.
  17529. */
  17530. }, {
  17531. key: 'stopListening',
  17532. value: function stopListening(event) {
  17533. var name = this.eventFormatter.format(event);
  17534. this.socket.removeListener(name);
  17535. delete this.events[name];
  17536. return this;
  17537. }
  17538. /**
  17539. * Bind the channel's socket to an event and store the callback.
  17540. */
  17541. }, {
  17542. key: 'on',
  17543. value: function on(event, callback) {
  17544. var _this2 = this;
  17545. var listener = function listener(channel, data) {
  17546. if (_this2.name == channel) {
  17547. callback(data);
  17548. }
  17549. };
  17550. this.socket.on(event, listener);
  17551. this.bind(event, listener);
  17552. }
  17553. /**
  17554. * Attach a 'reconnect' listener and bind the event.
  17555. */
  17556. }, {
  17557. key: 'configureReconnector',
  17558. value: function configureReconnector() {
  17559. var _this3 = this;
  17560. var listener = function listener() {
  17561. _this3.subscribe();
  17562. };
  17563. this.socket.on('reconnect', listener);
  17564. this.bind('reconnect', listener);
  17565. }
  17566. /**
  17567. * Bind the channel's socket to an event and store the callback.
  17568. */
  17569. }, {
  17570. key: 'bind',
  17571. value: function bind(event, callback) {
  17572. this.events[event] = this.events[event] || [];
  17573. this.events[event].push(callback);
  17574. }
  17575. /**
  17576. * Unbind the channel's socket from all stored event callbacks.
  17577. */
  17578. }, {
  17579. key: 'unbind',
  17580. value: function unbind() {
  17581. var _this4 = this;
  17582. Object.keys(this.events).forEach(function (event) {
  17583. _this4.events[event].forEach(function (callback) {
  17584. _this4.socket.removeListener(event, callback);
  17585. });
  17586. delete _this4.events[event];
  17587. });
  17588. }
  17589. }]);
  17590. return SocketIoChannel;
  17591. }(Channel);
  17592. /**
  17593. * This class represents a Socket.io presence channel.
  17594. */
  17595. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  17596. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  17597. function SocketIoPrivateChannel() {
  17598. classCallCheck(this, SocketIoPrivateChannel);
  17599. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  17600. }
  17601. createClass(SocketIoPrivateChannel, [{
  17602. key: 'whisper',
  17603. /**
  17604. * Trigger client event on the channel.
  17605. */
  17606. value: function whisper(eventName, data) {
  17607. this.socket.emit('client event', {
  17608. channel: this.name,
  17609. event: 'client-' + eventName,
  17610. data: data
  17611. });
  17612. return this;
  17613. }
  17614. }]);
  17615. return SocketIoPrivateChannel;
  17616. }(SocketIoChannel);
  17617. /**
  17618. * This class represents a Socket.io presence channel.
  17619. */
  17620. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  17621. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  17622. function SocketIoPresenceChannel() {
  17623. classCallCheck(this, SocketIoPresenceChannel);
  17624. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  17625. }
  17626. createClass(SocketIoPresenceChannel, [{
  17627. key: 'here',
  17628. /**
  17629. * Register a callback to be called anytime the member list changes.
  17630. */
  17631. value: function here(callback) {
  17632. this.on('presence:subscribed', function (members) {
  17633. callback(members.map(function (m) {
  17634. return m.user_info;
  17635. }));
  17636. });
  17637. return this;
  17638. }
  17639. /**
  17640. * Listen for someone joining the channel.
  17641. */
  17642. }, {
  17643. key: 'joining',
  17644. value: function joining(callback) {
  17645. this.on('presence:joining', function (member) {
  17646. return callback(member.user_info);
  17647. });
  17648. return this;
  17649. }
  17650. /**
  17651. * Listen for someone leaving the channel.
  17652. */
  17653. }, {
  17654. key: 'leaving',
  17655. value: function leaving(callback) {
  17656. this.on('presence:leaving', function (member) {
  17657. return callback(member.user_info);
  17658. });
  17659. return this;
  17660. }
  17661. }]);
  17662. return SocketIoPresenceChannel;
  17663. }(SocketIoPrivateChannel);
  17664. /**
  17665. * This class represents a null channel.
  17666. */
  17667. var NullChannel = function (_Channel) {
  17668. inherits(NullChannel, _Channel);
  17669. function NullChannel() {
  17670. classCallCheck(this, NullChannel);
  17671. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  17672. }
  17673. createClass(NullChannel, [{
  17674. key: 'subscribe',
  17675. /**
  17676. * Subscribe to a channel.
  17677. */
  17678. value: function subscribe() {}
  17679. //
  17680. /**
  17681. * Unsubscribe from a channel.
  17682. */
  17683. }, {
  17684. key: 'unsubscribe',
  17685. value: function unsubscribe() {}
  17686. //
  17687. /**
  17688. * Listen for an event on the channel instance.
  17689. */
  17690. }, {
  17691. key: 'listen',
  17692. value: function listen(event, callback) {
  17693. return this;
  17694. }
  17695. /**
  17696. * Stop listening for an event on the channel instance.
  17697. */
  17698. }, {
  17699. key: 'stopListening',
  17700. value: function stopListening(event) {
  17701. return this;
  17702. }
  17703. /**
  17704. * Bind a channel to an event.
  17705. */
  17706. }, {
  17707. key: 'on',
  17708. value: function on(event, callback) {
  17709. return this;
  17710. }
  17711. }]);
  17712. return NullChannel;
  17713. }(Channel);
  17714. /**
  17715. * This class represents a null private channel.
  17716. */
  17717. var NullPrivateChannel = function (_NullChannel) {
  17718. inherits(NullPrivateChannel, _NullChannel);
  17719. function NullPrivateChannel() {
  17720. classCallCheck(this, NullPrivateChannel);
  17721. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  17722. }
  17723. createClass(NullPrivateChannel, [{
  17724. key: 'whisper',
  17725. /**
  17726. * Trigger client event on the channel.
  17727. */
  17728. value: function whisper(eventName, data) {
  17729. return this;
  17730. }
  17731. }]);
  17732. return NullPrivateChannel;
  17733. }(NullChannel);
  17734. /**
  17735. * This class represents a null presence channel.
  17736. */
  17737. var NullPresenceChannel = function (_NullChannel) {
  17738. inherits(NullPresenceChannel, _NullChannel);
  17739. function NullPresenceChannel() {
  17740. classCallCheck(this, NullPresenceChannel);
  17741. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  17742. }
  17743. createClass(NullPresenceChannel, [{
  17744. key: 'here',
  17745. /**
  17746. * Register a callback to be called anytime the member list changes.
  17747. */
  17748. value: function here(callback) {
  17749. return this;
  17750. }
  17751. /**
  17752. * Listen for someone joining the channel.
  17753. */
  17754. }, {
  17755. key: 'joining',
  17756. value: function joining(callback) {
  17757. return this;
  17758. }
  17759. /**
  17760. * Listen for someone leaving the channel.
  17761. */
  17762. }, {
  17763. key: 'leaving',
  17764. value: function leaving(callback) {
  17765. return this;
  17766. }
  17767. /**
  17768. * Trigger client event on the channel.
  17769. */
  17770. }, {
  17771. key: 'whisper',
  17772. value: function whisper(eventName, data) {
  17773. return this;
  17774. }
  17775. }]);
  17776. return NullPresenceChannel;
  17777. }(NullChannel);
  17778. /**
  17779. * This class creates a connector to Pusher.
  17780. */
  17781. var PusherConnector = function (_Connector) {
  17782. inherits(PusherConnector, _Connector);
  17783. function PusherConnector() {
  17784. classCallCheck(this, PusherConnector);
  17785. /**
  17786. * All of the subscribed channel names.
  17787. */
  17788. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  17789. _this.channels = {};
  17790. return _this;
  17791. }
  17792. /**
  17793. * Create a fresh Pusher connection.
  17794. */
  17795. createClass(PusherConnector, [{
  17796. key: 'connect',
  17797. value: function connect() {
  17798. if (typeof this.options.client !== 'undefined') {
  17799. this.pusher = this.options.client;
  17800. } else {
  17801. this.pusher = new Pusher(this.options.key, this.options);
  17802. }
  17803. }
  17804. /**
  17805. * Listen for an event on a channel instance.
  17806. */
  17807. }, {
  17808. key: 'listen',
  17809. value: function listen(name, event, callback) {
  17810. return this.channel(name).listen(event, callback);
  17811. }
  17812. /**
  17813. * Get a channel instance by name.
  17814. */
  17815. }, {
  17816. key: 'channel',
  17817. value: function channel(name) {
  17818. if (!this.channels[name]) {
  17819. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  17820. }
  17821. return this.channels[name];
  17822. }
  17823. /**
  17824. * Get a private channel instance by name.
  17825. */
  17826. }, {
  17827. key: 'privateChannel',
  17828. value: function privateChannel(name) {
  17829. if (!this.channels['private-' + name]) {
  17830. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  17831. }
  17832. return this.channels['private-' + name];
  17833. }
  17834. /**
  17835. * Get a presence channel instance by name.
  17836. */
  17837. }, {
  17838. key: 'presenceChannel',
  17839. value: function presenceChannel(name) {
  17840. if (!this.channels['presence-' + name]) {
  17841. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  17842. }
  17843. return this.channels['presence-' + name];
  17844. }
  17845. /**
  17846. * Leave the given channel, as well as its private and presence variants.
  17847. */
  17848. }, {
  17849. key: 'leave',
  17850. value: function leave(name) {
  17851. var _this2 = this;
  17852. var channels = [name, 'private-' + name, 'presence-' + name];
  17853. channels.forEach(function (name, index) {
  17854. _this2.leaveChannel(name);
  17855. });
  17856. }
  17857. /**
  17858. * Leave the given channel.
  17859. */
  17860. }, {
  17861. key: 'leaveChannel',
  17862. value: function leaveChannel(name) {
  17863. if (this.channels[name]) {
  17864. this.channels[name].unsubscribe();
  17865. delete this.channels[name];
  17866. }
  17867. }
  17868. /**
  17869. * Get the socket ID for the connection.
  17870. */
  17871. }, {
  17872. key: 'socketId',
  17873. value: function socketId() {
  17874. return this.pusher.connection.socket_id;
  17875. }
  17876. /**
  17877. * Disconnect Pusher connection.
  17878. */
  17879. }, {
  17880. key: 'disconnect',
  17881. value: function disconnect() {
  17882. this.pusher.disconnect();
  17883. }
  17884. }]);
  17885. return PusherConnector;
  17886. }(Connector);
  17887. /**
  17888. * This class creates a connnector to a Socket.io server.
  17889. */
  17890. var SocketIoConnector = function (_Connector) {
  17891. inherits(SocketIoConnector, _Connector);
  17892. function SocketIoConnector() {
  17893. classCallCheck(this, SocketIoConnector);
  17894. /**
  17895. * All of the subscribed channel names.
  17896. */
  17897. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  17898. _this.channels = {};
  17899. return _this;
  17900. }
  17901. /**
  17902. * Create a fresh Socket.io connection.
  17903. */
  17904. createClass(SocketIoConnector, [{
  17905. key: 'connect',
  17906. value: function connect() {
  17907. var io = this.getSocketIO();
  17908. this.socket = io(this.options.host, this.options);
  17909. return this.socket;
  17910. }
  17911. /**
  17912. * Get socket.io module from global scope or options.
  17913. */
  17914. }, {
  17915. key: 'getSocketIO',
  17916. value: function getSocketIO() {
  17917. if (typeof this.options.client !== 'undefined') {
  17918. return this.options.client;
  17919. }
  17920. if (typeof io !== 'undefined') {
  17921. return io;
  17922. }
  17923. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  17924. }
  17925. /**
  17926. * Listen for an event on a channel instance.
  17927. */
  17928. }, {
  17929. key: 'listen',
  17930. value: function listen(name, event, callback) {
  17931. return this.channel(name).listen(event, callback);
  17932. }
  17933. /**
  17934. * Get a channel instance by name.
  17935. */
  17936. }, {
  17937. key: 'channel',
  17938. value: function channel(name) {
  17939. if (!this.channels[name]) {
  17940. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  17941. }
  17942. return this.channels[name];
  17943. }
  17944. /**
  17945. * Get a private channel instance by name.
  17946. */
  17947. }, {
  17948. key: 'privateChannel',
  17949. value: function privateChannel(name) {
  17950. if (!this.channels['private-' + name]) {
  17951. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  17952. }
  17953. return this.channels['private-' + name];
  17954. }
  17955. /**
  17956. * Get a presence channel instance by name.
  17957. */
  17958. }, {
  17959. key: 'presenceChannel',
  17960. value: function presenceChannel(name) {
  17961. if (!this.channels['presence-' + name]) {
  17962. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  17963. }
  17964. return this.channels['presence-' + name];
  17965. }
  17966. /**
  17967. * Leave the given channel, as well as its private and presence variants.
  17968. */
  17969. }, {
  17970. key: 'leave',
  17971. value: function leave(name) {
  17972. var _this2 = this;
  17973. var channels = [name, 'private-' + name, 'presence-' + name];
  17974. channels.forEach(function (name) {
  17975. _this2.leaveChannel(name);
  17976. });
  17977. }
  17978. /**
  17979. * Leave the given channel.
  17980. */
  17981. }, {
  17982. key: 'leaveChannel',
  17983. value: function leaveChannel(name) {
  17984. if (this.channels[name]) {
  17985. this.channels[name].unsubscribe();
  17986. delete this.channels[name];
  17987. }
  17988. }
  17989. /**
  17990. * Get the socket ID for the connection.
  17991. */
  17992. }, {
  17993. key: 'socketId',
  17994. value: function socketId() {
  17995. return this.socket.id;
  17996. }
  17997. /**
  17998. * Disconnect Socketio connection.
  17999. */
  18000. }, {
  18001. key: 'disconnect',
  18002. value: function disconnect() {
  18003. this.socket.disconnect();
  18004. }
  18005. }]);
  18006. return SocketIoConnector;
  18007. }(Connector);
  18008. /**
  18009. * This class creates a null connector.
  18010. */
  18011. var NullConnector = function (_Connector) {
  18012. inherits(NullConnector, _Connector);
  18013. function NullConnector() {
  18014. classCallCheck(this, NullConnector);
  18015. /**
  18016. * All of the subscribed channel names.
  18017. */
  18018. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  18019. _this.channels = {};
  18020. return _this;
  18021. }
  18022. /**
  18023. * Create a fresh connection.
  18024. */
  18025. createClass(NullConnector, [{
  18026. key: 'connect',
  18027. value: function connect() {}
  18028. //
  18029. /**
  18030. * Listen for an event on a channel instance.
  18031. */
  18032. }, {
  18033. key: 'listen',
  18034. value: function listen(name, event, callback) {
  18035. return new NullChannel();
  18036. }
  18037. /**
  18038. * Get a channel instance by name.
  18039. */
  18040. }, {
  18041. key: 'channel',
  18042. value: function channel(name) {
  18043. return new NullChannel();
  18044. }
  18045. /**
  18046. * Get a private channel instance by name.
  18047. */
  18048. }, {
  18049. key: 'privateChannel',
  18050. value: function privateChannel(name) {
  18051. return new NullPrivateChannel();
  18052. }
  18053. /**
  18054. * Get a presence channel instance by name.
  18055. */
  18056. }, {
  18057. key: 'presenceChannel',
  18058. value: function presenceChannel(name) {
  18059. return new NullPresenceChannel();
  18060. }
  18061. /**
  18062. * Leave the given channel, as well as its private and presence variants.
  18063. */
  18064. }, {
  18065. key: 'leave',
  18066. value: function leave(name) {}
  18067. //
  18068. /**
  18069. * Leave the given channel.
  18070. */
  18071. }, {
  18072. key: 'leaveChannel',
  18073. value: function leaveChannel(name) {}
  18074. //
  18075. /**
  18076. * Get the socket ID for the connection.
  18077. */
  18078. }, {
  18079. key: 'socketId',
  18080. value: function socketId() {
  18081. return 'fake-socket-id';
  18082. }
  18083. /**
  18084. * Disconnect the connection.
  18085. */
  18086. }, {
  18087. key: 'disconnect',
  18088. value: function disconnect() {
  18089. //
  18090. }
  18091. }]);
  18092. return NullConnector;
  18093. }(Connector);
  18094. /**
  18095. * This class is the primary API for interacting with broadcasting.
  18096. */
  18097. var Echo = function () {
  18098. /**
  18099. * Create a new class instance.
  18100. */
  18101. function Echo(options) {
  18102. classCallCheck(this, Echo);
  18103. this.options = options;
  18104. this.connect();
  18105. if (!this.options.withoutInterceptors) {
  18106. this.registerInterceptors();
  18107. }
  18108. }
  18109. /**
  18110. * Get a channel instance by name.
  18111. */
  18112. createClass(Echo, [{
  18113. key: 'channel',
  18114. value: function channel(_channel) {
  18115. return this.connector.channel(_channel);
  18116. }
  18117. /**
  18118. * Create a new connection.
  18119. */
  18120. }, {
  18121. key: 'connect',
  18122. value: function connect() {
  18123. if (this.options.broadcaster == 'pusher') {
  18124. this.connector = new PusherConnector(this.options);
  18125. } else if (this.options.broadcaster == 'socket.io') {
  18126. this.connector = new SocketIoConnector(this.options);
  18127. } else if (this.options.broadcaster == 'null') {
  18128. this.connector = new NullConnector(this.options);
  18129. } else if (typeof this.options.broadcaster == 'function') {
  18130. this.connector = new this.options.broadcaster(this.options);
  18131. }
  18132. }
  18133. /**
  18134. * Disconnect from the Echo server.
  18135. */
  18136. }, {
  18137. key: 'disconnect',
  18138. value: function disconnect() {
  18139. this.connector.disconnect();
  18140. }
  18141. /**
  18142. * Get a presence channel instance by name.
  18143. */
  18144. }, {
  18145. key: 'join',
  18146. value: function join(channel) {
  18147. return this.connector.presenceChannel(channel);
  18148. }
  18149. /**
  18150. * Leave the given channel, as well as its private and presence variants.
  18151. */
  18152. }, {
  18153. key: 'leave',
  18154. value: function leave(channel) {
  18155. this.connector.leave(channel);
  18156. }
  18157. /**
  18158. * Leave the given channel.
  18159. */
  18160. }, {
  18161. key: 'leaveChannel',
  18162. value: function leaveChannel(channel) {
  18163. this.connector.leaveChannel(channel);
  18164. }
  18165. /**
  18166. * Listen for an event on a channel instance.
  18167. */
  18168. }, {
  18169. key: 'listen',
  18170. value: function listen(channel, event, callback) {
  18171. return this.connector.listen(channel, event, callback);
  18172. }
  18173. /**
  18174. * Get a private channel instance by name.
  18175. */
  18176. }, {
  18177. key: 'private',
  18178. value: function _private(channel) {
  18179. return this.connector.privateChannel(channel);
  18180. }
  18181. /**
  18182. * Get the Socket ID for the connection.
  18183. */
  18184. }, {
  18185. key: 'socketId',
  18186. value: function socketId() {
  18187. return this.connector.socketId();
  18188. }
  18189. /**
  18190. * Register 3rd party request interceptiors. These are used to automatically
  18191. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  18192. */
  18193. }, {
  18194. key: 'registerInterceptors',
  18195. value: function registerInterceptors() {
  18196. if (typeof Vue === 'function' && Vue.http) {
  18197. this.registerVueRequestInterceptor();
  18198. }
  18199. if (typeof axios === 'function') {
  18200. this.registerAxiosRequestInterceptor();
  18201. }
  18202. if (typeof jQuery === 'function') {
  18203. this.registerjQueryAjaxSetup();
  18204. }
  18205. }
  18206. /**
  18207. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  18208. */
  18209. }, {
  18210. key: 'registerVueRequestInterceptor',
  18211. value: function registerVueRequestInterceptor() {
  18212. var _this = this;
  18213. Vue.http.interceptors.push(function (request, next) {
  18214. if (_this.socketId()) {
  18215. request.headers.set('X-Socket-ID', _this.socketId());
  18216. }
  18217. next();
  18218. });
  18219. }
  18220. /**
  18221. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  18222. */
  18223. }, {
  18224. key: 'registerAxiosRequestInterceptor',
  18225. value: function registerAxiosRequestInterceptor() {
  18226. var _this2 = this;
  18227. axios.interceptors.request.use(function (config) {
  18228. if (_this2.socketId()) {
  18229. config.headers['X-Socket-Id'] = _this2.socketId();
  18230. }
  18231. return config;
  18232. });
  18233. }
  18234. /**
  18235. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  18236. */
  18237. }, {
  18238. key: 'registerjQueryAjaxSetup',
  18239. value: function registerjQueryAjaxSetup() {
  18240. var _this3 = this;
  18241. if (typeof jQuery.ajax != 'undefined') {
  18242. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  18243. if (_this3.socketId()) {
  18244. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  18245. }
  18246. });
  18247. }
  18248. }
  18249. }]);
  18250. return Echo;
  18251. }();
  18252. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  18253. /***/ }),
  18254. /***/ "./node_modules/lodash/lodash.js":
  18255. /*!***************************************!*\
  18256. !*** ./node_modules/lodash/lodash.js ***!
  18257. \***************************************/
  18258. /*! no static exports found */
  18259. /***/ (function(module, exports, __webpack_require__) {
  18260. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  18261. * @license
  18262. * Lodash <https://lodash.com/>
  18263. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  18264. * Released under MIT license <https://lodash.com/license>
  18265. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  18266. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  18267. */
  18268. ;(function() {
  18269. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  18270. var undefined;
  18271. /** Used as the semantic version number. */
  18272. var VERSION = '4.17.15';
  18273. /** Used as the size to enable large array optimizations. */
  18274. var LARGE_ARRAY_SIZE = 200;
  18275. /** Error message constants. */
  18276. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  18277. FUNC_ERROR_TEXT = 'Expected a function';
  18278. /** Used to stand-in for `undefined` hash values. */
  18279. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  18280. /** Used as the maximum memoize cache size. */
  18281. var MAX_MEMOIZE_SIZE = 500;
  18282. /** Used as the internal argument placeholder. */
  18283. var PLACEHOLDER = '__lodash_placeholder__';
  18284. /** Used to compose bitmasks for cloning. */
  18285. var CLONE_DEEP_FLAG = 1,
  18286. CLONE_FLAT_FLAG = 2,
  18287. CLONE_SYMBOLS_FLAG = 4;
  18288. /** Used to compose bitmasks for value comparisons. */
  18289. var COMPARE_PARTIAL_FLAG = 1,
  18290. COMPARE_UNORDERED_FLAG = 2;
  18291. /** Used to compose bitmasks for function metadata. */
  18292. var WRAP_BIND_FLAG = 1,
  18293. WRAP_BIND_KEY_FLAG = 2,
  18294. WRAP_CURRY_BOUND_FLAG = 4,
  18295. WRAP_CURRY_FLAG = 8,
  18296. WRAP_CURRY_RIGHT_FLAG = 16,
  18297. WRAP_PARTIAL_FLAG = 32,
  18298. WRAP_PARTIAL_RIGHT_FLAG = 64,
  18299. WRAP_ARY_FLAG = 128,
  18300. WRAP_REARG_FLAG = 256,
  18301. WRAP_FLIP_FLAG = 512;
  18302. /** Used as default options for `_.truncate`. */
  18303. var DEFAULT_TRUNC_LENGTH = 30,
  18304. DEFAULT_TRUNC_OMISSION = '...';
  18305. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  18306. var HOT_COUNT = 800,
  18307. HOT_SPAN = 16;
  18308. /** Used to indicate the type of lazy iteratees. */
  18309. var LAZY_FILTER_FLAG = 1,
  18310. LAZY_MAP_FLAG = 2,
  18311. LAZY_WHILE_FLAG = 3;
  18312. /** Used as references for various `Number` constants. */
  18313. var INFINITY = 1 / 0,
  18314. MAX_SAFE_INTEGER = 9007199254740991,
  18315. MAX_INTEGER = 1.7976931348623157e+308,
  18316. NAN = 0 / 0;
  18317. /** Used as references for the maximum length and index of an array. */
  18318. var MAX_ARRAY_LENGTH = 4294967295,
  18319. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  18320. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  18321. /** Used to associate wrap methods with their bit flags. */
  18322. var wrapFlags = [
  18323. ['ary', WRAP_ARY_FLAG],
  18324. ['bind', WRAP_BIND_FLAG],
  18325. ['bindKey', WRAP_BIND_KEY_FLAG],
  18326. ['curry', WRAP_CURRY_FLAG],
  18327. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  18328. ['flip', WRAP_FLIP_FLAG],
  18329. ['partial', WRAP_PARTIAL_FLAG],
  18330. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  18331. ['rearg', WRAP_REARG_FLAG]
  18332. ];
  18333. /** `Object#toString` result references. */
  18334. var argsTag = '[object Arguments]',
  18335. arrayTag = '[object Array]',
  18336. asyncTag = '[object AsyncFunction]',
  18337. boolTag = '[object Boolean]',
  18338. dateTag = '[object Date]',
  18339. domExcTag = '[object DOMException]',
  18340. errorTag = '[object Error]',
  18341. funcTag = '[object Function]',
  18342. genTag = '[object GeneratorFunction]',
  18343. mapTag = '[object Map]',
  18344. numberTag = '[object Number]',
  18345. nullTag = '[object Null]',
  18346. objectTag = '[object Object]',
  18347. promiseTag = '[object Promise]',
  18348. proxyTag = '[object Proxy]',
  18349. regexpTag = '[object RegExp]',
  18350. setTag = '[object Set]',
  18351. stringTag = '[object String]',
  18352. symbolTag = '[object Symbol]',
  18353. undefinedTag = '[object Undefined]',
  18354. weakMapTag = '[object WeakMap]',
  18355. weakSetTag = '[object WeakSet]';
  18356. var arrayBufferTag = '[object ArrayBuffer]',
  18357. dataViewTag = '[object DataView]',
  18358. float32Tag = '[object Float32Array]',
  18359. float64Tag = '[object Float64Array]',
  18360. int8Tag = '[object Int8Array]',
  18361. int16Tag = '[object Int16Array]',
  18362. int32Tag = '[object Int32Array]',
  18363. uint8Tag = '[object Uint8Array]',
  18364. uint8ClampedTag = '[object Uint8ClampedArray]',
  18365. uint16Tag = '[object Uint16Array]',
  18366. uint32Tag = '[object Uint32Array]';
  18367. /** Used to match empty string literals in compiled template source. */
  18368. var reEmptyStringLeading = /\b__p \+= '';/g,
  18369. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  18370. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  18371. /** Used to match HTML entities and HTML characters. */
  18372. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  18373. reUnescapedHtml = /[&<>"']/g,
  18374. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  18375. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  18376. /** Used to match template delimiters. */
  18377. var reEscape = /<%-([\s\S]+?)%>/g,
  18378. reEvaluate = /<%([\s\S]+?)%>/g,
  18379. reInterpolate = /<%=([\s\S]+?)%>/g;
  18380. /** Used to match property names within property paths. */
  18381. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  18382. reIsPlainProp = /^\w*$/,
  18383. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  18384. /**
  18385. * Used to match `RegExp`
  18386. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  18387. */
  18388. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  18389. reHasRegExpChar = RegExp(reRegExpChar.source);
  18390. /** Used to match leading and trailing whitespace. */
  18391. var reTrim = /^\s+|\s+$/g,
  18392. reTrimStart = /^\s+/,
  18393. reTrimEnd = /\s+$/;
  18394. /** Used to match wrap detail comments. */
  18395. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  18396. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  18397. reSplitDetails = /,? & /;
  18398. /** Used to match words composed of alphanumeric characters. */
  18399. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  18400. /** Used to match backslashes in property paths. */
  18401. var reEscapeChar = /\\(\\)?/g;
  18402. /**
  18403. * Used to match
  18404. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  18405. */
  18406. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  18407. /** Used to match `RegExp` flags from their coerced string values. */
  18408. var reFlags = /\w*$/;
  18409. /** Used to detect bad signed hexadecimal string values. */
  18410. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  18411. /** Used to detect binary string values. */
  18412. var reIsBinary = /^0b[01]+$/i;
  18413. /** Used to detect host constructors (Safari). */
  18414. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  18415. /** Used to detect octal string values. */
  18416. var reIsOctal = /^0o[0-7]+$/i;
  18417. /** Used to detect unsigned integer values. */
  18418. var reIsUint = /^(?:0|[1-9]\d*)$/;
  18419. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  18420. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  18421. /** Used to ensure capturing order of template delimiters. */
  18422. var reNoMatch = /($^)/;
  18423. /** Used to match unescaped characters in compiled string literals. */
  18424. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  18425. /** Used to compose unicode character classes. */
  18426. var rsAstralRange = '\\ud800-\\udfff',
  18427. rsComboMarksRange = '\\u0300-\\u036f',
  18428. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  18429. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  18430. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  18431. rsDingbatRange = '\\u2700-\\u27bf',
  18432. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  18433. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  18434. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  18435. rsPunctuationRange = '\\u2000-\\u206f',
  18436. 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',
  18437. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  18438. rsVarRange = '\\ufe0e\\ufe0f',
  18439. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  18440. /** Used to compose unicode capture groups. */
  18441. var rsApos = "['\u2019]",
  18442. rsAstral = '[' + rsAstralRange + ']',
  18443. rsBreak = '[' + rsBreakRange + ']',
  18444. rsCombo = '[' + rsComboRange + ']',
  18445. rsDigits = '\\d+',
  18446. rsDingbat = '[' + rsDingbatRange + ']',
  18447. rsLower = '[' + rsLowerRange + ']',
  18448. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  18449. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  18450. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  18451. rsNonAstral = '[^' + rsAstralRange + ']',
  18452. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  18453. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  18454. rsUpper = '[' + rsUpperRange + ']',
  18455. rsZWJ = '\\u200d';
  18456. /** Used to compose unicode regexes. */
  18457. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  18458. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  18459. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  18460. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  18461. reOptMod = rsModifier + '?',
  18462. rsOptVar = '[' + rsVarRange + ']?',
  18463. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  18464. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  18465. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  18466. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  18467. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  18468. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  18469. /** Used to match apostrophes. */
  18470. var reApos = RegExp(rsApos, 'g');
  18471. /**
  18472. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  18473. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  18474. */
  18475. var reComboMark = RegExp(rsCombo, 'g');
  18476. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  18477. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  18478. /** Used to match complex or compound words. */
  18479. var reUnicodeWord = RegExp([
  18480. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  18481. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  18482. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  18483. rsUpper + '+' + rsOptContrUpper,
  18484. rsOrdUpper,
  18485. rsOrdLower,
  18486. rsDigits,
  18487. rsEmoji
  18488. ].join('|'), 'g');
  18489. /** 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/). */
  18490. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  18491. /** Used to detect strings that need a more robust regexp to match words. */
  18492. 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 ]/;
  18493. /** Used to assign default `context` object properties. */
  18494. var contextProps = [
  18495. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  18496. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  18497. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  18498. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  18499. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  18500. ];
  18501. /** Used to make template sourceURLs easier to identify. */
  18502. var templateCounter = -1;
  18503. /** Used to identify `toStringTag` values of typed arrays. */
  18504. var typedArrayTags = {};
  18505. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  18506. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  18507. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  18508. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  18509. typedArrayTags[uint32Tag] = true;
  18510. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  18511. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  18512. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  18513. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  18514. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  18515. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  18516. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  18517. typedArrayTags[weakMapTag] = false;
  18518. /** Used to identify `toStringTag` values supported by `_.clone`. */
  18519. var cloneableTags = {};
  18520. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  18521. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  18522. cloneableTags[boolTag] = cloneableTags[dateTag] =
  18523. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  18524. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  18525. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  18526. cloneableTags[numberTag] = cloneableTags[objectTag] =
  18527. cloneableTags[regexpTag] = cloneableTags[setTag] =
  18528. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  18529. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  18530. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  18531. cloneableTags[errorTag] = cloneableTags[funcTag] =
  18532. cloneableTags[weakMapTag] = false;
  18533. /** Used to map Latin Unicode letters to basic Latin letters. */
  18534. var deburredLetters = {
  18535. // Latin-1 Supplement block.
  18536. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  18537. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  18538. '\xc7': 'C', '\xe7': 'c',
  18539. '\xd0': 'D', '\xf0': 'd',
  18540. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  18541. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  18542. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  18543. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  18544. '\xd1': 'N', '\xf1': 'n',
  18545. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  18546. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  18547. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  18548. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  18549. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  18550. '\xc6': 'Ae', '\xe6': 'ae',
  18551. '\xde': 'Th', '\xfe': 'th',
  18552. '\xdf': 'ss',
  18553. // Latin Extended-A block.
  18554. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  18555. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  18556. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  18557. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  18558. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  18559. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  18560. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  18561. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  18562. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  18563. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  18564. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  18565. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  18566. '\u0134': 'J', '\u0135': 'j',
  18567. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  18568. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  18569. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  18570. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  18571. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  18572. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  18573. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  18574. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  18575. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  18576. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  18577. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  18578. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  18579. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  18580. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  18581. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  18582. '\u0174': 'W', '\u0175': 'w',
  18583. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  18584. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  18585. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  18586. '\u0132': 'IJ', '\u0133': 'ij',
  18587. '\u0152': 'Oe', '\u0153': 'oe',
  18588. '\u0149': "'n", '\u017f': 's'
  18589. };
  18590. /** Used to map characters to HTML entities. */
  18591. var htmlEscapes = {
  18592. '&': '&amp;',
  18593. '<': '&lt;',
  18594. '>': '&gt;',
  18595. '"': '&quot;',
  18596. "'": '&#39;'
  18597. };
  18598. /** Used to map HTML entities to characters. */
  18599. var htmlUnescapes = {
  18600. '&amp;': '&',
  18601. '&lt;': '<',
  18602. '&gt;': '>',
  18603. '&quot;': '"',
  18604. '&#39;': "'"
  18605. };
  18606. /** Used to escape characters for inclusion in compiled string literals. */
  18607. var stringEscapes = {
  18608. '\\': '\\',
  18609. "'": "'",
  18610. '\n': 'n',
  18611. '\r': 'r',
  18612. '\u2028': 'u2028',
  18613. '\u2029': 'u2029'
  18614. };
  18615. /** Built-in method references without a dependency on `root`. */
  18616. var freeParseFloat = parseFloat,
  18617. freeParseInt = parseInt;
  18618. /** Detect free variable `global` from Node.js. */
  18619. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  18620. /** Detect free variable `self`. */
  18621. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  18622. /** Used as a reference to the global object. */
  18623. var root = freeGlobal || freeSelf || Function('return this')();
  18624. /** Detect free variable `exports`. */
  18625. var freeExports = true && exports && !exports.nodeType && exports;
  18626. /** Detect free variable `module`. */
  18627. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  18628. /** Detect the popular CommonJS extension `module.exports`. */
  18629. var moduleExports = freeModule && freeModule.exports === freeExports;
  18630. /** Detect free variable `process` from Node.js. */
  18631. var freeProcess = moduleExports && freeGlobal.process;
  18632. /** Used to access faster Node.js helpers. */
  18633. var nodeUtil = (function() {
  18634. try {
  18635. // Use `util.types` for Node.js 10+.
  18636. var types = freeModule && freeModule.require && freeModule.require('util').types;
  18637. if (types) {
  18638. return types;
  18639. }
  18640. // Legacy `process.binding('util')` for Node.js < 10.
  18641. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  18642. } catch (e) {}
  18643. }());
  18644. /* Node.js helper references. */
  18645. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  18646. nodeIsDate = nodeUtil && nodeUtil.isDate,
  18647. nodeIsMap = nodeUtil && nodeUtil.isMap,
  18648. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  18649. nodeIsSet = nodeUtil && nodeUtil.isSet,
  18650. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  18651. /*--------------------------------------------------------------------------*/
  18652. /**
  18653. * A faster alternative to `Function#apply`, this function invokes `func`
  18654. * with the `this` binding of `thisArg` and the arguments of `args`.
  18655. *
  18656. * @private
  18657. * @param {Function} func The function to invoke.
  18658. * @param {*} thisArg The `this` binding of `func`.
  18659. * @param {Array} args The arguments to invoke `func` with.
  18660. * @returns {*} Returns the result of `func`.
  18661. */
  18662. function apply(func, thisArg, args) {
  18663. switch (args.length) {
  18664. case 0: return func.call(thisArg);
  18665. case 1: return func.call(thisArg, args[0]);
  18666. case 2: return func.call(thisArg, args[0], args[1]);
  18667. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  18668. }
  18669. return func.apply(thisArg, args);
  18670. }
  18671. /**
  18672. * A specialized version of `baseAggregator` for arrays.
  18673. *
  18674. * @private
  18675. * @param {Array} [array] The array to iterate over.
  18676. * @param {Function} setter The function to set `accumulator` values.
  18677. * @param {Function} iteratee The iteratee to transform keys.
  18678. * @param {Object} accumulator The initial aggregated object.
  18679. * @returns {Function} Returns `accumulator`.
  18680. */
  18681. function arrayAggregator(array, setter, iteratee, accumulator) {
  18682. var index = -1,
  18683. length = array == null ? 0 : array.length;
  18684. while (++index < length) {
  18685. var value = array[index];
  18686. setter(accumulator, value, iteratee(value), array);
  18687. }
  18688. return accumulator;
  18689. }
  18690. /**
  18691. * A specialized version of `_.forEach` for arrays without support for
  18692. * iteratee shorthands.
  18693. *
  18694. * @private
  18695. * @param {Array} [array] The array to iterate over.
  18696. * @param {Function} iteratee The function invoked per iteration.
  18697. * @returns {Array} Returns `array`.
  18698. */
  18699. function arrayEach(array, iteratee) {
  18700. var index = -1,
  18701. length = array == null ? 0 : array.length;
  18702. while (++index < length) {
  18703. if (iteratee(array[index], index, array) === false) {
  18704. break;
  18705. }
  18706. }
  18707. return array;
  18708. }
  18709. /**
  18710. * A specialized version of `_.forEachRight` for arrays without support for
  18711. * iteratee shorthands.
  18712. *
  18713. * @private
  18714. * @param {Array} [array] The array to iterate over.
  18715. * @param {Function} iteratee The function invoked per iteration.
  18716. * @returns {Array} Returns `array`.
  18717. */
  18718. function arrayEachRight(array, iteratee) {
  18719. var length = array == null ? 0 : array.length;
  18720. while (length--) {
  18721. if (iteratee(array[length], length, array) === false) {
  18722. break;
  18723. }
  18724. }
  18725. return array;
  18726. }
  18727. /**
  18728. * A specialized version of `_.every` for arrays without support for
  18729. * iteratee shorthands.
  18730. *
  18731. * @private
  18732. * @param {Array} [array] The array to iterate over.
  18733. * @param {Function} predicate The function invoked per iteration.
  18734. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  18735. * else `false`.
  18736. */
  18737. function arrayEvery(array, predicate) {
  18738. var index = -1,
  18739. length = array == null ? 0 : array.length;
  18740. while (++index < length) {
  18741. if (!predicate(array[index], index, array)) {
  18742. return false;
  18743. }
  18744. }
  18745. return true;
  18746. }
  18747. /**
  18748. * A specialized version of `_.filter` for arrays without support for
  18749. * iteratee shorthands.
  18750. *
  18751. * @private
  18752. * @param {Array} [array] The array to iterate over.
  18753. * @param {Function} predicate The function invoked per iteration.
  18754. * @returns {Array} Returns the new filtered array.
  18755. */
  18756. function arrayFilter(array, predicate) {
  18757. var index = -1,
  18758. length = array == null ? 0 : array.length,
  18759. resIndex = 0,
  18760. result = [];
  18761. while (++index < length) {
  18762. var value = array[index];
  18763. if (predicate(value, index, array)) {
  18764. result[resIndex++] = value;
  18765. }
  18766. }
  18767. return result;
  18768. }
  18769. /**
  18770. * A specialized version of `_.includes` for arrays without support for
  18771. * specifying an index to search from.
  18772. *
  18773. * @private
  18774. * @param {Array} [array] The array to inspect.
  18775. * @param {*} target The value to search for.
  18776. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18777. */
  18778. function arrayIncludes(array, value) {
  18779. var length = array == null ? 0 : array.length;
  18780. return !!length && baseIndexOf(array, value, 0) > -1;
  18781. }
  18782. /**
  18783. * This function is like `arrayIncludes` except that it accepts a comparator.
  18784. *
  18785. * @private
  18786. * @param {Array} [array] The array to inspect.
  18787. * @param {*} target The value to search for.
  18788. * @param {Function} comparator The comparator invoked per element.
  18789. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18790. */
  18791. function arrayIncludesWith(array, value, comparator) {
  18792. var index = -1,
  18793. length = array == null ? 0 : array.length;
  18794. while (++index < length) {
  18795. if (comparator(value, array[index])) {
  18796. return true;
  18797. }
  18798. }
  18799. return false;
  18800. }
  18801. /**
  18802. * A specialized version of `_.map` for arrays without support for iteratee
  18803. * shorthands.
  18804. *
  18805. * @private
  18806. * @param {Array} [array] The array to iterate over.
  18807. * @param {Function} iteratee The function invoked per iteration.
  18808. * @returns {Array} Returns the new mapped array.
  18809. */
  18810. function arrayMap(array, iteratee) {
  18811. var index = -1,
  18812. length = array == null ? 0 : array.length,
  18813. result = Array(length);
  18814. while (++index < length) {
  18815. result[index] = iteratee(array[index], index, array);
  18816. }
  18817. return result;
  18818. }
  18819. /**
  18820. * Appends the elements of `values` to `array`.
  18821. *
  18822. * @private
  18823. * @param {Array} array The array to modify.
  18824. * @param {Array} values The values to append.
  18825. * @returns {Array} Returns `array`.
  18826. */
  18827. function arrayPush(array, values) {
  18828. var index = -1,
  18829. length = values.length,
  18830. offset = array.length;
  18831. while (++index < length) {
  18832. array[offset + index] = values[index];
  18833. }
  18834. return array;
  18835. }
  18836. /**
  18837. * A specialized version of `_.reduce` for arrays without support for
  18838. * iteratee shorthands.
  18839. *
  18840. * @private
  18841. * @param {Array} [array] The array to iterate over.
  18842. * @param {Function} iteratee The function invoked per iteration.
  18843. * @param {*} [accumulator] The initial value.
  18844. * @param {boolean} [initAccum] Specify using the first element of `array` as
  18845. * the initial value.
  18846. * @returns {*} Returns the accumulated value.
  18847. */
  18848. function arrayReduce(array, iteratee, accumulator, initAccum) {
  18849. var index = -1,
  18850. length = array == null ? 0 : array.length;
  18851. if (initAccum && length) {
  18852. accumulator = array[++index];
  18853. }
  18854. while (++index < length) {
  18855. accumulator = iteratee(accumulator, array[index], index, array);
  18856. }
  18857. return accumulator;
  18858. }
  18859. /**
  18860. * A specialized version of `_.reduceRight` for arrays without support for
  18861. * iteratee shorthands.
  18862. *
  18863. * @private
  18864. * @param {Array} [array] The array to iterate over.
  18865. * @param {Function} iteratee The function invoked per iteration.
  18866. * @param {*} [accumulator] The initial value.
  18867. * @param {boolean} [initAccum] Specify using the last element of `array` as
  18868. * the initial value.
  18869. * @returns {*} Returns the accumulated value.
  18870. */
  18871. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  18872. var length = array == null ? 0 : array.length;
  18873. if (initAccum && length) {
  18874. accumulator = array[--length];
  18875. }
  18876. while (length--) {
  18877. accumulator = iteratee(accumulator, array[length], length, array);
  18878. }
  18879. return accumulator;
  18880. }
  18881. /**
  18882. * A specialized version of `_.some` for arrays without support for iteratee
  18883. * shorthands.
  18884. *
  18885. * @private
  18886. * @param {Array} [array] The array to iterate over.
  18887. * @param {Function} predicate The function invoked per iteration.
  18888. * @returns {boolean} Returns `true` if any element passes the predicate check,
  18889. * else `false`.
  18890. */
  18891. function arraySome(array, predicate) {
  18892. var index = -1,
  18893. length = array == null ? 0 : array.length;
  18894. while (++index < length) {
  18895. if (predicate(array[index], index, array)) {
  18896. return true;
  18897. }
  18898. }
  18899. return false;
  18900. }
  18901. /**
  18902. * Gets the size of an ASCII `string`.
  18903. *
  18904. * @private
  18905. * @param {string} string The string inspect.
  18906. * @returns {number} Returns the string size.
  18907. */
  18908. var asciiSize = baseProperty('length');
  18909. /**
  18910. * Converts an ASCII `string` to an array.
  18911. *
  18912. * @private
  18913. * @param {string} string The string to convert.
  18914. * @returns {Array} Returns the converted array.
  18915. */
  18916. function asciiToArray(string) {
  18917. return string.split('');
  18918. }
  18919. /**
  18920. * Splits an ASCII `string` into an array of its words.
  18921. *
  18922. * @private
  18923. * @param {string} The string to inspect.
  18924. * @returns {Array} Returns the words of `string`.
  18925. */
  18926. function asciiWords(string) {
  18927. return string.match(reAsciiWord) || [];
  18928. }
  18929. /**
  18930. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  18931. * without support for iteratee shorthands, which iterates over `collection`
  18932. * using `eachFunc`.
  18933. *
  18934. * @private
  18935. * @param {Array|Object} collection The collection to inspect.
  18936. * @param {Function} predicate The function invoked per iteration.
  18937. * @param {Function} eachFunc The function to iterate over `collection`.
  18938. * @returns {*} Returns the found element or its key, else `undefined`.
  18939. */
  18940. function baseFindKey(collection, predicate, eachFunc) {
  18941. var result;
  18942. eachFunc(collection, function(value, key, collection) {
  18943. if (predicate(value, key, collection)) {
  18944. result = key;
  18945. return false;
  18946. }
  18947. });
  18948. return result;
  18949. }
  18950. /**
  18951. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  18952. * support for iteratee shorthands.
  18953. *
  18954. * @private
  18955. * @param {Array} array The array to inspect.
  18956. * @param {Function} predicate The function invoked per iteration.
  18957. * @param {number} fromIndex The index to search from.
  18958. * @param {boolean} [fromRight] Specify iterating from right to left.
  18959. * @returns {number} Returns the index of the matched value, else `-1`.
  18960. */
  18961. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  18962. var length = array.length,
  18963. index = fromIndex + (fromRight ? 1 : -1);
  18964. while ((fromRight ? index-- : ++index < length)) {
  18965. if (predicate(array[index], index, array)) {
  18966. return index;
  18967. }
  18968. }
  18969. return -1;
  18970. }
  18971. /**
  18972. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  18973. *
  18974. * @private
  18975. * @param {Array} array The array to inspect.
  18976. * @param {*} value The value to search for.
  18977. * @param {number} fromIndex The index to search from.
  18978. * @returns {number} Returns the index of the matched value, else `-1`.
  18979. */
  18980. function baseIndexOf(array, value, fromIndex) {
  18981. return value === value
  18982. ? strictIndexOf(array, value, fromIndex)
  18983. : baseFindIndex(array, baseIsNaN, fromIndex);
  18984. }
  18985. /**
  18986. * This function is like `baseIndexOf` except that it accepts a comparator.
  18987. *
  18988. * @private
  18989. * @param {Array} array The array to inspect.
  18990. * @param {*} value The value to search for.
  18991. * @param {number} fromIndex The index to search from.
  18992. * @param {Function} comparator The comparator invoked per element.
  18993. * @returns {number} Returns the index of the matched value, else `-1`.
  18994. */
  18995. function baseIndexOfWith(array, value, fromIndex, comparator) {
  18996. var index = fromIndex - 1,
  18997. length = array.length;
  18998. while (++index < length) {
  18999. if (comparator(array[index], value)) {
  19000. return index;
  19001. }
  19002. }
  19003. return -1;
  19004. }
  19005. /**
  19006. * The base implementation of `_.isNaN` without support for number objects.
  19007. *
  19008. * @private
  19009. * @param {*} value The value to check.
  19010. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  19011. */
  19012. function baseIsNaN(value) {
  19013. return value !== value;
  19014. }
  19015. /**
  19016. * The base implementation of `_.mean` and `_.meanBy` without support for
  19017. * iteratee shorthands.
  19018. *
  19019. * @private
  19020. * @param {Array} array The array to iterate over.
  19021. * @param {Function} iteratee The function invoked per iteration.
  19022. * @returns {number} Returns the mean.
  19023. */
  19024. function baseMean(array, iteratee) {
  19025. var length = array == null ? 0 : array.length;
  19026. return length ? (baseSum(array, iteratee) / length) : NAN;
  19027. }
  19028. /**
  19029. * The base implementation of `_.property` without support for deep paths.
  19030. *
  19031. * @private
  19032. * @param {string} key The key of the property to get.
  19033. * @returns {Function} Returns the new accessor function.
  19034. */
  19035. function baseProperty(key) {
  19036. return function(object) {
  19037. return object == null ? undefined : object[key];
  19038. };
  19039. }
  19040. /**
  19041. * The base implementation of `_.propertyOf` without support for deep paths.
  19042. *
  19043. * @private
  19044. * @param {Object} object The object to query.
  19045. * @returns {Function} Returns the new accessor function.
  19046. */
  19047. function basePropertyOf(object) {
  19048. return function(key) {
  19049. return object == null ? undefined : object[key];
  19050. };
  19051. }
  19052. /**
  19053. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  19054. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  19055. *
  19056. * @private
  19057. * @param {Array|Object} collection The collection to iterate over.
  19058. * @param {Function} iteratee The function invoked per iteration.
  19059. * @param {*} accumulator The initial value.
  19060. * @param {boolean} initAccum Specify using the first or last element of
  19061. * `collection` as the initial value.
  19062. * @param {Function} eachFunc The function to iterate over `collection`.
  19063. * @returns {*} Returns the accumulated value.
  19064. */
  19065. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  19066. eachFunc(collection, function(value, index, collection) {
  19067. accumulator = initAccum
  19068. ? (initAccum = false, value)
  19069. : iteratee(accumulator, value, index, collection);
  19070. });
  19071. return accumulator;
  19072. }
  19073. /**
  19074. * The base implementation of `_.sortBy` which uses `comparer` to define the
  19075. * sort order of `array` and replaces criteria objects with their corresponding
  19076. * values.
  19077. *
  19078. * @private
  19079. * @param {Array} array The array to sort.
  19080. * @param {Function} comparer The function to define sort order.
  19081. * @returns {Array} Returns `array`.
  19082. */
  19083. function baseSortBy(array, comparer) {
  19084. var length = array.length;
  19085. array.sort(comparer);
  19086. while (length--) {
  19087. array[length] = array[length].value;
  19088. }
  19089. return array;
  19090. }
  19091. /**
  19092. * The base implementation of `_.sum` and `_.sumBy` without support for
  19093. * iteratee shorthands.
  19094. *
  19095. * @private
  19096. * @param {Array} array The array to iterate over.
  19097. * @param {Function} iteratee The function invoked per iteration.
  19098. * @returns {number} Returns the sum.
  19099. */
  19100. function baseSum(array, iteratee) {
  19101. var result,
  19102. index = -1,
  19103. length = array.length;
  19104. while (++index < length) {
  19105. var current = iteratee(array[index]);
  19106. if (current !== undefined) {
  19107. result = result === undefined ? current : (result + current);
  19108. }
  19109. }
  19110. return result;
  19111. }
  19112. /**
  19113. * The base implementation of `_.times` without support for iteratee shorthands
  19114. * or max array length checks.
  19115. *
  19116. * @private
  19117. * @param {number} n The number of times to invoke `iteratee`.
  19118. * @param {Function} iteratee The function invoked per iteration.
  19119. * @returns {Array} Returns the array of results.
  19120. */
  19121. function baseTimes(n, iteratee) {
  19122. var index = -1,
  19123. result = Array(n);
  19124. while (++index < n) {
  19125. result[index] = iteratee(index);
  19126. }
  19127. return result;
  19128. }
  19129. /**
  19130. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  19131. * of key-value pairs for `object` corresponding to the property names of `props`.
  19132. *
  19133. * @private
  19134. * @param {Object} object The object to query.
  19135. * @param {Array} props The property names to get values for.
  19136. * @returns {Object} Returns the key-value pairs.
  19137. */
  19138. function baseToPairs(object, props) {
  19139. return arrayMap(props, function(key) {
  19140. return [key, object[key]];
  19141. });
  19142. }
  19143. /**
  19144. * The base implementation of `_.unary` without support for storing metadata.
  19145. *
  19146. * @private
  19147. * @param {Function} func The function to cap arguments for.
  19148. * @returns {Function} Returns the new capped function.
  19149. */
  19150. function baseUnary(func) {
  19151. return function(value) {
  19152. return func(value);
  19153. };
  19154. }
  19155. /**
  19156. * The base implementation of `_.values` and `_.valuesIn` which creates an
  19157. * array of `object` property values corresponding to the property names
  19158. * of `props`.
  19159. *
  19160. * @private
  19161. * @param {Object} object The object to query.
  19162. * @param {Array} props The property names to get values for.
  19163. * @returns {Object} Returns the array of property values.
  19164. */
  19165. function baseValues(object, props) {
  19166. return arrayMap(props, function(key) {
  19167. return object[key];
  19168. });
  19169. }
  19170. /**
  19171. * Checks if a `cache` value for `key` exists.
  19172. *
  19173. * @private
  19174. * @param {Object} cache The cache to query.
  19175. * @param {string} key The key of the entry to check.
  19176. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19177. */
  19178. function cacheHas(cache, key) {
  19179. return cache.has(key);
  19180. }
  19181. /**
  19182. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  19183. * that is not found in the character symbols.
  19184. *
  19185. * @private
  19186. * @param {Array} strSymbols The string symbols to inspect.
  19187. * @param {Array} chrSymbols The character symbols to find.
  19188. * @returns {number} Returns the index of the first unmatched string symbol.
  19189. */
  19190. function charsStartIndex(strSymbols, chrSymbols) {
  19191. var index = -1,
  19192. length = strSymbols.length;
  19193. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19194. return index;
  19195. }
  19196. /**
  19197. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  19198. * that is not found in the character symbols.
  19199. *
  19200. * @private
  19201. * @param {Array} strSymbols The string symbols to inspect.
  19202. * @param {Array} chrSymbols The character symbols to find.
  19203. * @returns {number} Returns the index of the last unmatched string symbol.
  19204. */
  19205. function charsEndIndex(strSymbols, chrSymbols) {
  19206. var index = strSymbols.length;
  19207. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19208. return index;
  19209. }
  19210. /**
  19211. * Gets the number of `placeholder` occurrences in `array`.
  19212. *
  19213. * @private
  19214. * @param {Array} array The array to inspect.
  19215. * @param {*} placeholder The placeholder to search for.
  19216. * @returns {number} Returns the placeholder count.
  19217. */
  19218. function countHolders(array, placeholder) {
  19219. var length = array.length,
  19220. result = 0;
  19221. while (length--) {
  19222. if (array[length] === placeholder) {
  19223. ++result;
  19224. }
  19225. }
  19226. return result;
  19227. }
  19228. /**
  19229. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  19230. * letters to basic Latin letters.
  19231. *
  19232. * @private
  19233. * @param {string} letter The matched letter to deburr.
  19234. * @returns {string} Returns the deburred letter.
  19235. */
  19236. var deburrLetter = basePropertyOf(deburredLetters);
  19237. /**
  19238. * Used by `_.escape` to convert characters to HTML entities.
  19239. *
  19240. * @private
  19241. * @param {string} chr The matched character to escape.
  19242. * @returns {string} Returns the escaped character.
  19243. */
  19244. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  19245. /**
  19246. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  19247. *
  19248. * @private
  19249. * @param {string} chr The matched character to escape.
  19250. * @returns {string} Returns the escaped character.
  19251. */
  19252. function escapeStringChar(chr) {
  19253. return '\\' + stringEscapes[chr];
  19254. }
  19255. /**
  19256. * Gets the value at `key` of `object`.
  19257. *
  19258. * @private
  19259. * @param {Object} [object] The object to query.
  19260. * @param {string} key The key of the property to get.
  19261. * @returns {*} Returns the property value.
  19262. */
  19263. function getValue(object, key) {
  19264. return object == null ? undefined : object[key];
  19265. }
  19266. /**
  19267. * Checks if `string` contains Unicode symbols.
  19268. *
  19269. * @private
  19270. * @param {string} string The string to inspect.
  19271. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  19272. */
  19273. function hasUnicode(string) {
  19274. return reHasUnicode.test(string);
  19275. }
  19276. /**
  19277. * Checks if `string` contains a word composed of Unicode symbols.
  19278. *
  19279. * @private
  19280. * @param {string} string The string to inspect.
  19281. * @returns {boolean} Returns `true` if a word is found, else `false`.
  19282. */
  19283. function hasUnicodeWord(string) {
  19284. return reHasUnicodeWord.test(string);
  19285. }
  19286. /**
  19287. * Converts `iterator` to an array.
  19288. *
  19289. * @private
  19290. * @param {Object} iterator The iterator to convert.
  19291. * @returns {Array} Returns the converted array.
  19292. */
  19293. function iteratorToArray(iterator) {
  19294. var data,
  19295. result = [];
  19296. while (!(data = iterator.next()).done) {
  19297. result.push(data.value);
  19298. }
  19299. return result;
  19300. }
  19301. /**
  19302. * Converts `map` to its key-value pairs.
  19303. *
  19304. * @private
  19305. * @param {Object} map The map to convert.
  19306. * @returns {Array} Returns the key-value pairs.
  19307. */
  19308. function mapToArray(map) {
  19309. var index = -1,
  19310. result = Array(map.size);
  19311. map.forEach(function(value, key) {
  19312. result[++index] = [key, value];
  19313. });
  19314. return result;
  19315. }
  19316. /**
  19317. * Creates a unary function that invokes `func` with its argument transformed.
  19318. *
  19319. * @private
  19320. * @param {Function} func The function to wrap.
  19321. * @param {Function} transform The argument transform.
  19322. * @returns {Function} Returns the new function.
  19323. */
  19324. function overArg(func, transform) {
  19325. return function(arg) {
  19326. return func(transform(arg));
  19327. };
  19328. }
  19329. /**
  19330. * Replaces all `placeholder` elements in `array` with an internal placeholder
  19331. * and returns an array of their indexes.
  19332. *
  19333. * @private
  19334. * @param {Array} array The array to modify.
  19335. * @param {*} placeholder The placeholder to replace.
  19336. * @returns {Array} Returns the new array of placeholder indexes.
  19337. */
  19338. function replaceHolders(array, placeholder) {
  19339. var index = -1,
  19340. length = array.length,
  19341. resIndex = 0,
  19342. result = [];
  19343. while (++index < length) {
  19344. var value = array[index];
  19345. if (value === placeholder || value === PLACEHOLDER) {
  19346. array[index] = PLACEHOLDER;
  19347. result[resIndex++] = index;
  19348. }
  19349. }
  19350. return result;
  19351. }
  19352. /**
  19353. * Converts `set` to an array of its values.
  19354. *
  19355. * @private
  19356. * @param {Object} set The set to convert.
  19357. * @returns {Array} Returns the values.
  19358. */
  19359. function setToArray(set) {
  19360. var index = -1,
  19361. result = Array(set.size);
  19362. set.forEach(function(value) {
  19363. result[++index] = value;
  19364. });
  19365. return result;
  19366. }
  19367. /**
  19368. * Converts `set` to its value-value pairs.
  19369. *
  19370. * @private
  19371. * @param {Object} set The set to convert.
  19372. * @returns {Array} Returns the value-value pairs.
  19373. */
  19374. function setToPairs(set) {
  19375. var index = -1,
  19376. result = Array(set.size);
  19377. set.forEach(function(value) {
  19378. result[++index] = [value, value];
  19379. });
  19380. return result;
  19381. }
  19382. /**
  19383. * A specialized version of `_.indexOf` which performs strict equality
  19384. * comparisons of values, i.e. `===`.
  19385. *
  19386. * @private
  19387. * @param {Array} array The array to inspect.
  19388. * @param {*} value The value to search for.
  19389. * @param {number} fromIndex The index to search from.
  19390. * @returns {number} Returns the index of the matched value, else `-1`.
  19391. */
  19392. function strictIndexOf(array, value, fromIndex) {
  19393. var index = fromIndex - 1,
  19394. length = array.length;
  19395. while (++index < length) {
  19396. if (array[index] === value) {
  19397. return index;
  19398. }
  19399. }
  19400. return -1;
  19401. }
  19402. /**
  19403. * A specialized version of `_.lastIndexOf` which performs strict equality
  19404. * comparisons of values, i.e. `===`.
  19405. *
  19406. * @private
  19407. * @param {Array} array The array to inspect.
  19408. * @param {*} value The value to search for.
  19409. * @param {number} fromIndex The index to search from.
  19410. * @returns {number} Returns the index of the matched value, else `-1`.
  19411. */
  19412. function strictLastIndexOf(array, value, fromIndex) {
  19413. var index = fromIndex + 1;
  19414. while (index--) {
  19415. if (array[index] === value) {
  19416. return index;
  19417. }
  19418. }
  19419. return index;
  19420. }
  19421. /**
  19422. * Gets the number of symbols in `string`.
  19423. *
  19424. * @private
  19425. * @param {string} string The string to inspect.
  19426. * @returns {number} Returns the string size.
  19427. */
  19428. function stringSize(string) {
  19429. return hasUnicode(string)
  19430. ? unicodeSize(string)
  19431. : asciiSize(string);
  19432. }
  19433. /**
  19434. * Converts `string` to an array.
  19435. *
  19436. * @private
  19437. * @param {string} string The string to convert.
  19438. * @returns {Array} Returns the converted array.
  19439. */
  19440. function stringToArray(string) {
  19441. return hasUnicode(string)
  19442. ? unicodeToArray(string)
  19443. : asciiToArray(string);
  19444. }
  19445. /**
  19446. * Used by `_.unescape` to convert HTML entities to characters.
  19447. *
  19448. * @private
  19449. * @param {string} chr The matched character to unescape.
  19450. * @returns {string} Returns the unescaped character.
  19451. */
  19452. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  19453. /**
  19454. * Gets the size of a Unicode `string`.
  19455. *
  19456. * @private
  19457. * @param {string} string The string inspect.
  19458. * @returns {number} Returns the string size.
  19459. */
  19460. function unicodeSize(string) {
  19461. var result = reUnicode.lastIndex = 0;
  19462. while (reUnicode.test(string)) {
  19463. ++result;
  19464. }
  19465. return result;
  19466. }
  19467. /**
  19468. * Converts a Unicode `string` to an array.
  19469. *
  19470. * @private
  19471. * @param {string} string The string to convert.
  19472. * @returns {Array} Returns the converted array.
  19473. */
  19474. function unicodeToArray(string) {
  19475. return string.match(reUnicode) || [];
  19476. }
  19477. /**
  19478. * Splits a Unicode `string` into an array of its words.
  19479. *
  19480. * @private
  19481. * @param {string} The string to inspect.
  19482. * @returns {Array} Returns the words of `string`.
  19483. */
  19484. function unicodeWords(string) {
  19485. return string.match(reUnicodeWord) || [];
  19486. }
  19487. /*--------------------------------------------------------------------------*/
  19488. /**
  19489. * Create a new pristine `lodash` function using the `context` object.
  19490. *
  19491. * @static
  19492. * @memberOf _
  19493. * @since 1.1.0
  19494. * @category Util
  19495. * @param {Object} [context=root] The context object.
  19496. * @returns {Function} Returns a new `lodash` function.
  19497. * @example
  19498. *
  19499. * _.mixin({ 'foo': _.constant('foo') });
  19500. *
  19501. * var lodash = _.runInContext();
  19502. * lodash.mixin({ 'bar': lodash.constant('bar') });
  19503. *
  19504. * _.isFunction(_.foo);
  19505. * // => true
  19506. * _.isFunction(_.bar);
  19507. * // => false
  19508. *
  19509. * lodash.isFunction(lodash.foo);
  19510. * // => false
  19511. * lodash.isFunction(lodash.bar);
  19512. * // => true
  19513. *
  19514. * // Create a suped-up `defer` in Node.js.
  19515. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  19516. */
  19517. var runInContext = (function runInContext(context) {
  19518. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  19519. /** Built-in constructor references. */
  19520. var Array = context.Array,
  19521. Date = context.Date,
  19522. Error = context.Error,
  19523. Function = context.Function,
  19524. Math = context.Math,
  19525. Object = context.Object,
  19526. RegExp = context.RegExp,
  19527. String = context.String,
  19528. TypeError = context.TypeError;
  19529. /** Used for built-in method references. */
  19530. var arrayProto = Array.prototype,
  19531. funcProto = Function.prototype,
  19532. objectProto = Object.prototype;
  19533. /** Used to detect overreaching core-js shims. */
  19534. var coreJsData = context['__core-js_shared__'];
  19535. /** Used to resolve the decompiled source of functions. */
  19536. var funcToString = funcProto.toString;
  19537. /** Used to check objects for own properties. */
  19538. var hasOwnProperty = objectProto.hasOwnProperty;
  19539. /** Used to generate unique IDs. */
  19540. var idCounter = 0;
  19541. /** Used to detect methods masquerading as native. */
  19542. var maskSrcKey = (function() {
  19543. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  19544. return uid ? ('Symbol(src)_1.' + uid) : '';
  19545. }());
  19546. /**
  19547. * Used to resolve the
  19548. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  19549. * of values.
  19550. */
  19551. var nativeObjectToString = objectProto.toString;
  19552. /** Used to infer the `Object` constructor. */
  19553. var objectCtorString = funcToString.call(Object);
  19554. /** Used to restore the original `_` reference in `_.noConflict`. */
  19555. var oldDash = root._;
  19556. /** Used to detect if a method is native. */
  19557. var reIsNative = RegExp('^' +
  19558. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  19559. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  19560. );
  19561. /** Built-in value references. */
  19562. var Buffer = moduleExports ? context.Buffer : undefined,
  19563. Symbol = context.Symbol,
  19564. Uint8Array = context.Uint8Array,
  19565. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  19566. getPrototype = overArg(Object.getPrototypeOf, Object),
  19567. objectCreate = Object.create,
  19568. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  19569. splice = arrayProto.splice,
  19570. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  19571. symIterator = Symbol ? Symbol.iterator : undefined,
  19572. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  19573. var defineProperty = (function() {
  19574. try {
  19575. var func = getNative(Object, 'defineProperty');
  19576. func({}, '', {});
  19577. return func;
  19578. } catch (e) {}
  19579. }());
  19580. /** Mocked built-ins. */
  19581. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  19582. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  19583. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  19584. /* Built-in method references for those with the same name as other `lodash` methods. */
  19585. var nativeCeil = Math.ceil,
  19586. nativeFloor = Math.floor,
  19587. nativeGetSymbols = Object.getOwnPropertySymbols,
  19588. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  19589. nativeIsFinite = context.isFinite,
  19590. nativeJoin = arrayProto.join,
  19591. nativeKeys = overArg(Object.keys, Object),
  19592. nativeMax = Math.max,
  19593. nativeMin = Math.min,
  19594. nativeNow = Date.now,
  19595. nativeParseInt = context.parseInt,
  19596. nativeRandom = Math.random,
  19597. nativeReverse = arrayProto.reverse;
  19598. /* Built-in method references that are verified to be native. */
  19599. var DataView = getNative(context, 'DataView'),
  19600. Map = getNative(context, 'Map'),
  19601. Promise = getNative(context, 'Promise'),
  19602. Set = getNative(context, 'Set'),
  19603. WeakMap = getNative(context, 'WeakMap'),
  19604. nativeCreate = getNative(Object, 'create');
  19605. /** Used to store function metadata. */
  19606. var metaMap = WeakMap && new WeakMap;
  19607. /** Used to lookup unminified function names. */
  19608. var realNames = {};
  19609. /** Used to detect maps, sets, and weakmaps. */
  19610. var dataViewCtorString = toSource(DataView),
  19611. mapCtorString = toSource(Map),
  19612. promiseCtorString = toSource(Promise),
  19613. setCtorString = toSource(Set),
  19614. weakMapCtorString = toSource(WeakMap);
  19615. /** Used to convert symbols to primitives and strings. */
  19616. var symbolProto = Symbol ? Symbol.prototype : undefined,
  19617. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  19618. symbolToString = symbolProto ? symbolProto.toString : undefined;
  19619. /*------------------------------------------------------------------------*/
  19620. /**
  19621. * Creates a `lodash` object which wraps `value` to enable implicit method
  19622. * chain sequences. Methods that operate on and return arrays, collections,
  19623. * and functions can be chained together. Methods that retrieve a single value
  19624. * or may return a primitive value will automatically end the chain sequence
  19625. * and return the unwrapped value. Otherwise, the value must be unwrapped
  19626. * with `_#value`.
  19627. *
  19628. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  19629. * enabled using `_.chain`.
  19630. *
  19631. * The execution of chained methods is lazy, that is, it's deferred until
  19632. * `_#value` is implicitly or explicitly called.
  19633. *
  19634. * Lazy evaluation allows several methods to support shortcut fusion.
  19635. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  19636. * the creation of intermediate arrays and can greatly reduce the number of
  19637. * iteratee executions. Sections of a chain sequence qualify for shortcut
  19638. * fusion if the section is applied to an array and iteratees accept only
  19639. * one argument. The heuristic for whether a section qualifies for shortcut
  19640. * fusion is subject to change.
  19641. *
  19642. * Chaining is supported in custom builds as long as the `_#value` method is
  19643. * directly or indirectly included in the build.
  19644. *
  19645. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  19646. *
  19647. * The wrapper `Array` methods are:
  19648. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  19649. *
  19650. * The wrapper `String` methods are:
  19651. * `replace` and `split`
  19652. *
  19653. * The wrapper methods that support shortcut fusion are:
  19654. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  19655. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  19656. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  19657. *
  19658. * The chainable wrapper methods are:
  19659. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  19660. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  19661. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  19662. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  19663. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  19664. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  19665. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  19666. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  19667. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  19668. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  19669. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  19670. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  19671. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  19672. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  19673. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  19674. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  19675. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  19676. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  19677. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  19678. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  19679. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  19680. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  19681. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  19682. * `zipObject`, `zipObjectDeep`, and `zipWith`
  19683. *
  19684. * The wrapper methods that are **not** chainable by default are:
  19685. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  19686. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  19687. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  19688. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  19689. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  19690. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  19691. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  19692. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  19693. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  19694. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  19695. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  19696. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  19697. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  19698. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  19699. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  19700. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  19701. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  19702. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  19703. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  19704. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  19705. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  19706. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  19707. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  19708. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  19709. * `upperFirst`, `value`, and `words`
  19710. *
  19711. * @name _
  19712. * @constructor
  19713. * @category Seq
  19714. * @param {*} value The value to wrap in a `lodash` instance.
  19715. * @returns {Object} Returns the new `lodash` wrapper instance.
  19716. * @example
  19717. *
  19718. * function square(n) {
  19719. * return n * n;
  19720. * }
  19721. *
  19722. * var wrapped = _([1, 2, 3]);
  19723. *
  19724. * // Returns an unwrapped value.
  19725. * wrapped.reduce(_.add);
  19726. * // => 6
  19727. *
  19728. * // Returns a wrapped value.
  19729. * var squares = wrapped.map(square);
  19730. *
  19731. * _.isArray(squares);
  19732. * // => false
  19733. *
  19734. * _.isArray(squares.value());
  19735. * // => true
  19736. */
  19737. function lodash(value) {
  19738. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  19739. if (value instanceof LodashWrapper) {
  19740. return value;
  19741. }
  19742. if (hasOwnProperty.call(value, '__wrapped__')) {
  19743. return wrapperClone(value);
  19744. }
  19745. }
  19746. return new LodashWrapper(value);
  19747. }
  19748. /**
  19749. * The base implementation of `_.create` without support for assigning
  19750. * properties to the created object.
  19751. *
  19752. * @private
  19753. * @param {Object} proto The object to inherit from.
  19754. * @returns {Object} Returns the new object.
  19755. */
  19756. var baseCreate = (function() {
  19757. function object() {}
  19758. return function(proto) {
  19759. if (!isObject(proto)) {
  19760. return {};
  19761. }
  19762. if (objectCreate) {
  19763. return objectCreate(proto);
  19764. }
  19765. object.prototype = proto;
  19766. var result = new object;
  19767. object.prototype = undefined;
  19768. return result;
  19769. };
  19770. }());
  19771. /**
  19772. * The function whose prototype chain sequence wrappers inherit from.
  19773. *
  19774. * @private
  19775. */
  19776. function baseLodash() {
  19777. // No operation performed.
  19778. }
  19779. /**
  19780. * The base constructor for creating `lodash` wrapper objects.
  19781. *
  19782. * @private
  19783. * @param {*} value The value to wrap.
  19784. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  19785. */
  19786. function LodashWrapper(value, chainAll) {
  19787. this.__wrapped__ = value;
  19788. this.__actions__ = [];
  19789. this.__chain__ = !!chainAll;
  19790. this.__index__ = 0;
  19791. this.__values__ = undefined;
  19792. }
  19793. /**
  19794. * By default, the template delimiters used by lodash are like those in
  19795. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  19796. * following template settings to use alternative delimiters.
  19797. *
  19798. * @static
  19799. * @memberOf _
  19800. * @type {Object}
  19801. */
  19802. lodash.templateSettings = {
  19803. /**
  19804. * Used to detect `data` property values to be HTML-escaped.
  19805. *
  19806. * @memberOf _.templateSettings
  19807. * @type {RegExp}
  19808. */
  19809. 'escape': reEscape,
  19810. /**
  19811. * Used to detect code to be evaluated.
  19812. *
  19813. * @memberOf _.templateSettings
  19814. * @type {RegExp}
  19815. */
  19816. 'evaluate': reEvaluate,
  19817. /**
  19818. * Used to detect `data` property values to inject.
  19819. *
  19820. * @memberOf _.templateSettings
  19821. * @type {RegExp}
  19822. */
  19823. 'interpolate': reInterpolate,
  19824. /**
  19825. * Used to reference the data object in the template text.
  19826. *
  19827. * @memberOf _.templateSettings
  19828. * @type {string}
  19829. */
  19830. 'variable': '',
  19831. /**
  19832. * Used to import variables into the compiled template.
  19833. *
  19834. * @memberOf _.templateSettings
  19835. * @type {Object}
  19836. */
  19837. 'imports': {
  19838. /**
  19839. * A reference to the `lodash` function.
  19840. *
  19841. * @memberOf _.templateSettings.imports
  19842. * @type {Function}
  19843. */
  19844. '_': lodash
  19845. }
  19846. };
  19847. // Ensure wrappers are instances of `baseLodash`.
  19848. lodash.prototype = baseLodash.prototype;
  19849. lodash.prototype.constructor = lodash;
  19850. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  19851. LodashWrapper.prototype.constructor = LodashWrapper;
  19852. /*------------------------------------------------------------------------*/
  19853. /**
  19854. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  19855. *
  19856. * @private
  19857. * @constructor
  19858. * @param {*} value The value to wrap.
  19859. */
  19860. function LazyWrapper(value) {
  19861. this.__wrapped__ = value;
  19862. this.__actions__ = [];
  19863. this.__dir__ = 1;
  19864. this.__filtered__ = false;
  19865. this.__iteratees__ = [];
  19866. this.__takeCount__ = MAX_ARRAY_LENGTH;
  19867. this.__views__ = [];
  19868. }
  19869. /**
  19870. * Creates a clone of the lazy wrapper object.
  19871. *
  19872. * @private
  19873. * @name clone
  19874. * @memberOf LazyWrapper
  19875. * @returns {Object} Returns the cloned `LazyWrapper` object.
  19876. */
  19877. function lazyClone() {
  19878. var result = new LazyWrapper(this.__wrapped__);
  19879. result.__actions__ = copyArray(this.__actions__);
  19880. result.__dir__ = this.__dir__;
  19881. result.__filtered__ = this.__filtered__;
  19882. result.__iteratees__ = copyArray(this.__iteratees__);
  19883. result.__takeCount__ = this.__takeCount__;
  19884. result.__views__ = copyArray(this.__views__);
  19885. return result;
  19886. }
  19887. /**
  19888. * Reverses the direction of lazy iteration.
  19889. *
  19890. * @private
  19891. * @name reverse
  19892. * @memberOf LazyWrapper
  19893. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  19894. */
  19895. function lazyReverse() {
  19896. if (this.__filtered__) {
  19897. var result = new LazyWrapper(this);
  19898. result.__dir__ = -1;
  19899. result.__filtered__ = true;
  19900. } else {
  19901. result = this.clone();
  19902. result.__dir__ *= -1;
  19903. }
  19904. return result;
  19905. }
  19906. /**
  19907. * Extracts the unwrapped value from its lazy wrapper.
  19908. *
  19909. * @private
  19910. * @name value
  19911. * @memberOf LazyWrapper
  19912. * @returns {*} Returns the unwrapped value.
  19913. */
  19914. function lazyValue() {
  19915. var array = this.__wrapped__.value(),
  19916. dir = this.__dir__,
  19917. isArr = isArray(array),
  19918. isRight = dir < 0,
  19919. arrLength = isArr ? array.length : 0,
  19920. view = getView(0, arrLength, this.__views__),
  19921. start = view.start,
  19922. end = view.end,
  19923. length = end - start,
  19924. index = isRight ? end : (start - 1),
  19925. iteratees = this.__iteratees__,
  19926. iterLength = iteratees.length,
  19927. resIndex = 0,
  19928. takeCount = nativeMin(length, this.__takeCount__);
  19929. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  19930. return baseWrapperValue(array, this.__actions__);
  19931. }
  19932. var result = [];
  19933. outer:
  19934. while (length-- && resIndex < takeCount) {
  19935. index += dir;
  19936. var iterIndex = -1,
  19937. value = array[index];
  19938. while (++iterIndex < iterLength) {
  19939. var data = iteratees[iterIndex],
  19940. iteratee = data.iteratee,
  19941. type = data.type,
  19942. computed = iteratee(value);
  19943. if (type == LAZY_MAP_FLAG) {
  19944. value = computed;
  19945. } else if (!computed) {
  19946. if (type == LAZY_FILTER_FLAG) {
  19947. continue outer;
  19948. } else {
  19949. break outer;
  19950. }
  19951. }
  19952. }
  19953. result[resIndex++] = value;
  19954. }
  19955. return result;
  19956. }
  19957. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  19958. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  19959. LazyWrapper.prototype.constructor = LazyWrapper;
  19960. /*------------------------------------------------------------------------*/
  19961. /**
  19962. * Creates a hash object.
  19963. *
  19964. * @private
  19965. * @constructor
  19966. * @param {Array} [entries] The key-value pairs to cache.
  19967. */
  19968. function Hash(entries) {
  19969. var index = -1,
  19970. length = entries == null ? 0 : entries.length;
  19971. this.clear();
  19972. while (++index < length) {
  19973. var entry = entries[index];
  19974. this.set(entry[0], entry[1]);
  19975. }
  19976. }
  19977. /**
  19978. * Removes all key-value entries from the hash.
  19979. *
  19980. * @private
  19981. * @name clear
  19982. * @memberOf Hash
  19983. */
  19984. function hashClear() {
  19985. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  19986. this.size = 0;
  19987. }
  19988. /**
  19989. * Removes `key` and its value from the hash.
  19990. *
  19991. * @private
  19992. * @name delete
  19993. * @memberOf Hash
  19994. * @param {Object} hash The hash to modify.
  19995. * @param {string} key The key of the value to remove.
  19996. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19997. */
  19998. function hashDelete(key) {
  19999. var result = this.has(key) && delete this.__data__[key];
  20000. this.size -= result ? 1 : 0;
  20001. return result;
  20002. }
  20003. /**
  20004. * Gets the hash value for `key`.
  20005. *
  20006. * @private
  20007. * @name get
  20008. * @memberOf Hash
  20009. * @param {string} key The key of the value to get.
  20010. * @returns {*} Returns the entry value.
  20011. */
  20012. function hashGet(key) {
  20013. var data = this.__data__;
  20014. if (nativeCreate) {
  20015. var result = data[key];
  20016. return result === HASH_UNDEFINED ? undefined : result;
  20017. }
  20018. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  20019. }
  20020. /**
  20021. * Checks if a hash value for `key` exists.
  20022. *
  20023. * @private
  20024. * @name has
  20025. * @memberOf Hash
  20026. * @param {string} key The key of the entry to check.
  20027. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20028. */
  20029. function hashHas(key) {
  20030. var data = this.__data__;
  20031. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  20032. }
  20033. /**
  20034. * Sets the hash `key` to `value`.
  20035. *
  20036. * @private
  20037. * @name set
  20038. * @memberOf Hash
  20039. * @param {string} key The key of the value to set.
  20040. * @param {*} value The value to set.
  20041. * @returns {Object} Returns the hash instance.
  20042. */
  20043. function hashSet(key, value) {
  20044. var data = this.__data__;
  20045. this.size += this.has(key) ? 0 : 1;
  20046. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  20047. return this;
  20048. }
  20049. // Add methods to `Hash`.
  20050. Hash.prototype.clear = hashClear;
  20051. Hash.prototype['delete'] = hashDelete;
  20052. Hash.prototype.get = hashGet;
  20053. Hash.prototype.has = hashHas;
  20054. Hash.prototype.set = hashSet;
  20055. /*------------------------------------------------------------------------*/
  20056. /**
  20057. * Creates an list cache object.
  20058. *
  20059. * @private
  20060. * @constructor
  20061. * @param {Array} [entries] The key-value pairs to cache.
  20062. */
  20063. function ListCache(entries) {
  20064. var index = -1,
  20065. length = entries == null ? 0 : entries.length;
  20066. this.clear();
  20067. while (++index < length) {
  20068. var entry = entries[index];
  20069. this.set(entry[0], entry[1]);
  20070. }
  20071. }
  20072. /**
  20073. * Removes all key-value entries from the list cache.
  20074. *
  20075. * @private
  20076. * @name clear
  20077. * @memberOf ListCache
  20078. */
  20079. function listCacheClear() {
  20080. this.__data__ = [];
  20081. this.size = 0;
  20082. }
  20083. /**
  20084. * Removes `key` and its value from the list cache.
  20085. *
  20086. * @private
  20087. * @name delete
  20088. * @memberOf ListCache
  20089. * @param {string} key The key of the value to remove.
  20090. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20091. */
  20092. function listCacheDelete(key) {
  20093. var data = this.__data__,
  20094. index = assocIndexOf(data, key);
  20095. if (index < 0) {
  20096. return false;
  20097. }
  20098. var lastIndex = data.length - 1;
  20099. if (index == lastIndex) {
  20100. data.pop();
  20101. } else {
  20102. splice.call(data, index, 1);
  20103. }
  20104. --this.size;
  20105. return true;
  20106. }
  20107. /**
  20108. * Gets the list cache value for `key`.
  20109. *
  20110. * @private
  20111. * @name get
  20112. * @memberOf ListCache
  20113. * @param {string} key The key of the value to get.
  20114. * @returns {*} Returns the entry value.
  20115. */
  20116. function listCacheGet(key) {
  20117. var data = this.__data__,
  20118. index = assocIndexOf(data, key);
  20119. return index < 0 ? undefined : data[index][1];
  20120. }
  20121. /**
  20122. * Checks if a list cache value for `key` exists.
  20123. *
  20124. * @private
  20125. * @name has
  20126. * @memberOf ListCache
  20127. * @param {string} key The key of the entry to check.
  20128. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20129. */
  20130. function listCacheHas(key) {
  20131. return assocIndexOf(this.__data__, key) > -1;
  20132. }
  20133. /**
  20134. * Sets the list cache `key` to `value`.
  20135. *
  20136. * @private
  20137. * @name set
  20138. * @memberOf ListCache
  20139. * @param {string} key The key of the value to set.
  20140. * @param {*} value The value to set.
  20141. * @returns {Object} Returns the list cache instance.
  20142. */
  20143. function listCacheSet(key, value) {
  20144. var data = this.__data__,
  20145. index = assocIndexOf(data, key);
  20146. if (index < 0) {
  20147. ++this.size;
  20148. data.push([key, value]);
  20149. } else {
  20150. data[index][1] = value;
  20151. }
  20152. return this;
  20153. }
  20154. // Add methods to `ListCache`.
  20155. ListCache.prototype.clear = listCacheClear;
  20156. ListCache.prototype['delete'] = listCacheDelete;
  20157. ListCache.prototype.get = listCacheGet;
  20158. ListCache.prototype.has = listCacheHas;
  20159. ListCache.prototype.set = listCacheSet;
  20160. /*------------------------------------------------------------------------*/
  20161. /**
  20162. * Creates a map cache object to store key-value pairs.
  20163. *
  20164. * @private
  20165. * @constructor
  20166. * @param {Array} [entries] The key-value pairs to cache.
  20167. */
  20168. function MapCache(entries) {
  20169. var index = -1,
  20170. length = entries == null ? 0 : entries.length;
  20171. this.clear();
  20172. while (++index < length) {
  20173. var entry = entries[index];
  20174. this.set(entry[0], entry[1]);
  20175. }
  20176. }
  20177. /**
  20178. * Removes all key-value entries from the map.
  20179. *
  20180. * @private
  20181. * @name clear
  20182. * @memberOf MapCache
  20183. */
  20184. function mapCacheClear() {
  20185. this.size = 0;
  20186. this.__data__ = {
  20187. 'hash': new Hash,
  20188. 'map': new (Map || ListCache),
  20189. 'string': new Hash
  20190. };
  20191. }
  20192. /**
  20193. * Removes `key` and its value from the map.
  20194. *
  20195. * @private
  20196. * @name delete
  20197. * @memberOf MapCache
  20198. * @param {string} key The key of the value to remove.
  20199. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20200. */
  20201. function mapCacheDelete(key) {
  20202. var result = getMapData(this, key)['delete'](key);
  20203. this.size -= result ? 1 : 0;
  20204. return result;
  20205. }
  20206. /**
  20207. * Gets the map value for `key`.
  20208. *
  20209. * @private
  20210. * @name get
  20211. * @memberOf MapCache
  20212. * @param {string} key The key of the value to get.
  20213. * @returns {*} Returns the entry value.
  20214. */
  20215. function mapCacheGet(key) {
  20216. return getMapData(this, key).get(key);
  20217. }
  20218. /**
  20219. * Checks if a map value for `key` exists.
  20220. *
  20221. * @private
  20222. * @name has
  20223. * @memberOf MapCache
  20224. * @param {string} key The key of the entry to check.
  20225. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20226. */
  20227. function mapCacheHas(key) {
  20228. return getMapData(this, key).has(key);
  20229. }
  20230. /**
  20231. * Sets the map `key` to `value`.
  20232. *
  20233. * @private
  20234. * @name set
  20235. * @memberOf MapCache
  20236. * @param {string} key The key of the value to set.
  20237. * @param {*} value The value to set.
  20238. * @returns {Object} Returns the map cache instance.
  20239. */
  20240. function mapCacheSet(key, value) {
  20241. var data = getMapData(this, key),
  20242. size = data.size;
  20243. data.set(key, value);
  20244. this.size += data.size == size ? 0 : 1;
  20245. return this;
  20246. }
  20247. // Add methods to `MapCache`.
  20248. MapCache.prototype.clear = mapCacheClear;
  20249. MapCache.prototype['delete'] = mapCacheDelete;
  20250. MapCache.prototype.get = mapCacheGet;
  20251. MapCache.prototype.has = mapCacheHas;
  20252. MapCache.prototype.set = mapCacheSet;
  20253. /*------------------------------------------------------------------------*/
  20254. /**
  20255. *
  20256. * Creates an array cache object to store unique values.
  20257. *
  20258. * @private
  20259. * @constructor
  20260. * @param {Array} [values] The values to cache.
  20261. */
  20262. function SetCache(values) {
  20263. var index = -1,
  20264. length = values == null ? 0 : values.length;
  20265. this.__data__ = new MapCache;
  20266. while (++index < length) {
  20267. this.add(values[index]);
  20268. }
  20269. }
  20270. /**
  20271. * Adds `value` to the array cache.
  20272. *
  20273. * @private
  20274. * @name add
  20275. * @memberOf SetCache
  20276. * @alias push
  20277. * @param {*} value The value to cache.
  20278. * @returns {Object} Returns the cache instance.
  20279. */
  20280. function setCacheAdd(value) {
  20281. this.__data__.set(value, HASH_UNDEFINED);
  20282. return this;
  20283. }
  20284. /**
  20285. * Checks if `value` is in the array cache.
  20286. *
  20287. * @private
  20288. * @name has
  20289. * @memberOf SetCache
  20290. * @param {*} value The value to search for.
  20291. * @returns {number} Returns `true` if `value` is found, else `false`.
  20292. */
  20293. function setCacheHas(value) {
  20294. return this.__data__.has(value);
  20295. }
  20296. // Add methods to `SetCache`.
  20297. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  20298. SetCache.prototype.has = setCacheHas;
  20299. /*------------------------------------------------------------------------*/
  20300. /**
  20301. * Creates a stack cache object to store key-value pairs.
  20302. *
  20303. * @private
  20304. * @constructor
  20305. * @param {Array} [entries] The key-value pairs to cache.
  20306. */
  20307. function Stack(entries) {
  20308. var data = this.__data__ = new ListCache(entries);
  20309. this.size = data.size;
  20310. }
  20311. /**
  20312. * Removes all key-value entries from the stack.
  20313. *
  20314. * @private
  20315. * @name clear
  20316. * @memberOf Stack
  20317. */
  20318. function stackClear() {
  20319. this.__data__ = new ListCache;
  20320. this.size = 0;
  20321. }
  20322. /**
  20323. * Removes `key` and its value from the stack.
  20324. *
  20325. * @private
  20326. * @name delete
  20327. * @memberOf Stack
  20328. * @param {string} key The key of the value to remove.
  20329. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20330. */
  20331. function stackDelete(key) {
  20332. var data = this.__data__,
  20333. result = data['delete'](key);
  20334. this.size = data.size;
  20335. return result;
  20336. }
  20337. /**
  20338. * Gets the stack value for `key`.
  20339. *
  20340. * @private
  20341. * @name get
  20342. * @memberOf Stack
  20343. * @param {string} key The key of the value to get.
  20344. * @returns {*} Returns the entry value.
  20345. */
  20346. function stackGet(key) {
  20347. return this.__data__.get(key);
  20348. }
  20349. /**
  20350. * Checks if a stack value for `key` exists.
  20351. *
  20352. * @private
  20353. * @name has
  20354. * @memberOf Stack
  20355. * @param {string} key The key of the entry to check.
  20356. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20357. */
  20358. function stackHas(key) {
  20359. return this.__data__.has(key);
  20360. }
  20361. /**
  20362. * Sets the stack `key` to `value`.
  20363. *
  20364. * @private
  20365. * @name set
  20366. * @memberOf Stack
  20367. * @param {string} key The key of the value to set.
  20368. * @param {*} value The value to set.
  20369. * @returns {Object} Returns the stack cache instance.
  20370. */
  20371. function stackSet(key, value) {
  20372. var data = this.__data__;
  20373. if (data instanceof ListCache) {
  20374. var pairs = data.__data__;
  20375. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  20376. pairs.push([key, value]);
  20377. this.size = ++data.size;
  20378. return this;
  20379. }
  20380. data = this.__data__ = new MapCache(pairs);
  20381. }
  20382. data.set(key, value);
  20383. this.size = data.size;
  20384. return this;
  20385. }
  20386. // Add methods to `Stack`.
  20387. Stack.prototype.clear = stackClear;
  20388. Stack.prototype['delete'] = stackDelete;
  20389. Stack.prototype.get = stackGet;
  20390. Stack.prototype.has = stackHas;
  20391. Stack.prototype.set = stackSet;
  20392. /*------------------------------------------------------------------------*/
  20393. /**
  20394. * Creates an array of the enumerable property names of the array-like `value`.
  20395. *
  20396. * @private
  20397. * @param {*} value The value to query.
  20398. * @param {boolean} inherited Specify returning inherited property names.
  20399. * @returns {Array} Returns the array of property names.
  20400. */
  20401. function arrayLikeKeys(value, inherited) {
  20402. var isArr = isArray(value),
  20403. isArg = !isArr && isArguments(value),
  20404. isBuff = !isArr && !isArg && isBuffer(value),
  20405. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  20406. skipIndexes = isArr || isArg || isBuff || isType,
  20407. result = skipIndexes ? baseTimes(value.length, String) : [],
  20408. length = result.length;
  20409. for (var key in value) {
  20410. if ((inherited || hasOwnProperty.call(value, key)) &&
  20411. !(skipIndexes && (
  20412. // Safari 9 has enumerable `arguments.length` in strict mode.
  20413. key == 'length' ||
  20414. // Node.js 0.10 has enumerable non-index properties on buffers.
  20415. (isBuff && (key == 'offset' || key == 'parent')) ||
  20416. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  20417. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  20418. // Skip index properties.
  20419. isIndex(key, length)
  20420. ))) {
  20421. result.push(key);
  20422. }
  20423. }
  20424. return result;
  20425. }
  20426. /**
  20427. * A specialized version of `_.sample` for arrays.
  20428. *
  20429. * @private
  20430. * @param {Array} array The array to sample.
  20431. * @returns {*} Returns the random element.
  20432. */
  20433. function arraySample(array) {
  20434. var length = array.length;
  20435. return length ? array[baseRandom(0, length - 1)] : undefined;
  20436. }
  20437. /**
  20438. * A specialized version of `_.sampleSize` for arrays.
  20439. *
  20440. * @private
  20441. * @param {Array} array The array to sample.
  20442. * @param {number} n The number of elements to sample.
  20443. * @returns {Array} Returns the random elements.
  20444. */
  20445. function arraySampleSize(array, n) {
  20446. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  20447. }
  20448. /**
  20449. * A specialized version of `_.shuffle` for arrays.
  20450. *
  20451. * @private
  20452. * @param {Array} array The array to shuffle.
  20453. * @returns {Array} Returns the new shuffled array.
  20454. */
  20455. function arrayShuffle(array) {
  20456. return shuffleSelf(copyArray(array));
  20457. }
  20458. /**
  20459. * This function is like `assignValue` except that it doesn't assign
  20460. * `undefined` values.
  20461. *
  20462. * @private
  20463. * @param {Object} object The object to modify.
  20464. * @param {string} key The key of the property to assign.
  20465. * @param {*} value The value to assign.
  20466. */
  20467. function assignMergeValue(object, key, value) {
  20468. if ((value !== undefined && !eq(object[key], value)) ||
  20469. (value === undefined && !(key in object))) {
  20470. baseAssignValue(object, key, value);
  20471. }
  20472. }
  20473. /**
  20474. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  20475. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20476. * for equality comparisons.
  20477. *
  20478. * @private
  20479. * @param {Object} object The object to modify.
  20480. * @param {string} key The key of the property to assign.
  20481. * @param {*} value The value to assign.
  20482. */
  20483. function assignValue(object, key, value) {
  20484. var objValue = object[key];
  20485. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  20486. (value === undefined && !(key in object))) {
  20487. baseAssignValue(object, key, value);
  20488. }
  20489. }
  20490. /**
  20491. * Gets the index at which the `key` is found in `array` of key-value pairs.
  20492. *
  20493. * @private
  20494. * @param {Array} array The array to inspect.
  20495. * @param {*} key The key to search for.
  20496. * @returns {number} Returns the index of the matched value, else `-1`.
  20497. */
  20498. function assocIndexOf(array, key) {
  20499. var length = array.length;
  20500. while (length--) {
  20501. if (eq(array[length][0], key)) {
  20502. return length;
  20503. }
  20504. }
  20505. return -1;
  20506. }
  20507. /**
  20508. * Aggregates elements of `collection` on `accumulator` with keys transformed
  20509. * by `iteratee` and values set by `setter`.
  20510. *
  20511. * @private
  20512. * @param {Array|Object} collection The collection to iterate over.
  20513. * @param {Function} setter The function to set `accumulator` values.
  20514. * @param {Function} iteratee The iteratee to transform keys.
  20515. * @param {Object} accumulator The initial aggregated object.
  20516. * @returns {Function} Returns `accumulator`.
  20517. */
  20518. function baseAggregator(collection, setter, iteratee, accumulator) {
  20519. baseEach(collection, function(value, key, collection) {
  20520. setter(accumulator, value, iteratee(value), collection);
  20521. });
  20522. return accumulator;
  20523. }
  20524. /**
  20525. * The base implementation of `_.assign` without support for multiple sources
  20526. * or `customizer` functions.
  20527. *
  20528. * @private
  20529. * @param {Object} object The destination object.
  20530. * @param {Object} source The source object.
  20531. * @returns {Object} Returns `object`.
  20532. */
  20533. function baseAssign(object, source) {
  20534. return object && copyObject(source, keys(source), object);
  20535. }
  20536. /**
  20537. * The base implementation of `_.assignIn` without support for multiple sources
  20538. * or `customizer` functions.
  20539. *
  20540. * @private
  20541. * @param {Object} object The destination object.
  20542. * @param {Object} source The source object.
  20543. * @returns {Object} Returns `object`.
  20544. */
  20545. function baseAssignIn(object, source) {
  20546. return object && copyObject(source, keysIn(source), object);
  20547. }
  20548. /**
  20549. * The base implementation of `assignValue` and `assignMergeValue` without
  20550. * value checks.
  20551. *
  20552. * @private
  20553. * @param {Object} object The object to modify.
  20554. * @param {string} key The key of the property to assign.
  20555. * @param {*} value The value to assign.
  20556. */
  20557. function baseAssignValue(object, key, value) {
  20558. if (key == '__proto__' && defineProperty) {
  20559. defineProperty(object, key, {
  20560. 'configurable': true,
  20561. 'enumerable': true,
  20562. 'value': value,
  20563. 'writable': true
  20564. });
  20565. } else {
  20566. object[key] = value;
  20567. }
  20568. }
  20569. /**
  20570. * The base implementation of `_.at` without support for individual paths.
  20571. *
  20572. * @private
  20573. * @param {Object} object The object to iterate over.
  20574. * @param {string[]} paths The property paths to pick.
  20575. * @returns {Array} Returns the picked elements.
  20576. */
  20577. function baseAt(object, paths) {
  20578. var index = -1,
  20579. length = paths.length,
  20580. result = Array(length),
  20581. skip = object == null;
  20582. while (++index < length) {
  20583. result[index] = skip ? undefined : get(object, paths[index]);
  20584. }
  20585. return result;
  20586. }
  20587. /**
  20588. * The base implementation of `_.clamp` which doesn't coerce arguments.
  20589. *
  20590. * @private
  20591. * @param {number} number The number to clamp.
  20592. * @param {number} [lower] The lower bound.
  20593. * @param {number} upper The upper bound.
  20594. * @returns {number} Returns the clamped number.
  20595. */
  20596. function baseClamp(number, lower, upper) {
  20597. if (number === number) {
  20598. if (upper !== undefined) {
  20599. number = number <= upper ? number : upper;
  20600. }
  20601. if (lower !== undefined) {
  20602. number = number >= lower ? number : lower;
  20603. }
  20604. }
  20605. return number;
  20606. }
  20607. /**
  20608. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  20609. * traversed objects.
  20610. *
  20611. * @private
  20612. * @param {*} value The value to clone.
  20613. * @param {boolean} bitmask The bitmask flags.
  20614. * 1 - Deep clone
  20615. * 2 - Flatten inherited properties
  20616. * 4 - Clone symbols
  20617. * @param {Function} [customizer] The function to customize cloning.
  20618. * @param {string} [key] The key of `value`.
  20619. * @param {Object} [object] The parent object of `value`.
  20620. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  20621. * @returns {*} Returns the cloned value.
  20622. */
  20623. function baseClone(value, bitmask, customizer, key, object, stack) {
  20624. var result,
  20625. isDeep = bitmask & CLONE_DEEP_FLAG,
  20626. isFlat = bitmask & CLONE_FLAT_FLAG,
  20627. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  20628. if (customizer) {
  20629. result = object ? customizer(value, key, object, stack) : customizer(value);
  20630. }
  20631. if (result !== undefined) {
  20632. return result;
  20633. }
  20634. if (!isObject(value)) {
  20635. return value;
  20636. }
  20637. var isArr = isArray(value);
  20638. if (isArr) {
  20639. result = initCloneArray(value);
  20640. if (!isDeep) {
  20641. return copyArray(value, result);
  20642. }
  20643. } else {
  20644. var tag = getTag(value),
  20645. isFunc = tag == funcTag || tag == genTag;
  20646. if (isBuffer(value)) {
  20647. return cloneBuffer(value, isDeep);
  20648. }
  20649. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  20650. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  20651. if (!isDeep) {
  20652. return isFlat
  20653. ? copySymbolsIn(value, baseAssignIn(result, value))
  20654. : copySymbols(value, baseAssign(result, value));
  20655. }
  20656. } else {
  20657. if (!cloneableTags[tag]) {
  20658. return object ? value : {};
  20659. }
  20660. result = initCloneByTag(value, tag, isDeep);
  20661. }
  20662. }
  20663. // Check for circular references and return its corresponding clone.
  20664. stack || (stack = new Stack);
  20665. var stacked = stack.get(value);
  20666. if (stacked) {
  20667. return stacked;
  20668. }
  20669. stack.set(value, result);
  20670. if (isSet(value)) {
  20671. value.forEach(function(subValue) {
  20672. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  20673. });
  20674. } else if (isMap(value)) {
  20675. value.forEach(function(subValue, key) {
  20676. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20677. });
  20678. }
  20679. var keysFunc = isFull
  20680. ? (isFlat ? getAllKeysIn : getAllKeys)
  20681. : (isFlat ? keysIn : keys);
  20682. var props = isArr ? undefined : keysFunc(value);
  20683. arrayEach(props || value, function(subValue, key) {
  20684. if (props) {
  20685. key = subValue;
  20686. subValue = value[key];
  20687. }
  20688. // Recursively populate clone (susceptible to call stack limits).
  20689. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20690. });
  20691. return result;
  20692. }
  20693. /**
  20694. * The base implementation of `_.conforms` which doesn't clone `source`.
  20695. *
  20696. * @private
  20697. * @param {Object} source The object of property predicates to conform to.
  20698. * @returns {Function} Returns the new spec function.
  20699. */
  20700. function baseConforms(source) {
  20701. var props = keys(source);
  20702. return function(object) {
  20703. return baseConformsTo(object, source, props);
  20704. };
  20705. }
  20706. /**
  20707. * The base implementation of `_.conformsTo` which accepts `props` to check.
  20708. *
  20709. * @private
  20710. * @param {Object} object The object to inspect.
  20711. * @param {Object} source The object of property predicates to conform to.
  20712. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  20713. */
  20714. function baseConformsTo(object, source, props) {
  20715. var length = props.length;
  20716. if (object == null) {
  20717. return !length;
  20718. }
  20719. object = Object(object);
  20720. while (length--) {
  20721. var key = props[length],
  20722. predicate = source[key],
  20723. value = object[key];
  20724. if ((value === undefined && !(key in object)) || !predicate(value)) {
  20725. return false;
  20726. }
  20727. }
  20728. return true;
  20729. }
  20730. /**
  20731. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  20732. * to provide to `func`.
  20733. *
  20734. * @private
  20735. * @param {Function} func The function to delay.
  20736. * @param {number} wait The number of milliseconds to delay invocation.
  20737. * @param {Array} args The arguments to provide to `func`.
  20738. * @returns {number|Object} Returns the timer id or timeout object.
  20739. */
  20740. function baseDelay(func, wait, args) {
  20741. if (typeof func != 'function') {
  20742. throw new TypeError(FUNC_ERROR_TEXT);
  20743. }
  20744. return setTimeout(function() { func.apply(undefined, args); }, wait);
  20745. }
  20746. /**
  20747. * The base implementation of methods like `_.difference` without support
  20748. * for excluding multiple arrays or iteratee shorthands.
  20749. *
  20750. * @private
  20751. * @param {Array} array The array to inspect.
  20752. * @param {Array} values The values to exclude.
  20753. * @param {Function} [iteratee] The iteratee invoked per element.
  20754. * @param {Function} [comparator] The comparator invoked per element.
  20755. * @returns {Array} Returns the new array of filtered values.
  20756. */
  20757. function baseDifference(array, values, iteratee, comparator) {
  20758. var index = -1,
  20759. includes = arrayIncludes,
  20760. isCommon = true,
  20761. length = array.length,
  20762. result = [],
  20763. valuesLength = values.length;
  20764. if (!length) {
  20765. return result;
  20766. }
  20767. if (iteratee) {
  20768. values = arrayMap(values, baseUnary(iteratee));
  20769. }
  20770. if (comparator) {
  20771. includes = arrayIncludesWith;
  20772. isCommon = false;
  20773. }
  20774. else if (values.length >= LARGE_ARRAY_SIZE) {
  20775. includes = cacheHas;
  20776. isCommon = false;
  20777. values = new SetCache(values);
  20778. }
  20779. outer:
  20780. while (++index < length) {
  20781. var value = array[index],
  20782. computed = iteratee == null ? value : iteratee(value);
  20783. value = (comparator || value !== 0) ? value : 0;
  20784. if (isCommon && computed === computed) {
  20785. var valuesIndex = valuesLength;
  20786. while (valuesIndex--) {
  20787. if (values[valuesIndex] === computed) {
  20788. continue outer;
  20789. }
  20790. }
  20791. result.push(value);
  20792. }
  20793. else if (!includes(values, computed, comparator)) {
  20794. result.push(value);
  20795. }
  20796. }
  20797. return result;
  20798. }
  20799. /**
  20800. * The base implementation of `_.forEach` without support for iteratee shorthands.
  20801. *
  20802. * @private
  20803. * @param {Array|Object} collection The collection to iterate over.
  20804. * @param {Function} iteratee The function invoked per iteration.
  20805. * @returns {Array|Object} Returns `collection`.
  20806. */
  20807. var baseEach = createBaseEach(baseForOwn);
  20808. /**
  20809. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  20810. *
  20811. * @private
  20812. * @param {Array|Object} collection The collection to iterate over.
  20813. * @param {Function} iteratee The function invoked per iteration.
  20814. * @returns {Array|Object} Returns `collection`.
  20815. */
  20816. var baseEachRight = createBaseEach(baseForOwnRight, true);
  20817. /**
  20818. * The base implementation of `_.every` without support for iteratee shorthands.
  20819. *
  20820. * @private
  20821. * @param {Array|Object} collection The collection to iterate over.
  20822. * @param {Function} predicate The function invoked per iteration.
  20823. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  20824. * else `false`
  20825. */
  20826. function baseEvery(collection, predicate) {
  20827. var result = true;
  20828. baseEach(collection, function(value, index, collection) {
  20829. result = !!predicate(value, index, collection);
  20830. return result;
  20831. });
  20832. return result;
  20833. }
  20834. /**
  20835. * The base implementation of methods like `_.max` and `_.min` which accepts a
  20836. * `comparator` to determine the extremum value.
  20837. *
  20838. * @private
  20839. * @param {Array} array The array to iterate over.
  20840. * @param {Function} iteratee The iteratee invoked per iteration.
  20841. * @param {Function} comparator The comparator used to compare values.
  20842. * @returns {*} Returns the extremum value.
  20843. */
  20844. function baseExtremum(array, iteratee, comparator) {
  20845. var index = -1,
  20846. length = array.length;
  20847. while (++index < length) {
  20848. var value = array[index],
  20849. current = iteratee(value);
  20850. if (current != null && (computed === undefined
  20851. ? (current === current && !isSymbol(current))
  20852. : comparator(current, computed)
  20853. )) {
  20854. var computed = current,
  20855. result = value;
  20856. }
  20857. }
  20858. return result;
  20859. }
  20860. /**
  20861. * The base implementation of `_.fill` without an iteratee call guard.
  20862. *
  20863. * @private
  20864. * @param {Array} array The array to fill.
  20865. * @param {*} value The value to fill `array` with.
  20866. * @param {number} [start=0] The start position.
  20867. * @param {number} [end=array.length] The end position.
  20868. * @returns {Array} Returns `array`.
  20869. */
  20870. function baseFill(array, value, start, end) {
  20871. var length = array.length;
  20872. start = toInteger(start);
  20873. if (start < 0) {
  20874. start = -start > length ? 0 : (length + start);
  20875. }
  20876. end = (end === undefined || end > length) ? length : toInteger(end);
  20877. if (end < 0) {
  20878. end += length;
  20879. }
  20880. end = start > end ? 0 : toLength(end);
  20881. while (start < end) {
  20882. array[start++] = value;
  20883. }
  20884. return array;
  20885. }
  20886. /**
  20887. * The base implementation of `_.filter` without support for iteratee shorthands.
  20888. *
  20889. * @private
  20890. * @param {Array|Object} collection The collection to iterate over.
  20891. * @param {Function} predicate The function invoked per iteration.
  20892. * @returns {Array} Returns the new filtered array.
  20893. */
  20894. function baseFilter(collection, predicate) {
  20895. var result = [];
  20896. baseEach(collection, function(value, index, collection) {
  20897. if (predicate(value, index, collection)) {
  20898. result.push(value);
  20899. }
  20900. });
  20901. return result;
  20902. }
  20903. /**
  20904. * The base implementation of `_.flatten` with support for restricting flattening.
  20905. *
  20906. * @private
  20907. * @param {Array} array The array to flatten.
  20908. * @param {number} depth The maximum recursion depth.
  20909. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  20910. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  20911. * @param {Array} [result=[]] The initial result value.
  20912. * @returns {Array} Returns the new flattened array.
  20913. */
  20914. function baseFlatten(array, depth, predicate, isStrict, result) {
  20915. var index = -1,
  20916. length = array.length;
  20917. predicate || (predicate = isFlattenable);
  20918. result || (result = []);
  20919. while (++index < length) {
  20920. var value = array[index];
  20921. if (depth > 0 && predicate(value)) {
  20922. if (depth > 1) {
  20923. // Recursively flatten arrays (susceptible to call stack limits).
  20924. baseFlatten(value, depth - 1, predicate, isStrict, result);
  20925. } else {
  20926. arrayPush(result, value);
  20927. }
  20928. } else if (!isStrict) {
  20929. result[result.length] = value;
  20930. }
  20931. }
  20932. return result;
  20933. }
  20934. /**
  20935. * The base implementation of `baseForOwn` which iterates over `object`
  20936. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  20937. * Iteratee functions may exit iteration early by explicitly returning `false`.
  20938. *
  20939. * @private
  20940. * @param {Object} object The object to iterate over.
  20941. * @param {Function} iteratee The function invoked per iteration.
  20942. * @param {Function} keysFunc The function to get the keys of `object`.
  20943. * @returns {Object} Returns `object`.
  20944. */
  20945. var baseFor = createBaseFor();
  20946. /**
  20947. * This function is like `baseFor` except that it iterates over properties
  20948. * in the opposite order.
  20949. *
  20950. * @private
  20951. * @param {Object} object The object to iterate over.
  20952. * @param {Function} iteratee The function invoked per iteration.
  20953. * @param {Function} keysFunc The function to get the keys of `object`.
  20954. * @returns {Object} Returns `object`.
  20955. */
  20956. var baseForRight = createBaseFor(true);
  20957. /**
  20958. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  20959. *
  20960. * @private
  20961. * @param {Object} object The object to iterate over.
  20962. * @param {Function} iteratee The function invoked per iteration.
  20963. * @returns {Object} Returns `object`.
  20964. */
  20965. function baseForOwn(object, iteratee) {
  20966. return object && baseFor(object, iteratee, keys);
  20967. }
  20968. /**
  20969. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  20970. *
  20971. * @private
  20972. * @param {Object} object The object to iterate over.
  20973. * @param {Function} iteratee The function invoked per iteration.
  20974. * @returns {Object} Returns `object`.
  20975. */
  20976. function baseForOwnRight(object, iteratee) {
  20977. return object && baseForRight(object, iteratee, keys);
  20978. }
  20979. /**
  20980. * The base implementation of `_.functions` which creates an array of
  20981. * `object` function property names filtered from `props`.
  20982. *
  20983. * @private
  20984. * @param {Object} object The object to inspect.
  20985. * @param {Array} props The property names to filter.
  20986. * @returns {Array} Returns the function names.
  20987. */
  20988. function baseFunctions(object, props) {
  20989. return arrayFilter(props, function(key) {
  20990. return isFunction(object[key]);
  20991. });
  20992. }
  20993. /**
  20994. * The base implementation of `_.get` without support for default values.
  20995. *
  20996. * @private
  20997. * @param {Object} object The object to query.
  20998. * @param {Array|string} path The path of the property to get.
  20999. * @returns {*} Returns the resolved value.
  21000. */
  21001. function baseGet(object, path) {
  21002. path = castPath(path, object);
  21003. var index = 0,
  21004. length = path.length;
  21005. while (object != null && index < length) {
  21006. object = object[toKey(path[index++])];
  21007. }
  21008. return (index && index == length) ? object : undefined;
  21009. }
  21010. /**
  21011. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  21012. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  21013. * symbols of `object`.
  21014. *
  21015. * @private
  21016. * @param {Object} object The object to query.
  21017. * @param {Function} keysFunc The function to get the keys of `object`.
  21018. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  21019. * @returns {Array} Returns the array of property names and symbols.
  21020. */
  21021. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  21022. var result = keysFunc(object);
  21023. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  21024. }
  21025. /**
  21026. * The base implementation of `getTag` without fallbacks for buggy environments.
  21027. *
  21028. * @private
  21029. * @param {*} value The value to query.
  21030. * @returns {string} Returns the `toStringTag`.
  21031. */
  21032. function baseGetTag(value) {
  21033. if (value == null) {
  21034. return value === undefined ? undefinedTag : nullTag;
  21035. }
  21036. return (symToStringTag && symToStringTag in Object(value))
  21037. ? getRawTag(value)
  21038. : objectToString(value);
  21039. }
  21040. /**
  21041. * The base implementation of `_.gt` which doesn't coerce arguments.
  21042. *
  21043. * @private
  21044. * @param {*} value The value to compare.
  21045. * @param {*} other The other value to compare.
  21046. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  21047. * else `false`.
  21048. */
  21049. function baseGt(value, other) {
  21050. return value > other;
  21051. }
  21052. /**
  21053. * The base implementation of `_.has` without support for deep paths.
  21054. *
  21055. * @private
  21056. * @param {Object} [object] The object to query.
  21057. * @param {Array|string} key The key to check.
  21058. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21059. */
  21060. function baseHas(object, key) {
  21061. return object != null && hasOwnProperty.call(object, key);
  21062. }
  21063. /**
  21064. * The base implementation of `_.hasIn` without support for deep paths.
  21065. *
  21066. * @private
  21067. * @param {Object} [object] The object to query.
  21068. * @param {Array|string} key The key to check.
  21069. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21070. */
  21071. function baseHasIn(object, key) {
  21072. return object != null && key in Object(object);
  21073. }
  21074. /**
  21075. * The base implementation of `_.inRange` which doesn't coerce arguments.
  21076. *
  21077. * @private
  21078. * @param {number} number The number to check.
  21079. * @param {number} start The start of the range.
  21080. * @param {number} end The end of the range.
  21081. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  21082. */
  21083. function baseInRange(number, start, end) {
  21084. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  21085. }
  21086. /**
  21087. * The base implementation of methods like `_.intersection`, without support
  21088. * for iteratee shorthands, that accepts an array of arrays to inspect.
  21089. *
  21090. * @private
  21091. * @param {Array} arrays The arrays to inspect.
  21092. * @param {Function} [iteratee] The iteratee invoked per element.
  21093. * @param {Function} [comparator] The comparator invoked per element.
  21094. * @returns {Array} Returns the new array of shared values.
  21095. */
  21096. function baseIntersection(arrays, iteratee, comparator) {
  21097. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  21098. length = arrays[0].length,
  21099. othLength = arrays.length,
  21100. othIndex = othLength,
  21101. caches = Array(othLength),
  21102. maxLength = Infinity,
  21103. result = [];
  21104. while (othIndex--) {
  21105. var array = arrays[othIndex];
  21106. if (othIndex && iteratee) {
  21107. array = arrayMap(array, baseUnary(iteratee));
  21108. }
  21109. maxLength = nativeMin(array.length, maxLength);
  21110. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  21111. ? new SetCache(othIndex && array)
  21112. : undefined;
  21113. }
  21114. array = arrays[0];
  21115. var index = -1,
  21116. seen = caches[0];
  21117. outer:
  21118. while (++index < length && result.length < maxLength) {
  21119. var value = array[index],
  21120. computed = iteratee ? iteratee(value) : value;
  21121. value = (comparator || value !== 0) ? value : 0;
  21122. if (!(seen
  21123. ? cacheHas(seen, computed)
  21124. : includes(result, computed, comparator)
  21125. )) {
  21126. othIndex = othLength;
  21127. while (--othIndex) {
  21128. var cache = caches[othIndex];
  21129. if (!(cache
  21130. ? cacheHas(cache, computed)
  21131. : includes(arrays[othIndex], computed, comparator))
  21132. ) {
  21133. continue outer;
  21134. }
  21135. }
  21136. if (seen) {
  21137. seen.push(computed);
  21138. }
  21139. result.push(value);
  21140. }
  21141. }
  21142. return result;
  21143. }
  21144. /**
  21145. * The base implementation of `_.invert` and `_.invertBy` which inverts
  21146. * `object` with values transformed by `iteratee` and set by `setter`.
  21147. *
  21148. * @private
  21149. * @param {Object} object The object to iterate over.
  21150. * @param {Function} setter The function to set `accumulator` values.
  21151. * @param {Function} iteratee The iteratee to transform values.
  21152. * @param {Object} accumulator The initial inverted object.
  21153. * @returns {Function} Returns `accumulator`.
  21154. */
  21155. function baseInverter(object, setter, iteratee, accumulator) {
  21156. baseForOwn(object, function(value, key, object) {
  21157. setter(accumulator, iteratee(value), key, object);
  21158. });
  21159. return accumulator;
  21160. }
  21161. /**
  21162. * The base implementation of `_.invoke` without support for individual
  21163. * method arguments.
  21164. *
  21165. * @private
  21166. * @param {Object} object The object to query.
  21167. * @param {Array|string} path The path of the method to invoke.
  21168. * @param {Array} args The arguments to invoke the method with.
  21169. * @returns {*} Returns the result of the invoked method.
  21170. */
  21171. function baseInvoke(object, path, args) {
  21172. path = castPath(path, object);
  21173. object = parent(object, path);
  21174. var func = object == null ? object : object[toKey(last(path))];
  21175. return func == null ? undefined : apply(func, object, args);
  21176. }
  21177. /**
  21178. * The base implementation of `_.isArguments`.
  21179. *
  21180. * @private
  21181. * @param {*} value The value to check.
  21182. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  21183. */
  21184. function baseIsArguments(value) {
  21185. return isObjectLike(value) && baseGetTag(value) == argsTag;
  21186. }
  21187. /**
  21188. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  21189. *
  21190. * @private
  21191. * @param {*} value The value to check.
  21192. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  21193. */
  21194. function baseIsArrayBuffer(value) {
  21195. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  21196. }
  21197. /**
  21198. * The base implementation of `_.isDate` without Node.js optimizations.
  21199. *
  21200. * @private
  21201. * @param {*} value The value to check.
  21202. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  21203. */
  21204. function baseIsDate(value) {
  21205. return isObjectLike(value) && baseGetTag(value) == dateTag;
  21206. }
  21207. /**
  21208. * The base implementation of `_.isEqual` which supports partial comparisons
  21209. * and tracks traversed objects.
  21210. *
  21211. * @private
  21212. * @param {*} value The value to compare.
  21213. * @param {*} other The other value to compare.
  21214. * @param {boolean} bitmask The bitmask flags.
  21215. * 1 - Unordered comparison
  21216. * 2 - Partial comparison
  21217. * @param {Function} [customizer] The function to customize comparisons.
  21218. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  21219. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  21220. */
  21221. function baseIsEqual(value, other, bitmask, customizer, stack) {
  21222. if (value === other) {
  21223. return true;
  21224. }
  21225. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  21226. return value !== value && other !== other;
  21227. }
  21228. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  21229. }
  21230. /**
  21231. * A specialized version of `baseIsEqual` for arrays and objects which performs
  21232. * deep comparisons and tracks traversed objects enabling objects with circular
  21233. * references to be compared.
  21234. *
  21235. * @private
  21236. * @param {Object} object The object to compare.
  21237. * @param {Object} other The other object to compare.
  21238. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  21239. * @param {Function} customizer The function to customize comparisons.
  21240. * @param {Function} equalFunc The function to determine equivalents of values.
  21241. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  21242. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  21243. */
  21244. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  21245. var objIsArr = isArray(object),
  21246. othIsArr = isArray(other),
  21247. objTag = objIsArr ? arrayTag : getTag(object),
  21248. othTag = othIsArr ? arrayTag : getTag(other);
  21249. objTag = objTag == argsTag ? objectTag : objTag;
  21250. othTag = othTag == argsTag ? objectTag : othTag;
  21251. var objIsObj = objTag == objectTag,
  21252. othIsObj = othTag == objectTag,
  21253. isSameTag = objTag == othTag;
  21254. if (isSameTag && isBuffer(object)) {
  21255. if (!isBuffer(other)) {
  21256. return false;
  21257. }
  21258. objIsArr = true;
  21259. objIsObj = false;
  21260. }
  21261. if (isSameTag && !objIsObj) {
  21262. stack || (stack = new Stack);
  21263. return (objIsArr || isTypedArray(object))
  21264. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  21265. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  21266. }
  21267. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  21268. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  21269. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  21270. if (objIsWrapped || othIsWrapped) {
  21271. var objUnwrapped = objIsWrapped ? object.value() : object,
  21272. othUnwrapped = othIsWrapped ? other.value() : other;
  21273. stack || (stack = new Stack);
  21274. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  21275. }
  21276. }
  21277. if (!isSameTag) {
  21278. return false;
  21279. }
  21280. stack || (stack = new Stack);
  21281. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  21282. }
  21283. /**
  21284. * The base implementation of `_.isMap` without Node.js optimizations.
  21285. *
  21286. * @private
  21287. * @param {*} value The value to check.
  21288. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  21289. */
  21290. function baseIsMap(value) {
  21291. return isObjectLike(value) && getTag(value) == mapTag;
  21292. }
  21293. /**
  21294. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  21295. *
  21296. * @private
  21297. * @param {Object} object The object to inspect.
  21298. * @param {Object} source The object of property values to match.
  21299. * @param {Array} matchData The property names, values, and compare flags to match.
  21300. * @param {Function} [customizer] The function to customize comparisons.
  21301. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  21302. */
  21303. function baseIsMatch(object, source, matchData, customizer) {
  21304. var index = matchData.length,
  21305. length = index,
  21306. noCustomizer = !customizer;
  21307. if (object == null) {
  21308. return !length;
  21309. }
  21310. object = Object(object);
  21311. while (index--) {
  21312. var data = matchData[index];
  21313. if ((noCustomizer && data[2])
  21314. ? data[1] !== object[data[0]]
  21315. : !(data[0] in object)
  21316. ) {
  21317. return false;
  21318. }
  21319. }
  21320. while (++index < length) {
  21321. data = matchData[index];
  21322. var key = data[0],
  21323. objValue = object[key],
  21324. srcValue = data[1];
  21325. if (noCustomizer && data[2]) {
  21326. if (objValue === undefined && !(key in object)) {
  21327. return false;
  21328. }
  21329. } else {
  21330. var stack = new Stack;
  21331. if (customizer) {
  21332. var result = customizer(objValue, srcValue, key, object, source, stack);
  21333. }
  21334. if (!(result === undefined
  21335. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  21336. : result
  21337. )) {
  21338. return false;
  21339. }
  21340. }
  21341. }
  21342. return true;
  21343. }
  21344. /**
  21345. * The base implementation of `_.isNative` without bad shim checks.
  21346. *
  21347. * @private
  21348. * @param {*} value The value to check.
  21349. * @returns {boolean} Returns `true` if `value` is a native function,
  21350. * else `false`.
  21351. */
  21352. function baseIsNative(value) {
  21353. if (!isObject(value) || isMasked(value)) {
  21354. return false;
  21355. }
  21356. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  21357. return pattern.test(toSource(value));
  21358. }
  21359. /**
  21360. * The base implementation of `_.isRegExp` without Node.js optimizations.
  21361. *
  21362. * @private
  21363. * @param {*} value The value to check.
  21364. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  21365. */
  21366. function baseIsRegExp(value) {
  21367. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  21368. }
  21369. /**
  21370. * The base implementation of `_.isSet` without Node.js optimizations.
  21371. *
  21372. * @private
  21373. * @param {*} value The value to check.
  21374. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  21375. */
  21376. function baseIsSet(value) {
  21377. return isObjectLike(value) && getTag(value) == setTag;
  21378. }
  21379. /**
  21380. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  21381. *
  21382. * @private
  21383. * @param {*} value The value to check.
  21384. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  21385. */
  21386. function baseIsTypedArray(value) {
  21387. return isObjectLike(value) &&
  21388. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  21389. }
  21390. /**
  21391. * The base implementation of `_.iteratee`.
  21392. *
  21393. * @private
  21394. * @param {*} [value=_.identity] The value to convert to an iteratee.
  21395. * @returns {Function} Returns the iteratee.
  21396. */
  21397. function baseIteratee(value) {
  21398. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  21399. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  21400. if (typeof value == 'function') {
  21401. return value;
  21402. }
  21403. if (value == null) {
  21404. return identity;
  21405. }
  21406. if (typeof value == 'object') {
  21407. return isArray(value)
  21408. ? baseMatchesProperty(value[0], value[1])
  21409. : baseMatches(value);
  21410. }
  21411. return property(value);
  21412. }
  21413. /**
  21414. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  21415. *
  21416. * @private
  21417. * @param {Object} object The object to query.
  21418. * @returns {Array} Returns the array of property names.
  21419. */
  21420. function baseKeys(object) {
  21421. if (!isPrototype(object)) {
  21422. return nativeKeys(object);
  21423. }
  21424. var result = [];
  21425. for (var key in Object(object)) {
  21426. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  21427. result.push(key);
  21428. }
  21429. }
  21430. return result;
  21431. }
  21432. /**
  21433. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  21434. *
  21435. * @private
  21436. * @param {Object} object The object to query.
  21437. * @returns {Array} Returns the array of property names.
  21438. */
  21439. function baseKeysIn(object) {
  21440. if (!isObject(object)) {
  21441. return nativeKeysIn(object);
  21442. }
  21443. var isProto = isPrototype(object),
  21444. result = [];
  21445. for (var key in object) {
  21446. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  21447. result.push(key);
  21448. }
  21449. }
  21450. return result;
  21451. }
  21452. /**
  21453. * The base implementation of `_.lt` which doesn't coerce arguments.
  21454. *
  21455. * @private
  21456. * @param {*} value The value to compare.
  21457. * @param {*} other The other value to compare.
  21458. * @returns {boolean} Returns `true` if `value` is less than `other`,
  21459. * else `false`.
  21460. */
  21461. function baseLt(value, other) {
  21462. return value < other;
  21463. }
  21464. /**
  21465. * The base implementation of `_.map` without support for iteratee shorthands.
  21466. *
  21467. * @private
  21468. * @param {Array|Object} collection The collection to iterate over.
  21469. * @param {Function} iteratee The function invoked per iteration.
  21470. * @returns {Array} Returns the new mapped array.
  21471. */
  21472. function baseMap(collection, iteratee) {
  21473. var index = -1,
  21474. result = isArrayLike(collection) ? Array(collection.length) : [];
  21475. baseEach(collection, function(value, key, collection) {
  21476. result[++index] = iteratee(value, key, collection);
  21477. });
  21478. return result;
  21479. }
  21480. /**
  21481. * The base implementation of `_.matches` which doesn't clone `source`.
  21482. *
  21483. * @private
  21484. * @param {Object} source The object of property values to match.
  21485. * @returns {Function} Returns the new spec function.
  21486. */
  21487. function baseMatches(source) {
  21488. var matchData = getMatchData(source);
  21489. if (matchData.length == 1 && matchData[0][2]) {
  21490. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  21491. }
  21492. return function(object) {
  21493. return object === source || baseIsMatch(object, source, matchData);
  21494. };
  21495. }
  21496. /**
  21497. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  21498. *
  21499. * @private
  21500. * @param {string} path The path of the property to get.
  21501. * @param {*} srcValue The value to match.
  21502. * @returns {Function} Returns the new spec function.
  21503. */
  21504. function baseMatchesProperty(path, srcValue) {
  21505. if (isKey(path) && isStrictComparable(srcValue)) {
  21506. return matchesStrictComparable(toKey(path), srcValue);
  21507. }
  21508. return function(object) {
  21509. var objValue = get(object, path);
  21510. return (objValue === undefined && objValue === srcValue)
  21511. ? hasIn(object, path)
  21512. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  21513. };
  21514. }
  21515. /**
  21516. * The base implementation of `_.merge` without support for multiple sources.
  21517. *
  21518. * @private
  21519. * @param {Object} object The destination object.
  21520. * @param {Object} source The source object.
  21521. * @param {number} srcIndex The index of `source`.
  21522. * @param {Function} [customizer] The function to customize merged values.
  21523. * @param {Object} [stack] Tracks traversed source values and their merged
  21524. * counterparts.
  21525. */
  21526. function baseMerge(object, source, srcIndex, customizer, stack) {
  21527. if (object === source) {
  21528. return;
  21529. }
  21530. baseFor(source, function(srcValue, key) {
  21531. stack || (stack = new Stack);
  21532. if (isObject(srcValue)) {
  21533. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  21534. }
  21535. else {
  21536. var newValue = customizer
  21537. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  21538. : undefined;
  21539. if (newValue === undefined) {
  21540. newValue = srcValue;
  21541. }
  21542. assignMergeValue(object, key, newValue);
  21543. }
  21544. }, keysIn);
  21545. }
  21546. /**
  21547. * A specialized version of `baseMerge` for arrays and objects which performs
  21548. * deep merges and tracks traversed objects enabling objects with circular
  21549. * references to be merged.
  21550. *
  21551. * @private
  21552. * @param {Object} object The destination object.
  21553. * @param {Object} source The source object.
  21554. * @param {string} key The key of the value to merge.
  21555. * @param {number} srcIndex The index of `source`.
  21556. * @param {Function} mergeFunc The function to merge values.
  21557. * @param {Function} [customizer] The function to customize assigned values.
  21558. * @param {Object} [stack] Tracks traversed source values and their merged
  21559. * counterparts.
  21560. */
  21561. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  21562. var objValue = safeGet(object, key),
  21563. srcValue = safeGet(source, key),
  21564. stacked = stack.get(srcValue);
  21565. if (stacked) {
  21566. assignMergeValue(object, key, stacked);
  21567. return;
  21568. }
  21569. var newValue = customizer
  21570. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  21571. : undefined;
  21572. var isCommon = newValue === undefined;
  21573. if (isCommon) {
  21574. var isArr = isArray(srcValue),
  21575. isBuff = !isArr && isBuffer(srcValue),
  21576. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  21577. newValue = srcValue;
  21578. if (isArr || isBuff || isTyped) {
  21579. if (isArray(objValue)) {
  21580. newValue = objValue;
  21581. }
  21582. else if (isArrayLikeObject(objValue)) {
  21583. newValue = copyArray(objValue);
  21584. }
  21585. else if (isBuff) {
  21586. isCommon = false;
  21587. newValue = cloneBuffer(srcValue, true);
  21588. }
  21589. else if (isTyped) {
  21590. isCommon = false;
  21591. newValue = cloneTypedArray(srcValue, true);
  21592. }
  21593. else {
  21594. newValue = [];
  21595. }
  21596. }
  21597. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  21598. newValue = objValue;
  21599. if (isArguments(objValue)) {
  21600. newValue = toPlainObject(objValue);
  21601. }
  21602. else if (!isObject(objValue) || isFunction(objValue)) {
  21603. newValue = initCloneObject(srcValue);
  21604. }
  21605. }
  21606. else {
  21607. isCommon = false;
  21608. }
  21609. }
  21610. if (isCommon) {
  21611. // Recursively merge objects and arrays (susceptible to call stack limits).
  21612. stack.set(srcValue, newValue);
  21613. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  21614. stack['delete'](srcValue);
  21615. }
  21616. assignMergeValue(object, key, newValue);
  21617. }
  21618. /**
  21619. * The base implementation of `_.nth` which doesn't coerce arguments.
  21620. *
  21621. * @private
  21622. * @param {Array} array The array to query.
  21623. * @param {number} n The index of the element to return.
  21624. * @returns {*} Returns the nth element of `array`.
  21625. */
  21626. function baseNth(array, n) {
  21627. var length = array.length;
  21628. if (!length) {
  21629. return;
  21630. }
  21631. n += n < 0 ? length : 0;
  21632. return isIndex(n, length) ? array[n] : undefined;
  21633. }
  21634. /**
  21635. * The base implementation of `_.orderBy` without param guards.
  21636. *
  21637. * @private
  21638. * @param {Array|Object} collection The collection to iterate over.
  21639. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  21640. * @param {string[]} orders The sort orders of `iteratees`.
  21641. * @returns {Array} Returns the new sorted array.
  21642. */
  21643. function baseOrderBy(collection, iteratees, orders) {
  21644. var index = -1;
  21645. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  21646. var result = baseMap(collection, function(value, key, collection) {
  21647. var criteria = arrayMap(iteratees, function(iteratee) {
  21648. return iteratee(value);
  21649. });
  21650. return { 'criteria': criteria, 'index': ++index, 'value': value };
  21651. });
  21652. return baseSortBy(result, function(object, other) {
  21653. return compareMultiple(object, other, orders);
  21654. });
  21655. }
  21656. /**
  21657. * The base implementation of `_.pick` without support for individual
  21658. * property identifiers.
  21659. *
  21660. * @private
  21661. * @param {Object} object The source object.
  21662. * @param {string[]} paths The property paths to pick.
  21663. * @returns {Object} Returns the new object.
  21664. */
  21665. function basePick(object, paths) {
  21666. return basePickBy(object, paths, function(value, path) {
  21667. return hasIn(object, path);
  21668. });
  21669. }
  21670. /**
  21671. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  21672. *
  21673. * @private
  21674. * @param {Object} object The source object.
  21675. * @param {string[]} paths The property paths to pick.
  21676. * @param {Function} predicate The function invoked per property.
  21677. * @returns {Object} Returns the new object.
  21678. */
  21679. function basePickBy(object, paths, predicate) {
  21680. var index = -1,
  21681. length = paths.length,
  21682. result = {};
  21683. while (++index < length) {
  21684. var path = paths[index],
  21685. value = baseGet(object, path);
  21686. if (predicate(value, path)) {
  21687. baseSet(result, castPath(path, object), value);
  21688. }
  21689. }
  21690. return result;
  21691. }
  21692. /**
  21693. * A specialized version of `baseProperty` which supports deep paths.
  21694. *
  21695. * @private
  21696. * @param {Array|string} path The path of the property to get.
  21697. * @returns {Function} Returns the new accessor function.
  21698. */
  21699. function basePropertyDeep(path) {
  21700. return function(object) {
  21701. return baseGet(object, path);
  21702. };
  21703. }
  21704. /**
  21705. * The base implementation of `_.pullAllBy` without support for iteratee
  21706. * shorthands.
  21707. *
  21708. * @private
  21709. * @param {Array} array The array to modify.
  21710. * @param {Array} values The values to remove.
  21711. * @param {Function} [iteratee] The iteratee invoked per element.
  21712. * @param {Function} [comparator] The comparator invoked per element.
  21713. * @returns {Array} Returns `array`.
  21714. */
  21715. function basePullAll(array, values, iteratee, comparator) {
  21716. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  21717. index = -1,
  21718. length = values.length,
  21719. seen = array;
  21720. if (array === values) {
  21721. values = copyArray(values);
  21722. }
  21723. if (iteratee) {
  21724. seen = arrayMap(array, baseUnary(iteratee));
  21725. }
  21726. while (++index < length) {
  21727. var fromIndex = 0,
  21728. value = values[index],
  21729. computed = iteratee ? iteratee(value) : value;
  21730. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  21731. if (seen !== array) {
  21732. splice.call(seen, fromIndex, 1);
  21733. }
  21734. splice.call(array, fromIndex, 1);
  21735. }
  21736. }
  21737. return array;
  21738. }
  21739. /**
  21740. * The base implementation of `_.pullAt` without support for individual
  21741. * indexes or capturing the removed elements.
  21742. *
  21743. * @private
  21744. * @param {Array} array The array to modify.
  21745. * @param {number[]} indexes The indexes of elements to remove.
  21746. * @returns {Array} Returns `array`.
  21747. */
  21748. function basePullAt(array, indexes) {
  21749. var length = array ? indexes.length : 0,
  21750. lastIndex = length - 1;
  21751. while (length--) {
  21752. var index = indexes[length];
  21753. if (length == lastIndex || index !== previous) {
  21754. var previous = index;
  21755. if (isIndex(index)) {
  21756. splice.call(array, index, 1);
  21757. } else {
  21758. baseUnset(array, index);
  21759. }
  21760. }
  21761. }
  21762. return array;
  21763. }
  21764. /**
  21765. * The base implementation of `_.random` without support for returning
  21766. * floating-point numbers.
  21767. *
  21768. * @private
  21769. * @param {number} lower The lower bound.
  21770. * @param {number} upper The upper bound.
  21771. * @returns {number} Returns the random number.
  21772. */
  21773. function baseRandom(lower, upper) {
  21774. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  21775. }
  21776. /**
  21777. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  21778. * coerce arguments.
  21779. *
  21780. * @private
  21781. * @param {number} start The start of the range.
  21782. * @param {number} end The end of the range.
  21783. * @param {number} step The value to increment or decrement by.
  21784. * @param {boolean} [fromRight] Specify iterating from right to left.
  21785. * @returns {Array} Returns the range of numbers.
  21786. */
  21787. function baseRange(start, end, step, fromRight) {
  21788. var index = -1,
  21789. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  21790. result = Array(length);
  21791. while (length--) {
  21792. result[fromRight ? length : ++index] = start;
  21793. start += step;
  21794. }
  21795. return result;
  21796. }
  21797. /**
  21798. * The base implementation of `_.repeat` which doesn't coerce arguments.
  21799. *
  21800. * @private
  21801. * @param {string} string The string to repeat.
  21802. * @param {number} n The number of times to repeat the string.
  21803. * @returns {string} Returns the repeated string.
  21804. */
  21805. function baseRepeat(string, n) {
  21806. var result = '';
  21807. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  21808. return result;
  21809. }
  21810. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  21811. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  21812. do {
  21813. if (n % 2) {
  21814. result += string;
  21815. }
  21816. n = nativeFloor(n / 2);
  21817. if (n) {
  21818. string += string;
  21819. }
  21820. } while (n);
  21821. return result;
  21822. }
  21823. /**
  21824. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  21825. *
  21826. * @private
  21827. * @param {Function} func The function to apply a rest parameter to.
  21828. * @param {number} [start=func.length-1] The start position of the rest parameter.
  21829. * @returns {Function} Returns the new function.
  21830. */
  21831. function baseRest(func, start) {
  21832. return setToString(overRest(func, start, identity), func + '');
  21833. }
  21834. /**
  21835. * The base implementation of `_.sample`.
  21836. *
  21837. * @private
  21838. * @param {Array|Object} collection The collection to sample.
  21839. * @returns {*} Returns the random element.
  21840. */
  21841. function baseSample(collection) {
  21842. return arraySample(values(collection));
  21843. }
  21844. /**
  21845. * The base implementation of `_.sampleSize` without param guards.
  21846. *
  21847. * @private
  21848. * @param {Array|Object} collection The collection to sample.
  21849. * @param {number} n The number of elements to sample.
  21850. * @returns {Array} Returns the random elements.
  21851. */
  21852. function baseSampleSize(collection, n) {
  21853. var array = values(collection);
  21854. return shuffleSelf(array, baseClamp(n, 0, array.length));
  21855. }
  21856. /**
  21857. * The base implementation of `_.set`.
  21858. *
  21859. * @private
  21860. * @param {Object} object The object to modify.
  21861. * @param {Array|string} path The path of the property to set.
  21862. * @param {*} value The value to set.
  21863. * @param {Function} [customizer] The function to customize path creation.
  21864. * @returns {Object} Returns `object`.
  21865. */
  21866. function baseSet(object, path, value, customizer) {
  21867. if (!isObject(object)) {
  21868. return object;
  21869. }
  21870. path = castPath(path, object);
  21871. var index = -1,
  21872. length = path.length,
  21873. lastIndex = length - 1,
  21874. nested = object;
  21875. while (nested != null && ++index < length) {
  21876. var key = toKey(path[index]),
  21877. newValue = value;
  21878. if (index != lastIndex) {
  21879. var objValue = nested[key];
  21880. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  21881. if (newValue === undefined) {
  21882. newValue = isObject(objValue)
  21883. ? objValue
  21884. : (isIndex(path[index + 1]) ? [] : {});
  21885. }
  21886. }
  21887. assignValue(nested, key, newValue);
  21888. nested = nested[key];
  21889. }
  21890. return object;
  21891. }
  21892. /**
  21893. * The base implementation of `setData` without support for hot loop shorting.
  21894. *
  21895. * @private
  21896. * @param {Function} func The function to associate metadata with.
  21897. * @param {*} data The metadata.
  21898. * @returns {Function} Returns `func`.
  21899. */
  21900. var baseSetData = !metaMap ? identity : function(func, data) {
  21901. metaMap.set(func, data);
  21902. return func;
  21903. };
  21904. /**
  21905. * The base implementation of `setToString` without support for hot loop shorting.
  21906. *
  21907. * @private
  21908. * @param {Function} func The function to modify.
  21909. * @param {Function} string The `toString` result.
  21910. * @returns {Function} Returns `func`.
  21911. */
  21912. var baseSetToString = !defineProperty ? identity : function(func, string) {
  21913. return defineProperty(func, 'toString', {
  21914. 'configurable': true,
  21915. 'enumerable': false,
  21916. 'value': constant(string),
  21917. 'writable': true
  21918. });
  21919. };
  21920. /**
  21921. * The base implementation of `_.shuffle`.
  21922. *
  21923. * @private
  21924. * @param {Array|Object} collection The collection to shuffle.
  21925. * @returns {Array} Returns the new shuffled array.
  21926. */
  21927. function baseShuffle(collection) {
  21928. return shuffleSelf(values(collection));
  21929. }
  21930. /**
  21931. * The base implementation of `_.slice` without an iteratee call guard.
  21932. *
  21933. * @private
  21934. * @param {Array} array The array to slice.
  21935. * @param {number} [start=0] The start position.
  21936. * @param {number} [end=array.length] The end position.
  21937. * @returns {Array} Returns the slice of `array`.
  21938. */
  21939. function baseSlice(array, start, end) {
  21940. var index = -1,
  21941. length = array.length;
  21942. if (start < 0) {
  21943. start = -start > length ? 0 : (length + start);
  21944. }
  21945. end = end > length ? length : end;
  21946. if (end < 0) {
  21947. end += length;
  21948. }
  21949. length = start > end ? 0 : ((end - start) >>> 0);
  21950. start >>>= 0;
  21951. var result = Array(length);
  21952. while (++index < length) {
  21953. result[index] = array[index + start];
  21954. }
  21955. return result;
  21956. }
  21957. /**
  21958. * The base implementation of `_.some` without support for iteratee shorthands.
  21959. *
  21960. * @private
  21961. * @param {Array|Object} collection The collection to iterate over.
  21962. * @param {Function} predicate The function invoked per iteration.
  21963. * @returns {boolean} Returns `true` if any element passes the predicate check,
  21964. * else `false`.
  21965. */
  21966. function baseSome(collection, predicate) {
  21967. var result;
  21968. baseEach(collection, function(value, index, collection) {
  21969. result = predicate(value, index, collection);
  21970. return !result;
  21971. });
  21972. return !!result;
  21973. }
  21974. /**
  21975. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  21976. * performs a binary search of `array` to determine the index at which `value`
  21977. * should be inserted into `array` in order to maintain its sort order.
  21978. *
  21979. * @private
  21980. * @param {Array} array The sorted array to inspect.
  21981. * @param {*} value The value to evaluate.
  21982. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  21983. * @returns {number} Returns the index at which `value` should be inserted
  21984. * into `array`.
  21985. */
  21986. function baseSortedIndex(array, value, retHighest) {
  21987. var low = 0,
  21988. high = array == null ? low : array.length;
  21989. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  21990. while (low < high) {
  21991. var mid = (low + high) >>> 1,
  21992. computed = array[mid];
  21993. if (computed !== null && !isSymbol(computed) &&
  21994. (retHighest ? (computed <= value) : (computed < value))) {
  21995. low = mid + 1;
  21996. } else {
  21997. high = mid;
  21998. }
  21999. }
  22000. return high;
  22001. }
  22002. return baseSortedIndexBy(array, value, identity, retHighest);
  22003. }
  22004. /**
  22005. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  22006. * which invokes `iteratee` for `value` and each element of `array` to compute
  22007. * their sort ranking. The iteratee is invoked with one argument; (value).
  22008. *
  22009. * @private
  22010. * @param {Array} array The sorted array to inspect.
  22011. * @param {*} value The value to evaluate.
  22012. * @param {Function} iteratee The iteratee invoked per element.
  22013. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22014. * @returns {number} Returns the index at which `value` should be inserted
  22015. * into `array`.
  22016. */
  22017. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  22018. value = iteratee(value);
  22019. var low = 0,
  22020. high = array == null ? 0 : array.length,
  22021. valIsNaN = value !== value,
  22022. valIsNull = value === null,
  22023. valIsSymbol = isSymbol(value),
  22024. valIsUndefined = value === undefined;
  22025. while (low < high) {
  22026. var mid = nativeFloor((low + high) / 2),
  22027. computed = iteratee(array[mid]),
  22028. othIsDefined = computed !== undefined,
  22029. othIsNull = computed === null,
  22030. othIsReflexive = computed === computed,
  22031. othIsSymbol = isSymbol(computed);
  22032. if (valIsNaN) {
  22033. var setLow = retHighest || othIsReflexive;
  22034. } else if (valIsUndefined) {
  22035. setLow = othIsReflexive && (retHighest || othIsDefined);
  22036. } else if (valIsNull) {
  22037. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  22038. } else if (valIsSymbol) {
  22039. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  22040. } else if (othIsNull || othIsSymbol) {
  22041. setLow = false;
  22042. } else {
  22043. setLow = retHighest ? (computed <= value) : (computed < value);
  22044. }
  22045. if (setLow) {
  22046. low = mid + 1;
  22047. } else {
  22048. high = mid;
  22049. }
  22050. }
  22051. return nativeMin(high, MAX_ARRAY_INDEX);
  22052. }
  22053. /**
  22054. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  22055. * support for iteratee shorthands.
  22056. *
  22057. * @private
  22058. * @param {Array} array The array to inspect.
  22059. * @param {Function} [iteratee] The iteratee invoked per element.
  22060. * @returns {Array} Returns the new duplicate free array.
  22061. */
  22062. function baseSortedUniq(array, iteratee) {
  22063. var index = -1,
  22064. length = array.length,
  22065. resIndex = 0,
  22066. result = [];
  22067. while (++index < length) {
  22068. var value = array[index],
  22069. computed = iteratee ? iteratee(value) : value;
  22070. if (!index || !eq(computed, seen)) {
  22071. var seen = computed;
  22072. result[resIndex++] = value === 0 ? 0 : value;
  22073. }
  22074. }
  22075. return result;
  22076. }
  22077. /**
  22078. * The base implementation of `_.toNumber` which doesn't ensure correct
  22079. * conversions of binary, hexadecimal, or octal string values.
  22080. *
  22081. * @private
  22082. * @param {*} value The value to process.
  22083. * @returns {number} Returns the number.
  22084. */
  22085. function baseToNumber(value) {
  22086. if (typeof value == 'number') {
  22087. return value;
  22088. }
  22089. if (isSymbol(value)) {
  22090. return NAN;
  22091. }
  22092. return +value;
  22093. }
  22094. /**
  22095. * The base implementation of `_.toString` which doesn't convert nullish
  22096. * values to empty strings.
  22097. *
  22098. * @private
  22099. * @param {*} value The value to process.
  22100. * @returns {string} Returns the string.
  22101. */
  22102. function baseToString(value) {
  22103. // Exit early for strings to avoid a performance hit in some environments.
  22104. if (typeof value == 'string') {
  22105. return value;
  22106. }
  22107. if (isArray(value)) {
  22108. // Recursively convert values (susceptible to call stack limits).
  22109. return arrayMap(value, baseToString) + '';
  22110. }
  22111. if (isSymbol(value)) {
  22112. return symbolToString ? symbolToString.call(value) : '';
  22113. }
  22114. var result = (value + '');
  22115. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  22116. }
  22117. /**
  22118. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  22119. *
  22120. * @private
  22121. * @param {Array} array The array to inspect.
  22122. * @param {Function} [iteratee] The iteratee invoked per element.
  22123. * @param {Function} [comparator] The comparator invoked per element.
  22124. * @returns {Array} Returns the new duplicate free array.
  22125. */
  22126. function baseUniq(array, iteratee, comparator) {
  22127. var index = -1,
  22128. includes = arrayIncludes,
  22129. length = array.length,
  22130. isCommon = true,
  22131. result = [],
  22132. seen = result;
  22133. if (comparator) {
  22134. isCommon = false;
  22135. includes = arrayIncludesWith;
  22136. }
  22137. else if (length >= LARGE_ARRAY_SIZE) {
  22138. var set = iteratee ? null : createSet(array);
  22139. if (set) {
  22140. return setToArray(set);
  22141. }
  22142. isCommon = false;
  22143. includes = cacheHas;
  22144. seen = new SetCache;
  22145. }
  22146. else {
  22147. seen = iteratee ? [] : result;
  22148. }
  22149. outer:
  22150. while (++index < length) {
  22151. var value = array[index],
  22152. computed = iteratee ? iteratee(value) : value;
  22153. value = (comparator || value !== 0) ? value : 0;
  22154. if (isCommon && computed === computed) {
  22155. var seenIndex = seen.length;
  22156. while (seenIndex--) {
  22157. if (seen[seenIndex] === computed) {
  22158. continue outer;
  22159. }
  22160. }
  22161. if (iteratee) {
  22162. seen.push(computed);
  22163. }
  22164. result.push(value);
  22165. }
  22166. else if (!includes(seen, computed, comparator)) {
  22167. if (seen !== result) {
  22168. seen.push(computed);
  22169. }
  22170. result.push(value);
  22171. }
  22172. }
  22173. return result;
  22174. }
  22175. /**
  22176. * The base implementation of `_.unset`.
  22177. *
  22178. * @private
  22179. * @param {Object} object The object to modify.
  22180. * @param {Array|string} path The property path to unset.
  22181. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  22182. */
  22183. function baseUnset(object, path) {
  22184. path = castPath(path, object);
  22185. object = parent(object, path);
  22186. return object == null || delete object[toKey(last(path))];
  22187. }
  22188. /**
  22189. * The base implementation of `_.update`.
  22190. *
  22191. * @private
  22192. * @param {Object} object The object to modify.
  22193. * @param {Array|string} path The path of the property to update.
  22194. * @param {Function} updater The function to produce the updated value.
  22195. * @param {Function} [customizer] The function to customize path creation.
  22196. * @returns {Object} Returns `object`.
  22197. */
  22198. function baseUpdate(object, path, updater, customizer) {
  22199. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  22200. }
  22201. /**
  22202. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  22203. * without support for iteratee shorthands.
  22204. *
  22205. * @private
  22206. * @param {Array} array The array to query.
  22207. * @param {Function} predicate The function invoked per iteration.
  22208. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  22209. * @param {boolean} [fromRight] Specify iterating from right to left.
  22210. * @returns {Array} Returns the slice of `array`.
  22211. */
  22212. function baseWhile(array, predicate, isDrop, fromRight) {
  22213. var length = array.length,
  22214. index = fromRight ? length : -1;
  22215. while ((fromRight ? index-- : ++index < length) &&
  22216. predicate(array[index], index, array)) {}
  22217. return isDrop
  22218. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  22219. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  22220. }
  22221. /**
  22222. * The base implementation of `wrapperValue` which returns the result of
  22223. * performing a sequence of actions on the unwrapped `value`, where each
  22224. * successive action is supplied the return value of the previous.
  22225. *
  22226. * @private
  22227. * @param {*} value The unwrapped value.
  22228. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  22229. * @returns {*} Returns the resolved value.
  22230. */
  22231. function baseWrapperValue(value, actions) {
  22232. var result = value;
  22233. if (result instanceof LazyWrapper) {
  22234. result = result.value();
  22235. }
  22236. return arrayReduce(actions, function(result, action) {
  22237. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  22238. }, result);
  22239. }
  22240. /**
  22241. * The base implementation of methods like `_.xor`, without support for
  22242. * iteratee shorthands, that accepts an array of arrays to inspect.
  22243. *
  22244. * @private
  22245. * @param {Array} arrays The arrays to inspect.
  22246. * @param {Function} [iteratee] The iteratee invoked per element.
  22247. * @param {Function} [comparator] The comparator invoked per element.
  22248. * @returns {Array} Returns the new array of values.
  22249. */
  22250. function baseXor(arrays, iteratee, comparator) {
  22251. var length = arrays.length;
  22252. if (length < 2) {
  22253. return length ? baseUniq(arrays[0]) : [];
  22254. }
  22255. var index = -1,
  22256. result = Array(length);
  22257. while (++index < length) {
  22258. var array = arrays[index],
  22259. othIndex = -1;
  22260. while (++othIndex < length) {
  22261. if (othIndex != index) {
  22262. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  22263. }
  22264. }
  22265. }
  22266. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  22267. }
  22268. /**
  22269. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  22270. *
  22271. * @private
  22272. * @param {Array} props The property identifiers.
  22273. * @param {Array} values The property values.
  22274. * @param {Function} assignFunc The function to assign values.
  22275. * @returns {Object} Returns the new object.
  22276. */
  22277. function baseZipObject(props, values, assignFunc) {
  22278. var index = -1,
  22279. length = props.length,
  22280. valsLength = values.length,
  22281. result = {};
  22282. while (++index < length) {
  22283. var value = index < valsLength ? values[index] : undefined;
  22284. assignFunc(result, props[index], value);
  22285. }
  22286. return result;
  22287. }
  22288. /**
  22289. * Casts `value` to an empty array if it's not an array like object.
  22290. *
  22291. * @private
  22292. * @param {*} value The value to inspect.
  22293. * @returns {Array|Object} Returns the cast array-like object.
  22294. */
  22295. function castArrayLikeObject(value) {
  22296. return isArrayLikeObject(value) ? value : [];
  22297. }
  22298. /**
  22299. * Casts `value` to `identity` if it's not a function.
  22300. *
  22301. * @private
  22302. * @param {*} value The value to inspect.
  22303. * @returns {Function} Returns cast function.
  22304. */
  22305. function castFunction(value) {
  22306. return typeof value == 'function' ? value : identity;
  22307. }
  22308. /**
  22309. * Casts `value` to a path array if it's not one.
  22310. *
  22311. * @private
  22312. * @param {*} value The value to inspect.
  22313. * @param {Object} [object] The object to query keys on.
  22314. * @returns {Array} Returns the cast property path array.
  22315. */
  22316. function castPath(value, object) {
  22317. if (isArray(value)) {
  22318. return value;
  22319. }
  22320. return isKey(value, object) ? [value] : stringToPath(toString(value));
  22321. }
  22322. /**
  22323. * A `baseRest` alias which can be replaced with `identity` by module
  22324. * replacement plugins.
  22325. *
  22326. * @private
  22327. * @type {Function}
  22328. * @param {Function} func The function to apply a rest parameter to.
  22329. * @returns {Function} Returns the new function.
  22330. */
  22331. var castRest = baseRest;
  22332. /**
  22333. * Casts `array` to a slice if it's needed.
  22334. *
  22335. * @private
  22336. * @param {Array} array The array to inspect.
  22337. * @param {number} start The start position.
  22338. * @param {number} [end=array.length] The end position.
  22339. * @returns {Array} Returns the cast slice.
  22340. */
  22341. function castSlice(array, start, end) {
  22342. var length = array.length;
  22343. end = end === undefined ? length : end;
  22344. return (!start && end >= length) ? array : baseSlice(array, start, end);
  22345. }
  22346. /**
  22347. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  22348. *
  22349. * @private
  22350. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  22351. */
  22352. var clearTimeout = ctxClearTimeout || function(id) {
  22353. return root.clearTimeout(id);
  22354. };
  22355. /**
  22356. * Creates a clone of `buffer`.
  22357. *
  22358. * @private
  22359. * @param {Buffer} buffer The buffer to clone.
  22360. * @param {boolean} [isDeep] Specify a deep clone.
  22361. * @returns {Buffer} Returns the cloned buffer.
  22362. */
  22363. function cloneBuffer(buffer, isDeep) {
  22364. if (isDeep) {
  22365. return buffer.slice();
  22366. }
  22367. var length = buffer.length,
  22368. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  22369. buffer.copy(result);
  22370. return result;
  22371. }
  22372. /**
  22373. * Creates a clone of `arrayBuffer`.
  22374. *
  22375. * @private
  22376. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  22377. * @returns {ArrayBuffer} Returns the cloned array buffer.
  22378. */
  22379. function cloneArrayBuffer(arrayBuffer) {
  22380. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  22381. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  22382. return result;
  22383. }
  22384. /**
  22385. * Creates a clone of `dataView`.
  22386. *
  22387. * @private
  22388. * @param {Object} dataView The data view to clone.
  22389. * @param {boolean} [isDeep] Specify a deep clone.
  22390. * @returns {Object} Returns the cloned data view.
  22391. */
  22392. function cloneDataView(dataView, isDeep) {
  22393. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  22394. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  22395. }
  22396. /**
  22397. * Creates a clone of `regexp`.
  22398. *
  22399. * @private
  22400. * @param {Object} regexp The regexp to clone.
  22401. * @returns {Object} Returns the cloned regexp.
  22402. */
  22403. function cloneRegExp(regexp) {
  22404. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  22405. result.lastIndex = regexp.lastIndex;
  22406. return result;
  22407. }
  22408. /**
  22409. * Creates a clone of the `symbol` object.
  22410. *
  22411. * @private
  22412. * @param {Object} symbol The symbol object to clone.
  22413. * @returns {Object} Returns the cloned symbol object.
  22414. */
  22415. function cloneSymbol(symbol) {
  22416. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  22417. }
  22418. /**
  22419. * Creates a clone of `typedArray`.
  22420. *
  22421. * @private
  22422. * @param {Object} typedArray The typed array to clone.
  22423. * @param {boolean} [isDeep] Specify a deep clone.
  22424. * @returns {Object} Returns the cloned typed array.
  22425. */
  22426. function cloneTypedArray(typedArray, isDeep) {
  22427. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  22428. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  22429. }
  22430. /**
  22431. * Compares values to sort them in ascending order.
  22432. *
  22433. * @private
  22434. * @param {*} value The value to compare.
  22435. * @param {*} other The other value to compare.
  22436. * @returns {number} Returns the sort order indicator for `value`.
  22437. */
  22438. function compareAscending(value, other) {
  22439. if (value !== other) {
  22440. var valIsDefined = value !== undefined,
  22441. valIsNull = value === null,
  22442. valIsReflexive = value === value,
  22443. valIsSymbol = isSymbol(value);
  22444. var othIsDefined = other !== undefined,
  22445. othIsNull = other === null,
  22446. othIsReflexive = other === other,
  22447. othIsSymbol = isSymbol(other);
  22448. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  22449. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  22450. (valIsNull && othIsDefined && othIsReflexive) ||
  22451. (!valIsDefined && othIsReflexive) ||
  22452. !valIsReflexive) {
  22453. return 1;
  22454. }
  22455. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  22456. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  22457. (othIsNull && valIsDefined && valIsReflexive) ||
  22458. (!othIsDefined && valIsReflexive) ||
  22459. !othIsReflexive) {
  22460. return -1;
  22461. }
  22462. }
  22463. return 0;
  22464. }
  22465. /**
  22466. * Used by `_.orderBy` to compare multiple properties of a value to another
  22467. * and stable sort them.
  22468. *
  22469. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  22470. * specify an order of "desc" for descending or "asc" for ascending sort order
  22471. * of corresponding values.
  22472. *
  22473. * @private
  22474. * @param {Object} object The object to compare.
  22475. * @param {Object} other The other object to compare.
  22476. * @param {boolean[]|string[]} orders The order to sort by for each property.
  22477. * @returns {number} Returns the sort order indicator for `object`.
  22478. */
  22479. function compareMultiple(object, other, orders) {
  22480. var index = -1,
  22481. objCriteria = object.criteria,
  22482. othCriteria = other.criteria,
  22483. length = objCriteria.length,
  22484. ordersLength = orders.length;
  22485. while (++index < length) {
  22486. var result = compareAscending(objCriteria[index], othCriteria[index]);
  22487. if (result) {
  22488. if (index >= ordersLength) {
  22489. return result;
  22490. }
  22491. var order = orders[index];
  22492. return result * (order == 'desc' ? -1 : 1);
  22493. }
  22494. }
  22495. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  22496. // that causes it, under certain circumstances, to provide the same value for
  22497. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  22498. // for more details.
  22499. //
  22500. // This also ensures a stable sort in V8 and other engines.
  22501. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  22502. return object.index - other.index;
  22503. }
  22504. /**
  22505. * Creates an array that is the composition of partially applied arguments,
  22506. * placeholders, and provided arguments into a single array of arguments.
  22507. *
  22508. * @private
  22509. * @param {Array} args The provided arguments.
  22510. * @param {Array} partials The arguments to prepend to those provided.
  22511. * @param {Array} holders The `partials` placeholder indexes.
  22512. * @params {boolean} [isCurried] Specify composing for a curried function.
  22513. * @returns {Array} Returns the new array of composed arguments.
  22514. */
  22515. function composeArgs(args, partials, holders, isCurried) {
  22516. var argsIndex = -1,
  22517. argsLength = args.length,
  22518. holdersLength = holders.length,
  22519. leftIndex = -1,
  22520. leftLength = partials.length,
  22521. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22522. result = Array(leftLength + rangeLength),
  22523. isUncurried = !isCurried;
  22524. while (++leftIndex < leftLength) {
  22525. result[leftIndex] = partials[leftIndex];
  22526. }
  22527. while (++argsIndex < holdersLength) {
  22528. if (isUncurried || argsIndex < argsLength) {
  22529. result[holders[argsIndex]] = args[argsIndex];
  22530. }
  22531. }
  22532. while (rangeLength--) {
  22533. result[leftIndex++] = args[argsIndex++];
  22534. }
  22535. return result;
  22536. }
  22537. /**
  22538. * This function is like `composeArgs` except that the arguments composition
  22539. * is tailored for `_.partialRight`.
  22540. *
  22541. * @private
  22542. * @param {Array} args The provided arguments.
  22543. * @param {Array} partials The arguments to append to those provided.
  22544. * @param {Array} holders The `partials` placeholder indexes.
  22545. * @params {boolean} [isCurried] Specify composing for a curried function.
  22546. * @returns {Array} Returns the new array of composed arguments.
  22547. */
  22548. function composeArgsRight(args, partials, holders, isCurried) {
  22549. var argsIndex = -1,
  22550. argsLength = args.length,
  22551. holdersIndex = -1,
  22552. holdersLength = holders.length,
  22553. rightIndex = -1,
  22554. rightLength = partials.length,
  22555. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22556. result = Array(rangeLength + rightLength),
  22557. isUncurried = !isCurried;
  22558. while (++argsIndex < rangeLength) {
  22559. result[argsIndex] = args[argsIndex];
  22560. }
  22561. var offset = argsIndex;
  22562. while (++rightIndex < rightLength) {
  22563. result[offset + rightIndex] = partials[rightIndex];
  22564. }
  22565. while (++holdersIndex < holdersLength) {
  22566. if (isUncurried || argsIndex < argsLength) {
  22567. result[offset + holders[holdersIndex]] = args[argsIndex++];
  22568. }
  22569. }
  22570. return result;
  22571. }
  22572. /**
  22573. * Copies the values of `source` to `array`.
  22574. *
  22575. * @private
  22576. * @param {Array} source The array to copy values from.
  22577. * @param {Array} [array=[]] The array to copy values to.
  22578. * @returns {Array} Returns `array`.
  22579. */
  22580. function copyArray(source, array) {
  22581. var index = -1,
  22582. length = source.length;
  22583. array || (array = Array(length));
  22584. while (++index < length) {
  22585. array[index] = source[index];
  22586. }
  22587. return array;
  22588. }
  22589. /**
  22590. * Copies properties of `source` to `object`.
  22591. *
  22592. * @private
  22593. * @param {Object} source The object to copy properties from.
  22594. * @param {Array} props The property identifiers to copy.
  22595. * @param {Object} [object={}] The object to copy properties to.
  22596. * @param {Function} [customizer] The function to customize copied values.
  22597. * @returns {Object} Returns `object`.
  22598. */
  22599. function copyObject(source, props, object, customizer) {
  22600. var isNew = !object;
  22601. object || (object = {});
  22602. var index = -1,
  22603. length = props.length;
  22604. while (++index < length) {
  22605. var key = props[index];
  22606. var newValue = customizer
  22607. ? customizer(object[key], source[key], key, object, source)
  22608. : undefined;
  22609. if (newValue === undefined) {
  22610. newValue = source[key];
  22611. }
  22612. if (isNew) {
  22613. baseAssignValue(object, key, newValue);
  22614. } else {
  22615. assignValue(object, key, newValue);
  22616. }
  22617. }
  22618. return object;
  22619. }
  22620. /**
  22621. * Copies own symbols of `source` to `object`.
  22622. *
  22623. * @private
  22624. * @param {Object} source The object to copy symbols from.
  22625. * @param {Object} [object={}] The object to copy symbols to.
  22626. * @returns {Object} Returns `object`.
  22627. */
  22628. function copySymbols(source, object) {
  22629. return copyObject(source, getSymbols(source), object);
  22630. }
  22631. /**
  22632. * Copies own and inherited symbols of `source` to `object`.
  22633. *
  22634. * @private
  22635. * @param {Object} source The object to copy symbols from.
  22636. * @param {Object} [object={}] The object to copy symbols to.
  22637. * @returns {Object} Returns `object`.
  22638. */
  22639. function copySymbolsIn(source, object) {
  22640. return copyObject(source, getSymbolsIn(source), object);
  22641. }
  22642. /**
  22643. * Creates a function like `_.groupBy`.
  22644. *
  22645. * @private
  22646. * @param {Function} setter The function to set accumulator values.
  22647. * @param {Function} [initializer] The accumulator object initializer.
  22648. * @returns {Function} Returns the new aggregator function.
  22649. */
  22650. function createAggregator(setter, initializer) {
  22651. return function(collection, iteratee) {
  22652. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  22653. accumulator = initializer ? initializer() : {};
  22654. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  22655. };
  22656. }
  22657. /**
  22658. * Creates a function like `_.assign`.
  22659. *
  22660. * @private
  22661. * @param {Function} assigner The function to assign values.
  22662. * @returns {Function} Returns the new assigner function.
  22663. */
  22664. function createAssigner(assigner) {
  22665. return baseRest(function(object, sources) {
  22666. var index = -1,
  22667. length = sources.length,
  22668. customizer = length > 1 ? sources[length - 1] : undefined,
  22669. guard = length > 2 ? sources[2] : undefined;
  22670. customizer = (assigner.length > 3 && typeof customizer == 'function')
  22671. ? (length--, customizer)
  22672. : undefined;
  22673. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  22674. customizer = length < 3 ? undefined : customizer;
  22675. length = 1;
  22676. }
  22677. object = Object(object);
  22678. while (++index < length) {
  22679. var source = sources[index];
  22680. if (source) {
  22681. assigner(object, source, index, customizer);
  22682. }
  22683. }
  22684. return object;
  22685. });
  22686. }
  22687. /**
  22688. * Creates a `baseEach` or `baseEachRight` function.
  22689. *
  22690. * @private
  22691. * @param {Function} eachFunc The function to iterate over a collection.
  22692. * @param {boolean} [fromRight] Specify iterating from right to left.
  22693. * @returns {Function} Returns the new base function.
  22694. */
  22695. function createBaseEach(eachFunc, fromRight) {
  22696. return function(collection, iteratee) {
  22697. if (collection == null) {
  22698. return collection;
  22699. }
  22700. if (!isArrayLike(collection)) {
  22701. return eachFunc(collection, iteratee);
  22702. }
  22703. var length = collection.length,
  22704. index = fromRight ? length : -1,
  22705. iterable = Object(collection);
  22706. while ((fromRight ? index-- : ++index < length)) {
  22707. if (iteratee(iterable[index], index, iterable) === false) {
  22708. break;
  22709. }
  22710. }
  22711. return collection;
  22712. };
  22713. }
  22714. /**
  22715. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  22716. *
  22717. * @private
  22718. * @param {boolean} [fromRight] Specify iterating from right to left.
  22719. * @returns {Function} Returns the new base function.
  22720. */
  22721. function createBaseFor(fromRight) {
  22722. return function(object, iteratee, keysFunc) {
  22723. var index = -1,
  22724. iterable = Object(object),
  22725. props = keysFunc(object),
  22726. length = props.length;
  22727. while (length--) {
  22728. var key = props[fromRight ? length : ++index];
  22729. if (iteratee(iterable[key], key, iterable) === false) {
  22730. break;
  22731. }
  22732. }
  22733. return object;
  22734. };
  22735. }
  22736. /**
  22737. * Creates a function that wraps `func` to invoke it with the optional `this`
  22738. * binding of `thisArg`.
  22739. *
  22740. * @private
  22741. * @param {Function} func The function to wrap.
  22742. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22743. * @param {*} [thisArg] The `this` binding of `func`.
  22744. * @returns {Function} Returns the new wrapped function.
  22745. */
  22746. function createBind(func, bitmask, thisArg) {
  22747. var isBind = bitmask & WRAP_BIND_FLAG,
  22748. Ctor = createCtor(func);
  22749. function wrapper() {
  22750. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22751. return fn.apply(isBind ? thisArg : this, arguments);
  22752. }
  22753. return wrapper;
  22754. }
  22755. /**
  22756. * Creates a function like `_.lowerFirst`.
  22757. *
  22758. * @private
  22759. * @param {string} methodName The name of the `String` case method to use.
  22760. * @returns {Function} Returns the new case function.
  22761. */
  22762. function createCaseFirst(methodName) {
  22763. return function(string) {
  22764. string = toString(string);
  22765. var strSymbols = hasUnicode(string)
  22766. ? stringToArray(string)
  22767. : undefined;
  22768. var chr = strSymbols
  22769. ? strSymbols[0]
  22770. : string.charAt(0);
  22771. var trailing = strSymbols
  22772. ? castSlice(strSymbols, 1).join('')
  22773. : string.slice(1);
  22774. return chr[methodName]() + trailing;
  22775. };
  22776. }
  22777. /**
  22778. * Creates a function like `_.camelCase`.
  22779. *
  22780. * @private
  22781. * @param {Function} callback The function to combine each word.
  22782. * @returns {Function} Returns the new compounder function.
  22783. */
  22784. function createCompounder(callback) {
  22785. return function(string) {
  22786. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  22787. };
  22788. }
  22789. /**
  22790. * Creates a function that produces an instance of `Ctor` regardless of
  22791. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  22792. *
  22793. * @private
  22794. * @param {Function} Ctor The constructor to wrap.
  22795. * @returns {Function} Returns the new wrapped function.
  22796. */
  22797. function createCtor(Ctor) {
  22798. return function() {
  22799. // Use a `switch` statement to work with class constructors. See
  22800. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  22801. // for more details.
  22802. var args = arguments;
  22803. switch (args.length) {
  22804. case 0: return new Ctor;
  22805. case 1: return new Ctor(args[0]);
  22806. case 2: return new Ctor(args[0], args[1]);
  22807. case 3: return new Ctor(args[0], args[1], args[2]);
  22808. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  22809. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  22810. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  22811. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  22812. }
  22813. var thisBinding = baseCreate(Ctor.prototype),
  22814. result = Ctor.apply(thisBinding, args);
  22815. // Mimic the constructor's `return` behavior.
  22816. // See https://es5.github.io/#x13.2.2 for more details.
  22817. return isObject(result) ? result : thisBinding;
  22818. };
  22819. }
  22820. /**
  22821. * Creates a function that wraps `func` to enable currying.
  22822. *
  22823. * @private
  22824. * @param {Function} func The function to wrap.
  22825. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22826. * @param {number} arity The arity of `func`.
  22827. * @returns {Function} Returns the new wrapped function.
  22828. */
  22829. function createCurry(func, bitmask, arity) {
  22830. var Ctor = createCtor(func);
  22831. function wrapper() {
  22832. var length = arguments.length,
  22833. args = Array(length),
  22834. index = length,
  22835. placeholder = getHolder(wrapper);
  22836. while (index--) {
  22837. args[index] = arguments[index];
  22838. }
  22839. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  22840. ? []
  22841. : replaceHolders(args, placeholder);
  22842. length -= holders.length;
  22843. if (length < arity) {
  22844. return createRecurry(
  22845. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  22846. args, holders, undefined, undefined, arity - length);
  22847. }
  22848. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22849. return apply(fn, this, args);
  22850. }
  22851. return wrapper;
  22852. }
  22853. /**
  22854. * Creates a `_.find` or `_.findLast` function.
  22855. *
  22856. * @private
  22857. * @param {Function} findIndexFunc The function to find the collection index.
  22858. * @returns {Function} Returns the new find function.
  22859. */
  22860. function createFind(findIndexFunc) {
  22861. return function(collection, predicate, fromIndex) {
  22862. var iterable = Object(collection);
  22863. if (!isArrayLike(collection)) {
  22864. var iteratee = getIteratee(predicate, 3);
  22865. collection = keys(collection);
  22866. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  22867. }
  22868. var index = findIndexFunc(collection, predicate, fromIndex);
  22869. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  22870. };
  22871. }
  22872. /**
  22873. * Creates a `_.flow` or `_.flowRight` function.
  22874. *
  22875. * @private
  22876. * @param {boolean} [fromRight] Specify iterating from right to left.
  22877. * @returns {Function} Returns the new flow function.
  22878. */
  22879. function createFlow(fromRight) {
  22880. return flatRest(function(funcs) {
  22881. var length = funcs.length,
  22882. index = length,
  22883. prereq = LodashWrapper.prototype.thru;
  22884. if (fromRight) {
  22885. funcs.reverse();
  22886. }
  22887. while (index--) {
  22888. var func = funcs[index];
  22889. if (typeof func != 'function') {
  22890. throw new TypeError(FUNC_ERROR_TEXT);
  22891. }
  22892. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  22893. var wrapper = new LodashWrapper([], true);
  22894. }
  22895. }
  22896. index = wrapper ? index : length;
  22897. while (++index < length) {
  22898. func = funcs[index];
  22899. var funcName = getFuncName(func),
  22900. data = funcName == 'wrapper' ? getData(func) : undefined;
  22901. if (data && isLaziable(data[0]) &&
  22902. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  22903. !data[4].length && data[9] == 1
  22904. ) {
  22905. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  22906. } else {
  22907. wrapper = (func.length == 1 && isLaziable(func))
  22908. ? wrapper[funcName]()
  22909. : wrapper.thru(func);
  22910. }
  22911. }
  22912. return function() {
  22913. var args = arguments,
  22914. value = args[0];
  22915. if (wrapper && args.length == 1 && isArray(value)) {
  22916. return wrapper.plant(value).value();
  22917. }
  22918. var index = 0,
  22919. result = length ? funcs[index].apply(this, args) : value;
  22920. while (++index < length) {
  22921. result = funcs[index].call(this, result);
  22922. }
  22923. return result;
  22924. };
  22925. });
  22926. }
  22927. /**
  22928. * Creates a function that wraps `func` to invoke it with optional `this`
  22929. * binding of `thisArg`, partial application, and currying.
  22930. *
  22931. * @private
  22932. * @param {Function|string} func The function or method name to wrap.
  22933. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22934. * @param {*} [thisArg] The `this` binding of `func`.
  22935. * @param {Array} [partials] The arguments to prepend to those provided to
  22936. * the new function.
  22937. * @param {Array} [holders] The `partials` placeholder indexes.
  22938. * @param {Array} [partialsRight] The arguments to append to those provided
  22939. * to the new function.
  22940. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  22941. * @param {Array} [argPos] The argument positions of the new function.
  22942. * @param {number} [ary] The arity cap of `func`.
  22943. * @param {number} [arity] The arity of `func`.
  22944. * @returns {Function} Returns the new wrapped function.
  22945. */
  22946. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  22947. var isAry = bitmask & WRAP_ARY_FLAG,
  22948. isBind = bitmask & WRAP_BIND_FLAG,
  22949. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  22950. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  22951. isFlip = bitmask & WRAP_FLIP_FLAG,
  22952. Ctor = isBindKey ? undefined : createCtor(func);
  22953. function wrapper() {
  22954. var length = arguments.length,
  22955. args = Array(length),
  22956. index = length;
  22957. while (index--) {
  22958. args[index] = arguments[index];
  22959. }
  22960. if (isCurried) {
  22961. var placeholder = getHolder(wrapper),
  22962. holdersCount = countHolders(args, placeholder);
  22963. }
  22964. if (partials) {
  22965. args = composeArgs(args, partials, holders, isCurried);
  22966. }
  22967. if (partialsRight) {
  22968. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  22969. }
  22970. length -= holdersCount;
  22971. if (isCurried && length < arity) {
  22972. var newHolders = replaceHolders(args, placeholder);
  22973. return createRecurry(
  22974. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  22975. args, newHolders, argPos, ary, arity - length
  22976. );
  22977. }
  22978. var thisBinding = isBind ? thisArg : this,
  22979. fn = isBindKey ? thisBinding[func] : func;
  22980. length = args.length;
  22981. if (argPos) {
  22982. args = reorder(args, argPos);
  22983. } else if (isFlip && length > 1) {
  22984. args.reverse();
  22985. }
  22986. if (isAry && ary < length) {
  22987. args.length = ary;
  22988. }
  22989. if (this && this !== root && this instanceof wrapper) {
  22990. fn = Ctor || createCtor(fn);
  22991. }
  22992. return fn.apply(thisBinding, args);
  22993. }
  22994. return wrapper;
  22995. }
  22996. /**
  22997. * Creates a function like `_.invertBy`.
  22998. *
  22999. * @private
  23000. * @param {Function} setter The function to set accumulator values.
  23001. * @param {Function} toIteratee The function to resolve iteratees.
  23002. * @returns {Function} Returns the new inverter function.
  23003. */
  23004. function createInverter(setter, toIteratee) {
  23005. return function(object, iteratee) {
  23006. return baseInverter(object, setter, toIteratee(iteratee), {});
  23007. };
  23008. }
  23009. /**
  23010. * Creates a function that performs a mathematical operation on two values.
  23011. *
  23012. * @private
  23013. * @param {Function} operator The function to perform the operation.
  23014. * @param {number} [defaultValue] The value used for `undefined` arguments.
  23015. * @returns {Function} Returns the new mathematical operation function.
  23016. */
  23017. function createMathOperation(operator, defaultValue) {
  23018. return function(value, other) {
  23019. var result;
  23020. if (value === undefined && other === undefined) {
  23021. return defaultValue;
  23022. }
  23023. if (value !== undefined) {
  23024. result = value;
  23025. }
  23026. if (other !== undefined) {
  23027. if (result === undefined) {
  23028. return other;
  23029. }
  23030. if (typeof value == 'string' || typeof other == 'string') {
  23031. value = baseToString(value);
  23032. other = baseToString(other);
  23033. } else {
  23034. value = baseToNumber(value);
  23035. other = baseToNumber(other);
  23036. }
  23037. result = operator(value, other);
  23038. }
  23039. return result;
  23040. };
  23041. }
  23042. /**
  23043. * Creates a function like `_.over`.
  23044. *
  23045. * @private
  23046. * @param {Function} arrayFunc The function to iterate over iteratees.
  23047. * @returns {Function} Returns the new over function.
  23048. */
  23049. function createOver(arrayFunc) {
  23050. return flatRest(function(iteratees) {
  23051. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  23052. return baseRest(function(args) {
  23053. var thisArg = this;
  23054. return arrayFunc(iteratees, function(iteratee) {
  23055. return apply(iteratee, thisArg, args);
  23056. });
  23057. });
  23058. });
  23059. }
  23060. /**
  23061. * Creates the padding for `string` based on `length`. The `chars` string
  23062. * is truncated if the number of characters exceeds `length`.
  23063. *
  23064. * @private
  23065. * @param {number} length The padding length.
  23066. * @param {string} [chars=' '] The string used as padding.
  23067. * @returns {string} Returns the padding for `string`.
  23068. */
  23069. function createPadding(length, chars) {
  23070. chars = chars === undefined ? ' ' : baseToString(chars);
  23071. var charsLength = chars.length;
  23072. if (charsLength < 2) {
  23073. return charsLength ? baseRepeat(chars, length) : chars;
  23074. }
  23075. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  23076. return hasUnicode(chars)
  23077. ? castSlice(stringToArray(result), 0, length).join('')
  23078. : result.slice(0, length);
  23079. }
  23080. /**
  23081. * Creates a function that wraps `func` to invoke it with the `this` binding
  23082. * of `thisArg` and `partials` prepended to the arguments it receives.
  23083. *
  23084. * @private
  23085. * @param {Function} func The function to wrap.
  23086. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23087. * @param {*} thisArg The `this` binding of `func`.
  23088. * @param {Array} partials The arguments to prepend to those provided to
  23089. * the new function.
  23090. * @returns {Function} Returns the new wrapped function.
  23091. */
  23092. function createPartial(func, bitmask, thisArg, partials) {
  23093. var isBind = bitmask & WRAP_BIND_FLAG,
  23094. Ctor = createCtor(func);
  23095. function wrapper() {
  23096. var argsIndex = -1,
  23097. argsLength = arguments.length,
  23098. leftIndex = -1,
  23099. leftLength = partials.length,
  23100. args = Array(leftLength + argsLength),
  23101. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23102. while (++leftIndex < leftLength) {
  23103. args[leftIndex] = partials[leftIndex];
  23104. }
  23105. while (argsLength--) {
  23106. args[leftIndex++] = arguments[++argsIndex];
  23107. }
  23108. return apply(fn, isBind ? thisArg : this, args);
  23109. }
  23110. return wrapper;
  23111. }
  23112. /**
  23113. * Creates a `_.range` or `_.rangeRight` function.
  23114. *
  23115. * @private
  23116. * @param {boolean} [fromRight] Specify iterating from right to left.
  23117. * @returns {Function} Returns the new range function.
  23118. */
  23119. function createRange(fromRight) {
  23120. return function(start, end, step) {
  23121. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  23122. end = step = undefined;
  23123. }
  23124. // Ensure the sign of `-0` is preserved.
  23125. start = toFinite(start);
  23126. if (end === undefined) {
  23127. end = start;
  23128. start = 0;
  23129. } else {
  23130. end = toFinite(end);
  23131. }
  23132. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  23133. return baseRange(start, end, step, fromRight);
  23134. };
  23135. }
  23136. /**
  23137. * Creates a function that performs a relational operation on two values.
  23138. *
  23139. * @private
  23140. * @param {Function} operator The function to perform the operation.
  23141. * @returns {Function} Returns the new relational operation function.
  23142. */
  23143. function createRelationalOperation(operator) {
  23144. return function(value, other) {
  23145. if (!(typeof value == 'string' && typeof other == 'string')) {
  23146. value = toNumber(value);
  23147. other = toNumber(other);
  23148. }
  23149. return operator(value, other);
  23150. };
  23151. }
  23152. /**
  23153. * Creates a function that wraps `func` to continue currying.
  23154. *
  23155. * @private
  23156. * @param {Function} func The function to wrap.
  23157. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23158. * @param {Function} wrapFunc The function to create the `func` wrapper.
  23159. * @param {*} placeholder The placeholder value.
  23160. * @param {*} [thisArg] The `this` binding of `func`.
  23161. * @param {Array} [partials] The arguments to prepend to those provided to
  23162. * the new function.
  23163. * @param {Array} [holders] The `partials` placeholder indexes.
  23164. * @param {Array} [argPos] The argument positions of the new function.
  23165. * @param {number} [ary] The arity cap of `func`.
  23166. * @param {number} [arity] The arity of `func`.
  23167. * @returns {Function} Returns the new wrapped function.
  23168. */
  23169. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  23170. var isCurry = bitmask & WRAP_CURRY_FLAG,
  23171. newHolders = isCurry ? holders : undefined,
  23172. newHoldersRight = isCurry ? undefined : holders,
  23173. newPartials = isCurry ? partials : undefined,
  23174. newPartialsRight = isCurry ? undefined : partials;
  23175. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  23176. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  23177. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  23178. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  23179. }
  23180. var newData = [
  23181. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  23182. newHoldersRight, argPos, ary, arity
  23183. ];
  23184. var result = wrapFunc.apply(undefined, newData);
  23185. if (isLaziable(func)) {
  23186. setData(result, newData);
  23187. }
  23188. result.placeholder = placeholder;
  23189. return setWrapToString(result, func, bitmask);
  23190. }
  23191. /**
  23192. * Creates a function like `_.round`.
  23193. *
  23194. * @private
  23195. * @param {string} methodName The name of the `Math` method to use when rounding.
  23196. * @returns {Function} Returns the new round function.
  23197. */
  23198. function createRound(methodName) {
  23199. var func = Math[methodName];
  23200. return function(number, precision) {
  23201. number = toNumber(number);
  23202. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  23203. if (precision && nativeIsFinite(number)) {
  23204. // Shift with exponential notation to avoid floating-point issues.
  23205. // See [MDN](https://mdn.io/round#Examples) for more details.
  23206. var pair = (toString(number) + 'e').split('e'),
  23207. value = func(pair[0] + 'e' + (+pair[1] + precision));
  23208. pair = (toString(value) + 'e').split('e');
  23209. return +(pair[0] + 'e' + (+pair[1] - precision));
  23210. }
  23211. return func(number);
  23212. };
  23213. }
  23214. /**
  23215. * Creates a set object of `values`.
  23216. *
  23217. * @private
  23218. * @param {Array} values The values to add to the set.
  23219. * @returns {Object} Returns the new set.
  23220. */
  23221. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  23222. return new Set(values);
  23223. };
  23224. /**
  23225. * Creates a `_.toPairs` or `_.toPairsIn` function.
  23226. *
  23227. * @private
  23228. * @param {Function} keysFunc The function to get the keys of a given object.
  23229. * @returns {Function} Returns the new pairs function.
  23230. */
  23231. function createToPairs(keysFunc) {
  23232. return function(object) {
  23233. var tag = getTag(object);
  23234. if (tag == mapTag) {
  23235. return mapToArray(object);
  23236. }
  23237. if (tag == setTag) {
  23238. return setToPairs(object);
  23239. }
  23240. return baseToPairs(object, keysFunc(object));
  23241. };
  23242. }
  23243. /**
  23244. * Creates a function that either curries or invokes `func` with optional
  23245. * `this` binding and partially applied arguments.
  23246. *
  23247. * @private
  23248. * @param {Function|string} func The function or method name to wrap.
  23249. * @param {number} bitmask The bitmask flags.
  23250. * 1 - `_.bind`
  23251. * 2 - `_.bindKey`
  23252. * 4 - `_.curry` or `_.curryRight` of a bound function
  23253. * 8 - `_.curry`
  23254. * 16 - `_.curryRight`
  23255. * 32 - `_.partial`
  23256. * 64 - `_.partialRight`
  23257. * 128 - `_.rearg`
  23258. * 256 - `_.ary`
  23259. * 512 - `_.flip`
  23260. * @param {*} [thisArg] The `this` binding of `func`.
  23261. * @param {Array} [partials] The arguments to be partially applied.
  23262. * @param {Array} [holders] The `partials` placeholder indexes.
  23263. * @param {Array} [argPos] The argument positions of the new function.
  23264. * @param {number} [ary] The arity cap of `func`.
  23265. * @param {number} [arity] The arity of `func`.
  23266. * @returns {Function} Returns the new wrapped function.
  23267. */
  23268. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  23269. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  23270. if (!isBindKey && typeof func != 'function') {
  23271. throw new TypeError(FUNC_ERROR_TEXT);
  23272. }
  23273. var length = partials ? partials.length : 0;
  23274. if (!length) {
  23275. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  23276. partials = holders = undefined;
  23277. }
  23278. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  23279. arity = arity === undefined ? arity : toInteger(arity);
  23280. length -= holders ? holders.length : 0;
  23281. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  23282. var partialsRight = partials,
  23283. holdersRight = holders;
  23284. partials = holders = undefined;
  23285. }
  23286. var data = isBindKey ? undefined : getData(func);
  23287. var newData = [
  23288. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  23289. argPos, ary, arity
  23290. ];
  23291. if (data) {
  23292. mergeData(newData, data);
  23293. }
  23294. func = newData[0];
  23295. bitmask = newData[1];
  23296. thisArg = newData[2];
  23297. partials = newData[3];
  23298. holders = newData[4];
  23299. arity = newData[9] = newData[9] === undefined
  23300. ? (isBindKey ? 0 : func.length)
  23301. : nativeMax(newData[9] - length, 0);
  23302. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  23303. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  23304. }
  23305. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  23306. var result = createBind(func, bitmask, thisArg);
  23307. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  23308. result = createCurry(func, bitmask, arity);
  23309. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  23310. result = createPartial(func, bitmask, thisArg, partials);
  23311. } else {
  23312. result = createHybrid.apply(undefined, newData);
  23313. }
  23314. var setter = data ? baseSetData : setData;
  23315. return setWrapToString(setter(result, newData), func, bitmask);
  23316. }
  23317. /**
  23318. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  23319. * of source objects to the destination object for all destination properties
  23320. * that resolve to `undefined`.
  23321. *
  23322. * @private
  23323. * @param {*} objValue The destination value.
  23324. * @param {*} srcValue The source value.
  23325. * @param {string} key The key of the property to assign.
  23326. * @param {Object} object The parent object of `objValue`.
  23327. * @returns {*} Returns the value to assign.
  23328. */
  23329. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  23330. if (objValue === undefined ||
  23331. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  23332. return srcValue;
  23333. }
  23334. return objValue;
  23335. }
  23336. /**
  23337. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  23338. * objects into destination objects that are passed thru.
  23339. *
  23340. * @private
  23341. * @param {*} objValue The destination value.
  23342. * @param {*} srcValue The source value.
  23343. * @param {string} key The key of the property to merge.
  23344. * @param {Object} object The parent object of `objValue`.
  23345. * @param {Object} source The parent object of `srcValue`.
  23346. * @param {Object} [stack] Tracks traversed source values and their merged
  23347. * counterparts.
  23348. * @returns {*} Returns the value to assign.
  23349. */
  23350. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  23351. if (isObject(objValue) && isObject(srcValue)) {
  23352. // Recursively merge objects and arrays (susceptible to call stack limits).
  23353. stack.set(srcValue, objValue);
  23354. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  23355. stack['delete'](srcValue);
  23356. }
  23357. return objValue;
  23358. }
  23359. /**
  23360. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  23361. * objects.
  23362. *
  23363. * @private
  23364. * @param {*} value The value to inspect.
  23365. * @param {string} key The key of the property to inspect.
  23366. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  23367. */
  23368. function customOmitClone(value) {
  23369. return isPlainObject(value) ? undefined : value;
  23370. }
  23371. /**
  23372. * A specialized version of `baseIsEqualDeep` for arrays with support for
  23373. * partial deep comparisons.
  23374. *
  23375. * @private
  23376. * @param {Array} array The array to compare.
  23377. * @param {Array} other The other array to compare.
  23378. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23379. * @param {Function} customizer The function to customize comparisons.
  23380. * @param {Function} equalFunc The function to determine equivalents of values.
  23381. * @param {Object} stack Tracks traversed `array` and `other` objects.
  23382. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  23383. */
  23384. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  23385. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23386. arrLength = array.length,
  23387. othLength = other.length;
  23388. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  23389. return false;
  23390. }
  23391. // Assume cyclic values are equal.
  23392. var stacked = stack.get(array);
  23393. if (stacked && stack.get(other)) {
  23394. return stacked == other;
  23395. }
  23396. var index = -1,
  23397. result = true,
  23398. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  23399. stack.set(array, other);
  23400. stack.set(other, array);
  23401. // Ignore non-index properties.
  23402. while (++index < arrLength) {
  23403. var arrValue = array[index],
  23404. othValue = other[index];
  23405. if (customizer) {
  23406. var compared = isPartial
  23407. ? customizer(othValue, arrValue, index, other, array, stack)
  23408. : customizer(arrValue, othValue, index, array, other, stack);
  23409. }
  23410. if (compared !== undefined) {
  23411. if (compared) {
  23412. continue;
  23413. }
  23414. result = false;
  23415. break;
  23416. }
  23417. // Recursively compare arrays (susceptible to call stack limits).
  23418. if (seen) {
  23419. if (!arraySome(other, function(othValue, othIndex) {
  23420. if (!cacheHas(seen, othIndex) &&
  23421. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  23422. return seen.push(othIndex);
  23423. }
  23424. })) {
  23425. result = false;
  23426. break;
  23427. }
  23428. } else if (!(
  23429. arrValue === othValue ||
  23430. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  23431. )) {
  23432. result = false;
  23433. break;
  23434. }
  23435. }
  23436. stack['delete'](array);
  23437. stack['delete'](other);
  23438. return result;
  23439. }
  23440. /**
  23441. * A specialized version of `baseIsEqualDeep` for comparing objects of
  23442. * the same `toStringTag`.
  23443. *
  23444. * **Note:** This function only supports comparing values with tags of
  23445. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  23446. *
  23447. * @private
  23448. * @param {Object} object The object to compare.
  23449. * @param {Object} other The other object to compare.
  23450. * @param {string} tag The `toStringTag` of the objects to compare.
  23451. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23452. * @param {Function} customizer The function to customize comparisons.
  23453. * @param {Function} equalFunc The function to determine equivalents of values.
  23454. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23455. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23456. */
  23457. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  23458. switch (tag) {
  23459. case dataViewTag:
  23460. if ((object.byteLength != other.byteLength) ||
  23461. (object.byteOffset != other.byteOffset)) {
  23462. return false;
  23463. }
  23464. object = object.buffer;
  23465. other = other.buffer;
  23466. case arrayBufferTag:
  23467. if ((object.byteLength != other.byteLength) ||
  23468. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  23469. return false;
  23470. }
  23471. return true;
  23472. case boolTag:
  23473. case dateTag:
  23474. case numberTag:
  23475. // Coerce booleans to `1` or `0` and dates to milliseconds.
  23476. // Invalid dates are coerced to `NaN`.
  23477. return eq(+object, +other);
  23478. case errorTag:
  23479. return object.name == other.name && object.message == other.message;
  23480. case regexpTag:
  23481. case stringTag:
  23482. // Coerce regexes to strings and treat strings, primitives and objects,
  23483. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  23484. // for more details.
  23485. return object == (other + '');
  23486. case mapTag:
  23487. var convert = mapToArray;
  23488. case setTag:
  23489. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  23490. convert || (convert = setToArray);
  23491. if (object.size != other.size && !isPartial) {
  23492. return false;
  23493. }
  23494. // Assume cyclic values are equal.
  23495. var stacked = stack.get(object);
  23496. if (stacked) {
  23497. return stacked == other;
  23498. }
  23499. bitmask |= COMPARE_UNORDERED_FLAG;
  23500. // Recursively compare objects (susceptible to call stack limits).
  23501. stack.set(object, other);
  23502. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  23503. stack['delete'](object);
  23504. return result;
  23505. case symbolTag:
  23506. if (symbolValueOf) {
  23507. return symbolValueOf.call(object) == symbolValueOf.call(other);
  23508. }
  23509. }
  23510. return false;
  23511. }
  23512. /**
  23513. * A specialized version of `baseIsEqualDeep` for objects with support for
  23514. * partial deep comparisons.
  23515. *
  23516. * @private
  23517. * @param {Object} object The object to compare.
  23518. * @param {Object} other The other object to compare.
  23519. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23520. * @param {Function} customizer The function to customize comparisons.
  23521. * @param {Function} equalFunc The function to determine equivalents of values.
  23522. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23523. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23524. */
  23525. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  23526. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23527. objProps = getAllKeys(object),
  23528. objLength = objProps.length,
  23529. othProps = getAllKeys(other),
  23530. othLength = othProps.length;
  23531. if (objLength != othLength && !isPartial) {
  23532. return false;
  23533. }
  23534. var index = objLength;
  23535. while (index--) {
  23536. var key = objProps[index];
  23537. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  23538. return false;
  23539. }
  23540. }
  23541. // Assume cyclic values are equal.
  23542. var stacked = stack.get(object);
  23543. if (stacked && stack.get(other)) {
  23544. return stacked == other;
  23545. }
  23546. var result = true;
  23547. stack.set(object, other);
  23548. stack.set(other, object);
  23549. var skipCtor = isPartial;
  23550. while (++index < objLength) {
  23551. key = objProps[index];
  23552. var objValue = object[key],
  23553. othValue = other[key];
  23554. if (customizer) {
  23555. var compared = isPartial
  23556. ? customizer(othValue, objValue, key, other, object, stack)
  23557. : customizer(objValue, othValue, key, object, other, stack);
  23558. }
  23559. // Recursively compare objects (susceptible to call stack limits).
  23560. if (!(compared === undefined
  23561. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  23562. : compared
  23563. )) {
  23564. result = false;
  23565. break;
  23566. }
  23567. skipCtor || (skipCtor = key == 'constructor');
  23568. }
  23569. if (result && !skipCtor) {
  23570. var objCtor = object.constructor,
  23571. othCtor = other.constructor;
  23572. // Non `Object` object instances with different constructors are not equal.
  23573. if (objCtor != othCtor &&
  23574. ('constructor' in object && 'constructor' in other) &&
  23575. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  23576. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  23577. result = false;
  23578. }
  23579. }
  23580. stack['delete'](object);
  23581. stack['delete'](other);
  23582. return result;
  23583. }
  23584. /**
  23585. * A specialized version of `baseRest` which flattens the rest array.
  23586. *
  23587. * @private
  23588. * @param {Function} func The function to apply a rest parameter to.
  23589. * @returns {Function} Returns the new function.
  23590. */
  23591. function flatRest(func) {
  23592. return setToString(overRest(func, undefined, flatten), func + '');
  23593. }
  23594. /**
  23595. * Creates an array of own enumerable property names and symbols of `object`.
  23596. *
  23597. * @private
  23598. * @param {Object} object The object to query.
  23599. * @returns {Array} Returns the array of property names and symbols.
  23600. */
  23601. function getAllKeys(object) {
  23602. return baseGetAllKeys(object, keys, getSymbols);
  23603. }
  23604. /**
  23605. * Creates an array of own and inherited enumerable property names and
  23606. * symbols of `object`.
  23607. *
  23608. * @private
  23609. * @param {Object} object The object to query.
  23610. * @returns {Array} Returns the array of property names and symbols.
  23611. */
  23612. function getAllKeysIn(object) {
  23613. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  23614. }
  23615. /**
  23616. * Gets metadata for `func`.
  23617. *
  23618. * @private
  23619. * @param {Function} func The function to query.
  23620. * @returns {*} Returns the metadata for `func`.
  23621. */
  23622. var getData = !metaMap ? noop : function(func) {
  23623. return metaMap.get(func);
  23624. };
  23625. /**
  23626. * Gets the name of `func`.
  23627. *
  23628. * @private
  23629. * @param {Function} func The function to query.
  23630. * @returns {string} Returns the function name.
  23631. */
  23632. function getFuncName(func) {
  23633. var result = (func.name + ''),
  23634. array = realNames[result],
  23635. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  23636. while (length--) {
  23637. var data = array[length],
  23638. otherFunc = data.func;
  23639. if (otherFunc == null || otherFunc == func) {
  23640. return data.name;
  23641. }
  23642. }
  23643. return result;
  23644. }
  23645. /**
  23646. * Gets the argument placeholder value for `func`.
  23647. *
  23648. * @private
  23649. * @param {Function} func The function to inspect.
  23650. * @returns {*} Returns the placeholder value.
  23651. */
  23652. function getHolder(func) {
  23653. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  23654. return object.placeholder;
  23655. }
  23656. /**
  23657. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  23658. * this function returns the custom method, otherwise it returns `baseIteratee`.
  23659. * If arguments are provided, the chosen function is invoked with them and
  23660. * its result is returned.
  23661. *
  23662. * @private
  23663. * @param {*} [value] The value to convert to an iteratee.
  23664. * @param {number} [arity] The arity of the created iteratee.
  23665. * @returns {Function} Returns the chosen function or its result.
  23666. */
  23667. function getIteratee() {
  23668. var result = lodash.iteratee || iteratee;
  23669. result = result === iteratee ? baseIteratee : result;
  23670. return arguments.length ? result(arguments[0], arguments[1]) : result;
  23671. }
  23672. /**
  23673. * Gets the data for `map`.
  23674. *
  23675. * @private
  23676. * @param {Object} map The map to query.
  23677. * @param {string} key The reference key.
  23678. * @returns {*} Returns the map data.
  23679. */
  23680. function getMapData(map, key) {
  23681. var data = map.__data__;
  23682. return isKeyable(key)
  23683. ? data[typeof key == 'string' ? 'string' : 'hash']
  23684. : data.map;
  23685. }
  23686. /**
  23687. * Gets the property names, values, and compare flags of `object`.
  23688. *
  23689. * @private
  23690. * @param {Object} object The object to query.
  23691. * @returns {Array} Returns the match data of `object`.
  23692. */
  23693. function getMatchData(object) {
  23694. var result = keys(object),
  23695. length = result.length;
  23696. while (length--) {
  23697. var key = result[length],
  23698. value = object[key];
  23699. result[length] = [key, value, isStrictComparable(value)];
  23700. }
  23701. return result;
  23702. }
  23703. /**
  23704. * Gets the native function at `key` of `object`.
  23705. *
  23706. * @private
  23707. * @param {Object} object The object to query.
  23708. * @param {string} key The key of the method to get.
  23709. * @returns {*} Returns the function if it's native, else `undefined`.
  23710. */
  23711. function getNative(object, key) {
  23712. var value = getValue(object, key);
  23713. return baseIsNative(value) ? value : undefined;
  23714. }
  23715. /**
  23716. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  23717. *
  23718. * @private
  23719. * @param {*} value The value to query.
  23720. * @returns {string} Returns the raw `toStringTag`.
  23721. */
  23722. function getRawTag(value) {
  23723. var isOwn = hasOwnProperty.call(value, symToStringTag),
  23724. tag = value[symToStringTag];
  23725. try {
  23726. value[symToStringTag] = undefined;
  23727. var unmasked = true;
  23728. } catch (e) {}
  23729. var result = nativeObjectToString.call(value);
  23730. if (unmasked) {
  23731. if (isOwn) {
  23732. value[symToStringTag] = tag;
  23733. } else {
  23734. delete value[symToStringTag];
  23735. }
  23736. }
  23737. return result;
  23738. }
  23739. /**
  23740. * Creates an array of the own enumerable symbols of `object`.
  23741. *
  23742. * @private
  23743. * @param {Object} object The object to query.
  23744. * @returns {Array} Returns the array of symbols.
  23745. */
  23746. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  23747. if (object == null) {
  23748. return [];
  23749. }
  23750. object = Object(object);
  23751. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  23752. return propertyIsEnumerable.call(object, symbol);
  23753. });
  23754. };
  23755. /**
  23756. * Creates an array of the own and inherited enumerable symbols of `object`.
  23757. *
  23758. * @private
  23759. * @param {Object} object The object to query.
  23760. * @returns {Array} Returns the array of symbols.
  23761. */
  23762. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  23763. var result = [];
  23764. while (object) {
  23765. arrayPush(result, getSymbols(object));
  23766. object = getPrototype(object);
  23767. }
  23768. return result;
  23769. };
  23770. /**
  23771. * Gets the `toStringTag` of `value`.
  23772. *
  23773. * @private
  23774. * @param {*} value The value to query.
  23775. * @returns {string} Returns the `toStringTag`.
  23776. */
  23777. var getTag = baseGetTag;
  23778. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  23779. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  23780. (Map && getTag(new Map) != mapTag) ||
  23781. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  23782. (Set && getTag(new Set) != setTag) ||
  23783. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  23784. getTag = function(value) {
  23785. var result = baseGetTag(value),
  23786. Ctor = result == objectTag ? value.constructor : undefined,
  23787. ctorString = Ctor ? toSource(Ctor) : '';
  23788. if (ctorString) {
  23789. switch (ctorString) {
  23790. case dataViewCtorString: return dataViewTag;
  23791. case mapCtorString: return mapTag;
  23792. case promiseCtorString: return promiseTag;
  23793. case setCtorString: return setTag;
  23794. case weakMapCtorString: return weakMapTag;
  23795. }
  23796. }
  23797. return result;
  23798. };
  23799. }
  23800. /**
  23801. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  23802. *
  23803. * @private
  23804. * @param {number} start The start of the view.
  23805. * @param {number} end The end of the view.
  23806. * @param {Array} transforms The transformations to apply to the view.
  23807. * @returns {Object} Returns an object containing the `start` and `end`
  23808. * positions of the view.
  23809. */
  23810. function getView(start, end, transforms) {
  23811. var index = -1,
  23812. length = transforms.length;
  23813. while (++index < length) {
  23814. var data = transforms[index],
  23815. size = data.size;
  23816. switch (data.type) {
  23817. case 'drop': start += size; break;
  23818. case 'dropRight': end -= size; break;
  23819. case 'take': end = nativeMin(end, start + size); break;
  23820. case 'takeRight': start = nativeMax(start, end - size); break;
  23821. }
  23822. }
  23823. return { 'start': start, 'end': end };
  23824. }
  23825. /**
  23826. * Extracts wrapper details from the `source` body comment.
  23827. *
  23828. * @private
  23829. * @param {string} source The source to inspect.
  23830. * @returns {Array} Returns the wrapper details.
  23831. */
  23832. function getWrapDetails(source) {
  23833. var match = source.match(reWrapDetails);
  23834. return match ? match[1].split(reSplitDetails) : [];
  23835. }
  23836. /**
  23837. * Checks if `path` exists on `object`.
  23838. *
  23839. * @private
  23840. * @param {Object} object The object to query.
  23841. * @param {Array|string} path The path to check.
  23842. * @param {Function} hasFunc The function to check properties.
  23843. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  23844. */
  23845. function hasPath(object, path, hasFunc) {
  23846. path = castPath(path, object);
  23847. var index = -1,
  23848. length = path.length,
  23849. result = false;
  23850. while (++index < length) {
  23851. var key = toKey(path[index]);
  23852. if (!(result = object != null && hasFunc(object, key))) {
  23853. break;
  23854. }
  23855. object = object[key];
  23856. }
  23857. if (result || ++index != length) {
  23858. return result;
  23859. }
  23860. length = object == null ? 0 : object.length;
  23861. return !!length && isLength(length) && isIndex(key, length) &&
  23862. (isArray(object) || isArguments(object));
  23863. }
  23864. /**
  23865. * Initializes an array clone.
  23866. *
  23867. * @private
  23868. * @param {Array} array The array to clone.
  23869. * @returns {Array} Returns the initialized clone.
  23870. */
  23871. function initCloneArray(array) {
  23872. var length = array.length,
  23873. result = new array.constructor(length);
  23874. // Add properties assigned by `RegExp#exec`.
  23875. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  23876. result.index = array.index;
  23877. result.input = array.input;
  23878. }
  23879. return result;
  23880. }
  23881. /**
  23882. * Initializes an object clone.
  23883. *
  23884. * @private
  23885. * @param {Object} object The object to clone.
  23886. * @returns {Object} Returns the initialized clone.
  23887. */
  23888. function initCloneObject(object) {
  23889. return (typeof object.constructor == 'function' && !isPrototype(object))
  23890. ? baseCreate(getPrototype(object))
  23891. : {};
  23892. }
  23893. /**
  23894. * Initializes an object clone based on its `toStringTag`.
  23895. *
  23896. * **Note:** This function only supports cloning values with tags of
  23897. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  23898. *
  23899. * @private
  23900. * @param {Object} object The object to clone.
  23901. * @param {string} tag The `toStringTag` of the object to clone.
  23902. * @param {boolean} [isDeep] Specify a deep clone.
  23903. * @returns {Object} Returns the initialized clone.
  23904. */
  23905. function initCloneByTag(object, tag, isDeep) {
  23906. var Ctor = object.constructor;
  23907. switch (tag) {
  23908. case arrayBufferTag:
  23909. return cloneArrayBuffer(object);
  23910. case boolTag:
  23911. case dateTag:
  23912. return new Ctor(+object);
  23913. case dataViewTag:
  23914. return cloneDataView(object, isDeep);
  23915. case float32Tag: case float64Tag:
  23916. case int8Tag: case int16Tag: case int32Tag:
  23917. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  23918. return cloneTypedArray(object, isDeep);
  23919. case mapTag:
  23920. return new Ctor;
  23921. case numberTag:
  23922. case stringTag:
  23923. return new Ctor(object);
  23924. case regexpTag:
  23925. return cloneRegExp(object);
  23926. case setTag:
  23927. return new Ctor;
  23928. case symbolTag:
  23929. return cloneSymbol(object);
  23930. }
  23931. }
  23932. /**
  23933. * Inserts wrapper `details` in a comment at the top of the `source` body.
  23934. *
  23935. * @private
  23936. * @param {string} source The source to modify.
  23937. * @returns {Array} details The details to insert.
  23938. * @returns {string} Returns the modified source.
  23939. */
  23940. function insertWrapDetails(source, details) {
  23941. var length = details.length;
  23942. if (!length) {
  23943. return source;
  23944. }
  23945. var lastIndex = length - 1;
  23946. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  23947. details = details.join(length > 2 ? ', ' : ' ');
  23948. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  23949. }
  23950. /**
  23951. * Checks if `value` is a flattenable `arguments` object or array.
  23952. *
  23953. * @private
  23954. * @param {*} value The value to check.
  23955. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  23956. */
  23957. function isFlattenable(value) {
  23958. return isArray(value) || isArguments(value) ||
  23959. !!(spreadableSymbol && value && value[spreadableSymbol]);
  23960. }
  23961. /**
  23962. * Checks if `value` is a valid array-like index.
  23963. *
  23964. * @private
  23965. * @param {*} value The value to check.
  23966. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  23967. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  23968. */
  23969. function isIndex(value, length) {
  23970. var type = typeof value;
  23971. length = length == null ? MAX_SAFE_INTEGER : length;
  23972. return !!length &&
  23973. (type == 'number' ||
  23974. (type != 'symbol' && reIsUint.test(value))) &&
  23975. (value > -1 && value % 1 == 0 && value < length);
  23976. }
  23977. /**
  23978. * Checks if the given arguments are from an iteratee call.
  23979. *
  23980. * @private
  23981. * @param {*} value The potential iteratee value argument.
  23982. * @param {*} index The potential iteratee index or key argument.
  23983. * @param {*} object The potential iteratee object argument.
  23984. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  23985. * else `false`.
  23986. */
  23987. function isIterateeCall(value, index, object) {
  23988. if (!isObject(object)) {
  23989. return false;
  23990. }
  23991. var type = typeof index;
  23992. if (type == 'number'
  23993. ? (isArrayLike(object) && isIndex(index, object.length))
  23994. : (type == 'string' && index in object)
  23995. ) {
  23996. return eq(object[index], value);
  23997. }
  23998. return false;
  23999. }
  24000. /**
  24001. * Checks if `value` is a property name and not a property path.
  24002. *
  24003. * @private
  24004. * @param {*} value The value to check.
  24005. * @param {Object} [object] The object to query keys on.
  24006. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  24007. */
  24008. function isKey(value, object) {
  24009. if (isArray(value)) {
  24010. return false;
  24011. }
  24012. var type = typeof value;
  24013. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  24014. value == null || isSymbol(value)) {
  24015. return true;
  24016. }
  24017. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  24018. (object != null && value in Object(object));
  24019. }
  24020. /**
  24021. * Checks if `value` is suitable for use as unique object key.
  24022. *
  24023. * @private
  24024. * @param {*} value The value to check.
  24025. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  24026. */
  24027. function isKeyable(value) {
  24028. var type = typeof value;
  24029. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  24030. ? (value !== '__proto__')
  24031. : (value === null);
  24032. }
  24033. /**
  24034. * Checks if `func` has a lazy counterpart.
  24035. *
  24036. * @private
  24037. * @param {Function} func The function to check.
  24038. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  24039. * else `false`.
  24040. */
  24041. function isLaziable(func) {
  24042. var funcName = getFuncName(func),
  24043. other = lodash[funcName];
  24044. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  24045. return false;
  24046. }
  24047. if (func === other) {
  24048. return true;
  24049. }
  24050. var data = getData(other);
  24051. return !!data && func === data[0];
  24052. }
  24053. /**
  24054. * Checks if `func` has its source masked.
  24055. *
  24056. * @private
  24057. * @param {Function} func The function to check.
  24058. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  24059. */
  24060. function isMasked(func) {
  24061. return !!maskSrcKey && (maskSrcKey in func);
  24062. }
  24063. /**
  24064. * Checks if `func` is capable of being masked.
  24065. *
  24066. * @private
  24067. * @param {*} value The value to check.
  24068. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  24069. */
  24070. var isMaskable = coreJsData ? isFunction : stubFalse;
  24071. /**
  24072. * Checks if `value` is likely a prototype object.
  24073. *
  24074. * @private
  24075. * @param {*} value The value to check.
  24076. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  24077. */
  24078. function isPrototype(value) {
  24079. var Ctor = value && value.constructor,
  24080. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  24081. return value === proto;
  24082. }
  24083. /**
  24084. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  24085. *
  24086. * @private
  24087. * @param {*} value The value to check.
  24088. * @returns {boolean} Returns `true` if `value` if suitable for strict
  24089. * equality comparisons, else `false`.
  24090. */
  24091. function isStrictComparable(value) {
  24092. return value === value && !isObject(value);
  24093. }
  24094. /**
  24095. * A specialized version of `matchesProperty` for source values suitable
  24096. * for strict equality comparisons, i.e. `===`.
  24097. *
  24098. * @private
  24099. * @param {string} key The key of the property to get.
  24100. * @param {*} srcValue The value to match.
  24101. * @returns {Function} Returns the new spec function.
  24102. */
  24103. function matchesStrictComparable(key, srcValue) {
  24104. return function(object) {
  24105. if (object == null) {
  24106. return false;
  24107. }
  24108. return object[key] === srcValue &&
  24109. (srcValue !== undefined || (key in Object(object)));
  24110. };
  24111. }
  24112. /**
  24113. * A specialized version of `_.memoize` which clears the memoized function's
  24114. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  24115. *
  24116. * @private
  24117. * @param {Function} func The function to have its output memoized.
  24118. * @returns {Function} Returns the new memoized function.
  24119. */
  24120. function memoizeCapped(func) {
  24121. var result = memoize(func, function(key) {
  24122. if (cache.size === MAX_MEMOIZE_SIZE) {
  24123. cache.clear();
  24124. }
  24125. return key;
  24126. });
  24127. var cache = result.cache;
  24128. return result;
  24129. }
  24130. /**
  24131. * Merges the function metadata of `source` into `data`.
  24132. *
  24133. * Merging metadata reduces the number of wrappers used to invoke a function.
  24134. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  24135. * may be applied regardless of execution order. Methods like `_.ary` and
  24136. * `_.rearg` modify function arguments, making the order in which they are
  24137. * executed important, preventing the merging of metadata. However, we make
  24138. * an exception for a safe combined case where curried functions have `_.ary`
  24139. * and or `_.rearg` applied.
  24140. *
  24141. * @private
  24142. * @param {Array} data The destination metadata.
  24143. * @param {Array} source The source metadata.
  24144. * @returns {Array} Returns `data`.
  24145. */
  24146. function mergeData(data, source) {
  24147. var bitmask = data[1],
  24148. srcBitmask = source[1],
  24149. newBitmask = bitmask | srcBitmask,
  24150. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  24151. var isCombo =
  24152. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  24153. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  24154. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  24155. // Exit early if metadata can't be merged.
  24156. if (!(isCommon || isCombo)) {
  24157. return data;
  24158. }
  24159. // Use source `thisArg` if available.
  24160. if (srcBitmask & WRAP_BIND_FLAG) {
  24161. data[2] = source[2];
  24162. // Set when currying a bound function.
  24163. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  24164. }
  24165. // Compose partial arguments.
  24166. var value = source[3];
  24167. if (value) {
  24168. var partials = data[3];
  24169. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  24170. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  24171. }
  24172. // Compose partial right arguments.
  24173. value = source[5];
  24174. if (value) {
  24175. partials = data[5];
  24176. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  24177. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  24178. }
  24179. // Use source `argPos` if available.
  24180. value = source[7];
  24181. if (value) {
  24182. data[7] = value;
  24183. }
  24184. // Use source `ary` if it's smaller.
  24185. if (srcBitmask & WRAP_ARY_FLAG) {
  24186. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  24187. }
  24188. // Use source `arity` if one is not provided.
  24189. if (data[9] == null) {
  24190. data[9] = source[9];
  24191. }
  24192. // Use source `func` and merge bitmasks.
  24193. data[0] = source[0];
  24194. data[1] = newBitmask;
  24195. return data;
  24196. }
  24197. /**
  24198. * This function is like
  24199. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  24200. * except that it includes inherited enumerable properties.
  24201. *
  24202. * @private
  24203. * @param {Object} object The object to query.
  24204. * @returns {Array} Returns the array of property names.
  24205. */
  24206. function nativeKeysIn(object) {
  24207. var result = [];
  24208. if (object != null) {
  24209. for (var key in Object(object)) {
  24210. result.push(key);
  24211. }
  24212. }
  24213. return result;
  24214. }
  24215. /**
  24216. * Converts `value` to a string using `Object.prototype.toString`.
  24217. *
  24218. * @private
  24219. * @param {*} value The value to convert.
  24220. * @returns {string} Returns the converted string.
  24221. */
  24222. function objectToString(value) {
  24223. return nativeObjectToString.call(value);
  24224. }
  24225. /**
  24226. * A specialized version of `baseRest` which transforms the rest array.
  24227. *
  24228. * @private
  24229. * @param {Function} func The function to apply a rest parameter to.
  24230. * @param {number} [start=func.length-1] The start position of the rest parameter.
  24231. * @param {Function} transform The rest array transform.
  24232. * @returns {Function} Returns the new function.
  24233. */
  24234. function overRest(func, start, transform) {
  24235. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  24236. return function() {
  24237. var args = arguments,
  24238. index = -1,
  24239. length = nativeMax(args.length - start, 0),
  24240. array = Array(length);
  24241. while (++index < length) {
  24242. array[index] = args[start + index];
  24243. }
  24244. index = -1;
  24245. var otherArgs = Array(start + 1);
  24246. while (++index < start) {
  24247. otherArgs[index] = args[index];
  24248. }
  24249. otherArgs[start] = transform(array);
  24250. return apply(func, this, otherArgs);
  24251. };
  24252. }
  24253. /**
  24254. * Gets the parent value at `path` of `object`.
  24255. *
  24256. * @private
  24257. * @param {Object} object The object to query.
  24258. * @param {Array} path The path to get the parent value of.
  24259. * @returns {*} Returns the parent value.
  24260. */
  24261. function parent(object, path) {
  24262. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  24263. }
  24264. /**
  24265. * Reorder `array` according to the specified indexes where the element at
  24266. * the first index is assigned as the first element, the element at
  24267. * the second index is assigned as the second element, and so on.
  24268. *
  24269. * @private
  24270. * @param {Array} array The array to reorder.
  24271. * @param {Array} indexes The arranged array indexes.
  24272. * @returns {Array} Returns `array`.
  24273. */
  24274. function reorder(array, indexes) {
  24275. var arrLength = array.length,
  24276. length = nativeMin(indexes.length, arrLength),
  24277. oldArray = copyArray(array);
  24278. while (length--) {
  24279. var index = indexes[length];
  24280. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  24281. }
  24282. return array;
  24283. }
  24284. /**
  24285. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  24286. *
  24287. * @private
  24288. * @param {Object} object The object to query.
  24289. * @param {string} key The key of the property to get.
  24290. * @returns {*} Returns the property value.
  24291. */
  24292. function safeGet(object, key) {
  24293. if (key === 'constructor' && typeof object[key] === 'function') {
  24294. return;
  24295. }
  24296. if (key == '__proto__') {
  24297. return;
  24298. }
  24299. return object[key];
  24300. }
  24301. /**
  24302. * Sets metadata for `func`.
  24303. *
  24304. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  24305. * period of time, it will trip its breaker and transition to an identity
  24306. * function to avoid garbage collection pauses in V8. See
  24307. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  24308. * for more details.
  24309. *
  24310. * @private
  24311. * @param {Function} func The function to associate metadata with.
  24312. * @param {*} data The metadata.
  24313. * @returns {Function} Returns `func`.
  24314. */
  24315. var setData = shortOut(baseSetData);
  24316. /**
  24317. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  24318. *
  24319. * @private
  24320. * @param {Function} func The function to delay.
  24321. * @param {number} wait The number of milliseconds to delay invocation.
  24322. * @returns {number|Object} Returns the timer id or timeout object.
  24323. */
  24324. var setTimeout = ctxSetTimeout || function(func, wait) {
  24325. return root.setTimeout(func, wait);
  24326. };
  24327. /**
  24328. * Sets the `toString` method of `func` to return `string`.
  24329. *
  24330. * @private
  24331. * @param {Function} func The function to modify.
  24332. * @param {Function} string The `toString` result.
  24333. * @returns {Function} Returns `func`.
  24334. */
  24335. var setToString = shortOut(baseSetToString);
  24336. /**
  24337. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  24338. * with wrapper details in a comment at the top of the source body.
  24339. *
  24340. * @private
  24341. * @param {Function} wrapper The function to modify.
  24342. * @param {Function} reference The reference function.
  24343. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24344. * @returns {Function} Returns `wrapper`.
  24345. */
  24346. function setWrapToString(wrapper, reference, bitmask) {
  24347. var source = (reference + '');
  24348. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  24349. }
  24350. /**
  24351. * Creates a function that'll short out and invoke `identity` instead
  24352. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  24353. * milliseconds.
  24354. *
  24355. * @private
  24356. * @param {Function} func The function to restrict.
  24357. * @returns {Function} Returns the new shortable function.
  24358. */
  24359. function shortOut(func) {
  24360. var count = 0,
  24361. lastCalled = 0;
  24362. return function() {
  24363. var stamp = nativeNow(),
  24364. remaining = HOT_SPAN - (stamp - lastCalled);
  24365. lastCalled = stamp;
  24366. if (remaining > 0) {
  24367. if (++count >= HOT_COUNT) {
  24368. return arguments[0];
  24369. }
  24370. } else {
  24371. count = 0;
  24372. }
  24373. return func.apply(undefined, arguments);
  24374. };
  24375. }
  24376. /**
  24377. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  24378. *
  24379. * @private
  24380. * @param {Array} array The array to shuffle.
  24381. * @param {number} [size=array.length] The size of `array`.
  24382. * @returns {Array} Returns `array`.
  24383. */
  24384. function shuffleSelf(array, size) {
  24385. var index = -1,
  24386. length = array.length,
  24387. lastIndex = length - 1;
  24388. size = size === undefined ? length : size;
  24389. while (++index < size) {
  24390. var rand = baseRandom(index, lastIndex),
  24391. value = array[rand];
  24392. array[rand] = array[index];
  24393. array[index] = value;
  24394. }
  24395. array.length = size;
  24396. return array;
  24397. }
  24398. /**
  24399. * Converts `string` to a property path array.
  24400. *
  24401. * @private
  24402. * @param {string} string The string to convert.
  24403. * @returns {Array} Returns the property path array.
  24404. */
  24405. var stringToPath = memoizeCapped(function(string) {
  24406. var result = [];
  24407. if (string.charCodeAt(0) === 46 /* . */) {
  24408. result.push('');
  24409. }
  24410. string.replace(rePropName, function(match, number, quote, subString) {
  24411. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  24412. });
  24413. return result;
  24414. });
  24415. /**
  24416. * Converts `value` to a string key if it's not a string or symbol.
  24417. *
  24418. * @private
  24419. * @param {*} value The value to inspect.
  24420. * @returns {string|symbol} Returns the key.
  24421. */
  24422. function toKey(value) {
  24423. if (typeof value == 'string' || isSymbol(value)) {
  24424. return value;
  24425. }
  24426. var result = (value + '');
  24427. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  24428. }
  24429. /**
  24430. * Converts `func` to its source code.
  24431. *
  24432. * @private
  24433. * @param {Function} func The function to convert.
  24434. * @returns {string} Returns the source code.
  24435. */
  24436. function toSource(func) {
  24437. if (func != null) {
  24438. try {
  24439. return funcToString.call(func);
  24440. } catch (e) {}
  24441. try {
  24442. return (func + '');
  24443. } catch (e) {}
  24444. }
  24445. return '';
  24446. }
  24447. /**
  24448. * Updates wrapper `details` based on `bitmask` flags.
  24449. *
  24450. * @private
  24451. * @returns {Array} details The details to modify.
  24452. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24453. * @returns {Array} Returns `details`.
  24454. */
  24455. function updateWrapDetails(details, bitmask) {
  24456. arrayEach(wrapFlags, function(pair) {
  24457. var value = '_.' + pair[0];
  24458. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  24459. details.push(value);
  24460. }
  24461. });
  24462. return details.sort();
  24463. }
  24464. /**
  24465. * Creates a clone of `wrapper`.
  24466. *
  24467. * @private
  24468. * @param {Object} wrapper The wrapper to clone.
  24469. * @returns {Object} Returns the cloned wrapper.
  24470. */
  24471. function wrapperClone(wrapper) {
  24472. if (wrapper instanceof LazyWrapper) {
  24473. return wrapper.clone();
  24474. }
  24475. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  24476. result.__actions__ = copyArray(wrapper.__actions__);
  24477. result.__index__ = wrapper.__index__;
  24478. result.__values__ = wrapper.__values__;
  24479. return result;
  24480. }
  24481. /*------------------------------------------------------------------------*/
  24482. /**
  24483. * Creates an array of elements split into groups the length of `size`.
  24484. * If `array` can't be split evenly, the final chunk will be the remaining
  24485. * elements.
  24486. *
  24487. * @static
  24488. * @memberOf _
  24489. * @since 3.0.0
  24490. * @category Array
  24491. * @param {Array} array The array to process.
  24492. * @param {number} [size=1] The length of each chunk
  24493. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24494. * @returns {Array} Returns the new array of chunks.
  24495. * @example
  24496. *
  24497. * _.chunk(['a', 'b', 'c', 'd'], 2);
  24498. * // => [['a', 'b'], ['c', 'd']]
  24499. *
  24500. * _.chunk(['a', 'b', 'c', 'd'], 3);
  24501. * // => [['a', 'b', 'c'], ['d']]
  24502. */
  24503. function chunk(array, size, guard) {
  24504. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  24505. size = 1;
  24506. } else {
  24507. size = nativeMax(toInteger(size), 0);
  24508. }
  24509. var length = array == null ? 0 : array.length;
  24510. if (!length || size < 1) {
  24511. return [];
  24512. }
  24513. var index = 0,
  24514. resIndex = 0,
  24515. result = Array(nativeCeil(length / size));
  24516. while (index < length) {
  24517. result[resIndex++] = baseSlice(array, index, (index += size));
  24518. }
  24519. return result;
  24520. }
  24521. /**
  24522. * Creates an array with all falsey values removed. The values `false`, `null`,
  24523. * `0`, `""`, `undefined`, and `NaN` are falsey.
  24524. *
  24525. * @static
  24526. * @memberOf _
  24527. * @since 0.1.0
  24528. * @category Array
  24529. * @param {Array} array The array to compact.
  24530. * @returns {Array} Returns the new array of filtered values.
  24531. * @example
  24532. *
  24533. * _.compact([0, 1, false, 2, '', 3]);
  24534. * // => [1, 2, 3]
  24535. */
  24536. function compact(array) {
  24537. var index = -1,
  24538. length = array == null ? 0 : array.length,
  24539. resIndex = 0,
  24540. result = [];
  24541. while (++index < length) {
  24542. var value = array[index];
  24543. if (value) {
  24544. result[resIndex++] = value;
  24545. }
  24546. }
  24547. return result;
  24548. }
  24549. /**
  24550. * Creates a new array concatenating `array` with any additional arrays
  24551. * and/or values.
  24552. *
  24553. * @static
  24554. * @memberOf _
  24555. * @since 4.0.0
  24556. * @category Array
  24557. * @param {Array} array The array to concatenate.
  24558. * @param {...*} [values] The values to concatenate.
  24559. * @returns {Array} Returns the new concatenated array.
  24560. * @example
  24561. *
  24562. * var array = [1];
  24563. * var other = _.concat(array, 2, [3], [[4]]);
  24564. *
  24565. * console.log(other);
  24566. * // => [1, 2, 3, [4]]
  24567. *
  24568. * console.log(array);
  24569. * // => [1]
  24570. */
  24571. function concat() {
  24572. var length = arguments.length;
  24573. if (!length) {
  24574. return [];
  24575. }
  24576. var args = Array(length - 1),
  24577. array = arguments[0],
  24578. index = length;
  24579. while (index--) {
  24580. args[index - 1] = arguments[index];
  24581. }
  24582. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  24583. }
  24584. /**
  24585. * Creates an array of `array` values not included in the other given arrays
  24586. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24587. * for equality comparisons. The order and references of result values are
  24588. * determined by the first array.
  24589. *
  24590. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  24591. *
  24592. * @static
  24593. * @memberOf _
  24594. * @since 0.1.0
  24595. * @category Array
  24596. * @param {Array} array The array to inspect.
  24597. * @param {...Array} [values] The values to exclude.
  24598. * @returns {Array} Returns the new array of filtered values.
  24599. * @see _.without, _.xor
  24600. * @example
  24601. *
  24602. * _.difference([2, 1], [2, 3]);
  24603. * // => [1]
  24604. */
  24605. var difference = baseRest(function(array, values) {
  24606. return isArrayLikeObject(array)
  24607. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  24608. : [];
  24609. });
  24610. /**
  24611. * This method is like `_.difference` except that it accepts `iteratee` which
  24612. * is invoked for each element of `array` and `values` to generate the criterion
  24613. * by which they're compared. The order and references of result values are
  24614. * determined by the first array. The iteratee is invoked with one argument:
  24615. * (value).
  24616. *
  24617. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  24618. *
  24619. * @static
  24620. * @memberOf _
  24621. * @since 4.0.0
  24622. * @category Array
  24623. * @param {Array} array The array to inspect.
  24624. * @param {...Array} [values] The values to exclude.
  24625. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24626. * @returns {Array} Returns the new array of filtered values.
  24627. * @example
  24628. *
  24629. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24630. * // => [1.2]
  24631. *
  24632. * // The `_.property` iteratee shorthand.
  24633. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  24634. * // => [{ 'x': 2 }]
  24635. */
  24636. var differenceBy = baseRest(function(array, values) {
  24637. var iteratee = last(values);
  24638. if (isArrayLikeObject(iteratee)) {
  24639. iteratee = undefined;
  24640. }
  24641. return isArrayLikeObject(array)
  24642. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  24643. : [];
  24644. });
  24645. /**
  24646. * This method is like `_.difference` except that it accepts `comparator`
  24647. * which is invoked to compare elements of `array` to `values`. The order and
  24648. * references of result values are determined by the first array. The comparator
  24649. * is invoked with two arguments: (arrVal, othVal).
  24650. *
  24651. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  24652. *
  24653. * @static
  24654. * @memberOf _
  24655. * @since 4.0.0
  24656. * @category Array
  24657. * @param {Array} array The array to inspect.
  24658. * @param {...Array} [values] The values to exclude.
  24659. * @param {Function} [comparator] The comparator invoked per element.
  24660. * @returns {Array} Returns the new array of filtered values.
  24661. * @example
  24662. *
  24663. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24664. *
  24665. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  24666. * // => [{ 'x': 2, 'y': 1 }]
  24667. */
  24668. var differenceWith = baseRest(function(array, values) {
  24669. var comparator = last(values);
  24670. if (isArrayLikeObject(comparator)) {
  24671. comparator = undefined;
  24672. }
  24673. return isArrayLikeObject(array)
  24674. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  24675. : [];
  24676. });
  24677. /**
  24678. * Creates a slice of `array` with `n` elements dropped from the beginning.
  24679. *
  24680. * @static
  24681. * @memberOf _
  24682. * @since 0.5.0
  24683. * @category Array
  24684. * @param {Array} array The array to query.
  24685. * @param {number} [n=1] The number of elements to drop.
  24686. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24687. * @returns {Array} Returns the slice of `array`.
  24688. * @example
  24689. *
  24690. * _.drop([1, 2, 3]);
  24691. * // => [2, 3]
  24692. *
  24693. * _.drop([1, 2, 3], 2);
  24694. * // => [3]
  24695. *
  24696. * _.drop([1, 2, 3], 5);
  24697. * // => []
  24698. *
  24699. * _.drop([1, 2, 3], 0);
  24700. * // => [1, 2, 3]
  24701. */
  24702. function drop(array, n, guard) {
  24703. var length = array == null ? 0 : array.length;
  24704. if (!length) {
  24705. return [];
  24706. }
  24707. n = (guard || n === undefined) ? 1 : toInteger(n);
  24708. return baseSlice(array, n < 0 ? 0 : n, length);
  24709. }
  24710. /**
  24711. * Creates a slice of `array` with `n` elements dropped from the end.
  24712. *
  24713. * @static
  24714. * @memberOf _
  24715. * @since 3.0.0
  24716. * @category Array
  24717. * @param {Array} array The array to query.
  24718. * @param {number} [n=1] The number of elements to drop.
  24719. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24720. * @returns {Array} Returns the slice of `array`.
  24721. * @example
  24722. *
  24723. * _.dropRight([1, 2, 3]);
  24724. * // => [1, 2]
  24725. *
  24726. * _.dropRight([1, 2, 3], 2);
  24727. * // => [1]
  24728. *
  24729. * _.dropRight([1, 2, 3], 5);
  24730. * // => []
  24731. *
  24732. * _.dropRight([1, 2, 3], 0);
  24733. * // => [1, 2, 3]
  24734. */
  24735. function dropRight(array, n, guard) {
  24736. var length = array == null ? 0 : array.length;
  24737. if (!length) {
  24738. return [];
  24739. }
  24740. n = (guard || n === undefined) ? 1 : toInteger(n);
  24741. n = length - n;
  24742. return baseSlice(array, 0, n < 0 ? 0 : n);
  24743. }
  24744. /**
  24745. * Creates a slice of `array` excluding elements dropped from the end.
  24746. * Elements are dropped until `predicate` returns falsey. The predicate is
  24747. * invoked with three arguments: (value, index, array).
  24748. *
  24749. * @static
  24750. * @memberOf _
  24751. * @since 3.0.0
  24752. * @category Array
  24753. * @param {Array} array The array to query.
  24754. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24755. * @returns {Array} Returns the slice of `array`.
  24756. * @example
  24757. *
  24758. * var users = [
  24759. * { 'user': 'barney', 'active': true },
  24760. * { 'user': 'fred', 'active': false },
  24761. * { 'user': 'pebbles', 'active': false }
  24762. * ];
  24763. *
  24764. * _.dropRightWhile(users, function(o) { return !o.active; });
  24765. * // => objects for ['barney']
  24766. *
  24767. * // The `_.matches` iteratee shorthand.
  24768. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  24769. * // => objects for ['barney', 'fred']
  24770. *
  24771. * // The `_.matchesProperty` iteratee shorthand.
  24772. * _.dropRightWhile(users, ['active', false]);
  24773. * // => objects for ['barney']
  24774. *
  24775. * // The `_.property` iteratee shorthand.
  24776. * _.dropRightWhile(users, 'active');
  24777. * // => objects for ['barney', 'fred', 'pebbles']
  24778. */
  24779. function dropRightWhile(array, predicate) {
  24780. return (array && array.length)
  24781. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  24782. : [];
  24783. }
  24784. /**
  24785. * Creates a slice of `array` excluding elements dropped from the beginning.
  24786. * Elements are dropped until `predicate` returns falsey. The predicate is
  24787. * invoked with three arguments: (value, index, array).
  24788. *
  24789. * @static
  24790. * @memberOf _
  24791. * @since 3.0.0
  24792. * @category Array
  24793. * @param {Array} array The array to query.
  24794. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24795. * @returns {Array} Returns the slice of `array`.
  24796. * @example
  24797. *
  24798. * var users = [
  24799. * { 'user': 'barney', 'active': false },
  24800. * { 'user': 'fred', 'active': false },
  24801. * { 'user': 'pebbles', 'active': true }
  24802. * ];
  24803. *
  24804. * _.dropWhile(users, function(o) { return !o.active; });
  24805. * // => objects for ['pebbles']
  24806. *
  24807. * // The `_.matches` iteratee shorthand.
  24808. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  24809. * // => objects for ['fred', 'pebbles']
  24810. *
  24811. * // The `_.matchesProperty` iteratee shorthand.
  24812. * _.dropWhile(users, ['active', false]);
  24813. * // => objects for ['pebbles']
  24814. *
  24815. * // The `_.property` iteratee shorthand.
  24816. * _.dropWhile(users, 'active');
  24817. * // => objects for ['barney', 'fred', 'pebbles']
  24818. */
  24819. function dropWhile(array, predicate) {
  24820. return (array && array.length)
  24821. ? baseWhile(array, getIteratee(predicate, 3), true)
  24822. : [];
  24823. }
  24824. /**
  24825. * Fills elements of `array` with `value` from `start` up to, but not
  24826. * including, `end`.
  24827. *
  24828. * **Note:** This method mutates `array`.
  24829. *
  24830. * @static
  24831. * @memberOf _
  24832. * @since 3.2.0
  24833. * @category Array
  24834. * @param {Array} array The array to fill.
  24835. * @param {*} value The value to fill `array` with.
  24836. * @param {number} [start=0] The start position.
  24837. * @param {number} [end=array.length] The end position.
  24838. * @returns {Array} Returns `array`.
  24839. * @example
  24840. *
  24841. * var array = [1, 2, 3];
  24842. *
  24843. * _.fill(array, 'a');
  24844. * console.log(array);
  24845. * // => ['a', 'a', 'a']
  24846. *
  24847. * _.fill(Array(3), 2);
  24848. * // => [2, 2, 2]
  24849. *
  24850. * _.fill([4, 6, 8, 10], '*', 1, 3);
  24851. * // => [4, '*', '*', 10]
  24852. */
  24853. function fill(array, value, start, end) {
  24854. var length = array == null ? 0 : array.length;
  24855. if (!length) {
  24856. return [];
  24857. }
  24858. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  24859. start = 0;
  24860. end = length;
  24861. }
  24862. return baseFill(array, value, start, end);
  24863. }
  24864. /**
  24865. * This method is like `_.find` except that it returns the index of the first
  24866. * element `predicate` returns truthy for instead of the element itself.
  24867. *
  24868. * @static
  24869. * @memberOf _
  24870. * @since 1.1.0
  24871. * @category Array
  24872. * @param {Array} array The array to inspect.
  24873. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24874. * @param {number} [fromIndex=0] The index to search from.
  24875. * @returns {number} Returns the index of the found element, else `-1`.
  24876. * @example
  24877. *
  24878. * var users = [
  24879. * { 'user': 'barney', 'active': false },
  24880. * { 'user': 'fred', 'active': false },
  24881. * { 'user': 'pebbles', 'active': true }
  24882. * ];
  24883. *
  24884. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  24885. * // => 0
  24886. *
  24887. * // The `_.matches` iteratee shorthand.
  24888. * _.findIndex(users, { 'user': 'fred', 'active': false });
  24889. * // => 1
  24890. *
  24891. * // The `_.matchesProperty` iteratee shorthand.
  24892. * _.findIndex(users, ['active', false]);
  24893. * // => 0
  24894. *
  24895. * // The `_.property` iteratee shorthand.
  24896. * _.findIndex(users, 'active');
  24897. * // => 2
  24898. */
  24899. function findIndex(array, predicate, fromIndex) {
  24900. var length = array == null ? 0 : array.length;
  24901. if (!length) {
  24902. return -1;
  24903. }
  24904. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  24905. if (index < 0) {
  24906. index = nativeMax(length + index, 0);
  24907. }
  24908. return baseFindIndex(array, getIteratee(predicate, 3), index);
  24909. }
  24910. /**
  24911. * This method is like `_.findIndex` except that it iterates over elements
  24912. * of `collection` from right to left.
  24913. *
  24914. * @static
  24915. * @memberOf _
  24916. * @since 2.0.0
  24917. * @category Array
  24918. * @param {Array} array The array to inspect.
  24919. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24920. * @param {number} [fromIndex=array.length-1] The index to search from.
  24921. * @returns {number} Returns the index of the found element, else `-1`.
  24922. * @example
  24923. *
  24924. * var users = [
  24925. * { 'user': 'barney', 'active': true },
  24926. * { 'user': 'fred', 'active': false },
  24927. * { 'user': 'pebbles', 'active': false }
  24928. * ];
  24929. *
  24930. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  24931. * // => 2
  24932. *
  24933. * // The `_.matches` iteratee shorthand.
  24934. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  24935. * // => 0
  24936. *
  24937. * // The `_.matchesProperty` iteratee shorthand.
  24938. * _.findLastIndex(users, ['active', false]);
  24939. * // => 2
  24940. *
  24941. * // The `_.property` iteratee shorthand.
  24942. * _.findLastIndex(users, 'active');
  24943. * // => 0
  24944. */
  24945. function findLastIndex(array, predicate, fromIndex) {
  24946. var length = array == null ? 0 : array.length;
  24947. if (!length) {
  24948. return -1;
  24949. }
  24950. var index = length - 1;
  24951. if (fromIndex !== undefined) {
  24952. index = toInteger(fromIndex);
  24953. index = fromIndex < 0
  24954. ? nativeMax(length + index, 0)
  24955. : nativeMin(index, length - 1);
  24956. }
  24957. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  24958. }
  24959. /**
  24960. * Flattens `array` a single level deep.
  24961. *
  24962. * @static
  24963. * @memberOf _
  24964. * @since 0.1.0
  24965. * @category Array
  24966. * @param {Array} array The array to flatten.
  24967. * @returns {Array} Returns the new flattened array.
  24968. * @example
  24969. *
  24970. * _.flatten([1, [2, [3, [4]], 5]]);
  24971. * // => [1, 2, [3, [4]], 5]
  24972. */
  24973. function flatten(array) {
  24974. var length = array == null ? 0 : array.length;
  24975. return length ? baseFlatten(array, 1) : [];
  24976. }
  24977. /**
  24978. * Recursively flattens `array`.
  24979. *
  24980. * @static
  24981. * @memberOf _
  24982. * @since 3.0.0
  24983. * @category Array
  24984. * @param {Array} array The array to flatten.
  24985. * @returns {Array} Returns the new flattened array.
  24986. * @example
  24987. *
  24988. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  24989. * // => [1, 2, 3, 4, 5]
  24990. */
  24991. function flattenDeep(array) {
  24992. var length = array == null ? 0 : array.length;
  24993. return length ? baseFlatten(array, INFINITY) : [];
  24994. }
  24995. /**
  24996. * Recursively flatten `array` up to `depth` times.
  24997. *
  24998. * @static
  24999. * @memberOf _
  25000. * @since 4.4.0
  25001. * @category Array
  25002. * @param {Array} array The array to flatten.
  25003. * @param {number} [depth=1] The maximum recursion depth.
  25004. * @returns {Array} Returns the new flattened array.
  25005. * @example
  25006. *
  25007. * var array = [1, [2, [3, [4]], 5]];
  25008. *
  25009. * _.flattenDepth(array, 1);
  25010. * // => [1, 2, [3, [4]], 5]
  25011. *
  25012. * _.flattenDepth(array, 2);
  25013. * // => [1, 2, 3, [4], 5]
  25014. */
  25015. function flattenDepth(array, depth) {
  25016. var length = array == null ? 0 : array.length;
  25017. if (!length) {
  25018. return [];
  25019. }
  25020. depth = depth === undefined ? 1 : toInteger(depth);
  25021. return baseFlatten(array, depth);
  25022. }
  25023. /**
  25024. * The inverse of `_.toPairs`; this method returns an object composed
  25025. * from key-value `pairs`.
  25026. *
  25027. * @static
  25028. * @memberOf _
  25029. * @since 4.0.0
  25030. * @category Array
  25031. * @param {Array} pairs The key-value pairs.
  25032. * @returns {Object} Returns the new object.
  25033. * @example
  25034. *
  25035. * _.fromPairs([['a', 1], ['b', 2]]);
  25036. * // => { 'a': 1, 'b': 2 }
  25037. */
  25038. function fromPairs(pairs) {
  25039. var index = -1,
  25040. length = pairs == null ? 0 : pairs.length,
  25041. result = {};
  25042. while (++index < length) {
  25043. var pair = pairs[index];
  25044. result[pair[0]] = pair[1];
  25045. }
  25046. return result;
  25047. }
  25048. /**
  25049. * Gets the first element of `array`.
  25050. *
  25051. * @static
  25052. * @memberOf _
  25053. * @since 0.1.0
  25054. * @alias first
  25055. * @category Array
  25056. * @param {Array} array The array to query.
  25057. * @returns {*} Returns the first element of `array`.
  25058. * @example
  25059. *
  25060. * _.head([1, 2, 3]);
  25061. * // => 1
  25062. *
  25063. * _.head([]);
  25064. * // => undefined
  25065. */
  25066. function head(array) {
  25067. return (array && array.length) ? array[0] : undefined;
  25068. }
  25069. /**
  25070. * Gets the index at which the first occurrence of `value` is found in `array`
  25071. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25072. * for equality comparisons. If `fromIndex` is negative, it's used as the
  25073. * offset from the end of `array`.
  25074. *
  25075. * @static
  25076. * @memberOf _
  25077. * @since 0.1.0
  25078. * @category Array
  25079. * @param {Array} array The array to inspect.
  25080. * @param {*} value The value to search for.
  25081. * @param {number} [fromIndex=0] The index to search from.
  25082. * @returns {number} Returns the index of the matched value, else `-1`.
  25083. * @example
  25084. *
  25085. * _.indexOf([1, 2, 1, 2], 2);
  25086. * // => 1
  25087. *
  25088. * // Search from the `fromIndex`.
  25089. * _.indexOf([1, 2, 1, 2], 2, 2);
  25090. * // => 3
  25091. */
  25092. function indexOf(array, value, fromIndex) {
  25093. var length = array == null ? 0 : array.length;
  25094. if (!length) {
  25095. return -1;
  25096. }
  25097. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25098. if (index < 0) {
  25099. index = nativeMax(length + index, 0);
  25100. }
  25101. return baseIndexOf(array, value, index);
  25102. }
  25103. /**
  25104. * Gets all but the last element of `array`.
  25105. *
  25106. * @static
  25107. * @memberOf _
  25108. * @since 0.1.0
  25109. * @category Array
  25110. * @param {Array} array The array to query.
  25111. * @returns {Array} Returns the slice of `array`.
  25112. * @example
  25113. *
  25114. * _.initial([1, 2, 3]);
  25115. * // => [1, 2]
  25116. */
  25117. function initial(array) {
  25118. var length = array == null ? 0 : array.length;
  25119. return length ? baseSlice(array, 0, -1) : [];
  25120. }
  25121. /**
  25122. * Creates an array of unique values that are included in all given arrays
  25123. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25124. * for equality comparisons. The order and references of result values are
  25125. * determined by the first array.
  25126. *
  25127. * @static
  25128. * @memberOf _
  25129. * @since 0.1.0
  25130. * @category Array
  25131. * @param {...Array} [arrays] The arrays to inspect.
  25132. * @returns {Array} Returns the new array of intersecting values.
  25133. * @example
  25134. *
  25135. * _.intersection([2, 1], [2, 3]);
  25136. * // => [2]
  25137. */
  25138. var intersection = baseRest(function(arrays) {
  25139. var mapped = arrayMap(arrays, castArrayLikeObject);
  25140. return (mapped.length && mapped[0] === arrays[0])
  25141. ? baseIntersection(mapped)
  25142. : [];
  25143. });
  25144. /**
  25145. * This method is like `_.intersection` except that it accepts `iteratee`
  25146. * which is invoked for each element of each `arrays` to generate the criterion
  25147. * by which they're compared. The order and references of result values are
  25148. * determined by the first array. The iteratee is invoked with one argument:
  25149. * (value).
  25150. *
  25151. * @static
  25152. * @memberOf _
  25153. * @since 4.0.0
  25154. * @category Array
  25155. * @param {...Array} [arrays] The arrays to inspect.
  25156. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25157. * @returns {Array} Returns the new array of intersecting values.
  25158. * @example
  25159. *
  25160. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25161. * // => [2.1]
  25162. *
  25163. * // The `_.property` iteratee shorthand.
  25164. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25165. * // => [{ 'x': 1 }]
  25166. */
  25167. var intersectionBy = baseRest(function(arrays) {
  25168. var iteratee = last(arrays),
  25169. mapped = arrayMap(arrays, castArrayLikeObject);
  25170. if (iteratee === last(mapped)) {
  25171. iteratee = undefined;
  25172. } else {
  25173. mapped.pop();
  25174. }
  25175. return (mapped.length && mapped[0] === arrays[0])
  25176. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  25177. : [];
  25178. });
  25179. /**
  25180. * This method is like `_.intersection` except that it accepts `comparator`
  25181. * which is invoked to compare elements of `arrays`. The order and references
  25182. * of result values are determined by the first array. The comparator is
  25183. * invoked with two arguments: (arrVal, othVal).
  25184. *
  25185. * @static
  25186. * @memberOf _
  25187. * @since 4.0.0
  25188. * @category Array
  25189. * @param {...Array} [arrays] The arrays to inspect.
  25190. * @param {Function} [comparator] The comparator invoked per element.
  25191. * @returns {Array} Returns the new array of intersecting values.
  25192. * @example
  25193. *
  25194. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25195. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25196. *
  25197. * _.intersectionWith(objects, others, _.isEqual);
  25198. * // => [{ 'x': 1, 'y': 2 }]
  25199. */
  25200. var intersectionWith = baseRest(function(arrays) {
  25201. var comparator = last(arrays),
  25202. mapped = arrayMap(arrays, castArrayLikeObject);
  25203. comparator = typeof comparator == 'function' ? comparator : undefined;
  25204. if (comparator) {
  25205. mapped.pop();
  25206. }
  25207. return (mapped.length && mapped[0] === arrays[0])
  25208. ? baseIntersection(mapped, undefined, comparator)
  25209. : [];
  25210. });
  25211. /**
  25212. * Converts all elements in `array` into a string separated by `separator`.
  25213. *
  25214. * @static
  25215. * @memberOf _
  25216. * @since 4.0.0
  25217. * @category Array
  25218. * @param {Array} array The array to convert.
  25219. * @param {string} [separator=','] The element separator.
  25220. * @returns {string} Returns the joined string.
  25221. * @example
  25222. *
  25223. * _.join(['a', 'b', 'c'], '~');
  25224. * // => 'a~b~c'
  25225. */
  25226. function join(array, separator) {
  25227. return array == null ? '' : nativeJoin.call(array, separator);
  25228. }
  25229. /**
  25230. * Gets the last element of `array`.
  25231. *
  25232. * @static
  25233. * @memberOf _
  25234. * @since 0.1.0
  25235. * @category Array
  25236. * @param {Array} array The array to query.
  25237. * @returns {*} Returns the last element of `array`.
  25238. * @example
  25239. *
  25240. * _.last([1, 2, 3]);
  25241. * // => 3
  25242. */
  25243. function last(array) {
  25244. var length = array == null ? 0 : array.length;
  25245. return length ? array[length - 1] : undefined;
  25246. }
  25247. /**
  25248. * This method is like `_.indexOf` except that it iterates over elements of
  25249. * `array` from right to left.
  25250. *
  25251. * @static
  25252. * @memberOf _
  25253. * @since 0.1.0
  25254. * @category Array
  25255. * @param {Array} array The array to inspect.
  25256. * @param {*} value The value to search for.
  25257. * @param {number} [fromIndex=array.length-1] The index to search from.
  25258. * @returns {number} Returns the index of the matched value, else `-1`.
  25259. * @example
  25260. *
  25261. * _.lastIndexOf([1, 2, 1, 2], 2);
  25262. * // => 3
  25263. *
  25264. * // Search from the `fromIndex`.
  25265. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  25266. * // => 1
  25267. */
  25268. function lastIndexOf(array, value, fromIndex) {
  25269. var length = array == null ? 0 : array.length;
  25270. if (!length) {
  25271. return -1;
  25272. }
  25273. var index = length;
  25274. if (fromIndex !== undefined) {
  25275. index = toInteger(fromIndex);
  25276. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  25277. }
  25278. return value === value
  25279. ? strictLastIndexOf(array, value, index)
  25280. : baseFindIndex(array, baseIsNaN, index, true);
  25281. }
  25282. /**
  25283. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  25284. * element from the end is returned.
  25285. *
  25286. * @static
  25287. * @memberOf _
  25288. * @since 4.11.0
  25289. * @category Array
  25290. * @param {Array} array The array to query.
  25291. * @param {number} [n=0] The index of the element to return.
  25292. * @returns {*} Returns the nth element of `array`.
  25293. * @example
  25294. *
  25295. * var array = ['a', 'b', 'c', 'd'];
  25296. *
  25297. * _.nth(array, 1);
  25298. * // => 'b'
  25299. *
  25300. * _.nth(array, -2);
  25301. * // => 'c';
  25302. */
  25303. function nth(array, n) {
  25304. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  25305. }
  25306. /**
  25307. * Removes all given values from `array` using
  25308. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25309. * for equality comparisons.
  25310. *
  25311. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  25312. * to remove elements from an array by predicate.
  25313. *
  25314. * @static
  25315. * @memberOf _
  25316. * @since 2.0.0
  25317. * @category Array
  25318. * @param {Array} array The array to modify.
  25319. * @param {...*} [values] The values to remove.
  25320. * @returns {Array} Returns `array`.
  25321. * @example
  25322. *
  25323. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25324. *
  25325. * _.pull(array, 'a', 'c');
  25326. * console.log(array);
  25327. * // => ['b', 'b']
  25328. */
  25329. var pull = baseRest(pullAll);
  25330. /**
  25331. * This method is like `_.pull` except that it accepts an array of values to remove.
  25332. *
  25333. * **Note:** Unlike `_.difference`, this method mutates `array`.
  25334. *
  25335. * @static
  25336. * @memberOf _
  25337. * @since 4.0.0
  25338. * @category Array
  25339. * @param {Array} array The array to modify.
  25340. * @param {Array} values The values to remove.
  25341. * @returns {Array} Returns `array`.
  25342. * @example
  25343. *
  25344. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25345. *
  25346. * _.pullAll(array, ['a', 'c']);
  25347. * console.log(array);
  25348. * // => ['b', 'b']
  25349. */
  25350. function pullAll(array, values) {
  25351. return (array && array.length && values && values.length)
  25352. ? basePullAll(array, values)
  25353. : array;
  25354. }
  25355. /**
  25356. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  25357. * invoked for each element of `array` and `values` to generate the criterion
  25358. * by which they're compared. The iteratee is invoked with one argument: (value).
  25359. *
  25360. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  25361. *
  25362. * @static
  25363. * @memberOf _
  25364. * @since 4.0.0
  25365. * @category Array
  25366. * @param {Array} array The array to modify.
  25367. * @param {Array} values The values to remove.
  25368. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25369. * @returns {Array} Returns `array`.
  25370. * @example
  25371. *
  25372. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  25373. *
  25374. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  25375. * console.log(array);
  25376. * // => [{ 'x': 2 }]
  25377. */
  25378. function pullAllBy(array, values, iteratee) {
  25379. return (array && array.length && values && values.length)
  25380. ? basePullAll(array, values, getIteratee(iteratee, 2))
  25381. : array;
  25382. }
  25383. /**
  25384. * This method is like `_.pullAll` except that it accepts `comparator` which
  25385. * is invoked to compare elements of `array` to `values`. The comparator is
  25386. * invoked with two arguments: (arrVal, othVal).
  25387. *
  25388. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  25389. *
  25390. * @static
  25391. * @memberOf _
  25392. * @since 4.6.0
  25393. * @category Array
  25394. * @param {Array} array The array to modify.
  25395. * @param {Array} values The values to remove.
  25396. * @param {Function} [comparator] The comparator invoked per element.
  25397. * @returns {Array} Returns `array`.
  25398. * @example
  25399. *
  25400. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  25401. *
  25402. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  25403. * console.log(array);
  25404. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  25405. */
  25406. function pullAllWith(array, values, comparator) {
  25407. return (array && array.length && values && values.length)
  25408. ? basePullAll(array, values, undefined, comparator)
  25409. : array;
  25410. }
  25411. /**
  25412. * Removes elements from `array` corresponding to `indexes` and returns an
  25413. * array of removed elements.
  25414. *
  25415. * **Note:** Unlike `_.at`, this method mutates `array`.
  25416. *
  25417. * @static
  25418. * @memberOf _
  25419. * @since 3.0.0
  25420. * @category Array
  25421. * @param {Array} array The array to modify.
  25422. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  25423. * @returns {Array} Returns the new array of removed elements.
  25424. * @example
  25425. *
  25426. * var array = ['a', 'b', 'c', 'd'];
  25427. * var pulled = _.pullAt(array, [1, 3]);
  25428. *
  25429. * console.log(array);
  25430. * // => ['a', 'c']
  25431. *
  25432. * console.log(pulled);
  25433. * // => ['b', 'd']
  25434. */
  25435. var pullAt = flatRest(function(array, indexes) {
  25436. var length = array == null ? 0 : array.length,
  25437. result = baseAt(array, indexes);
  25438. basePullAt(array, arrayMap(indexes, function(index) {
  25439. return isIndex(index, length) ? +index : index;
  25440. }).sort(compareAscending));
  25441. return result;
  25442. });
  25443. /**
  25444. * Removes all elements from `array` that `predicate` returns truthy for
  25445. * and returns an array of the removed elements. The predicate is invoked
  25446. * with three arguments: (value, index, array).
  25447. *
  25448. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  25449. * to pull elements from an array by value.
  25450. *
  25451. * @static
  25452. * @memberOf _
  25453. * @since 2.0.0
  25454. * @category Array
  25455. * @param {Array} array The array to modify.
  25456. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25457. * @returns {Array} Returns the new array of removed elements.
  25458. * @example
  25459. *
  25460. * var array = [1, 2, 3, 4];
  25461. * var evens = _.remove(array, function(n) {
  25462. * return n % 2 == 0;
  25463. * });
  25464. *
  25465. * console.log(array);
  25466. * // => [1, 3]
  25467. *
  25468. * console.log(evens);
  25469. * // => [2, 4]
  25470. */
  25471. function remove(array, predicate) {
  25472. var result = [];
  25473. if (!(array && array.length)) {
  25474. return result;
  25475. }
  25476. var index = -1,
  25477. indexes = [],
  25478. length = array.length;
  25479. predicate = getIteratee(predicate, 3);
  25480. while (++index < length) {
  25481. var value = array[index];
  25482. if (predicate(value, index, array)) {
  25483. result.push(value);
  25484. indexes.push(index);
  25485. }
  25486. }
  25487. basePullAt(array, indexes);
  25488. return result;
  25489. }
  25490. /**
  25491. * Reverses `array` so that the first element becomes the last, the second
  25492. * element becomes the second to last, and so on.
  25493. *
  25494. * **Note:** This method mutates `array` and is based on
  25495. * [`Array#reverse`](https://mdn.io/Array/reverse).
  25496. *
  25497. * @static
  25498. * @memberOf _
  25499. * @since 4.0.0
  25500. * @category Array
  25501. * @param {Array} array The array to modify.
  25502. * @returns {Array} Returns `array`.
  25503. * @example
  25504. *
  25505. * var array = [1, 2, 3];
  25506. *
  25507. * _.reverse(array);
  25508. * // => [3, 2, 1]
  25509. *
  25510. * console.log(array);
  25511. * // => [3, 2, 1]
  25512. */
  25513. function reverse(array) {
  25514. return array == null ? array : nativeReverse.call(array);
  25515. }
  25516. /**
  25517. * Creates a slice of `array` from `start` up to, but not including, `end`.
  25518. *
  25519. * **Note:** This method is used instead of
  25520. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  25521. * returned.
  25522. *
  25523. * @static
  25524. * @memberOf _
  25525. * @since 3.0.0
  25526. * @category Array
  25527. * @param {Array} array The array to slice.
  25528. * @param {number} [start=0] The start position.
  25529. * @param {number} [end=array.length] The end position.
  25530. * @returns {Array} Returns the slice of `array`.
  25531. */
  25532. function slice(array, start, end) {
  25533. var length = array == null ? 0 : array.length;
  25534. if (!length) {
  25535. return [];
  25536. }
  25537. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  25538. start = 0;
  25539. end = length;
  25540. }
  25541. else {
  25542. start = start == null ? 0 : toInteger(start);
  25543. end = end === undefined ? length : toInteger(end);
  25544. }
  25545. return baseSlice(array, start, end);
  25546. }
  25547. /**
  25548. * Uses a binary search to determine the lowest index at which `value`
  25549. * should be inserted into `array` in order to maintain its sort order.
  25550. *
  25551. * @static
  25552. * @memberOf _
  25553. * @since 0.1.0
  25554. * @category Array
  25555. * @param {Array} array The sorted array to inspect.
  25556. * @param {*} value The value to evaluate.
  25557. * @returns {number} Returns the index at which `value` should be inserted
  25558. * into `array`.
  25559. * @example
  25560. *
  25561. * _.sortedIndex([30, 50], 40);
  25562. * // => 1
  25563. */
  25564. function sortedIndex(array, value) {
  25565. return baseSortedIndex(array, value);
  25566. }
  25567. /**
  25568. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  25569. * which is invoked for `value` and each element of `array` to compute their
  25570. * sort ranking. The iteratee is invoked with one argument: (value).
  25571. *
  25572. * @static
  25573. * @memberOf _
  25574. * @since 4.0.0
  25575. * @category Array
  25576. * @param {Array} array The sorted array to inspect.
  25577. * @param {*} value The value to evaluate.
  25578. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25579. * @returns {number} Returns the index at which `value` should be inserted
  25580. * into `array`.
  25581. * @example
  25582. *
  25583. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25584. *
  25585. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25586. * // => 0
  25587. *
  25588. * // The `_.property` iteratee shorthand.
  25589. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  25590. * // => 0
  25591. */
  25592. function sortedIndexBy(array, value, iteratee) {
  25593. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  25594. }
  25595. /**
  25596. * This method is like `_.indexOf` except that it performs a binary
  25597. * search on a sorted `array`.
  25598. *
  25599. * @static
  25600. * @memberOf _
  25601. * @since 4.0.0
  25602. * @category Array
  25603. * @param {Array} array The array to inspect.
  25604. * @param {*} value The value to search for.
  25605. * @returns {number} Returns the index of the matched value, else `-1`.
  25606. * @example
  25607. *
  25608. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  25609. * // => 1
  25610. */
  25611. function sortedIndexOf(array, value) {
  25612. var length = array == null ? 0 : array.length;
  25613. if (length) {
  25614. var index = baseSortedIndex(array, value);
  25615. if (index < length && eq(array[index], value)) {
  25616. return index;
  25617. }
  25618. }
  25619. return -1;
  25620. }
  25621. /**
  25622. * This method is like `_.sortedIndex` except that it returns the highest
  25623. * index at which `value` should be inserted into `array` in order to
  25624. * maintain its sort order.
  25625. *
  25626. * @static
  25627. * @memberOf _
  25628. * @since 3.0.0
  25629. * @category Array
  25630. * @param {Array} array The sorted array to inspect.
  25631. * @param {*} value The value to evaluate.
  25632. * @returns {number} Returns the index at which `value` should be inserted
  25633. * into `array`.
  25634. * @example
  25635. *
  25636. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  25637. * // => 4
  25638. */
  25639. function sortedLastIndex(array, value) {
  25640. return baseSortedIndex(array, value, true);
  25641. }
  25642. /**
  25643. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  25644. * which is invoked for `value` and each element of `array` to compute their
  25645. * sort ranking. The iteratee is invoked with one argument: (value).
  25646. *
  25647. * @static
  25648. * @memberOf _
  25649. * @since 4.0.0
  25650. * @category Array
  25651. * @param {Array} array The sorted array to inspect.
  25652. * @param {*} value The value to evaluate.
  25653. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25654. * @returns {number} Returns the index at which `value` should be inserted
  25655. * into `array`.
  25656. * @example
  25657. *
  25658. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25659. *
  25660. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25661. * // => 1
  25662. *
  25663. * // The `_.property` iteratee shorthand.
  25664. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  25665. * // => 1
  25666. */
  25667. function sortedLastIndexBy(array, value, iteratee) {
  25668. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  25669. }
  25670. /**
  25671. * This method is like `_.lastIndexOf` except that it performs a binary
  25672. * search on a sorted `array`.
  25673. *
  25674. * @static
  25675. * @memberOf _
  25676. * @since 4.0.0
  25677. * @category Array
  25678. * @param {Array} array The array to inspect.
  25679. * @param {*} value The value to search for.
  25680. * @returns {number} Returns the index of the matched value, else `-1`.
  25681. * @example
  25682. *
  25683. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  25684. * // => 3
  25685. */
  25686. function sortedLastIndexOf(array, value) {
  25687. var length = array == null ? 0 : array.length;
  25688. if (length) {
  25689. var index = baseSortedIndex(array, value, true) - 1;
  25690. if (eq(array[index], value)) {
  25691. return index;
  25692. }
  25693. }
  25694. return -1;
  25695. }
  25696. /**
  25697. * This method is like `_.uniq` except that it's designed and optimized
  25698. * for sorted arrays.
  25699. *
  25700. * @static
  25701. * @memberOf _
  25702. * @since 4.0.0
  25703. * @category Array
  25704. * @param {Array} array The array to inspect.
  25705. * @returns {Array} Returns the new duplicate free array.
  25706. * @example
  25707. *
  25708. * _.sortedUniq([1, 1, 2]);
  25709. * // => [1, 2]
  25710. */
  25711. function sortedUniq(array) {
  25712. return (array && array.length)
  25713. ? baseSortedUniq(array)
  25714. : [];
  25715. }
  25716. /**
  25717. * This method is like `_.uniqBy` except that it's designed and optimized
  25718. * for sorted arrays.
  25719. *
  25720. * @static
  25721. * @memberOf _
  25722. * @since 4.0.0
  25723. * @category Array
  25724. * @param {Array} array The array to inspect.
  25725. * @param {Function} [iteratee] The iteratee invoked per element.
  25726. * @returns {Array} Returns the new duplicate free array.
  25727. * @example
  25728. *
  25729. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  25730. * // => [1.1, 2.3]
  25731. */
  25732. function sortedUniqBy(array, iteratee) {
  25733. return (array && array.length)
  25734. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  25735. : [];
  25736. }
  25737. /**
  25738. * Gets all but the first element of `array`.
  25739. *
  25740. * @static
  25741. * @memberOf _
  25742. * @since 4.0.0
  25743. * @category Array
  25744. * @param {Array} array The array to query.
  25745. * @returns {Array} Returns the slice of `array`.
  25746. * @example
  25747. *
  25748. * _.tail([1, 2, 3]);
  25749. * // => [2, 3]
  25750. */
  25751. function tail(array) {
  25752. var length = array == null ? 0 : array.length;
  25753. return length ? baseSlice(array, 1, length) : [];
  25754. }
  25755. /**
  25756. * Creates a slice of `array` with `n` elements taken from the beginning.
  25757. *
  25758. * @static
  25759. * @memberOf _
  25760. * @since 0.1.0
  25761. * @category Array
  25762. * @param {Array} array The array to query.
  25763. * @param {number} [n=1] The number of elements to take.
  25764. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25765. * @returns {Array} Returns the slice of `array`.
  25766. * @example
  25767. *
  25768. * _.take([1, 2, 3]);
  25769. * // => [1]
  25770. *
  25771. * _.take([1, 2, 3], 2);
  25772. * // => [1, 2]
  25773. *
  25774. * _.take([1, 2, 3], 5);
  25775. * // => [1, 2, 3]
  25776. *
  25777. * _.take([1, 2, 3], 0);
  25778. * // => []
  25779. */
  25780. function take(array, n, guard) {
  25781. if (!(array && array.length)) {
  25782. return [];
  25783. }
  25784. n = (guard || n === undefined) ? 1 : toInteger(n);
  25785. return baseSlice(array, 0, n < 0 ? 0 : n);
  25786. }
  25787. /**
  25788. * Creates a slice of `array` with `n` elements taken from the end.
  25789. *
  25790. * @static
  25791. * @memberOf _
  25792. * @since 3.0.0
  25793. * @category Array
  25794. * @param {Array} array The array to query.
  25795. * @param {number} [n=1] The number of elements to take.
  25796. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25797. * @returns {Array} Returns the slice of `array`.
  25798. * @example
  25799. *
  25800. * _.takeRight([1, 2, 3]);
  25801. * // => [3]
  25802. *
  25803. * _.takeRight([1, 2, 3], 2);
  25804. * // => [2, 3]
  25805. *
  25806. * _.takeRight([1, 2, 3], 5);
  25807. * // => [1, 2, 3]
  25808. *
  25809. * _.takeRight([1, 2, 3], 0);
  25810. * // => []
  25811. */
  25812. function takeRight(array, n, guard) {
  25813. var length = array == null ? 0 : array.length;
  25814. if (!length) {
  25815. return [];
  25816. }
  25817. n = (guard || n === undefined) ? 1 : toInteger(n);
  25818. n = length - n;
  25819. return baseSlice(array, n < 0 ? 0 : n, length);
  25820. }
  25821. /**
  25822. * Creates a slice of `array` with elements taken from the end. Elements are
  25823. * taken until `predicate` returns falsey. The predicate is invoked with
  25824. * three arguments: (value, index, array).
  25825. *
  25826. * @static
  25827. * @memberOf _
  25828. * @since 3.0.0
  25829. * @category Array
  25830. * @param {Array} array The array to query.
  25831. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25832. * @returns {Array} Returns the slice of `array`.
  25833. * @example
  25834. *
  25835. * var users = [
  25836. * { 'user': 'barney', 'active': true },
  25837. * { 'user': 'fred', 'active': false },
  25838. * { 'user': 'pebbles', 'active': false }
  25839. * ];
  25840. *
  25841. * _.takeRightWhile(users, function(o) { return !o.active; });
  25842. * // => objects for ['fred', 'pebbles']
  25843. *
  25844. * // The `_.matches` iteratee shorthand.
  25845. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  25846. * // => objects for ['pebbles']
  25847. *
  25848. * // The `_.matchesProperty` iteratee shorthand.
  25849. * _.takeRightWhile(users, ['active', false]);
  25850. * // => objects for ['fred', 'pebbles']
  25851. *
  25852. * // The `_.property` iteratee shorthand.
  25853. * _.takeRightWhile(users, 'active');
  25854. * // => []
  25855. */
  25856. function takeRightWhile(array, predicate) {
  25857. return (array && array.length)
  25858. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  25859. : [];
  25860. }
  25861. /**
  25862. * Creates a slice of `array` with elements taken from the beginning. Elements
  25863. * are taken until `predicate` returns falsey. The predicate is invoked with
  25864. * three arguments: (value, index, array).
  25865. *
  25866. * @static
  25867. * @memberOf _
  25868. * @since 3.0.0
  25869. * @category Array
  25870. * @param {Array} array The array to query.
  25871. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25872. * @returns {Array} Returns the slice of `array`.
  25873. * @example
  25874. *
  25875. * var users = [
  25876. * { 'user': 'barney', 'active': false },
  25877. * { 'user': 'fred', 'active': false },
  25878. * { 'user': 'pebbles', 'active': true }
  25879. * ];
  25880. *
  25881. * _.takeWhile(users, function(o) { return !o.active; });
  25882. * // => objects for ['barney', 'fred']
  25883. *
  25884. * // The `_.matches` iteratee shorthand.
  25885. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  25886. * // => objects for ['barney']
  25887. *
  25888. * // The `_.matchesProperty` iteratee shorthand.
  25889. * _.takeWhile(users, ['active', false]);
  25890. * // => objects for ['barney', 'fred']
  25891. *
  25892. * // The `_.property` iteratee shorthand.
  25893. * _.takeWhile(users, 'active');
  25894. * // => []
  25895. */
  25896. function takeWhile(array, predicate) {
  25897. return (array && array.length)
  25898. ? baseWhile(array, getIteratee(predicate, 3))
  25899. : [];
  25900. }
  25901. /**
  25902. * Creates an array of unique values, in order, from all given arrays using
  25903. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25904. * for equality comparisons.
  25905. *
  25906. * @static
  25907. * @memberOf _
  25908. * @since 0.1.0
  25909. * @category Array
  25910. * @param {...Array} [arrays] The arrays to inspect.
  25911. * @returns {Array} Returns the new array of combined values.
  25912. * @example
  25913. *
  25914. * _.union([2], [1, 2]);
  25915. * // => [2, 1]
  25916. */
  25917. var union = baseRest(function(arrays) {
  25918. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  25919. });
  25920. /**
  25921. * This method is like `_.union` except that it accepts `iteratee` which is
  25922. * invoked for each element of each `arrays` to generate the criterion by
  25923. * which uniqueness is computed. Result values are chosen from the first
  25924. * array in which the value occurs. The iteratee is invoked with one argument:
  25925. * (value).
  25926. *
  25927. * @static
  25928. * @memberOf _
  25929. * @since 4.0.0
  25930. * @category Array
  25931. * @param {...Array} [arrays] The arrays to inspect.
  25932. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25933. * @returns {Array} Returns the new array of combined values.
  25934. * @example
  25935. *
  25936. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  25937. * // => [2.1, 1.2]
  25938. *
  25939. * // The `_.property` iteratee shorthand.
  25940. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25941. * // => [{ 'x': 1 }, { 'x': 2 }]
  25942. */
  25943. var unionBy = baseRest(function(arrays) {
  25944. var iteratee = last(arrays);
  25945. if (isArrayLikeObject(iteratee)) {
  25946. iteratee = undefined;
  25947. }
  25948. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  25949. });
  25950. /**
  25951. * This method is like `_.union` except that it accepts `comparator` which
  25952. * is invoked to compare elements of `arrays`. Result values are chosen from
  25953. * the first array in which the value occurs. The comparator is invoked
  25954. * with two arguments: (arrVal, othVal).
  25955. *
  25956. * @static
  25957. * @memberOf _
  25958. * @since 4.0.0
  25959. * @category Array
  25960. * @param {...Array} [arrays] The arrays to inspect.
  25961. * @param {Function} [comparator] The comparator invoked per element.
  25962. * @returns {Array} Returns the new array of combined values.
  25963. * @example
  25964. *
  25965. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25966. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25967. *
  25968. * _.unionWith(objects, others, _.isEqual);
  25969. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  25970. */
  25971. var unionWith = baseRest(function(arrays) {
  25972. var comparator = last(arrays);
  25973. comparator = typeof comparator == 'function' ? comparator : undefined;
  25974. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  25975. });
  25976. /**
  25977. * Creates a duplicate-free version of an array, using
  25978. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25979. * for equality comparisons, in which only the first occurrence of each element
  25980. * is kept. The order of result values is determined by the order they occur
  25981. * in the array.
  25982. *
  25983. * @static
  25984. * @memberOf _
  25985. * @since 0.1.0
  25986. * @category Array
  25987. * @param {Array} array The array to inspect.
  25988. * @returns {Array} Returns the new duplicate free array.
  25989. * @example
  25990. *
  25991. * _.uniq([2, 1, 2]);
  25992. * // => [2, 1]
  25993. */
  25994. function uniq(array) {
  25995. return (array && array.length) ? baseUniq(array) : [];
  25996. }
  25997. /**
  25998. * This method is like `_.uniq` except that it accepts `iteratee` which is
  25999. * invoked for each element in `array` to generate the criterion by which
  26000. * uniqueness is computed. The order of result values is determined by the
  26001. * order they occur in the array. The iteratee is invoked with one argument:
  26002. * (value).
  26003. *
  26004. * @static
  26005. * @memberOf _
  26006. * @since 4.0.0
  26007. * @category Array
  26008. * @param {Array} array The array to inspect.
  26009. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26010. * @returns {Array} Returns the new duplicate free array.
  26011. * @example
  26012. *
  26013. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  26014. * // => [2.1, 1.2]
  26015. *
  26016. * // The `_.property` iteratee shorthand.
  26017. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  26018. * // => [{ 'x': 1 }, { 'x': 2 }]
  26019. */
  26020. function uniqBy(array, iteratee) {
  26021. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  26022. }
  26023. /**
  26024. * This method is like `_.uniq` except that it accepts `comparator` which
  26025. * is invoked to compare elements of `array`. The order of result values is
  26026. * determined by the order they occur in the array.The comparator is invoked
  26027. * with two arguments: (arrVal, othVal).
  26028. *
  26029. * @static
  26030. * @memberOf _
  26031. * @since 4.0.0
  26032. * @category Array
  26033. * @param {Array} array The array to inspect.
  26034. * @param {Function} [comparator] The comparator invoked per element.
  26035. * @returns {Array} Returns the new duplicate free array.
  26036. * @example
  26037. *
  26038. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26039. *
  26040. * _.uniqWith(objects, _.isEqual);
  26041. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  26042. */
  26043. function uniqWith(array, comparator) {
  26044. comparator = typeof comparator == 'function' ? comparator : undefined;
  26045. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  26046. }
  26047. /**
  26048. * This method is like `_.zip` except that it accepts an array of grouped
  26049. * elements and creates an array regrouping the elements to their pre-zip
  26050. * configuration.
  26051. *
  26052. * @static
  26053. * @memberOf _
  26054. * @since 1.2.0
  26055. * @category Array
  26056. * @param {Array} array The array of grouped elements to process.
  26057. * @returns {Array} Returns the new array of regrouped elements.
  26058. * @example
  26059. *
  26060. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  26061. * // => [['a', 1, true], ['b', 2, false]]
  26062. *
  26063. * _.unzip(zipped);
  26064. * // => [['a', 'b'], [1, 2], [true, false]]
  26065. */
  26066. function unzip(array) {
  26067. if (!(array && array.length)) {
  26068. return [];
  26069. }
  26070. var length = 0;
  26071. array = arrayFilter(array, function(group) {
  26072. if (isArrayLikeObject(group)) {
  26073. length = nativeMax(group.length, length);
  26074. return true;
  26075. }
  26076. });
  26077. return baseTimes(length, function(index) {
  26078. return arrayMap(array, baseProperty(index));
  26079. });
  26080. }
  26081. /**
  26082. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  26083. * how regrouped values should be combined. The iteratee is invoked with the
  26084. * elements of each group: (...group).
  26085. *
  26086. * @static
  26087. * @memberOf _
  26088. * @since 3.8.0
  26089. * @category Array
  26090. * @param {Array} array The array of grouped elements to process.
  26091. * @param {Function} [iteratee=_.identity] The function to combine
  26092. * regrouped values.
  26093. * @returns {Array} Returns the new array of regrouped elements.
  26094. * @example
  26095. *
  26096. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  26097. * // => [[1, 10, 100], [2, 20, 200]]
  26098. *
  26099. * _.unzipWith(zipped, _.add);
  26100. * // => [3, 30, 300]
  26101. */
  26102. function unzipWith(array, iteratee) {
  26103. if (!(array && array.length)) {
  26104. return [];
  26105. }
  26106. var result = unzip(array);
  26107. if (iteratee == null) {
  26108. return result;
  26109. }
  26110. return arrayMap(result, function(group) {
  26111. return apply(iteratee, undefined, group);
  26112. });
  26113. }
  26114. /**
  26115. * Creates an array excluding all given values using
  26116. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26117. * for equality comparisons.
  26118. *
  26119. * **Note:** Unlike `_.pull`, this method returns a new array.
  26120. *
  26121. * @static
  26122. * @memberOf _
  26123. * @since 0.1.0
  26124. * @category Array
  26125. * @param {Array} array The array to inspect.
  26126. * @param {...*} [values] The values to exclude.
  26127. * @returns {Array} Returns the new array of filtered values.
  26128. * @see _.difference, _.xor
  26129. * @example
  26130. *
  26131. * _.without([2, 1, 2, 3], 1, 2);
  26132. * // => [3]
  26133. */
  26134. var without = baseRest(function(array, values) {
  26135. return isArrayLikeObject(array)
  26136. ? baseDifference(array, values)
  26137. : [];
  26138. });
  26139. /**
  26140. * Creates an array of unique values that is the
  26141. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  26142. * of the given arrays. The order of result values is determined by the order
  26143. * they occur in the arrays.
  26144. *
  26145. * @static
  26146. * @memberOf _
  26147. * @since 2.4.0
  26148. * @category Array
  26149. * @param {...Array} [arrays] The arrays to inspect.
  26150. * @returns {Array} Returns the new array of filtered values.
  26151. * @see _.difference, _.without
  26152. * @example
  26153. *
  26154. * _.xor([2, 1], [2, 3]);
  26155. * // => [1, 3]
  26156. */
  26157. var xor = baseRest(function(arrays) {
  26158. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  26159. });
  26160. /**
  26161. * This method is like `_.xor` except that it accepts `iteratee` which is
  26162. * invoked for each element of each `arrays` to generate the criterion by
  26163. * which by which they're compared. The order of result values is determined
  26164. * by the order they occur in the arrays. The iteratee is invoked with one
  26165. * argument: (value).
  26166. *
  26167. * @static
  26168. * @memberOf _
  26169. * @since 4.0.0
  26170. * @category Array
  26171. * @param {...Array} [arrays] The arrays to inspect.
  26172. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26173. * @returns {Array} Returns the new array of filtered values.
  26174. * @example
  26175. *
  26176. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  26177. * // => [1.2, 3.4]
  26178. *
  26179. * // The `_.property` iteratee shorthand.
  26180. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26181. * // => [{ 'x': 2 }]
  26182. */
  26183. var xorBy = baseRest(function(arrays) {
  26184. var iteratee = last(arrays);
  26185. if (isArrayLikeObject(iteratee)) {
  26186. iteratee = undefined;
  26187. }
  26188. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  26189. });
  26190. /**
  26191. * This method is like `_.xor` except that it accepts `comparator` which is
  26192. * invoked to compare elements of `arrays`. The order of result values is
  26193. * determined by the order they occur in the arrays. The comparator is invoked
  26194. * with two arguments: (arrVal, othVal).
  26195. *
  26196. * @static
  26197. * @memberOf _
  26198. * @since 4.0.0
  26199. * @category Array
  26200. * @param {...Array} [arrays] The arrays to inspect.
  26201. * @param {Function} [comparator] The comparator invoked per element.
  26202. * @returns {Array} Returns the new array of filtered values.
  26203. * @example
  26204. *
  26205. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26206. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26207. *
  26208. * _.xorWith(objects, others, _.isEqual);
  26209. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26210. */
  26211. var xorWith = baseRest(function(arrays) {
  26212. var comparator = last(arrays);
  26213. comparator = typeof comparator == 'function' ? comparator : undefined;
  26214. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  26215. });
  26216. /**
  26217. * Creates an array of grouped elements, the first of which contains the
  26218. * first elements of the given arrays, the second of which contains the
  26219. * second elements of the given arrays, and so on.
  26220. *
  26221. * @static
  26222. * @memberOf _
  26223. * @since 0.1.0
  26224. * @category Array
  26225. * @param {...Array} [arrays] The arrays to process.
  26226. * @returns {Array} Returns the new array of grouped elements.
  26227. * @example
  26228. *
  26229. * _.zip(['a', 'b'], [1, 2], [true, false]);
  26230. * // => [['a', 1, true], ['b', 2, false]]
  26231. */
  26232. var zip = baseRest(unzip);
  26233. /**
  26234. * This method is like `_.fromPairs` except that it accepts two arrays,
  26235. * one of property identifiers and one of corresponding values.
  26236. *
  26237. * @static
  26238. * @memberOf _
  26239. * @since 0.4.0
  26240. * @category Array
  26241. * @param {Array} [props=[]] The property identifiers.
  26242. * @param {Array} [values=[]] The property values.
  26243. * @returns {Object} Returns the new object.
  26244. * @example
  26245. *
  26246. * _.zipObject(['a', 'b'], [1, 2]);
  26247. * // => { 'a': 1, 'b': 2 }
  26248. */
  26249. function zipObject(props, values) {
  26250. return baseZipObject(props || [], values || [], assignValue);
  26251. }
  26252. /**
  26253. * This method is like `_.zipObject` except that it supports property paths.
  26254. *
  26255. * @static
  26256. * @memberOf _
  26257. * @since 4.1.0
  26258. * @category Array
  26259. * @param {Array} [props=[]] The property identifiers.
  26260. * @param {Array} [values=[]] The property values.
  26261. * @returns {Object} Returns the new object.
  26262. * @example
  26263. *
  26264. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  26265. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  26266. */
  26267. function zipObjectDeep(props, values) {
  26268. return baseZipObject(props || [], values || [], baseSet);
  26269. }
  26270. /**
  26271. * This method is like `_.zip` except that it accepts `iteratee` to specify
  26272. * how grouped values should be combined. The iteratee is invoked with the
  26273. * elements of each group: (...group).
  26274. *
  26275. * @static
  26276. * @memberOf _
  26277. * @since 3.8.0
  26278. * @category Array
  26279. * @param {...Array} [arrays] The arrays to process.
  26280. * @param {Function} [iteratee=_.identity] The function to combine
  26281. * grouped values.
  26282. * @returns {Array} Returns the new array of grouped elements.
  26283. * @example
  26284. *
  26285. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  26286. * return a + b + c;
  26287. * });
  26288. * // => [111, 222]
  26289. */
  26290. var zipWith = baseRest(function(arrays) {
  26291. var length = arrays.length,
  26292. iteratee = length > 1 ? arrays[length - 1] : undefined;
  26293. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  26294. return unzipWith(arrays, iteratee);
  26295. });
  26296. /*------------------------------------------------------------------------*/
  26297. /**
  26298. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  26299. * chain sequences enabled. The result of such sequences must be unwrapped
  26300. * with `_#value`.
  26301. *
  26302. * @static
  26303. * @memberOf _
  26304. * @since 1.3.0
  26305. * @category Seq
  26306. * @param {*} value The value to wrap.
  26307. * @returns {Object} Returns the new `lodash` wrapper instance.
  26308. * @example
  26309. *
  26310. * var users = [
  26311. * { 'user': 'barney', 'age': 36 },
  26312. * { 'user': 'fred', 'age': 40 },
  26313. * { 'user': 'pebbles', 'age': 1 }
  26314. * ];
  26315. *
  26316. * var youngest = _
  26317. * .chain(users)
  26318. * .sortBy('age')
  26319. * .map(function(o) {
  26320. * return o.user + ' is ' + o.age;
  26321. * })
  26322. * .head()
  26323. * .value();
  26324. * // => 'pebbles is 1'
  26325. */
  26326. function chain(value) {
  26327. var result = lodash(value);
  26328. result.__chain__ = true;
  26329. return result;
  26330. }
  26331. /**
  26332. * This method invokes `interceptor` and returns `value`. The interceptor
  26333. * is invoked with one argument; (value). The purpose of this method is to
  26334. * "tap into" a method chain sequence in order to modify intermediate results.
  26335. *
  26336. * @static
  26337. * @memberOf _
  26338. * @since 0.1.0
  26339. * @category Seq
  26340. * @param {*} value The value to provide to `interceptor`.
  26341. * @param {Function} interceptor The function to invoke.
  26342. * @returns {*} Returns `value`.
  26343. * @example
  26344. *
  26345. * _([1, 2, 3])
  26346. * .tap(function(array) {
  26347. * // Mutate input array.
  26348. * array.pop();
  26349. * })
  26350. * .reverse()
  26351. * .value();
  26352. * // => [2, 1]
  26353. */
  26354. function tap(value, interceptor) {
  26355. interceptor(value);
  26356. return value;
  26357. }
  26358. /**
  26359. * This method is like `_.tap` except that it returns the result of `interceptor`.
  26360. * The purpose of this method is to "pass thru" values replacing intermediate
  26361. * results in a method chain sequence.
  26362. *
  26363. * @static
  26364. * @memberOf _
  26365. * @since 3.0.0
  26366. * @category Seq
  26367. * @param {*} value The value to provide to `interceptor`.
  26368. * @param {Function} interceptor The function to invoke.
  26369. * @returns {*} Returns the result of `interceptor`.
  26370. * @example
  26371. *
  26372. * _(' abc ')
  26373. * .chain()
  26374. * .trim()
  26375. * .thru(function(value) {
  26376. * return [value];
  26377. * })
  26378. * .value();
  26379. * // => ['abc']
  26380. */
  26381. function thru(value, interceptor) {
  26382. return interceptor(value);
  26383. }
  26384. /**
  26385. * This method is the wrapper version of `_.at`.
  26386. *
  26387. * @name at
  26388. * @memberOf _
  26389. * @since 1.0.0
  26390. * @category Seq
  26391. * @param {...(string|string[])} [paths] The property paths to pick.
  26392. * @returns {Object} Returns the new `lodash` wrapper instance.
  26393. * @example
  26394. *
  26395. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  26396. *
  26397. * _(object).at(['a[0].b.c', 'a[1]']).value();
  26398. * // => [3, 4]
  26399. */
  26400. var wrapperAt = flatRest(function(paths) {
  26401. var length = paths.length,
  26402. start = length ? paths[0] : 0,
  26403. value = this.__wrapped__,
  26404. interceptor = function(object) { return baseAt(object, paths); };
  26405. if (length > 1 || this.__actions__.length ||
  26406. !(value instanceof LazyWrapper) || !isIndex(start)) {
  26407. return this.thru(interceptor);
  26408. }
  26409. value = value.slice(start, +start + (length ? 1 : 0));
  26410. value.__actions__.push({
  26411. 'func': thru,
  26412. 'args': [interceptor],
  26413. 'thisArg': undefined
  26414. });
  26415. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  26416. if (length && !array.length) {
  26417. array.push(undefined);
  26418. }
  26419. return array;
  26420. });
  26421. });
  26422. /**
  26423. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  26424. *
  26425. * @name chain
  26426. * @memberOf _
  26427. * @since 0.1.0
  26428. * @category Seq
  26429. * @returns {Object} Returns the new `lodash` wrapper instance.
  26430. * @example
  26431. *
  26432. * var users = [
  26433. * { 'user': 'barney', 'age': 36 },
  26434. * { 'user': 'fred', 'age': 40 }
  26435. * ];
  26436. *
  26437. * // A sequence without explicit chaining.
  26438. * _(users).head();
  26439. * // => { 'user': 'barney', 'age': 36 }
  26440. *
  26441. * // A sequence with explicit chaining.
  26442. * _(users)
  26443. * .chain()
  26444. * .head()
  26445. * .pick('user')
  26446. * .value();
  26447. * // => { 'user': 'barney' }
  26448. */
  26449. function wrapperChain() {
  26450. return chain(this);
  26451. }
  26452. /**
  26453. * Executes the chain sequence and returns the wrapped result.
  26454. *
  26455. * @name commit
  26456. * @memberOf _
  26457. * @since 3.2.0
  26458. * @category Seq
  26459. * @returns {Object} Returns the new `lodash` wrapper instance.
  26460. * @example
  26461. *
  26462. * var array = [1, 2];
  26463. * var wrapped = _(array).push(3);
  26464. *
  26465. * console.log(array);
  26466. * // => [1, 2]
  26467. *
  26468. * wrapped = wrapped.commit();
  26469. * console.log(array);
  26470. * // => [1, 2, 3]
  26471. *
  26472. * wrapped.last();
  26473. * // => 3
  26474. *
  26475. * console.log(array);
  26476. * // => [1, 2, 3]
  26477. */
  26478. function wrapperCommit() {
  26479. return new LodashWrapper(this.value(), this.__chain__);
  26480. }
  26481. /**
  26482. * Gets the next value on a wrapped object following the
  26483. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  26484. *
  26485. * @name next
  26486. * @memberOf _
  26487. * @since 4.0.0
  26488. * @category Seq
  26489. * @returns {Object} Returns the next iterator value.
  26490. * @example
  26491. *
  26492. * var wrapped = _([1, 2]);
  26493. *
  26494. * wrapped.next();
  26495. * // => { 'done': false, 'value': 1 }
  26496. *
  26497. * wrapped.next();
  26498. * // => { 'done': false, 'value': 2 }
  26499. *
  26500. * wrapped.next();
  26501. * // => { 'done': true, 'value': undefined }
  26502. */
  26503. function wrapperNext() {
  26504. if (this.__values__ === undefined) {
  26505. this.__values__ = toArray(this.value());
  26506. }
  26507. var done = this.__index__ >= this.__values__.length,
  26508. value = done ? undefined : this.__values__[this.__index__++];
  26509. return { 'done': done, 'value': value };
  26510. }
  26511. /**
  26512. * Enables the wrapper to be iterable.
  26513. *
  26514. * @name Symbol.iterator
  26515. * @memberOf _
  26516. * @since 4.0.0
  26517. * @category Seq
  26518. * @returns {Object} Returns the wrapper object.
  26519. * @example
  26520. *
  26521. * var wrapped = _([1, 2]);
  26522. *
  26523. * wrapped[Symbol.iterator]() === wrapped;
  26524. * // => true
  26525. *
  26526. * Array.from(wrapped);
  26527. * // => [1, 2]
  26528. */
  26529. function wrapperToIterator() {
  26530. return this;
  26531. }
  26532. /**
  26533. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  26534. *
  26535. * @name plant
  26536. * @memberOf _
  26537. * @since 3.2.0
  26538. * @category Seq
  26539. * @param {*} value The value to plant.
  26540. * @returns {Object} Returns the new `lodash` wrapper instance.
  26541. * @example
  26542. *
  26543. * function square(n) {
  26544. * return n * n;
  26545. * }
  26546. *
  26547. * var wrapped = _([1, 2]).map(square);
  26548. * var other = wrapped.plant([3, 4]);
  26549. *
  26550. * other.value();
  26551. * // => [9, 16]
  26552. *
  26553. * wrapped.value();
  26554. * // => [1, 4]
  26555. */
  26556. function wrapperPlant(value) {
  26557. var result,
  26558. parent = this;
  26559. while (parent instanceof baseLodash) {
  26560. var clone = wrapperClone(parent);
  26561. clone.__index__ = 0;
  26562. clone.__values__ = undefined;
  26563. if (result) {
  26564. previous.__wrapped__ = clone;
  26565. } else {
  26566. result = clone;
  26567. }
  26568. var previous = clone;
  26569. parent = parent.__wrapped__;
  26570. }
  26571. previous.__wrapped__ = value;
  26572. return result;
  26573. }
  26574. /**
  26575. * This method is the wrapper version of `_.reverse`.
  26576. *
  26577. * **Note:** This method mutates the wrapped array.
  26578. *
  26579. * @name reverse
  26580. * @memberOf _
  26581. * @since 0.1.0
  26582. * @category Seq
  26583. * @returns {Object} Returns the new `lodash` wrapper instance.
  26584. * @example
  26585. *
  26586. * var array = [1, 2, 3];
  26587. *
  26588. * _(array).reverse().value()
  26589. * // => [3, 2, 1]
  26590. *
  26591. * console.log(array);
  26592. * // => [3, 2, 1]
  26593. */
  26594. function wrapperReverse() {
  26595. var value = this.__wrapped__;
  26596. if (value instanceof LazyWrapper) {
  26597. var wrapped = value;
  26598. if (this.__actions__.length) {
  26599. wrapped = new LazyWrapper(this);
  26600. }
  26601. wrapped = wrapped.reverse();
  26602. wrapped.__actions__.push({
  26603. 'func': thru,
  26604. 'args': [reverse],
  26605. 'thisArg': undefined
  26606. });
  26607. return new LodashWrapper(wrapped, this.__chain__);
  26608. }
  26609. return this.thru(reverse);
  26610. }
  26611. /**
  26612. * Executes the chain sequence to resolve the unwrapped value.
  26613. *
  26614. * @name value
  26615. * @memberOf _
  26616. * @since 0.1.0
  26617. * @alias toJSON, valueOf
  26618. * @category Seq
  26619. * @returns {*} Returns the resolved unwrapped value.
  26620. * @example
  26621. *
  26622. * _([1, 2, 3]).value();
  26623. * // => [1, 2, 3]
  26624. */
  26625. function wrapperValue() {
  26626. return baseWrapperValue(this.__wrapped__, this.__actions__);
  26627. }
  26628. /*------------------------------------------------------------------------*/
  26629. /**
  26630. * Creates an object composed of keys generated from the results of running
  26631. * each element of `collection` thru `iteratee`. The corresponding value of
  26632. * each key is the number of times the key was returned by `iteratee`. The
  26633. * iteratee is invoked with one argument: (value).
  26634. *
  26635. * @static
  26636. * @memberOf _
  26637. * @since 0.5.0
  26638. * @category Collection
  26639. * @param {Array|Object} collection The collection to iterate over.
  26640. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26641. * @returns {Object} Returns the composed aggregate object.
  26642. * @example
  26643. *
  26644. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  26645. * // => { '4': 1, '6': 2 }
  26646. *
  26647. * // The `_.property` iteratee shorthand.
  26648. * _.countBy(['one', 'two', 'three'], 'length');
  26649. * // => { '3': 2, '5': 1 }
  26650. */
  26651. var countBy = createAggregator(function(result, value, key) {
  26652. if (hasOwnProperty.call(result, key)) {
  26653. ++result[key];
  26654. } else {
  26655. baseAssignValue(result, key, 1);
  26656. }
  26657. });
  26658. /**
  26659. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  26660. * Iteration is stopped once `predicate` returns falsey. The predicate is
  26661. * invoked with three arguments: (value, index|key, collection).
  26662. *
  26663. * **Note:** This method returns `true` for
  26664. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  26665. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  26666. * elements of empty collections.
  26667. *
  26668. * @static
  26669. * @memberOf _
  26670. * @since 0.1.0
  26671. * @category Collection
  26672. * @param {Array|Object} collection The collection to iterate over.
  26673. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26674. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26675. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  26676. * else `false`.
  26677. * @example
  26678. *
  26679. * _.every([true, 1, null, 'yes'], Boolean);
  26680. * // => false
  26681. *
  26682. * var users = [
  26683. * { 'user': 'barney', 'age': 36, 'active': false },
  26684. * { 'user': 'fred', 'age': 40, 'active': false }
  26685. * ];
  26686. *
  26687. * // The `_.matches` iteratee shorthand.
  26688. * _.every(users, { 'user': 'barney', 'active': false });
  26689. * // => false
  26690. *
  26691. * // The `_.matchesProperty` iteratee shorthand.
  26692. * _.every(users, ['active', false]);
  26693. * // => true
  26694. *
  26695. * // The `_.property` iteratee shorthand.
  26696. * _.every(users, 'active');
  26697. * // => false
  26698. */
  26699. function every(collection, predicate, guard) {
  26700. var func = isArray(collection) ? arrayEvery : baseEvery;
  26701. if (guard && isIterateeCall(collection, predicate, guard)) {
  26702. predicate = undefined;
  26703. }
  26704. return func(collection, getIteratee(predicate, 3));
  26705. }
  26706. /**
  26707. * Iterates over elements of `collection`, returning an array of all elements
  26708. * `predicate` returns truthy for. The predicate is invoked with three
  26709. * arguments: (value, index|key, collection).
  26710. *
  26711. * **Note:** Unlike `_.remove`, this method returns a new array.
  26712. *
  26713. * @static
  26714. * @memberOf _
  26715. * @since 0.1.0
  26716. * @category Collection
  26717. * @param {Array|Object} collection The collection to iterate over.
  26718. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26719. * @returns {Array} Returns the new filtered array.
  26720. * @see _.reject
  26721. * @example
  26722. *
  26723. * var users = [
  26724. * { 'user': 'barney', 'age': 36, 'active': true },
  26725. * { 'user': 'fred', 'age': 40, 'active': false }
  26726. * ];
  26727. *
  26728. * _.filter(users, function(o) { return !o.active; });
  26729. * // => objects for ['fred']
  26730. *
  26731. * // The `_.matches` iteratee shorthand.
  26732. * _.filter(users, { 'age': 36, 'active': true });
  26733. * // => objects for ['barney']
  26734. *
  26735. * // The `_.matchesProperty` iteratee shorthand.
  26736. * _.filter(users, ['active', false]);
  26737. * // => objects for ['fred']
  26738. *
  26739. * // The `_.property` iteratee shorthand.
  26740. * _.filter(users, 'active');
  26741. * // => objects for ['barney']
  26742. */
  26743. function filter(collection, predicate) {
  26744. var func = isArray(collection) ? arrayFilter : baseFilter;
  26745. return func(collection, getIteratee(predicate, 3));
  26746. }
  26747. /**
  26748. * Iterates over elements of `collection`, returning the first element
  26749. * `predicate` returns truthy for. The predicate is invoked with three
  26750. * arguments: (value, index|key, collection).
  26751. *
  26752. * @static
  26753. * @memberOf _
  26754. * @since 0.1.0
  26755. * @category Collection
  26756. * @param {Array|Object} collection The collection to inspect.
  26757. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26758. * @param {number} [fromIndex=0] The index to search from.
  26759. * @returns {*} Returns the matched element, else `undefined`.
  26760. * @example
  26761. *
  26762. * var users = [
  26763. * { 'user': 'barney', 'age': 36, 'active': true },
  26764. * { 'user': 'fred', 'age': 40, 'active': false },
  26765. * { 'user': 'pebbles', 'age': 1, 'active': true }
  26766. * ];
  26767. *
  26768. * _.find(users, function(o) { return o.age < 40; });
  26769. * // => object for 'barney'
  26770. *
  26771. * // The `_.matches` iteratee shorthand.
  26772. * _.find(users, { 'age': 1, 'active': true });
  26773. * // => object for 'pebbles'
  26774. *
  26775. * // The `_.matchesProperty` iteratee shorthand.
  26776. * _.find(users, ['active', false]);
  26777. * // => object for 'fred'
  26778. *
  26779. * // The `_.property` iteratee shorthand.
  26780. * _.find(users, 'active');
  26781. * // => object for 'barney'
  26782. */
  26783. var find = createFind(findIndex);
  26784. /**
  26785. * This method is like `_.find` except that it iterates over elements of
  26786. * `collection` from right to left.
  26787. *
  26788. * @static
  26789. * @memberOf _
  26790. * @since 2.0.0
  26791. * @category Collection
  26792. * @param {Array|Object} collection The collection to inspect.
  26793. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26794. * @param {number} [fromIndex=collection.length-1] The index to search from.
  26795. * @returns {*} Returns the matched element, else `undefined`.
  26796. * @example
  26797. *
  26798. * _.findLast([1, 2, 3, 4], function(n) {
  26799. * return n % 2 == 1;
  26800. * });
  26801. * // => 3
  26802. */
  26803. var findLast = createFind(findLastIndex);
  26804. /**
  26805. * Creates a flattened array of values by running each element in `collection`
  26806. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  26807. * with three arguments: (value, index|key, collection).
  26808. *
  26809. * @static
  26810. * @memberOf _
  26811. * @since 4.0.0
  26812. * @category Collection
  26813. * @param {Array|Object} collection The collection to iterate over.
  26814. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26815. * @returns {Array} Returns the new flattened array.
  26816. * @example
  26817. *
  26818. * function duplicate(n) {
  26819. * return [n, n];
  26820. * }
  26821. *
  26822. * _.flatMap([1, 2], duplicate);
  26823. * // => [1, 1, 2, 2]
  26824. */
  26825. function flatMap(collection, iteratee) {
  26826. return baseFlatten(map(collection, iteratee), 1);
  26827. }
  26828. /**
  26829. * This method is like `_.flatMap` except that it recursively flattens the
  26830. * mapped results.
  26831. *
  26832. * @static
  26833. * @memberOf _
  26834. * @since 4.7.0
  26835. * @category Collection
  26836. * @param {Array|Object} collection The collection to iterate over.
  26837. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26838. * @returns {Array} Returns the new flattened array.
  26839. * @example
  26840. *
  26841. * function duplicate(n) {
  26842. * return [[[n, n]]];
  26843. * }
  26844. *
  26845. * _.flatMapDeep([1, 2], duplicate);
  26846. * // => [1, 1, 2, 2]
  26847. */
  26848. function flatMapDeep(collection, iteratee) {
  26849. return baseFlatten(map(collection, iteratee), INFINITY);
  26850. }
  26851. /**
  26852. * This method is like `_.flatMap` except that it recursively flattens the
  26853. * mapped results up to `depth` times.
  26854. *
  26855. * @static
  26856. * @memberOf _
  26857. * @since 4.7.0
  26858. * @category Collection
  26859. * @param {Array|Object} collection The collection to iterate over.
  26860. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26861. * @param {number} [depth=1] The maximum recursion depth.
  26862. * @returns {Array} Returns the new flattened array.
  26863. * @example
  26864. *
  26865. * function duplicate(n) {
  26866. * return [[[n, n]]];
  26867. * }
  26868. *
  26869. * _.flatMapDepth([1, 2], duplicate, 2);
  26870. * // => [[1, 1], [2, 2]]
  26871. */
  26872. function flatMapDepth(collection, iteratee, depth) {
  26873. depth = depth === undefined ? 1 : toInteger(depth);
  26874. return baseFlatten(map(collection, iteratee), depth);
  26875. }
  26876. /**
  26877. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  26878. * The iteratee is invoked with three arguments: (value, index|key, collection).
  26879. * Iteratee functions may exit iteration early by explicitly returning `false`.
  26880. *
  26881. * **Note:** As with other "Collections" methods, objects with a "length"
  26882. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  26883. * or `_.forOwn` for object iteration.
  26884. *
  26885. * @static
  26886. * @memberOf _
  26887. * @since 0.1.0
  26888. * @alias each
  26889. * @category Collection
  26890. * @param {Array|Object} collection The collection to iterate over.
  26891. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26892. * @returns {Array|Object} Returns `collection`.
  26893. * @see _.forEachRight
  26894. * @example
  26895. *
  26896. * _.forEach([1, 2], function(value) {
  26897. * console.log(value);
  26898. * });
  26899. * // => Logs `1` then `2`.
  26900. *
  26901. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  26902. * console.log(key);
  26903. * });
  26904. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  26905. */
  26906. function forEach(collection, iteratee) {
  26907. var func = isArray(collection) ? arrayEach : baseEach;
  26908. return func(collection, getIteratee(iteratee, 3));
  26909. }
  26910. /**
  26911. * This method is like `_.forEach` except that it iterates over elements of
  26912. * `collection` from right to left.
  26913. *
  26914. * @static
  26915. * @memberOf _
  26916. * @since 2.0.0
  26917. * @alias eachRight
  26918. * @category Collection
  26919. * @param {Array|Object} collection The collection to iterate over.
  26920. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26921. * @returns {Array|Object} Returns `collection`.
  26922. * @see _.forEach
  26923. * @example
  26924. *
  26925. * _.forEachRight([1, 2], function(value) {
  26926. * console.log(value);
  26927. * });
  26928. * // => Logs `2` then `1`.
  26929. */
  26930. function forEachRight(collection, iteratee) {
  26931. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  26932. return func(collection, getIteratee(iteratee, 3));
  26933. }
  26934. /**
  26935. * Creates an object composed of keys generated from the results of running
  26936. * each element of `collection` thru `iteratee`. The order of grouped values
  26937. * is determined by the order they occur in `collection`. The corresponding
  26938. * value of each key is an array of elements responsible for generating the
  26939. * key. The iteratee is invoked with one argument: (value).
  26940. *
  26941. * @static
  26942. * @memberOf _
  26943. * @since 0.1.0
  26944. * @category Collection
  26945. * @param {Array|Object} collection The collection to iterate over.
  26946. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26947. * @returns {Object} Returns the composed aggregate object.
  26948. * @example
  26949. *
  26950. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  26951. * // => { '4': [4.2], '6': [6.1, 6.3] }
  26952. *
  26953. * // The `_.property` iteratee shorthand.
  26954. * _.groupBy(['one', 'two', 'three'], 'length');
  26955. * // => { '3': ['one', 'two'], '5': ['three'] }
  26956. */
  26957. var groupBy = createAggregator(function(result, value, key) {
  26958. if (hasOwnProperty.call(result, key)) {
  26959. result[key].push(value);
  26960. } else {
  26961. baseAssignValue(result, key, [value]);
  26962. }
  26963. });
  26964. /**
  26965. * Checks if `value` is in `collection`. If `collection` is a string, it's
  26966. * checked for a substring of `value`, otherwise
  26967. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26968. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  26969. * the offset from the end of `collection`.
  26970. *
  26971. * @static
  26972. * @memberOf _
  26973. * @since 0.1.0
  26974. * @category Collection
  26975. * @param {Array|Object|string} collection The collection to inspect.
  26976. * @param {*} value The value to search for.
  26977. * @param {number} [fromIndex=0] The index to search from.
  26978. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  26979. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  26980. * @example
  26981. *
  26982. * _.includes([1, 2, 3], 1);
  26983. * // => true
  26984. *
  26985. * _.includes([1, 2, 3], 1, 2);
  26986. * // => false
  26987. *
  26988. * _.includes({ 'a': 1, 'b': 2 }, 1);
  26989. * // => true
  26990. *
  26991. * _.includes('abcd', 'bc');
  26992. * // => true
  26993. */
  26994. function includes(collection, value, fromIndex, guard) {
  26995. collection = isArrayLike(collection) ? collection : values(collection);
  26996. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  26997. var length = collection.length;
  26998. if (fromIndex < 0) {
  26999. fromIndex = nativeMax(length + fromIndex, 0);
  27000. }
  27001. return isString(collection)
  27002. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  27003. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  27004. }
  27005. /**
  27006. * Invokes the method at `path` of each element in `collection`, returning
  27007. * an array of the results of each invoked method. Any additional arguments
  27008. * are provided to each invoked method. If `path` is a function, it's invoked
  27009. * for, and `this` bound to, each element in `collection`.
  27010. *
  27011. * @static
  27012. * @memberOf _
  27013. * @since 4.0.0
  27014. * @category Collection
  27015. * @param {Array|Object} collection The collection to iterate over.
  27016. * @param {Array|Function|string} path The path of the method to invoke or
  27017. * the function invoked per iteration.
  27018. * @param {...*} [args] The arguments to invoke each method with.
  27019. * @returns {Array} Returns the array of results.
  27020. * @example
  27021. *
  27022. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  27023. * // => [[1, 5, 7], [1, 2, 3]]
  27024. *
  27025. * _.invokeMap([123, 456], String.prototype.split, '');
  27026. * // => [['1', '2', '3'], ['4', '5', '6']]
  27027. */
  27028. var invokeMap = baseRest(function(collection, path, args) {
  27029. var index = -1,
  27030. isFunc = typeof path == 'function',
  27031. result = isArrayLike(collection) ? Array(collection.length) : [];
  27032. baseEach(collection, function(value) {
  27033. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  27034. });
  27035. return result;
  27036. });
  27037. /**
  27038. * Creates an object composed of keys generated from the results of running
  27039. * each element of `collection` thru `iteratee`. The corresponding value of
  27040. * each key is the last element responsible for generating the key. The
  27041. * iteratee is invoked with one argument: (value).
  27042. *
  27043. * @static
  27044. * @memberOf _
  27045. * @since 4.0.0
  27046. * @category Collection
  27047. * @param {Array|Object} collection The collection to iterate over.
  27048. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27049. * @returns {Object} Returns the composed aggregate object.
  27050. * @example
  27051. *
  27052. * var array = [
  27053. * { 'dir': 'left', 'code': 97 },
  27054. * { 'dir': 'right', 'code': 100 }
  27055. * ];
  27056. *
  27057. * _.keyBy(array, function(o) {
  27058. * return String.fromCharCode(o.code);
  27059. * });
  27060. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  27061. *
  27062. * _.keyBy(array, 'dir');
  27063. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  27064. */
  27065. var keyBy = createAggregator(function(result, value, key) {
  27066. baseAssignValue(result, key, value);
  27067. });
  27068. /**
  27069. * Creates an array of values by running each element in `collection` thru
  27070. * `iteratee`. The iteratee is invoked with three arguments:
  27071. * (value, index|key, collection).
  27072. *
  27073. * Many lodash methods are guarded to work as iteratees for methods like
  27074. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  27075. *
  27076. * The guarded methods are:
  27077. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  27078. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  27079. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  27080. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  27081. *
  27082. * @static
  27083. * @memberOf _
  27084. * @since 0.1.0
  27085. * @category Collection
  27086. * @param {Array|Object} collection The collection to iterate over.
  27087. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27088. * @returns {Array} Returns the new mapped array.
  27089. * @example
  27090. *
  27091. * function square(n) {
  27092. * return n * n;
  27093. * }
  27094. *
  27095. * _.map([4, 8], square);
  27096. * // => [16, 64]
  27097. *
  27098. * _.map({ 'a': 4, 'b': 8 }, square);
  27099. * // => [16, 64] (iteration order is not guaranteed)
  27100. *
  27101. * var users = [
  27102. * { 'user': 'barney' },
  27103. * { 'user': 'fred' }
  27104. * ];
  27105. *
  27106. * // The `_.property` iteratee shorthand.
  27107. * _.map(users, 'user');
  27108. * // => ['barney', 'fred']
  27109. */
  27110. function map(collection, iteratee) {
  27111. var func = isArray(collection) ? arrayMap : baseMap;
  27112. return func(collection, getIteratee(iteratee, 3));
  27113. }
  27114. /**
  27115. * This method is like `_.sortBy` except that it allows specifying the sort
  27116. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  27117. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  27118. * descending or "asc" for ascending sort order of corresponding values.
  27119. *
  27120. * @static
  27121. * @memberOf _
  27122. * @since 4.0.0
  27123. * @category Collection
  27124. * @param {Array|Object} collection The collection to iterate over.
  27125. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  27126. * The iteratees to sort by.
  27127. * @param {string[]} [orders] The sort orders of `iteratees`.
  27128. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27129. * @returns {Array} Returns the new sorted array.
  27130. * @example
  27131. *
  27132. * var users = [
  27133. * { 'user': 'fred', 'age': 48 },
  27134. * { 'user': 'barney', 'age': 34 },
  27135. * { 'user': 'fred', 'age': 40 },
  27136. * { 'user': 'barney', 'age': 36 }
  27137. * ];
  27138. *
  27139. * // Sort by `user` in ascending order and by `age` in descending order.
  27140. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  27141. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27142. */
  27143. function orderBy(collection, iteratees, orders, guard) {
  27144. if (collection == null) {
  27145. return [];
  27146. }
  27147. if (!isArray(iteratees)) {
  27148. iteratees = iteratees == null ? [] : [iteratees];
  27149. }
  27150. orders = guard ? undefined : orders;
  27151. if (!isArray(orders)) {
  27152. orders = orders == null ? [] : [orders];
  27153. }
  27154. return baseOrderBy(collection, iteratees, orders);
  27155. }
  27156. /**
  27157. * Creates an array of elements split into two groups, the first of which
  27158. * contains elements `predicate` returns truthy for, the second of which
  27159. * contains elements `predicate` returns falsey for. The predicate is
  27160. * invoked with one argument: (value).
  27161. *
  27162. * @static
  27163. * @memberOf _
  27164. * @since 3.0.0
  27165. * @category Collection
  27166. * @param {Array|Object} collection The collection to iterate over.
  27167. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27168. * @returns {Array} Returns the array of grouped elements.
  27169. * @example
  27170. *
  27171. * var users = [
  27172. * { 'user': 'barney', 'age': 36, 'active': false },
  27173. * { 'user': 'fred', 'age': 40, 'active': true },
  27174. * { 'user': 'pebbles', 'age': 1, 'active': false }
  27175. * ];
  27176. *
  27177. * _.partition(users, function(o) { return o.active; });
  27178. * // => objects for [['fred'], ['barney', 'pebbles']]
  27179. *
  27180. * // The `_.matches` iteratee shorthand.
  27181. * _.partition(users, { 'age': 1, 'active': false });
  27182. * // => objects for [['pebbles'], ['barney', 'fred']]
  27183. *
  27184. * // The `_.matchesProperty` iteratee shorthand.
  27185. * _.partition(users, ['active', false]);
  27186. * // => objects for [['barney', 'pebbles'], ['fred']]
  27187. *
  27188. * // The `_.property` iteratee shorthand.
  27189. * _.partition(users, 'active');
  27190. * // => objects for [['fred'], ['barney', 'pebbles']]
  27191. */
  27192. var partition = createAggregator(function(result, value, key) {
  27193. result[key ? 0 : 1].push(value);
  27194. }, function() { return [[], []]; });
  27195. /**
  27196. * Reduces `collection` to a value which is the accumulated result of running
  27197. * each element in `collection` thru `iteratee`, where each successive
  27198. * invocation is supplied the return value of the previous. If `accumulator`
  27199. * is not given, the first element of `collection` is used as the initial
  27200. * value. The iteratee is invoked with four arguments:
  27201. * (accumulator, value, index|key, collection).
  27202. *
  27203. * Many lodash methods are guarded to work as iteratees for methods like
  27204. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  27205. *
  27206. * The guarded methods are:
  27207. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  27208. * and `sortBy`
  27209. *
  27210. * @static
  27211. * @memberOf _
  27212. * @since 0.1.0
  27213. * @category Collection
  27214. * @param {Array|Object} collection The collection to iterate over.
  27215. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27216. * @param {*} [accumulator] The initial value.
  27217. * @returns {*} Returns the accumulated value.
  27218. * @see _.reduceRight
  27219. * @example
  27220. *
  27221. * _.reduce([1, 2], function(sum, n) {
  27222. * return sum + n;
  27223. * }, 0);
  27224. * // => 3
  27225. *
  27226. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  27227. * (result[value] || (result[value] = [])).push(key);
  27228. * return result;
  27229. * }, {});
  27230. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  27231. */
  27232. function reduce(collection, iteratee, accumulator) {
  27233. var func = isArray(collection) ? arrayReduce : baseReduce,
  27234. initAccum = arguments.length < 3;
  27235. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  27236. }
  27237. /**
  27238. * This method is like `_.reduce` except that it iterates over elements of
  27239. * `collection` from right to left.
  27240. *
  27241. * @static
  27242. * @memberOf _
  27243. * @since 0.1.0
  27244. * @category Collection
  27245. * @param {Array|Object} collection The collection to iterate over.
  27246. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27247. * @param {*} [accumulator] The initial value.
  27248. * @returns {*} Returns the accumulated value.
  27249. * @see _.reduce
  27250. * @example
  27251. *
  27252. * var array = [[0, 1], [2, 3], [4, 5]];
  27253. *
  27254. * _.reduceRight(array, function(flattened, other) {
  27255. * return flattened.concat(other);
  27256. * }, []);
  27257. * // => [4, 5, 2, 3, 0, 1]
  27258. */
  27259. function reduceRight(collection, iteratee, accumulator) {
  27260. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  27261. initAccum = arguments.length < 3;
  27262. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  27263. }
  27264. /**
  27265. * The opposite of `_.filter`; this method returns the elements of `collection`
  27266. * that `predicate` does **not** return truthy for.
  27267. *
  27268. * @static
  27269. * @memberOf _
  27270. * @since 0.1.0
  27271. * @category Collection
  27272. * @param {Array|Object} collection The collection to iterate over.
  27273. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27274. * @returns {Array} Returns the new filtered array.
  27275. * @see _.filter
  27276. * @example
  27277. *
  27278. * var users = [
  27279. * { 'user': 'barney', 'age': 36, 'active': false },
  27280. * { 'user': 'fred', 'age': 40, 'active': true }
  27281. * ];
  27282. *
  27283. * _.reject(users, function(o) { return !o.active; });
  27284. * // => objects for ['fred']
  27285. *
  27286. * // The `_.matches` iteratee shorthand.
  27287. * _.reject(users, { 'age': 40, 'active': true });
  27288. * // => objects for ['barney']
  27289. *
  27290. * // The `_.matchesProperty` iteratee shorthand.
  27291. * _.reject(users, ['active', false]);
  27292. * // => objects for ['fred']
  27293. *
  27294. * // The `_.property` iteratee shorthand.
  27295. * _.reject(users, 'active');
  27296. * // => objects for ['barney']
  27297. */
  27298. function reject(collection, predicate) {
  27299. var func = isArray(collection) ? arrayFilter : baseFilter;
  27300. return func(collection, negate(getIteratee(predicate, 3)));
  27301. }
  27302. /**
  27303. * Gets a random element from `collection`.
  27304. *
  27305. * @static
  27306. * @memberOf _
  27307. * @since 2.0.0
  27308. * @category Collection
  27309. * @param {Array|Object} collection The collection to sample.
  27310. * @returns {*} Returns the random element.
  27311. * @example
  27312. *
  27313. * _.sample([1, 2, 3, 4]);
  27314. * // => 2
  27315. */
  27316. function sample(collection) {
  27317. var func = isArray(collection) ? arraySample : baseSample;
  27318. return func(collection);
  27319. }
  27320. /**
  27321. * Gets `n` random elements at unique keys from `collection` up to the
  27322. * size of `collection`.
  27323. *
  27324. * @static
  27325. * @memberOf _
  27326. * @since 4.0.0
  27327. * @category Collection
  27328. * @param {Array|Object} collection The collection to sample.
  27329. * @param {number} [n=1] The number of elements to sample.
  27330. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27331. * @returns {Array} Returns the random elements.
  27332. * @example
  27333. *
  27334. * _.sampleSize([1, 2, 3], 2);
  27335. * // => [3, 1]
  27336. *
  27337. * _.sampleSize([1, 2, 3], 4);
  27338. * // => [2, 3, 1]
  27339. */
  27340. function sampleSize(collection, n, guard) {
  27341. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  27342. n = 1;
  27343. } else {
  27344. n = toInteger(n);
  27345. }
  27346. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  27347. return func(collection, n);
  27348. }
  27349. /**
  27350. * Creates an array of shuffled values, using a version of the
  27351. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  27352. *
  27353. * @static
  27354. * @memberOf _
  27355. * @since 0.1.0
  27356. * @category Collection
  27357. * @param {Array|Object} collection The collection to shuffle.
  27358. * @returns {Array} Returns the new shuffled array.
  27359. * @example
  27360. *
  27361. * _.shuffle([1, 2, 3, 4]);
  27362. * // => [4, 1, 3, 2]
  27363. */
  27364. function shuffle(collection) {
  27365. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  27366. return func(collection);
  27367. }
  27368. /**
  27369. * Gets the size of `collection` by returning its length for array-like
  27370. * values or the number of own enumerable string keyed properties for objects.
  27371. *
  27372. * @static
  27373. * @memberOf _
  27374. * @since 0.1.0
  27375. * @category Collection
  27376. * @param {Array|Object|string} collection The collection to inspect.
  27377. * @returns {number} Returns the collection size.
  27378. * @example
  27379. *
  27380. * _.size([1, 2, 3]);
  27381. * // => 3
  27382. *
  27383. * _.size({ 'a': 1, 'b': 2 });
  27384. * // => 2
  27385. *
  27386. * _.size('pebbles');
  27387. * // => 7
  27388. */
  27389. function size(collection) {
  27390. if (collection == null) {
  27391. return 0;
  27392. }
  27393. if (isArrayLike(collection)) {
  27394. return isString(collection) ? stringSize(collection) : collection.length;
  27395. }
  27396. var tag = getTag(collection);
  27397. if (tag == mapTag || tag == setTag) {
  27398. return collection.size;
  27399. }
  27400. return baseKeys(collection).length;
  27401. }
  27402. /**
  27403. * Checks if `predicate` returns truthy for **any** element of `collection`.
  27404. * Iteration is stopped once `predicate` returns truthy. The predicate is
  27405. * invoked with three arguments: (value, index|key, collection).
  27406. *
  27407. * @static
  27408. * @memberOf _
  27409. * @since 0.1.0
  27410. * @category Collection
  27411. * @param {Array|Object} collection The collection to iterate over.
  27412. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27413. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27414. * @returns {boolean} Returns `true` if any element passes the predicate check,
  27415. * else `false`.
  27416. * @example
  27417. *
  27418. * _.some([null, 0, 'yes', false], Boolean);
  27419. * // => true
  27420. *
  27421. * var users = [
  27422. * { 'user': 'barney', 'active': true },
  27423. * { 'user': 'fred', 'active': false }
  27424. * ];
  27425. *
  27426. * // The `_.matches` iteratee shorthand.
  27427. * _.some(users, { 'user': 'barney', 'active': false });
  27428. * // => false
  27429. *
  27430. * // The `_.matchesProperty` iteratee shorthand.
  27431. * _.some(users, ['active', false]);
  27432. * // => true
  27433. *
  27434. * // The `_.property` iteratee shorthand.
  27435. * _.some(users, 'active');
  27436. * // => true
  27437. */
  27438. function some(collection, predicate, guard) {
  27439. var func = isArray(collection) ? arraySome : baseSome;
  27440. if (guard && isIterateeCall(collection, predicate, guard)) {
  27441. predicate = undefined;
  27442. }
  27443. return func(collection, getIteratee(predicate, 3));
  27444. }
  27445. /**
  27446. * Creates an array of elements, sorted in ascending order by the results of
  27447. * running each element in a collection thru each iteratee. This method
  27448. * performs a stable sort, that is, it preserves the original sort order of
  27449. * equal elements. The iteratees are invoked with one argument: (value).
  27450. *
  27451. * @static
  27452. * @memberOf _
  27453. * @since 0.1.0
  27454. * @category Collection
  27455. * @param {Array|Object} collection The collection to iterate over.
  27456. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  27457. * The iteratees to sort by.
  27458. * @returns {Array} Returns the new sorted array.
  27459. * @example
  27460. *
  27461. * var users = [
  27462. * { 'user': 'fred', 'age': 48 },
  27463. * { 'user': 'barney', 'age': 36 },
  27464. * { 'user': 'fred', 'age': 40 },
  27465. * { 'user': 'barney', 'age': 34 }
  27466. * ];
  27467. *
  27468. * _.sortBy(users, [function(o) { return o.user; }]);
  27469. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27470. *
  27471. * _.sortBy(users, ['user', 'age']);
  27472. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  27473. */
  27474. var sortBy = baseRest(function(collection, iteratees) {
  27475. if (collection == null) {
  27476. return [];
  27477. }
  27478. var length = iteratees.length;
  27479. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  27480. iteratees = [];
  27481. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  27482. iteratees = [iteratees[0]];
  27483. }
  27484. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  27485. });
  27486. /*------------------------------------------------------------------------*/
  27487. /**
  27488. * Gets the timestamp of the number of milliseconds that have elapsed since
  27489. * the Unix epoch (1 January 1970 00:00:00 UTC).
  27490. *
  27491. * @static
  27492. * @memberOf _
  27493. * @since 2.4.0
  27494. * @category Date
  27495. * @returns {number} Returns the timestamp.
  27496. * @example
  27497. *
  27498. * _.defer(function(stamp) {
  27499. * console.log(_.now() - stamp);
  27500. * }, _.now());
  27501. * // => Logs the number of milliseconds it took for the deferred invocation.
  27502. */
  27503. var now = ctxNow || function() {
  27504. return root.Date.now();
  27505. };
  27506. /*------------------------------------------------------------------------*/
  27507. /**
  27508. * The opposite of `_.before`; this method creates a function that invokes
  27509. * `func` once it's called `n` or more times.
  27510. *
  27511. * @static
  27512. * @memberOf _
  27513. * @since 0.1.0
  27514. * @category Function
  27515. * @param {number} n The number of calls before `func` is invoked.
  27516. * @param {Function} func The function to restrict.
  27517. * @returns {Function} Returns the new restricted function.
  27518. * @example
  27519. *
  27520. * var saves = ['profile', 'settings'];
  27521. *
  27522. * var done = _.after(saves.length, function() {
  27523. * console.log('done saving!');
  27524. * });
  27525. *
  27526. * _.forEach(saves, function(type) {
  27527. * asyncSave({ 'type': type, 'complete': done });
  27528. * });
  27529. * // => Logs 'done saving!' after the two async saves have completed.
  27530. */
  27531. function after(n, func) {
  27532. if (typeof func != 'function') {
  27533. throw new TypeError(FUNC_ERROR_TEXT);
  27534. }
  27535. n = toInteger(n);
  27536. return function() {
  27537. if (--n < 1) {
  27538. return func.apply(this, arguments);
  27539. }
  27540. };
  27541. }
  27542. /**
  27543. * Creates a function that invokes `func`, with up to `n` arguments,
  27544. * ignoring any additional arguments.
  27545. *
  27546. * @static
  27547. * @memberOf _
  27548. * @since 3.0.0
  27549. * @category Function
  27550. * @param {Function} func The function to cap arguments for.
  27551. * @param {number} [n=func.length] The arity cap.
  27552. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27553. * @returns {Function} Returns the new capped function.
  27554. * @example
  27555. *
  27556. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  27557. * // => [6, 8, 10]
  27558. */
  27559. function ary(func, n, guard) {
  27560. n = guard ? undefined : n;
  27561. n = (func && n == null) ? func.length : n;
  27562. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  27563. }
  27564. /**
  27565. * Creates a function that invokes `func`, with the `this` binding and arguments
  27566. * of the created function, while it's called less than `n` times. Subsequent
  27567. * calls to the created function return the result of the last `func` invocation.
  27568. *
  27569. * @static
  27570. * @memberOf _
  27571. * @since 3.0.0
  27572. * @category Function
  27573. * @param {number} n The number of calls at which `func` is no longer invoked.
  27574. * @param {Function} func The function to restrict.
  27575. * @returns {Function} Returns the new restricted function.
  27576. * @example
  27577. *
  27578. * jQuery(element).on('click', _.before(5, addContactToList));
  27579. * // => Allows adding up to 4 contacts to the list.
  27580. */
  27581. function before(n, func) {
  27582. var result;
  27583. if (typeof func != 'function') {
  27584. throw new TypeError(FUNC_ERROR_TEXT);
  27585. }
  27586. n = toInteger(n);
  27587. return function() {
  27588. if (--n > 0) {
  27589. result = func.apply(this, arguments);
  27590. }
  27591. if (n <= 1) {
  27592. func = undefined;
  27593. }
  27594. return result;
  27595. };
  27596. }
  27597. /**
  27598. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  27599. * and `partials` prepended to the arguments it receives.
  27600. *
  27601. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  27602. * may be used as a placeholder for partially applied arguments.
  27603. *
  27604. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  27605. * property of bound functions.
  27606. *
  27607. * @static
  27608. * @memberOf _
  27609. * @since 0.1.0
  27610. * @category Function
  27611. * @param {Function} func The function to bind.
  27612. * @param {*} thisArg The `this` binding of `func`.
  27613. * @param {...*} [partials] The arguments to be partially applied.
  27614. * @returns {Function} Returns the new bound function.
  27615. * @example
  27616. *
  27617. * function greet(greeting, punctuation) {
  27618. * return greeting + ' ' + this.user + punctuation;
  27619. * }
  27620. *
  27621. * var object = { 'user': 'fred' };
  27622. *
  27623. * var bound = _.bind(greet, object, 'hi');
  27624. * bound('!');
  27625. * // => 'hi fred!'
  27626. *
  27627. * // Bound with placeholders.
  27628. * var bound = _.bind(greet, object, _, '!');
  27629. * bound('hi');
  27630. * // => 'hi fred!'
  27631. */
  27632. var bind = baseRest(function(func, thisArg, partials) {
  27633. var bitmask = WRAP_BIND_FLAG;
  27634. if (partials.length) {
  27635. var holders = replaceHolders(partials, getHolder(bind));
  27636. bitmask |= WRAP_PARTIAL_FLAG;
  27637. }
  27638. return createWrap(func, bitmask, thisArg, partials, holders);
  27639. });
  27640. /**
  27641. * Creates a function that invokes the method at `object[key]` with `partials`
  27642. * prepended to the arguments it receives.
  27643. *
  27644. * This method differs from `_.bind` by allowing bound functions to reference
  27645. * methods that may be redefined or don't yet exist. See
  27646. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  27647. * for more details.
  27648. *
  27649. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  27650. * builds, may be used as a placeholder for partially applied arguments.
  27651. *
  27652. * @static
  27653. * @memberOf _
  27654. * @since 0.10.0
  27655. * @category Function
  27656. * @param {Object} object The object to invoke the method on.
  27657. * @param {string} key The key of the method.
  27658. * @param {...*} [partials] The arguments to be partially applied.
  27659. * @returns {Function} Returns the new bound function.
  27660. * @example
  27661. *
  27662. * var object = {
  27663. * 'user': 'fred',
  27664. * 'greet': function(greeting, punctuation) {
  27665. * return greeting + ' ' + this.user + punctuation;
  27666. * }
  27667. * };
  27668. *
  27669. * var bound = _.bindKey(object, 'greet', 'hi');
  27670. * bound('!');
  27671. * // => 'hi fred!'
  27672. *
  27673. * object.greet = function(greeting, punctuation) {
  27674. * return greeting + 'ya ' + this.user + punctuation;
  27675. * };
  27676. *
  27677. * bound('!');
  27678. * // => 'hiya fred!'
  27679. *
  27680. * // Bound with placeholders.
  27681. * var bound = _.bindKey(object, 'greet', _, '!');
  27682. * bound('hi');
  27683. * // => 'hiya fred!'
  27684. */
  27685. var bindKey = baseRest(function(object, key, partials) {
  27686. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  27687. if (partials.length) {
  27688. var holders = replaceHolders(partials, getHolder(bindKey));
  27689. bitmask |= WRAP_PARTIAL_FLAG;
  27690. }
  27691. return createWrap(key, bitmask, object, partials, holders);
  27692. });
  27693. /**
  27694. * Creates a function that accepts arguments of `func` and either invokes
  27695. * `func` returning its result, if at least `arity` number of arguments have
  27696. * been provided, or returns a function that accepts the remaining `func`
  27697. * arguments, and so on. The arity of `func` may be specified if `func.length`
  27698. * is not sufficient.
  27699. *
  27700. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  27701. * may be used as a placeholder for provided arguments.
  27702. *
  27703. * **Note:** This method doesn't set the "length" property of curried functions.
  27704. *
  27705. * @static
  27706. * @memberOf _
  27707. * @since 2.0.0
  27708. * @category Function
  27709. * @param {Function} func The function to curry.
  27710. * @param {number} [arity=func.length] The arity of `func`.
  27711. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27712. * @returns {Function} Returns the new curried function.
  27713. * @example
  27714. *
  27715. * var abc = function(a, b, c) {
  27716. * return [a, b, c];
  27717. * };
  27718. *
  27719. * var curried = _.curry(abc);
  27720. *
  27721. * curried(1)(2)(3);
  27722. * // => [1, 2, 3]
  27723. *
  27724. * curried(1, 2)(3);
  27725. * // => [1, 2, 3]
  27726. *
  27727. * curried(1, 2, 3);
  27728. * // => [1, 2, 3]
  27729. *
  27730. * // Curried with placeholders.
  27731. * curried(1)(_, 3)(2);
  27732. * // => [1, 2, 3]
  27733. */
  27734. function curry(func, arity, guard) {
  27735. arity = guard ? undefined : arity;
  27736. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27737. result.placeholder = curry.placeholder;
  27738. return result;
  27739. }
  27740. /**
  27741. * This method is like `_.curry` except that arguments are applied to `func`
  27742. * in the manner of `_.partialRight` instead of `_.partial`.
  27743. *
  27744. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  27745. * builds, may be used as a placeholder for provided arguments.
  27746. *
  27747. * **Note:** This method doesn't set the "length" property of curried functions.
  27748. *
  27749. * @static
  27750. * @memberOf _
  27751. * @since 3.0.0
  27752. * @category Function
  27753. * @param {Function} func The function to curry.
  27754. * @param {number} [arity=func.length] The arity of `func`.
  27755. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27756. * @returns {Function} Returns the new curried function.
  27757. * @example
  27758. *
  27759. * var abc = function(a, b, c) {
  27760. * return [a, b, c];
  27761. * };
  27762. *
  27763. * var curried = _.curryRight(abc);
  27764. *
  27765. * curried(3)(2)(1);
  27766. * // => [1, 2, 3]
  27767. *
  27768. * curried(2, 3)(1);
  27769. * // => [1, 2, 3]
  27770. *
  27771. * curried(1, 2, 3);
  27772. * // => [1, 2, 3]
  27773. *
  27774. * // Curried with placeholders.
  27775. * curried(3)(1, _)(2);
  27776. * // => [1, 2, 3]
  27777. */
  27778. function curryRight(func, arity, guard) {
  27779. arity = guard ? undefined : arity;
  27780. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27781. result.placeholder = curryRight.placeholder;
  27782. return result;
  27783. }
  27784. /**
  27785. * Creates a debounced function that delays invoking `func` until after `wait`
  27786. * milliseconds have elapsed since the last time the debounced function was
  27787. * invoked. The debounced function comes with a `cancel` method to cancel
  27788. * delayed `func` invocations and a `flush` method to immediately invoke them.
  27789. * Provide `options` to indicate whether `func` should be invoked on the
  27790. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  27791. * with the last arguments provided to the debounced function. Subsequent
  27792. * calls to the debounced function return the result of the last `func`
  27793. * invocation.
  27794. *
  27795. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27796. * invoked on the trailing edge of the timeout only if the debounced function
  27797. * is invoked more than once during the `wait` timeout.
  27798. *
  27799. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27800. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27801. *
  27802. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27803. * for details over the differences between `_.debounce` and `_.throttle`.
  27804. *
  27805. * @static
  27806. * @memberOf _
  27807. * @since 0.1.0
  27808. * @category Function
  27809. * @param {Function} func The function to debounce.
  27810. * @param {number} [wait=0] The number of milliseconds to delay.
  27811. * @param {Object} [options={}] The options object.
  27812. * @param {boolean} [options.leading=false]
  27813. * Specify invoking on the leading edge of the timeout.
  27814. * @param {number} [options.maxWait]
  27815. * The maximum time `func` is allowed to be delayed before it's invoked.
  27816. * @param {boolean} [options.trailing=true]
  27817. * Specify invoking on the trailing edge of the timeout.
  27818. * @returns {Function} Returns the new debounced function.
  27819. * @example
  27820. *
  27821. * // Avoid costly calculations while the window size is in flux.
  27822. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  27823. *
  27824. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  27825. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  27826. * 'leading': true,
  27827. * 'trailing': false
  27828. * }));
  27829. *
  27830. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  27831. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  27832. * var source = new EventSource('/stream');
  27833. * jQuery(source).on('message', debounced);
  27834. *
  27835. * // Cancel the trailing debounced invocation.
  27836. * jQuery(window).on('popstate', debounced.cancel);
  27837. */
  27838. function debounce(func, wait, options) {
  27839. var lastArgs,
  27840. lastThis,
  27841. maxWait,
  27842. result,
  27843. timerId,
  27844. lastCallTime,
  27845. lastInvokeTime = 0,
  27846. leading = false,
  27847. maxing = false,
  27848. trailing = true;
  27849. if (typeof func != 'function') {
  27850. throw new TypeError(FUNC_ERROR_TEXT);
  27851. }
  27852. wait = toNumber(wait) || 0;
  27853. if (isObject(options)) {
  27854. leading = !!options.leading;
  27855. maxing = 'maxWait' in options;
  27856. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  27857. trailing = 'trailing' in options ? !!options.trailing : trailing;
  27858. }
  27859. function invokeFunc(time) {
  27860. var args = lastArgs,
  27861. thisArg = lastThis;
  27862. lastArgs = lastThis = undefined;
  27863. lastInvokeTime = time;
  27864. result = func.apply(thisArg, args);
  27865. return result;
  27866. }
  27867. function leadingEdge(time) {
  27868. // Reset any `maxWait` timer.
  27869. lastInvokeTime = time;
  27870. // Start the timer for the trailing edge.
  27871. timerId = setTimeout(timerExpired, wait);
  27872. // Invoke the leading edge.
  27873. return leading ? invokeFunc(time) : result;
  27874. }
  27875. function remainingWait(time) {
  27876. var timeSinceLastCall = time - lastCallTime,
  27877. timeSinceLastInvoke = time - lastInvokeTime,
  27878. timeWaiting = wait - timeSinceLastCall;
  27879. return maxing
  27880. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  27881. : timeWaiting;
  27882. }
  27883. function shouldInvoke(time) {
  27884. var timeSinceLastCall = time - lastCallTime,
  27885. timeSinceLastInvoke = time - lastInvokeTime;
  27886. // Either this is the first call, activity has stopped and we're at the
  27887. // trailing edge, the system time has gone backwards and we're treating
  27888. // it as the trailing edge, or we've hit the `maxWait` limit.
  27889. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  27890. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  27891. }
  27892. function timerExpired() {
  27893. var time = now();
  27894. if (shouldInvoke(time)) {
  27895. return trailingEdge(time);
  27896. }
  27897. // Restart the timer.
  27898. timerId = setTimeout(timerExpired, remainingWait(time));
  27899. }
  27900. function trailingEdge(time) {
  27901. timerId = undefined;
  27902. // Only invoke if we have `lastArgs` which means `func` has been
  27903. // debounced at least once.
  27904. if (trailing && lastArgs) {
  27905. return invokeFunc(time);
  27906. }
  27907. lastArgs = lastThis = undefined;
  27908. return result;
  27909. }
  27910. function cancel() {
  27911. if (timerId !== undefined) {
  27912. clearTimeout(timerId);
  27913. }
  27914. lastInvokeTime = 0;
  27915. lastArgs = lastCallTime = lastThis = timerId = undefined;
  27916. }
  27917. function flush() {
  27918. return timerId === undefined ? result : trailingEdge(now());
  27919. }
  27920. function debounced() {
  27921. var time = now(),
  27922. isInvoking = shouldInvoke(time);
  27923. lastArgs = arguments;
  27924. lastThis = this;
  27925. lastCallTime = time;
  27926. if (isInvoking) {
  27927. if (timerId === undefined) {
  27928. return leadingEdge(lastCallTime);
  27929. }
  27930. if (maxing) {
  27931. // Handle invocations in a tight loop.
  27932. clearTimeout(timerId);
  27933. timerId = setTimeout(timerExpired, wait);
  27934. return invokeFunc(lastCallTime);
  27935. }
  27936. }
  27937. if (timerId === undefined) {
  27938. timerId = setTimeout(timerExpired, wait);
  27939. }
  27940. return result;
  27941. }
  27942. debounced.cancel = cancel;
  27943. debounced.flush = flush;
  27944. return debounced;
  27945. }
  27946. /**
  27947. * Defers invoking the `func` until the current call stack has cleared. Any
  27948. * additional arguments are provided to `func` when it's invoked.
  27949. *
  27950. * @static
  27951. * @memberOf _
  27952. * @since 0.1.0
  27953. * @category Function
  27954. * @param {Function} func The function to defer.
  27955. * @param {...*} [args] The arguments to invoke `func` with.
  27956. * @returns {number} Returns the timer id.
  27957. * @example
  27958. *
  27959. * _.defer(function(text) {
  27960. * console.log(text);
  27961. * }, 'deferred');
  27962. * // => Logs 'deferred' after one millisecond.
  27963. */
  27964. var defer = baseRest(function(func, args) {
  27965. return baseDelay(func, 1, args);
  27966. });
  27967. /**
  27968. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  27969. * provided to `func` when it's invoked.
  27970. *
  27971. * @static
  27972. * @memberOf _
  27973. * @since 0.1.0
  27974. * @category Function
  27975. * @param {Function} func The function to delay.
  27976. * @param {number} wait The number of milliseconds to delay invocation.
  27977. * @param {...*} [args] The arguments to invoke `func` with.
  27978. * @returns {number} Returns the timer id.
  27979. * @example
  27980. *
  27981. * _.delay(function(text) {
  27982. * console.log(text);
  27983. * }, 1000, 'later');
  27984. * // => Logs 'later' after one second.
  27985. */
  27986. var delay = baseRest(function(func, wait, args) {
  27987. return baseDelay(func, toNumber(wait) || 0, args);
  27988. });
  27989. /**
  27990. * Creates a function that invokes `func` with arguments reversed.
  27991. *
  27992. * @static
  27993. * @memberOf _
  27994. * @since 4.0.0
  27995. * @category Function
  27996. * @param {Function} func The function to flip arguments for.
  27997. * @returns {Function} Returns the new flipped function.
  27998. * @example
  27999. *
  28000. * var flipped = _.flip(function() {
  28001. * return _.toArray(arguments);
  28002. * });
  28003. *
  28004. * flipped('a', 'b', 'c', 'd');
  28005. * // => ['d', 'c', 'b', 'a']
  28006. */
  28007. function flip(func) {
  28008. return createWrap(func, WRAP_FLIP_FLAG);
  28009. }
  28010. /**
  28011. * Creates a function that memoizes the result of `func`. If `resolver` is
  28012. * provided, it determines the cache key for storing the result based on the
  28013. * arguments provided to the memoized function. By default, the first argument
  28014. * provided to the memoized function is used as the map cache key. The `func`
  28015. * is invoked with the `this` binding of the memoized function.
  28016. *
  28017. * **Note:** The cache is exposed as the `cache` property on the memoized
  28018. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  28019. * constructor with one whose instances implement the
  28020. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  28021. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  28022. *
  28023. * @static
  28024. * @memberOf _
  28025. * @since 0.1.0
  28026. * @category Function
  28027. * @param {Function} func The function to have its output memoized.
  28028. * @param {Function} [resolver] The function to resolve the cache key.
  28029. * @returns {Function} Returns the new memoized function.
  28030. * @example
  28031. *
  28032. * var object = { 'a': 1, 'b': 2 };
  28033. * var other = { 'c': 3, 'd': 4 };
  28034. *
  28035. * var values = _.memoize(_.values);
  28036. * values(object);
  28037. * // => [1, 2]
  28038. *
  28039. * values(other);
  28040. * // => [3, 4]
  28041. *
  28042. * object.a = 2;
  28043. * values(object);
  28044. * // => [1, 2]
  28045. *
  28046. * // Modify the result cache.
  28047. * values.cache.set(object, ['a', 'b']);
  28048. * values(object);
  28049. * // => ['a', 'b']
  28050. *
  28051. * // Replace `_.memoize.Cache`.
  28052. * _.memoize.Cache = WeakMap;
  28053. */
  28054. function memoize(func, resolver) {
  28055. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  28056. throw new TypeError(FUNC_ERROR_TEXT);
  28057. }
  28058. var memoized = function() {
  28059. var args = arguments,
  28060. key = resolver ? resolver.apply(this, args) : args[0],
  28061. cache = memoized.cache;
  28062. if (cache.has(key)) {
  28063. return cache.get(key);
  28064. }
  28065. var result = func.apply(this, args);
  28066. memoized.cache = cache.set(key, result) || cache;
  28067. return result;
  28068. };
  28069. memoized.cache = new (memoize.Cache || MapCache);
  28070. return memoized;
  28071. }
  28072. // Expose `MapCache`.
  28073. memoize.Cache = MapCache;
  28074. /**
  28075. * Creates a function that negates the result of the predicate `func`. The
  28076. * `func` predicate is invoked with the `this` binding and arguments of the
  28077. * created function.
  28078. *
  28079. * @static
  28080. * @memberOf _
  28081. * @since 3.0.0
  28082. * @category Function
  28083. * @param {Function} predicate The predicate to negate.
  28084. * @returns {Function} Returns the new negated function.
  28085. * @example
  28086. *
  28087. * function isEven(n) {
  28088. * return n % 2 == 0;
  28089. * }
  28090. *
  28091. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  28092. * // => [1, 3, 5]
  28093. */
  28094. function negate(predicate) {
  28095. if (typeof predicate != 'function') {
  28096. throw new TypeError(FUNC_ERROR_TEXT);
  28097. }
  28098. return function() {
  28099. var args = arguments;
  28100. switch (args.length) {
  28101. case 0: return !predicate.call(this);
  28102. case 1: return !predicate.call(this, args[0]);
  28103. case 2: return !predicate.call(this, args[0], args[1]);
  28104. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  28105. }
  28106. return !predicate.apply(this, args);
  28107. };
  28108. }
  28109. /**
  28110. * Creates a function that is restricted to invoking `func` once. Repeat calls
  28111. * to the function return the value of the first invocation. The `func` is
  28112. * invoked with the `this` binding and arguments of the created function.
  28113. *
  28114. * @static
  28115. * @memberOf _
  28116. * @since 0.1.0
  28117. * @category Function
  28118. * @param {Function} func The function to restrict.
  28119. * @returns {Function} Returns the new restricted function.
  28120. * @example
  28121. *
  28122. * var initialize = _.once(createApplication);
  28123. * initialize();
  28124. * initialize();
  28125. * // => `createApplication` is invoked once
  28126. */
  28127. function once(func) {
  28128. return before(2, func);
  28129. }
  28130. /**
  28131. * Creates a function that invokes `func` with its arguments transformed.
  28132. *
  28133. * @static
  28134. * @since 4.0.0
  28135. * @memberOf _
  28136. * @category Function
  28137. * @param {Function} func The function to wrap.
  28138. * @param {...(Function|Function[])} [transforms=[_.identity]]
  28139. * The argument transforms.
  28140. * @returns {Function} Returns the new function.
  28141. * @example
  28142. *
  28143. * function doubled(n) {
  28144. * return n * 2;
  28145. * }
  28146. *
  28147. * function square(n) {
  28148. * return n * n;
  28149. * }
  28150. *
  28151. * var func = _.overArgs(function(x, y) {
  28152. * return [x, y];
  28153. * }, [square, doubled]);
  28154. *
  28155. * func(9, 3);
  28156. * // => [81, 6]
  28157. *
  28158. * func(10, 5);
  28159. * // => [100, 10]
  28160. */
  28161. var overArgs = castRest(function(func, transforms) {
  28162. transforms = (transforms.length == 1 && isArray(transforms[0]))
  28163. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  28164. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  28165. var funcsLength = transforms.length;
  28166. return baseRest(function(args) {
  28167. var index = -1,
  28168. length = nativeMin(args.length, funcsLength);
  28169. while (++index < length) {
  28170. args[index] = transforms[index].call(this, args[index]);
  28171. }
  28172. return apply(func, this, args);
  28173. });
  28174. });
  28175. /**
  28176. * Creates a function that invokes `func` with `partials` prepended to the
  28177. * arguments it receives. This method is like `_.bind` except it does **not**
  28178. * alter the `this` binding.
  28179. *
  28180. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  28181. * builds, may be used as a placeholder for partially applied arguments.
  28182. *
  28183. * **Note:** This method doesn't set the "length" property of partially
  28184. * applied functions.
  28185. *
  28186. * @static
  28187. * @memberOf _
  28188. * @since 0.2.0
  28189. * @category Function
  28190. * @param {Function} func The function to partially apply arguments to.
  28191. * @param {...*} [partials] The arguments to be partially applied.
  28192. * @returns {Function} Returns the new partially applied function.
  28193. * @example
  28194. *
  28195. * function greet(greeting, name) {
  28196. * return greeting + ' ' + name;
  28197. * }
  28198. *
  28199. * var sayHelloTo = _.partial(greet, 'hello');
  28200. * sayHelloTo('fred');
  28201. * // => 'hello fred'
  28202. *
  28203. * // Partially applied with placeholders.
  28204. * var greetFred = _.partial(greet, _, 'fred');
  28205. * greetFred('hi');
  28206. * // => 'hi fred'
  28207. */
  28208. var partial = baseRest(function(func, partials) {
  28209. var holders = replaceHolders(partials, getHolder(partial));
  28210. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  28211. });
  28212. /**
  28213. * This method is like `_.partial` except that partially applied arguments
  28214. * are appended to the arguments it receives.
  28215. *
  28216. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  28217. * builds, may be used as a placeholder for partially applied arguments.
  28218. *
  28219. * **Note:** This method doesn't set the "length" property of partially
  28220. * applied functions.
  28221. *
  28222. * @static
  28223. * @memberOf _
  28224. * @since 1.0.0
  28225. * @category Function
  28226. * @param {Function} func The function to partially apply arguments to.
  28227. * @param {...*} [partials] The arguments to be partially applied.
  28228. * @returns {Function} Returns the new partially applied function.
  28229. * @example
  28230. *
  28231. * function greet(greeting, name) {
  28232. * return greeting + ' ' + name;
  28233. * }
  28234. *
  28235. * var greetFred = _.partialRight(greet, 'fred');
  28236. * greetFred('hi');
  28237. * // => 'hi fred'
  28238. *
  28239. * // Partially applied with placeholders.
  28240. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  28241. * sayHelloTo('fred');
  28242. * // => 'hello fred'
  28243. */
  28244. var partialRight = baseRest(function(func, partials) {
  28245. var holders = replaceHolders(partials, getHolder(partialRight));
  28246. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  28247. });
  28248. /**
  28249. * Creates a function that invokes `func` with arguments arranged according
  28250. * to the specified `indexes` where the argument value at the first index is
  28251. * provided as the first argument, the argument value at the second index is
  28252. * provided as the second argument, and so on.
  28253. *
  28254. * @static
  28255. * @memberOf _
  28256. * @since 3.0.0
  28257. * @category Function
  28258. * @param {Function} func The function to rearrange arguments for.
  28259. * @param {...(number|number[])} indexes The arranged argument indexes.
  28260. * @returns {Function} Returns the new function.
  28261. * @example
  28262. *
  28263. * var rearged = _.rearg(function(a, b, c) {
  28264. * return [a, b, c];
  28265. * }, [2, 0, 1]);
  28266. *
  28267. * rearged('b', 'c', 'a')
  28268. * // => ['a', 'b', 'c']
  28269. */
  28270. var rearg = flatRest(function(func, indexes) {
  28271. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  28272. });
  28273. /**
  28274. * Creates a function that invokes `func` with the `this` binding of the
  28275. * created function and arguments from `start` and beyond provided as
  28276. * an array.
  28277. *
  28278. * **Note:** This method is based on the
  28279. * [rest parameter](https://mdn.io/rest_parameters).
  28280. *
  28281. * @static
  28282. * @memberOf _
  28283. * @since 4.0.0
  28284. * @category Function
  28285. * @param {Function} func The function to apply a rest parameter to.
  28286. * @param {number} [start=func.length-1] The start position of the rest parameter.
  28287. * @returns {Function} Returns the new function.
  28288. * @example
  28289. *
  28290. * var say = _.rest(function(what, names) {
  28291. * return what + ' ' + _.initial(names).join(', ') +
  28292. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  28293. * });
  28294. *
  28295. * say('hello', 'fred', 'barney', 'pebbles');
  28296. * // => 'hello fred, barney, & pebbles'
  28297. */
  28298. function rest(func, start) {
  28299. if (typeof func != 'function') {
  28300. throw new TypeError(FUNC_ERROR_TEXT);
  28301. }
  28302. start = start === undefined ? start : toInteger(start);
  28303. return baseRest(func, start);
  28304. }
  28305. /**
  28306. * Creates a function that invokes `func` with the `this` binding of the
  28307. * create function and an array of arguments much like
  28308. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  28309. *
  28310. * **Note:** This method is based on the
  28311. * [spread operator](https://mdn.io/spread_operator).
  28312. *
  28313. * @static
  28314. * @memberOf _
  28315. * @since 3.2.0
  28316. * @category Function
  28317. * @param {Function} func The function to spread arguments over.
  28318. * @param {number} [start=0] The start position of the spread.
  28319. * @returns {Function} Returns the new function.
  28320. * @example
  28321. *
  28322. * var say = _.spread(function(who, what) {
  28323. * return who + ' says ' + what;
  28324. * });
  28325. *
  28326. * say(['fred', 'hello']);
  28327. * // => 'fred says hello'
  28328. *
  28329. * var numbers = Promise.all([
  28330. * Promise.resolve(40),
  28331. * Promise.resolve(36)
  28332. * ]);
  28333. *
  28334. * numbers.then(_.spread(function(x, y) {
  28335. * return x + y;
  28336. * }));
  28337. * // => a Promise of 76
  28338. */
  28339. function spread(func, start) {
  28340. if (typeof func != 'function') {
  28341. throw new TypeError(FUNC_ERROR_TEXT);
  28342. }
  28343. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  28344. return baseRest(function(args) {
  28345. var array = args[start],
  28346. otherArgs = castSlice(args, 0, start);
  28347. if (array) {
  28348. arrayPush(otherArgs, array);
  28349. }
  28350. return apply(func, this, otherArgs);
  28351. });
  28352. }
  28353. /**
  28354. * Creates a throttled function that only invokes `func` at most once per
  28355. * every `wait` milliseconds. The throttled function comes with a `cancel`
  28356. * method to cancel delayed `func` invocations and a `flush` method to
  28357. * immediately invoke them. Provide `options` to indicate whether `func`
  28358. * should be invoked on the leading and/or trailing edge of the `wait`
  28359. * timeout. The `func` is invoked with the last arguments provided to the
  28360. * throttled function. Subsequent calls to the throttled function return the
  28361. * result of the last `func` invocation.
  28362. *
  28363. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28364. * invoked on the trailing edge of the timeout only if the throttled function
  28365. * is invoked more than once during the `wait` timeout.
  28366. *
  28367. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28368. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28369. *
  28370. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28371. * for details over the differences between `_.throttle` and `_.debounce`.
  28372. *
  28373. * @static
  28374. * @memberOf _
  28375. * @since 0.1.0
  28376. * @category Function
  28377. * @param {Function} func The function to throttle.
  28378. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  28379. * @param {Object} [options={}] The options object.
  28380. * @param {boolean} [options.leading=true]
  28381. * Specify invoking on the leading edge of the timeout.
  28382. * @param {boolean} [options.trailing=true]
  28383. * Specify invoking on the trailing edge of the timeout.
  28384. * @returns {Function} Returns the new throttled function.
  28385. * @example
  28386. *
  28387. * // Avoid excessively updating the position while scrolling.
  28388. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  28389. *
  28390. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  28391. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  28392. * jQuery(element).on('click', throttled);
  28393. *
  28394. * // Cancel the trailing throttled invocation.
  28395. * jQuery(window).on('popstate', throttled.cancel);
  28396. */
  28397. function throttle(func, wait, options) {
  28398. var leading = true,
  28399. trailing = true;
  28400. if (typeof func != 'function') {
  28401. throw new TypeError(FUNC_ERROR_TEXT);
  28402. }
  28403. if (isObject(options)) {
  28404. leading = 'leading' in options ? !!options.leading : leading;
  28405. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28406. }
  28407. return debounce(func, wait, {
  28408. 'leading': leading,
  28409. 'maxWait': wait,
  28410. 'trailing': trailing
  28411. });
  28412. }
  28413. /**
  28414. * Creates a function that accepts up to one argument, ignoring any
  28415. * additional arguments.
  28416. *
  28417. * @static
  28418. * @memberOf _
  28419. * @since 4.0.0
  28420. * @category Function
  28421. * @param {Function} func The function to cap arguments for.
  28422. * @returns {Function} Returns the new capped function.
  28423. * @example
  28424. *
  28425. * _.map(['6', '8', '10'], _.unary(parseInt));
  28426. * // => [6, 8, 10]
  28427. */
  28428. function unary(func) {
  28429. return ary(func, 1);
  28430. }
  28431. /**
  28432. * Creates a function that provides `value` to `wrapper` as its first
  28433. * argument. Any additional arguments provided to the function are appended
  28434. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  28435. * binding of the created function.
  28436. *
  28437. * @static
  28438. * @memberOf _
  28439. * @since 0.1.0
  28440. * @category Function
  28441. * @param {*} value The value to wrap.
  28442. * @param {Function} [wrapper=identity] The wrapper function.
  28443. * @returns {Function} Returns the new function.
  28444. * @example
  28445. *
  28446. * var p = _.wrap(_.escape, function(func, text) {
  28447. * return '<p>' + func(text) + '</p>';
  28448. * });
  28449. *
  28450. * p('fred, barney, & pebbles');
  28451. * // => '<p>fred, barney, &amp; pebbles</p>'
  28452. */
  28453. function wrap(value, wrapper) {
  28454. return partial(castFunction(wrapper), value);
  28455. }
  28456. /*------------------------------------------------------------------------*/
  28457. /**
  28458. * Casts `value` as an array if it's not one.
  28459. *
  28460. * @static
  28461. * @memberOf _
  28462. * @since 4.4.0
  28463. * @category Lang
  28464. * @param {*} value The value to inspect.
  28465. * @returns {Array} Returns the cast array.
  28466. * @example
  28467. *
  28468. * _.castArray(1);
  28469. * // => [1]
  28470. *
  28471. * _.castArray({ 'a': 1 });
  28472. * // => [{ 'a': 1 }]
  28473. *
  28474. * _.castArray('abc');
  28475. * // => ['abc']
  28476. *
  28477. * _.castArray(null);
  28478. * // => [null]
  28479. *
  28480. * _.castArray(undefined);
  28481. * // => [undefined]
  28482. *
  28483. * _.castArray();
  28484. * // => []
  28485. *
  28486. * var array = [1, 2, 3];
  28487. * console.log(_.castArray(array) === array);
  28488. * // => true
  28489. */
  28490. function castArray() {
  28491. if (!arguments.length) {
  28492. return [];
  28493. }
  28494. var value = arguments[0];
  28495. return isArray(value) ? value : [value];
  28496. }
  28497. /**
  28498. * Creates a shallow clone of `value`.
  28499. *
  28500. * **Note:** This method is loosely based on the
  28501. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  28502. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  28503. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  28504. * arrays. The own enumerable properties of `arguments` objects are cloned
  28505. * as plain objects. An empty object is returned for uncloneable values such
  28506. * as error objects, functions, DOM nodes, and WeakMaps.
  28507. *
  28508. * @static
  28509. * @memberOf _
  28510. * @since 0.1.0
  28511. * @category Lang
  28512. * @param {*} value The value to clone.
  28513. * @returns {*} Returns the cloned value.
  28514. * @see _.cloneDeep
  28515. * @example
  28516. *
  28517. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28518. *
  28519. * var shallow = _.clone(objects);
  28520. * console.log(shallow[0] === objects[0]);
  28521. * // => true
  28522. */
  28523. function clone(value) {
  28524. return baseClone(value, CLONE_SYMBOLS_FLAG);
  28525. }
  28526. /**
  28527. * This method is like `_.clone` except that it accepts `customizer` which
  28528. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  28529. * cloning is handled by the method instead. The `customizer` is invoked with
  28530. * up to four arguments; (value [, index|key, object, stack]).
  28531. *
  28532. * @static
  28533. * @memberOf _
  28534. * @since 4.0.0
  28535. * @category Lang
  28536. * @param {*} value The value to clone.
  28537. * @param {Function} [customizer] The function to customize cloning.
  28538. * @returns {*} Returns the cloned value.
  28539. * @see _.cloneDeepWith
  28540. * @example
  28541. *
  28542. * function customizer(value) {
  28543. * if (_.isElement(value)) {
  28544. * return value.cloneNode(false);
  28545. * }
  28546. * }
  28547. *
  28548. * var el = _.cloneWith(document.body, customizer);
  28549. *
  28550. * console.log(el === document.body);
  28551. * // => false
  28552. * console.log(el.nodeName);
  28553. * // => 'BODY'
  28554. * console.log(el.childNodes.length);
  28555. * // => 0
  28556. */
  28557. function cloneWith(value, customizer) {
  28558. customizer = typeof customizer == 'function' ? customizer : undefined;
  28559. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  28560. }
  28561. /**
  28562. * This method is like `_.clone` except that it recursively clones `value`.
  28563. *
  28564. * @static
  28565. * @memberOf _
  28566. * @since 1.0.0
  28567. * @category Lang
  28568. * @param {*} value The value to recursively clone.
  28569. * @returns {*} Returns the deep cloned value.
  28570. * @see _.clone
  28571. * @example
  28572. *
  28573. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28574. *
  28575. * var deep = _.cloneDeep(objects);
  28576. * console.log(deep[0] === objects[0]);
  28577. * // => false
  28578. */
  28579. function cloneDeep(value) {
  28580. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  28581. }
  28582. /**
  28583. * This method is like `_.cloneWith` except that it recursively clones `value`.
  28584. *
  28585. * @static
  28586. * @memberOf _
  28587. * @since 4.0.0
  28588. * @category Lang
  28589. * @param {*} value The value to recursively clone.
  28590. * @param {Function} [customizer] The function to customize cloning.
  28591. * @returns {*} Returns the deep cloned value.
  28592. * @see _.cloneWith
  28593. * @example
  28594. *
  28595. * function customizer(value) {
  28596. * if (_.isElement(value)) {
  28597. * return value.cloneNode(true);
  28598. * }
  28599. * }
  28600. *
  28601. * var el = _.cloneDeepWith(document.body, customizer);
  28602. *
  28603. * console.log(el === document.body);
  28604. * // => false
  28605. * console.log(el.nodeName);
  28606. * // => 'BODY'
  28607. * console.log(el.childNodes.length);
  28608. * // => 20
  28609. */
  28610. function cloneDeepWith(value, customizer) {
  28611. customizer = typeof customizer == 'function' ? customizer : undefined;
  28612. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  28613. }
  28614. /**
  28615. * Checks if `object` conforms to `source` by invoking the predicate
  28616. * properties of `source` with the corresponding property values of `object`.
  28617. *
  28618. * **Note:** This method is equivalent to `_.conforms` when `source` is
  28619. * partially applied.
  28620. *
  28621. * @static
  28622. * @memberOf _
  28623. * @since 4.14.0
  28624. * @category Lang
  28625. * @param {Object} object The object to inspect.
  28626. * @param {Object} source The object of property predicates to conform to.
  28627. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  28628. * @example
  28629. *
  28630. * var object = { 'a': 1, 'b': 2 };
  28631. *
  28632. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  28633. * // => true
  28634. *
  28635. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  28636. * // => false
  28637. */
  28638. function conformsTo(object, source) {
  28639. return source == null || baseConformsTo(object, source, keys(source));
  28640. }
  28641. /**
  28642. * Performs a
  28643. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28644. * comparison between two values to determine if they are equivalent.
  28645. *
  28646. * @static
  28647. * @memberOf _
  28648. * @since 4.0.0
  28649. * @category Lang
  28650. * @param {*} value The value to compare.
  28651. * @param {*} other The other value to compare.
  28652. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28653. * @example
  28654. *
  28655. * var object = { 'a': 1 };
  28656. * var other = { 'a': 1 };
  28657. *
  28658. * _.eq(object, object);
  28659. * // => true
  28660. *
  28661. * _.eq(object, other);
  28662. * // => false
  28663. *
  28664. * _.eq('a', 'a');
  28665. * // => true
  28666. *
  28667. * _.eq('a', Object('a'));
  28668. * // => false
  28669. *
  28670. * _.eq(NaN, NaN);
  28671. * // => true
  28672. */
  28673. function eq(value, other) {
  28674. return value === other || (value !== value && other !== other);
  28675. }
  28676. /**
  28677. * Checks if `value` is greater than `other`.
  28678. *
  28679. * @static
  28680. * @memberOf _
  28681. * @since 3.9.0
  28682. * @category Lang
  28683. * @param {*} value The value to compare.
  28684. * @param {*} other The other value to compare.
  28685. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  28686. * else `false`.
  28687. * @see _.lt
  28688. * @example
  28689. *
  28690. * _.gt(3, 1);
  28691. * // => true
  28692. *
  28693. * _.gt(3, 3);
  28694. * // => false
  28695. *
  28696. * _.gt(1, 3);
  28697. * // => false
  28698. */
  28699. var gt = createRelationalOperation(baseGt);
  28700. /**
  28701. * Checks if `value` is greater than or equal to `other`.
  28702. *
  28703. * @static
  28704. * @memberOf _
  28705. * @since 3.9.0
  28706. * @category Lang
  28707. * @param {*} value The value to compare.
  28708. * @param {*} other The other value to compare.
  28709. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  28710. * `other`, else `false`.
  28711. * @see _.lte
  28712. * @example
  28713. *
  28714. * _.gte(3, 1);
  28715. * // => true
  28716. *
  28717. * _.gte(3, 3);
  28718. * // => true
  28719. *
  28720. * _.gte(1, 3);
  28721. * // => false
  28722. */
  28723. var gte = createRelationalOperation(function(value, other) {
  28724. return value >= other;
  28725. });
  28726. /**
  28727. * Checks if `value` is likely an `arguments` object.
  28728. *
  28729. * @static
  28730. * @memberOf _
  28731. * @since 0.1.0
  28732. * @category Lang
  28733. * @param {*} value The value to check.
  28734. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  28735. * else `false`.
  28736. * @example
  28737. *
  28738. * _.isArguments(function() { return arguments; }());
  28739. * // => true
  28740. *
  28741. * _.isArguments([1, 2, 3]);
  28742. * // => false
  28743. */
  28744. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  28745. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  28746. !propertyIsEnumerable.call(value, 'callee');
  28747. };
  28748. /**
  28749. * Checks if `value` is classified as an `Array` object.
  28750. *
  28751. * @static
  28752. * @memberOf _
  28753. * @since 0.1.0
  28754. * @category Lang
  28755. * @param {*} value The value to check.
  28756. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  28757. * @example
  28758. *
  28759. * _.isArray([1, 2, 3]);
  28760. * // => true
  28761. *
  28762. * _.isArray(document.body.children);
  28763. * // => false
  28764. *
  28765. * _.isArray('abc');
  28766. * // => false
  28767. *
  28768. * _.isArray(_.noop);
  28769. * // => false
  28770. */
  28771. var isArray = Array.isArray;
  28772. /**
  28773. * Checks if `value` is classified as an `ArrayBuffer` object.
  28774. *
  28775. * @static
  28776. * @memberOf _
  28777. * @since 4.3.0
  28778. * @category Lang
  28779. * @param {*} value The value to check.
  28780. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  28781. * @example
  28782. *
  28783. * _.isArrayBuffer(new ArrayBuffer(2));
  28784. * // => true
  28785. *
  28786. * _.isArrayBuffer(new Array(2));
  28787. * // => false
  28788. */
  28789. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  28790. /**
  28791. * Checks if `value` is array-like. A value is considered array-like if it's
  28792. * not a function and has a `value.length` that's an integer greater than or
  28793. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  28794. *
  28795. * @static
  28796. * @memberOf _
  28797. * @since 4.0.0
  28798. * @category Lang
  28799. * @param {*} value The value to check.
  28800. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  28801. * @example
  28802. *
  28803. * _.isArrayLike([1, 2, 3]);
  28804. * // => true
  28805. *
  28806. * _.isArrayLike(document.body.children);
  28807. * // => true
  28808. *
  28809. * _.isArrayLike('abc');
  28810. * // => true
  28811. *
  28812. * _.isArrayLike(_.noop);
  28813. * // => false
  28814. */
  28815. function isArrayLike(value) {
  28816. return value != null && isLength(value.length) && !isFunction(value);
  28817. }
  28818. /**
  28819. * This method is like `_.isArrayLike` except that it also checks if `value`
  28820. * is an object.
  28821. *
  28822. * @static
  28823. * @memberOf _
  28824. * @since 4.0.0
  28825. * @category Lang
  28826. * @param {*} value The value to check.
  28827. * @returns {boolean} Returns `true` if `value` is an array-like object,
  28828. * else `false`.
  28829. * @example
  28830. *
  28831. * _.isArrayLikeObject([1, 2, 3]);
  28832. * // => true
  28833. *
  28834. * _.isArrayLikeObject(document.body.children);
  28835. * // => true
  28836. *
  28837. * _.isArrayLikeObject('abc');
  28838. * // => false
  28839. *
  28840. * _.isArrayLikeObject(_.noop);
  28841. * // => false
  28842. */
  28843. function isArrayLikeObject(value) {
  28844. return isObjectLike(value) && isArrayLike(value);
  28845. }
  28846. /**
  28847. * Checks if `value` is classified as a boolean primitive or object.
  28848. *
  28849. * @static
  28850. * @memberOf _
  28851. * @since 0.1.0
  28852. * @category Lang
  28853. * @param {*} value The value to check.
  28854. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  28855. * @example
  28856. *
  28857. * _.isBoolean(false);
  28858. * // => true
  28859. *
  28860. * _.isBoolean(null);
  28861. * // => false
  28862. */
  28863. function isBoolean(value) {
  28864. return value === true || value === false ||
  28865. (isObjectLike(value) && baseGetTag(value) == boolTag);
  28866. }
  28867. /**
  28868. * Checks if `value` is a buffer.
  28869. *
  28870. * @static
  28871. * @memberOf _
  28872. * @since 4.3.0
  28873. * @category Lang
  28874. * @param {*} value The value to check.
  28875. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  28876. * @example
  28877. *
  28878. * _.isBuffer(new Buffer(2));
  28879. * // => true
  28880. *
  28881. * _.isBuffer(new Uint8Array(2));
  28882. * // => false
  28883. */
  28884. var isBuffer = nativeIsBuffer || stubFalse;
  28885. /**
  28886. * Checks if `value` is classified as a `Date` object.
  28887. *
  28888. * @static
  28889. * @memberOf _
  28890. * @since 0.1.0
  28891. * @category Lang
  28892. * @param {*} value The value to check.
  28893. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  28894. * @example
  28895. *
  28896. * _.isDate(new Date);
  28897. * // => true
  28898. *
  28899. * _.isDate('Mon April 23 2012');
  28900. * // => false
  28901. */
  28902. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  28903. /**
  28904. * Checks if `value` is likely a DOM element.
  28905. *
  28906. * @static
  28907. * @memberOf _
  28908. * @since 0.1.0
  28909. * @category Lang
  28910. * @param {*} value The value to check.
  28911. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  28912. * @example
  28913. *
  28914. * _.isElement(document.body);
  28915. * // => true
  28916. *
  28917. * _.isElement('<body>');
  28918. * // => false
  28919. */
  28920. function isElement(value) {
  28921. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  28922. }
  28923. /**
  28924. * Checks if `value` is an empty object, collection, map, or set.
  28925. *
  28926. * Objects are considered empty if they have no own enumerable string keyed
  28927. * properties.
  28928. *
  28929. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  28930. * jQuery-like collections are considered empty if they have a `length` of `0`.
  28931. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  28932. *
  28933. * @static
  28934. * @memberOf _
  28935. * @since 0.1.0
  28936. * @category Lang
  28937. * @param {*} value The value to check.
  28938. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  28939. * @example
  28940. *
  28941. * _.isEmpty(null);
  28942. * // => true
  28943. *
  28944. * _.isEmpty(true);
  28945. * // => true
  28946. *
  28947. * _.isEmpty(1);
  28948. * // => true
  28949. *
  28950. * _.isEmpty([1, 2, 3]);
  28951. * // => false
  28952. *
  28953. * _.isEmpty({ 'a': 1 });
  28954. * // => false
  28955. */
  28956. function isEmpty(value) {
  28957. if (value == null) {
  28958. return true;
  28959. }
  28960. if (isArrayLike(value) &&
  28961. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  28962. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  28963. return !value.length;
  28964. }
  28965. var tag = getTag(value);
  28966. if (tag == mapTag || tag == setTag) {
  28967. return !value.size;
  28968. }
  28969. if (isPrototype(value)) {
  28970. return !baseKeys(value).length;
  28971. }
  28972. for (var key in value) {
  28973. if (hasOwnProperty.call(value, key)) {
  28974. return false;
  28975. }
  28976. }
  28977. return true;
  28978. }
  28979. /**
  28980. * Performs a deep comparison between two values to determine if they are
  28981. * equivalent.
  28982. *
  28983. * **Note:** This method supports comparing arrays, array buffers, booleans,
  28984. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  28985. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  28986. * by their own, not inherited, enumerable properties. Functions and DOM
  28987. * nodes are compared by strict equality, i.e. `===`.
  28988. *
  28989. * @static
  28990. * @memberOf _
  28991. * @since 0.1.0
  28992. * @category Lang
  28993. * @param {*} value The value to compare.
  28994. * @param {*} other The other value to compare.
  28995. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28996. * @example
  28997. *
  28998. * var object = { 'a': 1 };
  28999. * var other = { 'a': 1 };
  29000. *
  29001. * _.isEqual(object, other);
  29002. * // => true
  29003. *
  29004. * object === other;
  29005. * // => false
  29006. */
  29007. function isEqual(value, other) {
  29008. return baseIsEqual(value, other);
  29009. }
  29010. /**
  29011. * This method is like `_.isEqual` except that it accepts `customizer` which
  29012. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29013. * are handled by the method instead. The `customizer` is invoked with up to
  29014. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  29015. *
  29016. * @static
  29017. * @memberOf _
  29018. * @since 4.0.0
  29019. * @category Lang
  29020. * @param {*} value The value to compare.
  29021. * @param {*} other The other value to compare.
  29022. * @param {Function} [customizer] The function to customize comparisons.
  29023. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29024. * @example
  29025. *
  29026. * function isGreeting(value) {
  29027. * return /^h(?:i|ello)$/.test(value);
  29028. * }
  29029. *
  29030. * function customizer(objValue, othValue) {
  29031. * if (isGreeting(objValue) && isGreeting(othValue)) {
  29032. * return true;
  29033. * }
  29034. * }
  29035. *
  29036. * var array = ['hello', 'goodbye'];
  29037. * var other = ['hi', 'goodbye'];
  29038. *
  29039. * _.isEqualWith(array, other, customizer);
  29040. * // => true
  29041. */
  29042. function isEqualWith(value, other, customizer) {
  29043. customizer = typeof customizer == 'function' ? customizer : undefined;
  29044. var result = customizer ? customizer(value, other) : undefined;
  29045. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  29046. }
  29047. /**
  29048. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  29049. * `SyntaxError`, `TypeError`, or `URIError` object.
  29050. *
  29051. * @static
  29052. * @memberOf _
  29053. * @since 3.0.0
  29054. * @category Lang
  29055. * @param {*} value The value to check.
  29056. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  29057. * @example
  29058. *
  29059. * _.isError(new Error);
  29060. * // => true
  29061. *
  29062. * _.isError(Error);
  29063. * // => false
  29064. */
  29065. function isError(value) {
  29066. if (!isObjectLike(value)) {
  29067. return false;
  29068. }
  29069. var tag = baseGetTag(value);
  29070. return tag == errorTag || tag == domExcTag ||
  29071. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  29072. }
  29073. /**
  29074. * Checks if `value` is a finite primitive number.
  29075. *
  29076. * **Note:** This method is based on
  29077. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  29078. *
  29079. * @static
  29080. * @memberOf _
  29081. * @since 0.1.0
  29082. * @category Lang
  29083. * @param {*} value The value to check.
  29084. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  29085. * @example
  29086. *
  29087. * _.isFinite(3);
  29088. * // => true
  29089. *
  29090. * _.isFinite(Number.MIN_VALUE);
  29091. * // => true
  29092. *
  29093. * _.isFinite(Infinity);
  29094. * // => false
  29095. *
  29096. * _.isFinite('3');
  29097. * // => false
  29098. */
  29099. function isFinite(value) {
  29100. return typeof value == 'number' && nativeIsFinite(value);
  29101. }
  29102. /**
  29103. * Checks if `value` is classified as a `Function` object.
  29104. *
  29105. * @static
  29106. * @memberOf _
  29107. * @since 0.1.0
  29108. * @category Lang
  29109. * @param {*} value The value to check.
  29110. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  29111. * @example
  29112. *
  29113. * _.isFunction(_);
  29114. * // => true
  29115. *
  29116. * _.isFunction(/abc/);
  29117. * // => false
  29118. */
  29119. function isFunction(value) {
  29120. if (!isObject(value)) {
  29121. return false;
  29122. }
  29123. // The use of `Object#toString` avoids issues with the `typeof` operator
  29124. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  29125. var tag = baseGetTag(value);
  29126. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  29127. }
  29128. /**
  29129. * Checks if `value` is an integer.
  29130. *
  29131. * **Note:** This method is based on
  29132. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  29133. *
  29134. * @static
  29135. * @memberOf _
  29136. * @since 4.0.0
  29137. * @category Lang
  29138. * @param {*} value The value to check.
  29139. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  29140. * @example
  29141. *
  29142. * _.isInteger(3);
  29143. * // => true
  29144. *
  29145. * _.isInteger(Number.MIN_VALUE);
  29146. * // => false
  29147. *
  29148. * _.isInteger(Infinity);
  29149. * // => false
  29150. *
  29151. * _.isInteger('3');
  29152. * // => false
  29153. */
  29154. function isInteger(value) {
  29155. return typeof value == 'number' && value == toInteger(value);
  29156. }
  29157. /**
  29158. * Checks if `value` is a valid array-like length.
  29159. *
  29160. * **Note:** This method is loosely based on
  29161. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29162. *
  29163. * @static
  29164. * @memberOf _
  29165. * @since 4.0.0
  29166. * @category Lang
  29167. * @param {*} value The value to check.
  29168. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  29169. * @example
  29170. *
  29171. * _.isLength(3);
  29172. * // => true
  29173. *
  29174. * _.isLength(Number.MIN_VALUE);
  29175. * // => false
  29176. *
  29177. * _.isLength(Infinity);
  29178. * // => false
  29179. *
  29180. * _.isLength('3');
  29181. * // => false
  29182. */
  29183. function isLength(value) {
  29184. return typeof value == 'number' &&
  29185. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  29186. }
  29187. /**
  29188. * Checks if `value` is the
  29189. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  29190. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  29191. *
  29192. * @static
  29193. * @memberOf _
  29194. * @since 0.1.0
  29195. * @category Lang
  29196. * @param {*} value The value to check.
  29197. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  29198. * @example
  29199. *
  29200. * _.isObject({});
  29201. * // => true
  29202. *
  29203. * _.isObject([1, 2, 3]);
  29204. * // => true
  29205. *
  29206. * _.isObject(_.noop);
  29207. * // => true
  29208. *
  29209. * _.isObject(null);
  29210. * // => false
  29211. */
  29212. function isObject(value) {
  29213. var type = typeof value;
  29214. return value != null && (type == 'object' || type == 'function');
  29215. }
  29216. /**
  29217. * Checks if `value` is object-like. A value is object-like if it's not `null`
  29218. * and has a `typeof` result of "object".
  29219. *
  29220. * @static
  29221. * @memberOf _
  29222. * @since 4.0.0
  29223. * @category Lang
  29224. * @param {*} value The value to check.
  29225. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  29226. * @example
  29227. *
  29228. * _.isObjectLike({});
  29229. * // => true
  29230. *
  29231. * _.isObjectLike([1, 2, 3]);
  29232. * // => true
  29233. *
  29234. * _.isObjectLike(_.noop);
  29235. * // => false
  29236. *
  29237. * _.isObjectLike(null);
  29238. * // => false
  29239. */
  29240. function isObjectLike(value) {
  29241. return value != null && typeof value == 'object';
  29242. }
  29243. /**
  29244. * Checks if `value` is classified as a `Map` object.
  29245. *
  29246. * @static
  29247. * @memberOf _
  29248. * @since 4.3.0
  29249. * @category Lang
  29250. * @param {*} value The value to check.
  29251. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  29252. * @example
  29253. *
  29254. * _.isMap(new Map);
  29255. * // => true
  29256. *
  29257. * _.isMap(new WeakMap);
  29258. * // => false
  29259. */
  29260. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  29261. /**
  29262. * Performs a partial deep comparison between `object` and `source` to
  29263. * determine if `object` contains equivalent property values.
  29264. *
  29265. * **Note:** This method is equivalent to `_.matches` when `source` is
  29266. * partially applied.
  29267. *
  29268. * Partial comparisons will match empty array and empty object `source`
  29269. * values against any array or object value, respectively. See `_.isEqual`
  29270. * for a list of supported value comparisons.
  29271. *
  29272. * @static
  29273. * @memberOf _
  29274. * @since 3.0.0
  29275. * @category Lang
  29276. * @param {Object} object The object to inspect.
  29277. * @param {Object} source The object of property values to match.
  29278. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29279. * @example
  29280. *
  29281. * var object = { 'a': 1, 'b': 2 };
  29282. *
  29283. * _.isMatch(object, { 'b': 2 });
  29284. * // => true
  29285. *
  29286. * _.isMatch(object, { 'b': 1 });
  29287. * // => false
  29288. */
  29289. function isMatch(object, source) {
  29290. return object === source || baseIsMatch(object, source, getMatchData(source));
  29291. }
  29292. /**
  29293. * This method is like `_.isMatch` except that it accepts `customizer` which
  29294. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29295. * are handled by the method instead. The `customizer` is invoked with five
  29296. * arguments: (objValue, srcValue, index|key, object, source).
  29297. *
  29298. * @static
  29299. * @memberOf _
  29300. * @since 4.0.0
  29301. * @category Lang
  29302. * @param {Object} object The object to inspect.
  29303. * @param {Object} source The object of property values to match.
  29304. * @param {Function} [customizer] The function to customize comparisons.
  29305. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29306. * @example
  29307. *
  29308. * function isGreeting(value) {
  29309. * return /^h(?:i|ello)$/.test(value);
  29310. * }
  29311. *
  29312. * function customizer(objValue, srcValue) {
  29313. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  29314. * return true;
  29315. * }
  29316. * }
  29317. *
  29318. * var object = { 'greeting': 'hello' };
  29319. * var source = { 'greeting': 'hi' };
  29320. *
  29321. * _.isMatchWith(object, source, customizer);
  29322. * // => true
  29323. */
  29324. function isMatchWith(object, source, customizer) {
  29325. customizer = typeof customizer == 'function' ? customizer : undefined;
  29326. return baseIsMatch(object, source, getMatchData(source), customizer);
  29327. }
  29328. /**
  29329. * Checks if `value` is `NaN`.
  29330. *
  29331. * **Note:** This method is based on
  29332. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  29333. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  29334. * `undefined` and other non-number values.
  29335. *
  29336. * @static
  29337. * @memberOf _
  29338. * @since 0.1.0
  29339. * @category Lang
  29340. * @param {*} value The value to check.
  29341. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  29342. * @example
  29343. *
  29344. * _.isNaN(NaN);
  29345. * // => true
  29346. *
  29347. * _.isNaN(new Number(NaN));
  29348. * // => true
  29349. *
  29350. * isNaN(undefined);
  29351. * // => true
  29352. *
  29353. * _.isNaN(undefined);
  29354. * // => false
  29355. */
  29356. function isNaN(value) {
  29357. // An `NaN` primitive is the only value that is not equal to itself.
  29358. // Perform the `toStringTag` check first to avoid errors with some
  29359. // ActiveX objects in IE.
  29360. return isNumber(value) && value != +value;
  29361. }
  29362. /**
  29363. * Checks if `value` is a pristine native function.
  29364. *
  29365. * **Note:** This method can't reliably detect native functions in the presence
  29366. * of the core-js package because core-js circumvents this kind of detection.
  29367. * Despite multiple requests, the core-js maintainer has made it clear: any
  29368. * attempt to fix the detection will be obstructed. As a result, we're left
  29369. * with little choice but to throw an error. Unfortunately, this also affects
  29370. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  29371. * which rely on core-js.
  29372. *
  29373. * @static
  29374. * @memberOf _
  29375. * @since 3.0.0
  29376. * @category Lang
  29377. * @param {*} value The value to check.
  29378. * @returns {boolean} Returns `true` if `value` is a native function,
  29379. * else `false`.
  29380. * @example
  29381. *
  29382. * _.isNative(Array.prototype.push);
  29383. * // => true
  29384. *
  29385. * _.isNative(_);
  29386. * // => false
  29387. */
  29388. function isNative(value) {
  29389. if (isMaskable(value)) {
  29390. throw new Error(CORE_ERROR_TEXT);
  29391. }
  29392. return baseIsNative(value);
  29393. }
  29394. /**
  29395. * Checks if `value` is `null`.
  29396. *
  29397. * @static
  29398. * @memberOf _
  29399. * @since 0.1.0
  29400. * @category Lang
  29401. * @param {*} value The value to check.
  29402. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  29403. * @example
  29404. *
  29405. * _.isNull(null);
  29406. * // => true
  29407. *
  29408. * _.isNull(void 0);
  29409. * // => false
  29410. */
  29411. function isNull(value) {
  29412. return value === null;
  29413. }
  29414. /**
  29415. * Checks if `value` is `null` or `undefined`.
  29416. *
  29417. * @static
  29418. * @memberOf _
  29419. * @since 4.0.0
  29420. * @category Lang
  29421. * @param {*} value The value to check.
  29422. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  29423. * @example
  29424. *
  29425. * _.isNil(null);
  29426. * // => true
  29427. *
  29428. * _.isNil(void 0);
  29429. * // => true
  29430. *
  29431. * _.isNil(NaN);
  29432. * // => false
  29433. */
  29434. function isNil(value) {
  29435. return value == null;
  29436. }
  29437. /**
  29438. * Checks if `value` is classified as a `Number` primitive or object.
  29439. *
  29440. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  29441. * classified as numbers, use the `_.isFinite` method.
  29442. *
  29443. * @static
  29444. * @memberOf _
  29445. * @since 0.1.0
  29446. * @category Lang
  29447. * @param {*} value The value to check.
  29448. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  29449. * @example
  29450. *
  29451. * _.isNumber(3);
  29452. * // => true
  29453. *
  29454. * _.isNumber(Number.MIN_VALUE);
  29455. * // => true
  29456. *
  29457. * _.isNumber(Infinity);
  29458. * // => true
  29459. *
  29460. * _.isNumber('3');
  29461. * // => false
  29462. */
  29463. function isNumber(value) {
  29464. return typeof value == 'number' ||
  29465. (isObjectLike(value) && baseGetTag(value) == numberTag);
  29466. }
  29467. /**
  29468. * Checks if `value` is a plain object, that is, an object created by the
  29469. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  29470. *
  29471. * @static
  29472. * @memberOf _
  29473. * @since 0.8.0
  29474. * @category Lang
  29475. * @param {*} value The value to check.
  29476. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  29477. * @example
  29478. *
  29479. * function Foo() {
  29480. * this.a = 1;
  29481. * }
  29482. *
  29483. * _.isPlainObject(new Foo);
  29484. * // => false
  29485. *
  29486. * _.isPlainObject([1, 2, 3]);
  29487. * // => false
  29488. *
  29489. * _.isPlainObject({ 'x': 0, 'y': 0 });
  29490. * // => true
  29491. *
  29492. * _.isPlainObject(Object.create(null));
  29493. * // => true
  29494. */
  29495. function isPlainObject(value) {
  29496. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  29497. return false;
  29498. }
  29499. var proto = getPrototype(value);
  29500. if (proto === null) {
  29501. return true;
  29502. }
  29503. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  29504. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  29505. funcToString.call(Ctor) == objectCtorString;
  29506. }
  29507. /**
  29508. * Checks if `value` is classified as a `RegExp` object.
  29509. *
  29510. * @static
  29511. * @memberOf _
  29512. * @since 0.1.0
  29513. * @category Lang
  29514. * @param {*} value The value to check.
  29515. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  29516. * @example
  29517. *
  29518. * _.isRegExp(/abc/);
  29519. * // => true
  29520. *
  29521. * _.isRegExp('/abc/');
  29522. * // => false
  29523. */
  29524. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  29525. /**
  29526. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  29527. * double precision number which isn't the result of a rounded unsafe integer.
  29528. *
  29529. * **Note:** This method is based on
  29530. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  29531. *
  29532. * @static
  29533. * @memberOf _
  29534. * @since 4.0.0
  29535. * @category Lang
  29536. * @param {*} value The value to check.
  29537. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  29538. * @example
  29539. *
  29540. * _.isSafeInteger(3);
  29541. * // => true
  29542. *
  29543. * _.isSafeInteger(Number.MIN_VALUE);
  29544. * // => false
  29545. *
  29546. * _.isSafeInteger(Infinity);
  29547. * // => false
  29548. *
  29549. * _.isSafeInteger('3');
  29550. * // => false
  29551. */
  29552. function isSafeInteger(value) {
  29553. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  29554. }
  29555. /**
  29556. * Checks if `value` is classified as a `Set` object.
  29557. *
  29558. * @static
  29559. * @memberOf _
  29560. * @since 4.3.0
  29561. * @category Lang
  29562. * @param {*} value The value to check.
  29563. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  29564. * @example
  29565. *
  29566. * _.isSet(new Set);
  29567. * // => true
  29568. *
  29569. * _.isSet(new WeakSet);
  29570. * // => false
  29571. */
  29572. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  29573. /**
  29574. * Checks if `value` is classified as a `String` primitive or object.
  29575. *
  29576. * @static
  29577. * @since 0.1.0
  29578. * @memberOf _
  29579. * @category Lang
  29580. * @param {*} value The value to check.
  29581. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  29582. * @example
  29583. *
  29584. * _.isString('abc');
  29585. * // => true
  29586. *
  29587. * _.isString(1);
  29588. * // => false
  29589. */
  29590. function isString(value) {
  29591. return typeof value == 'string' ||
  29592. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  29593. }
  29594. /**
  29595. * Checks if `value` is classified as a `Symbol` primitive or object.
  29596. *
  29597. * @static
  29598. * @memberOf _
  29599. * @since 4.0.0
  29600. * @category Lang
  29601. * @param {*} value The value to check.
  29602. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  29603. * @example
  29604. *
  29605. * _.isSymbol(Symbol.iterator);
  29606. * // => true
  29607. *
  29608. * _.isSymbol('abc');
  29609. * // => false
  29610. */
  29611. function isSymbol(value) {
  29612. return typeof value == 'symbol' ||
  29613. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  29614. }
  29615. /**
  29616. * Checks if `value` is classified as a typed array.
  29617. *
  29618. * @static
  29619. * @memberOf _
  29620. * @since 3.0.0
  29621. * @category Lang
  29622. * @param {*} value The value to check.
  29623. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  29624. * @example
  29625. *
  29626. * _.isTypedArray(new Uint8Array);
  29627. * // => true
  29628. *
  29629. * _.isTypedArray([]);
  29630. * // => false
  29631. */
  29632. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  29633. /**
  29634. * Checks if `value` is `undefined`.
  29635. *
  29636. * @static
  29637. * @since 0.1.0
  29638. * @memberOf _
  29639. * @category Lang
  29640. * @param {*} value The value to check.
  29641. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  29642. * @example
  29643. *
  29644. * _.isUndefined(void 0);
  29645. * // => true
  29646. *
  29647. * _.isUndefined(null);
  29648. * // => false
  29649. */
  29650. function isUndefined(value) {
  29651. return value === undefined;
  29652. }
  29653. /**
  29654. * Checks if `value` is classified as a `WeakMap` object.
  29655. *
  29656. * @static
  29657. * @memberOf _
  29658. * @since 4.3.0
  29659. * @category Lang
  29660. * @param {*} value The value to check.
  29661. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  29662. * @example
  29663. *
  29664. * _.isWeakMap(new WeakMap);
  29665. * // => true
  29666. *
  29667. * _.isWeakMap(new Map);
  29668. * // => false
  29669. */
  29670. function isWeakMap(value) {
  29671. return isObjectLike(value) && getTag(value) == weakMapTag;
  29672. }
  29673. /**
  29674. * Checks if `value` is classified as a `WeakSet` object.
  29675. *
  29676. * @static
  29677. * @memberOf _
  29678. * @since 4.3.0
  29679. * @category Lang
  29680. * @param {*} value The value to check.
  29681. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  29682. * @example
  29683. *
  29684. * _.isWeakSet(new WeakSet);
  29685. * // => true
  29686. *
  29687. * _.isWeakSet(new Set);
  29688. * // => false
  29689. */
  29690. function isWeakSet(value) {
  29691. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  29692. }
  29693. /**
  29694. * Checks if `value` is less than `other`.
  29695. *
  29696. * @static
  29697. * @memberOf _
  29698. * @since 3.9.0
  29699. * @category Lang
  29700. * @param {*} value The value to compare.
  29701. * @param {*} other The other value to compare.
  29702. * @returns {boolean} Returns `true` if `value` is less than `other`,
  29703. * else `false`.
  29704. * @see _.gt
  29705. * @example
  29706. *
  29707. * _.lt(1, 3);
  29708. * // => true
  29709. *
  29710. * _.lt(3, 3);
  29711. * // => false
  29712. *
  29713. * _.lt(3, 1);
  29714. * // => false
  29715. */
  29716. var lt = createRelationalOperation(baseLt);
  29717. /**
  29718. * Checks if `value` is less than or equal to `other`.
  29719. *
  29720. * @static
  29721. * @memberOf _
  29722. * @since 3.9.0
  29723. * @category Lang
  29724. * @param {*} value The value to compare.
  29725. * @param {*} other The other value to compare.
  29726. * @returns {boolean} Returns `true` if `value` is less than or equal to
  29727. * `other`, else `false`.
  29728. * @see _.gte
  29729. * @example
  29730. *
  29731. * _.lte(1, 3);
  29732. * // => true
  29733. *
  29734. * _.lte(3, 3);
  29735. * // => true
  29736. *
  29737. * _.lte(3, 1);
  29738. * // => false
  29739. */
  29740. var lte = createRelationalOperation(function(value, other) {
  29741. return value <= other;
  29742. });
  29743. /**
  29744. * Converts `value` to an array.
  29745. *
  29746. * @static
  29747. * @since 0.1.0
  29748. * @memberOf _
  29749. * @category Lang
  29750. * @param {*} value The value to convert.
  29751. * @returns {Array} Returns the converted array.
  29752. * @example
  29753. *
  29754. * _.toArray({ 'a': 1, 'b': 2 });
  29755. * // => [1, 2]
  29756. *
  29757. * _.toArray('abc');
  29758. * // => ['a', 'b', 'c']
  29759. *
  29760. * _.toArray(1);
  29761. * // => []
  29762. *
  29763. * _.toArray(null);
  29764. * // => []
  29765. */
  29766. function toArray(value) {
  29767. if (!value) {
  29768. return [];
  29769. }
  29770. if (isArrayLike(value)) {
  29771. return isString(value) ? stringToArray(value) : copyArray(value);
  29772. }
  29773. if (symIterator && value[symIterator]) {
  29774. return iteratorToArray(value[symIterator]());
  29775. }
  29776. var tag = getTag(value),
  29777. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  29778. return func(value);
  29779. }
  29780. /**
  29781. * Converts `value` to a finite number.
  29782. *
  29783. * @static
  29784. * @memberOf _
  29785. * @since 4.12.0
  29786. * @category Lang
  29787. * @param {*} value The value to convert.
  29788. * @returns {number} Returns the converted number.
  29789. * @example
  29790. *
  29791. * _.toFinite(3.2);
  29792. * // => 3.2
  29793. *
  29794. * _.toFinite(Number.MIN_VALUE);
  29795. * // => 5e-324
  29796. *
  29797. * _.toFinite(Infinity);
  29798. * // => 1.7976931348623157e+308
  29799. *
  29800. * _.toFinite('3.2');
  29801. * // => 3.2
  29802. */
  29803. function toFinite(value) {
  29804. if (!value) {
  29805. return value === 0 ? value : 0;
  29806. }
  29807. value = toNumber(value);
  29808. if (value === INFINITY || value === -INFINITY) {
  29809. var sign = (value < 0 ? -1 : 1);
  29810. return sign * MAX_INTEGER;
  29811. }
  29812. return value === value ? value : 0;
  29813. }
  29814. /**
  29815. * Converts `value` to an integer.
  29816. *
  29817. * **Note:** This method is loosely based on
  29818. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  29819. *
  29820. * @static
  29821. * @memberOf _
  29822. * @since 4.0.0
  29823. * @category Lang
  29824. * @param {*} value The value to convert.
  29825. * @returns {number} Returns the converted integer.
  29826. * @example
  29827. *
  29828. * _.toInteger(3.2);
  29829. * // => 3
  29830. *
  29831. * _.toInteger(Number.MIN_VALUE);
  29832. * // => 0
  29833. *
  29834. * _.toInteger(Infinity);
  29835. * // => 1.7976931348623157e+308
  29836. *
  29837. * _.toInteger('3.2');
  29838. * // => 3
  29839. */
  29840. function toInteger(value) {
  29841. var result = toFinite(value),
  29842. remainder = result % 1;
  29843. return result === result ? (remainder ? result - remainder : result) : 0;
  29844. }
  29845. /**
  29846. * Converts `value` to an integer suitable for use as the length of an
  29847. * array-like object.
  29848. *
  29849. * **Note:** This method is based on
  29850. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29851. *
  29852. * @static
  29853. * @memberOf _
  29854. * @since 4.0.0
  29855. * @category Lang
  29856. * @param {*} value The value to convert.
  29857. * @returns {number} Returns the converted integer.
  29858. * @example
  29859. *
  29860. * _.toLength(3.2);
  29861. * // => 3
  29862. *
  29863. * _.toLength(Number.MIN_VALUE);
  29864. * // => 0
  29865. *
  29866. * _.toLength(Infinity);
  29867. * // => 4294967295
  29868. *
  29869. * _.toLength('3.2');
  29870. * // => 3
  29871. */
  29872. function toLength(value) {
  29873. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  29874. }
  29875. /**
  29876. * Converts `value` to a number.
  29877. *
  29878. * @static
  29879. * @memberOf _
  29880. * @since 4.0.0
  29881. * @category Lang
  29882. * @param {*} value The value to process.
  29883. * @returns {number} Returns the number.
  29884. * @example
  29885. *
  29886. * _.toNumber(3.2);
  29887. * // => 3.2
  29888. *
  29889. * _.toNumber(Number.MIN_VALUE);
  29890. * // => 5e-324
  29891. *
  29892. * _.toNumber(Infinity);
  29893. * // => Infinity
  29894. *
  29895. * _.toNumber('3.2');
  29896. * // => 3.2
  29897. */
  29898. function toNumber(value) {
  29899. if (typeof value == 'number') {
  29900. return value;
  29901. }
  29902. if (isSymbol(value)) {
  29903. return NAN;
  29904. }
  29905. if (isObject(value)) {
  29906. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  29907. value = isObject(other) ? (other + '') : other;
  29908. }
  29909. if (typeof value != 'string') {
  29910. return value === 0 ? value : +value;
  29911. }
  29912. value = value.replace(reTrim, '');
  29913. var isBinary = reIsBinary.test(value);
  29914. return (isBinary || reIsOctal.test(value))
  29915. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  29916. : (reIsBadHex.test(value) ? NAN : +value);
  29917. }
  29918. /**
  29919. * Converts `value` to a plain object flattening inherited enumerable string
  29920. * keyed properties of `value` to own properties of the plain object.
  29921. *
  29922. * @static
  29923. * @memberOf _
  29924. * @since 3.0.0
  29925. * @category Lang
  29926. * @param {*} value The value to convert.
  29927. * @returns {Object} Returns the converted plain object.
  29928. * @example
  29929. *
  29930. * function Foo() {
  29931. * this.b = 2;
  29932. * }
  29933. *
  29934. * Foo.prototype.c = 3;
  29935. *
  29936. * _.assign({ 'a': 1 }, new Foo);
  29937. * // => { 'a': 1, 'b': 2 }
  29938. *
  29939. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  29940. * // => { 'a': 1, 'b': 2, 'c': 3 }
  29941. */
  29942. function toPlainObject(value) {
  29943. return copyObject(value, keysIn(value));
  29944. }
  29945. /**
  29946. * Converts `value` to a safe integer. A safe integer can be compared and
  29947. * represented correctly.
  29948. *
  29949. * @static
  29950. * @memberOf _
  29951. * @since 4.0.0
  29952. * @category Lang
  29953. * @param {*} value The value to convert.
  29954. * @returns {number} Returns the converted integer.
  29955. * @example
  29956. *
  29957. * _.toSafeInteger(3.2);
  29958. * // => 3
  29959. *
  29960. * _.toSafeInteger(Number.MIN_VALUE);
  29961. * // => 0
  29962. *
  29963. * _.toSafeInteger(Infinity);
  29964. * // => 9007199254740991
  29965. *
  29966. * _.toSafeInteger('3.2');
  29967. * // => 3
  29968. */
  29969. function toSafeInteger(value) {
  29970. return value
  29971. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  29972. : (value === 0 ? value : 0);
  29973. }
  29974. /**
  29975. * Converts `value` to a string. An empty string is returned for `null`
  29976. * and `undefined` values. The sign of `-0` is preserved.
  29977. *
  29978. * @static
  29979. * @memberOf _
  29980. * @since 4.0.0
  29981. * @category Lang
  29982. * @param {*} value The value to convert.
  29983. * @returns {string} Returns the converted string.
  29984. * @example
  29985. *
  29986. * _.toString(null);
  29987. * // => ''
  29988. *
  29989. * _.toString(-0);
  29990. * // => '-0'
  29991. *
  29992. * _.toString([1, 2, 3]);
  29993. * // => '1,2,3'
  29994. */
  29995. function toString(value) {
  29996. return value == null ? '' : baseToString(value);
  29997. }
  29998. /*------------------------------------------------------------------------*/
  29999. /**
  30000. * Assigns own enumerable string keyed properties of source objects to the
  30001. * destination object. Source objects are applied from left to right.
  30002. * Subsequent sources overwrite property assignments of previous sources.
  30003. *
  30004. * **Note:** This method mutates `object` and is loosely based on
  30005. * [`Object.assign`](https://mdn.io/Object/assign).
  30006. *
  30007. * @static
  30008. * @memberOf _
  30009. * @since 0.10.0
  30010. * @category Object
  30011. * @param {Object} object The destination object.
  30012. * @param {...Object} [sources] The source objects.
  30013. * @returns {Object} Returns `object`.
  30014. * @see _.assignIn
  30015. * @example
  30016. *
  30017. * function Foo() {
  30018. * this.a = 1;
  30019. * }
  30020. *
  30021. * function Bar() {
  30022. * this.c = 3;
  30023. * }
  30024. *
  30025. * Foo.prototype.b = 2;
  30026. * Bar.prototype.d = 4;
  30027. *
  30028. * _.assign({ 'a': 0 }, new Foo, new Bar);
  30029. * // => { 'a': 1, 'c': 3 }
  30030. */
  30031. var assign = createAssigner(function(object, source) {
  30032. if (isPrototype(source) || isArrayLike(source)) {
  30033. copyObject(source, keys(source), object);
  30034. return;
  30035. }
  30036. for (var key in source) {
  30037. if (hasOwnProperty.call(source, key)) {
  30038. assignValue(object, key, source[key]);
  30039. }
  30040. }
  30041. });
  30042. /**
  30043. * This method is like `_.assign` except that it iterates over own and
  30044. * inherited source properties.
  30045. *
  30046. * **Note:** This method mutates `object`.
  30047. *
  30048. * @static
  30049. * @memberOf _
  30050. * @since 4.0.0
  30051. * @alias extend
  30052. * @category Object
  30053. * @param {Object} object The destination object.
  30054. * @param {...Object} [sources] The source objects.
  30055. * @returns {Object} Returns `object`.
  30056. * @see _.assign
  30057. * @example
  30058. *
  30059. * function Foo() {
  30060. * this.a = 1;
  30061. * }
  30062. *
  30063. * function Bar() {
  30064. * this.c = 3;
  30065. * }
  30066. *
  30067. * Foo.prototype.b = 2;
  30068. * Bar.prototype.d = 4;
  30069. *
  30070. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  30071. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  30072. */
  30073. var assignIn = createAssigner(function(object, source) {
  30074. copyObject(source, keysIn(source), object);
  30075. });
  30076. /**
  30077. * This method is like `_.assignIn` except that it accepts `customizer`
  30078. * which is invoked to produce the assigned values. If `customizer` returns
  30079. * `undefined`, assignment is handled by the method instead. The `customizer`
  30080. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30081. *
  30082. * **Note:** This method mutates `object`.
  30083. *
  30084. * @static
  30085. * @memberOf _
  30086. * @since 4.0.0
  30087. * @alias extendWith
  30088. * @category Object
  30089. * @param {Object} object The destination object.
  30090. * @param {...Object} sources The source objects.
  30091. * @param {Function} [customizer] The function to customize assigned values.
  30092. * @returns {Object} Returns `object`.
  30093. * @see _.assignWith
  30094. * @example
  30095. *
  30096. * function customizer(objValue, srcValue) {
  30097. * return _.isUndefined(objValue) ? srcValue : objValue;
  30098. * }
  30099. *
  30100. * var defaults = _.partialRight(_.assignInWith, customizer);
  30101. *
  30102. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30103. * // => { 'a': 1, 'b': 2 }
  30104. */
  30105. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  30106. copyObject(source, keysIn(source), object, customizer);
  30107. });
  30108. /**
  30109. * This method is like `_.assign` except that it accepts `customizer`
  30110. * which is invoked to produce the assigned values. If `customizer` returns
  30111. * `undefined`, assignment is handled by the method instead. The `customizer`
  30112. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30113. *
  30114. * **Note:** This method mutates `object`.
  30115. *
  30116. * @static
  30117. * @memberOf _
  30118. * @since 4.0.0
  30119. * @category Object
  30120. * @param {Object} object The destination object.
  30121. * @param {...Object} sources The source objects.
  30122. * @param {Function} [customizer] The function to customize assigned values.
  30123. * @returns {Object} Returns `object`.
  30124. * @see _.assignInWith
  30125. * @example
  30126. *
  30127. * function customizer(objValue, srcValue) {
  30128. * return _.isUndefined(objValue) ? srcValue : objValue;
  30129. * }
  30130. *
  30131. * var defaults = _.partialRight(_.assignWith, customizer);
  30132. *
  30133. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30134. * // => { 'a': 1, 'b': 2 }
  30135. */
  30136. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  30137. copyObject(source, keys(source), object, customizer);
  30138. });
  30139. /**
  30140. * Creates an array of values corresponding to `paths` of `object`.
  30141. *
  30142. * @static
  30143. * @memberOf _
  30144. * @since 1.0.0
  30145. * @category Object
  30146. * @param {Object} object The object to iterate over.
  30147. * @param {...(string|string[])} [paths] The property paths to pick.
  30148. * @returns {Array} Returns the picked values.
  30149. * @example
  30150. *
  30151. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  30152. *
  30153. * _.at(object, ['a[0].b.c', 'a[1]']);
  30154. * // => [3, 4]
  30155. */
  30156. var at = flatRest(baseAt);
  30157. /**
  30158. * Creates an object that inherits from the `prototype` object. If a
  30159. * `properties` object is given, its own enumerable string keyed properties
  30160. * are assigned to the created object.
  30161. *
  30162. * @static
  30163. * @memberOf _
  30164. * @since 2.3.0
  30165. * @category Object
  30166. * @param {Object} prototype The object to inherit from.
  30167. * @param {Object} [properties] The properties to assign to the object.
  30168. * @returns {Object} Returns the new object.
  30169. * @example
  30170. *
  30171. * function Shape() {
  30172. * this.x = 0;
  30173. * this.y = 0;
  30174. * }
  30175. *
  30176. * function Circle() {
  30177. * Shape.call(this);
  30178. * }
  30179. *
  30180. * Circle.prototype = _.create(Shape.prototype, {
  30181. * 'constructor': Circle
  30182. * });
  30183. *
  30184. * var circle = new Circle;
  30185. * circle instanceof Circle;
  30186. * // => true
  30187. *
  30188. * circle instanceof Shape;
  30189. * // => true
  30190. */
  30191. function create(prototype, properties) {
  30192. var result = baseCreate(prototype);
  30193. return properties == null ? result : baseAssign(result, properties);
  30194. }
  30195. /**
  30196. * Assigns own and inherited enumerable string keyed properties of source
  30197. * objects to the destination object for all destination properties that
  30198. * resolve to `undefined`. Source objects are applied from left to right.
  30199. * Once a property is set, additional values of the same property are ignored.
  30200. *
  30201. * **Note:** This method mutates `object`.
  30202. *
  30203. * @static
  30204. * @since 0.1.0
  30205. * @memberOf _
  30206. * @category Object
  30207. * @param {Object} object The destination object.
  30208. * @param {...Object} [sources] The source objects.
  30209. * @returns {Object} Returns `object`.
  30210. * @see _.defaultsDeep
  30211. * @example
  30212. *
  30213. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30214. * // => { 'a': 1, 'b': 2 }
  30215. */
  30216. var defaults = baseRest(function(object, sources) {
  30217. object = Object(object);
  30218. var index = -1;
  30219. var length = sources.length;
  30220. var guard = length > 2 ? sources[2] : undefined;
  30221. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  30222. length = 1;
  30223. }
  30224. while (++index < length) {
  30225. var source = sources[index];
  30226. var props = keysIn(source);
  30227. var propsIndex = -1;
  30228. var propsLength = props.length;
  30229. while (++propsIndex < propsLength) {
  30230. var key = props[propsIndex];
  30231. var value = object[key];
  30232. if (value === undefined ||
  30233. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  30234. object[key] = source[key];
  30235. }
  30236. }
  30237. }
  30238. return object;
  30239. });
  30240. /**
  30241. * This method is like `_.defaults` except that it recursively assigns
  30242. * default properties.
  30243. *
  30244. * **Note:** This method mutates `object`.
  30245. *
  30246. * @static
  30247. * @memberOf _
  30248. * @since 3.10.0
  30249. * @category Object
  30250. * @param {Object} object The destination object.
  30251. * @param {...Object} [sources] The source objects.
  30252. * @returns {Object} Returns `object`.
  30253. * @see _.defaults
  30254. * @example
  30255. *
  30256. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  30257. * // => { 'a': { 'b': 2, 'c': 3 } }
  30258. */
  30259. var defaultsDeep = baseRest(function(args) {
  30260. args.push(undefined, customDefaultsMerge);
  30261. return apply(mergeWith, undefined, args);
  30262. });
  30263. /**
  30264. * This method is like `_.find` except that it returns the key of the first
  30265. * element `predicate` returns truthy for instead of the element itself.
  30266. *
  30267. * @static
  30268. * @memberOf _
  30269. * @since 1.1.0
  30270. * @category Object
  30271. * @param {Object} object The object to inspect.
  30272. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30273. * @returns {string|undefined} Returns the key of the matched element,
  30274. * else `undefined`.
  30275. * @example
  30276. *
  30277. * var users = {
  30278. * 'barney': { 'age': 36, 'active': true },
  30279. * 'fred': { 'age': 40, 'active': false },
  30280. * 'pebbles': { 'age': 1, 'active': true }
  30281. * };
  30282. *
  30283. * _.findKey(users, function(o) { return o.age < 40; });
  30284. * // => 'barney' (iteration order is not guaranteed)
  30285. *
  30286. * // The `_.matches` iteratee shorthand.
  30287. * _.findKey(users, { 'age': 1, 'active': true });
  30288. * // => 'pebbles'
  30289. *
  30290. * // The `_.matchesProperty` iteratee shorthand.
  30291. * _.findKey(users, ['active', false]);
  30292. * // => 'fred'
  30293. *
  30294. * // The `_.property` iteratee shorthand.
  30295. * _.findKey(users, 'active');
  30296. * // => 'barney'
  30297. */
  30298. function findKey(object, predicate) {
  30299. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  30300. }
  30301. /**
  30302. * This method is like `_.findKey` except that it iterates over elements of
  30303. * a collection in the opposite order.
  30304. *
  30305. * @static
  30306. * @memberOf _
  30307. * @since 2.0.0
  30308. * @category Object
  30309. * @param {Object} object The object to inspect.
  30310. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30311. * @returns {string|undefined} Returns the key of the matched element,
  30312. * else `undefined`.
  30313. * @example
  30314. *
  30315. * var users = {
  30316. * 'barney': { 'age': 36, 'active': true },
  30317. * 'fred': { 'age': 40, 'active': false },
  30318. * 'pebbles': { 'age': 1, 'active': true }
  30319. * };
  30320. *
  30321. * _.findLastKey(users, function(o) { return o.age < 40; });
  30322. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  30323. *
  30324. * // The `_.matches` iteratee shorthand.
  30325. * _.findLastKey(users, { 'age': 36, 'active': true });
  30326. * // => 'barney'
  30327. *
  30328. * // The `_.matchesProperty` iteratee shorthand.
  30329. * _.findLastKey(users, ['active', false]);
  30330. * // => 'fred'
  30331. *
  30332. * // The `_.property` iteratee shorthand.
  30333. * _.findLastKey(users, 'active');
  30334. * // => 'pebbles'
  30335. */
  30336. function findLastKey(object, predicate) {
  30337. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  30338. }
  30339. /**
  30340. * Iterates over own and inherited enumerable string keyed properties of an
  30341. * object and invokes `iteratee` for each property. The iteratee is invoked
  30342. * with three arguments: (value, key, object). Iteratee functions may exit
  30343. * iteration early by explicitly returning `false`.
  30344. *
  30345. * @static
  30346. * @memberOf _
  30347. * @since 0.3.0
  30348. * @category Object
  30349. * @param {Object} object The object to iterate over.
  30350. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30351. * @returns {Object} Returns `object`.
  30352. * @see _.forInRight
  30353. * @example
  30354. *
  30355. * function Foo() {
  30356. * this.a = 1;
  30357. * this.b = 2;
  30358. * }
  30359. *
  30360. * Foo.prototype.c = 3;
  30361. *
  30362. * _.forIn(new Foo, function(value, key) {
  30363. * console.log(key);
  30364. * });
  30365. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  30366. */
  30367. function forIn(object, iteratee) {
  30368. return object == null
  30369. ? object
  30370. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  30371. }
  30372. /**
  30373. * This method is like `_.forIn` except that it iterates over properties of
  30374. * `object` in the opposite order.
  30375. *
  30376. * @static
  30377. * @memberOf _
  30378. * @since 2.0.0
  30379. * @category Object
  30380. * @param {Object} object The object to iterate over.
  30381. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30382. * @returns {Object} Returns `object`.
  30383. * @see _.forIn
  30384. * @example
  30385. *
  30386. * function Foo() {
  30387. * this.a = 1;
  30388. * this.b = 2;
  30389. * }
  30390. *
  30391. * Foo.prototype.c = 3;
  30392. *
  30393. * _.forInRight(new Foo, function(value, key) {
  30394. * console.log(key);
  30395. * });
  30396. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  30397. */
  30398. function forInRight(object, iteratee) {
  30399. return object == null
  30400. ? object
  30401. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  30402. }
  30403. /**
  30404. * Iterates over own enumerable string keyed properties of an object and
  30405. * invokes `iteratee` for each property. The iteratee is invoked with three
  30406. * arguments: (value, key, object). Iteratee functions may exit iteration
  30407. * early by explicitly returning `false`.
  30408. *
  30409. * @static
  30410. * @memberOf _
  30411. * @since 0.3.0
  30412. * @category Object
  30413. * @param {Object} object The object to iterate over.
  30414. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30415. * @returns {Object} Returns `object`.
  30416. * @see _.forOwnRight
  30417. * @example
  30418. *
  30419. * function Foo() {
  30420. * this.a = 1;
  30421. * this.b = 2;
  30422. * }
  30423. *
  30424. * Foo.prototype.c = 3;
  30425. *
  30426. * _.forOwn(new Foo, function(value, key) {
  30427. * console.log(key);
  30428. * });
  30429. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  30430. */
  30431. function forOwn(object, iteratee) {
  30432. return object && baseForOwn(object, getIteratee(iteratee, 3));
  30433. }
  30434. /**
  30435. * This method is like `_.forOwn` except that it iterates over properties of
  30436. * `object` in the opposite order.
  30437. *
  30438. * @static
  30439. * @memberOf _
  30440. * @since 2.0.0
  30441. * @category Object
  30442. * @param {Object} object The object to iterate over.
  30443. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30444. * @returns {Object} Returns `object`.
  30445. * @see _.forOwn
  30446. * @example
  30447. *
  30448. * function Foo() {
  30449. * this.a = 1;
  30450. * this.b = 2;
  30451. * }
  30452. *
  30453. * Foo.prototype.c = 3;
  30454. *
  30455. * _.forOwnRight(new Foo, function(value, key) {
  30456. * console.log(key);
  30457. * });
  30458. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  30459. */
  30460. function forOwnRight(object, iteratee) {
  30461. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  30462. }
  30463. /**
  30464. * Creates an array of function property names from own enumerable properties
  30465. * of `object`.
  30466. *
  30467. * @static
  30468. * @since 0.1.0
  30469. * @memberOf _
  30470. * @category Object
  30471. * @param {Object} object The object to inspect.
  30472. * @returns {Array} Returns the function names.
  30473. * @see _.functionsIn
  30474. * @example
  30475. *
  30476. * function Foo() {
  30477. * this.a = _.constant('a');
  30478. * this.b = _.constant('b');
  30479. * }
  30480. *
  30481. * Foo.prototype.c = _.constant('c');
  30482. *
  30483. * _.functions(new Foo);
  30484. * // => ['a', 'b']
  30485. */
  30486. function functions(object) {
  30487. return object == null ? [] : baseFunctions(object, keys(object));
  30488. }
  30489. /**
  30490. * Creates an array of function property names from own and inherited
  30491. * enumerable properties of `object`.
  30492. *
  30493. * @static
  30494. * @memberOf _
  30495. * @since 4.0.0
  30496. * @category Object
  30497. * @param {Object} object The object to inspect.
  30498. * @returns {Array} Returns the function names.
  30499. * @see _.functions
  30500. * @example
  30501. *
  30502. * function Foo() {
  30503. * this.a = _.constant('a');
  30504. * this.b = _.constant('b');
  30505. * }
  30506. *
  30507. * Foo.prototype.c = _.constant('c');
  30508. *
  30509. * _.functionsIn(new Foo);
  30510. * // => ['a', 'b', 'c']
  30511. */
  30512. function functionsIn(object) {
  30513. return object == null ? [] : baseFunctions(object, keysIn(object));
  30514. }
  30515. /**
  30516. * Gets the value at `path` of `object`. If the resolved value is
  30517. * `undefined`, the `defaultValue` is returned in its place.
  30518. *
  30519. * @static
  30520. * @memberOf _
  30521. * @since 3.7.0
  30522. * @category Object
  30523. * @param {Object} object The object to query.
  30524. * @param {Array|string} path The path of the property to get.
  30525. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30526. * @returns {*} Returns the resolved value.
  30527. * @example
  30528. *
  30529. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30530. *
  30531. * _.get(object, 'a[0].b.c');
  30532. * // => 3
  30533. *
  30534. * _.get(object, ['a', '0', 'b', 'c']);
  30535. * // => 3
  30536. *
  30537. * _.get(object, 'a.b.c', 'default');
  30538. * // => 'default'
  30539. */
  30540. function get(object, path, defaultValue) {
  30541. var result = object == null ? undefined : baseGet(object, path);
  30542. return result === undefined ? defaultValue : result;
  30543. }
  30544. /**
  30545. * Checks if `path` is a direct property of `object`.
  30546. *
  30547. * @static
  30548. * @since 0.1.0
  30549. * @memberOf _
  30550. * @category Object
  30551. * @param {Object} object The object to query.
  30552. * @param {Array|string} path The path to check.
  30553. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30554. * @example
  30555. *
  30556. * var object = { 'a': { 'b': 2 } };
  30557. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  30558. *
  30559. * _.has(object, 'a');
  30560. * // => true
  30561. *
  30562. * _.has(object, 'a.b');
  30563. * // => true
  30564. *
  30565. * _.has(object, ['a', 'b']);
  30566. * // => true
  30567. *
  30568. * _.has(other, 'a');
  30569. * // => false
  30570. */
  30571. function has(object, path) {
  30572. return object != null && hasPath(object, path, baseHas);
  30573. }
  30574. /**
  30575. * Checks if `path` is a direct or inherited property of `object`.
  30576. *
  30577. * @static
  30578. * @memberOf _
  30579. * @since 4.0.0
  30580. * @category Object
  30581. * @param {Object} object The object to query.
  30582. * @param {Array|string} path The path to check.
  30583. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30584. * @example
  30585. *
  30586. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  30587. *
  30588. * _.hasIn(object, 'a');
  30589. * // => true
  30590. *
  30591. * _.hasIn(object, 'a.b');
  30592. * // => true
  30593. *
  30594. * _.hasIn(object, ['a', 'b']);
  30595. * // => true
  30596. *
  30597. * _.hasIn(object, 'b');
  30598. * // => false
  30599. */
  30600. function hasIn(object, path) {
  30601. return object != null && hasPath(object, path, baseHasIn);
  30602. }
  30603. /**
  30604. * Creates an object composed of the inverted keys and values of `object`.
  30605. * If `object` contains duplicate values, subsequent values overwrite
  30606. * property assignments of previous values.
  30607. *
  30608. * @static
  30609. * @memberOf _
  30610. * @since 0.7.0
  30611. * @category Object
  30612. * @param {Object} object The object to invert.
  30613. * @returns {Object} Returns the new inverted object.
  30614. * @example
  30615. *
  30616. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30617. *
  30618. * _.invert(object);
  30619. * // => { '1': 'c', '2': 'b' }
  30620. */
  30621. var invert = createInverter(function(result, value, key) {
  30622. if (value != null &&
  30623. typeof value.toString != 'function') {
  30624. value = nativeObjectToString.call(value);
  30625. }
  30626. result[value] = key;
  30627. }, constant(identity));
  30628. /**
  30629. * This method is like `_.invert` except that the inverted object is generated
  30630. * from the results of running each element of `object` thru `iteratee`. The
  30631. * corresponding inverted value of each inverted key is an array of keys
  30632. * responsible for generating the inverted value. The iteratee is invoked
  30633. * with one argument: (value).
  30634. *
  30635. * @static
  30636. * @memberOf _
  30637. * @since 4.1.0
  30638. * @category Object
  30639. * @param {Object} object The object to invert.
  30640. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  30641. * @returns {Object} Returns the new inverted object.
  30642. * @example
  30643. *
  30644. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30645. *
  30646. * _.invertBy(object);
  30647. * // => { '1': ['a', 'c'], '2': ['b'] }
  30648. *
  30649. * _.invertBy(object, function(value) {
  30650. * return 'group' + value;
  30651. * });
  30652. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  30653. */
  30654. var invertBy = createInverter(function(result, value, key) {
  30655. if (value != null &&
  30656. typeof value.toString != 'function') {
  30657. value = nativeObjectToString.call(value);
  30658. }
  30659. if (hasOwnProperty.call(result, value)) {
  30660. result[value].push(key);
  30661. } else {
  30662. result[value] = [key];
  30663. }
  30664. }, getIteratee);
  30665. /**
  30666. * Invokes the method at `path` of `object`.
  30667. *
  30668. * @static
  30669. * @memberOf _
  30670. * @since 4.0.0
  30671. * @category Object
  30672. * @param {Object} object The object to query.
  30673. * @param {Array|string} path The path of the method to invoke.
  30674. * @param {...*} [args] The arguments to invoke the method with.
  30675. * @returns {*} Returns the result of the invoked method.
  30676. * @example
  30677. *
  30678. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  30679. *
  30680. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  30681. * // => [2, 3]
  30682. */
  30683. var invoke = baseRest(baseInvoke);
  30684. /**
  30685. * Creates an array of the own enumerable property names of `object`.
  30686. *
  30687. * **Note:** Non-object values are coerced to objects. See the
  30688. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  30689. * for more details.
  30690. *
  30691. * @static
  30692. * @since 0.1.0
  30693. * @memberOf _
  30694. * @category Object
  30695. * @param {Object} object The object to query.
  30696. * @returns {Array} Returns the array of property names.
  30697. * @example
  30698. *
  30699. * function Foo() {
  30700. * this.a = 1;
  30701. * this.b = 2;
  30702. * }
  30703. *
  30704. * Foo.prototype.c = 3;
  30705. *
  30706. * _.keys(new Foo);
  30707. * // => ['a', 'b'] (iteration order is not guaranteed)
  30708. *
  30709. * _.keys('hi');
  30710. * // => ['0', '1']
  30711. */
  30712. function keys(object) {
  30713. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  30714. }
  30715. /**
  30716. * Creates an array of the own and inherited enumerable property names of `object`.
  30717. *
  30718. * **Note:** Non-object values are coerced to objects.
  30719. *
  30720. * @static
  30721. * @memberOf _
  30722. * @since 3.0.0
  30723. * @category Object
  30724. * @param {Object} object The object to query.
  30725. * @returns {Array} Returns the array of property names.
  30726. * @example
  30727. *
  30728. * function Foo() {
  30729. * this.a = 1;
  30730. * this.b = 2;
  30731. * }
  30732. *
  30733. * Foo.prototype.c = 3;
  30734. *
  30735. * _.keysIn(new Foo);
  30736. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  30737. */
  30738. function keysIn(object) {
  30739. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  30740. }
  30741. /**
  30742. * The opposite of `_.mapValues`; this method creates an object with the
  30743. * same values as `object` and keys generated by running each own enumerable
  30744. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  30745. * with three arguments: (value, key, object).
  30746. *
  30747. * @static
  30748. * @memberOf _
  30749. * @since 3.8.0
  30750. * @category Object
  30751. * @param {Object} object The object to iterate over.
  30752. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30753. * @returns {Object} Returns the new mapped object.
  30754. * @see _.mapValues
  30755. * @example
  30756. *
  30757. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  30758. * return key + value;
  30759. * });
  30760. * // => { 'a1': 1, 'b2': 2 }
  30761. */
  30762. function mapKeys(object, iteratee) {
  30763. var result = {};
  30764. iteratee = getIteratee(iteratee, 3);
  30765. baseForOwn(object, function(value, key, object) {
  30766. baseAssignValue(result, iteratee(value, key, object), value);
  30767. });
  30768. return result;
  30769. }
  30770. /**
  30771. * Creates an object with the same keys as `object` and values generated
  30772. * by running each own enumerable string keyed property of `object` thru
  30773. * `iteratee`. The iteratee is invoked with three arguments:
  30774. * (value, key, object).
  30775. *
  30776. * @static
  30777. * @memberOf _
  30778. * @since 2.4.0
  30779. * @category Object
  30780. * @param {Object} object The object to iterate over.
  30781. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30782. * @returns {Object} Returns the new mapped object.
  30783. * @see _.mapKeys
  30784. * @example
  30785. *
  30786. * var users = {
  30787. * 'fred': { 'user': 'fred', 'age': 40 },
  30788. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  30789. * };
  30790. *
  30791. * _.mapValues(users, function(o) { return o.age; });
  30792. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30793. *
  30794. * // The `_.property` iteratee shorthand.
  30795. * _.mapValues(users, 'age');
  30796. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30797. */
  30798. function mapValues(object, iteratee) {
  30799. var result = {};
  30800. iteratee = getIteratee(iteratee, 3);
  30801. baseForOwn(object, function(value, key, object) {
  30802. baseAssignValue(result, key, iteratee(value, key, object));
  30803. });
  30804. return result;
  30805. }
  30806. /**
  30807. * This method is like `_.assign` except that it recursively merges own and
  30808. * inherited enumerable string keyed properties of source objects into the
  30809. * destination object. Source properties that resolve to `undefined` are
  30810. * skipped if a destination value exists. Array and plain object properties
  30811. * are merged recursively. Other objects and value types are overridden by
  30812. * assignment. Source objects are applied from left to right. Subsequent
  30813. * sources overwrite property assignments of previous sources.
  30814. *
  30815. * **Note:** This method mutates `object`.
  30816. *
  30817. * @static
  30818. * @memberOf _
  30819. * @since 0.5.0
  30820. * @category Object
  30821. * @param {Object} object The destination object.
  30822. * @param {...Object} [sources] The source objects.
  30823. * @returns {Object} Returns `object`.
  30824. * @example
  30825. *
  30826. * var object = {
  30827. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  30828. * };
  30829. *
  30830. * var other = {
  30831. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  30832. * };
  30833. *
  30834. * _.merge(object, other);
  30835. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  30836. */
  30837. var merge = createAssigner(function(object, source, srcIndex) {
  30838. baseMerge(object, source, srcIndex);
  30839. });
  30840. /**
  30841. * This method is like `_.merge` except that it accepts `customizer` which
  30842. * is invoked to produce the merged values of the destination and source
  30843. * properties. If `customizer` returns `undefined`, merging is handled by the
  30844. * method instead. The `customizer` is invoked with six arguments:
  30845. * (objValue, srcValue, key, object, source, stack).
  30846. *
  30847. * **Note:** This method mutates `object`.
  30848. *
  30849. * @static
  30850. * @memberOf _
  30851. * @since 4.0.0
  30852. * @category Object
  30853. * @param {Object} object The destination object.
  30854. * @param {...Object} sources The source objects.
  30855. * @param {Function} customizer The function to customize assigned values.
  30856. * @returns {Object} Returns `object`.
  30857. * @example
  30858. *
  30859. * function customizer(objValue, srcValue) {
  30860. * if (_.isArray(objValue)) {
  30861. * return objValue.concat(srcValue);
  30862. * }
  30863. * }
  30864. *
  30865. * var object = { 'a': [1], 'b': [2] };
  30866. * var other = { 'a': [3], 'b': [4] };
  30867. *
  30868. * _.mergeWith(object, other, customizer);
  30869. * // => { 'a': [1, 3], 'b': [2, 4] }
  30870. */
  30871. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  30872. baseMerge(object, source, srcIndex, customizer);
  30873. });
  30874. /**
  30875. * The opposite of `_.pick`; this method creates an object composed of the
  30876. * own and inherited enumerable property paths of `object` that are not omitted.
  30877. *
  30878. * **Note:** This method is considerably slower than `_.pick`.
  30879. *
  30880. * @static
  30881. * @since 0.1.0
  30882. * @memberOf _
  30883. * @category Object
  30884. * @param {Object} object The source object.
  30885. * @param {...(string|string[])} [paths] The property paths to omit.
  30886. * @returns {Object} Returns the new object.
  30887. * @example
  30888. *
  30889. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30890. *
  30891. * _.omit(object, ['a', 'c']);
  30892. * // => { 'b': '2' }
  30893. */
  30894. var omit = flatRest(function(object, paths) {
  30895. var result = {};
  30896. if (object == null) {
  30897. return result;
  30898. }
  30899. var isDeep = false;
  30900. paths = arrayMap(paths, function(path) {
  30901. path = castPath(path, object);
  30902. isDeep || (isDeep = path.length > 1);
  30903. return path;
  30904. });
  30905. copyObject(object, getAllKeysIn(object), result);
  30906. if (isDeep) {
  30907. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  30908. }
  30909. var length = paths.length;
  30910. while (length--) {
  30911. baseUnset(result, paths[length]);
  30912. }
  30913. return result;
  30914. });
  30915. /**
  30916. * The opposite of `_.pickBy`; this method creates an object composed of
  30917. * the own and inherited enumerable string keyed properties of `object` that
  30918. * `predicate` doesn't return truthy for. The predicate is invoked with two
  30919. * arguments: (value, key).
  30920. *
  30921. * @static
  30922. * @memberOf _
  30923. * @since 4.0.0
  30924. * @category Object
  30925. * @param {Object} object The source object.
  30926. * @param {Function} [predicate=_.identity] The function invoked per property.
  30927. * @returns {Object} Returns the new object.
  30928. * @example
  30929. *
  30930. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30931. *
  30932. * _.omitBy(object, _.isNumber);
  30933. * // => { 'b': '2' }
  30934. */
  30935. function omitBy(object, predicate) {
  30936. return pickBy(object, negate(getIteratee(predicate)));
  30937. }
  30938. /**
  30939. * Creates an object composed of the picked `object` properties.
  30940. *
  30941. * @static
  30942. * @since 0.1.0
  30943. * @memberOf _
  30944. * @category Object
  30945. * @param {Object} object The source object.
  30946. * @param {...(string|string[])} [paths] The property paths to pick.
  30947. * @returns {Object} Returns the new object.
  30948. * @example
  30949. *
  30950. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30951. *
  30952. * _.pick(object, ['a', 'c']);
  30953. * // => { 'a': 1, 'c': 3 }
  30954. */
  30955. var pick = flatRest(function(object, paths) {
  30956. return object == null ? {} : basePick(object, paths);
  30957. });
  30958. /**
  30959. * Creates an object composed of the `object` properties `predicate` returns
  30960. * truthy for. The predicate is invoked with two arguments: (value, key).
  30961. *
  30962. * @static
  30963. * @memberOf _
  30964. * @since 4.0.0
  30965. * @category Object
  30966. * @param {Object} object The source object.
  30967. * @param {Function} [predicate=_.identity] The function invoked per property.
  30968. * @returns {Object} Returns the new object.
  30969. * @example
  30970. *
  30971. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30972. *
  30973. * _.pickBy(object, _.isNumber);
  30974. * // => { 'a': 1, 'c': 3 }
  30975. */
  30976. function pickBy(object, predicate) {
  30977. if (object == null) {
  30978. return {};
  30979. }
  30980. var props = arrayMap(getAllKeysIn(object), function(prop) {
  30981. return [prop];
  30982. });
  30983. predicate = getIteratee(predicate);
  30984. return basePickBy(object, props, function(value, path) {
  30985. return predicate(value, path[0]);
  30986. });
  30987. }
  30988. /**
  30989. * This method is like `_.get` except that if the resolved value is a
  30990. * function it's invoked with the `this` binding of its parent object and
  30991. * its result is returned.
  30992. *
  30993. * @static
  30994. * @since 0.1.0
  30995. * @memberOf _
  30996. * @category Object
  30997. * @param {Object} object The object to query.
  30998. * @param {Array|string} path The path of the property to resolve.
  30999. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31000. * @returns {*} Returns the resolved value.
  31001. * @example
  31002. *
  31003. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  31004. *
  31005. * _.result(object, 'a[0].b.c1');
  31006. * // => 3
  31007. *
  31008. * _.result(object, 'a[0].b.c2');
  31009. * // => 4
  31010. *
  31011. * _.result(object, 'a[0].b.c3', 'default');
  31012. * // => 'default'
  31013. *
  31014. * _.result(object, 'a[0].b.c3', _.constant('default'));
  31015. * // => 'default'
  31016. */
  31017. function result(object, path, defaultValue) {
  31018. path = castPath(path, object);
  31019. var index = -1,
  31020. length = path.length;
  31021. // Ensure the loop is entered when path is empty.
  31022. if (!length) {
  31023. length = 1;
  31024. object = undefined;
  31025. }
  31026. while (++index < length) {
  31027. var value = object == null ? undefined : object[toKey(path[index])];
  31028. if (value === undefined) {
  31029. index = length;
  31030. value = defaultValue;
  31031. }
  31032. object = isFunction(value) ? value.call(object) : value;
  31033. }
  31034. return object;
  31035. }
  31036. /**
  31037. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  31038. * it's created. Arrays are created for missing index properties while objects
  31039. * are created for all other missing properties. Use `_.setWith` to customize
  31040. * `path` creation.
  31041. *
  31042. * **Note:** This method mutates `object`.
  31043. *
  31044. * @static
  31045. * @memberOf _
  31046. * @since 3.7.0
  31047. * @category Object
  31048. * @param {Object} object The object to modify.
  31049. * @param {Array|string} path The path of the property to set.
  31050. * @param {*} value The value to set.
  31051. * @returns {Object} Returns `object`.
  31052. * @example
  31053. *
  31054. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31055. *
  31056. * _.set(object, 'a[0].b.c', 4);
  31057. * console.log(object.a[0].b.c);
  31058. * // => 4
  31059. *
  31060. * _.set(object, ['x', '0', 'y', 'z'], 5);
  31061. * console.log(object.x[0].y.z);
  31062. * // => 5
  31063. */
  31064. function set(object, path, value) {
  31065. return object == null ? object : baseSet(object, path, value);
  31066. }
  31067. /**
  31068. * This method is like `_.set` except that it accepts `customizer` which is
  31069. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31070. * path creation is handled by the method instead. The `customizer` is invoked
  31071. * with three arguments: (nsValue, key, nsObject).
  31072. *
  31073. * **Note:** This method mutates `object`.
  31074. *
  31075. * @static
  31076. * @memberOf _
  31077. * @since 4.0.0
  31078. * @category Object
  31079. * @param {Object} object The object to modify.
  31080. * @param {Array|string} path The path of the property to set.
  31081. * @param {*} value The value to set.
  31082. * @param {Function} [customizer] The function to customize assigned values.
  31083. * @returns {Object} Returns `object`.
  31084. * @example
  31085. *
  31086. * var object = {};
  31087. *
  31088. * _.setWith(object, '[0][1]', 'a', Object);
  31089. * // => { '0': { '1': 'a' } }
  31090. */
  31091. function setWith(object, path, value, customizer) {
  31092. customizer = typeof customizer == 'function' ? customizer : undefined;
  31093. return object == null ? object : baseSet(object, path, value, customizer);
  31094. }
  31095. /**
  31096. * Creates an array of own enumerable string keyed-value pairs for `object`
  31097. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  31098. * entries are returned.
  31099. *
  31100. * @static
  31101. * @memberOf _
  31102. * @since 4.0.0
  31103. * @alias entries
  31104. * @category Object
  31105. * @param {Object} object The object to query.
  31106. * @returns {Array} Returns the key-value pairs.
  31107. * @example
  31108. *
  31109. * function Foo() {
  31110. * this.a = 1;
  31111. * this.b = 2;
  31112. * }
  31113. *
  31114. * Foo.prototype.c = 3;
  31115. *
  31116. * _.toPairs(new Foo);
  31117. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  31118. */
  31119. var toPairs = createToPairs(keys);
  31120. /**
  31121. * Creates an array of own and inherited enumerable string keyed-value pairs
  31122. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  31123. * or set, its entries are returned.
  31124. *
  31125. * @static
  31126. * @memberOf _
  31127. * @since 4.0.0
  31128. * @alias entriesIn
  31129. * @category Object
  31130. * @param {Object} object The object to query.
  31131. * @returns {Array} Returns the key-value pairs.
  31132. * @example
  31133. *
  31134. * function Foo() {
  31135. * this.a = 1;
  31136. * this.b = 2;
  31137. * }
  31138. *
  31139. * Foo.prototype.c = 3;
  31140. *
  31141. * _.toPairsIn(new Foo);
  31142. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  31143. */
  31144. var toPairsIn = createToPairs(keysIn);
  31145. /**
  31146. * An alternative to `_.reduce`; this method transforms `object` to a new
  31147. * `accumulator` object which is the result of running each of its own
  31148. * enumerable string keyed properties thru `iteratee`, with each invocation
  31149. * potentially mutating the `accumulator` object. If `accumulator` is not
  31150. * provided, a new object with the same `[[Prototype]]` will be used. The
  31151. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  31152. * Iteratee functions may exit iteration early by explicitly returning `false`.
  31153. *
  31154. * @static
  31155. * @memberOf _
  31156. * @since 1.3.0
  31157. * @category Object
  31158. * @param {Object} object The object to iterate over.
  31159. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31160. * @param {*} [accumulator] The custom accumulator value.
  31161. * @returns {*} Returns the accumulated value.
  31162. * @example
  31163. *
  31164. * _.transform([2, 3, 4], function(result, n) {
  31165. * result.push(n *= n);
  31166. * return n % 2 == 0;
  31167. * }, []);
  31168. * // => [4, 9]
  31169. *
  31170. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  31171. * (result[value] || (result[value] = [])).push(key);
  31172. * }, {});
  31173. * // => { '1': ['a', 'c'], '2': ['b'] }
  31174. */
  31175. function transform(object, iteratee, accumulator) {
  31176. var isArr = isArray(object),
  31177. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  31178. iteratee = getIteratee(iteratee, 4);
  31179. if (accumulator == null) {
  31180. var Ctor = object && object.constructor;
  31181. if (isArrLike) {
  31182. accumulator = isArr ? new Ctor : [];
  31183. }
  31184. else if (isObject(object)) {
  31185. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  31186. }
  31187. else {
  31188. accumulator = {};
  31189. }
  31190. }
  31191. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  31192. return iteratee(accumulator, value, index, object);
  31193. });
  31194. return accumulator;
  31195. }
  31196. /**
  31197. * Removes the property at `path` of `object`.
  31198. *
  31199. * **Note:** This method mutates `object`.
  31200. *
  31201. * @static
  31202. * @memberOf _
  31203. * @since 4.0.0
  31204. * @category Object
  31205. * @param {Object} object The object to modify.
  31206. * @param {Array|string} path The path of the property to unset.
  31207. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  31208. * @example
  31209. *
  31210. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  31211. * _.unset(object, 'a[0].b.c');
  31212. * // => true
  31213. *
  31214. * console.log(object);
  31215. * // => { 'a': [{ 'b': {} }] };
  31216. *
  31217. * _.unset(object, ['a', '0', 'b', 'c']);
  31218. * // => true
  31219. *
  31220. * console.log(object);
  31221. * // => { 'a': [{ 'b': {} }] };
  31222. */
  31223. function unset(object, path) {
  31224. return object == null ? true : baseUnset(object, path);
  31225. }
  31226. /**
  31227. * This method is like `_.set` except that accepts `updater` to produce the
  31228. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  31229. * is invoked with one argument: (value).
  31230. *
  31231. * **Note:** This method mutates `object`.
  31232. *
  31233. * @static
  31234. * @memberOf _
  31235. * @since 4.6.0
  31236. * @category Object
  31237. * @param {Object} object The object to modify.
  31238. * @param {Array|string} path The path of the property to set.
  31239. * @param {Function} updater The function to produce the updated value.
  31240. * @returns {Object} Returns `object`.
  31241. * @example
  31242. *
  31243. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31244. *
  31245. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  31246. * console.log(object.a[0].b.c);
  31247. * // => 9
  31248. *
  31249. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  31250. * console.log(object.x[0].y.z);
  31251. * // => 0
  31252. */
  31253. function update(object, path, updater) {
  31254. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  31255. }
  31256. /**
  31257. * This method is like `_.update` except that it accepts `customizer` which is
  31258. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31259. * path creation is handled by the method instead. The `customizer` is invoked
  31260. * with three arguments: (nsValue, key, nsObject).
  31261. *
  31262. * **Note:** This method mutates `object`.
  31263. *
  31264. * @static
  31265. * @memberOf _
  31266. * @since 4.6.0
  31267. * @category Object
  31268. * @param {Object} object The object to modify.
  31269. * @param {Array|string} path The path of the property to set.
  31270. * @param {Function} updater The function to produce the updated value.
  31271. * @param {Function} [customizer] The function to customize assigned values.
  31272. * @returns {Object} Returns `object`.
  31273. * @example
  31274. *
  31275. * var object = {};
  31276. *
  31277. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  31278. * // => { '0': { '1': 'a' } }
  31279. */
  31280. function updateWith(object, path, updater, customizer) {
  31281. customizer = typeof customizer == 'function' ? customizer : undefined;
  31282. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  31283. }
  31284. /**
  31285. * Creates an array of the own enumerable string keyed property values of `object`.
  31286. *
  31287. * **Note:** Non-object values are coerced to objects.
  31288. *
  31289. * @static
  31290. * @since 0.1.0
  31291. * @memberOf _
  31292. * @category Object
  31293. * @param {Object} object The object to query.
  31294. * @returns {Array} Returns the array of property values.
  31295. * @example
  31296. *
  31297. * function Foo() {
  31298. * this.a = 1;
  31299. * this.b = 2;
  31300. * }
  31301. *
  31302. * Foo.prototype.c = 3;
  31303. *
  31304. * _.values(new Foo);
  31305. * // => [1, 2] (iteration order is not guaranteed)
  31306. *
  31307. * _.values('hi');
  31308. * // => ['h', 'i']
  31309. */
  31310. function values(object) {
  31311. return object == null ? [] : baseValues(object, keys(object));
  31312. }
  31313. /**
  31314. * Creates an array of the own and inherited enumerable string keyed property
  31315. * values of `object`.
  31316. *
  31317. * **Note:** Non-object values are coerced to objects.
  31318. *
  31319. * @static
  31320. * @memberOf _
  31321. * @since 3.0.0
  31322. * @category Object
  31323. * @param {Object} object The object to query.
  31324. * @returns {Array} Returns the array of property values.
  31325. * @example
  31326. *
  31327. * function Foo() {
  31328. * this.a = 1;
  31329. * this.b = 2;
  31330. * }
  31331. *
  31332. * Foo.prototype.c = 3;
  31333. *
  31334. * _.valuesIn(new Foo);
  31335. * // => [1, 2, 3] (iteration order is not guaranteed)
  31336. */
  31337. function valuesIn(object) {
  31338. return object == null ? [] : baseValues(object, keysIn(object));
  31339. }
  31340. /*------------------------------------------------------------------------*/
  31341. /**
  31342. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  31343. *
  31344. * @static
  31345. * @memberOf _
  31346. * @since 4.0.0
  31347. * @category Number
  31348. * @param {number} number The number to clamp.
  31349. * @param {number} [lower] The lower bound.
  31350. * @param {number} upper The upper bound.
  31351. * @returns {number} Returns the clamped number.
  31352. * @example
  31353. *
  31354. * _.clamp(-10, -5, 5);
  31355. * // => -5
  31356. *
  31357. * _.clamp(10, -5, 5);
  31358. * // => 5
  31359. */
  31360. function clamp(number, lower, upper) {
  31361. if (upper === undefined) {
  31362. upper = lower;
  31363. lower = undefined;
  31364. }
  31365. if (upper !== undefined) {
  31366. upper = toNumber(upper);
  31367. upper = upper === upper ? upper : 0;
  31368. }
  31369. if (lower !== undefined) {
  31370. lower = toNumber(lower);
  31371. lower = lower === lower ? lower : 0;
  31372. }
  31373. return baseClamp(toNumber(number), lower, upper);
  31374. }
  31375. /**
  31376. * Checks if `n` is between `start` and up to, but not including, `end`. If
  31377. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  31378. * If `start` is greater than `end` the params are swapped to support
  31379. * negative ranges.
  31380. *
  31381. * @static
  31382. * @memberOf _
  31383. * @since 3.3.0
  31384. * @category Number
  31385. * @param {number} number The number to check.
  31386. * @param {number} [start=0] The start of the range.
  31387. * @param {number} end The end of the range.
  31388. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  31389. * @see _.range, _.rangeRight
  31390. * @example
  31391. *
  31392. * _.inRange(3, 2, 4);
  31393. * // => true
  31394. *
  31395. * _.inRange(4, 8);
  31396. * // => true
  31397. *
  31398. * _.inRange(4, 2);
  31399. * // => false
  31400. *
  31401. * _.inRange(2, 2);
  31402. * // => false
  31403. *
  31404. * _.inRange(1.2, 2);
  31405. * // => true
  31406. *
  31407. * _.inRange(5.2, 4);
  31408. * // => false
  31409. *
  31410. * _.inRange(-3, -2, -6);
  31411. * // => true
  31412. */
  31413. function inRange(number, start, end) {
  31414. start = toFinite(start);
  31415. if (end === undefined) {
  31416. end = start;
  31417. start = 0;
  31418. } else {
  31419. end = toFinite(end);
  31420. }
  31421. number = toNumber(number);
  31422. return baseInRange(number, start, end);
  31423. }
  31424. /**
  31425. * Produces a random number between the inclusive `lower` and `upper` bounds.
  31426. * If only one argument is provided a number between `0` and the given number
  31427. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  31428. * floats, a floating-point number is returned instead of an integer.
  31429. *
  31430. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  31431. * floating-point values which can produce unexpected results.
  31432. *
  31433. * @static
  31434. * @memberOf _
  31435. * @since 0.7.0
  31436. * @category Number
  31437. * @param {number} [lower=0] The lower bound.
  31438. * @param {number} [upper=1] The upper bound.
  31439. * @param {boolean} [floating] Specify returning a floating-point number.
  31440. * @returns {number} Returns the random number.
  31441. * @example
  31442. *
  31443. * _.random(0, 5);
  31444. * // => an integer between 0 and 5
  31445. *
  31446. * _.random(5);
  31447. * // => also an integer between 0 and 5
  31448. *
  31449. * _.random(5, true);
  31450. * // => a floating-point number between 0 and 5
  31451. *
  31452. * _.random(1.2, 5.2);
  31453. * // => a floating-point number between 1.2 and 5.2
  31454. */
  31455. function random(lower, upper, floating) {
  31456. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  31457. upper = floating = undefined;
  31458. }
  31459. if (floating === undefined) {
  31460. if (typeof upper == 'boolean') {
  31461. floating = upper;
  31462. upper = undefined;
  31463. }
  31464. else if (typeof lower == 'boolean') {
  31465. floating = lower;
  31466. lower = undefined;
  31467. }
  31468. }
  31469. if (lower === undefined && upper === undefined) {
  31470. lower = 0;
  31471. upper = 1;
  31472. }
  31473. else {
  31474. lower = toFinite(lower);
  31475. if (upper === undefined) {
  31476. upper = lower;
  31477. lower = 0;
  31478. } else {
  31479. upper = toFinite(upper);
  31480. }
  31481. }
  31482. if (lower > upper) {
  31483. var temp = lower;
  31484. lower = upper;
  31485. upper = temp;
  31486. }
  31487. if (floating || lower % 1 || upper % 1) {
  31488. var rand = nativeRandom();
  31489. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  31490. }
  31491. return baseRandom(lower, upper);
  31492. }
  31493. /*------------------------------------------------------------------------*/
  31494. /**
  31495. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  31496. *
  31497. * @static
  31498. * @memberOf _
  31499. * @since 3.0.0
  31500. * @category String
  31501. * @param {string} [string=''] The string to convert.
  31502. * @returns {string} Returns the camel cased string.
  31503. * @example
  31504. *
  31505. * _.camelCase('Foo Bar');
  31506. * // => 'fooBar'
  31507. *
  31508. * _.camelCase('--foo-bar--');
  31509. * // => 'fooBar'
  31510. *
  31511. * _.camelCase('__FOO_BAR__');
  31512. * // => 'fooBar'
  31513. */
  31514. var camelCase = createCompounder(function(result, word, index) {
  31515. word = word.toLowerCase();
  31516. return result + (index ? capitalize(word) : word);
  31517. });
  31518. /**
  31519. * Converts the first character of `string` to upper case and the remaining
  31520. * to lower case.
  31521. *
  31522. * @static
  31523. * @memberOf _
  31524. * @since 3.0.0
  31525. * @category String
  31526. * @param {string} [string=''] The string to capitalize.
  31527. * @returns {string} Returns the capitalized string.
  31528. * @example
  31529. *
  31530. * _.capitalize('FRED');
  31531. * // => 'Fred'
  31532. */
  31533. function capitalize(string) {
  31534. return upperFirst(toString(string).toLowerCase());
  31535. }
  31536. /**
  31537. * Deburrs `string` by converting
  31538. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  31539. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  31540. * letters to basic Latin letters and removing
  31541. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  31542. *
  31543. * @static
  31544. * @memberOf _
  31545. * @since 3.0.0
  31546. * @category String
  31547. * @param {string} [string=''] The string to deburr.
  31548. * @returns {string} Returns the deburred string.
  31549. * @example
  31550. *
  31551. * _.deburr('déjà vu');
  31552. * // => 'deja vu'
  31553. */
  31554. function deburr(string) {
  31555. string = toString(string);
  31556. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  31557. }
  31558. /**
  31559. * Checks if `string` ends with the given target string.
  31560. *
  31561. * @static
  31562. * @memberOf _
  31563. * @since 3.0.0
  31564. * @category String
  31565. * @param {string} [string=''] The string to inspect.
  31566. * @param {string} [target] The string to search for.
  31567. * @param {number} [position=string.length] The position to search up to.
  31568. * @returns {boolean} Returns `true` if `string` ends with `target`,
  31569. * else `false`.
  31570. * @example
  31571. *
  31572. * _.endsWith('abc', 'c');
  31573. * // => true
  31574. *
  31575. * _.endsWith('abc', 'b');
  31576. * // => false
  31577. *
  31578. * _.endsWith('abc', 'b', 2);
  31579. * // => true
  31580. */
  31581. function endsWith(string, target, position) {
  31582. string = toString(string);
  31583. target = baseToString(target);
  31584. var length = string.length;
  31585. position = position === undefined
  31586. ? length
  31587. : baseClamp(toInteger(position), 0, length);
  31588. var end = position;
  31589. position -= target.length;
  31590. return position >= 0 && string.slice(position, end) == target;
  31591. }
  31592. /**
  31593. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  31594. * corresponding HTML entities.
  31595. *
  31596. * **Note:** No other characters are escaped. To escape additional
  31597. * characters use a third-party library like [_he_](https://mths.be/he).
  31598. *
  31599. * Though the ">" character is escaped for symmetry, characters like
  31600. * ">" and "/" don't need escaping in HTML and have no special meaning
  31601. * unless they're part of a tag or unquoted attribute value. See
  31602. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  31603. * (under "semi-related fun fact") for more details.
  31604. *
  31605. * When working with HTML you should always
  31606. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  31607. * XSS vectors.
  31608. *
  31609. * @static
  31610. * @since 0.1.0
  31611. * @memberOf _
  31612. * @category String
  31613. * @param {string} [string=''] The string to escape.
  31614. * @returns {string} Returns the escaped string.
  31615. * @example
  31616. *
  31617. * _.escape('fred, barney, & pebbles');
  31618. * // => 'fred, barney, &amp; pebbles'
  31619. */
  31620. function escape(string) {
  31621. string = toString(string);
  31622. return (string && reHasUnescapedHtml.test(string))
  31623. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  31624. : string;
  31625. }
  31626. /**
  31627. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  31628. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  31629. *
  31630. * @static
  31631. * @memberOf _
  31632. * @since 3.0.0
  31633. * @category String
  31634. * @param {string} [string=''] The string to escape.
  31635. * @returns {string} Returns the escaped string.
  31636. * @example
  31637. *
  31638. * _.escapeRegExp('[lodash](https://lodash.com/)');
  31639. * // => '\[lodash\]\(https://lodash\.com/\)'
  31640. */
  31641. function escapeRegExp(string) {
  31642. string = toString(string);
  31643. return (string && reHasRegExpChar.test(string))
  31644. ? string.replace(reRegExpChar, '\\$&')
  31645. : string;
  31646. }
  31647. /**
  31648. * Converts `string` to
  31649. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  31650. *
  31651. * @static
  31652. * @memberOf _
  31653. * @since 3.0.0
  31654. * @category String
  31655. * @param {string} [string=''] The string to convert.
  31656. * @returns {string} Returns the kebab cased string.
  31657. * @example
  31658. *
  31659. * _.kebabCase('Foo Bar');
  31660. * // => 'foo-bar'
  31661. *
  31662. * _.kebabCase('fooBar');
  31663. * // => 'foo-bar'
  31664. *
  31665. * _.kebabCase('__FOO_BAR__');
  31666. * // => 'foo-bar'
  31667. */
  31668. var kebabCase = createCompounder(function(result, word, index) {
  31669. return result + (index ? '-' : '') + word.toLowerCase();
  31670. });
  31671. /**
  31672. * Converts `string`, as space separated words, to lower case.
  31673. *
  31674. * @static
  31675. * @memberOf _
  31676. * @since 4.0.0
  31677. * @category String
  31678. * @param {string} [string=''] The string to convert.
  31679. * @returns {string} Returns the lower cased string.
  31680. * @example
  31681. *
  31682. * _.lowerCase('--Foo-Bar--');
  31683. * // => 'foo bar'
  31684. *
  31685. * _.lowerCase('fooBar');
  31686. * // => 'foo bar'
  31687. *
  31688. * _.lowerCase('__FOO_BAR__');
  31689. * // => 'foo bar'
  31690. */
  31691. var lowerCase = createCompounder(function(result, word, index) {
  31692. return result + (index ? ' ' : '') + word.toLowerCase();
  31693. });
  31694. /**
  31695. * Converts the first character of `string` to lower case.
  31696. *
  31697. * @static
  31698. * @memberOf _
  31699. * @since 4.0.0
  31700. * @category String
  31701. * @param {string} [string=''] The string to convert.
  31702. * @returns {string} Returns the converted string.
  31703. * @example
  31704. *
  31705. * _.lowerFirst('Fred');
  31706. * // => 'fred'
  31707. *
  31708. * _.lowerFirst('FRED');
  31709. * // => 'fRED'
  31710. */
  31711. var lowerFirst = createCaseFirst('toLowerCase');
  31712. /**
  31713. * Pads `string` on the left and right sides if it's shorter than `length`.
  31714. * Padding characters are truncated if they can't be evenly divided by `length`.
  31715. *
  31716. * @static
  31717. * @memberOf _
  31718. * @since 3.0.0
  31719. * @category String
  31720. * @param {string} [string=''] The string to pad.
  31721. * @param {number} [length=0] The padding length.
  31722. * @param {string} [chars=' '] The string used as padding.
  31723. * @returns {string} Returns the padded string.
  31724. * @example
  31725. *
  31726. * _.pad('abc', 8);
  31727. * // => ' abc '
  31728. *
  31729. * _.pad('abc', 8, '_-');
  31730. * // => '_-abc_-_'
  31731. *
  31732. * _.pad('abc', 3);
  31733. * // => 'abc'
  31734. */
  31735. function pad(string, length, chars) {
  31736. string = toString(string);
  31737. length = toInteger(length);
  31738. var strLength = length ? stringSize(string) : 0;
  31739. if (!length || strLength >= length) {
  31740. return string;
  31741. }
  31742. var mid = (length - strLength) / 2;
  31743. return (
  31744. createPadding(nativeFloor(mid), chars) +
  31745. string +
  31746. createPadding(nativeCeil(mid), chars)
  31747. );
  31748. }
  31749. /**
  31750. * Pads `string` on the right side if it's shorter than `length`. Padding
  31751. * characters are truncated if they exceed `length`.
  31752. *
  31753. * @static
  31754. * @memberOf _
  31755. * @since 4.0.0
  31756. * @category String
  31757. * @param {string} [string=''] The string to pad.
  31758. * @param {number} [length=0] The padding length.
  31759. * @param {string} [chars=' '] The string used as padding.
  31760. * @returns {string} Returns the padded string.
  31761. * @example
  31762. *
  31763. * _.padEnd('abc', 6);
  31764. * // => 'abc '
  31765. *
  31766. * _.padEnd('abc', 6, '_-');
  31767. * // => 'abc_-_'
  31768. *
  31769. * _.padEnd('abc', 3);
  31770. * // => 'abc'
  31771. */
  31772. function padEnd(string, length, chars) {
  31773. string = toString(string);
  31774. length = toInteger(length);
  31775. var strLength = length ? stringSize(string) : 0;
  31776. return (length && strLength < length)
  31777. ? (string + createPadding(length - strLength, chars))
  31778. : string;
  31779. }
  31780. /**
  31781. * Pads `string` on the left side if it's shorter than `length`. Padding
  31782. * characters are truncated if they exceed `length`.
  31783. *
  31784. * @static
  31785. * @memberOf _
  31786. * @since 4.0.0
  31787. * @category String
  31788. * @param {string} [string=''] The string to pad.
  31789. * @param {number} [length=0] The padding length.
  31790. * @param {string} [chars=' '] The string used as padding.
  31791. * @returns {string} Returns the padded string.
  31792. * @example
  31793. *
  31794. * _.padStart('abc', 6);
  31795. * // => ' abc'
  31796. *
  31797. * _.padStart('abc', 6, '_-');
  31798. * // => '_-_abc'
  31799. *
  31800. * _.padStart('abc', 3);
  31801. * // => 'abc'
  31802. */
  31803. function padStart(string, length, chars) {
  31804. string = toString(string);
  31805. length = toInteger(length);
  31806. var strLength = length ? stringSize(string) : 0;
  31807. return (length && strLength < length)
  31808. ? (createPadding(length - strLength, chars) + string)
  31809. : string;
  31810. }
  31811. /**
  31812. * Converts `string` to an integer of the specified radix. If `radix` is
  31813. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  31814. * hexadecimal, in which case a `radix` of `16` is used.
  31815. *
  31816. * **Note:** This method aligns with the
  31817. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  31818. *
  31819. * @static
  31820. * @memberOf _
  31821. * @since 1.1.0
  31822. * @category String
  31823. * @param {string} string The string to convert.
  31824. * @param {number} [radix=10] The radix to interpret `value` by.
  31825. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31826. * @returns {number} Returns the converted integer.
  31827. * @example
  31828. *
  31829. * _.parseInt('08');
  31830. * // => 8
  31831. *
  31832. * _.map(['6', '08', '10'], _.parseInt);
  31833. * // => [6, 8, 10]
  31834. */
  31835. function parseInt(string, radix, guard) {
  31836. if (guard || radix == null) {
  31837. radix = 0;
  31838. } else if (radix) {
  31839. radix = +radix;
  31840. }
  31841. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  31842. }
  31843. /**
  31844. * Repeats the given string `n` times.
  31845. *
  31846. * @static
  31847. * @memberOf _
  31848. * @since 3.0.0
  31849. * @category String
  31850. * @param {string} [string=''] The string to repeat.
  31851. * @param {number} [n=1] The number of times to repeat the string.
  31852. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31853. * @returns {string} Returns the repeated string.
  31854. * @example
  31855. *
  31856. * _.repeat('*', 3);
  31857. * // => '***'
  31858. *
  31859. * _.repeat('abc', 2);
  31860. * // => 'abcabc'
  31861. *
  31862. * _.repeat('abc', 0);
  31863. * // => ''
  31864. */
  31865. function repeat(string, n, guard) {
  31866. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  31867. n = 1;
  31868. } else {
  31869. n = toInteger(n);
  31870. }
  31871. return baseRepeat(toString(string), n);
  31872. }
  31873. /**
  31874. * Replaces matches for `pattern` in `string` with `replacement`.
  31875. *
  31876. * **Note:** This method is based on
  31877. * [`String#replace`](https://mdn.io/String/replace).
  31878. *
  31879. * @static
  31880. * @memberOf _
  31881. * @since 4.0.0
  31882. * @category String
  31883. * @param {string} [string=''] The string to modify.
  31884. * @param {RegExp|string} pattern The pattern to replace.
  31885. * @param {Function|string} replacement The match replacement.
  31886. * @returns {string} Returns the modified string.
  31887. * @example
  31888. *
  31889. * _.replace('Hi Fred', 'Fred', 'Barney');
  31890. * // => 'Hi Barney'
  31891. */
  31892. function replace() {
  31893. var args = arguments,
  31894. string = toString(args[0]);
  31895. return args.length < 3 ? string : string.replace(args[1], args[2]);
  31896. }
  31897. /**
  31898. * Converts `string` to
  31899. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  31900. *
  31901. * @static
  31902. * @memberOf _
  31903. * @since 3.0.0
  31904. * @category String
  31905. * @param {string} [string=''] The string to convert.
  31906. * @returns {string} Returns the snake cased string.
  31907. * @example
  31908. *
  31909. * _.snakeCase('Foo Bar');
  31910. * // => 'foo_bar'
  31911. *
  31912. * _.snakeCase('fooBar');
  31913. * // => 'foo_bar'
  31914. *
  31915. * _.snakeCase('--FOO-BAR--');
  31916. * // => 'foo_bar'
  31917. */
  31918. var snakeCase = createCompounder(function(result, word, index) {
  31919. return result + (index ? '_' : '') + word.toLowerCase();
  31920. });
  31921. /**
  31922. * Splits `string` by `separator`.
  31923. *
  31924. * **Note:** This method is based on
  31925. * [`String#split`](https://mdn.io/String/split).
  31926. *
  31927. * @static
  31928. * @memberOf _
  31929. * @since 4.0.0
  31930. * @category String
  31931. * @param {string} [string=''] The string to split.
  31932. * @param {RegExp|string} separator The separator pattern to split by.
  31933. * @param {number} [limit] The length to truncate results to.
  31934. * @returns {Array} Returns the string segments.
  31935. * @example
  31936. *
  31937. * _.split('a-b-c', '-', 2);
  31938. * // => ['a', 'b']
  31939. */
  31940. function split(string, separator, limit) {
  31941. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  31942. separator = limit = undefined;
  31943. }
  31944. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  31945. if (!limit) {
  31946. return [];
  31947. }
  31948. string = toString(string);
  31949. if (string && (
  31950. typeof separator == 'string' ||
  31951. (separator != null && !isRegExp(separator))
  31952. )) {
  31953. separator = baseToString(separator);
  31954. if (!separator && hasUnicode(string)) {
  31955. return castSlice(stringToArray(string), 0, limit);
  31956. }
  31957. }
  31958. return string.split(separator, limit);
  31959. }
  31960. /**
  31961. * Converts `string` to
  31962. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  31963. *
  31964. * @static
  31965. * @memberOf _
  31966. * @since 3.1.0
  31967. * @category String
  31968. * @param {string} [string=''] The string to convert.
  31969. * @returns {string} Returns the start cased string.
  31970. * @example
  31971. *
  31972. * _.startCase('--foo-bar--');
  31973. * // => 'Foo Bar'
  31974. *
  31975. * _.startCase('fooBar');
  31976. * // => 'Foo Bar'
  31977. *
  31978. * _.startCase('__FOO_BAR__');
  31979. * // => 'FOO BAR'
  31980. */
  31981. var startCase = createCompounder(function(result, word, index) {
  31982. return result + (index ? ' ' : '') + upperFirst(word);
  31983. });
  31984. /**
  31985. * Checks if `string` starts with the given target string.
  31986. *
  31987. * @static
  31988. * @memberOf _
  31989. * @since 3.0.0
  31990. * @category String
  31991. * @param {string} [string=''] The string to inspect.
  31992. * @param {string} [target] The string to search for.
  31993. * @param {number} [position=0] The position to search from.
  31994. * @returns {boolean} Returns `true` if `string` starts with `target`,
  31995. * else `false`.
  31996. * @example
  31997. *
  31998. * _.startsWith('abc', 'a');
  31999. * // => true
  32000. *
  32001. * _.startsWith('abc', 'b');
  32002. * // => false
  32003. *
  32004. * _.startsWith('abc', 'b', 1);
  32005. * // => true
  32006. */
  32007. function startsWith(string, target, position) {
  32008. string = toString(string);
  32009. position = position == null
  32010. ? 0
  32011. : baseClamp(toInteger(position), 0, string.length);
  32012. target = baseToString(target);
  32013. return string.slice(position, position + target.length) == target;
  32014. }
  32015. /**
  32016. * Creates a compiled template function that can interpolate data properties
  32017. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  32018. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  32019. * properties may be accessed as free variables in the template. If a setting
  32020. * object is given, it takes precedence over `_.templateSettings` values.
  32021. *
  32022. * **Note:** In the development build `_.template` utilizes
  32023. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  32024. * for easier debugging.
  32025. *
  32026. * For more information on precompiling templates see
  32027. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  32028. *
  32029. * For more information on Chrome extension sandboxes see
  32030. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  32031. *
  32032. * @static
  32033. * @since 0.1.0
  32034. * @memberOf _
  32035. * @category String
  32036. * @param {string} [string=''] The template string.
  32037. * @param {Object} [options={}] The options object.
  32038. * @param {RegExp} [options.escape=_.templateSettings.escape]
  32039. * The HTML "escape" delimiter.
  32040. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  32041. * The "evaluate" delimiter.
  32042. * @param {Object} [options.imports=_.templateSettings.imports]
  32043. * An object to import into the template as free variables.
  32044. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  32045. * The "interpolate" delimiter.
  32046. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  32047. * The sourceURL of the compiled template.
  32048. * @param {string} [options.variable='obj']
  32049. * The data object variable name.
  32050. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32051. * @returns {Function} Returns the compiled template function.
  32052. * @example
  32053. *
  32054. * // Use the "interpolate" delimiter to create a compiled template.
  32055. * var compiled = _.template('hello <%= user %>!');
  32056. * compiled({ 'user': 'fred' });
  32057. * // => 'hello fred!'
  32058. *
  32059. * // Use the HTML "escape" delimiter to escape data property values.
  32060. * var compiled = _.template('<b><%- value %></b>');
  32061. * compiled({ 'value': '<script>' });
  32062. * // => '<b>&lt;script&gt;</b>'
  32063. *
  32064. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  32065. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  32066. * compiled({ 'users': ['fred', 'barney'] });
  32067. * // => '<li>fred</li><li>barney</li>'
  32068. *
  32069. * // Use the internal `print` function in "evaluate" delimiters.
  32070. * var compiled = _.template('<% print("hello " + user); %>!');
  32071. * compiled({ 'user': 'barney' });
  32072. * // => 'hello barney!'
  32073. *
  32074. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  32075. * // Disable support by replacing the "interpolate" delimiter.
  32076. * var compiled = _.template('hello ${ user }!');
  32077. * compiled({ 'user': 'pebbles' });
  32078. * // => 'hello pebbles!'
  32079. *
  32080. * // Use backslashes to treat delimiters as plain text.
  32081. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  32082. * compiled({ 'value': 'ignored' });
  32083. * // => '<%- value %>'
  32084. *
  32085. * // Use the `imports` option to import `jQuery` as `jq`.
  32086. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  32087. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  32088. * compiled({ 'users': ['fred', 'barney'] });
  32089. * // => '<li>fred</li><li>barney</li>'
  32090. *
  32091. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  32092. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  32093. * compiled(data);
  32094. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  32095. *
  32096. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  32097. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  32098. * compiled.source;
  32099. * // => function(data) {
  32100. * // var __t, __p = '';
  32101. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  32102. * // return __p;
  32103. * // }
  32104. *
  32105. * // Use custom template delimiters.
  32106. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  32107. * var compiled = _.template('hello {{ user }}!');
  32108. * compiled({ 'user': 'mustache' });
  32109. * // => 'hello mustache!'
  32110. *
  32111. * // Use the `source` property to inline compiled templates for meaningful
  32112. * // line numbers in error messages and stack traces.
  32113. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  32114. * var JST = {\
  32115. * "main": ' + _.template(mainText).source + '\
  32116. * };\
  32117. * ');
  32118. */
  32119. function template(string, options, guard) {
  32120. // Based on John Resig's `tmpl` implementation
  32121. // (http://ejohn.org/blog/javascript-micro-templating/)
  32122. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  32123. var settings = lodash.templateSettings;
  32124. if (guard && isIterateeCall(string, options, guard)) {
  32125. options = undefined;
  32126. }
  32127. string = toString(string);
  32128. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  32129. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  32130. importsKeys = keys(imports),
  32131. importsValues = baseValues(imports, importsKeys);
  32132. var isEscaping,
  32133. isEvaluating,
  32134. index = 0,
  32135. interpolate = options.interpolate || reNoMatch,
  32136. source = "__p += '";
  32137. // Compile the regexp to match each delimiter.
  32138. var reDelimiters = RegExp(
  32139. (options.escape || reNoMatch).source + '|' +
  32140. interpolate.source + '|' +
  32141. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  32142. (options.evaluate || reNoMatch).source + '|$'
  32143. , 'g');
  32144. // Use a sourceURL for easier debugging.
  32145. // The sourceURL gets injected into the source that's eval-ed, so be careful
  32146. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  32147. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  32148. var sourceURL = '//# sourceURL=' +
  32149. (hasOwnProperty.call(options, 'sourceURL')
  32150. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  32151. : ('lodash.templateSources[' + (++templateCounter) + ']')
  32152. ) + '\n';
  32153. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  32154. interpolateValue || (interpolateValue = esTemplateValue);
  32155. // Escape characters that can't be included in string literals.
  32156. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  32157. // Replace delimiters with snippets.
  32158. if (escapeValue) {
  32159. isEscaping = true;
  32160. source += "' +\n__e(" + escapeValue + ") +\n'";
  32161. }
  32162. if (evaluateValue) {
  32163. isEvaluating = true;
  32164. source += "';\n" + evaluateValue + ";\n__p += '";
  32165. }
  32166. if (interpolateValue) {
  32167. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  32168. }
  32169. index = offset + match.length;
  32170. // The JS engine embedded in Adobe products needs `match` returned in
  32171. // order to produce the correct `offset` value.
  32172. return match;
  32173. });
  32174. source += "';\n";
  32175. // If `variable` is not specified wrap a with-statement around the generated
  32176. // code to add the data object to the top of the scope chain.
  32177. // Like with sourceURL, we take care to not check the option's prototype,
  32178. // as this configuration is a code injection vector.
  32179. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  32180. if (!variable) {
  32181. source = 'with (obj) {\n' + source + '\n}\n';
  32182. }
  32183. // Cleanup code by stripping empty strings.
  32184. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  32185. .replace(reEmptyStringMiddle, '$1')
  32186. .replace(reEmptyStringTrailing, '$1;');
  32187. // Frame code as the function body.
  32188. source = 'function(' + (variable || 'obj') + ') {\n' +
  32189. (variable
  32190. ? ''
  32191. : 'obj || (obj = {});\n'
  32192. ) +
  32193. "var __t, __p = ''" +
  32194. (isEscaping
  32195. ? ', __e = _.escape'
  32196. : ''
  32197. ) +
  32198. (isEvaluating
  32199. ? ', __j = Array.prototype.join;\n' +
  32200. "function print() { __p += __j.call(arguments, '') }\n"
  32201. : ';\n'
  32202. ) +
  32203. source +
  32204. 'return __p\n}';
  32205. var result = attempt(function() {
  32206. return Function(importsKeys, sourceURL + 'return ' + source)
  32207. .apply(undefined, importsValues);
  32208. });
  32209. // Provide the compiled function's source by its `toString` method or
  32210. // the `source` property as a convenience for inlining compiled templates.
  32211. result.source = source;
  32212. if (isError(result)) {
  32213. throw result;
  32214. }
  32215. return result;
  32216. }
  32217. /**
  32218. * Converts `string`, as a whole, to lower case just like
  32219. * [String#toLowerCase](https://mdn.io/toLowerCase).
  32220. *
  32221. * @static
  32222. * @memberOf _
  32223. * @since 4.0.0
  32224. * @category String
  32225. * @param {string} [string=''] The string to convert.
  32226. * @returns {string} Returns the lower cased string.
  32227. * @example
  32228. *
  32229. * _.toLower('--Foo-Bar--');
  32230. * // => '--foo-bar--'
  32231. *
  32232. * _.toLower('fooBar');
  32233. * // => 'foobar'
  32234. *
  32235. * _.toLower('__FOO_BAR__');
  32236. * // => '__foo_bar__'
  32237. */
  32238. function toLower(value) {
  32239. return toString(value).toLowerCase();
  32240. }
  32241. /**
  32242. * Converts `string`, as a whole, to upper case just like
  32243. * [String#toUpperCase](https://mdn.io/toUpperCase).
  32244. *
  32245. * @static
  32246. * @memberOf _
  32247. * @since 4.0.0
  32248. * @category String
  32249. * @param {string} [string=''] The string to convert.
  32250. * @returns {string} Returns the upper cased string.
  32251. * @example
  32252. *
  32253. * _.toUpper('--foo-bar--');
  32254. * // => '--FOO-BAR--'
  32255. *
  32256. * _.toUpper('fooBar');
  32257. * // => 'FOOBAR'
  32258. *
  32259. * _.toUpper('__foo_bar__');
  32260. * // => '__FOO_BAR__'
  32261. */
  32262. function toUpper(value) {
  32263. return toString(value).toUpperCase();
  32264. }
  32265. /**
  32266. * Removes leading and trailing whitespace or specified characters from `string`.
  32267. *
  32268. * @static
  32269. * @memberOf _
  32270. * @since 3.0.0
  32271. * @category String
  32272. * @param {string} [string=''] The string to trim.
  32273. * @param {string} [chars=whitespace] The characters to trim.
  32274. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32275. * @returns {string} Returns the trimmed string.
  32276. * @example
  32277. *
  32278. * _.trim(' abc ');
  32279. * // => 'abc'
  32280. *
  32281. * _.trim('-_-abc-_-', '_-');
  32282. * // => 'abc'
  32283. *
  32284. * _.map([' foo ', ' bar '], _.trim);
  32285. * // => ['foo', 'bar']
  32286. */
  32287. function trim(string, chars, guard) {
  32288. string = toString(string);
  32289. if (string && (guard || chars === undefined)) {
  32290. return string.replace(reTrim, '');
  32291. }
  32292. if (!string || !(chars = baseToString(chars))) {
  32293. return string;
  32294. }
  32295. var strSymbols = stringToArray(string),
  32296. chrSymbols = stringToArray(chars),
  32297. start = charsStartIndex(strSymbols, chrSymbols),
  32298. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  32299. return castSlice(strSymbols, start, end).join('');
  32300. }
  32301. /**
  32302. * Removes trailing whitespace or specified characters from `string`.
  32303. *
  32304. * @static
  32305. * @memberOf _
  32306. * @since 4.0.0
  32307. * @category String
  32308. * @param {string} [string=''] The string to trim.
  32309. * @param {string} [chars=whitespace] The characters to trim.
  32310. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32311. * @returns {string} Returns the trimmed string.
  32312. * @example
  32313. *
  32314. * _.trimEnd(' abc ');
  32315. * // => ' abc'
  32316. *
  32317. * _.trimEnd('-_-abc-_-', '_-');
  32318. * // => '-_-abc'
  32319. */
  32320. function trimEnd(string, chars, guard) {
  32321. string = toString(string);
  32322. if (string && (guard || chars === undefined)) {
  32323. return string.replace(reTrimEnd, '');
  32324. }
  32325. if (!string || !(chars = baseToString(chars))) {
  32326. return string;
  32327. }
  32328. var strSymbols = stringToArray(string),
  32329. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  32330. return castSlice(strSymbols, 0, end).join('');
  32331. }
  32332. /**
  32333. * Removes leading whitespace or specified characters from `string`.
  32334. *
  32335. * @static
  32336. * @memberOf _
  32337. * @since 4.0.0
  32338. * @category String
  32339. * @param {string} [string=''] The string to trim.
  32340. * @param {string} [chars=whitespace] The characters to trim.
  32341. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32342. * @returns {string} Returns the trimmed string.
  32343. * @example
  32344. *
  32345. * _.trimStart(' abc ');
  32346. * // => 'abc '
  32347. *
  32348. * _.trimStart('-_-abc-_-', '_-');
  32349. * // => 'abc-_-'
  32350. */
  32351. function trimStart(string, chars, guard) {
  32352. string = toString(string);
  32353. if (string && (guard || chars === undefined)) {
  32354. return string.replace(reTrimStart, '');
  32355. }
  32356. if (!string || !(chars = baseToString(chars))) {
  32357. return string;
  32358. }
  32359. var strSymbols = stringToArray(string),
  32360. start = charsStartIndex(strSymbols, stringToArray(chars));
  32361. return castSlice(strSymbols, start).join('');
  32362. }
  32363. /**
  32364. * Truncates `string` if it's longer than the given maximum string length.
  32365. * The last characters of the truncated string are replaced with the omission
  32366. * string which defaults to "...".
  32367. *
  32368. * @static
  32369. * @memberOf _
  32370. * @since 4.0.0
  32371. * @category String
  32372. * @param {string} [string=''] The string to truncate.
  32373. * @param {Object} [options={}] The options object.
  32374. * @param {number} [options.length=30] The maximum string length.
  32375. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  32376. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  32377. * @returns {string} Returns the truncated string.
  32378. * @example
  32379. *
  32380. * _.truncate('hi-diddly-ho there, neighborino');
  32381. * // => 'hi-diddly-ho there, neighbo...'
  32382. *
  32383. * _.truncate('hi-diddly-ho there, neighborino', {
  32384. * 'length': 24,
  32385. * 'separator': ' '
  32386. * });
  32387. * // => 'hi-diddly-ho there,...'
  32388. *
  32389. * _.truncate('hi-diddly-ho there, neighborino', {
  32390. * 'length': 24,
  32391. * 'separator': /,? +/
  32392. * });
  32393. * // => 'hi-diddly-ho there...'
  32394. *
  32395. * _.truncate('hi-diddly-ho there, neighborino', {
  32396. * 'omission': ' [...]'
  32397. * });
  32398. * // => 'hi-diddly-ho there, neig [...]'
  32399. */
  32400. function truncate(string, options) {
  32401. var length = DEFAULT_TRUNC_LENGTH,
  32402. omission = DEFAULT_TRUNC_OMISSION;
  32403. if (isObject(options)) {
  32404. var separator = 'separator' in options ? options.separator : separator;
  32405. length = 'length' in options ? toInteger(options.length) : length;
  32406. omission = 'omission' in options ? baseToString(options.omission) : omission;
  32407. }
  32408. string = toString(string);
  32409. var strLength = string.length;
  32410. if (hasUnicode(string)) {
  32411. var strSymbols = stringToArray(string);
  32412. strLength = strSymbols.length;
  32413. }
  32414. if (length >= strLength) {
  32415. return string;
  32416. }
  32417. var end = length - stringSize(omission);
  32418. if (end < 1) {
  32419. return omission;
  32420. }
  32421. var result = strSymbols
  32422. ? castSlice(strSymbols, 0, end).join('')
  32423. : string.slice(0, end);
  32424. if (separator === undefined) {
  32425. return result + omission;
  32426. }
  32427. if (strSymbols) {
  32428. end += (result.length - end);
  32429. }
  32430. if (isRegExp(separator)) {
  32431. if (string.slice(end).search(separator)) {
  32432. var match,
  32433. substring = result;
  32434. if (!separator.global) {
  32435. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  32436. }
  32437. separator.lastIndex = 0;
  32438. while ((match = separator.exec(substring))) {
  32439. var newEnd = match.index;
  32440. }
  32441. result = result.slice(0, newEnd === undefined ? end : newEnd);
  32442. }
  32443. } else if (string.indexOf(baseToString(separator), end) != end) {
  32444. var index = result.lastIndexOf(separator);
  32445. if (index > -1) {
  32446. result = result.slice(0, index);
  32447. }
  32448. }
  32449. return result + omission;
  32450. }
  32451. /**
  32452. * The inverse of `_.escape`; this method converts the HTML entities
  32453. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  32454. * their corresponding characters.
  32455. *
  32456. * **Note:** No other HTML entities are unescaped. To unescape additional
  32457. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  32458. *
  32459. * @static
  32460. * @memberOf _
  32461. * @since 0.6.0
  32462. * @category String
  32463. * @param {string} [string=''] The string to unescape.
  32464. * @returns {string} Returns the unescaped string.
  32465. * @example
  32466. *
  32467. * _.unescape('fred, barney, &amp; pebbles');
  32468. * // => 'fred, barney, & pebbles'
  32469. */
  32470. function unescape(string) {
  32471. string = toString(string);
  32472. return (string && reHasEscapedHtml.test(string))
  32473. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  32474. : string;
  32475. }
  32476. /**
  32477. * Converts `string`, as space separated words, to upper case.
  32478. *
  32479. * @static
  32480. * @memberOf _
  32481. * @since 4.0.0
  32482. * @category String
  32483. * @param {string} [string=''] The string to convert.
  32484. * @returns {string} Returns the upper cased string.
  32485. * @example
  32486. *
  32487. * _.upperCase('--foo-bar');
  32488. * // => 'FOO BAR'
  32489. *
  32490. * _.upperCase('fooBar');
  32491. * // => 'FOO BAR'
  32492. *
  32493. * _.upperCase('__foo_bar__');
  32494. * // => 'FOO BAR'
  32495. */
  32496. var upperCase = createCompounder(function(result, word, index) {
  32497. return result + (index ? ' ' : '') + word.toUpperCase();
  32498. });
  32499. /**
  32500. * Converts the first character of `string` to upper case.
  32501. *
  32502. * @static
  32503. * @memberOf _
  32504. * @since 4.0.0
  32505. * @category String
  32506. * @param {string} [string=''] The string to convert.
  32507. * @returns {string} Returns the converted string.
  32508. * @example
  32509. *
  32510. * _.upperFirst('fred');
  32511. * // => 'Fred'
  32512. *
  32513. * _.upperFirst('FRED');
  32514. * // => 'FRED'
  32515. */
  32516. var upperFirst = createCaseFirst('toUpperCase');
  32517. /**
  32518. * Splits `string` into an array of its words.
  32519. *
  32520. * @static
  32521. * @memberOf _
  32522. * @since 3.0.0
  32523. * @category String
  32524. * @param {string} [string=''] The string to inspect.
  32525. * @param {RegExp|string} [pattern] The pattern to match words.
  32526. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32527. * @returns {Array} Returns the words of `string`.
  32528. * @example
  32529. *
  32530. * _.words('fred, barney, & pebbles');
  32531. * // => ['fred', 'barney', 'pebbles']
  32532. *
  32533. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  32534. * // => ['fred', 'barney', '&', 'pebbles']
  32535. */
  32536. function words(string, pattern, guard) {
  32537. string = toString(string);
  32538. pattern = guard ? undefined : pattern;
  32539. if (pattern === undefined) {
  32540. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  32541. }
  32542. return string.match(pattern) || [];
  32543. }
  32544. /*------------------------------------------------------------------------*/
  32545. /**
  32546. * Attempts to invoke `func`, returning either the result or the caught error
  32547. * object. Any additional arguments are provided to `func` when it's invoked.
  32548. *
  32549. * @static
  32550. * @memberOf _
  32551. * @since 3.0.0
  32552. * @category Util
  32553. * @param {Function} func The function to attempt.
  32554. * @param {...*} [args] The arguments to invoke `func` with.
  32555. * @returns {*} Returns the `func` result or error object.
  32556. * @example
  32557. *
  32558. * // Avoid throwing errors for invalid selectors.
  32559. * var elements = _.attempt(function(selector) {
  32560. * return document.querySelectorAll(selector);
  32561. * }, '>_>');
  32562. *
  32563. * if (_.isError(elements)) {
  32564. * elements = [];
  32565. * }
  32566. */
  32567. var attempt = baseRest(function(func, args) {
  32568. try {
  32569. return apply(func, undefined, args);
  32570. } catch (e) {
  32571. return isError(e) ? e : new Error(e);
  32572. }
  32573. });
  32574. /**
  32575. * Binds methods of an object to the object itself, overwriting the existing
  32576. * method.
  32577. *
  32578. * **Note:** This method doesn't set the "length" property of bound functions.
  32579. *
  32580. * @static
  32581. * @since 0.1.0
  32582. * @memberOf _
  32583. * @category Util
  32584. * @param {Object} object The object to bind and assign the bound methods to.
  32585. * @param {...(string|string[])} methodNames The object method names to bind.
  32586. * @returns {Object} Returns `object`.
  32587. * @example
  32588. *
  32589. * var view = {
  32590. * 'label': 'docs',
  32591. * 'click': function() {
  32592. * console.log('clicked ' + this.label);
  32593. * }
  32594. * };
  32595. *
  32596. * _.bindAll(view, ['click']);
  32597. * jQuery(element).on('click', view.click);
  32598. * // => Logs 'clicked docs' when clicked.
  32599. */
  32600. var bindAll = flatRest(function(object, methodNames) {
  32601. arrayEach(methodNames, function(key) {
  32602. key = toKey(key);
  32603. baseAssignValue(object, key, bind(object[key], object));
  32604. });
  32605. return object;
  32606. });
  32607. /**
  32608. * Creates a function that iterates over `pairs` and invokes the corresponding
  32609. * function of the first predicate to return truthy. The predicate-function
  32610. * pairs are invoked with the `this` binding and arguments of the created
  32611. * function.
  32612. *
  32613. * @static
  32614. * @memberOf _
  32615. * @since 4.0.0
  32616. * @category Util
  32617. * @param {Array} pairs The predicate-function pairs.
  32618. * @returns {Function} Returns the new composite function.
  32619. * @example
  32620. *
  32621. * var func = _.cond([
  32622. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  32623. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  32624. * [_.stubTrue, _.constant('no match')]
  32625. * ]);
  32626. *
  32627. * func({ 'a': 1, 'b': 2 });
  32628. * // => 'matches A'
  32629. *
  32630. * func({ 'a': 0, 'b': 1 });
  32631. * // => 'matches B'
  32632. *
  32633. * func({ 'a': '1', 'b': '2' });
  32634. * // => 'no match'
  32635. */
  32636. function cond(pairs) {
  32637. var length = pairs == null ? 0 : pairs.length,
  32638. toIteratee = getIteratee();
  32639. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  32640. if (typeof pair[1] != 'function') {
  32641. throw new TypeError(FUNC_ERROR_TEXT);
  32642. }
  32643. return [toIteratee(pair[0]), pair[1]];
  32644. });
  32645. return baseRest(function(args) {
  32646. var index = -1;
  32647. while (++index < length) {
  32648. var pair = pairs[index];
  32649. if (apply(pair[0], this, args)) {
  32650. return apply(pair[1], this, args);
  32651. }
  32652. }
  32653. });
  32654. }
  32655. /**
  32656. * Creates a function that invokes the predicate properties of `source` with
  32657. * the corresponding property values of a given object, returning `true` if
  32658. * all predicates return truthy, else `false`.
  32659. *
  32660. * **Note:** The created function is equivalent to `_.conformsTo` with
  32661. * `source` partially applied.
  32662. *
  32663. * @static
  32664. * @memberOf _
  32665. * @since 4.0.0
  32666. * @category Util
  32667. * @param {Object} source The object of property predicates to conform to.
  32668. * @returns {Function} Returns the new spec function.
  32669. * @example
  32670. *
  32671. * var objects = [
  32672. * { 'a': 2, 'b': 1 },
  32673. * { 'a': 1, 'b': 2 }
  32674. * ];
  32675. *
  32676. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  32677. * // => [{ 'a': 1, 'b': 2 }]
  32678. */
  32679. function conforms(source) {
  32680. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  32681. }
  32682. /**
  32683. * Creates a function that returns `value`.
  32684. *
  32685. * @static
  32686. * @memberOf _
  32687. * @since 2.4.0
  32688. * @category Util
  32689. * @param {*} value The value to return from the new function.
  32690. * @returns {Function} Returns the new constant function.
  32691. * @example
  32692. *
  32693. * var objects = _.times(2, _.constant({ 'a': 1 }));
  32694. *
  32695. * console.log(objects);
  32696. * // => [{ 'a': 1 }, { 'a': 1 }]
  32697. *
  32698. * console.log(objects[0] === objects[1]);
  32699. * // => true
  32700. */
  32701. function constant(value) {
  32702. return function() {
  32703. return value;
  32704. };
  32705. }
  32706. /**
  32707. * Checks `value` to determine whether a default value should be returned in
  32708. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  32709. * or `undefined`.
  32710. *
  32711. * @static
  32712. * @memberOf _
  32713. * @since 4.14.0
  32714. * @category Util
  32715. * @param {*} value The value to check.
  32716. * @param {*} defaultValue The default value.
  32717. * @returns {*} Returns the resolved value.
  32718. * @example
  32719. *
  32720. * _.defaultTo(1, 10);
  32721. * // => 1
  32722. *
  32723. * _.defaultTo(undefined, 10);
  32724. * // => 10
  32725. */
  32726. function defaultTo(value, defaultValue) {
  32727. return (value == null || value !== value) ? defaultValue : value;
  32728. }
  32729. /**
  32730. * Creates a function that returns the result of invoking the given functions
  32731. * with the `this` binding of the created function, where each successive
  32732. * invocation is supplied the return value of the previous.
  32733. *
  32734. * @static
  32735. * @memberOf _
  32736. * @since 3.0.0
  32737. * @category Util
  32738. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32739. * @returns {Function} Returns the new composite function.
  32740. * @see _.flowRight
  32741. * @example
  32742. *
  32743. * function square(n) {
  32744. * return n * n;
  32745. * }
  32746. *
  32747. * var addSquare = _.flow([_.add, square]);
  32748. * addSquare(1, 2);
  32749. * // => 9
  32750. */
  32751. var flow = createFlow();
  32752. /**
  32753. * This method is like `_.flow` except that it creates a function that
  32754. * invokes the given functions from right to left.
  32755. *
  32756. * @static
  32757. * @since 3.0.0
  32758. * @memberOf _
  32759. * @category Util
  32760. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32761. * @returns {Function} Returns the new composite function.
  32762. * @see _.flow
  32763. * @example
  32764. *
  32765. * function square(n) {
  32766. * return n * n;
  32767. * }
  32768. *
  32769. * var addSquare = _.flowRight([square, _.add]);
  32770. * addSquare(1, 2);
  32771. * // => 9
  32772. */
  32773. var flowRight = createFlow(true);
  32774. /**
  32775. * This method returns the first argument it receives.
  32776. *
  32777. * @static
  32778. * @since 0.1.0
  32779. * @memberOf _
  32780. * @category Util
  32781. * @param {*} value Any value.
  32782. * @returns {*} Returns `value`.
  32783. * @example
  32784. *
  32785. * var object = { 'a': 1 };
  32786. *
  32787. * console.log(_.identity(object) === object);
  32788. * // => true
  32789. */
  32790. function identity(value) {
  32791. return value;
  32792. }
  32793. /**
  32794. * Creates a function that invokes `func` with the arguments of the created
  32795. * function. If `func` is a property name, the created function returns the
  32796. * property value for a given element. If `func` is an array or object, the
  32797. * created function returns `true` for elements that contain the equivalent
  32798. * source properties, otherwise it returns `false`.
  32799. *
  32800. * @static
  32801. * @since 4.0.0
  32802. * @memberOf _
  32803. * @category Util
  32804. * @param {*} [func=_.identity] The value to convert to a callback.
  32805. * @returns {Function} Returns the callback.
  32806. * @example
  32807. *
  32808. * var users = [
  32809. * { 'user': 'barney', 'age': 36, 'active': true },
  32810. * { 'user': 'fred', 'age': 40, 'active': false }
  32811. * ];
  32812. *
  32813. * // The `_.matches` iteratee shorthand.
  32814. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  32815. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  32816. *
  32817. * // The `_.matchesProperty` iteratee shorthand.
  32818. * _.filter(users, _.iteratee(['user', 'fred']));
  32819. * // => [{ 'user': 'fred', 'age': 40 }]
  32820. *
  32821. * // The `_.property` iteratee shorthand.
  32822. * _.map(users, _.iteratee('user'));
  32823. * // => ['barney', 'fred']
  32824. *
  32825. * // Create custom iteratee shorthands.
  32826. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  32827. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  32828. * return func.test(string);
  32829. * };
  32830. * });
  32831. *
  32832. * _.filter(['abc', 'def'], /ef/);
  32833. * // => ['def']
  32834. */
  32835. function iteratee(func) {
  32836. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  32837. }
  32838. /**
  32839. * Creates a function that performs a partial deep comparison between a given
  32840. * object and `source`, returning `true` if the given object has equivalent
  32841. * property values, else `false`.
  32842. *
  32843. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  32844. * partially applied.
  32845. *
  32846. * Partial comparisons will match empty array and empty object `source`
  32847. * values against any array or object value, respectively. See `_.isEqual`
  32848. * for a list of supported value comparisons.
  32849. *
  32850. * @static
  32851. * @memberOf _
  32852. * @since 3.0.0
  32853. * @category Util
  32854. * @param {Object} source The object of property values to match.
  32855. * @returns {Function} Returns the new spec function.
  32856. * @example
  32857. *
  32858. * var objects = [
  32859. * { 'a': 1, 'b': 2, 'c': 3 },
  32860. * { 'a': 4, 'b': 5, 'c': 6 }
  32861. * ];
  32862. *
  32863. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  32864. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  32865. */
  32866. function matches(source) {
  32867. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  32868. }
  32869. /**
  32870. * Creates a function that performs a partial deep comparison between the
  32871. * value at `path` of a given object to `srcValue`, returning `true` if the
  32872. * object value is equivalent, else `false`.
  32873. *
  32874. * **Note:** Partial comparisons will match empty array and empty object
  32875. * `srcValue` values against any array or object value, respectively. See
  32876. * `_.isEqual` for a list of supported value comparisons.
  32877. *
  32878. * @static
  32879. * @memberOf _
  32880. * @since 3.2.0
  32881. * @category Util
  32882. * @param {Array|string} path The path of the property to get.
  32883. * @param {*} srcValue The value to match.
  32884. * @returns {Function} Returns the new spec function.
  32885. * @example
  32886. *
  32887. * var objects = [
  32888. * { 'a': 1, 'b': 2, 'c': 3 },
  32889. * { 'a': 4, 'b': 5, 'c': 6 }
  32890. * ];
  32891. *
  32892. * _.find(objects, _.matchesProperty('a', 4));
  32893. * // => { 'a': 4, 'b': 5, 'c': 6 }
  32894. */
  32895. function matchesProperty(path, srcValue) {
  32896. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  32897. }
  32898. /**
  32899. * Creates a function that invokes the method at `path` of a given object.
  32900. * Any additional arguments are provided to the invoked method.
  32901. *
  32902. * @static
  32903. * @memberOf _
  32904. * @since 3.7.0
  32905. * @category Util
  32906. * @param {Array|string} path The path of the method to invoke.
  32907. * @param {...*} [args] The arguments to invoke the method with.
  32908. * @returns {Function} Returns the new invoker function.
  32909. * @example
  32910. *
  32911. * var objects = [
  32912. * { 'a': { 'b': _.constant(2) } },
  32913. * { 'a': { 'b': _.constant(1) } }
  32914. * ];
  32915. *
  32916. * _.map(objects, _.method('a.b'));
  32917. * // => [2, 1]
  32918. *
  32919. * _.map(objects, _.method(['a', 'b']));
  32920. * // => [2, 1]
  32921. */
  32922. var method = baseRest(function(path, args) {
  32923. return function(object) {
  32924. return baseInvoke(object, path, args);
  32925. };
  32926. });
  32927. /**
  32928. * The opposite of `_.method`; this method creates a function that invokes
  32929. * the method at a given path of `object`. Any additional arguments are
  32930. * provided to the invoked method.
  32931. *
  32932. * @static
  32933. * @memberOf _
  32934. * @since 3.7.0
  32935. * @category Util
  32936. * @param {Object} object The object to query.
  32937. * @param {...*} [args] The arguments to invoke the method with.
  32938. * @returns {Function} Returns the new invoker function.
  32939. * @example
  32940. *
  32941. * var array = _.times(3, _.constant),
  32942. * object = { 'a': array, 'b': array, 'c': array };
  32943. *
  32944. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  32945. * // => [2, 0]
  32946. *
  32947. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  32948. * // => [2, 0]
  32949. */
  32950. var methodOf = baseRest(function(object, args) {
  32951. return function(path) {
  32952. return baseInvoke(object, path, args);
  32953. };
  32954. });
  32955. /**
  32956. * Adds all own enumerable string keyed function properties of a source
  32957. * object to the destination object. If `object` is a function, then methods
  32958. * are added to its prototype as well.
  32959. *
  32960. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  32961. * avoid conflicts caused by modifying the original.
  32962. *
  32963. * @static
  32964. * @since 0.1.0
  32965. * @memberOf _
  32966. * @category Util
  32967. * @param {Function|Object} [object=lodash] The destination object.
  32968. * @param {Object} source The object of functions to add.
  32969. * @param {Object} [options={}] The options object.
  32970. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  32971. * @returns {Function|Object} Returns `object`.
  32972. * @example
  32973. *
  32974. * function vowels(string) {
  32975. * return _.filter(string, function(v) {
  32976. * return /[aeiou]/i.test(v);
  32977. * });
  32978. * }
  32979. *
  32980. * _.mixin({ 'vowels': vowels });
  32981. * _.vowels('fred');
  32982. * // => ['e']
  32983. *
  32984. * _('fred').vowels().value();
  32985. * // => ['e']
  32986. *
  32987. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  32988. * _('fred').vowels();
  32989. * // => ['e']
  32990. */
  32991. function mixin(object, source, options) {
  32992. var props = keys(source),
  32993. methodNames = baseFunctions(source, props);
  32994. if (options == null &&
  32995. !(isObject(source) && (methodNames.length || !props.length))) {
  32996. options = source;
  32997. source = object;
  32998. object = this;
  32999. methodNames = baseFunctions(source, keys(source));
  33000. }
  33001. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  33002. isFunc = isFunction(object);
  33003. arrayEach(methodNames, function(methodName) {
  33004. var func = source[methodName];
  33005. object[methodName] = func;
  33006. if (isFunc) {
  33007. object.prototype[methodName] = function() {
  33008. var chainAll = this.__chain__;
  33009. if (chain || chainAll) {
  33010. var result = object(this.__wrapped__),
  33011. actions = result.__actions__ = copyArray(this.__actions__);
  33012. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  33013. result.__chain__ = chainAll;
  33014. return result;
  33015. }
  33016. return func.apply(object, arrayPush([this.value()], arguments));
  33017. };
  33018. }
  33019. });
  33020. return object;
  33021. }
  33022. /**
  33023. * Reverts the `_` variable to its previous value and returns a reference to
  33024. * the `lodash` function.
  33025. *
  33026. * @static
  33027. * @since 0.1.0
  33028. * @memberOf _
  33029. * @category Util
  33030. * @returns {Function} Returns the `lodash` function.
  33031. * @example
  33032. *
  33033. * var lodash = _.noConflict();
  33034. */
  33035. function noConflict() {
  33036. if (root._ === this) {
  33037. root._ = oldDash;
  33038. }
  33039. return this;
  33040. }
  33041. /**
  33042. * This method returns `undefined`.
  33043. *
  33044. * @static
  33045. * @memberOf _
  33046. * @since 2.3.0
  33047. * @category Util
  33048. * @example
  33049. *
  33050. * _.times(2, _.noop);
  33051. * // => [undefined, undefined]
  33052. */
  33053. function noop() {
  33054. // No operation performed.
  33055. }
  33056. /**
  33057. * Creates a function that gets the argument at index `n`. If `n` is negative,
  33058. * the nth argument from the end is returned.
  33059. *
  33060. * @static
  33061. * @memberOf _
  33062. * @since 4.0.0
  33063. * @category Util
  33064. * @param {number} [n=0] The index of the argument to return.
  33065. * @returns {Function} Returns the new pass-thru function.
  33066. * @example
  33067. *
  33068. * var func = _.nthArg(1);
  33069. * func('a', 'b', 'c', 'd');
  33070. * // => 'b'
  33071. *
  33072. * var func = _.nthArg(-2);
  33073. * func('a', 'b', 'c', 'd');
  33074. * // => 'c'
  33075. */
  33076. function nthArg(n) {
  33077. n = toInteger(n);
  33078. return baseRest(function(args) {
  33079. return baseNth(args, n);
  33080. });
  33081. }
  33082. /**
  33083. * Creates a function that invokes `iteratees` with the arguments it receives
  33084. * and returns their results.
  33085. *
  33086. * @static
  33087. * @memberOf _
  33088. * @since 4.0.0
  33089. * @category Util
  33090. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  33091. * The iteratees to invoke.
  33092. * @returns {Function} Returns the new function.
  33093. * @example
  33094. *
  33095. * var func = _.over([Math.max, Math.min]);
  33096. *
  33097. * func(1, 2, 3, 4);
  33098. * // => [4, 1]
  33099. */
  33100. var over = createOver(arrayMap);
  33101. /**
  33102. * Creates a function that checks if **all** of the `predicates` return
  33103. * truthy when invoked with the arguments it receives.
  33104. *
  33105. * @static
  33106. * @memberOf _
  33107. * @since 4.0.0
  33108. * @category Util
  33109. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33110. * The predicates to check.
  33111. * @returns {Function} Returns the new function.
  33112. * @example
  33113. *
  33114. * var func = _.overEvery([Boolean, isFinite]);
  33115. *
  33116. * func('1');
  33117. * // => true
  33118. *
  33119. * func(null);
  33120. * // => false
  33121. *
  33122. * func(NaN);
  33123. * // => false
  33124. */
  33125. var overEvery = createOver(arrayEvery);
  33126. /**
  33127. * Creates a function that checks if **any** of the `predicates` return
  33128. * truthy when invoked with the arguments it receives.
  33129. *
  33130. * @static
  33131. * @memberOf _
  33132. * @since 4.0.0
  33133. * @category Util
  33134. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33135. * The predicates to check.
  33136. * @returns {Function} Returns the new function.
  33137. * @example
  33138. *
  33139. * var func = _.overSome([Boolean, isFinite]);
  33140. *
  33141. * func('1');
  33142. * // => true
  33143. *
  33144. * func(null);
  33145. * // => true
  33146. *
  33147. * func(NaN);
  33148. * // => false
  33149. */
  33150. var overSome = createOver(arraySome);
  33151. /**
  33152. * Creates a function that returns the value at `path` of a given object.
  33153. *
  33154. * @static
  33155. * @memberOf _
  33156. * @since 2.4.0
  33157. * @category Util
  33158. * @param {Array|string} path The path of the property to get.
  33159. * @returns {Function} Returns the new accessor function.
  33160. * @example
  33161. *
  33162. * var objects = [
  33163. * { 'a': { 'b': 2 } },
  33164. * { 'a': { 'b': 1 } }
  33165. * ];
  33166. *
  33167. * _.map(objects, _.property('a.b'));
  33168. * // => [2, 1]
  33169. *
  33170. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  33171. * // => [1, 2]
  33172. */
  33173. function property(path) {
  33174. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  33175. }
  33176. /**
  33177. * The opposite of `_.property`; this method creates a function that returns
  33178. * the value at a given path of `object`.
  33179. *
  33180. * @static
  33181. * @memberOf _
  33182. * @since 3.0.0
  33183. * @category Util
  33184. * @param {Object} object The object to query.
  33185. * @returns {Function} Returns the new accessor function.
  33186. * @example
  33187. *
  33188. * var array = [0, 1, 2],
  33189. * object = { 'a': array, 'b': array, 'c': array };
  33190. *
  33191. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  33192. * // => [2, 0]
  33193. *
  33194. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  33195. * // => [2, 0]
  33196. */
  33197. function propertyOf(object) {
  33198. return function(path) {
  33199. return object == null ? undefined : baseGet(object, path);
  33200. };
  33201. }
  33202. /**
  33203. * Creates an array of numbers (positive and/or negative) progressing from
  33204. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  33205. * `start` is specified without an `end` or `step`. If `end` is not specified,
  33206. * it's set to `start` with `start` then set to `0`.
  33207. *
  33208. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  33209. * floating-point values which can produce unexpected results.
  33210. *
  33211. * @static
  33212. * @since 0.1.0
  33213. * @memberOf _
  33214. * @category Util
  33215. * @param {number} [start=0] The start of the range.
  33216. * @param {number} end The end of the range.
  33217. * @param {number} [step=1] The value to increment or decrement by.
  33218. * @returns {Array} Returns the range of numbers.
  33219. * @see _.inRange, _.rangeRight
  33220. * @example
  33221. *
  33222. * _.range(4);
  33223. * // => [0, 1, 2, 3]
  33224. *
  33225. * _.range(-4);
  33226. * // => [0, -1, -2, -3]
  33227. *
  33228. * _.range(1, 5);
  33229. * // => [1, 2, 3, 4]
  33230. *
  33231. * _.range(0, 20, 5);
  33232. * // => [0, 5, 10, 15]
  33233. *
  33234. * _.range(0, -4, -1);
  33235. * // => [0, -1, -2, -3]
  33236. *
  33237. * _.range(1, 4, 0);
  33238. * // => [1, 1, 1]
  33239. *
  33240. * _.range(0);
  33241. * // => []
  33242. */
  33243. var range = createRange();
  33244. /**
  33245. * This method is like `_.range` except that it populates values in
  33246. * descending order.
  33247. *
  33248. * @static
  33249. * @memberOf _
  33250. * @since 4.0.0
  33251. * @category Util
  33252. * @param {number} [start=0] The start of the range.
  33253. * @param {number} end The end of the range.
  33254. * @param {number} [step=1] The value to increment or decrement by.
  33255. * @returns {Array} Returns the range of numbers.
  33256. * @see _.inRange, _.range
  33257. * @example
  33258. *
  33259. * _.rangeRight(4);
  33260. * // => [3, 2, 1, 0]
  33261. *
  33262. * _.rangeRight(-4);
  33263. * // => [-3, -2, -1, 0]
  33264. *
  33265. * _.rangeRight(1, 5);
  33266. * // => [4, 3, 2, 1]
  33267. *
  33268. * _.rangeRight(0, 20, 5);
  33269. * // => [15, 10, 5, 0]
  33270. *
  33271. * _.rangeRight(0, -4, -1);
  33272. * // => [-3, -2, -1, 0]
  33273. *
  33274. * _.rangeRight(1, 4, 0);
  33275. * // => [1, 1, 1]
  33276. *
  33277. * _.rangeRight(0);
  33278. * // => []
  33279. */
  33280. var rangeRight = createRange(true);
  33281. /**
  33282. * This method returns a new empty array.
  33283. *
  33284. * @static
  33285. * @memberOf _
  33286. * @since 4.13.0
  33287. * @category Util
  33288. * @returns {Array} Returns the new empty array.
  33289. * @example
  33290. *
  33291. * var arrays = _.times(2, _.stubArray);
  33292. *
  33293. * console.log(arrays);
  33294. * // => [[], []]
  33295. *
  33296. * console.log(arrays[0] === arrays[1]);
  33297. * // => false
  33298. */
  33299. function stubArray() {
  33300. return [];
  33301. }
  33302. /**
  33303. * This method returns `false`.
  33304. *
  33305. * @static
  33306. * @memberOf _
  33307. * @since 4.13.0
  33308. * @category Util
  33309. * @returns {boolean} Returns `false`.
  33310. * @example
  33311. *
  33312. * _.times(2, _.stubFalse);
  33313. * // => [false, false]
  33314. */
  33315. function stubFalse() {
  33316. return false;
  33317. }
  33318. /**
  33319. * This method returns a new empty object.
  33320. *
  33321. * @static
  33322. * @memberOf _
  33323. * @since 4.13.0
  33324. * @category Util
  33325. * @returns {Object} Returns the new empty object.
  33326. * @example
  33327. *
  33328. * var objects = _.times(2, _.stubObject);
  33329. *
  33330. * console.log(objects);
  33331. * // => [{}, {}]
  33332. *
  33333. * console.log(objects[0] === objects[1]);
  33334. * // => false
  33335. */
  33336. function stubObject() {
  33337. return {};
  33338. }
  33339. /**
  33340. * This method returns an empty string.
  33341. *
  33342. * @static
  33343. * @memberOf _
  33344. * @since 4.13.0
  33345. * @category Util
  33346. * @returns {string} Returns the empty string.
  33347. * @example
  33348. *
  33349. * _.times(2, _.stubString);
  33350. * // => ['', '']
  33351. */
  33352. function stubString() {
  33353. return '';
  33354. }
  33355. /**
  33356. * This method returns `true`.
  33357. *
  33358. * @static
  33359. * @memberOf _
  33360. * @since 4.13.0
  33361. * @category Util
  33362. * @returns {boolean} Returns `true`.
  33363. * @example
  33364. *
  33365. * _.times(2, _.stubTrue);
  33366. * // => [true, true]
  33367. */
  33368. function stubTrue() {
  33369. return true;
  33370. }
  33371. /**
  33372. * Invokes the iteratee `n` times, returning an array of the results of
  33373. * each invocation. The iteratee is invoked with one argument; (index).
  33374. *
  33375. * @static
  33376. * @since 0.1.0
  33377. * @memberOf _
  33378. * @category Util
  33379. * @param {number} n The number of times to invoke `iteratee`.
  33380. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33381. * @returns {Array} Returns the array of results.
  33382. * @example
  33383. *
  33384. * _.times(3, String);
  33385. * // => ['0', '1', '2']
  33386. *
  33387. * _.times(4, _.constant(0));
  33388. * // => [0, 0, 0, 0]
  33389. */
  33390. function times(n, iteratee) {
  33391. n = toInteger(n);
  33392. if (n < 1 || n > MAX_SAFE_INTEGER) {
  33393. return [];
  33394. }
  33395. var index = MAX_ARRAY_LENGTH,
  33396. length = nativeMin(n, MAX_ARRAY_LENGTH);
  33397. iteratee = getIteratee(iteratee);
  33398. n -= MAX_ARRAY_LENGTH;
  33399. var result = baseTimes(length, iteratee);
  33400. while (++index < n) {
  33401. iteratee(index);
  33402. }
  33403. return result;
  33404. }
  33405. /**
  33406. * Converts `value` to a property path array.
  33407. *
  33408. * @static
  33409. * @memberOf _
  33410. * @since 4.0.0
  33411. * @category Util
  33412. * @param {*} value The value to convert.
  33413. * @returns {Array} Returns the new property path array.
  33414. * @example
  33415. *
  33416. * _.toPath('a.b.c');
  33417. * // => ['a', 'b', 'c']
  33418. *
  33419. * _.toPath('a[0].b.c');
  33420. * // => ['a', '0', 'b', 'c']
  33421. */
  33422. function toPath(value) {
  33423. if (isArray(value)) {
  33424. return arrayMap(value, toKey);
  33425. }
  33426. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  33427. }
  33428. /**
  33429. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  33430. *
  33431. * @static
  33432. * @since 0.1.0
  33433. * @memberOf _
  33434. * @category Util
  33435. * @param {string} [prefix=''] The value to prefix the ID with.
  33436. * @returns {string} Returns the unique ID.
  33437. * @example
  33438. *
  33439. * _.uniqueId('contact_');
  33440. * // => 'contact_104'
  33441. *
  33442. * _.uniqueId();
  33443. * // => '105'
  33444. */
  33445. function uniqueId(prefix) {
  33446. var id = ++idCounter;
  33447. return toString(prefix) + id;
  33448. }
  33449. /*------------------------------------------------------------------------*/
  33450. /**
  33451. * Adds two numbers.
  33452. *
  33453. * @static
  33454. * @memberOf _
  33455. * @since 3.4.0
  33456. * @category Math
  33457. * @param {number} augend The first number in an addition.
  33458. * @param {number} addend The second number in an addition.
  33459. * @returns {number} Returns the total.
  33460. * @example
  33461. *
  33462. * _.add(6, 4);
  33463. * // => 10
  33464. */
  33465. var add = createMathOperation(function(augend, addend) {
  33466. return augend + addend;
  33467. }, 0);
  33468. /**
  33469. * Computes `number` rounded up to `precision`.
  33470. *
  33471. * @static
  33472. * @memberOf _
  33473. * @since 3.10.0
  33474. * @category Math
  33475. * @param {number} number The number to round up.
  33476. * @param {number} [precision=0] The precision to round up to.
  33477. * @returns {number} Returns the rounded up number.
  33478. * @example
  33479. *
  33480. * _.ceil(4.006);
  33481. * // => 5
  33482. *
  33483. * _.ceil(6.004, 2);
  33484. * // => 6.01
  33485. *
  33486. * _.ceil(6040, -2);
  33487. * // => 6100
  33488. */
  33489. var ceil = createRound('ceil');
  33490. /**
  33491. * Divide two numbers.
  33492. *
  33493. * @static
  33494. * @memberOf _
  33495. * @since 4.7.0
  33496. * @category Math
  33497. * @param {number} dividend The first number in a division.
  33498. * @param {number} divisor The second number in a division.
  33499. * @returns {number} Returns the quotient.
  33500. * @example
  33501. *
  33502. * _.divide(6, 4);
  33503. * // => 1.5
  33504. */
  33505. var divide = createMathOperation(function(dividend, divisor) {
  33506. return dividend / divisor;
  33507. }, 1);
  33508. /**
  33509. * Computes `number` rounded down to `precision`.
  33510. *
  33511. * @static
  33512. * @memberOf _
  33513. * @since 3.10.0
  33514. * @category Math
  33515. * @param {number} number The number to round down.
  33516. * @param {number} [precision=0] The precision to round down to.
  33517. * @returns {number} Returns the rounded down number.
  33518. * @example
  33519. *
  33520. * _.floor(4.006);
  33521. * // => 4
  33522. *
  33523. * _.floor(0.046, 2);
  33524. * // => 0.04
  33525. *
  33526. * _.floor(4060, -2);
  33527. * // => 4000
  33528. */
  33529. var floor = createRound('floor');
  33530. /**
  33531. * Computes the maximum value of `array`. If `array` is empty or falsey,
  33532. * `undefined` is returned.
  33533. *
  33534. * @static
  33535. * @since 0.1.0
  33536. * @memberOf _
  33537. * @category Math
  33538. * @param {Array} array The array to iterate over.
  33539. * @returns {*} Returns the maximum value.
  33540. * @example
  33541. *
  33542. * _.max([4, 2, 8, 6]);
  33543. * // => 8
  33544. *
  33545. * _.max([]);
  33546. * // => undefined
  33547. */
  33548. function max(array) {
  33549. return (array && array.length)
  33550. ? baseExtremum(array, identity, baseGt)
  33551. : undefined;
  33552. }
  33553. /**
  33554. * This method is like `_.max` except that it accepts `iteratee` which is
  33555. * invoked for each element in `array` to generate the criterion by which
  33556. * the value is ranked. The iteratee is invoked with one argument: (value).
  33557. *
  33558. * @static
  33559. * @memberOf _
  33560. * @since 4.0.0
  33561. * @category Math
  33562. * @param {Array} array The array to iterate over.
  33563. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33564. * @returns {*} Returns the maximum value.
  33565. * @example
  33566. *
  33567. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33568. *
  33569. * _.maxBy(objects, function(o) { return o.n; });
  33570. * // => { 'n': 2 }
  33571. *
  33572. * // The `_.property` iteratee shorthand.
  33573. * _.maxBy(objects, 'n');
  33574. * // => { 'n': 2 }
  33575. */
  33576. function maxBy(array, iteratee) {
  33577. return (array && array.length)
  33578. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  33579. : undefined;
  33580. }
  33581. /**
  33582. * Computes the mean of the values in `array`.
  33583. *
  33584. * @static
  33585. * @memberOf _
  33586. * @since 4.0.0
  33587. * @category Math
  33588. * @param {Array} array The array to iterate over.
  33589. * @returns {number} Returns the mean.
  33590. * @example
  33591. *
  33592. * _.mean([4, 2, 8, 6]);
  33593. * // => 5
  33594. */
  33595. function mean(array) {
  33596. return baseMean(array, identity);
  33597. }
  33598. /**
  33599. * This method is like `_.mean` except that it accepts `iteratee` which is
  33600. * invoked for each element in `array` to generate the value to be averaged.
  33601. * The iteratee is invoked with one argument: (value).
  33602. *
  33603. * @static
  33604. * @memberOf _
  33605. * @since 4.7.0
  33606. * @category Math
  33607. * @param {Array} array The array to iterate over.
  33608. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33609. * @returns {number} Returns the mean.
  33610. * @example
  33611. *
  33612. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33613. *
  33614. * _.meanBy(objects, function(o) { return o.n; });
  33615. * // => 5
  33616. *
  33617. * // The `_.property` iteratee shorthand.
  33618. * _.meanBy(objects, 'n');
  33619. * // => 5
  33620. */
  33621. function meanBy(array, iteratee) {
  33622. return baseMean(array, getIteratee(iteratee, 2));
  33623. }
  33624. /**
  33625. * Computes the minimum value of `array`. If `array` is empty or falsey,
  33626. * `undefined` is returned.
  33627. *
  33628. * @static
  33629. * @since 0.1.0
  33630. * @memberOf _
  33631. * @category Math
  33632. * @param {Array} array The array to iterate over.
  33633. * @returns {*} Returns the minimum value.
  33634. * @example
  33635. *
  33636. * _.min([4, 2, 8, 6]);
  33637. * // => 2
  33638. *
  33639. * _.min([]);
  33640. * // => undefined
  33641. */
  33642. function min(array) {
  33643. return (array && array.length)
  33644. ? baseExtremum(array, identity, baseLt)
  33645. : undefined;
  33646. }
  33647. /**
  33648. * This method is like `_.min` except that it accepts `iteratee` which is
  33649. * invoked for each element in `array` to generate the criterion by which
  33650. * the value is ranked. The iteratee is invoked with one argument: (value).
  33651. *
  33652. * @static
  33653. * @memberOf _
  33654. * @since 4.0.0
  33655. * @category Math
  33656. * @param {Array} array The array to iterate over.
  33657. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33658. * @returns {*} Returns the minimum value.
  33659. * @example
  33660. *
  33661. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33662. *
  33663. * _.minBy(objects, function(o) { return o.n; });
  33664. * // => { 'n': 1 }
  33665. *
  33666. * // The `_.property` iteratee shorthand.
  33667. * _.minBy(objects, 'n');
  33668. * // => { 'n': 1 }
  33669. */
  33670. function minBy(array, iteratee) {
  33671. return (array && array.length)
  33672. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  33673. : undefined;
  33674. }
  33675. /**
  33676. * Multiply two numbers.
  33677. *
  33678. * @static
  33679. * @memberOf _
  33680. * @since 4.7.0
  33681. * @category Math
  33682. * @param {number} multiplier The first number in a multiplication.
  33683. * @param {number} multiplicand The second number in a multiplication.
  33684. * @returns {number} Returns the product.
  33685. * @example
  33686. *
  33687. * _.multiply(6, 4);
  33688. * // => 24
  33689. */
  33690. var multiply = createMathOperation(function(multiplier, multiplicand) {
  33691. return multiplier * multiplicand;
  33692. }, 1);
  33693. /**
  33694. * Computes `number` rounded to `precision`.
  33695. *
  33696. * @static
  33697. * @memberOf _
  33698. * @since 3.10.0
  33699. * @category Math
  33700. * @param {number} number The number to round.
  33701. * @param {number} [precision=0] The precision to round to.
  33702. * @returns {number} Returns the rounded number.
  33703. * @example
  33704. *
  33705. * _.round(4.006);
  33706. * // => 4
  33707. *
  33708. * _.round(4.006, 2);
  33709. * // => 4.01
  33710. *
  33711. * _.round(4060, -2);
  33712. * // => 4100
  33713. */
  33714. var round = createRound('round');
  33715. /**
  33716. * Subtract two numbers.
  33717. *
  33718. * @static
  33719. * @memberOf _
  33720. * @since 4.0.0
  33721. * @category Math
  33722. * @param {number} minuend The first number in a subtraction.
  33723. * @param {number} subtrahend The second number in a subtraction.
  33724. * @returns {number} Returns the difference.
  33725. * @example
  33726. *
  33727. * _.subtract(6, 4);
  33728. * // => 2
  33729. */
  33730. var subtract = createMathOperation(function(minuend, subtrahend) {
  33731. return minuend - subtrahend;
  33732. }, 0);
  33733. /**
  33734. * Computes the sum of the values in `array`.
  33735. *
  33736. * @static
  33737. * @memberOf _
  33738. * @since 3.4.0
  33739. * @category Math
  33740. * @param {Array} array The array to iterate over.
  33741. * @returns {number} Returns the sum.
  33742. * @example
  33743. *
  33744. * _.sum([4, 2, 8, 6]);
  33745. * // => 20
  33746. */
  33747. function sum(array) {
  33748. return (array && array.length)
  33749. ? baseSum(array, identity)
  33750. : 0;
  33751. }
  33752. /**
  33753. * This method is like `_.sum` except that it accepts `iteratee` which is
  33754. * invoked for each element in `array` to generate the value to be summed.
  33755. * The iteratee is invoked with one argument: (value).
  33756. *
  33757. * @static
  33758. * @memberOf _
  33759. * @since 4.0.0
  33760. * @category Math
  33761. * @param {Array} array The array to iterate over.
  33762. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33763. * @returns {number} Returns the sum.
  33764. * @example
  33765. *
  33766. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33767. *
  33768. * _.sumBy(objects, function(o) { return o.n; });
  33769. * // => 20
  33770. *
  33771. * // The `_.property` iteratee shorthand.
  33772. * _.sumBy(objects, 'n');
  33773. * // => 20
  33774. */
  33775. function sumBy(array, iteratee) {
  33776. return (array && array.length)
  33777. ? baseSum(array, getIteratee(iteratee, 2))
  33778. : 0;
  33779. }
  33780. /*------------------------------------------------------------------------*/
  33781. // Add methods that return wrapped values in chain sequences.
  33782. lodash.after = after;
  33783. lodash.ary = ary;
  33784. lodash.assign = assign;
  33785. lodash.assignIn = assignIn;
  33786. lodash.assignInWith = assignInWith;
  33787. lodash.assignWith = assignWith;
  33788. lodash.at = at;
  33789. lodash.before = before;
  33790. lodash.bind = bind;
  33791. lodash.bindAll = bindAll;
  33792. lodash.bindKey = bindKey;
  33793. lodash.castArray = castArray;
  33794. lodash.chain = chain;
  33795. lodash.chunk = chunk;
  33796. lodash.compact = compact;
  33797. lodash.concat = concat;
  33798. lodash.cond = cond;
  33799. lodash.conforms = conforms;
  33800. lodash.constant = constant;
  33801. lodash.countBy = countBy;
  33802. lodash.create = create;
  33803. lodash.curry = curry;
  33804. lodash.curryRight = curryRight;
  33805. lodash.debounce = debounce;
  33806. lodash.defaults = defaults;
  33807. lodash.defaultsDeep = defaultsDeep;
  33808. lodash.defer = defer;
  33809. lodash.delay = delay;
  33810. lodash.difference = difference;
  33811. lodash.differenceBy = differenceBy;
  33812. lodash.differenceWith = differenceWith;
  33813. lodash.drop = drop;
  33814. lodash.dropRight = dropRight;
  33815. lodash.dropRightWhile = dropRightWhile;
  33816. lodash.dropWhile = dropWhile;
  33817. lodash.fill = fill;
  33818. lodash.filter = filter;
  33819. lodash.flatMap = flatMap;
  33820. lodash.flatMapDeep = flatMapDeep;
  33821. lodash.flatMapDepth = flatMapDepth;
  33822. lodash.flatten = flatten;
  33823. lodash.flattenDeep = flattenDeep;
  33824. lodash.flattenDepth = flattenDepth;
  33825. lodash.flip = flip;
  33826. lodash.flow = flow;
  33827. lodash.flowRight = flowRight;
  33828. lodash.fromPairs = fromPairs;
  33829. lodash.functions = functions;
  33830. lodash.functionsIn = functionsIn;
  33831. lodash.groupBy = groupBy;
  33832. lodash.initial = initial;
  33833. lodash.intersection = intersection;
  33834. lodash.intersectionBy = intersectionBy;
  33835. lodash.intersectionWith = intersectionWith;
  33836. lodash.invert = invert;
  33837. lodash.invertBy = invertBy;
  33838. lodash.invokeMap = invokeMap;
  33839. lodash.iteratee = iteratee;
  33840. lodash.keyBy = keyBy;
  33841. lodash.keys = keys;
  33842. lodash.keysIn = keysIn;
  33843. lodash.map = map;
  33844. lodash.mapKeys = mapKeys;
  33845. lodash.mapValues = mapValues;
  33846. lodash.matches = matches;
  33847. lodash.matchesProperty = matchesProperty;
  33848. lodash.memoize = memoize;
  33849. lodash.merge = merge;
  33850. lodash.mergeWith = mergeWith;
  33851. lodash.method = method;
  33852. lodash.methodOf = methodOf;
  33853. lodash.mixin = mixin;
  33854. lodash.negate = negate;
  33855. lodash.nthArg = nthArg;
  33856. lodash.omit = omit;
  33857. lodash.omitBy = omitBy;
  33858. lodash.once = once;
  33859. lodash.orderBy = orderBy;
  33860. lodash.over = over;
  33861. lodash.overArgs = overArgs;
  33862. lodash.overEvery = overEvery;
  33863. lodash.overSome = overSome;
  33864. lodash.partial = partial;
  33865. lodash.partialRight = partialRight;
  33866. lodash.partition = partition;
  33867. lodash.pick = pick;
  33868. lodash.pickBy = pickBy;
  33869. lodash.property = property;
  33870. lodash.propertyOf = propertyOf;
  33871. lodash.pull = pull;
  33872. lodash.pullAll = pullAll;
  33873. lodash.pullAllBy = pullAllBy;
  33874. lodash.pullAllWith = pullAllWith;
  33875. lodash.pullAt = pullAt;
  33876. lodash.range = range;
  33877. lodash.rangeRight = rangeRight;
  33878. lodash.rearg = rearg;
  33879. lodash.reject = reject;
  33880. lodash.remove = remove;
  33881. lodash.rest = rest;
  33882. lodash.reverse = reverse;
  33883. lodash.sampleSize = sampleSize;
  33884. lodash.set = set;
  33885. lodash.setWith = setWith;
  33886. lodash.shuffle = shuffle;
  33887. lodash.slice = slice;
  33888. lodash.sortBy = sortBy;
  33889. lodash.sortedUniq = sortedUniq;
  33890. lodash.sortedUniqBy = sortedUniqBy;
  33891. lodash.split = split;
  33892. lodash.spread = spread;
  33893. lodash.tail = tail;
  33894. lodash.take = take;
  33895. lodash.takeRight = takeRight;
  33896. lodash.takeRightWhile = takeRightWhile;
  33897. lodash.takeWhile = takeWhile;
  33898. lodash.tap = tap;
  33899. lodash.throttle = throttle;
  33900. lodash.thru = thru;
  33901. lodash.toArray = toArray;
  33902. lodash.toPairs = toPairs;
  33903. lodash.toPairsIn = toPairsIn;
  33904. lodash.toPath = toPath;
  33905. lodash.toPlainObject = toPlainObject;
  33906. lodash.transform = transform;
  33907. lodash.unary = unary;
  33908. lodash.union = union;
  33909. lodash.unionBy = unionBy;
  33910. lodash.unionWith = unionWith;
  33911. lodash.uniq = uniq;
  33912. lodash.uniqBy = uniqBy;
  33913. lodash.uniqWith = uniqWith;
  33914. lodash.unset = unset;
  33915. lodash.unzip = unzip;
  33916. lodash.unzipWith = unzipWith;
  33917. lodash.update = update;
  33918. lodash.updateWith = updateWith;
  33919. lodash.values = values;
  33920. lodash.valuesIn = valuesIn;
  33921. lodash.without = without;
  33922. lodash.words = words;
  33923. lodash.wrap = wrap;
  33924. lodash.xor = xor;
  33925. lodash.xorBy = xorBy;
  33926. lodash.xorWith = xorWith;
  33927. lodash.zip = zip;
  33928. lodash.zipObject = zipObject;
  33929. lodash.zipObjectDeep = zipObjectDeep;
  33930. lodash.zipWith = zipWith;
  33931. // Add aliases.
  33932. lodash.entries = toPairs;
  33933. lodash.entriesIn = toPairsIn;
  33934. lodash.extend = assignIn;
  33935. lodash.extendWith = assignInWith;
  33936. // Add methods to `lodash.prototype`.
  33937. mixin(lodash, lodash);
  33938. /*------------------------------------------------------------------------*/
  33939. // Add methods that return unwrapped values in chain sequences.
  33940. lodash.add = add;
  33941. lodash.attempt = attempt;
  33942. lodash.camelCase = camelCase;
  33943. lodash.capitalize = capitalize;
  33944. lodash.ceil = ceil;
  33945. lodash.clamp = clamp;
  33946. lodash.clone = clone;
  33947. lodash.cloneDeep = cloneDeep;
  33948. lodash.cloneDeepWith = cloneDeepWith;
  33949. lodash.cloneWith = cloneWith;
  33950. lodash.conformsTo = conformsTo;
  33951. lodash.deburr = deburr;
  33952. lodash.defaultTo = defaultTo;
  33953. lodash.divide = divide;
  33954. lodash.endsWith = endsWith;
  33955. lodash.eq = eq;
  33956. lodash.escape = escape;
  33957. lodash.escapeRegExp = escapeRegExp;
  33958. lodash.every = every;
  33959. lodash.find = find;
  33960. lodash.findIndex = findIndex;
  33961. lodash.findKey = findKey;
  33962. lodash.findLast = findLast;
  33963. lodash.findLastIndex = findLastIndex;
  33964. lodash.findLastKey = findLastKey;
  33965. lodash.floor = floor;
  33966. lodash.forEach = forEach;
  33967. lodash.forEachRight = forEachRight;
  33968. lodash.forIn = forIn;
  33969. lodash.forInRight = forInRight;
  33970. lodash.forOwn = forOwn;
  33971. lodash.forOwnRight = forOwnRight;
  33972. lodash.get = get;
  33973. lodash.gt = gt;
  33974. lodash.gte = gte;
  33975. lodash.has = has;
  33976. lodash.hasIn = hasIn;
  33977. lodash.head = head;
  33978. lodash.identity = identity;
  33979. lodash.includes = includes;
  33980. lodash.indexOf = indexOf;
  33981. lodash.inRange = inRange;
  33982. lodash.invoke = invoke;
  33983. lodash.isArguments = isArguments;
  33984. lodash.isArray = isArray;
  33985. lodash.isArrayBuffer = isArrayBuffer;
  33986. lodash.isArrayLike = isArrayLike;
  33987. lodash.isArrayLikeObject = isArrayLikeObject;
  33988. lodash.isBoolean = isBoolean;
  33989. lodash.isBuffer = isBuffer;
  33990. lodash.isDate = isDate;
  33991. lodash.isElement = isElement;
  33992. lodash.isEmpty = isEmpty;
  33993. lodash.isEqual = isEqual;
  33994. lodash.isEqualWith = isEqualWith;
  33995. lodash.isError = isError;
  33996. lodash.isFinite = isFinite;
  33997. lodash.isFunction = isFunction;
  33998. lodash.isInteger = isInteger;
  33999. lodash.isLength = isLength;
  34000. lodash.isMap = isMap;
  34001. lodash.isMatch = isMatch;
  34002. lodash.isMatchWith = isMatchWith;
  34003. lodash.isNaN = isNaN;
  34004. lodash.isNative = isNative;
  34005. lodash.isNil = isNil;
  34006. lodash.isNull = isNull;
  34007. lodash.isNumber = isNumber;
  34008. lodash.isObject = isObject;
  34009. lodash.isObjectLike = isObjectLike;
  34010. lodash.isPlainObject = isPlainObject;
  34011. lodash.isRegExp = isRegExp;
  34012. lodash.isSafeInteger = isSafeInteger;
  34013. lodash.isSet = isSet;
  34014. lodash.isString = isString;
  34015. lodash.isSymbol = isSymbol;
  34016. lodash.isTypedArray = isTypedArray;
  34017. lodash.isUndefined = isUndefined;
  34018. lodash.isWeakMap = isWeakMap;
  34019. lodash.isWeakSet = isWeakSet;
  34020. lodash.join = join;
  34021. lodash.kebabCase = kebabCase;
  34022. lodash.last = last;
  34023. lodash.lastIndexOf = lastIndexOf;
  34024. lodash.lowerCase = lowerCase;
  34025. lodash.lowerFirst = lowerFirst;
  34026. lodash.lt = lt;
  34027. lodash.lte = lte;
  34028. lodash.max = max;
  34029. lodash.maxBy = maxBy;
  34030. lodash.mean = mean;
  34031. lodash.meanBy = meanBy;
  34032. lodash.min = min;
  34033. lodash.minBy = minBy;
  34034. lodash.stubArray = stubArray;
  34035. lodash.stubFalse = stubFalse;
  34036. lodash.stubObject = stubObject;
  34037. lodash.stubString = stubString;
  34038. lodash.stubTrue = stubTrue;
  34039. lodash.multiply = multiply;
  34040. lodash.nth = nth;
  34041. lodash.noConflict = noConflict;
  34042. lodash.noop = noop;
  34043. lodash.now = now;
  34044. lodash.pad = pad;
  34045. lodash.padEnd = padEnd;
  34046. lodash.padStart = padStart;
  34047. lodash.parseInt = parseInt;
  34048. lodash.random = random;
  34049. lodash.reduce = reduce;
  34050. lodash.reduceRight = reduceRight;
  34051. lodash.repeat = repeat;
  34052. lodash.replace = replace;
  34053. lodash.result = result;
  34054. lodash.round = round;
  34055. lodash.runInContext = runInContext;
  34056. lodash.sample = sample;
  34057. lodash.size = size;
  34058. lodash.snakeCase = snakeCase;
  34059. lodash.some = some;
  34060. lodash.sortedIndex = sortedIndex;
  34061. lodash.sortedIndexBy = sortedIndexBy;
  34062. lodash.sortedIndexOf = sortedIndexOf;
  34063. lodash.sortedLastIndex = sortedLastIndex;
  34064. lodash.sortedLastIndexBy = sortedLastIndexBy;
  34065. lodash.sortedLastIndexOf = sortedLastIndexOf;
  34066. lodash.startCase = startCase;
  34067. lodash.startsWith = startsWith;
  34068. lodash.subtract = subtract;
  34069. lodash.sum = sum;
  34070. lodash.sumBy = sumBy;
  34071. lodash.template = template;
  34072. lodash.times = times;
  34073. lodash.toFinite = toFinite;
  34074. lodash.toInteger = toInteger;
  34075. lodash.toLength = toLength;
  34076. lodash.toLower = toLower;
  34077. lodash.toNumber = toNumber;
  34078. lodash.toSafeInteger = toSafeInteger;
  34079. lodash.toString = toString;
  34080. lodash.toUpper = toUpper;
  34081. lodash.trim = trim;
  34082. lodash.trimEnd = trimEnd;
  34083. lodash.trimStart = trimStart;
  34084. lodash.truncate = truncate;
  34085. lodash.unescape = unescape;
  34086. lodash.uniqueId = uniqueId;
  34087. lodash.upperCase = upperCase;
  34088. lodash.upperFirst = upperFirst;
  34089. // Add aliases.
  34090. lodash.each = forEach;
  34091. lodash.eachRight = forEachRight;
  34092. lodash.first = head;
  34093. mixin(lodash, (function() {
  34094. var source = {};
  34095. baseForOwn(lodash, function(func, methodName) {
  34096. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  34097. source[methodName] = func;
  34098. }
  34099. });
  34100. return source;
  34101. }()), { 'chain': false });
  34102. /*------------------------------------------------------------------------*/
  34103. /**
  34104. * The semantic version number.
  34105. *
  34106. * @static
  34107. * @memberOf _
  34108. * @type {string}
  34109. */
  34110. lodash.VERSION = VERSION;
  34111. // Assign default placeholders.
  34112. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  34113. lodash[methodName].placeholder = lodash;
  34114. });
  34115. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  34116. arrayEach(['drop', 'take'], function(methodName, index) {
  34117. LazyWrapper.prototype[methodName] = function(n) {
  34118. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  34119. var result = (this.__filtered__ && !index)
  34120. ? new LazyWrapper(this)
  34121. : this.clone();
  34122. if (result.__filtered__) {
  34123. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  34124. } else {
  34125. result.__views__.push({
  34126. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  34127. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  34128. });
  34129. }
  34130. return result;
  34131. };
  34132. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  34133. return this.reverse()[methodName](n).reverse();
  34134. };
  34135. });
  34136. // Add `LazyWrapper` methods that accept an `iteratee` value.
  34137. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  34138. var type = index + 1,
  34139. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  34140. LazyWrapper.prototype[methodName] = function(iteratee) {
  34141. var result = this.clone();
  34142. result.__iteratees__.push({
  34143. 'iteratee': getIteratee(iteratee, 3),
  34144. 'type': type
  34145. });
  34146. result.__filtered__ = result.__filtered__ || isFilter;
  34147. return result;
  34148. };
  34149. });
  34150. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  34151. arrayEach(['head', 'last'], function(methodName, index) {
  34152. var takeName = 'take' + (index ? 'Right' : '');
  34153. LazyWrapper.prototype[methodName] = function() {
  34154. return this[takeName](1).value()[0];
  34155. };
  34156. });
  34157. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  34158. arrayEach(['initial', 'tail'], function(methodName, index) {
  34159. var dropName = 'drop' + (index ? '' : 'Right');
  34160. LazyWrapper.prototype[methodName] = function() {
  34161. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  34162. };
  34163. });
  34164. LazyWrapper.prototype.compact = function() {
  34165. return this.filter(identity);
  34166. };
  34167. LazyWrapper.prototype.find = function(predicate) {
  34168. return this.filter(predicate).head();
  34169. };
  34170. LazyWrapper.prototype.findLast = function(predicate) {
  34171. return this.reverse().find(predicate);
  34172. };
  34173. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  34174. if (typeof path == 'function') {
  34175. return new LazyWrapper(this);
  34176. }
  34177. return this.map(function(value) {
  34178. return baseInvoke(value, path, args);
  34179. });
  34180. });
  34181. LazyWrapper.prototype.reject = function(predicate) {
  34182. return this.filter(negate(getIteratee(predicate)));
  34183. };
  34184. LazyWrapper.prototype.slice = function(start, end) {
  34185. start = toInteger(start);
  34186. var result = this;
  34187. if (result.__filtered__ && (start > 0 || end < 0)) {
  34188. return new LazyWrapper(result);
  34189. }
  34190. if (start < 0) {
  34191. result = result.takeRight(-start);
  34192. } else if (start) {
  34193. result = result.drop(start);
  34194. }
  34195. if (end !== undefined) {
  34196. end = toInteger(end);
  34197. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  34198. }
  34199. return result;
  34200. };
  34201. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  34202. return this.reverse().takeWhile(predicate).reverse();
  34203. };
  34204. LazyWrapper.prototype.toArray = function() {
  34205. return this.take(MAX_ARRAY_LENGTH);
  34206. };
  34207. // Add `LazyWrapper` methods to `lodash.prototype`.
  34208. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34209. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  34210. isTaker = /^(?:head|last)$/.test(methodName),
  34211. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  34212. retUnwrapped = isTaker || /^find/.test(methodName);
  34213. if (!lodashFunc) {
  34214. return;
  34215. }
  34216. lodash.prototype[methodName] = function() {
  34217. var value = this.__wrapped__,
  34218. args = isTaker ? [1] : arguments,
  34219. isLazy = value instanceof LazyWrapper,
  34220. iteratee = args[0],
  34221. useLazy = isLazy || isArray(value);
  34222. var interceptor = function(value) {
  34223. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  34224. return (isTaker && chainAll) ? result[0] : result;
  34225. };
  34226. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  34227. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  34228. isLazy = useLazy = false;
  34229. }
  34230. var chainAll = this.__chain__,
  34231. isHybrid = !!this.__actions__.length,
  34232. isUnwrapped = retUnwrapped && !chainAll,
  34233. onlyLazy = isLazy && !isHybrid;
  34234. if (!retUnwrapped && useLazy) {
  34235. value = onlyLazy ? value : new LazyWrapper(this);
  34236. var result = func.apply(value, args);
  34237. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  34238. return new LodashWrapper(result, chainAll);
  34239. }
  34240. if (isUnwrapped && onlyLazy) {
  34241. return func.apply(this, args);
  34242. }
  34243. result = this.thru(interceptor);
  34244. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  34245. };
  34246. });
  34247. // Add `Array` methods to `lodash.prototype`.
  34248. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  34249. var func = arrayProto[methodName],
  34250. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  34251. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  34252. lodash.prototype[methodName] = function() {
  34253. var args = arguments;
  34254. if (retUnwrapped && !this.__chain__) {
  34255. var value = this.value();
  34256. return func.apply(isArray(value) ? value : [], args);
  34257. }
  34258. return this[chainName](function(value) {
  34259. return func.apply(isArray(value) ? value : [], args);
  34260. });
  34261. };
  34262. });
  34263. // Map minified method names to their real names.
  34264. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34265. var lodashFunc = lodash[methodName];
  34266. if (lodashFunc) {
  34267. var key = lodashFunc.name + '';
  34268. if (!hasOwnProperty.call(realNames, key)) {
  34269. realNames[key] = [];
  34270. }
  34271. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  34272. }
  34273. });
  34274. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  34275. 'name': 'wrapper',
  34276. 'func': undefined
  34277. }];
  34278. // Add methods to `LazyWrapper`.
  34279. LazyWrapper.prototype.clone = lazyClone;
  34280. LazyWrapper.prototype.reverse = lazyReverse;
  34281. LazyWrapper.prototype.value = lazyValue;
  34282. // Add chain sequence methods to the `lodash` wrapper.
  34283. lodash.prototype.at = wrapperAt;
  34284. lodash.prototype.chain = wrapperChain;
  34285. lodash.prototype.commit = wrapperCommit;
  34286. lodash.prototype.next = wrapperNext;
  34287. lodash.prototype.plant = wrapperPlant;
  34288. lodash.prototype.reverse = wrapperReverse;
  34289. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  34290. // Add lazy aliases.
  34291. lodash.prototype.first = lodash.prototype.head;
  34292. if (symIterator) {
  34293. lodash.prototype[symIterator] = wrapperToIterator;
  34294. }
  34295. return lodash;
  34296. });
  34297. /*--------------------------------------------------------------------------*/
  34298. // Export lodash.
  34299. var _ = runInContext();
  34300. // Some AMD build optimizers, like r.js, check for condition patterns like:
  34301. if (true) {
  34302. // Expose Lodash on the global object to prevent errors when Lodash is
  34303. // loaded by a script tag in the presence of an AMD loader.
  34304. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  34305. // Use `_.noConflict` to remove Lodash from the global object.
  34306. root._ = _;
  34307. // Define as an anonymous module so, through path mapping, it can be
  34308. // referenced as the "underscore" module.
  34309. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  34310. return _;
  34311. }).call(exports, __webpack_require__, exports, module),
  34312. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  34313. }
  34314. // Check for `exports` after `define` in case a build optimizer adds it.
  34315. else {}
  34316. }.call(this));
  34317. /* 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)))
  34318. /***/ }),
  34319. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  34320. /*!***************************************************!*\
  34321. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  34322. \***************************************************/
  34323. /*! exports provided: default */
  34324. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  34325. "use strict";
  34326. __webpack_require__.r(__webpack_exports__);
  34327. /* WEBPACK VAR INJECTION */(function(global) {/**!
  34328. * @fileOverview Kickass library to create and place poppers near their reference elements.
  34329. * @version 1.16.1
  34330. * @license
  34331. * Copyright (c) 2016 Federico Zivolo and contributors
  34332. *
  34333. * Permission is hereby granted, free of charge, to any person obtaining a copy
  34334. * of this software and associated documentation files (the "Software"), to deal
  34335. * in the Software without restriction, including without limitation the rights
  34336. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  34337. * copies of the Software, and to permit persons to whom the Software is
  34338. * furnished to do so, subject to the following conditions:
  34339. *
  34340. * The above copyright notice and this permission notice shall be included in all
  34341. * copies or substantial portions of the Software.
  34342. *
  34343. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  34344. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  34345. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  34346. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  34347. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  34348. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  34349. * SOFTWARE.
  34350. */
  34351. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  34352. var timeoutDuration = function () {
  34353. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  34354. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  34355. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  34356. return 1;
  34357. }
  34358. }
  34359. return 0;
  34360. }();
  34361. function microtaskDebounce(fn) {
  34362. var called = false;
  34363. return function () {
  34364. if (called) {
  34365. return;
  34366. }
  34367. called = true;
  34368. window.Promise.resolve().then(function () {
  34369. called = false;
  34370. fn();
  34371. });
  34372. };
  34373. }
  34374. function taskDebounce(fn) {
  34375. var scheduled = false;
  34376. return function () {
  34377. if (!scheduled) {
  34378. scheduled = true;
  34379. setTimeout(function () {
  34380. scheduled = false;
  34381. fn();
  34382. }, timeoutDuration);
  34383. }
  34384. };
  34385. }
  34386. var supportsMicroTasks = isBrowser && window.Promise;
  34387. /**
  34388. * Create a debounced version of a method, that's asynchronously deferred
  34389. * but called in the minimum time possible.
  34390. *
  34391. * @method
  34392. * @memberof Popper.Utils
  34393. * @argument {Function} fn
  34394. * @returns {Function}
  34395. */
  34396. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  34397. /**
  34398. * Check if the given variable is a function
  34399. * @method
  34400. * @memberof Popper.Utils
  34401. * @argument {Any} functionToCheck - variable to check
  34402. * @returns {Boolean} answer to: is a function?
  34403. */
  34404. function isFunction(functionToCheck) {
  34405. var getType = {};
  34406. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  34407. }
  34408. /**
  34409. * Get CSS computed property of the given element
  34410. * @method
  34411. * @memberof Popper.Utils
  34412. * @argument {Eement} element
  34413. * @argument {String} property
  34414. */
  34415. function getStyleComputedProperty(element, property) {
  34416. if (element.nodeType !== 1) {
  34417. return [];
  34418. }
  34419. // NOTE: 1 DOM access here
  34420. var window = element.ownerDocument.defaultView;
  34421. var css = window.getComputedStyle(element, null);
  34422. return property ? css[property] : css;
  34423. }
  34424. /**
  34425. * Returns the parentNode or the host of the element
  34426. * @method
  34427. * @memberof Popper.Utils
  34428. * @argument {Element} element
  34429. * @returns {Element} parent
  34430. */
  34431. function getParentNode(element) {
  34432. if (element.nodeName === 'HTML') {
  34433. return element;
  34434. }
  34435. return element.parentNode || element.host;
  34436. }
  34437. /**
  34438. * Returns the scrolling parent of the given element
  34439. * @method
  34440. * @memberof Popper.Utils
  34441. * @argument {Element} element
  34442. * @returns {Element} scroll parent
  34443. */
  34444. function getScrollParent(element) {
  34445. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  34446. if (!element) {
  34447. return document.body;
  34448. }
  34449. switch (element.nodeName) {
  34450. case 'HTML':
  34451. case 'BODY':
  34452. return element.ownerDocument.body;
  34453. case '#document':
  34454. return element.body;
  34455. }
  34456. // Firefox want us to check `-x` and `-y` variations as well
  34457. var _getStyleComputedProp = getStyleComputedProperty(element),
  34458. overflow = _getStyleComputedProp.overflow,
  34459. overflowX = _getStyleComputedProp.overflowX,
  34460. overflowY = _getStyleComputedProp.overflowY;
  34461. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  34462. return element;
  34463. }
  34464. return getScrollParent(getParentNode(element));
  34465. }
  34466. /**
  34467. * Returns the reference node of the reference object, or the reference object itself.
  34468. * @method
  34469. * @memberof Popper.Utils
  34470. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  34471. * @returns {Element} parent
  34472. */
  34473. function getReferenceNode(reference) {
  34474. return reference && reference.referenceNode ? reference.referenceNode : reference;
  34475. }
  34476. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  34477. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  34478. /**
  34479. * Determines if the browser is Internet Explorer
  34480. * @method
  34481. * @memberof Popper.Utils
  34482. * @param {Number} version to check
  34483. * @returns {Boolean} isIE
  34484. */
  34485. function isIE(version) {
  34486. if (version === 11) {
  34487. return isIE11;
  34488. }
  34489. if (version === 10) {
  34490. return isIE10;
  34491. }
  34492. return isIE11 || isIE10;
  34493. }
  34494. /**
  34495. * Returns the offset parent of the given element
  34496. * @method
  34497. * @memberof Popper.Utils
  34498. * @argument {Element} element
  34499. * @returns {Element} offset parent
  34500. */
  34501. function getOffsetParent(element) {
  34502. if (!element) {
  34503. return document.documentElement;
  34504. }
  34505. var noOffsetParent = isIE(10) ? document.body : null;
  34506. // NOTE: 1 DOM access here
  34507. var offsetParent = element.offsetParent || null;
  34508. // Skip hidden elements which don't have an offsetParent
  34509. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  34510. offsetParent = (element = element.nextElementSibling).offsetParent;
  34511. }
  34512. var nodeName = offsetParent && offsetParent.nodeName;
  34513. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  34514. return element ? element.ownerDocument.documentElement : document.documentElement;
  34515. }
  34516. // .offsetParent will return the closest TH, TD or TABLE in case
  34517. // no offsetParent is present, I hate this job...
  34518. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  34519. return getOffsetParent(offsetParent);
  34520. }
  34521. return offsetParent;
  34522. }
  34523. function isOffsetContainer(element) {
  34524. var nodeName = element.nodeName;
  34525. if (nodeName === 'BODY') {
  34526. return false;
  34527. }
  34528. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  34529. }
  34530. /**
  34531. * Finds the root node (document, shadowDOM root) of the given element
  34532. * @method
  34533. * @memberof Popper.Utils
  34534. * @argument {Element} node
  34535. * @returns {Element} root node
  34536. */
  34537. function getRoot(node) {
  34538. if (node.parentNode !== null) {
  34539. return getRoot(node.parentNode);
  34540. }
  34541. return node;
  34542. }
  34543. /**
  34544. * Finds the offset parent common to the two provided nodes
  34545. * @method
  34546. * @memberof Popper.Utils
  34547. * @argument {Element} element1
  34548. * @argument {Element} element2
  34549. * @returns {Element} common offset parent
  34550. */
  34551. function findCommonOffsetParent(element1, element2) {
  34552. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34553. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  34554. return document.documentElement;
  34555. }
  34556. // Here we make sure to give as "start" the element that comes first in the DOM
  34557. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  34558. var start = order ? element1 : element2;
  34559. var end = order ? element2 : element1;
  34560. // Get common ancestor container
  34561. var range = document.createRange();
  34562. range.setStart(start, 0);
  34563. range.setEnd(end, 0);
  34564. var commonAncestorContainer = range.commonAncestorContainer;
  34565. // Both nodes are inside #document
  34566. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  34567. if (isOffsetContainer(commonAncestorContainer)) {
  34568. return commonAncestorContainer;
  34569. }
  34570. return getOffsetParent(commonAncestorContainer);
  34571. }
  34572. // one of the nodes is inside shadowDOM, find which one
  34573. var element1root = getRoot(element1);
  34574. if (element1root.host) {
  34575. return findCommonOffsetParent(element1root.host, element2);
  34576. } else {
  34577. return findCommonOffsetParent(element1, getRoot(element2).host);
  34578. }
  34579. }
  34580. /**
  34581. * Gets the scroll value of the given element in the given side (top and left)
  34582. * @method
  34583. * @memberof Popper.Utils
  34584. * @argument {Element} element
  34585. * @argument {String} side `top` or `left`
  34586. * @returns {number} amount of scrolled pixels
  34587. */
  34588. function getScroll(element) {
  34589. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  34590. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  34591. var nodeName = element.nodeName;
  34592. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34593. var html = element.ownerDocument.documentElement;
  34594. var scrollingElement = element.ownerDocument.scrollingElement || html;
  34595. return scrollingElement[upperSide];
  34596. }
  34597. return element[upperSide];
  34598. }
  34599. /*
  34600. * Sum or subtract the element scroll values (left and top) from a given rect object
  34601. * @method
  34602. * @memberof Popper.Utils
  34603. * @param {Object} rect - Rect object you want to change
  34604. * @param {HTMLElement} element - The element from the function reads the scroll values
  34605. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  34606. * @return {Object} rect - The modifier rect object
  34607. */
  34608. function includeScroll(rect, element) {
  34609. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34610. var scrollTop = getScroll(element, 'top');
  34611. var scrollLeft = getScroll(element, 'left');
  34612. var modifier = subtract ? -1 : 1;
  34613. rect.top += scrollTop * modifier;
  34614. rect.bottom += scrollTop * modifier;
  34615. rect.left += scrollLeft * modifier;
  34616. rect.right += scrollLeft * modifier;
  34617. return rect;
  34618. }
  34619. /*
  34620. * Helper to detect borders of a given element
  34621. * @method
  34622. * @memberof Popper.Utils
  34623. * @param {CSSStyleDeclaration} styles
  34624. * Result of `getStyleComputedProperty` on the given element
  34625. * @param {String} axis - `x` or `y`
  34626. * @return {number} borders - The borders size of the given axis
  34627. */
  34628. function getBordersSize(styles, axis) {
  34629. var sideA = axis === 'x' ? 'Left' : 'Top';
  34630. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  34631. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  34632. }
  34633. function getSize(axis, body, html, computedStyle) {
  34634. 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);
  34635. }
  34636. function getWindowSizes(document) {
  34637. var body = document.body;
  34638. var html = document.documentElement;
  34639. var computedStyle = isIE(10) && getComputedStyle(html);
  34640. return {
  34641. height: getSize('Height', body, html, computedStyle),
  34642. width: getSize('Width', body, html, computedStyle)
  34643. };
  34644. }
  34645. var classCallCheck = function (instance, Constructor) {
  34646. if (!(instance instanceof Constructor)) {
  34647. throw new TypeError("Cannot call a class as a function");
  34648. }
  34649. };
  34650. var createClass = function () {
  34651. function defineProperties(target, props) {
  34652. for (var i = 0; i < props.length; i++) {
  34653. var descriptor = props[i];
  34654. descriptor.enumerable = descriptor.enumerable || false;
  34655. descriptor.configurable = true;
  34656. if ("value" in descriptor) descriptor.writable = true;
  34657. Object.defineProperty(target, descriptor.key, descriptor);
  34658. }
  34659. }
  34660. return function (Constructor, protoProps, staticProps) {
  34661. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  34662. if (staticProps) defineProperties(Constructor, staticProps);
  34663. return Constructor;
  34664. };
  34665. }();
  34666. var defineProperty = function (obj, key, value) {
  34667. if (key in obj) {
  34668. Object.defineProperty(obj, key, {
  34669. value: value,
  34670. enumerable: true,
  34671. configurable: true,
  34672. writable: true
  34673. });
  34674. } else {
  34675. obj[key] = value;
  34676. }
  34677. return obj;
  34678. };
  34679. var _extends = Object.assign || function (target) {
  34680. for (var i = 1; i < arguments.length; i++) {
  34681. var source = arguments[i];
  34682. for (var key in source) {
  34683. if (Object.prototype.hasOwnProperty.call(source, key)) {
  34684. target[key] = source[key];
  34685. }
  34686. }
  34687. }
  34688. return target;
  34689. };
  34690. /**
  34691. * Given element offsets, generate an output similar to getBoundingClientRect
  34692. * @method
  34693. * @memberof Popper.Utils
  34694. * @argument {Object} offsets
  34695. * @returns {Object} ClientRect like output
  34696. */
  34697. function getClientRect(offsets) {
  34698. return _extends({}, offsets, {
  34699. right: offsets.left + offsets.width,
  34700. bottom: offsets.top + offsets.height
  34701. });
  34702. }
  34703. /**
  34704. * Get bounding client rect of given element
  34705. * @method
  34706. * @memberof Popper.Utils
  34707. * @param {HTMLElement} element
  34708. * @return {Object} client rect
  34709. */
  34710. function getBoundingClientRect(element) {
  34711. var rect = {};
  34712. // IE10 10 FIX: Please, don't ask, the element isn't
  34713. // considered in DOM in some circumstances...
  34714. // This isn't reproducible in IE10 compatibility mode of IE11
  34715. try {
  34716. if (isIE(10)) {
  34717. rect = element.getBoundingClientRect();
  34718. var scrollTop = getScroll(element, 'top');
  34719. var scrollLeft = getScroll(element, 'left');
  34720. rect.top += scrollTop;
  34721. rect.left += scrollLeft;
  34722. rect.bottom += scrollTop;
  34723. rect.right += scrollLeft;
  34724. } else {
  34725. rect = element.getBoundingClientRect();
  34726. }
  34727. } catch (e) {}
  34728. var result = {
  34729. left: rect.left,
  34730. top: rect.top,
  34731. width: rect.right - rect.left,
  34732. height: rect.bottom - rect.top
  34733. };
  34734. // subtract scrollbar size from sizes
  34735. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  34736. var width = sizes.width || element.clientWidth || result.width;
  34737. var height = sizes.height || element.clientHeight || result.height;
  34738. var horizScrollbar = element.offsetWidth - width;
  34739. var vertScrollbar = element.offsetHeight - height;
  34740. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  34741. // we make this check conditional for performance reasons
  34742. if (horizScrollbar || vertScrollbar) {
  34743. var styles = getStyleComputedProperty(element);
  34744. horizScrollbar -= getBordersSize(styles, 'x');
  34745. vertScrollbar -= getBordersSize(styles, 'y');
  34746. result.width -= horizScrollbar;
  34747. result.height -= vertScrollbar;
  34748. }
  34749. return getClientRect(result);
  34750. }
  34751. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  34752. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34753. var isIE10 = isIE(10);
  34754. var isHTML = parent.nodeName === 'HTML';
  34755. var childrenRect = getBoundingClientRect(children);
  34756. var parentRect = getBoundingClientRect(parent);
  34757. var scrollParent = getScrollParent(children);
  34758. var styles = getStyleComputedProperty(parent);
  34759. var borderTopWidth = parseFloat(styles.borderTopWidth);
  34760. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  34761. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  34762. if (fixedPosition && isHTML) {
  34763. parentRect.top = Math.max(parentRect.top, 0);
  34764. parentRect.left = Math.max(parentRect.left, 0);
  34765. }
  34766. var offsets = getClientRect({
  34767. top: childrenRect.top - parentRect.top - borderTopWidth,
  34768. left: childrenRect.left - parentRect.left - borderLeftWidth,
  34769. width: childrenRect.width,
  34770. height: childrenRect.height
  34771. });
  34772. offsets.marginTop = 0;
  34773. offsets.marginLeft = 0;
  34774. // Subtract margins of documentElement in case it's being used as parent
  34775. // we do this only on HTML because it's the only element that behaves
  34776. // differently when margins are applied to it. The margins are included in
  34777. // the box of the documentElement, in the other cases not.
  34778. if (!isIE10 && isHTML) {
  34779. var marginTop = parseFloat(styles.marginTop);
  34780. var marginLeft = parseFloat(styles.marginLeft);
  34781. offsets.top -= borderTopWidth - marginTop;
  34782. offsets.bottom -= borderTopWidth - marginTop;
  34783. offsets.left -= borderLeftWidth - marginLeft;
  34784. offsets.right -= borderLeftWidth - marginLeft;
  34785. // Attach marginTop and marginLeft because in some circumstances we may need them
  34786. offsets.marginTop = marginTop;
  34787. offsets.marginLeft = marginLeft;
  34788. }
  34789. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  34790. offsets = includeScroll(offsets, parent);
  34791. }
  34792. return offsets;
  34793. }
  34794. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  34795. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  34796. var html = element.ownerDocument.documentElement;
  34797. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  34798. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  34799. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  34800. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  34801. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  34802. var offset = {
  34803. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  34804. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  34805. width: width,
  34806. height: height
  34807. };
  34808. return getClientRect(offset);
  34809. }
  34810. /**
  34811. * Check if the given element is fixed or is inside a fixed parent
  34812. * @method
  34813. * @memberof Popper.Utils
  34814. * @argument {Element} element
  34815. * @argument {Element} customContainer
  34816. * @returns {Boolean} answer to "isFixed?"
  34817. */
  34818. function isFixed(element) {
  34819. var nodeName = element.nodeName;
  34820. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34821. return false;
  34822. }
  34823. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  34824. return true;
  34825. }
  34826. var parentNode = getParentNode(element);
  34827. if (!parentNode) {
  34828. return false;
  34829. }
  34830. return isFixed(parentNode);
  34831. }
  34832. /**
  34833. * Finds the first parent of an element that has a transformed property defined
  34834. * @method
  34835. * @memberof Popper.Utils
  34836. * @argument {Element} element
  34837. * @returns {Element} first transformed parent or documentElement
  34838. */
  34839. function getFixedPositionOffsetParent(element) {
  34840. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34841. if (!element || !element.parentElement || isIE()) {
  34842. return document.documentElement;
  34843. }
  34844. var el = element.parentElement;
  34845. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  34846. el = el.parentElement;
  34847. }
  34848. return el || document.documentElement;
  34849. }
  34850. /**
  34851. * Computed the boundaries limits and return them
  34852. * @method
  34853. * @memberof Popper.Utils
  34854. * @param {HTMLElement} popper
  34855. * @param {HTMLElement} reference
  34856. * @param {number} padding
  34857. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  34858. * @param {Boolean} fixedPosition - Is in fixed position mode
  34859. * @returns {Object} Coordinates of the boundaries
  34860. */
  34861. function getBoundaries(popper, reference, padding, boundariesElement) {
  34862. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  34863. // NOTE: 1 DOM access here
  34864. var boundaries = { top: 0, left: 0 };
  34865. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34866. // Handle viewport case
  34867. if (boundariesElement === 'viewport') {
  34868. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  34869. } else {
  34870. // Handle other cases based on DOM element used as boundaries
  34871. var boundariesNode = void 0;
  34872. if (boundariesElement === 'scrollParent') {
  34873. boundariesNode = getScrollParent(getParentNode(reference));
  34874. if (boundariesNode.nodeName === 'BODY') {
  34875. boundariesNode = popper.ownerDocument.documentElement;
  34876. }
  34877. } else if (boundariesElement === 'window') {
  34878. boundariesNode = popper.ownerDocument.documentElement;
  34879. } else {
  34880. boundariesNode = boundariesElement;
  34881. }
  34882. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  34883. // In case of HTML, we need a different computation
  34884. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  34885. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  34886. height = _getWindowSizes.height,
  34887. width = _getWindowSizes.width;
  34888. boundaries.top += offsets.top - offsets.marginTop;
  34889. boundaries.bottom = height + offsets.top;
  34890. boundaries.left += offsets.left - offsets.marginLeft;
  34891. boundaries.right = width + offsets.left;
  34892. } else {
  34893. // for all the other DOM elements, this one is good
  34894. boundaries = offsets;
  34895. }
  34896. }
  34897. // Add paddings
  34898. padding = padding || 0;
  34899. var isPaddingNumber = typeof padding === 'number';
  34900. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  34901. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  34902. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  34903. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  34904. return boundaries;
  34905. }
  34906. function getArea(_ref) {
  34907. var width = _ref.width,
  34908. height = _ref.height;
  34909. return width * height;
  34910. }
  34911. /**
  34912. * Utility used to transform the `auto` placement to the placement with more
  34913. * available space.
  34914. * @method
  34915. * @memberof Popper.Utils
  34916. * @argument {Object} data - The data object generated by update method
  34917. * @argument {Object} options - Modifiers configuration and options
  34918. * @returns {Object} The data object, properly modified
  34919. */
  34920. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  34921. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  34922. if (placement.indexOf('auto') === -1) {
  34923. return placement;
  34924. }
  34925. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  34926. var rects = {
  34927. top: {
  34928. width: boundaries.width,
  34929. height: refRect.top - boundaries.top
  34930. },
  34931. right: {
  34932. width: boundaries.right - refRect.right,
  34933. height: boundaries.height
  34934. },
  34935. bottom: {
  34936. width: boundaries.width,
  34937. height: boundaries.bottom - refRect.bottom
  34938. },
  34939. left: {
  34940. width: refRect.left - boundaries.left,
  34941. height: boundaries.height
  34942. }
  34943. };
  34944. var sortedAreas = Object.keys(rects).map(function (key) {
  34945. return _extends({
  34946. key: key
  34947. }, rects[key], {
  34948. area: getArea(rects[key])
  34949. });
  34950. }).sort(function (a, b) {
  34951. return b.area - a.area;
  34952. });
  34953. var filteredAreas = sortedAreas.filter(function (_ref2) {
  34954. var width = _ref2.width,
  34955. height = _ref2.height;
  34956. return width >= popper.clientWidth && height >= popper.clientHeight;
  34957. });
  34958. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  34959. var variation = placement.split('-')[1];
  34960. return computedPlacement + (variation ? '-' + variation : '');
  34961. }
  34962. /**
  34963. * Get offsets to the reference element
  34964. * @method
  34965. * @memberof Popper.Utils
  34966. * @param {Object} state
  34967. * @param {Element} popper - the popper element
  34968. * @param {Element} reference - the reference element (the popper will be relative to this)
  34969. * @param {Element} fixedPosition - is in fixed position mode
  34970. * @returns {Object} An object containing the offsets which will be applied to the popper
  34971. */
  34972. function getReferenceOffsets(state, popper, reference) {
  34973. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  34974. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34975. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  34976. }
  34977. /**
  34978. * Get the outer sizes of the given element (offset size + margins)
  34979. * @method
  34980. * @memberof Popper.Utils
  34981. * @argument {Element} element
  34982. * @returns {Object} object containing width and height properties
  34983. */
  34984. function getOuterSizes(element) {
  34985. var window = element.ownerDocument.defaultView;
  34986. var styles = window.getComputedStyle(element);
  34987. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  34988. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  34989. var result = {
  34990. width: element.offsetWidth + y,
  34991. height: element.offsetHeight + x
  34992. };
  34993. return result;
  34994. }
  34995. /**
  34996. * Get the opposite placement of the given one
  34997. * @method
  34998. * @memberof Popper.Utils
  34999. * @argument {String} placement
  35000. * @returns {String} flipped placement
  35001. */
  35002. function getOppositePlacement(placement) {
  35003. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  35004. return placement.replace(/left|right|bottom|top/g, function (matched) {
  35005. return hash[matched];
  35006. });
  35007. }
  35008. /**
  35009. * Get offsets to the popper
  35010. * @method
  35011. * @memberof Popper.Utils
  35012. * @param {Object} position - CSS position the Popper will get applied
  35013. * @param {HTMLElement} popper - the popper element
  35014. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  35015. * @param {String} placement - one of the valid placement options
  35016. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  35017. */
  35018. function getPopperOffsets(popper, referenceOffsets, placement) {
  35019. placement = placement.split('-')[0];
  35020. // Get popper node sizes
  35021. var popperRect = getOuterSizes(popper);
  35022. // Add position, width and height to our offsets object
  35023. var popperOffsets = {
  35024. width: popperRect.width,
  35025. height: popperRect.height
  35026. };
  35027. // depending by the popper placement we have to compute its offsets slightly differently
  35028. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  35029. var mainSide = isHoriz ? 'top' : 'left';
  35030. var secondarySide = isHoriz ? 'left' : 'top';
  35031. var measurement = isHoriz ? 'height' : 'width';
  35032. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  35033. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  35034. if (placement === secondarySide) {
  35035. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  35036. } else {
  35037. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  35038. }
  35039. return popperOffsets;
  35040. }
  35041. /**
  35042. * Mimics the `find` method of Array
  35043. * @method
  35044. * @memberof Popper.Utils
  35045. * @argument {Array} arr
  35046. * @argument prop
  35047. * @argument value
  35048. * @returns index or -1
  35049. */
  35050. function find(arr, check) {
  35051. // use native find if supported
  35052. if (Array.prototype.find) {
  35053. return arr.find(check);
  35054. }
  35055. // use `filter` to obtain the same behavior of `find`
  35056. return arr.filter(check)[0];
  35057. }
  35058. /**
  35059. * Return the index of the matching object
  35060. * @method
  35061. * @memberof Popper.Utils
  35062. * @argument {Array} arr
  35063. * @argument prop
  35064. * @argument value
  35065. * @returns index or -1
  35066. */
  35067. function findIndex(arr, prop, value) {
  35068. // use native findIndex if supported
  35069. if (Array.prototype.findIndex) {
  35070. return arr.findIndex(function (cur) {
  35071. return cur[prop] === value;
  35072. });
  35073. }
  35074. // use `find` + `indexOf` if `findIndex` isn't supported
  35075. var match = find(arr, function (obj) {
  35076. return obj[prop] === value;
  35077. });
  35078. return arr.indexOf(match);
  35079. }
  35080. /**
  35081. * Loop trough the list of modifiers and run them in order,
  35082. * each of them will then edit the data object.
  35083. * @method
  35084. * @memberof Popper.Utils
  35085. * @param {dataObject} data
  35086. * @param {Array} modifiers
  35087. * @param {String} ends - Optional modifier name used as stopper
  35088. * @returns {dataObject}
  35089. */
  35090. function runModifiers(modifiers, data, ends) {
  35091. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  35092. modifiersToRun.forEach(function (modifier) {
  35093. if (modifier['function']) {
  35094. // eslint-disable-line dot-notation
  35095. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  35096. }
  35097. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  35098. if (modifier.enabled && isFunction(fn)) {
  35099. // Add properties to offsets to make them a complete clientRect object
  35100. // we do this before each modifier to make sure the previous one doesn't
  35101. // mess with these values
  35102. data.offsets.popper = getClientRect(data.offsets.popper);
  35103. data.offsets.reference = getClientRect(data.offsets.reference);
  35104. data = fn(data, modifier);
  35105. }
  35106. });
  35107. return data;
  35108. }
  35109. /**
  35110. * Updates the position of the popper, computing the new offsets and applying
  35111. * the new style.<br />
  35112. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  35113. * @method
  35114. * @memberof Popper
  35115. */
  35116. function update() {
  35117. // if popper is destroyed, don't perform any further update
  35118. if (this.state.isDestroyed) {
  35119. return;
  35120. }
  35121. var data = {
  35122. instance: this,
  35123. styles: {},
  35124. arrowStyles: {},
  35125. attributes: {},
  35126. flipped: false,
  35127. offsets: {}
  35128. };
  35129. // compute reference element offsets
  35130. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  35131. // compute auto placement, store placement inside the data object,
  35132. // modifiers will be able to edit `placement` if needed
  35133. // and refer to originalPlacement to know the original value
  35134. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  35135. // store the computed placement inside `originalPlacement`
  35136. data.originalPlacement = data.placement;
  35137. data.positionFixed = this.options.positionFixed;
  35138. // compute the popper offsets
  35139. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  35140. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  35141. // run the modifiers
  35142. data = runModifiers(this.modifiers, data);
  35143. // the first `update` will call `onCreate` callback
  35144. // the other ones will call `onUpdate` callback
  35145. if (!this.state.isCreated) {
  35146. this.state.isCreated = true;
  35147. this.options.onCreate(data);
  35148. } else {
  35149. this.options.onUpdate(data);
  35150. }
  35151. }
  35152. /**
  35153. * Helper used to know if the given modifier is enabled.
  35154. * @method
  35155. * @memberof Popper.Utils
  35156. * @returns {Boolean}
  35157. */
  35158. function isModifierEnabled(modifiers, modifierName) {
  35159. return modifiers.some(function (_ref) {
  35160. var name = _ref.name,
  35161. enabled = _ref.enabled;
  35162. return enabled && name === modifierName;
  35163. });
  35164. }
  35165. /**
  35166. * Get the prefixed supported property name
  35167. * @method
  35168. * @memberof Popper.Utils
  35169. * @argument {String} property (camelCase)
  35170. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  35171. */
  35172. function getSupportedPropertyName(property) {
  35173. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  35174. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  35175. for (var i = 0; i < prefixes.length; i++) {
  35176. var prefix = prefixes[i];
  35177. var toCheck = prefix ? '' + prefix + upperProp : property;
  35178. if (typeof document.body.style[toCheck] !== 'undefined') {
  35179. return toCheck;
  35180. }
  35181. }
  35182. return null;
  35183. }
  35184. /**
  35185. * Destroys the popper.
  35186. * @method
  35187. * @memberof Popper
  35188. */
  35189. function destroy() {
  35190. this.state.isDestroyed = true;
  35191. // touch DOM only if `applyStyle` modifier is enabled
  35192. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  35193. this.popper.removeAttribute('x-placement');
  35194. this.popper.style.position = '';
  35195. this.popper.style.top = '';
  35196. this.popper.style.left = '';
  35197. this.popper.style.right = '';
  35198. this.popper.style.bottom = '';
  35199. this.popper.style.willChange = '';
  35200. this.popper.style[getSupportedPropertyName('transform')] = '';
  35201. }
  35202. this.disableEventListeners();
  35203. // remove the popper if user explicitly asked for the deletion on destroy
  35204. // do not use `remove` because IE11 doesn't support it
  35205. if (this.options.removeOnDestroy) {
  35206. this.popper.parentNode.removeChild(this.popper);
  35207. }
  35208. return this;
  35209. }
  35210. /**
  35211. * Get the window associated with the element
  35212. * @argument {Element} element
  35213. * @returns {Window}
  35214. */
  35215. function getWindow(element) {
  35216. var ownerDocument = element.ownerDocument;
  35217. return ownerDocument ? ownerDocument.defaultView : window;
  35218. }
  35219. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  35220. var isBody = scrollParent.nodeName === 'BODY';
  35221. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  35222. target.addEventListener(event, callback, { passive: true });
  35223. if (!isBody) {
  35224. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  35225. }
  35226. scrollParents.push(target);
  35227. }
  35228. /**
  35229. * Setup needed event listeners used to update the popper position
  35230. * @method
  35231. * @memberof Popper.Utils
  35232. * @private
  35233. */
  35234. function setupEventListeners(reference, options, state, updateBound) {
  35235. // Resize event listener on window
  35236. state.updateBound = updateBound;
  35237. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  35238. // Scroll event listener on scroll parents
  35239. var scrollElement = getScrollParent(reference);
  35240. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  35241. state.scrollElement = scrollElement;
  35242. state.eventsEnabled = true;
  35243. return state;
  35244. }
  35245. /**
  35246. * It will add resize/scroll events and start recalculating
  35247. * position of the popper element when they are triggered.
  35248. * @method
  35249. * @memberof Popper
  35250. */
  35251. function enableEventListeners() {
  35252. if (!this.state.eventsEnabled) {
  35253. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  35254. }
  35255. }
  35256. /**
  35257. * Remove event listeners used to update the popper position
  35258. * @method
  35259. * @memberof Popper.Utils
  35260. * @private
  35261. */
  35262. function removeEventListeners(reference, state) {
  35263. // Remove resize event listener on window
  35264. getWindow(reference).removeEventListener('resize', state.updateBound);
  35265. // Remove scroll event listener on scroll parents
  35266. state.scrollParents.forEach(function (target) {
  35267. target.removeEventListener('scroll', state.updateBound);
  35268. });
  35269. // Reset state
  35270. state.updateBound = null;
  35271. state.scrollParents = [];
  35272. state.scrollElement = null;
  35273. state.eventsEnabled = false;
  35274. return state;
  35275. }
  35276. /**
  35277. * It will remove resize/scroll events and won't recalculate popper position
  35278. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  35279. * unless you call `update` method manually.
  35280. * @method
  35281. * @memberof Popper
  35282. */
  35283. function disableEventListeners() {
  35284. if (this.state.eventsEnabled) {
  35285. cancelAnimationFrame(this.scheduleUpdate);
  35286. this.state = removeEventListeners(this.reference, this.state);
  35287. }
  35288. }
  35289. /**
  35290. * Tells if a given input is a number
  35291. * @method
  35292. * @memberof Popper.Utils
  35293. * @param {*} input to check
  35294. * @return {Boolean}
  35295. */
  35296. function isNumeric(n) {
  35297. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  35298. }
  35299. /**
  35300. * Set the style to the given popper
  35301. * @method
  35302. * @memberof Popper.Utils
  35303. * @argument {Element} element - Element to apply the style to
  35304. * @argument {Object} styles
  35305. * Object with a list of properties and values which will be applied to the element
  35306. */
  35307. function setStyles(element, styles) {
  35308. Object.keys(styles).forEach(function (prop) {
  35309. var unit = '';
  35310. // add unit if the value is numeric and is one of the following
  35311. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  35312. unit = 'px';
  35313. }
  35314. element.style[prop] = styles[prop] + unit;
  35315. });
  35316. }
  35317. /**
  35318. * Set the attributes to the given popper
  35319. * @method
  35320. * @memberof Popper.Utils
  35321. * @argument {Element} element - Element to apply the attributes to
  35322. * @argument {Object} styles
  35323. * Object with a list of properties and values which will be applied to the element
  35324. */
  35325. function setAttributes(element, attributes) {
  35326. Object.keys(attributes).forEach(function (prop) {
  35327. var value = attributes[prop];
  35328. if (value !== false) {
  35329. element.setAttribute(prop, attributes[prop]);
  35330. } else {
  35331. element.removeAttribute(prop);
  35332. }
  35333. });
  35334. }
  35335. /**
  35336. * @function
  35337. * @memberof Modifiers
  35338. * @argument {Object} data - The data object generated by `update` method
  35339. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  35340. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  35341. * @argument {Object} options - Modifiers configuration and options
  35342. * @returns {Object} The same data object
  35343. */
  35344. function applyStyle(data) {
  35345. // any property present in `data.styles` will be applied to the popper,
  35346. // in this way we can make the 3rd party modifiers add custom styles to it
  35347. // Be aware, modifiers could override the properties defined in the previous
  35348. // lines of this modifier!
  35349. setStyles(data.instance.popper, data.styles);
  35350. // any property present in `data.attributes` will be applied to the popper,
  35351. // they will be set as HTML attributes of the element
  35352. setAttributes(data.instance.popper, data.attributes);
  35353. // if arrowElement is defined and arrowStyles has some properties
  35354. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  35355. setStyles(data.arrowElement, data.arrowStyles);
  35356. }
  35357. return data;
  35358. }
  35359. /**
  35360. * Set the x-placement attribute before everything else because it could be used
  35361. * to add margins to the popper margins needs to be calculated to get the
  35362. * correct popper offsets.
  35363. * @method
  35364. * @memberof Popper.modifiers
  35365. * @param {HTMLElement} reference - The reference element used to position the popper
  35366. * @param {HTMLElement} popper - The HTML element used as popper
  35367. * @param {Object} options - Popper.js options
  35368. */
  35369. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  35370. // compute reference element offsets
  35371. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  35372. // compute auto placement, store placement inside the data object,
  35373. // modifiers will be able to edit `placement` if needed
  35374. // and refer to originalPlacement to know the original value
  35375. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  35376. popper.setAttribute('x-placement', placement);
  35377. // Apply `position` to popper before anything else because
  35378. // without the position applied we can't guarantee correct computations
  35379. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  35380. return options;
  35381. }
  35382. /**
  35383. * @function
  35384. * @memberof Popper.Utils
  35385. * @argument {Object} data - The data object generated by `update` method
  35386. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  35387. * @returns {Object} The popper's position offsets rounded
  35388. *
  35389. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  35390. * good as it can be within reason.
  35391. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  35392. *
  35393. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  35394. * as well on High DPI screens).
  35395. *
  35396. * Firefox prefers no rounding for positioning and does not have blurriness on
  35397. * high DPI screens.
  35398. *
  35399. * Only horizontal placement and left/right values need to be considered.
  35400. */
  35401. function getRoundedOffsets(data, shouldRound) {
  35402. var _data$offsets = data.offsets,
  35403. popper = _data$offsets.popper,
  35404. reference = _data$offsets.reference;
  35405. var round = Math.round,
  35406. floor = Math.floor;
  35407. var noRound = function noRound(v) {
  35408. return v;
  35409. };
  35410. var referenceWidth = round(reference.width);
  35411. var popperWidth = round(popper.width);
  35412. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  35413. var isVariation = data.placement.indexOf('-') !== -1;
  35414. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  35415. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  35416. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  35417. var verticalToInteger = !shouldRound ? noRound : round;
  35418. return {
  35419. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  35420. top: verticalToInteger(popper.top),
  35421. bottom: verticalToInteger(popper.bottom),
  35422. right: horizontalToInteger(popper.right)
  35423. };
  35424. }
  35425. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  35426. /**
  35427. * @function
  35428. * @memberof Modifiers
  35429. * @argument {Object} data - The data object generated by `update` method
  35430. * @argument {Object} options - Modifiers configuration and options
  35431. * @returns {Object} The data object, properly modified
  35432. */
  35433. function computeStyle(data, options) {
  35434. var x = options.x,
  35435. y = options.y;
  35436. var popper = data.offsets.popper;
  35437. // Remove this legacy support in Popper.js v2
  35438. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  35439. return modifier.name === 'applyStyle';
  35440. }).gpuAcceleration;
  35441. if (legacyGpuAccelerationOption !== undefined) {
  35442. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  35443. }
  35444. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  35445. var offsetParent = getOffsetParent(data.instance.popper);
  35446. var offsetParentRect = getBoundingClientRect(offsetParent);
  35447. // Styles
  35448. var styles = {
  35449. position: popper.position
  35450. };
  35451. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  35452. var sideA = x === 'bottom' ? 'top' : 'bottom';
  35453. var sideB = y === 'right' ? 'left' : 'right';
  35454. // if gpuAcceleration is set to `true` and transform is supported,
  35455. // we use `translate3d` to apply the position to the popper we
  35456. // automatically use the supported prefixed version if needed
  35457. var prefixedProperty = getSupportedPropertyName('transform');
  35458. // now, let's make a step back and look at this code closely (wtf?)
  35459. // If the content of the popper grows once it's been positioned, it
  35460. // may happen that the popper gets misplaced because of the new content
  35461. // overflowing its reference element
  35462. // To avoid this problem, we provide two options (x and y), which allow
  35463. // the consumer to define the offset origin.
  35464. // If we position a popper on top of a reference element, we can set
  35465. // `x` to `top` to make the popper grow towards its top instead of
  35466. // its bottom.
  35467. var left = void 0,
  35468. top = void 0;
  35469. if (sideA === 'bottom') {
  35470. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  35471. // and not the bottom of the html element
  35472. if (offsetParent.nodeName === 'HTML') {
  35473. top = -offsetParent.clientHeight + offsets.bottom;
  35474. } else {
  35475. top = -offsetParentRect.height + offsets.bottom;
  35476. }
  35477. } else {
  35478. top = offsets.top;
  35479. }
  35480. if (sideB === 'right') {
  35481. if (offsetParent.nodeName === 'HTML') {
  35482. left = -offsetParent.clientWidth + offsets.right;
  35483. } else {
  35484. left = -offsetParentRect.width + offsets.right;
  35485. }
  35486. } else {
  35487. left = offsets.left;
  35488. }
  35489. if (gpuAcceleration && prefixedProperty) {
  35490. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  35491. styles[sideA] = 0;
  35492. styles[sideB] = 0;
  35493. styles.willChange = 'transform';
  35494. } else {
  35495. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  35496. var invertTop = sideA === 'bottom' ? -1 : 1;
  35497. var invertLeft = sideB === 'right' ? -1 : 1;
  35498. styles[sideA] = top * invertTop;
  35499. styles[sideB] = left * invertLeft;
  35500. styles.willChange = sideA + ', ' + sideB;
  35501. }
  35502. // Attributes
  35503. var attributes = {
  35504. 'x-placement': data.placement
  35505. };
  35506. // Update `data` attributes, styles and arrowStyles
  35507. data.attributes = _extends({}, attributes, data.attributes);
  35508. data.styles = _extends({}, styles, data.styles);
  35509. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  35510. return data;
  35511. }
  35512. /**
  35513. * Helper used to know if the given modifier depends from another one.<br />
  35514. * It checks if the needed modifier is listed and enabled.
  35515. * @method
  35516. * @memberof Popper.Utils
  35517. * @param {Array} modifiers - list of modifiers
  35518. * @param {String} requestingName - name of requesting modifier
  35519. * @param {String} requestedName - name of requested modifier
  35520. * @returns {Boolean}
  35521. */
  35522. function isModifierRequired(modifiers, requestingName, requestedName) {
  35523. var requesting = find(modifiers, function (_ref) {
  35524. var name = _ref.name;
  35525. return name === requestingName;
  35526. });
  35527. var isRequired = !!requesting && modifiers.some(function (modifier) {
  35528. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  35529. });
  35530. if (!isRequired) {
  35531. var _requesting = '`' + requestingName + '`';
  35532. var requested = '`' + requestedName + '`';
  35533. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  35534. }
  35535. return isRequired;
  35536. }
  35537. /**
  35538. * @function
  35539. * @memberof Modifiers
  35540. * @argument {Object} data - The data object generated by update method
  35541. * @argument {Object} options - Modifiers configuration and options
  35542. * @returns {Object} The data object, properly modified
  35543. */
  35544. function arrow(data, options) {
  35545. var _data$offsets$arrow;
  35546. // arrow depends on keepTogether in order to work
  35547. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  35548. return data;
  35549. }
  35550. var arrowElement = options.element;
  35551. // if arrowElement is a string, suppose it's a CSS selector
  35552. if (typeof arrowElement === 'string') {
  35553. arrowElement = data.instance.popper.querySelector(arrowElement);
  35554. // if arrowElement is not found, don't run the modifier
  35555. if (!arrowElement) {
  35556. return data;
  35557. }
  35558. } else {
  35559. // if the arrowElement isn't a query selector we must check that the
  35560. // provided DOM node is child of its popper node
  35561. if (!data.instance.popper.contains(arrowElement)) {
  35562. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  35563. return data;
  35564. }
  35565. }
  35566. var placement = data.placement.split('-')[0];
  35567. var _data$offsets = data.offsets,
  35568. popper = _data$offsets.popper,
  35569. reference = _data$offsets.reference;
  35570. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  35571. var len = isVertical ? 'height' : 'width';
  35572. var sideCapitalized = isVertical ? 'Top' : 'Left';
  35573. var side = sideCapitalized.toLowerCase();
  35574. var altSide = isVertical ? 'left' : 'top';
  35575. var opSide = isVertical ? 'bottom' : 'right';
  35576. var arrowElementSize = getOuterSizes(arrowElement)[len];
  35577. //
  35578. // extends keepTogether behavior making sure the popper and its
  35579. // reference have enough pixels in conjunction
  35580. //
  35581. // top/left side
  35582. if (reference[opSide] - arrowElementSize < popper[side]) {
  35583. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  35584. }
  35585. // bottom/right side
  35586. if (reference[side] + arrowElementSize > popper[opSide]) {
  35587. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  35588. }
  35589. data.offsets.popper = getClientRect(data.offsets.popper);
  35590. // compute center of the popper
  35591. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  35592. // Compute the sideValue using the updated popper offsets
  35593. // take popper margin in account because we don't have this info available
  35594. var css = getStyleComputedProperty(data.instance.popper);
  35595. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  35596. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  35597. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  35598. // prevent arrowElement from being placed not contiguously to its popper
  35599. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  35600. data.arrowElement = arrowElement;
  35601. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  35602. return data;
  35603. }
  35604. /**
  35605. * Get the opposite placement variation of the given one
  35606. * @method
  35607. * @memberof Popper.Utils
  35608. * @argument {String} placement variation
  35609. * @returns {String} flipped placement variation
  35610. */
  35611. function getOppositeVariation(variation) {
  35612. if (variation === 'end') {
  35613. return 'start';
  35614. } else if (variation === 'start') {
  35615. return 'end';
  35616. }
  35617. return variation;
  35618. }
  35619. /**
  35620. * List of accepted placements to use as values of the `placement` option.<br />
  35621. * Valid placements are:
  35622. * - `auto`
  35623. * - `top`
  35624. * - `right`
  35625. * - `bottom`
  35626. * - `left`
  35627. *
  35628. * Each placement can have a variation from this list:
  35629. * - `-start`
  35630. * - `-end`
  35631. *
  35632. * Variations are interpreted easily if you think of them as the left to right
  35633. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  35634. * is right.<br />
  35635. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  35636. *
  35637. * Some valid examples are:
  35638. * - `top-end` (on top of reference, right aligned)
  35639. * - `right-start` (on right of reference, top aligned)
  35640. * - `bottom` (on bottom, centered)
  35641. * - `auto-end` (on the side with more space available, alignment depends by placement)
  35642. *
  35643. * @static
  35644. * @type {Array}
  35645. * @enum {String}
  35646. * @readonly
  35647. * @method placements
  35648. * @memberof Popper
  35649. */
  35650. 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'];
  35651. // Get rid of `auto` `auto-start` and `auto-end`
  35652. var validPlacements = placements.slice(3);
  35653. /**
  35654. * Given an initial placement, returns all the subsequent placements
  35655. * clockwise (or counter-clockwise).
  35656. *
  35657. * @method
  35658. * @memberof Popper.Utils
  35659. * @argument {String} placement - A valid placement (it accepts variations)
  35660. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  35661. * @returns {Array} placements including their variations
  35662. */
  35663. function clockwise(placement) {
  35664. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35665. var index = validPlacements.indexOf(placement);
  35666. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  35667. return counter ? arr.reverse() : arr;
  35668. }
  35669. var BEHAVIORS = {
  35670. FLIP: 'flip',
  35671. CLOCKWISE: 'clockwise',
  35672. COUNTERCLOCKWISE: 'counterclockwise'
  35673. };
  35674. /**
  35675. * @function
  35676. * @memberof Modifiers
  35677. * @argument {Object} data - The data object generated by update method
  35678. * @argument {Object} options - Modifiers configuration and options
  35679. * @returns {Object} The data object, properly modified
  35680. */
  35681. function flip(data, options) {
  35682. // if `inner` modifier is enabled, we can't use the `flip` modifier
  35683. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  35684. return data;
  35685. }
  35686. if (data.flipped && data.placement === data.originalPlacement) {
  35687. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  35688. return data;
  35689. }
  35690. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  35691. var placement = data.placement.split('-')[0];
  35692. var placementOpposite = getOppositePlacement(placement);
  35693. var variation = data.placement.split('-')[1] || '';
  35694. var flipOrder = [];
  35695. switch (options.behavior) {
  35696. case BEHAVIORS.FLIP:
  35697. flipOrder = [placement, placementOpposite];
  35698. break;
  35699. case BEHAVIORS.CLOCKWISE:
  35700. flipOrder = clockwise(placement);
  35701. break;
  35702. case BEHAVIORS.COUNTERCLOCKWISE:
  35703. flipOrder = clockwise(placement, true);
  35704. break;
  35705. default:
  35706. flipOrder = options.behavior;
  35707. }
  35708. flipOrder.forEach(function (step, index) {
  35709. if (placement !== step || flipOrder.length === index + 1) {
  35710. return data;
  35711. }
  35712. placement = data.placement.split('-')[0];
  35713. placementOpposite = getOppositePlacement(placement);
  35714. var popperOffsets = data.offsets.popper;
  35715. var refOffsets = data.offsets.reference;
  35716. // using floor because the reference offsets may contain decimals we are not going to consider here
  35717. var floor = Math.floor;
  35718. 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);
  35719. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  35720. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  35721. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  35722. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  35723. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  35724. // flip the variation if required
  35725. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35726. // flips variation if reference element overflows boundaries
  35727. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  35728. // flips variation if popper content overflows boundaries
  35729. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  35730. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  35731. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  35732. // this boolean to detect any flip loop
  35733. data.flipped = true;
  35734. if (overlapsRef || overflowsBoundaries) {
  35735. placement = flipOrder[index + 1];
  35736. }
  35737. if (flippedVariation) {
  35738. variation = getOppositeVariation(variation);
  35739. }
  35740. data.placement = placement + (variation ? '-' + variation : '');
  35741. // this object contains `position`, we want to preserve it along with
  35742. // any additional property we may add in the future
  35743. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  35744. data = runModifiers(data.instance.modifiers, data, 'flip');
  35745. }
  35746. });
  35747. return data;
  35748. }
  35749. /**
  35750. * @function
  35751. * @memberof Modifiers
  35752. * @argument {Object} data - The data object generated by update method
  35753. * @argument {Object} options - Modifiers configuration and options
  35754. * @returns {Object} The data object, properly modified
  35755. */
  35756. function keepTogether(data) {
  35757. var _data$offsets = data.offsets,
  35758. popper = _data$offsets.popper,
  35759. reference = _data$offsets.reference;
  35760. var placement = data.placement.split('-')[0];
  35761. var floor = Math.floor;
  35762. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35763. var side = isVertical ? 'right' : 'bottom';
  35764. var opSide = isVertical ? 'left' : 'top';
  35765. var measurement = isVertical ? 'width' : 'height';
  35766. if (popper[side] < floor(reference[opSide])) {
  35767. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  35768. }
  35769. if (popper[opSide] > floor(reference[side])) {
  35770. data.offsets.popper[opSide] = floor(reference[side]);
  35771. }
  35772. return data;
  35773. }
  35774. /**
  35775. * Converts a string containing value + unit into a px value number
  35776. * @function
  35777. * @memberof {modifiers~offset}
  35778. * @private
  35779. * @argument {String} str - Value + unit string
  35780. * @argument {String} measurement - `height` or `width`
  35781. * @argument {Object} popperOffsets
  35782. * @argument {Object} referenceOffsets
  35783. * @returns {Number|String}
  35784. * Value in pixels, or original string if no values were extracted
  35785. */
  35786. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  35787. // separate value from unit
  35788. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  35789. var value = +split[1];
  35790. var unit = split[2];
  35791. // If it's not a number it's an operator, I guess
  35792. if (!value) {
  35793. return str;
  35794. }
  35795. if (unit.indexOf('%') === 0) {
  35796. var element = void 0;
  35797. switch (unit) {
  35798. case '%p':
  35799. element = popperOffsets;
  35800. break;
  35801. case '%':
  35802. case '%r':
  35803. default:
  35804. element = referenceOffsets;
  35805. }
  35806. var rect = getClientRect(element);
  35807. return rect[measurement] / 100 * value;
  35808. } else if (unit === 'vh' || unit === 'vw') {
  35809. // if is a vh or vw, we calculate the size based on the viewport
  35810. var size = void 0;
  35811. if (unit === 'vh') {
  35812. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  35813. } else {
  35814. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  35815. }
  35816. return size / 100 * value;
  35817. } else {
  35818. // if is an explicit pixel unit, we get rid of the unit and keep the value
  35819. // if is an implicit unit, it's px, and we return just the value
  35820. return value;
  35821. }
  35822. }
  35823. /**
  35824. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  35825. * @function
  35826. * @memberof {modifiers~offset}
  35827. * @private
  35828. * @argument {String} offset
  35829. * @argument {Object} popperOffsets
  35830. * @argument {Object} referenceOffsets
  35831. * @argument {String} basePlacement
  35832. * @returns {Array} a two cells array with x and y offsets in numbers
  35833. */
  35834. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  35835. var offsets = [0, 0];
  35836. // Use height if placement is left or right and index is 0 otherwise use width
  35837. // in this way the first offset will use an axis and the second one
  35838. // will use the other one
  35839. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  35840. // Split the offset string to obtain a list of values and operands
  35841. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  35842. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  35843. return frag.trim();
  35844. });
  35845. // Detect if the offset string contains a pair of values or a single one
  35846. // they could be separated by comma or space
  35847. var divider = fragments.indexOf(find(fragments, function (frag) {
  35848. return frag.search(/,|\s/) !== -1;
  35849. }));
  35850. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  35851. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  35852. }
  35853. // If divider is found, we divide the list of values and operands to divide
  35854. // them by ofset X and Y.
  35855. var splitRegex = /\s*,\s*|\s+/;
  35856. 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];
  35857. // Convert the values with units to absolute pixels to allow our computations
  35858. ops = ops.map(function (op, index) {
  35859. // Most of the units rely on the orientation of the popper
  35860. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  35861. var mergeWithPrevious = false;
  35862. return op
  35863. // This aggregates any `+` or `-` sign that aren't considered operators
  35864. // e.g.: 10 + +5 => [10, +, +5]
  35865. .reduce(function (a, b) {
  35866. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  35867. a[a.length - 1] = b;
  35868. mergeWithPrevious = true;
  35869. return a;
  35870. } else if (mergeWithPrevious) {
  35871. a[a.length - 1] += b;
  35872. mergeWithPrevious = false;
  35873. return a;
  35874. } else {
  35875. return a.concat(b);
  35876. }
  35877. }, [])
  35878. // Here we convert the string values into number values (in px)
  35879. .map(function (str) {
  35880. return toValue(str, measurement, popperOffsets, referenceOffsets);
  35881. });
  35882. });
  35883. // Loop trough the offsets arrays and execute the operations
  35884. ops.forEach(function (op, index) {
  35885. op.forEach(function (frag, index2) {
  35886. if (isNumeric(frag)) {
  35887. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  35888. }
  35889. });
  35890. });
  35891. return offsets;
  35892. }
  35893. /**
  35894. * @function
  35895. * @memberof Modifiers
  35896. * @argument {Object} data - The data object generated by update method
  35897. * @argument {Object} options - Modifiers configuration and options
  35898. * @argument {Number|String} options.offset=0
  35899. * The offset value as described in the modifier description
  35900. * @returns {Object} The data object, properly modified
  35901. */
  35902. function offset(data, _ref) {
  35903. var offset = _ref.offset;
  35904. var placement = data.placement,
  35905. _data$offsets = data.offsets,
  35906. popper = _data$offsets.popper,
  35907. reference = _data$offsets.reference;
  35908. var basePlacement = placement.split('-')[0];
  35909. var offsets = void 0;
  35910. if (isNumeric(+offset)) {
  35911. offsets = [+offset, 0];
  35912. } else {
  35913. offsets = parseOffset(offset, popper, reference, basePlacement);
  35914. }
  35915. if (basePlacement === 'left') {
  35916. popper.top += offsets[0];
  35917. popper.left -= offsets[1];
  35918. } else if (basePlacement === 'right') {
  35919. popper.top += offsets[0];
  35920. popper.left += offsets[1];
  35921. } else if (basePlacement === 'top') {
  35922. popper.left += offsets[0];
  35923. popper.top -= offsets[1];
  35924. } else if (basePlacement === 'bottom') {
  35925. popper.left += offsets[0];
  35926. popper.top += offsets[1];
  35927. }
  35928. data.popper = popper;
  35929. return data;
  35930. }
  35931. /**
  35932. * @function
  35933. * @memberof Modifiers
  35934. * @argument {Object} data - The data object generated by `update` method
  35935. * @argument {Object} options - Modifiers configuration and options
  35936. * @returns {Object} The data object, properly modified
  35937. */
  35938. function preventOverflow(data, options) {
  35939. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  35940. // If offsetParent is the reference element, we really want to
  35941. // go one step up and use the next offsetParent as reference to
  35942. // avoid to make this modifier completely useless and look like broken
  35943. if (data.instance.reference === boundariesElement) {
  35944. boundariesElement = getOffsetParent(boundariesElement);
  35945. }
  35946. // NOTE: DOM access here
  35947. // resets the popper's position so that the document size can be calculated excluding
  35948. // the size of the popper element itself
  35949. var transformProp = getSupportedPropertyName('transform');
  35950. var popperStyles = data.instance.popper.style; // assignment to help minification
  35951. var top = popperStyles.top,
  35952. left = popperStyles.left,
  35953. transform = popperStyles[transformProp];
  35954. popperStyles.top = '';
  35955. popperStyles.left = '';
  35956. popperStyles[transformProp] = '';
  35957. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  35958. // NOTE: DOM access here
  35959. // restores the original style properties after the offsets have been computed
  35960. popperStyles.top = top;
  35961. popperStyles.left = left;
  35962. popperStyles[transformProp] = transform;
  35963. options.boundaries = boundaries;
  35964. var order = options.priority;
  35965. var popper = data.offsets.popper;
  35966. var check = {
  35967. primary: function primary(placement) {
  35968. var value = popper[placement];
  35969. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  35970. value = Math.max(popper[placement], boundaries[placement]);
  35971. }
  35972. return defineProperty({}, placement, value);
  35973. },
  35974. secondary: function secondary(placement) {
  35975. var mainSide = placement === 'right' ? 'left' : 'top';
  35976. var value = popper[mainSide];
  35977. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  35978. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  35979. }
  35980. return defineProperty({}, mainSide, value);
  35981. }
  35982. };
  35983. order.forEach(function (placement) {
  35984. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  35985. popper = _extends({}, popper, check[side](placement));
  35986. });
  35987. data.offsets.popper = popper;
  35988. return data;
  35989. }
  35990. /**
  35991. * @function
  35992. * @memberof Modifiers
  35993. * @argument {Object} data - The data object generated by `update` method
  35994. * @argument {Object} options - Modifiers configuration and options
  35995. * @returns {Object} The data object, properly modified
  35996. */
  35997. function shift(data) {
  35998. var placement = data.placement;
  35999. var basePlacement = placement.split('-')[0];
  36000. var shiftvariation = placement.split('-')[1];
  36001. // if shift shiftvariation is specified, run the modifier
  36002. if (shiftvariation) {
  36003. var _data$offsets = data.offsets,
  36004. reference = _data$offsets.reference,
  36005. popper = _data$offsets.popper;
  36006. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  36007. var side = isVertical ? 'left' : 'top';
  36008. var measurement = isVertical ? 'width' : 'height';
  36009. var shiftOffsets = {
  36010. start: defineProperty({}, side, reference[side]),
  36011. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  36012. };
  36013. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  36014. }
  36015. return data;
  36016. }
  36017. /**
  36018. * @function
  36019. * @memberof Modifiers
  36020. * @argument {Object} data - The data object generated by update method
  36021. * @argument {Object} options - Modifiers configuration and options
  36022. * @returns {Object} The data object, properly modified
  36023. */
  36024. function hide(data) {
  36025. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  36026. return data;
  36027. }
  36028. var refRect = data.offsets.reference;
  36029. var bound = find(data.instance.modifiers, function (modifier) {
  36030. return modifier.name === 'preventOverflow';
  36031. }).boundaries;
  36032. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  36033. // Avoid unnecessary DOM access if visibility hasn't changed
  36034. if (data.hide === true) {
  36035. return data;
  36036. }
  36037. data.hide = true;
  36038. data.attributes['x-out-of-boundaries'] = '';
  36039. } else {
  36040. // Avoid unnecessary DOM access if visibility hasn't changed
  36041. if (data.hide === false) {
  36042. return data;
  36043. }
  36044. data.hide = false;
  36045. data.attributes['x-out-of-boundaries'] = false;
  36046. }
  36047. return data;
  36048. }
  36049. /**
  36050. * @function
  36051. * @memberof Modifiers
  36052. * @argument {Object} data - The data object generated by `update` method
  36053. * @argument {Object} options - Modifiers configuration and options
  36054. * @returns {Object} The data object, properly modified
  36055. */
  36056. function inner(data) {
  36057. var placement = data.placement;
  36058. var basePlacement = placement.split('-')[0];
  36059. var _data$offsets = data.offsets,
  36060. popper = _data$offsets.popper,
  36061. reference = _data$offsets.reference;
  36062. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  36063. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  36064. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  36065. data.placement = getOppositePlacement(placement);
  36066. data.offsets.popper = getClientRect(popper);
  36067. return data;
  36068. }
  36069. /**
  36070. * Modifier function, each modifier can have a function of this type assigned
  36071. * to its `fn` property.<br />
  36072. * These functions will be called on each update, this means that you must
  36073. * make sure they are performant enough to avoid performance bottlenecks.
  36074. *
  36075. * @function ModifierFn
  36076. * @argument {dataObject} data - The data object generated by `update` method
  36077. * @argument {Object} options - Modifiers configuration and options
  36078. * @returns {dataObject} The data object, properly modified
  36079. */
  36080. /**
  36081. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  36082. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  36083. * needed by the library.
  36084. *
  36085. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  36086. * All the other properties are configurations that could be tweaked.
  36087. * @namespace modifiers
  36088. */
  36089. var modifiers = {
  36090. /**
  36091. * Modifier used to shift the popper on the start or end of its reference
  36092. * element.<br />
  36093. * It will read the variation of the `placement` property.<br />
  36094. * It can be one either `-end` or `-start`.
  36095. * @memberof modifiers
  36096. * @inner
  36097. */
  36098. shift: {
  36099. /** @prop {number} order=100 - Index used to define the order of execution */
  36100. order: 100,
  36101. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36102. enabled: true,
  36103. /** @prop {ModifierFn} */
  36104. fn: shift
  36105. },
  36106. /**
  36107. * The `offset` modifier can shift your popper on both its axis.
  36108. *
  36109. * It accepts the following units:
  36110. * - `px` or unit-less, interpreted as pixels
  36111. * - `%` or `%r`, percentage relative to the length of the reference element
  36112. * - `%p`, percentage relative to the length of the popper element
  36113. * - `vw`, CSS viewport width unit
  36114. * - `vh`, CSS viewport height unit
  36115. *
  36116. * For length is intended the main axis relative to the placement of the popper.<br />
  36117. * This means that if the placement is `top` or `bottom`, the length will be the
  36118. * `width`. In case of `left` or `right`, it will be the `height`.
  36119. *
  36120. * You can provide a single value (as `Number` or `String`), or a pair of values
  36121. * as `String` divided by a comma or one (or more) white spaces.<br />
  36122. * The latter is a deprecated method because it leads to confusion and will be
  36123. * removed in v2.<br />
  36124. * Additionally, it accepts additions and subtractions between different units.
  36125. * Note that multiplications and divisions aren't supported.
  36126. *
  36127. * Valid examples are:
  36128. * ```
  36129. * 10
  36130. * '10%'
  36131. * '10, 10'
  36132. * '10%, 10'
  36133. * '10 + 10%'
  36134. * '10 - 5vh + 3%'
  36135. * '-10px + 5vh, 5px - 6%'
  36136. * ```
  36137. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  36138. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  36139. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  36140. *
  36141. * @memberof modifiers
  36142. * @inner
  36143. */
  36144. offset: {
  36145. /** @prop {number} order=200 - Index used to define the order of execution */
  36146. order: 200,
  36147. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36148. enabled: true,
  36149. /** @prop {ModifierFn} */
  36150. fn: offset,
  36151. /** @prop {Number|String} offset=0
  36152. * The offset value as described in the modifier description
  36153. */
  36154. offset: 0
  36155. },
  36156. /**
  36157. * Modifier used to prevent the popper from being positioned outside the boundary.
  36158. *
  36159. * A scenario exists where the reference itself is not within the boundaries.<br />
  36160. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  36161. * In this case we need to decide whether the popper should either:
  36162. *
  36163. * - detach from the reference and remain "trapped" in the boundaries, or
  36164. * - if it should ignore the boundary and "escape with its reference"
  36165. *
  36166. * When `escapeWithReference` is set to`true` and reference is completely
  36167. * outside its boundaries, the popper will overflow (or completely leave)
  36168. * the boundaries in order to remain attached to the edge of the reference.
  36169. *
  36170. * @memberof modifiers
  36171. * @inner
  36172. */
  36173. preventOverflow: {
  36174. /** @prop {number} order=300 - Index used to define the order of execution */
  36175. order: 300,
  36176. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36177. enabled: true,
  36178. /** @prop {ModifierFn} */
  36179. fn: preventOverflow,
  36180. /**
  36181. * @prop {Array} [priority=['left','right','top','bottom']]
  36182. * Popper will try to prevent overflow following these priorities by default,
  36183. * then, it could overflow on the left and on top of the `boundariesElement`
  36184. */
  36185. priority: ['left', 'right', 'top', 'bottom'],
  36186. /**
  36187. * @prop {number} padding=5
  36188. * Amount of pixel used to define a minimum distance between the boundaries
  36189. * and the popper. This makes sure the popper always has a little padding
  36190. * between the edges of its container
  36191. */
  36192. padding: 5,
  36193. /**
  36194. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  36195. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  36196. * `viewport` or any DOM element.
  36197. */
  36198. boundariesElement: 'scrollParent'
  36199. },
  36200. /**
  36201. * Modifier used to make sure the reference and its popper stay near each other
  36202. * without leaving any gap between the two. Especially useful when the arrow is
  36203. * enabled and you want to ensure that it points to its reference element.
  36204. * It cares only about the first axis. You can still have poppers with margin
  36205. * between the popper and its reference element.
  36206. * @memberof modifiers
  36207. * @inner
  36208. */
  36209. keepTogether: {
  36210. /** @prop {number} order=400 - Index used to define the order of execution */
  36211. order: 400,
  36212. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36213. enabled: true,
  36214. /** @prop {ModifierFn} */
  36215. fn: keepTogether
  36216. },
  36217. /**
  36218. * This modifier is used to move the `arrowElement` of the popper to make
  36219. * sure it is positioned between the reference element and its popper element.
  36220. * It will read the outer size of the `arrowElement` node to detect how many
  36221. * pixels of conjunction are needed.
  36222. *
  36223. * It has no effect if no `arrowElement` is provided.
  36224. * @memberof modifiers
  36225. * @inner
  36226. */
  36227. arrow: {
  36228. /** @prop {number} order=500 - Index used to define the order of execution */
  36229. order: 500,
  36230. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36231. enabled: true,
  36232. /** @prop {ModifierFn} */
  36233. fn: arrow,
  36234. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  36235. element: '[x-arrow]'
  36236. },
  36237. /**
  36238. * Modifier used to flip the popper's placement when it starts to overlap its
  36239. * reference element.
  36240. *
  36241. * Requires the `preventOverflow` modifier before it in order to work.
  36242. *
  36243. * **NOTE:** this modifier will interrupt the current update cycle and will
  36244. * restart it if it detects the need to flip the placement.
  36245. * @memberof modifiers
  36246. * @inner
  36247. */
  36248. flip: {
  36249. /** @prop {number} order=600 - Index used to define the order of execution */
  36250. order: 600,
  36251. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36252. enabled: true,
  36253. /** @prop {ModifierFn} */
  36254. fn: flip,
  36255. /**
  36256. * @prop {String|Array} behavior='flip'
  36257. * The behavior used to change the popper's placement. It can be one of
  36258. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  36259. * placements (with optional variations)
  36260. */
  36261. behavior: 'flip',
  36262. /**
  36263. * @prop {number} padding=5
  36264. * The popper will flip if it hits the edges of the `boundariesElement`
  36265. */
  36266. padding: 5,
  36267. /**
  36268. * @prop {String|HTMLElement} boundariesElement='viewport'
  36269. * The element which will define the boundaries of the popper position.
  36270. * The popper will never be placed outside of the defined boundaries
  36271. * (except if `keepTogether` is enabled)
  36272. */
  36273. boundariesElement: 'viewport',
  36274. /**
  36275. * @prop {Boolean} flipVariations=false
  36276. * The popper will switch placement variation between `-start` and `-end` when
  36277. * the reference element overlaps its boundaries.
  36278. *
  36279. * The original placement should have a set variation.
  36280. */
  36281. flipVariations: false,
  36282. /**
  36283. * @prop {Boolean} flipVariationsByContent=false
  36284. * The popper will switch placement variation between `-start` and `-end` when
  36285. * the popper element overlaps its reference boundaries.
  36286. *
  36287. * The original placement should have a set variation.
  36288. */
  36289. flipVariationsByContent: false
  36290. },
  36291. /**
  36292. * Modifier used to make the popper flow toward the inner of the reference element.
  36293. * By default, when this modifier is disabled, the popper will be placed outside
  36294. * the reference element.
  36295. * @memberof modifiers
  36296. * @inner
  36297. */
  36298. inner: {
  36299. /** @prop {number} order=700 - Index used to define the order of execution */
  36300. order: 700,
  36301. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  36302. enabled: false,
  36303. /** @prop {ModifierFn} */
  36304. fn: inner
  36305. },
  36306. /**
  36307. * Modifier used to hide the popper when its reference element is outside of the
  36308. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  36309. * be used to hide with a CSS selector the popper when its reference is
  36310. * out of boundaries.
  36311. *
  36312. * Requires the `preventOverflow` modifier before it in order to work.
  36313. * @memberof modifiers
  36314. * @inner
  36315. */
  36316. hide: {
  36317. /** @prop {number} order=800 - Index used to define the order of execution */
  36318. order: 800,
  36319. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36320. enabled: true,
  36321. /** @prop {ModifierFn} */
  36322. fn: hide
  36323. },
  36324. /**
  36325. * Computes the style that will be applied to the popper element to gets
  36326. * properly positioned.
  36327. *
  36328. * Note that this modifier will not touch the DOM, it just prepares the styles
  36329. * so that `applyStyle` modifier can apply it. This separation is useful
  36330. * in case you need to replace `applyStyle` with a custom implementation.
  36331. *
  36332. * This modifier has `850` as `order` value to maintain backward compatibility
  36333. * with previous versions of Popper.js. Expect the modifiers ordering method
  36334. * to change in future major versions of the library.
  36335. *
  36336. * @memberof modifiers
  36337. * @inner
  36338. */
  36339. computeStyle: {
  36340. /** @prop {number} order=850 - Index used to define the order of execution */
  36341. order: 850,
  36342. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36343. enabled: true,
  36344. /** @prop {ModifierFn} */
  36345. fn: computeStyle,
  36346. /**
  36347. * @prop {Boolean} gpuAcceleration=true
  36348. * If true, it uses the CSS 3D transformation to position the popper.
  36349. * Otherwise, it will use the `top` and `left` properties
  36350. */
  36351. gpuAcceleration: true,
  36352. /**
  36353. * @prop {string} [x='bottom']
  36354. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  36355. * Change this if your popper should grow in a direction different from `bottom`
  36356. */
  36357. x: 'bottom',
  36358. /**
  36359. * @prop {string} [x='left']
  36360. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  36361. * Change this if your popper should grow in a direction different from `right`
  36362. */
  36363. y: 'right'
  36364. },
  36365. /**
  36366. * Applies the computed styles to the popper element.
  36367. *
  36368. * All the DOM manipulations are limited to this modifier. This is useful in case
  36369. * you want to integrate Popper.js inside a framework or view library and you
  36370. * want to delegate all the DOM manipulations to it.
  36371. *
  36372. * Note that if you disable this modifier, you must make sure the popper element
  36373. * has its position set to `absolute` before Popper.js can do its work!
  36374. *
  36375. * Just disable this modifier and define your own to achieve the desired effect.
  36376. *
  36377. * @memberof modifiers
  36378. * @inner
  36379. */
  36380. applyStyle: {
  36381. /** @prop {number} order=900 - Index used to define the order of execution */
  36382. order: 900,
  36383. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36384. enabled: true,
  36385. /** @prop {ModifierFn} */
  36386. fn: applyStyle,
  36387. /** @prop {Function} */
  36388. onLoad: applyStyleOnLoad,
  36389. /**
  36390. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  36391. * @prop {Boolean} gpuAcceleration=true
  36392. * If true, it uses the CSS 3D transformation to position the popper.
  36393. * Otherwise, it will use the `top` and `left` properties
  36394. */
  36395. gpuAcceleration: undefined
  36396. }
  36397. };
  36398. /**
  36399. * The `dataObject` is an object containing all the information used by Popper.js.
  36400. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  36401. * @name dataObject
  36402. * @property {Object} data.instance The Popper.js instance
  36403. * @property {String} data.placement Placement applied to popper
  36404. * @property {String} data.originalPlacement Placement originally defined on init
  36405. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  36406. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  36407. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  36408. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36409. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36410. * @property {Object} data.boundaries Offsets of the popper boundaries
  36411. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  36412. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  36413. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  36414. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  36415. */
  36416. /**
  36417. * Default options provided to Popper.js constructor.<br />
  36418. * These can be overridden using the `options` argument of Popper.js.<br />
  36419. * To override an option, simply pass an object with the same
  36420. * structure of the `options` object, as the 3rd argument. For example:
  36421. * ```
  36422. * new Popper(ref, pop, {
  36423. * modifiers: {
  36424. * preventOverflow: { enabled: false }
  36425. * }
  36426. * })
  36427. * ```
  36428. * @type {Object}
  36429. * @static
  36430. * @memberof Popper
  36431. */
  36432. var Defaults = {
  36433. /**
  36434. * Popper's placement.
  36435. * @prop {Popper.placements} placement='bottom'
  36436. */
  36437. placement: 'bottom',
  36438. /**
  36439. * Set this to true if you want popper to position it self in 'fixed' mode
  36440. * @prop {Boolean} positionFixed=false
  36441. */
  36442. positionFixed: false,
  36443. /**
  36444. * Whether events (resize, scroll) are initially enabled.
  36445. * @prop {Boolean} eventsEnabled=true
  36446. */
  36447. eventsEnabled: true,
  36448. /**
  36449. * Set to true if you want to automatically remove the popper when
  36450. * you call the `destroy` method.
  36451. * @prop {Boolean} removeOnDestroy=false
  36452. */
  36453. removeOnDestroy: false,
  36454. /**
  36455. * Callback called when the popper is created.<br />
  36456. * By default, it is set to no-op.<br />
  36457. * Access Popper.js instance with `data.instance`.
  36458. * @prop {onCreate}
  36459. */
  36460. onCreate: function onCreate() {},
  36461. /**
  36462. * Callback called when the popper is updated. This callback is not called
  36463. * on the initialization/creation of the popper, but only on subsequent
  36464. * updates.<br />
  36465. * By default, it is set to no-op.<br />
  36466. * Access Popper.js instance with `data.instance`.
  36467. * @prop {onUpdate}
  36468. */
  36469. onUpdate: function onUpdate() {},
  36470. /**
  36471. * List of modifiers used to modify the offsets before they are applied to the popper.
  36472. * They provide most of the functionalities of Popper.js.
  36473. * @prop {modifiers}
  36474. */
  36475. modifiers: modifiers
  36476. };
  36477. /**
  36478. * @callback onCreate
  36479. * @param {dataObject} data
  36480. */
  36481. /**
  36482. * @callback onUpdate
  36483. * @param {dataObject} data
  36484. */
  36485. // Utils
  36486. // Methods
  36487. var Popper = function () {
  36488. /**
  36489. * Creates a new Popper.js instance.
  36490. * @class Popper
  36491. * @param {Element|referenceObject} reference - The reference element used to position the popper
  36492. * @param {Element} popper - The HTML / XML element used as the popper
  36493. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  36494. * @return {Object} instance - The generated Popper.js instance
  36495. */
  36496. function Popper(reference, popper) {
  36497. var _this = this;
  36498. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  36499. classCallCheck(this, Popper);
  36500. this.scheduleUpdate = function () {
  36501. return requestAnimationFrame(_this.update);
  36502. };
  36503. // make update() debounced, so that it only runs at most once-per-tick
  36504. this.update = debounce(this.update.bind(this));
  36505. // with {} we create a new object with the options inside it
  36506. this.options = _extends({}, Popper.Defaults, options);
  36507. // init state
  36508. this.state = {
  36509. isDestroyed: false,
  36510. isCreated: false,
  36511. scrollParents: []
  36512. };
  36513. // get reference and popper elements (allow jQuery wrappers)
  36514. this.reference = reference && reference.jquery ? reference[0] : reference;
  36515. this.popper = popper && popper.jquery ? popper[0] : popper;
  36516. // Deep merge modifiers options
  36517. this.options.modifiers = {};
  36518. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  36519. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  36520. });
  36521. // Refactoring modifiers' list (Object => Array)
  36522. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  36523. return _extends({
  36524. name: name
  36525. }, _this.options.modifiers[name]);
  36526. })
  36527. // sort the modifiers by order
  36528. .sort(function (a, b) {
  36529. return a.order - b.order;
  36530. });
  36531. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  36532. // such code is executed in the same order of its modifier
  36533. // they could add new properties to their options configuration
  36534. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  36535. this.modifiers.forEach(function (modifierOptions) {
  36536. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  36537. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  36538. }
  36539. });
  36540. // fire the first update to position the popper in the right place
  36541. this.update();
  36542. var eventsEnabled = this.options.eventsEnabled;
  36543. if (eventsEnabled) {
  36544. // setup event listeners, they will take care of update the position in specific situations
  36545. this.enableEventListeners();
  36546. }
  36547. this.state.eventsEnabled = eventsEnabled;
  36548. }
  36549. // We can't use class properties because they don't get listed in the
  36550. // class prototype and break stuff like Sinon stubs
  36551. createClass(Popper, [{
  36552. key: 'update',
  36553. value: function update$$1() {
  36554. return update.call(this);
  36555. }
  36556. }, {
  36557. key: 'destroy',
  36558. value: function destroy$$1() {
  36559. return destroy.call(this);
  36560. }
  36561. }, {
  36562. key: 'enableEventListeners',
  36563. value: function enableEventListeners$$1() {
  36564. return enableEventListeners.call(this);
  36565. }
  36566. }, {
  36567. key: 'disableEventListeners',
  36568. value: function disableEventListeners$$1() {
  36569. return disableEventListeners.call(this);
  36570. }
  36571. /**
  36572. * Schedules an update. It will run on the next UI update available.
  36573. * @method scheduleUpdate
  36574. * @memberof Popper
  36575. */
  36576. /**
  36577. * Collection of utilities useful when writing custom modifiers.
  36578. * Starting from version 1.7, this method is available only if you
  36579. * include `popper-utils.js` before `popper.js`.
  36580. *
  36581. * **DEPRECATION**: This way to access PopperUtils is deprecated
  36582. * and will be removed in v2! Use the PopperUtils module directly instead.
  36583. * Due to the high instability of the methods contained in Utils, we can't
  36584. * guarantee them to follow semver. Use them at your own risk!
  36585. * @static
  36586. * @private
  36587. * @type {Object}
  36588. * @deprecated since version 1.8
  36589. * @member Utils
  36590. * @memberof Popper
  36591. */
  36592. }]);
  36593. return Popper;
  36594. }();
  36595. /**
  36596. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  36597. * and lets you use it as replacement of a real DOM node.<br />
  36598. * You can use this method to position a popper relatively to a set of coordinates
  36599. * in case you don't have a DOM node to use as reference.
  36600. *
  36601. * ```
  36602. * new Popper(referenceObject, popperNode);
  36603. * ```
  36604. *
  36605. * NB: This feature isn't supported in Internet Explorer 10.
  36606. * @name referenceObject
  36607. * @property {Function} data.getBoundingClientRect
  36608. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  36609. * @property {number} data.clientWidth
  36610. * An ES6 getter that will return the width of the virtual reference element.
  36611. * @property {number} data.clientHeight
  36612. * An ES6 getter that will return the height of the virtual reference element.
  36613. */
  36614. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  36615. Popper.placements = placements;
  36616. Popper.Defaults = Defaults;
  36617. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  36618. //# sourceMappingURL=popper.js.map
  36619. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  36620. /***/ }),
  36621. /***/ "./node_modules/process/browser.js":
  36622. /*!*****************************************!*\
  36623. !*** ./node_modules/process/browser.js ***!
  36624. \*****************************************/
  36625. /*! no static exports found */
  36626. /***/ (function(module, exports) {
  36627. // shim for using process in browser
  36628. var process = module.exports = {};
  36629. // cached from whatever global is present so that test runners that stub it
  36630. // don't break things. But we need to wrap it in a try catch in case it is
  36631. // wrapped in strict mode code which doesn't define any globals. It's inside a
  36632. // function because try/catches deoptimize in certain engines.
  36633. var cachedSetTimeout;
  36634. var cachedClearTimeout;
  36635. function defaultSetTimout() {
  36636. throw new Error('setTimeout has not been defined');
  36637. }
  36638. function defaultClearTimeout () {
  36639. throw new Error('clearTimeout has not been defined');
  36640. }
  36641. (function () {
  36642. try {
  36643. if (typeof setTimeout === 'function') {
  36644. cachedSetTimeout = setTimeout;
  36645. } else {
  36646. cachedSetTimeout = defaultSetTimout;
  36647. }
  36648. } catch (e) {
  36649. cachedSetTimeout = defaultSetTimout;
  36650. }
  36651. try {
  36652. if (typeof clearTimeout === 'function') {
  36653. cachedClearTimeout = clearTimeout;
  36654. } else {
  36655. cachedClearTimeout = defaultClearTimeout;
  36656. }
  36657. } catch (e) {
  36658. cachedClearTimeout = defaultClearTimeout;
  36659. }
  36660. } ())
  36661. function runTimeout(fun) {
  36662. if (cachedSetTimeout === setTimeout) {
  36663. //normal enviroments in sane situations
  36664. return setTimeout(fun, 0);
  36665. }
  36666. // if setTimeout wasn't available but was latter defined
  36667. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  36668. cachedSetTimeout = setTimeout;
  36669. return setTimeout(fun, 0);
  36670. }
  36671. try {
  36672. // when when somebody has screwed with setTimeout but no I.E. maddness
  36673. return cachedSetTimeout(fun, 0);
  36674. } catch(e){
  36675. try {
  36676. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36677. return cachedSetTimeout.call(null, fun, 0);
  36678. } catch(e){
  36679. // 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
  36680. return cachedSetTimeout.call(this, fun, 0);
  36681. }
  36682. }
  36683. }
  36684. function runClearTimeout(marker) {
  36685. if (cachedClearTimeout === clearTimeout) {
  36686. //normal enviroments in sane situations
  36687. return clearTimeout(marker);
  36688. }
  36689. // if clearTimeout wasn't available but was latter defined
  36690. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  36691. cachedClearTimeout = clearTimeout;
  36692. return clearTimeout(marker);
  36693. }
  36694. try {
  36695. // when when somebody has screwed with setTimeout but no I.E. maddness
  36696. return cachedClearTimeout(marker);
  36697. } catch (e){
  36698. try {
  36699. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36700. return cachedClearTimeout.call(null, marker);
  36701. } catch (e){
  36702. // 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.
  36703. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  36704. return cachedClearTimeout.call(this, marker);
  36705. }
  36706. }
  36707. }
  36708. var queue = [];
  36709. var draining = false;
  36710. var currentQueue;
  36711. var queueIndex = -1;
  36712. function cleanUpNextTick() {
  36713. if (!draining || !currentQueue) {
  36714. return;
  36715. }
  36716. draining = false;
  36717. if (currentQueue.length) {
  36718. queue = currentQueue.concat(queue);
  36719. } else {
  36720. queueIndex = -1;
  36721. }
  36722. if (queue.length) {
  36723. drainQueue();
  36724. }
  36725. }
  36726. function drainQueue() {
  36727. if (draining) {
  36728. return;
  36729. }
  36730. var timeout = runTimeout(cleanUpNextTick);
  36731. draining = true;
  36732. var len = queue.length;
  36733. while(len) {
  36734. currentQueue = queue;
  36735. queue = [];
  36736. while (++queueIndex < len) {
  36737. if (currentQueue) {
  36738. currentQueue[queueIndex].run();
  36739. }
  36740. }
  36741. queueIndex = -1;
  36742. len = queue.length;
  36743. }
  36744. currentQueue = null;
  36745. draining = false;
  36746. runClearTimeout(timeout);
  36747. }
  36748. process.nextTick = function (fun) {
  36749. var args = new Array(arguments.length - 1);
  36750. if (arguments.length > 1) {
  36751. for (var i = 1; i < arguments.length; i++) {
  36752. args[i - 1] = arguments[i];
  36753. }
  36754. }
  36755. queue.push(new Item(fun, args));
  36756. if (queue.length === 1 && !draining) {
  36757. runTimeout(drainQueue);
  36758. }
  36759. };
  36760. // v8 likes predictible objects
  36761. function Item(fun, array) {
  36762. this.fun = fun;
  36763. this.array = array;
  36764. }
  36765. Item.prototype.run = function () {
  36766. this.fun.apply(null, this.array);
  36767. };
  36768. process.title = 'browser';
  36769. process.browser = true;
  36770. process.env = {};
  36771. process.argv = [];
  36772. process.version = ''; // empty string to avoid regexp issues
  36773. process.versions = {};
  36774. function noop() {}
  36775. process.on = noop;
  36776. process.addListener = noop;
  36777. process.once = noop;
  36778. process.off = noop;
  36779. process.removeListener = noop;
  36780. process.removeAllListeners = noop;
  36781. process.emit = noop;
  36782. process.prependListener = noop;
  36783. process.prependOnceListener = noop;
  36784. process.listeners = function (name) { return [] }
  36785. process.binding = function (name) {
  36786. throw new Error('process.binding is not supported');
  36787. };
  36788. process.cwd = function () { return '/' };
  36789. process.chdir = function (dir) {
  36790. throw new Error('process.chdir is not supported');
  36791. };
  36792. process.umask = function() { return 0; };
  36793. /***/ }),
  36794. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  36795. /*!***************************************************!*\
  36796. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  36797. \***************************************************/
  36798. /*! no static exports found */
  36799. /***/ (function(module, exports, __webpack_require__) {
  36800. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  36801. * Pusher JavaScript Library v5.0.3
  36802. * https://pusher.com/
  36803. *
  36804. * Copyright 2017, Pusher
  36805. * Released under the MIT licence.
  36806. */
  36807. (function webpackUniversalModuleDefinition(root, factory) {
  36808. if(true)
  36809. module.exports = factory();
  36810. else {}
  36811. })(window, function() {
  36812. return /******/ (function(modules) { // webpackBootstrap
  36813. /******/ // The module cache
  36814. /******/ var installedModules = {};
  36815. /******/
  36816. /******/ // The require function
  36817. /******/ function __webpack_require__(moduleId) {
  36818. /******/
  36819. /******/ // Check if module is in cache
  36820. /******/ if(installedModules[moduleId]) {
  36821. /******/ return installedModules[moduleId].exports;
  36822. /******/ }
  36823. /******/ // Create a new module (and put it into the cache)
  36824. /******/ var module = installedModules[moduleId] = {
  36825. /******/ i: moduleId,
  36826. /******/ l: false,
  36827. /******/ exports: {}
  36828. /******/ };
  36829. /******/
  36830. /******/ // Execute the module function
  36831. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  36832. /******/
  36833. /******/ // Flag the module as loaded
  36834. /******/ module.l = true;
  36835. /******/
  36836. /******/ // Return the exports of the module
  36837. /******/ return module.exports;
  36838. /******/ }
  36839. /******/
  36840. /******/
  36841. /******/ // expose the modules object (__webpack_modules__)
  36842. /******/ __webpack_require__.m = modules;
  36843. /******/
  36844. /******/ // expose the module cache
  36845. /******/ __webpack_require__.c = installedModules;
  36846. /******/
  36847. /******/ // define getter function for harmony exports
  36848. /******/ __webpack_require__.d = function(exports, name, getter) {
  36849. /******/ if(!__webpack_require__.o(exports, name)) {
  36850. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  36851. /******/ }
  36852. /******/ };
  36853. /******/
  36854. /******/ // define __esModule on exports
  36855. /******/ __webpack_require__.r = function(exports) {
  36856. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  36857. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  36858. /******/ }
  36859. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  36860. /******/ };
  36861. /******/
  36862. /******/ // create a fake namespace object
  36863. /******/ // mode & 1: value is a module id, require it
  36864. /******/ // mode & 2: merge all properties of value into the ns
  36865. /******/ // mode & 4: return value when already ns object
  36866. /******/ // mode & 8|1: behave like require
  36867. /******/ __webpack_require__.t = function(value, mode) {
  36868. /******/ if(mode & 1) value = __webpack_require__(value);
  36869. /******/ if(mode & 8) return value;
  36870. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  36871. /******/ var ns = Object.create(null);
  36872. /******/ __webpack_require__.r(ns);
  36873. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  36874. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  36875. /******/ return ns;
  36876. /******/ };
  36877. /******/
  36878. /******/ // getDefaultExport function for compatibility with non-harmony modules
  36879. /******/ __webpack_require__.n = function(module) {
  36880. /******/ var getter = module && module.__esModule ?
  36881. /******/ function getDefault() { return module['default']; } :
  36882. /******/ function getModuleExports() { return module; };
  36883. /******/ __webpack_require__.d(getter, 'a', getter);
  36884. /******/ return getter;
  36885. /******/ };
  36886. /******/
  36887. /******/ // Object.prototype.hasOwnProperty.call
  36888. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  36889. /******/
  36890. /******/ // __webpack_public_path__
  36891. /******/ __webpack_require__.p = "";
  36892. /******/
  36893. /******/
  36894. /******/ // Load entry module and return exports
  36895. /******/ return __webpack_require__(__webpack_require__.s = 2);
  36896. /******/ })
  36897. /************************************************************************/
  36898. /******/ ([
  36899. /* 0 */
  36900. /***/ (function(module, exports, __webpack_require__) {
  36901. (function(nacl) {
  36902. 'use strict';
  36903. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  36904. // Public domain.
  36905. //
  36906. // Implementation derived from TweetNaCl version 20140427.
  36907. // See for details: http://tweetnacl.cr.yp.to/
  36908. var gf = function(init) {
  36909. var i, r = new Float64Array(16);
  36910. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  36911. return r;
  36912. };
  36913. // Pluggable, initialized in high-level API below.
  36914. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  36915. var _0 = new Uint8Array(16);
  36916. var _9 = new Uint8Array(32); _9[0] = 9;
  36917. var gf0 = gf(),
  36918. gf1 = gf([1]),
  36919. _121665 = gf([0xdb41, 1]),
  36920. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  36921. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  36922. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  36923. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  36924. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  36925. function ts64(x, i, h, l) {
  36926. x[i] = (h >> 24) & 0xff;
  36927. x[i+1] = (h >> 16) & 0xff;
  36928. x[i+2] = (h >> 8) & 0xff;
  36929. x[i+3] = h & 0xff;
  36930. x[i+4] = (l >> 24) & 0xff;
  36931. x[i+5] = (l >> 16) & 0xff;
  36932. x[i+6] = (l >> 8) & 0xff;
  36933. x[i+7] = l & 0xff;
  36934. }
  36935. function vn(x, xi, y, yi, n) {
  36936. var i,d = 0;
  36937. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  36938. return (1 & ((d - 1) >>> 8)) - 1;
  36939. }
  36940. function crypto_verify_16(x, xi, y, yi) {
  36941. return vn(x,xi,y,yi,16);
  36942. }
  36943. function crypto_verify_32(x, xi, y, yi) {
  36944. return vn(x,xi,y,yi,32);
  36945. }
  36946. function core_salsa20(o, p, k, c) {
  36947. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  36948. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  36949. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  36950. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  36951. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  36952. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  36953. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  36954. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  36955. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  36956. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  36957. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  36958. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  36959. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  36960. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  36961. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  36962. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  36963. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  36964. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  36965. x15 = j15, u;
  36966. for (var i = 0; i < 20; i += 2) {
  36967. u = x0 + x12 | 0;
  36968. x4 ^= u<<7 | u>>>(32-7);
  36969. u = x4 + x0 | 0;
  36970. x8 ^= u<<9 | u>>>(32-9);
  36971. u = x8 + x4 | 0;
  36972. x12 ^= u<<13 | u>>>(32-13);
  36973. u = x12 + x8 | 0;
  36974. x0 ^= u<<18 | u>>>(32-18);
  36975. u = x5 + x1 | 0;
  36976. x9 ^= u<<7 | u>>>(32-7);
  36977. u = x9 + x5 | 0;
  36978. x13 ^= u<<9 | u>>>(32-9);
  36979. u = x13 + x9 | 0;
  36980. x1 ^= u<<13 | u>>>(32-13);
  36981. u = x1 + x13 | 0;
  36982. x5 ^= u<<18 | u>>>(32-18);
  36983. u = x10 + x6 | 0;
  36984. x14 ^= u<<7 | u>>>(32-7);
  36985. u = x14 + x10 | 0;
  36986. x2 ^= u<<9 | u>>>(32-9);
  36987. u = x2 + x14 | 0;
  36988. x6 ^= u<<13 | u>>>(32-13);
  36989. u = x6 + x2 | 0;
  36990. x10 ^= u<<18 | u>>>(32-18);
  36991. u = x15 + x11 | 0;
  36992. x3 ^= u<<7 | u>>>(32-7);
  36993. u = x3 + x15 | 0;
  36994. x7 ^= u<<9 | u>>>(32-9);
  36995. u = x7 + x3 | 0;
  36996. x11 ^= u<<13 | u>>>(32-13);
  36997. u = x11 + x7 | 0;
  36998. x15 ^= u<<18 | u>>>(32-18);
  36999. u = x0 + x3 | 0;
  37000. x1 ^= u<<7 | u>>>(32-7);
  37001. u = x1 + x0 | 0;
  37002. x2 ^= u<<9 | u>>>(32-9);
  37003. u = x2 + x1 | 0;
  37004. x3 ^= u<<13 | u>>>(32-13);
  37005. u = x3 + x2 | 0;
  37006. x0 ^= u<<18 | u>>>(32-18);
  37007. u = x5 + x4 | 0;
  37008. x6 ^= u<<7 | u>>>(32-7);
  37009. u = x6 + x5 | 0;
  37010. x7 ^= u<<9 | u>>>(32-9);
  37011. u = x7 + x6 | 0;
  37012. x4 ^= u<<13 | u>>>(32-13);
  37013. u = x4 + x7 | 0;
  37014. x5 ^= u<<18 | u>>>(32-18);
  37015. u = x10 + x9 | 0;
  37016. x11 ^= u<<7 | u>>>(32-7);
  37017. u = x11 + x10 | 0;
  37018. x8 ^= u<<9 | u>>>(32-9);
  37019. u = x8 + x11 | 0;
  37020. x9 ^= u<<13 | u>>>(32-13);
  37021. u = x9 + x8 | 0;
  37022. x10 ^= u<<18 | u>>>(32-18);
  37023. u = x15 + x14 | 0;
  37024. x12 ^= u<<7 | u>>>(32-7);
  37025. u = x12 + x15 | 0;
  37026. x13 ^= u<<9 | u>>>(32-9);
  37027. u = x13 + x12 | 0;
  37028. x14 ^= u<<13 | u>>>(32-13);
  37029. u = x14 + x13 | 0;
  37030. x15 ^= u<<18 | u>>>(32-18);
  37031. }
  37032. x0 = x0 + j0 | 0;
  37033. x1 = x1 + j1 | 0;
  37034. x2 = x2 + j2 | 0;
  37035. x3 = x3 + j3 | 0;
  37036. x4 = x4 + j4 | 0;
  37037. x5 = x5 + j5 | 0;
  37038. x6 = x6 + j6 | 0;
  37039. x7 = x7 + j7 | 0;
  37040. x8 = x8 + j8 | 0;
  37041. x9 = x9 + j9 | 0;
  37042. x10 = x10 + j10 | 0;
  37043. x11 = x11 + j11 | 0;
  37044. x12 = x12 + j12 | 0;
  37045. x13 = x13 + j13 | 0;
  37046. x14 = x14 + j14 | 0;
  37047. x15 = x15 + j15 | 0;
  37048. o[ 0] = x0 >>> 0 & 0xff;
  37049. o[ 1] = x0 >>> 8 & 0xff;
  37050. o[ 2] = x0 >>> 16 & 0xff;
  37051. o[ 3] = x0 >>> 24 & 0xff;
  37052. o[ 4] = x1 >>> 0 & 0xff;
  37053. o[ 5] = x1 >>> 8 & 0xff;
  37054. o[ 6] = x1 >>> 16 & 0xff;
  37055. o[ 7] = x1 >>> 24 & 0xff;
  37056. o[ 8] = x2 >>> 0 & 0xff;
  37057. o[ 9] = x2 >>> 8 & 0xff;
  37058. o[10] = x2 >>> 16 & 0xff;
  37059. o[11] = x2 >>> 24 & 0xff;
  37060. o[12] = x3 >>> 0 & 0xff;
  37061. o[13] = x3 >>> 8 & 0xff;
  37062. o[14] = x3 >>> 16 & 0xff;
  37063. o[15] = x3 >>> 24 & 0xff;
  37064. o[16] = x4 >>> 0 & 0xff;
  37065. o[17] = x4 >>> 8 & 0xff;
  37066. o[18] = x4 >>> 16 & 0xff;
  37067. o[19] = x4 >>> 24 & 0xff;
  37068. o[20] = x5 >>> 0 & 0xff;
  37069. o[21] = x5 >>> 8 & 0xff;
  37070. o[22] = x5 >>> 16 & 0xff;
  37071. o[23] = x5 >>> 24 & 0xff;
  37072. o[24] = x6 >>> 0 & 0xff;
  37073. o[25] = x6 >>> 8 & 0xff;
  37074. o[26] = x6 >>> 16 & 0xff;
  37075. o[27] = x6 >>> 24 & 0xff;
  37076. o[28] = x7 >>> 0 & 0xff;
  37077. o[29] = x7 >>> 8 & 0xff;
  37078. o[30] = x7 >>> 16 & 0xff;
  37079. o[31] = x7 >>> 24 & 0xff;
  37080. o[32] = x8 >>> 0 & 0xff;
  37081. o[33] = x8 >>> 8 & 0xff;
  37082. o[34] = x8 >>> 16 & 0xff;
  37083. o[35] = x8 >>> 24 & 0xff;
  37084. o[36] = x9 >>> 0 & 0xff;
  37085. o[37] = x9 >>> 8 & 0xff;
  37086. o[38] = x9 >>> 16 & 0xff;
  37087. o[39] = x9 >>> 24 & 0xff;
  37088. o[40] = x10 >>> 0 & 0xff;
  37089. o[41] = x10 >>> 8 & 0xff;
  37090. o[42] = x10 >>> 16 & 0xff;
  37091. o[43] = x10 >>> 24 & 0xff;
  37092. o[44] = x11 >>> 0 & 0xff;
  37093. o[45] = x11 >>> 8 & 0xff;
  37094. o[46] = x11 >>> 16 & 0xff;
  37095. o[47] = x11 >>> 24 & 0xff;
  37096. o[48] = x12 >>> 0 & 0xff;
  37097. o[49] = x12 >>> 8 & 0xff;
  37098. o[50] = x12 >>> 16 & 0xff;
  37099. o[51] = x12 >>> 24 & 0xff;
  37100. o[52] = x13 >>> 0 & 0xff;
  37101. o[53] = x13 >>> 8 & 0xff;
  37102. o[54] = x13 >>> 16 & 0xff;
  37103. o[55] = x13 >>> 24 & 0xff;
  37104. o[56] = x14 >>> 0 & 0xff;
  37105. o[57] = x14 >>> 8 & 0xff;
  37106. o[58] = x14 >>> 16 & 0xff;
  37107. o[59] = x14 >>> 24 & 0xff;
  37108. o[60] = x15 >>> 0 & 0xff;
  37109. o[61] = x15 >>> 8 & 0xff;
  37110. o[62] = x15 >>> 16 & 0xff;
  37111. o[63] = x15 >>> 24 & 0xff;
  37112. }
  37113. function core_hsalsa20(o,p,k,c) {
  37114. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37115. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37116. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37117. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37118. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37119. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37120. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37121. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37122. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37123. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37124. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37125. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37126. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37127. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37128. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37129. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37130. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37131. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37132. x15 = j15, u;
  37133. for (var i = 0; i < 20; i += 2) {
  37134. u = x0 + x12 | 0;
  37135. x4 ^= u<<7 | u>>>(32-7);
  37136. u = x4 + x0 | 0;
  37137. x8 ^= u<<9 | u>>>(32-9);
  37138. u = x8 + x4 | 0;
  37139. x12 ^= u<<13 | u>>>(32-13);
  37140. u = x12 + x8 | 0;
  37141. x0 ^= u<<18 | u>>>(32-18);
  37142. u = x5 + x1 | 0;
  37143. x9 ^= u<<7 | u>>>(32-7);
  37144. u = x9 + x5 | 0;
  37145. x13 ^= u<<9 | u>>>(32-9);
  37146. u = x13 + x9 | 0;
  37147. x1 ^= u<<13 | u>>>(32-13);
  37148. u = x1 + x13 | 0;
  37149. x5 ^= u<<18 | u>>>(32-18);
  37150. u = x10 + x6 | 0;
  37151. x14 ^= u<<7 | u>>>(32-7);
  37152. u = x14 + x10 | 0;
  37153. x2 ^= u<<9 | u>>>(32-9);
  37154. u = x2 + x14 | 0;
  37155. x6 ^= u<<13 | u>>>(32-13);
  37156. u = x6 + x2 | 0;
  37157. x10 ^= u<<18 | u>>>(32-18);
  37158. u = x15 + x11 | 0;
  37159. x3 ^= u<<7 | u>>>(32-7);
  37160. u = x3 + x15 | 0;
  37161. x7 ^= u<<9 | u>>>(32-9);
  37162. u = x7 + x3 | 0;
  37163. x11 ^= u<<13 | u>>>(32-13);
  37164. u = x11 + x7 | 0;
  37165. x15 ^= u<<18 | u>>>(32-18);
  37166. u = x0 + x3 | 0;
  37167. x1 ^= u<<7 | u>>>(32-7);
  37168. u = x1 + x0 | 0;
  37169. x2 ^= u<<9 | u>>>(32-9);
  37170. u = x2 + x1 | 0;
  37171. x3 ^= u<<13 | u>>>(32-13);
  37172. u = x3 + x2 | 0;
  37173. x0 ^= u<<18 | u>>>(32-18);
  37174. u = x5 + x4 | 0;
  37175. x6 ^= u<<7 | u>>>(32-7);
  37176. u = x6 + x5 | 0;
  37177. x7 ^= u<<9 | u>>>(32-9);
  37178. u = x7 + x6 | 0;
  37179. x4 ^= u<<13 | u>>>(32-13);
  37180. u = x4 + x7 | 0;
  37181. x5 ^= u<<18 | u>>>(32-18);
  37182. u = x10 + x9 | 0;
  37183. x11 ^= u<<7 | u>>>(32-7);
  37184. u = x11 + x10 | 0;
  37185. x8 ^= u<<9 | u>>>(32-9);
  37186. u = x8 + x11 | 0;
  37187. x9 ^= u<<13 | u>>>(32-13);
  37188. u = x9 + x8 | 0;
  37189. x10 ^= u<<18 | u>>>(32-18);
  37190. u = x15 + x14 | 0;
  37191. x12 ^= u<<7 | u>>>(32-7);
  37192. u = x12 + x15 | 0;
  37193. x13 ^= u<<9 | u>>>(32-9);
  37194. u = x13 + x12 | 0;
  37195. x14 ^= u<<13 | u>>>(32-13);
  37196. u = x14 + x13 | 0;
  37197. x15 ^= u<<18 | u>>>(32-18);
  37198. }
  37199. o[ 0] = x0 >>> 0 & 0xff;
  37200. o[ 1] = x0 >>> 8 & 0xff;
  37201. o[ 2] = x0 >>> 16 & 0xff;
  37202. o[ 3] = x0 >>> 24 & 0xff;
  37203. o[ 4] = x5 >>> 0 & 0xff;
  37204. o[ 5] = x5 >>> 8 & 0xff;
  37205. o[ 6] = x5 >>> 16 & 0xff;
  37206. o[ 7] = x5 >>> 24 & 0xff;
  37207. o[ 8] = x10 >>> 0 & 0xff;
  37208. o[ 9] = x10 >>> 8 & 0xff;
  37209. o[10] = x10 >>> 16 & 0xff;
  37210. o[11] = x10 >>> 24 & 0xff;
  37211. o[12] = x15 >>> 0 & 0xff;
  37212. o[13] = x15 >>> 8 & 0xff;
  37213. o[14] = x15 >>> 16 & 0xff;
  37214. o[15] = x15 >>> 24 & 0xff;
  37215. o[16] = x6 >>> 0 & 0xff;
  37216. o[17] = x6 >>> 8 & 0xff;
  37217. o[18] = x6 >>> 16 & 0xff;
  37218. o[19] = x6 >>> 24 & 0xff;
  37219. o[20] = x7 >>> 0 & 0xff;
  37220. o[21] = x7 >>> 8 & 0xff;
  37221. o[22] = x7 >>> 16 & 0xff;
  37222. o[23] = x7 >>> 24 & 0xff;
  37223. o[24] = x8 >>> 0 & 0xff;
  37224. o[25] = x8 >>> 8 & 0xff;
  37225. o[26] = x8 >>> 16 & 0xff;
  37226. o[27] = x8 >>> 24 & 0xff;
  37227. o[28] = x9 >>> 0 & 0xff;
  37228. o[29] = x9 >>> 8 & 0xff;
  37229. o[30] = x9 >>> 16 & 0xff;
  37230. o[31] = x9 >>> 24 & 0xff;
  37231. }
  37232. function crypto_core_salsa20(out,inp,k,c) {
  37233. core_salsa20(out,inp,k,c);
  37234. }
  37235. function crypto_core_hsalsa20(out,inp,k,c) {
  37236. core_hsalsa20(out,inp,k,c);
  37237. }
  37238. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  37239. // "expand 32-byte k"
  37240. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  37241. var z = new Uint8Array(16), x = new Uint8Array(64);
  37242. var u, i;
  37243. for (i = 0; i < 16; i++) z[i] = 0;
  37244. for (i = 0; i < 8; i++) z[i] = n[i];
  37245. while (b >= 64) {
  37246. crypto_core_salsa20(x,z,k,sigma);
  37247. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37248. u = 1;
  37249. for (i = 8; i < 16; i++) {
  37250. u = u + (z[i] & 0xff) | 0;
  37251. z[i] = u & 0xff;
  37252. u >>>= 8;
  37253. }
  37254. b -= 64;
  37255. cpos += 64;
  37256. mpos += 64;
  37257. }
  37258. if (b > 0) {
  37259. crypto_core_salsa20(x,z,k,sigma);
  37260. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37261. }
  37262. return 0;
  37263. }
  37264. function crypto_stream_salsa20(c,cpos,b,n,k) {
  37265. var z = new Uint8Array(16), x = new Uint8Array(64);
  37266. var u, i;
  37267. for (i = 0; i < 16; i++) z[i] = 0;
  37268. for (i = 0; i < 8; i++) z[i] = n[i];
  37269. while (b >= 64) {
  37270. crypto_core_salsa20(x,z,k,sigma);
  37271. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  37272. u = 1;
  37273. for (i = 8; i < 16; i++) {
  37274. u = u + (z[i] & 0xff) | 0;
  37275. z[i] = u & 0xff;
  37276. u >>>= 8;
  37277. }
  37278. b -= 64;
  37279. cpos += 64;
  37280. }
  37281. if (b > 0) {
  37282. crypto_core_salsa20(x,z,k,sigma);
  37283. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  37284. }
  37285. return 0;
  37286. }
  37287. function crypto_stream(c,cpos,d,n,k) {
  37288. var s = new Uint8Array(32);
  37289. crypto_core_hsalsa20(s,n,k,sigma);
  37290. var sn = new Uint8Array(8);
  37291. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37292. return crypto_stream_salsa20(c,cpos,d,sn,s);
  37293. }
  37294. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  37295. var s = new Uint8Array(32);
  37296. crypto_core_hsalsa20(s,n,k,sigma);
  37297. var sn = new Uint8Array(8);
  37298. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37299. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  37300. }
  37301. /*
  37302. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  37303. * https://github.com/floodyberry/poly1305-donna
  37304. */
  37305. var poly1305 = function(key) {
  37306. this.buffer = new Uint8Array(16);
  37307. this.r = new Uint16Array(10);
  37308. this.h = new Uint16Array(10);
  37309. this.pad = new Uint16Array(8);
  37310. this.leftover = 0;
  37311. this.fin = 0;
  37312. var t0, t1, t2, t3, t4, t5, t6, t7;
  37313. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  37314. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37315. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  37316. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37317. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  37318. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  37319. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37320. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  37321. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37322. this.r[9] = ((t7 >>> 5)) & 0x007f;
  37323. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  37324. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  37325. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  37326. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  37327. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  37328. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  37329. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  37330. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  37331. };
  37332. poly1305.prototype.blocks = function(m, mpos, bytes) {
  37333. var hibit = this.fin ? 0 : (1 << 11);
  37334. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  37335. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  37336. var h0 = this.h[0],
  37337. h1 = this.h[1],
  37338. h2 = this.h[2],
  37339. h3 = this.h[3],
  37340. h4 = this.h[4],
  37341. h5 = this.h[5],
  37342. h6 = this.h[6],
  37343. h7 = this.h[7],
  37344. h8 = this.h[8],
  37345. h9 = this.h[9];
  37346. var r0 = this.r[0],
  37347. r1 = this.r[1],
  37348. r2 = this.r[2],
  37349. r3 = this.r[3],
  37350. r4 = this.r[4],
  37351. r5 = this.r[5],
  37352. r6 = this.r[6],
  37353. r7 = this.r[7],
  37354. r8 = this.r[8],
  37355. r9 = this.r[9];
  37356. while (bytes >= 16) {
  37357. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  37358. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37359. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  37360. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37361. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  37362. h5 += ((t4 >>> 1)) & 0x1fff;
  37363. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37364. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  37365. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37366. h9 += ((t7 >>> 5)) | hibit;
  37367. c = 0;
  37368. d0 = c;
  37369. d0 += h0 * r0;
  37370. d0 += h1 * (5 * r9);
  37371. d0 += h2 * (5 * r8);
  37372. d0 += h3 * (5 * r7);
  37373. d0 += h4 * (5 * r6);
  37374. c = (d0 >>> 13); d0 &= 0x1fff;
  37375. d0 += h5 * (5 * r5);
  37376. d0 += h6 * (5 * r4);
  37377. d0 += h7 * (5 * r3);
  37378. d0 += h8 * (5 * r2);
  37379. d0 += h9 * (5 * r1);
  37380. c += (d0 >>> 13); d0 &= 0x1fff;
  37381. d1 = c;
  37382. d1 += h0 * r1;
  37383. d1 += h1 * r0;
  37384. d1 += h2 * (5 * r9);
  37385. d1 += h3 * (5 * r8);
  37386. d1 += h4 * (5 * r7);
  37387. c = (d1 >>> 13); d1 &= 0x1fff;
  37388. d1 += h5 * (5 * r6);
  37389. d1 += h6 * (5 * r5);
  37390. d1 += h7 * (5 * r4);
  37391. d1 += h8 * (5 * r3);
  37392. d1 += h9 * (5 * r2);
  37393. c += (d1 >>> 13); d1 &= 0x1fff;
  37394. d2 = c;
  37395. d2 += h0 * r2;
  37396. d2 += h1 * r1;
  37397. d2 += h2 * r0;
  37398. d2 += h3 * (5 * r9);
  37399. d2 += h4 * (5 * r8);
  37400. c = (d2 >>> 13); d2 &= 0x1fff;
  37401. d2 += h5 * (5 * r7);
  37402. d2 += h6 * (5 * r6);
  37403. d2 += h7 * (5 * r5);
  37404. d2 += h8 * (5 * r4);
  37405. d2 += h9 * (5 * r3);
  37406. c += (d2 >>> 13); d2 &= 0x1fff;
  37407. d3 = c;
  37408. d3 += h0 * r3;
  37409. d3 += h1 * r2;
  37410. d3 += h2 * r1;
  37411. d3 += h3 * r0;
  37412. d3 += h4 * (5 * r9);
  37413. c = (d3 >>> 13); d3 &= 0x1fff;
  37414. d3 += h5 * (5 * r8);
  37415. d3 += h6 * (5 * r7);
  37416. d3 += h7 * (5 * r6);
  37417. d3 += h8 * (5 * r5);
  37418. d3 += h9 * (5 * r4);
  37419. c += (d3 >>> 13); d3 &= 0x1fff;
  37420. d4 = c;
  37421. d4 += h0 * r4;
  37422. d4 += h1 * r3;
  37423. d4 += h2 * r2;
  37424. d4 += h3 * r1;
  37425. d4 += h4 * r0;
  37426. c = (d4 >>> 13); d4 &= 0x1fff;
  37427. d4 += h5 * (5 * r9);
  37428. d4 += h6 * (5 * r8);
  37429. d4 += h7 * (5 * r7);
  37430. d4 += h8 * (5 * r6);
  37431. d4 += h9 * (5 * r5);
  37432. c += (d4 >>> 13); d4 &= 0x1fff;
  37433. d5 = c;
  37434. d5 += h0 * r5;
  37435. d5 += h1 * r4;
  37436. d5 += h2 * r3;
  37437. d5 += h3 * r2;
  37438. d5 += h4 * r1;
  37439. c = (d5 >>> 13); d5 &= 0x1fff;
  37440. d5 += h5 * r0;
  37441. d5 += h6 * (5 * r9);
  37442. d5 += h7 * (5 * r8);
  37443. d5 += h8 * (5 * r7);
  37444. d5 += h9 * (5 * r6);
  37445. c += (d5 >>> 13); d5 &= 0x1fff;
  37446. d6 = c;
  37447. d6 += h0 * r6;
  37448. d6 += h1 * r5;
  37449. d6 += h2 * r4;
  37450. d6 += h3 * r3;
  37451. d6 += h4 * r2;
  37452. c = (d6 >>> 13); d6 &= 0x1fff;
  37453. d6 += h5 * r1;
  37454. d6 += h6 * r0;
  37455. d6 += h7 * (5 * r9);
  37456. d6 += h8 * (5 * r8);
  37457. d6 += h9 * (5 * r7);
  37458. c += (d6 >>> 13); d6 &= 0x1fff;
  37459. d7 = c;
  37460. d7 += h0 * r7;
  37461. d7 += h1 * r6;
  37462. d7 += h2 * r5;
  37463. d7 += h3 * r4;
  37464. d7 += h4 * r3;
  37465. c = (d7 >>> 13); d7 &= 0x1fff;
  37466. d7 += h5 * r2;
  37467. d7 += h6 * r1;
  37468. d7 += h7 * r0;
  37469. d7 += h8 * (5 * r9);
  37470. d7 += h9 * (5 * r8);
  37471. c += (d7 >>> 13); d7 &= 0x1fff;
  37472. d8 = c;
  37473. d8 += h0 * r8;
  37474. d8 += h1 * r7;
  37475. d8 += h2 * r6;
  37476. d8 += h3 * r5;
  37477. d8 += h4 * r4;
  37478. c = (d8 >>> 13); d8 &= 0x1fff;
  37479. d8 += h5 * r3;
  37480. d8 += h6 * r2;
  37481. d8 += h7 * r1;
  37482. d8 += h8 * r0;
  37483. d8 += h9 * (5 * r9);
  37484. c += (d8 >>> 13); d8 &= 0x1fff;
  37485. d9 = c;
  37486. d9 += h0 * r9;
  37487. d9 += h1 * r8;
  37488. d9 += h2 * r7;
  37489. d9 += h3 * r6;
  37490. d9 += h4 * r5;
  37491. c = (d9 >>> 13); d9 &= 0x1fff;
  37492. d9 += h5 * r4;
  37493. d9 += h6 * r3;
  37494. d9 += h7 * r2;
  37495. d9 += h8 * r1;
  37496. d9 += h9 * r0;
  37497. c += (d9 >>> 13); d9 &= 0x1fff;
  37498. c = (((c << 2) + c)) | 0;
  37499. c = (c + d0) | 0;
  37500. d0 = c & 0x1fff;
  37501. c = (c >>> 13);
  37502. d1 += c;
  37503. h0 = d0;
  37504. h1 = d1;
  37505. h2 = d2;
  37506. h3 = d3;
  37507. h4 = d4;
  37508. h5 = d5;
  37509. h6 = d6;
  37510. h7 = d7;
  37511. h8 = d8;
  37512. h9 = d9;
  37513. mpos += 16;
  37514. bytes -= 16;
  37515. }
  37516. this.h[0] = h0;
  37517. this.h[1] = h1;
  37518. this.h[2] = h2;
  37519. this.h[3] = h3;
  37520. this.h[4] = h4;
  37521. this.h[5] = h5;
  37522. this.h[6] = h6;
  37523. this.h[7] = h7;
  37524. this.h[8] = h8;
  37525. this.h[9] = h9;
  37526. };
  37527. poly1305.prototype.finish = function(mac, macpos) {
  37528. var g = new Uint16Array(10);
  37529. var c, mask, f, i;
  37530. if (this.leftover) {
  37531. i = this.leftover;
  37532. this.buffer[i++] = 1;
  37533. for (; i < 16; i++) this.buffer[i] = 0;
  37534. this.fin = 1;
  37535. this.blocks(this.buffer, 0, 16);
  37536. }
  37537. c = this.h[1] >>> 13;
  37538. this.h[1] &= 0x1fff;
  37539. for (i = 2; i < 10; i++) {
  37540. this.h[i] += c;
  37541. c = this.h[i] >>> 13;
  37542. this.h[i] &= 0x1fff;
  37543. }
  37544. this.h[0] += (c * 5);
  37545. c = this.h[0] >>> 13;
  37546. this.h[0] &= 0x1fff;
  37547. this.h[1] += c;
  37548. c = this.h[1] >>> 13;
  37549. this.h[1] &= 0x1fff;
  37550. this.h[2] += c;
  37551. g[0] = this.h[0] + 5;
  37552. c = g[0] >>> 13;
  37553. g[0] &= 0x1fff;
  37554. for (i = 1; i < 10; i++) {
  37555. g[i] = this.h[i] + c;
  37556. c = g[i] >>> 13;
  37557. g[i] &= 0x1fff;
  37558. }
  37559. g[9] -= (1 << 13);
  37560. mask = (c ^ 1) - 1;
  37561. for (i = 0; i < 10; i++) g[i] &= mask;
  37562. mask = ~mask;
  37563. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  37564. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  37565. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  37566. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  37567. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  37568. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  37569. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  37570. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  37571. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  37572. f = this.h[0] + this.pad[0];
  37573. this.h[0] = f & 0xffff;
  37574. for (i = 1; i < 8; i++) {
  37575. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  37576. this.h[i] = f & 0xffff;
  37577. }
  37578. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  37579. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  37580. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  37581. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  37582. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  37583. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  37584. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  37585. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  37586. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  37587. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  37588. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  37589. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  37590. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  37591. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  37592. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  37593. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  37594. };
  37595. poly1305.prototype.update = function(m, mpos, bytes) {
  37596. var i, want;
  37597. if (this.leftover) {
  37598. want = (16 - this.leftover);
  37599. if (want > bytes)
  37600. want = bytes;
  37601. for (i = 0; i < want; i++)
  37602. this.buffer[this.leftover + i] = m[mpos+i];
  37603. bytes -= want;
  37604. mpos += want;
  37605. this.leftover += want;
  37606. if (this.leftover < 16)
  37607. return;
  37608. this.blocks(this.buffer, 0, 16);
  37609. this.leftover = 0;
  37610. }
  37611. if (bytes >= 16) {
  37612. want = bytes - (bytes % 16);
  37613. this.blocks(m, mpos, want);
  37614. mpos += want;
  37615. bytes -= want;
  37616. }
  37617. if (bytes) {
  37618. for (i = 0; i < bytes; i++)
  37619. this.buffer[this.leftover + i] = m[mpos+i];
  37620. this.leftover += bytes;
  37621. }
  37622. };
  37623. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  37624. var s = new poly1305(k);
  37625. s.update(m, mpos, n);
  37626. s.finish(out, outpos);
  37627. return 0;
  37628. }
  37629. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  37630. var x = new Uint8Array(16);
  37631. crypto_onetimeauth(x,0,m,mpos,n,k);
  37632. return crypto_verify_16(h,hpos,x,0);
  37633. }
  37634. function crypto_secretbox(c,m,d,n,k) {
  37635. var i;
  37636. if (d < 32) return -1;
  37637. crypto_stream_xor(c,0,m,0,d,n,k);
  37638. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  37639. for (i = 0; i < 16; i++) c[i] = 0;
  37640. return 0;
  37641. }
  37642. function crypto_secretbox_open(m,c,d,n,k) {
  37643. var i;
  37644. var x = new Uint8Array(32);
  37645. if (d < 32) return -1;
  37646. crypto_stream(x,0,32,n,k);
  37647. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  37648. crypto_stream_xor(m,0,c,0,d,n,k);
  37649. for (i = 0; i < 32; i++) m[i] = 0;
  37650. return 0;
  37651. }
  37652. function set25519(r, a) {
  37653. var i;
  37654. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  37655. }
  37656. function car25519(o) {
  37657. var i, v, c = 1;
  37658. for (i = 0; i < 16; i++) {
  37659. v = o[i] + c + 65535;
  37660. c = Math.floor(v / 65536);
  37661. o[i] = v - c * 65536;
  37662. }
  37663. o[0] += c-1 + 37 * (c-1);
  37664. }
  37665. function sel25519(p, q, b) {
  37666. var t, c = ~(b-1);
  37667. for (var i = 0; i < 16; i++) {
  37668. t = c & (p[i] ^ q[i]);
  37669. p[i] ^= t;
  37670. q[i] ^= t;
  37671. }
  37672. }
  37673. function pack25519(o, n) {
  37674. var i, j, b;
  37675. var m = gf(), t = gf();
  37676. for (i = 0; i < 16; i++) t[i] = n[i];
  37677. car25519(t);
  37678. car25519(t);
  37679. car25519(t);
  37680. for (j = 0; j < 2; j++) {
  37681. m[0] = t[0] - 0xffed;
  37682. for (i = 1; i < 15; i++) {
  37683. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  37684. m[i-1] &= 0xffff;
  37685. }
  37686. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  37687. b = (m[15]>>16) & 1;
  37688. m[14] &= 0xffff;
  37689. sel25519(t, m, 1-b);
  37690. }
  37691. for (i = 0; i < 16; i++) {
  37692. o[2*i] = t[i] & 0xff;
  37693. o[2*i+1] = t[i]>>8;
  37694. }
  37695. }
  37696. function neq25519(a, b) {
  37697. var c = new Uint8Array(32), d = new Uint8Array(32);
  37698. pack25519(c, a);
  37699. pack25519(d, b);
  37700. return crypto_verify_32(c, 0, d, 0);
  37701. }
  37702. function par25519(a) {
  37703. var d = new Uint8Array(32);
  37704. pack25519(d, a);
  37705. return d[0] & 1;
  37706. }
  37707. function unpack25519(o, n) {
  37708. var i;
  37709. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  37710. o[15] &= 0x7fff;
  37711. }
  37712. function A(o, a, b) {
  37713. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  37714. }
  37715. function Z(o, a, b) {
  37716. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  37717. }
  37718. function M(o, a, b) {
  37719. var v, c,
  37720. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  37721. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  37722. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  37723. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  37724. b0 = b[0],
  37725. b1 = b[1],
  37726. b2 = b[2],
  37727. b3 = b[3],
  37728. b4 = b[4],
  37729. b5 = b[5],
  37730. b6 = b[6],
  37731. b7 = b[7],
  37732. b8 = b[8],
  37733. b9 = b[9],
  37734. b10 = b[10],
  37735. b11 = b[11],
  37736. b12 = b[12],
  37737. b13 = b[13],
  37738. b14 = b[14],
  37739. b15 = b[15];
  37740. v = a[0];
  37741. t0 += v * b0;
  37742. t1 += v * b1;
  37743. t2 += v * b2;
  37744. t3 += v * b3;
  37745. t4 += v * b4;
  37746. t5 += v * b5;
  37747. t6 += v * b6;
  37748. t7 += v * b7;
  37749. t8 += v * b8;
  37750. t9 += v * b9;
  37751. t10 += v * b10;
  37752. t11 += v * b11;
  37753. t12 += v * b12;
  37754. t13 += v * b13;
  37755. t14 += v * b14;
  37756. t15 += v * b15;
  37757. v = a[1];
  37758. t1 += v * b0;
  37759. t2 += v * b1;
  37760. t3 += v * b2;
  37761. t4 += v * b3;
  37762. t5 += v * b4;
  37763. t6 += v * b5;
  37764. t7 += v * b6;
  37765. t8 += v * b7;
  37766. t9 += v * b8;
  37767. t10 += v * b9;
  37768. t11 += v * b10;
  37769. t12 += v * b11;
  37770. t13 += v * b12;
  37771. t14 += v * b13;
  37772. t15 += v * b14;
  37773. t16 += v * b15;
  37774. v = a[2];
  37775. t2 += v * b0;
  37776. t3 += v * b1;
  37777. t4 += v * b2;
  37778. t5 += v * b3;
  37779. t6 += v * b4;
  37780. t7 += v * b5;
  37781. t8 += v * b6;
  37782. t9 += v * b7;
  37783. t10 += v * b8;
  37784. t11 += v * b9;
  37785. t12 += v * b10;
  37786. t13 += v * b11;
  37787. t14 += v * b12;
  37788. t15 += v * b13;
  37789. t16 += v * b14;
  37790. t17 += v * b15;
  37791. v = a[3];
  37792. t3 += v * b0;
  37793. t4 += v * b1;
  37794. t5 += v * b2;
  37795. t6 += v * b3;
  37796. t7 += v * b4;
  37797. t8 += v * b5;
  37798. t9 += v * b6;
  37799. t10 += v * b7;
  37800. t11 += v * b8;
  37801. t12 += v * b9;
  37802. t13 += v * b10;
  37803. t14 += v * b11;
  37804. t15 += v * b12;
  37805. t16 += v * b13;
  37806. t17 += v * b14;
  37807. t18 += v * b15;
  37808. v = a[4];
  37809. t4 += v * b0;
  37810. t5 += v * b1;
  37811. t6 += v * b2;
  37812. t7 += v * b3;
  37813. t8 += v * b4;
  37814. t9 += v * b5;
  37815. t10 += v * b6;
  37816. t11 += v * b7;
  37817. t12 += v * b8;
  37818. t13 += v * b9;
  37819. t14 += v * b10;
  37820. t15 += v * b11;
  37821. t16 += v * b12;
  37822. t17 += v * b13;
  37823. t18 += v * b14;
  37824. t19 += v * b15;
  37825. v = a[5];
  37826. t5 += v * b0;
  37827. t6 += v * b1;
  37828. t7 += v * b2;
  37829. t8 += v * b3;
  37830. t9 += v * b4;
  37831. t10 += v * b5;
  37832. t11 += v * b6;
  37833. t12 += v * b7;
  37834. t13 += v * b8;
  37835. t14 += v * b9;
  37836. t15 += v * b10;
  37837. t16 += v * b11;
  37838. t17 += v * b12;
  37839. t18 += v * b13;
  37840. t19 += v * b14;
  37841. t20 += v * b15;
  37842. v = a[6];
  37843. t6 += v * b0;
  37844. t7 += v * b1;
  37845. t8 += v * b2;
  37846. t9 += v * b3;
  37847. t10 += v * b4;
  37848. t11 += v * b5;
  37849. t12 += v * b6;
  37850. t13 += v * b7;
  37851. t14 += v * b8;
  37852. t15 += v * b9;
  37853. t16 += v * b10;
  37854. t17 += v * b11;
  37855. t18 += v * b12;
  37856. t19 += v * b13;
  37857. t20 += v * b14;
  37858. t21 += v * b15;
  37859. v = a[7];
  37860. t7 += v * b0;
  37861. t8 += v * b1;
  37862. t9 += v * b2;
  37863. t10 += v * b3;
  37864. t11 += v * b4;
  37865. t12 += v * b5;
  37866. t13 += v * b6;
  37867. t14 += v * b7;
  37868. t15 += v * b8;
  37869. t16 += v * b9;
  37870. t17 += v * b10;
  37871. t18 += v * b11;
  37872. t19 += v * b12;
  37873. t20 += v * b13;
  37874. t21 += v * b14;
  37875. t22 += v * b15;
  37876. v = a[8];
  37877. t8 += v * b0;
  37878. t9 += v * b1;
  37879. t10 += v * b2;
  37880. t11 += v * b3;
  37881. t12 += v * b4;
  37882. t13 += v * b5;
  37883. t14 += v * b6;
  37884. t15 += v * b7;
  37885. t16 += v * b8;
  37886. t17 += v * b9;
  37887. t18 += v * b10;
  37888. t19 += v * b11;
  37889. t20 += v * b12;
  37890. t21 += v * b13;
  37891. t22 += v * b14;
  37892. t23 += v * b15;
  37893. v = a[9];
  37894. t9 += v * b0;
  37895. t10 += v * b1;
  37896. t11 += v * b2;
  37897. t12 += v * b3;
  37898. t13 += v * b4;
  37899. t14 += v * b5;
  37900. t15 += v * b6;
  37901. t16 += v * b7;
  37902. t17 += v * b8;
  37903. t18 += v * b9;
  37904. t19 += v * b10;
  37905. t20 += v * b11;
  37906. t21 += v * b12;
  37907. t22 += v * b13;
  37908. t23 += v * b14;
  37909. t24 += v * b15;
  37910. v = a[10];
  37911. t10 += v * b0;
  37912. t11 += v * b1;
  37913. t12 += v * b2;
  37914. t13 += v * b3;
  37915. t14 += v * b4;
  37916. t15 += v * b5;
  37917. t16 += v * b6;
  37918. t17 += v * b7;
  37919. t18 += v * b8;
  37920. t19 += v * b9;
  37921. t20 += v * b10;
  37922. t21 += v * b11;
  37923. t22 += v * b12;
  37924. t23 += v * b13;
  37925. t24 += v * b14;
  37926. t25 += v * b15;
  37927. v = a[11];
  37928. t11 += v * b0;
  37929. t12 += v * b1;
  37930. t13 += v * b2;
  37931. t14 += v * b3;
  37932. t15 += v * b4;
  37933. t16 += v * b5;
  37934. t17 += v * b6;
  37935. t18 += v * b7;
  37936. t19 += v * b8;
  37937. t20 += v * b9;
  37938. t21 += v * b10;
  37939. t22 += v * b11;
  37940. t23 += v * b12;
  37941. t24 += v * b13;
  37942. t25 += v * b14;
  37943. t26 += v * b15;
  37944. v = a[12];
  37945. t12 += v * b0;
  37946. t13 += v * b1;
  37947. t14 += v * b2;
  37948. t15 += v * b3;
  37949. t16 += v * b4;
  37950. t17 += v * b5;
  37951. t18 += v * b6;
  37952. t19 += v * b7;
  37953. t20 += v * b8;
  37954. t21 += v * b9;
  37955. t22 += v * b10;
  37956. t23 += v * b11;
  37957. t24 += v * b12;
  37958. t25 += v * b13;
  37959. t26 += v * b14;
  37960. t27 += v * b15;
  37961. v = a[13];
  37962. t13 += v * b0;
  37963. t14 += v * b1;
  37964. t15 += v * b2;
  37965. t16 += v * b3;
  37966. t17 += v * b4;
  37967. t18 += v * b5;
  37968. t19 += v * b6;
  37969. t20 += v * b7;
  37970. t21 += v * b8;
  37971. t22 += v * b9;
  37972. t23 += v * b10;
  37973. t24 += v * b11;
  37974. t25 += v * b12;
  37975. t26 += v * b13;
  37976. t27 += v * b14;
  37977. t28 += v * b15;
  37978. v = a[14];
  37979. t14 += v * b0;
  37980. t15 += v * b1;
  37981. t16 += v * b2;
  37982. t17 += v * b3;
  37983. t18 += v * b4;
  37984. t19 += v * b5;
  37985. t20 += v * b6;
  37986. t21 += v * b7;
  37987. t22 += v * b8;
  37988. t23 += v * b9;
  37989. t24 += v * b10;
  37990. t25 += v * b11;
  37991. t26 += v * b12;
  37992. t27 += v * b13;
  37993. t28 += v * b14;
  37994. t29 += v * b15;
  37995. v = a[15];
  37996. t15 += v * b0;
  37997. t16 += v * b1;
  37998. t17 += v * b2;
  37999. t18 += v * b3;
  38000. t19 += v * b4;
  38001. t20 += v * b5;
  38002. t21 += v * b6;
  38003. t22 += v * b7;
  38004. t23 += v * b8;
  38005. t24 += v * b9;
  38006. t25 += v * b10;
  38007. t26 += v * b11;
  38008. t27 += v * b12;
  38009. t28 += v * b13;
  38010. t29 += v * b14;
  38011. t30 += v * b15;
  38012. t0 += 38 * t16;
  38013. t1 += 38 * t17;
  38014. t2 += 38 * t18;
  38015. t3 += 38 * t19;
  38016. t4 += 38 * t20;
  38017. t5 += 38 * t21;
  38018. t6 += 38 * t22;
  38019. t7 += 38 * t23;
  38020. t8 += 38 * t24;
  38021. t9 += 38 * t25;
  38022. t10 += 38 * t26;
  38023. t11 += 38 * t27;
  38024. t12 += 38 * t28;
  38025. t13 += 38 * t29;
  38026. t14 += 38 * t30;
  38027. // t15 left as is
  38028. // first car
  38029. c = 1;
  38030. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38031. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38032. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38033. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38034. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38035. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38036. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38037. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38038. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38039. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38040. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38041. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38042. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38043. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38044. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38045. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38046. t0 += c-1 + 37 * (c-1);
  38047. // second car
  38048. c = 1;
  38049. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38050. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38051. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38052. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38053. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38054. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38055. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38056. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38057. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38058. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38059. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38060. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38061. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38062. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38063. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38064. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38065. t0 += c-1 + 37 * (c-1);
  38066. o[ 0] = t0;
  38067. o[ 1] = t1;
  38068. o[ 2] = t2;
  38069. o[ 3] = t3;
  38070. o[ 4] = t4;
  38071. o[ 5] = t5;
  38072. o[ 6] = t6;
  38073. o[ 7] = t7;
  38074. o[ 8] = t8;
  38075. o[ 9] = t9;
  38076. o[10] = t10;
  38077. o[11] = t11;
  38078. o[12] = t12;
  38079. o[13] = t13;
  38080. o[14] = t14;
  38081. o[15] = t15;
  38082. }
  38083. function S(o, a) {
  38084. M(o, a, a);
  38085. }
  38086. function inv25519(o, i) {
  38087. var c = gf();
  38088. var a;
  38089. for (a = 0; a < 16; a++) c[a] = i[a];
  38090. for (a = 253; a >= 0; a--) {
  38091. S(c, c);
  38092. if(a !== 2 && a !== 4) M(c, c, i);
  38093. }
  38094. for (a = 0; a < 16; a++) o[a] = c[a];
  38095. }
  38096. function pow2523(o, i) {
  38097. var c = gf();
  38098. var a;
  38099. for (a = 0; a < 16; a++) c[a] = i[a];
  38100. for (a = 250; a >= 0; a--) {
  38101. S(c, c);
  38102. if(a !== 1) M(c, c, i);
  38103. }
  38104. for (a = 0; a < 16; a++) o[a] = c[a];
  38105. }
  38106. function crypto_scalarmult(q, n, p) {
  38107. var z = new Uint8Array(32);
  38108. var x = new Float64Array(80), r, i;
  38109. var a = gf(), b = gf(), c = gf(),
  38110. d = gf(), e = gf(), f = gf();
  38111. for (i = 0; i < 31; i++) z[i] = n[i];
  38112. z[31]=(n[31]&127)|64;
  38113. z[0]&=248;
  38114. unpack25519(x,p);
  38115. for (i = 0; i < 16; i++) {
  38116. b[i]=x[i];
  38117. d[i]=a[i]=c[i]=0;
  38118. }
  38119. a[0]=d[0]=1;
  38120. for (i=254; i>=0; --i) {
  38121. r=(z[i>>>3]>>>(i&7))&1;
  38122. sel25519(a,b,r);
  38123. sel25519(c,d,r);
  38124. A(e,a,c);
  38125. Z(a,a,c);
  38126. A(c,b,d);
  38127. Z(b,b,d);
  38128. S(d,e);
  38129. S(f,a);
  38130. M(a,c,a);
  38131. M(c,b,e);
  38132. A(e,a,c);
  38133. Z(a,a,c);
  38134. S(b,a);
  38135. Z(c,d,f);
  38136. M(a,c,_121665);
  38137. A(a,a,d);
  38138. M(c,c,a);
  38139. M(a,d,f);
  38140. M(d,b,x);
  38141. S(b,e);
  38142. sel25519(a,b,r);
  38143. sel25519(c,d,r);
  38144. }
  38145. for (i = 0; i < 16; i++) {
  38146. x[i+16]=a[i];
  38147. x[i+32]=c[i];
  38148. x[i+48]=b[i];
  38149. x[i+64]=d[i];
  38150. }
  38151. var x32 = x.subarray(32);
  38152. var x16 = x.subarray(16);
  38153. inv25519(x32,x32);
  38154. M(x16,x16,x32);
  38155. pack25519(q,x16);
  38156. return 0;
  38157. }
  38158. function crypto_scalarmult_base(q, n) {
  38159. return crypto_scalarmult(q, n, _9);
  38160. }
  38161. function crypto_box_keypair(y, x) {
  38162. randombytes(x, 32);
  38163. return crypto_scalarmult_base(y, x);
  38164. }
  38165. function crypto_box_beforenm(k, y, x) {
  38166. var s = new Uint8Array(32);
  38167. crypto_scalarmult(s, x, y);
  38168. return crypto_core_hsalsa20(k, _0, s, sigma);
  38169. }
  38170. var crypto_box_afternm = crypto_secretbox;
  38171. var crypto_box_open_afternm = crypto_secretbox_open;
  38172. function crypto_box(c, m, d, n, y, x) {
  38173. var k = new Uint8Array(32);
  38174. crypto_box_beforenm(k, y, x);
  38175. return crypto_box_afternm(c, m, d, n, k);
  38176. }
  38177. function crypto_box_open(m, c, d, n, y, x) {
  38178. var k = new Uint8Array(32);
  38179. crypto_box_beforenm(k, y, x);
  38180. return crypto_box_open_afternm(m, c, d, n, k);
  38181. }
  38182. var K = [
  38183. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  38184. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  38185. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  38186. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  38187. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  38188. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  38189. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  38190. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  38191. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  38192. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  38193. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  38194. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  38195. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  38196. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  38197. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  38198. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  38199. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  38200. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  38201. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  38202. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  38203. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  38204. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  38205. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  38206. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  38207. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  38208. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  38209. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  38210. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  38211. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  38212. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  38213. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  38214. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  38215. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  38216. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  38217. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  38218. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  38219. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  38220. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  38221. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  38222. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  38223. ];
  38224. function crypto_hashblocks_hl(hh, hl, m, n) {
  38225. var wh = new Int32Array(16), wl = new Int32Array(16),
  38226. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  38227. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  38228. th, tl, i, j, h, l, a, b, c, d;
  38229. var ah0 = hh[0],
  38230. ah1 = hh[1],
  38231. ah2 = hh[2],
  38232. ah3 = hh[3],
  38233. ah4 = hh[4],
  38234. ah5 = hh[5],
  38235. ah6 = hh[6],
  38236. ah7 = hh[7],
  38237. al0 = hl[0],
  38238. al1 = hl[1],
  38239. al2 = hl[2],
  38240. al3 = hl[3],
  38241. al4 = hl[4],
  38242. al5 = hl[5],
  38243. al6 = hl[6],
  38244. al7 = hl[7];
  38245. var pos = 0;
  38246. while (n >= 128) {
  38247. for (i = 0; i < 16; i++) {
  38248. j = 8 * i + pos;
  38249. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  38250. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  38251. }
  38252. for (i = 0; i < 80; i++) {
  38253. bh0 = ah0;
  38254. bh1 = ah1;
  38255. bh2 = ah2;
  38256. bh3 = ah3;
  38257. bh4 = ah4;
  38258. bh5 = ah5;
  38259. bh6 = ah6;
  38260. bh7 = ah7;
  38261. bl0 = al0;
  38262. bl1 = al1;
  38263. bl2 = al2;
  38264. bl3 = al3;
  38265. bl4 = al4;
  38266. bl5 = al5;
  38267. bl6 = al6;
  38268. bl7 = al7;
  38269. // add
  38270. h = ah7;
  38271. l = al7;
  38272. a = l & 0xffff; b = l >>> 16;
  38273. c = h & 0xffff; d = h >>> 16;
  38274. // Sigma1
  38275. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  38276. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  38277. a += l & 0xffff; b += l >>> 16;
  38278. c += h & 0xffff; d += h >>> 16;
  38279. // Ch
  38280. h = (ah4 & ah5) ^ (~ah4 & ah6);
  38281. l = (al4 & al5) ^ (~al4 & al6);
  38282. a += l & 0xffff; b += l >>> 16;
  38283. c += h & 0xffff; d += h >>> 16;
  38284. // K
  38285. h = K[i*2];
  38286. l = K[i*2+1];
  38287. a += l & 0xffff; b += l >>> 16;
  38288. c += h & 0xffff; d += h >>> 16;
  38289. // w
  38290. h = wh[i%16];
  38291. l = wl[i%16];
  38292. a += l & 0xffff; b += l >>> 16;
  38293. c += h & 0xffff; d += h >>> 16;
  38294. b += a >>> 16;
  38295. c += b >>> 16;
  38296. d += c >>> 16;
  38297. th = c & 0xffff | d << 16;
  38298. tl = a & 0xffff | b << 16;
  38299. // add
  38300. h = th;
  38301. l = tl;
  38302. a = l & 0xffff; b = l >>> 16;
  38303. c = h & 0xffff; d = h >>> 16;
  38304. // Sigma0
  38305. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  38306. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  38307. a += l & 0xffff; b += l >>> 16;
  38308. c += h & 0xffff; d += h >>> 16;
  38309. // Maj
  38310. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  38311. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  38312. a += l & 0xffff; b += l >>> 16;
  38313. c += h & 0xffff; d += h >>> 16;
  38314. b += a >>> 16;
  38315. c += b >>> 16;
  38316. d += c >>> 16;
  38317. bh7 = (c & 0xffff) | (d << 16);
  38318. bl7 = (a & 0xffff) | (b << 16);
  38319. // add
  38320. h = bh3;
  38321. l = bl3;
  38322. a = l & 0xffff; b = l >>> 16;
  38323. c = h & 0xffff; d = h >>> 16;
  38324. h = th;
  38325. l = tl;
  38326. a += l & 0xffff; b += l >>> 16;
  38327. c += h & 0xffff; d += h >>> 16;
  38328. b += a >>> 16;
  38329. c += b >>> 16;
  38330. d += c >>> 16;
  38331. bh3 = (c & 0xffff) | (d << 16);
  38332. bl3 = (a & 0xffff) | (b << 16);
  38333. ah1 = bh0;
  38334. ah2 = bh1;
  38335. ah3 = bh2;
  38336. ah4 = bh3;
  38337. ah5 = bh4;
  38338. ah6 = bh5;
  38339. ah7 = bh6;
  38340. ah0 = bh7;
  38341. al1 = bl0;
  38342. al2 = bl1;
  38343. al3 = bl2;
  38344. al4 = bl3;
  38345. al5 = bl4;
  38346. al6 = bl5;
  38347. al7 = bl6;
  38348. al0 = bl7;
  38349. if (i%16 === 15) {
  38350. for (j = 0; j < 16; j++) {
  38351. // add
  38352. h = wh[j];
  38353. l = wl[j];
  38354. a = l & 0xffff; b = l >>> 16;
  38355. c = h & 0xffff; d = h >>> 16;
  38356. h = wh[(j+9)%16];
  38357. l = wl[(j+9)%16];
  38358. a += l & 0xffff; b += l >>> 16;
  38359. c += h & 0xffff; d += h >>> 16;
  38360. // sigma0
  38361. th = wh[(j+1)%16];
  38362. tl = wl[(j+1)%16];
  38363. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  38364. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  38365. a += l & 0xffff; b += l >>> 16;
  38366. c += h & 0xffff; d += h >>> 16;
  38367. // sigma1
  38368. th = wh[(j+14)%16];
  38369. tl = wl[(j+14)%16];
  38370. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  38371. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  38372. a += l & 0xffff; b += l >>> 16;
  38373. c += h & 0xffff; d += h >>> 16;
  38374. b += a >>> 16;
  38375. c += b >>> 16;
  38376. d += c >>> 16;
  38377. wh[j] = (c & 0xffff) | (d << 16);
  38378. wl[j] = (a & 0xffff) | (b << 16);
  38379. }
  38380. }
  38381. }
  38382. // add
  38383. h = ah0;
  38384. l = al0;
  38385. a = l & 0xffff; b = l >>> 16;
  38386. c = h & 0xffff; d = h >>> 16;
  38387. h = hh[0];
  38388. l = hl[0];
  38389. a += l & 0xffff; b += l >>> 16;
  38390. c += h & 0xffff; d += h >>> 16;
  38391. b += a >>> 16;
  38392. c += b >>> 16;
  38393. d += c >>> 16;
  38394. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  38395. hl[0] = al0 = (a & 0xffff) | (b << 16);
  38396. h = ah1;
  38397. l = al1;
  38398. a = l & 0xffff; b = l >>> 16;
  38399. c = h & 0xffff; d = h >>> 16;
  38400. h = hh[1];
  38401. l = hl[1];
  38402. a += l & 0xffff; b += l >>> 16;
  38403. c += h & 0xffff; d += h >>> 16;
  38404. b += a >>> 16;
  38405. c += b >>> 16;
  38406. d += c >>> 16;
  38407. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  38408. hl[1] = al1 = (a & 0xffff) | (b << 16);
  38409. h = ah2;
  38410. l = al2;
  38411. a = l & 0xffff; b = l >>> 16;
  38412. c = h & 0xffff; d = h >>> 16;
  38413. h = hh[2];
  38414. l = hl[2];
  38415. a += l & 0xffff; b += l >>> 16;
  38416. c += h & 0xffff; d += h >>> 16;
  38417. b += a >>> 16;
  38418. c += b >>> 16;
  38419. d += c >>> 16;
  38420. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  38421. hl[2] = al2 = (a & 0xffff) | (b << 16);
  38422. h = ah3;
  38423. l = al3;
  38424. a = l & 0xffff; b = l >>> 16;
  38425. c = h & 0xffff; d = h >>> 16;
  38426. h = hh[3];
  38427. l = hl[3];
  38428. a += l & 0xffff; b += l >>> 16;
  38429. c += h & 0xffff; d += h >>> 16;
  38430. b += a >>> 16;
  38431. c += b >>> 16;
  38432. d += c >>> 16;
  38433. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  38434. hl[3] = al3 = (a & 0xffff) | (b << 16);
  38435. h = ah4;
  38436. l = al4;
  38437. a = l & 0xffff; b = l >>> 16;
  38438. c = h & 0xffff; d = h >>> 16;
  38439. h = hh[4];
  38440. l = hl[4];
  38441. a += l & 0xffff; b += l >>> 16;
  38442. c += h & 0xffff; d += h >>> 16;
  38443. b += a >>> 16;
  38444. c += b >>> 16;
  38445. d += c >>> 16;
  38446. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  38447. hl[4] = al4 = (a & 0xffff) | (b << 16);
  38448. h = ah5;
  38449. l = al5;
  38450. a = l & 0xffff; b = l >>> 16;
  38451. c = h & 0xffff; d = h >>> 16;
  38452. h = hh[5];
  38453. l = hl[5];
  38454. a += l & 0xffff; b += l >>> 16;
  38455. c += h & 0xffff; d += h >>> 16;
  38456. b += a >>> 16;
  38457. c += b >>> 16;
  38458. d += c >>> 16;
  38459. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  38460. hl[5] = al5 = (a & 0xffff) | (b << 16);
  38461. h = ah6;
  38462. l = al6;
  38463. a = l & 0xffff; b = l >>> 16;
  38464. c = h & 0xffff; d = h >>> 16;
  38465. h = hh[6];
  38466. l = hl[6];
  38467. a += l & 0xffff; b += l >>> 16;
  38468. c += h & 0xffff; d += h >>> 16;
  38469. b += a >>> 16;
  38470. c += b >>> 16;
  38471. d += c >>> 16;
  38472. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  38473. hl[6] = al6 = (a & 0xffff) | (b << 16);
  38474. h = ah7;
  38475. l = al7;
  38476. a = l & 0xffff; b = l >>> 16;
  38477. c = h & 0xffff; d = h >>> 16;
  38478. h = hh[7];
  38479. l = hl[7];
  38480. a += l & 0xffff; b += l >>> 16;
  38481. c += h & 0xffff; d += h >>> 16;
  38482. b += a >>> 16;
  38483. c += b >>> 16;
  38484. d += c >>> 16;
  38485. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  38486. hl[7] = al7 = (a & 0xffff) | (b << 16);
  38487. pos += 128;
  38488. n -= 128;
  38489. }
  38490. return n;
  38491. }
  38492. function crypto_hash(out, m, n) {
  38493. var hh = new Int32Array(8),
  38494. hl = new Int32Array(8),
  38495. x = new Uint8Array(256),
  38496. i, b = n;
  38497. hh[0] = 0x6a09e667;
  38498. hh[1] = 0xbb67ae85;
  38499. hh[2] = 0x3c6ef372;
  38500. hh[3] = 0xa54ff53a;
  38501. hh[4] = 0x510e527f;
  38502. hh[5] = 0x9b05688c;
  38503. hh[6] = 0x1f83d9ab;
  38504. hh[7] = 0x5be0cd19;
  38505. hl[0] = 0xf3bcc908;
  38506. hl[1] = 0x84caa73b;
  38507. hl[2] = 0xfe94f82b;
  38508. hl[3] = 0x5f1d36f1;
  38509. hl[4] = 0xade682d1;
  38510. hl[5] = 0x2b3e6c1f;
  38511. hl[6] = 0xfb41bd6b;
  38512. hl[7] = 0x137e2179;
  38513. crypto_hashblocks_hl(hh, hl, m, n);
  38514. n %= 128;
  38515. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  38516. x[n] = 128;
  38517. n = 256-128*(n<112?1:0);
  38518. x[n-9] = 0;
  38519. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  38520. crypto_hashblocks_hl(hh, hl, x, n);
  38521. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  38522. return 0;
  38523. }
  38524. function add(p, q) {
  38525. var a = gf(), b = gf(), c = gf(),
  38526. d = gf(), e = gf(), f = gf(),
  38527. g = gf(), h = gf(), t = gf();
  38528. Z(a, p[1], p[0]);
  38529. Z(t, q[1], q[0]);
  38530. M(a, a, t);
  38531. A(b, p[0], p[1]);
  38532. A(t, q[0], q[1]);
  38533. M(b, b, t);
  38534. M(c, p[3], q[3]);
  38535. M(c, c, D2);
  38536. M(d, p[2], q[2]);
  38537. A(d, d, d);
  38538. Z(e, b, a);
  38539. Z(f, d, c);
  38540. A(g, d, c);
  38541. A(h, b, a);
  38542. M(p[0], e, f);
  38543. M(p[1], h, g);
  38544. M(p[2], g, f);
  38545. M(p[3], e, h);
  38546. }
  38547. function cswap(p, q, b) {
  38548. var i;
  38549. for (i = 0; i < 4; i++) {
  38550. sel25519(p[i], q[i], b);
  38551. }
  38552. }
  38553. function pack(r, p) {
  38554. var tx = gf(), ty = gf(), zi = gf();
  38555. inv25519(zi, p[2]);
  38556. M(tx, p[0], zi);
  38557. M(ty, p[1], zi);
  38558. pack25519(r, ty);
  38559. r[31] ^= par25519(tx) << 7;
  38560. }
  38561. function scalarmult(p, q, s) {
  38562. var b, i;
  38563. set25519(p[0], gf0);
  38564. set25519(p[1], gf1);
  38565. set25519(p[2], gf1);
  38566. set25519(p[3], gf0);
  38567. for (i = 255; i >= 0; --i) {
  38568. b = (s[(i/8)|0] >> (i&7)) & 1;
  38569. cswap(p, q, b);
  38570. add(q, p);
  38571. add(p, p);
  38572. cswap(p, q, b);
  38573. }
  38574. }
  38575. function scalarbase(p, s) {
  38576. var q = [gf(), gf(), gf(), gf()];
  38577. set25519(q[0], X);
  38578. set25519(q[1], Y);
  38579. set25519(q[2], gf1);
  38580. M(q[3], X, Y);
  38581. scalarmult(p, q, s);
  38582. }
  38583. function crypto_sign_keypair(pk, sk, seeded) {
  38584. var d = new Uint8Array(64);
  38585. var p = [gf(), gf(), gf(), gf()];
  38586. var i;
  38587. if (!seeded) randombytes(sk, 32);
  38588. crypto_hash(d, sk, 32);
  38589. d[0] &= 248;
  38590. d[31] &= 127;
  38591. d[31] |= 64;
  38592. scalarbase(p, d);
  38593. pack(pk, p);
  38594. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  38595. return 0;
  38596. }
  38597. 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]);
  38598. function modL(r, x) {
  38599. var carry, i, j, k;
  38600. for (i = 63; i >= 32; --i) {
  38601. carry = 0;
  38602. for (j = i - 32, k = i - 12; j < k; ++j) {
  38603. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  38604. carry = (x[j] + 128) >> 8;
  38605. x[j] -= carry * 256;
  38606. }
  38607. x[j] += carry;
  38608. x[i] = 0;
  38609. }
  38610. carry = 0;
  38611. for (j = 0; j < 32; j++) {
  38612. x[j] += carry - (x[31] >> 4) * L[j];
  38613. carry = x[j] >> 8;
  38614. x[j] &= 255;
  38615. }
  38616. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  38617. for (i = 0; i < 32; i++) {
  38618. x[i+1] += x[i] >> 8;
  38619. r[i] = x[i] & 255;
  38620. }
  38621. }
  38622. function reduce(r) {
  38623. var x = new Float64Array(64), i;
  38624. for (i = 0; i < 64; i++) x[i] = r[i];
  38625. for (i = 0; i < 64; i++) r[i] = 0;
  38626. modL(r, x);
  38627. }
  38628. // Note: difference from C - smlen returned, not passed as argument.
  38629. function crypto_sign(sm, m, n, sk) {
  38630. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  38631. var i, j, x = new Float64Array(64);
  38632. var p = [gf(), gf(), gf(), gf()];
  38633. crypto_hash(d, sk, 32);
  38634. d[0] &= 248;
  38635. d[31] &= 127;
  38636. d[31] |= 64;
  38637. var smlen = n + 64;
  38638. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  38639. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  38640. crypto_hash(r, sm.subarray(32), n+32);
  38641. reduce(r);
  38642. scalarbase(p, r);
  38643. pack(sm, p);
  38644. for (i = 32; i < 64; i++) sm[i] = sk[i];
  38645. crypto_hash(h, sm, n + 64);
  38646. reduce(h);
  38647. for (i = 0; i < 64; i++) x[i] = 0;
  38648. for (i = 0; i < 32; i++) x[i] = r[i];
  38649. for (i = 0; i < 32; i++) {
  38650. for (j = 0; j < 32; j++) {
  38651. x[i+j] += h[i] * d[j];
  38652. }
  38653. }
  38654. modL(sm.subarray(32), x);
  38655. return smlen;
  38656. }
  38657. function unpackneg(r, p) {
  38658. var t = gf(), chk = gf(), num = gf(),
  38659. den = gf(), den2 = gf(), den4 = gf(),
  38660. den6 = gf();
  38661. set25519(r[2], gf1);
  38662. unpack25519(r[1], p);
  38663. S(num, r[1]);
  38664. M(den, num, D);
  38665. Z(num, num, r[2]);
  38666. A(den, r[2], den);
  38667. S(den2, den);
  38668. S(den4, den2);
  38669. M(den6, den4, den2);
  38670. M(t, den6, num);
  38671. M(t, t, den);
  38672. pow2523(t, t);
  38673. M(t, t, num);
  38674. M(t, t, den);
  38675. M(t, t, den);
  38676. M(r[0], t, den);
  38677. S(chk, r[0]);
  38678. M(chk, chk, den);
  38679. if (neq25519(chk, num)) M(r[0], r[0], I);
  38680. S(chk, r[0]);
  38681. M(chk, chk, den);
  38682. if (neq25519(chk, num)) return -1;
  38683. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  38684. M(r[3], r[0], r[1]);
  38685. return 0;
  38686. }
  38687. function crypto_sign_open(m, sm, n, pk) {
  38688. var i, mlen;
  38689. var t = new Uint8Array(32), h = new Uint8Array(64);
  38690. var p = [gf(), gf(), gf(), gf()],
  38691. q = [gf(), gf(), gf(), gf()];
  38692. mlen = -1;
  38693. if (n < 64) return -1;
  38694. if (unpackneg(q, pk)) return -1;
  38695. for (i = 0; i < n; i++) m[i] = sm[i];
  38696. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  38697. crypto_hash(h, m, n);
  38698. reduce(h);
  38699. scalarmult(p, q, h);
  38700. scalarbase(q, sm.subarray(32));
  38701. add(p, q);
  38702. pack(t, p);
  38703. n -= 64;
  38704. if (crypto_verify_32(sm, 0, t, 0)) {
  38705. for (i = 0; i < n; i++) m[i] = 0;
  38706. return -1;
  38707. }
  38708. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  38709. mlen = n;
  38710. return mlen;
  38711. }
  38712. var crypto_secretbox_KEYBYTES = 32,
  38713. crypto_secretbox_NONCEBYTES = 24,
  38714. crypto_secretbox_ZEROBYTES = 32,
  38715. crypto_secretbox_BOXZEROBYTES = 16,
  38716. crypto_scalarmult_BYTES = 32,
  38717. crypto_scalarmult_SCALARBYTES = 32,
  38718. crypto_box_PUBLICKEYBYTES = 32,
  38719. crypto_box_SECRETKEYBYTES = 32,
  38720. crypto_box_BEFORENMBYTES = 32,
  38721. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  38722. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  38723. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  38724. crypto_sign_BYTES = 64,
  38725. crypto_sign_PUBLICKEYBYTES = 32,
  38726. crypto_sign_SECRETKEYBYTES = 64,
  38727. crypto_sign_SEEDBYTES = 32,
  38728. crypto_hash_BYTES = 64;
  38729. nacl.lowlevel = {
  38730. crypto_core_hsalsa20: crypto_core_hsalsa20,
  38731. crypto_stream_xor: crypto_stream_xor,
  38732. crypto_stream: crypto_stream,
  38733. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  38734. crypto_stream_salsa20: crypto_stream_salsa20,
  38735. crypto_onetimeauth: crypto_onetimeauth,
  38736. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  38737. crypto_verify_16: crypto_verify_16,
  38738. crypto_verify_32: crypto_verify_32,
  38739. crypto_secretbox: crypto_secretbox,
  38740. crypto_secretbox_open: crypto_secretbox_open,
  38741. crypto_scalarmult: crypto_scalarmult,
  38742. crypto_scalarmult_base: crypto_scalarmult_base,
  38743. crypto_box_beforenm: crypto_box_beforenm,
  38744. crypto_box_afternm: crypto_box_afternm,
  38745. crypto_box: crypto_box,
  38746. crypto_box_open: crypto_box_open,
  38747. crypto_box_keypair: crypto_box_keypair,
  38748. crypto_hash: crypto_hash,
  38749. crypto_sign: crypto_sign,
  38750. crypto_sign_keypair: crypto_sign_keypair,
  38751. crypto_sign_open: crypto_sign_open,
  38752. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  38753. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  38754. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  38755. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  38756. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  38757. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  38758. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  38759. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  38760. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  38761. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  38762. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  38763. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  38764. crypto_sign_BYTES: crypto_sign_BYTES,
  38765. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  38766. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  38767. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  38768. crypto_hash_BYTES: crypto_hash_BYTES
  38769. };
  38770. /* High-level API */
  38771. function checkLengths(k, n) {
  38772. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  38773. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  38774. }
  38775. function checkBoxLengths(pk, sk) {
  38776. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  38777. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  38778. }
  38779. function checkArrayTypes() {
  38780. for (var i = 0; i < arguments.length; i++) {
  38781. if (!(arguments[i] instanceof Uint8Array))
  38782. throw new TypeError('unexpected type, use Uint8Array');
  38783. }
  38784. }
  38785. function cleanup(arr) {
  38786. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  38787. }
  38788. nacl.randomBytes = function(n) {
  38789. var b = new Uint8Array(n);
  38790. randombytes(b, n);
  38791. return b;
  38792. };
  38793. nacl.secretbox = function(msg, nonce, key) {
  38794. checkArrayTypes(msg, nonce, key);
  38795. checkLengths(key, nonce);
  38796. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  38797. var c = new Uint8Array(m.length);
  38798. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  38799. crypto_secretbox(c, m, m.length, nonce, key);
  38800. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  38801. };
  38802. nacl.secretbox.open = function(box, nonce, key) {
  38803. checkArrayTypes(box, nonce, key);
  38804. checkLengths(key, nonce);
  38805. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  38806. var m = new Uint8Array(c.length);
  38807. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  38808. if (c.length < 32) return null;
  38809. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  38810. return m.subarray(crypto_secretbox_ZEROBYTES);
  38811. };
  38812. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  38813. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  38814. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  38815. nacl.scalarMult = function(n, p) {
  38816. checkArrayTypes(n, p);
  38817. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38818. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  38819. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38820. crypto_scalarmult(q, n, p);
  38821. return q;
  38822. };
  38823. nacl.scalarMult.base = function(n) {
  38824. checkArrayTypes(n);
  38825. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38826. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38827. crypto_scalarmult_base(q, n);
  38828. return q;
  38829. };
  38830. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  38831. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  38832. nacl.box = function(msg, nonce, publicKey, secretKey) {
  38833. var k = nacl.box.before(publicKey, secretKey);
  38834. return nacl.secretbox(msg, nonce, k);
  38835. };
  38836. nacl.box.before = function(publicKey, secretKey) {
  38837. checkArrayTypes(publicKey, secretKey);
  38838. checkBoxLengths(publicKey, secretKey);
  38839. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  38840. crypto_box_beforenm(k, publicKey, secretKey);
  38841. return k;
  38842. };
  38843. nacl.box.after = nacl.secretbox;
  38844. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  38845. var k = nacl.box.before(publicKey, secretKey);
  38846. return nacl.secretbox.open(msg, nonce, k);
  38847. };
  38848. nacl.box.open.after = nacl.secretbox.open;
  38849. nacl.box.keyPair = function() {
  38850. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38851. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  38852. crypto_box_keypair(pk, sk);
  38853. return {publicKey: pk, secretKey: sk};
  38854. };
  38855. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  38856. checkArrayTypes(secretKey);
  38857. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  38858. throw new Error('bad secret key size');
  38859. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38860. crypto_scalarmult_base(pk, secretKey);
  38861. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38862. };
  38863. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  38864. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  38865. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  38866. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  38867. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  38868. nacl.sign = function(msg, secretKey) {
  38869. checkArrayTypes(msg, secretKey);
  38870. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38871. throw new Error('bad secret key size');
  38872. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  38873. crypto_sign(signedMsg, msg, msg.length, secretKey);
  38874. return signedMsg;
  38875. };
  38876. nacl.sign.open = function(signedMsg, publicKey) {
  38877. checkArrayTypes(signedMsg, publicKey);
  38878. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38879. throw new Error('bad public key size');
  38880. var tmp = new Uint8Array(signedMsg.length);
  38881. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  38882. if (mlen < 0) return null;
  38883. var m = new Uint8Array(mlen);
  38884. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  38885. return m;
  38886. };
  38887. nacl.sign.detached = function(msg, secretKey) {
  38888. var signedMsg = nacl.sign(msg, secretKey);
  38889. var sig = new Uint8Array(crypto_sign_BYTES);
  38890. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  38891. return sig;
  38892. };
  38893. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  38894. checkArrayTypes(msg, sig, publicKey);
  38895. if (sig.length !== crypto_sign_BYTES)
  38896. throw new Error('bad signature size');
  38897. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38898. throw new Error('bad public key size');
  38899. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  38900. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  38901. var i;
  38902. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  38903. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  38904. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  38905. };
  38906. nacl.sign.keyPair = function() {
  38907. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38908. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38909. crypto_sign_keypair(pk, sk);
  38910. return {publicKey: pk, secretKey: sk};
  38911. };
  38912. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  38913. checkArrayTypes(secretKey);
  38914. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38915. throw new Error('bad secret key size');
  38916. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38917. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  38918. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38919. };
  38920. nacl.sign.keyPair.fromSeed = function(seed) {
  38921. checkArrayTypes(seed);
  38922. if (seed.length !== crypto_sign_SEEDBYTES)
  38923. throw new Error('bad seed size');
  38924. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38925. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38926. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  38927. crypto_sign_keypair(pk, sk, true);
  38928. return {publicKey: pk, secretKey: sk};
  38929. };
  38930. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  38931. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  38932. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  38933. nacl.sign.signatureLength = crypto_sign_BYTES;
  38934. nacl.hash = function(msg) {
  38935. checkArrayTypes(msg);
  38936. var h = new Uint8Array(crypto_hash_BYTES);
  38937. crypto_hash(h, msg, msg.length);
  38938. return h;
  38939. };
  38940. nacl.hash.hashLength = crypto_hash_BYTES;
  38941. nacl.verify = function(x, y) {
  38942. checkArrayTypes(x, y);
  38943. // Zero length arguments are considered not equal.
  38944. if (x.length === 0 || y.length === 0) return false;
  38945. if (x.length !== y.length) return false;
  38946. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  38947. };
  38948. nacl.setPRNG = function(fn) {
  38949. randombytes = fn;
  38950. };
  38951. (function() {
  38952. // Initialize PRNG if environment provides CSPRNG.
  38953. // If not, methods calling randombytes will throw.
  38954. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  38955. if (crypto && crypto.getRandomValues) {
  38956. // Browsers.
  38957. var QUOTA = 65536;
  38958. nacl.setPRNG(function(x, n) {
  38959. var i, v = new Uint8Array(n);
  38960. for (i = 0; i < n; i += QUOTA) {
  38961. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  38962. }
  38963. for (i = 0; i < n; i++) x[i] = v[i];
  38964. cleanup(v);
  38965. });
  38966. } else if (true) {
  38967. // Node.js.
  38968. crypto = __webpack_require__(3);
  38969. if (crypto && crypto.randomBytes) {
  38970. nacl.setPRNG(function(x, n) {
  38971. var i, v = crypto.randomBytes(n);
  38972. for (i = 0; i < n; i++) x[i] = v[i];
  38973. cleanup(v);
  38974. });
  38975. }
  38976. }
  38977. })();
  38978. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  38979. /***/ }),
  38980. /* 1 */
  38981. /***/ (function(module, exports, __webpack_require__) {
  38982. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  38983. // Public domain.
  38984. (function(root, f) {
  38985. 'use strict';
  38986. if ( true && module.exports) module.exports = f();
  38987. else if (root.nacl) root.nacl.util = f();
  38988. else {
  38989. root.nacl = {};
  38990. root.nacl.util = f();
  38991. }
  38992. }(this, function() {
  38993. 'use strict';
  38994. var util = {};
  38995. function validateBase64(s) {
  38996. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  38997. throw new TypeError('invalid encoding');
  38998. }
  38999. }
  39000. util.decodeUTF8 = function(s) {
  39001. if (typeof s !== 'string') throw new TypeError('expected string');
  39002. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  39003. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39004. return b;
  39005. };
  39006. util.encodeUTF8 = function(arr) {
  39007. var i, s = [];
  39008. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  39009. return decodeURIComponent(escape(s.join('')));
  39010. };
  39011. if (typeof atob === 'undefined') {
  39012. // Node.js
  39013. if (typeof Buffer.from !== 'undefined') {
  39014. // Node v6 and later
  39015. util.encodeBase64 = function (arr) { // v6 and later
  39016. return Buffer.from(arr).toString('base64');
  39017. };
  39018. util.decodeBase64 = function (s) {
  39019. validateBase64(s);
  39020. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  39021. };
  39022. } else {
  39023. // Node earlier than v6
  39024. util.encodeBase64 = function (arr) { // v6 and later
  39025. return (new Buffer(arr)).toString('base64');
  39026. };
  39027. util.decodeBase64 = function(s) {
  39028. validateBase64(s);
  39029. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  39030. };
  39031. }
  39032. } else {
  39033. // Browsers
  39034. util.encodeBase64 = function(arr) {
  39035. var i, s = [], len = arr.length;
  39036. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  39037. return btoa(s.join(''));
  39038. };
  39039. util.decodeBase64 = function(s) {
  39040. validateBase64(s);
  39041. var i, d = atob(s), b = new Uint8Array(d.length);
  39042. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39043. return b;
  39044. };
  39045. }
  39046. return util;
  39047. }));
  39048. /***/ }),
  39049. /* 2 */
  39050. /***/ (function(module, exports, __webpack_require__) {
  39051. // required so we don't have to do require('pusher').default etc.
  39052. module.exports = __webpack_require__(4).default;
  39053. /***/ }),
  39054. /* 3 */
  39055. /***/ (function(module, exports) {
  39056. /* (ignored) */
  39057. /***/ }),
  39058. /* 4 */
  39059. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  39060. "use strict";
  39061. __webpack_require__.r(__webpack_exports__);
  39062. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  39063. var ScriptReceiverFactory = (function () {
  39064. function ScriptReceiverFactory(prefix, name) {
  39065. this.lastId = 0;
  39066. this.prefix = prefix;
  39067. this.name = name;
  39068. }
  39069. ScriptReceiverFactory.prototype.create = function (callback) {
  39070. this.lastId++;
  39071. var number = this.lastId;
  39072. var id = this.prefix + number;
  39073. var name = this.name + "[" + number + "]";
  39074. var called = false;
  39075. var callbackWrapper = function () {
  39076. if (!called) {
  39077. callback.apply(null, arguments);
  39078. called = true;
  39079. }
  39080. };
  39081. this[number] = callbackWrapper;
  39082. return { number: number, id: id, name: name, callback: callbackWrapper };
  39083. };
  39084. ScriptReceiverFactory.prototype.remove = function (receiver) {
  39085. delete this[receiver.number];
  39086. };
  39087. return ScriptReceiverFactory;
  39088. }());
  39089. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  39090. // CONCATENATED MODULE: ./src/core/defaults.ts
  39091. var Defaults = {
  39092. VERSION: "5.0.3",
  39093. PROTOCOL: 7,
  39094. host: 'ws.pusherapp.com',
  39095. ws_port: 80,
  39096. wss_port: 443,
  39097. ws_path: '',
  39098. sockjs_host: 'sockjs.pusher.com',
  39099. sockjs_http_port: 80,
  39100. sockjs_https_port: 443,
  39101. sockjs_path: '/pusher',
  39102. stats_host: 'stats.pusher.com',
  39103. channel_auth_endpoint: '/pusher/auth',
  39104. channel_auth_transport: 'ajax',
  39105. activity_timeout: 120000,
  39106. pong_timeout: 30000,
  39107. unavailable_timeout: 10000,
  39108. cdn_http: "http://js.pusher.com",
  39109. cdn_https: "https://js.pusher.com",
  39110. dependency_suffix: ""
  39111. };
  39112. /* harmony default export */ var defaults = (Defaults);
  39113. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  39114. var dependency_loader_DependencyLoader = (function () {
  39115. function DependencyLoader(options) {
  39116. this.options = options;
  39117. this.receivers = options.receivers || ScriptReceivers;
  39118. this.loading = {};
  39119. }
  39120. DependencyLoader.prototype.load = function (name, options, callback) {
  39121. var self = this;
  39122. if (self.loading[name] && self.loading[name].length > 0) {
  39123. self.loading[name].push(callback);
  39124. }
  39125. else {
  39126. self.loading[name] = [callback];
  39127. var request = runtime.createScriptRequest(self.getPath(name, options));
  39128. var receiver = self.receivers.create(function (error) {
  39129. self.receivers.remove(receiver);
  39130. if (self.loading[name]) {
  39131. var callbacks = self.loading[name];
  39132. delete self.loading[name];
  39133. var successCallback = function (wasSuccessful) {
  39134. if (!wasSuccessful) {
  39135. request.cleanup();
  39136. }
  39137. };
  39138. for (var i = 0; i < callbacks.length; i++) {
  39139. callbacks[i](error, successCallback);
  39140. }
  39141. }
  39142. });
  39143. request.send(receiver);
  39144. }
  39145. };
  39146. DependencyLoader.prototype.getRoot = function (options) {
  39147. var cdn;
  39148. var protocol = runtime.getDocument().location.protocol;
  39149. if ((options && options.useTLS) || protocol === "https:") {
  39150. cdn = this.options.cdn_https;
  39151. }
  39152. else {
  39153. cdn = this.options.cdn_http;
  39154. }
  39155. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  39156. };
  39157. DependencyLoader.prototype.getPath = function (name, options) {
  39158. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  39159. };
  39160. ;
  39161. return DependencyLoader;
  39162. }());
  39163. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  39164. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  39165. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  39166. var Dependencies = new dependency_loader({
  39167. cdn_http: defaults.cdn_http,
  39168. cdn_https: defaults.cdn_https,
  39169. version: defaults.VERSION,
  39170. suffix: defaults.dependency_suffix,
  39171. receivers: DependenciesReceivers
  39172. });
  39173. // CONCATENATED MODULE: ./src/core/base64.ts
  39174. function encode(s) {
  39175. return btoa(utob(s));
  39176. }
  39177. var fromCharCode = String.fromCharCode;
  39178. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  39179. var b64tab = {};
  39180. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  39181. b64tab[b64chars.charAt(base64_i)] = base64_i;
  39182. }
  39183. var cb_utob = function (c) {
  39184. var cc = c.charCodeAt(0);
  39185. return cc < 0x80
  39186. ? c
  39187. : cc < 0x800
  39188. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  39189. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  39190. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  39191. fromCharCode(0x80 | (cc & 0x3f));
  39192. };
  39193. var utob = function (u) {
  39194. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  39195. };
  39196. var cb_encode = function (ccc) {
  39197. var padlen = [0, 2, 1][ccc.length % 3];
  39198. var ord = (ccc.charCodeAt(0) << 16) |
  39199. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  39200. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  39201. var chars = [
  39202. b64chars.charAt(ord >>> 18),
  39203. b64chars.charAt((ord >>> 12) & 63),
  39204. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  39205. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  39206. ];
  39207. return chars.join('');
  39208. };
  39209. var btoa = window.btoa ||
  39210. function (b) {
  39211. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  39212. };
  39213. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  39214. var Timer = (function () {
  39215. function Timer(set, clear, delay, callback) {
  39216. var _this = this;
  39217. this.clear = clear;
  39218. this.timer = set(function () {
  39219. if (_this.timer) {
  39220. _this.timer = callback(_this.timer);
  39221. }
  39222. }, delay);
  39223. }
  39224. Timer.prototype.isRunning = function () {
  39225. return this.timer !== null;
  39226. };
  39227. Timer.prototype.ensureAborted = function () {
  39228. if (this.timer) {
  39229. this.clear(this.timer);
  39230. this.timer = null;
  39231. }
  39232. };
  39233. return Timer;
  39234. }());
  39235. /* harmony default export */ var abstract_timer = (Timer);
  39236. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  39237. var __extends = (undefined && undefined.__extends) || (function () {
  39238. var extendStatics = function (d, b) {
  39239. extendStatics = Object.setPrototypeOf ||
  39240. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39241. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39242. return extendStatics(d, b);
  39243. };
  39244. return function (d, b) {
  39245. extendStatics(d, b);
  39246. function __() { this.constructor = d; }
  39247. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39248. };
  39249. })();
  39250. function timers_clearTimeout(timer) {
  39251. window.clearTimeout(timer);
  39252. }
  39253. function timers_clearInterval(timer) {
  39254. window.clearInterval(timer);
  39255. }
  39256. var OneOffTimer = (function (_super) {
  39257. __extends(OneOffTimer, _super);
  39258. function OneOffTimer(delay, callback) {
  39259. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  39260. callback();
  39261. return null;
  39262. }) || this;
  39263. }
  39264. return OneOffTimer;
  39265. }(abstract_timer));
  39266. var PeriodicTimer = (function (_super) {
  39267. __extends(PeriodicTimer, _super);
  39268. function PeriodicTimer(delay, callback) {
  39269. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  39270. callback();
  39271. return timer;
  39272. }) || this;
  39273. }
  39274. return PeriodicTimer;
  39275. }(abstract_timer));
  39276. // CONCATENATED MODULE: ./src/core/util.ts
  39277. var Util = {
  39278. now: function () {
  39279. if (Date.now) {
  39280. return Date.now();
  39281. }
  39282. else {
  39283. return new Date().valueOf();
  39284. }
  39285. },
  39286. defer: function (callback) {
  39287. return new OneOffTimer(0, callback);
  39288. },
  39289. method: function (name) {
  39290. var args = [];
  39291. for (var _i = 1; _i < arguments.length; _i++) {
  39292. args[_i - 1] = arguments[_i];
  39293. }
  39294. var boundArguments = Array.prototype.slice.call(arguments, 1);
  39295. return function (object) {
  39296. return object[name].apply(object, boundArguments.concat(arguments));
  39297. };
  39298. }
  39299. };
  39300. /* harmony default export */ var util = (Util);
  39301. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  39302. function extend(target) {
  39303. var sources = [];
  39304. for (var _i = 1; _i < arguments.length; _i++) {
  39305. sources[_i - 1] = arguments[_i];
  39306. }
  39307. for (var i = 0; i < sources.length; i++) {
  39308. var extensions = sources[i];
  39309. for (var property in extensions) {
  39310. if (extensions[property] && extensions[property].constructor &&
  39311. extensions[property].constructor === Object) {
  39312. target[property] = extend(target[property] || {}, extensions[property]);
  39313. }
  39314. else {
  39315. target[property] = extensions[property];
  39316. }
  39317. }
  39318. }
  39319. return target;
  39320. }
  39321. function stringify() {
  39322. var m = ["Pusher"];
  39323. for (var i = 0; i < arguments.length; i++) {
  39324. if (typeof arguments[i] === "string") {
  39325. m.push(arguments[i]);
  39326. }
  39327. else {
  39328. m.push(safeJSONStringify(arguments[i]));
  39329. }
  39330. }
  39331. return m.join(" : ");
  39332. }
  39333. function arrayIndexOf(array, item) {
  39334. var nativeIndexOf = Array.prototype.indexOf;
  39335. if (array === null) {
  39336. return -1;
  39337. }
  39338. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  39339. return array.indexOf(item);
  39340. }
  39341. for (var i = 0, l = array.length; i < l; i++) {
  39342. if (array[i] === item) {
  39343. return i;
  39344. }
  39345. }
  39346. return -1;
  39347. }
  39348. function objectApply(object, f) {
  39349. for (var key in object) {
  39350. if (Object.prototype.hasOwnProperty.call(object, key)) {
  39351. f(object[key], key, object);
  39352. }
  39353. }
  39354. }
  39355. function keys(object) {
  39356. var keys = [];
  39357. objectApply(object, function (_, key) {
  39358. keys.push(key);
  39359. });
  39360. return keys;
  39361. }
  39362. function values(object) {
  39363. var values = [];
  39364. objectApply(object, function (value) {
  39365. values.push(value);
  39366. });
  39367. return values;
  39368. }
  39369. function apply(array, f, context) {
  39370. for (var i = 0; i < array.length; i++) {
  39371. f.call(context || window, array[i], i, array);
  39372. }
  39373. }
  39374. function map(array, f) {
  39375. var result = [];
  39376. for (var i = 0; i < array.length; i++) {
  39377. result.push(f(array[i], i, array, result));
  39378. }
  39379. return result;
  39380. }
  39381. function mapObject(object, f) {
  39382. var result = {};
  39383. objectApply(object, function (value, key) {
  39384. result[key] = f(value);
  39385. });
  39386. return result;
  39387. }
  39388. function filter(array, test) {
  39389. test = test || function (value) { return !!value; };
  39390. var result = [];
  39391. for (var i = 0; i < array.length; i++) {
  39392. if (test(array[i], i, array, result)) {
  39393. result.push(array[i]);
  39394. }
  39395. }
  39396. return result;
  39397. }
  39398. function filterObject(object, test) {
  39399. var result = {};
  39400. objectApply(object, function (value, key) {
  39401. if ((test && test(value, key, object, result)) || Boolean(value)) {
  39402. result[key] = value;
  39403. }
  39404. });
  39405. return result;
  39406. }
  39407. function flatten(object) {
  39408. var result = [];
  39409. objectApply(object, function (value, key) {
  39410. result.push([key, value]);
  39411. });
  39412. return result;
  39413. }
  39414. function any(array, test) {
  39415. for (var i = 0; i < array.length; i++) {
  39416. if (test(array[i], i, array)) {
  39417. return true;
  39418. }
  39419. }
  39420. return false;
  39421. }
  39422. function collections_all(array, test) {
  39423. for (var i = 0; i < array.length; i++) {
  39424. if (!test(array[i], i, array)) {
  39425. return false;
  39426. }
  39427. }
  39428. return true;
  39429. }
  39430. function encodeParamsObject(data) {
  39431. return mapObject(data, function (value) {
  39432. if (typeof value === "object") {
  39433. value = safeJSONStringify(value);
  39434. }
  39435. return encodeURIComponent(encode(value.toString()));
  39436. });
  39437. }
  39438. function buildQueryString(data) {
  39439. var params = filterObject(data, function (value) {
  39440. return value !== undefined;
  39441. });
  39442. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  39443. return query;
  39444. }
  39445. function decycleObject(object) {
  39446. var objects = [], paths = [];
  39447. return (function derez(value, path) {
  39448. var i, name, nu;
  39449. switch (typeof value) {
  39450. case 'object':
  39451. if (!value) {
  39452. return null;
  39453. }
  39454. for (i = 0; i < objects.length; i += 1) {
  39455. if (objects[i] === value) {
  39456. return { $ref: paths[i] };
  39457. }
  39458. }
  39459. objects.push(value);
  39460. paths.push(path);
  39461. if (Object.prototype.toString.apply(value) === '[object Array]') {
  39462. nu = [];
  39463. for (i = 0; i < value.length; i += 1) {
  39464. nu[i] = derez(value[i], path + '[' + i + ']');
  39465. }
  39466. }
  39467. else {
  39468. nu = {};
  39469. for (name in value) {
  39470. if (Object.prototype.hasOwnProperty.call(value, name)) {
  39471. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  39472. }
  39473. }
  39474. }
  39475. return nu;
  39476. case 'number':
  39477. case 'string':
  39478. case 'boolean':
  39479. return value;
  39480. }
  39481. }(object, '$'));
  39482. }
  39483. function safeJSONStringify(source) {
  39484. try {
  39485. return JSON.stringify(source);
  39486. }
  39487. catch (e) {
  39488. return JSON.stringify(decycleObject(source));
  39489. }
  39490. }
  39491. // CONCATENATED MODULE: ./src/core/logger.ts
  39492. var logger_Logger = (function () {
  39493. function Logger() {
  39494. this.globalLog = function (message) {
  39495. if (window.console && window.console.log) {
  39496. window.console.log(message);
  39497. }
  39498. };
  39499. }
  39500. Logger.prototype.debug = function () {
  39501. var args = [];
  39502. for (var _i = 0; _i < arguments.length; _i++) {
  39503. args[_i] = arguments[_i];
  39504. }
  39505. this.log(this.globalLog, args);
  39506. };
  39507. Logger.prototype.warn = function () {
  39508. var args = [];
  39509. for (var _i = 0; _i < arguments.length; _i++) {
  39510. args[_i] = arguments[_i];
  39511. }
  39512. this.log(this.globalLogWarn, args);
  39513. };
  39514. Logger.prototype.error = function () {
  39515. var args = [];
  39516. for (var _i = 0; _i < arguments.length; _i++) {
  39517. args[_i] = arguments[_i];
  39518. }
  39519. this.log(this.globalLogError, args);
  39520. };
  39521. Logger.prototype.globalLogWarn = function (message) {
  39522. if (window.console && window.console.warn) {
  39523. window.console.warn(message);
  39524. }
  39525. else {
  39526. this.globalLog(message);
  39527. }
  39528. };
  39529. Logger.prototype.globalLogError = function (message) {
  39530. if (window.console && window.console.error) {
  39531. window.console.error(message);
  39532. }
  39533. else {
  39534. this.globalLogWarn(message);
  39535. }
  39536. };
  39537. Logger.prototype.log = function (defaultLoggingFunction) {
  39538. var args = [];
  39539. for (var _i = 1; _i < arguments.length; _i++) {
  39540. args[_i - 1] = arguments[_i];
  39541. }
  39542. var message = stringify.apply(this, arguments);
  39543. if (core_pusher.log) {
  39544. core_pusher.log(message);
  39545. }
  39546. else if (core_pusher.logToConsole) {
  39547. var log = defaultLoggingFunction.bind(this);
  39548. log(message);
  39549. }
  39550. };
  39551. return Logger;
  39552. }());
  39553. /* harmony default export */ var logger = (new logger_Logger());
  39554. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  39555. var urlStore = {
  39556. baseUrl: "https://pusher.com",
  39557. urls: {
  39558. authenticationEndpoint: {
  39559. path: "/docs/authenticating_users",
  39560. },
  39561. javascriptQuickStart: {
  39562. path: "/docs/javascript_quick_start"
  39563. },
  39564. triggeringClientEvents: {
  39565. path: "/docs/client_api_guide/client_events#trigger-events"
  39566. }
  39567. }
  39568. };
  39569. var buildLogSuffix = function (key) {
  39570. var urlPrefix = "See:";
  39571. var urlObj = urlStore.urls[key];
  39572. if (!urlObj)
  39573. return "";
  39574. var url;
  39575. if (urlObj.fullUrl) {
  39576. url = urlObj.fullUrl;
  39577. }
  39578. else if (urlObj.path) {
  39579. url = urlStore.baseUrl + urlObj.path;
  39580. }
  39581. if (!url)
  39582. return "";
  39583. return urlPrefix + " " + url;
  39584. };
  39585. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  39586. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  39587. var ajax = function (context, socketId, callback) {
  39588. var self = this, xhr;
  39589. xhr = runtime.createXHR();
  39590. xhr.open("POST", self.options.authEndpoint, true);
  39591. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  39592. for (var headerName in this.authOptions.headers) {
  39593. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  39594. }
  39595. xhr.onreadystatechange = function () {
  39596. if (xhr.readyState === 4) {
  39597. if (xhr.status === 200) {
  39598. var data, parsed = false;
  39599. try {
  39600. data = JSON.parse(xhr.responseText);
  39601. parsed = true;
  39602. }
  39603. catch (e) {
  39604. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  39605. }
  39606. if (parsed) {
  39607. callback(false, data);
  39608. }
  39609. }
  39610. else {
  39611. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  39612. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  39613. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  39614. ("Clients must be authenticated to join private or presence channels. " + suffix));
  39615. callback(true, xhr.status);
  39616. }
  39617. }
  39618. };
  39619. xhr.send(this.composeQuery(socketId));
  39620. return xhr;
  39621. };
  39622. /* harmony default export */ var xhr_auth = (ajax);
  39623. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  39624. var jsonp = function (context, socketId, callback) {
  39625. if (this.authOptions.headers !== undefined) {
  39626. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  39627. }
  39628. var callbackName = context.nextAuthCallbackID.toString();
  39629. context.nextAuthCallbackID++;
  39630. var document = context.getDocument();
  39631. var script = document.createElement("script");
  39632. context.auth_callbacks[callbackName] = function (data) {
  39633. callback(false, data);
  39634. };
  39635. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  39636. script.src = this.options.authEndpoint +
  39637. '?callback=' +
  39638. encodeURIComponent(callback_name) +
  39639. '&' +
  39640. this.composeQuery(socketId);
  39641. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  39642. head.insertBefore(script, head.firstChild);
  39643. };
  39644. /* harmony default export */ var jsonp_auth = (jsonp);
  39645. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  39646. var ScriptRequest = (function () {
  39647. function ScriptRequest(src) {
  39648. this.src = src;
  39649. }
  39650. ScriptRequest.prototype.send = function (receiver) {
  39651. var self = this;
  39652. var errorString = "Error loading " + self.src;
  39653. self.script = document.createElement("script");
  39654. self.script.id = receiver.id;
  39655. self.script.src = self.src;
  39656. self.script.type = "text/javascript";
  39657. self.script.charset = "UTF-8";
  39658. if (self.script.addEventListener) {
  39659. self.script.onerror = function () {
  39660. receiver.callback(errorString);
  39661. };
  39662. self.script.onload = function () {
  39663. receiver.callback(null);
  39664. };
  39665. }
  39666. else {
  39667. self.script.onreadystatechange = function () {
  39668. if (self.script.readyState === 'loaded' ||
  39669. self.script.readyState === 'complete') {
  39670. receiver.callback(null);
  39671. }
  39672. };
  39673. }
  39674. if (self.script.async === undefined && document.attachEvent &&
  39675. /opera/i.test(navigator.userAgent)) {
  39676. self.errorScript = document.createElement("script");
  39677. self.errorScript.id = receiver.id + "_error";
  39678. self.errorScript.text = receiver.name + "('" + errorString + "');";
  39679. self.script.async = self.errorScript.async = false;
  39680. }
  39681. else {
  39682. self.script.async = true;
  39683. }
  39684. var head = document.getElementsByTagName('head')[0];
  39685. head.insertBefore(self.script, head.firstChild);
  39686. if (self.errorScript) {
  39687. head.insertBefore(self.errorScript, self.script.nextSibling);
  39688. }
  39689. };
  39690. ScriptRequest.prototype.cleanup = function () {
  39691. if (this.script) {
  39692. this.script.onload = this.script.onerror = null;
  39693. this.script.onreadystatechange = null;
  39694. }
  39695. if (this.script && this.script.parentNode) {
  39696. this.script.parentNode.removeChild(this.script);
  39697. }
  39698. if (this.errorScript && this.errorScript.parentNode) {
  39699. this.errorScript.parentNode.removeChild(this.errorScript);
  39700. }
  39701. this.script = null;
  39702. this.errorScript = null;
  39703. };
  39704. return ScriptRequest;
  39705. }());
  39706. /* harmony default export */ var script_request = (ScriptRequest);
  39707. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  39708. var jsonp_request_JSONPRequest = (function () {
  39709. function JSONPRequest(url, data) {
  39710. this.url = url;
  39711. this.data = data;
  39712. }
  39713. JSONPRequest.prototype.send = function (receiver) {
  39714. if (this.request) {
  39715. return;
  39716. }
  39717. var query = buildQueryString(this.data);
  39718. var url = this.url + "/" + receiver.number + "?" + query;
  39719. this.request = runtime.createScriptRequest(url);
  39720. this.request.send(receiver);
  39721. };
  39722. JSONPRequest.prototype.cleanup = function () {
  39723. if (this.request) {
  39724. this.request.cleanup();
  39725. }
  39726. };
  39727. return JSONPRequest;
  39728. }());
  39729. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  39730. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  39731. var getAgent = function (sender, useTLS) {
  39732. return function (data, callback) {
  39733. var scheme = "http" + (useTLS ? "s" : "") + "://";
  39734. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  39735. var request = runtime.createJSONPRequest(url, data);
  39736. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  39737. ScriptReceivers.remove(receiver);
  39738. request.cleanup();
  39739. if (result && result.host) {
  39740. sender.host = result.host;
  39741. }
  39742. if (callback) {
  39743. callback(error, result);
  39744. }
  39745. });
  39746. request.send(receiver);
  39747. };
  39748. };
  39749. var jsonp_timeline_jsonp = {
  39750. name: 'jsonp',
  39751. getAgent: getAgent
  39752. };
  39753. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  39754. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  39755. function getGenericURL(baseScheme, params, path) {
  39756. var scheme = baseScheme + (params.useTLS ? "s" : "");
  39757. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  39758. return scheme + "://" + host + path;
  39759. }
  39760. function getGenericPath(key, queryString) {
  39761. var path = "/app/" + key;
  39762. var query = "?protocol=" + defaults.PROTOCOL +
  39763. "&client=js" +
  39764. "&version=" + defaults.VERSION +
  39765. (queryString ? ("&" + queryString) : "");
  39766. return path + query;
  39767. }
  39768. var ws = {
  39769. getInitial: function (key, params) {
  39770. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  39771. return getGenericURL("ws", params, path);
  39772. }
  39773. };
  39774. var http = {
  39775. getInitial: function (key, params) {
  39776. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  39777. return getGenericURL("http", params, path);
  39778. }
  39779. };
  39780. var sockjs = {
  39781. getInitial: function (key, params) {
  39782. return getGenericURL("http", params, params.httpPath || "/pusher");
  39783. },
  39784. getPath: function (key, params) {
  39785. return getGenericPath(key);
  39786. }
  39787. };
  39788. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  39789. var callback_registry_CallbackRegistry = (function () {
  39790. function CallbackRegistry() {
  39791. this._callbacks = {};
  39792. }
  39793. CallbackRegistry.prototype.get = function (name) {
  39794. return this._callbacks[prefix(name)];
  39795. };
  39796. CallbackRegistry.prototype.add = function (name, callback, context) {
  39797. var prefixedEventName = prefix(name);
  39798. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  39799. this._callbacks[prefixedEventName].push({
  39800. fn: callback,
  39801. context: context
  39802. });
  39803. };
  39804. CallbackRegistry.prototype.remove = function (name, callback, context) {
  39805. if (!name && !callback && !context) {
  39806. this._callbacks = {};
  39807. return;
  39808. }
  39809. var names = name ? [prefix(name)] : keys(this._callbacks);
  39810. if (callback || context) {
  39811. this.removeCallback(names, callback, context);
  39812. }
  39813. else {
  39814. this.removeAllCallbacks(names);
  39815. }
  39816. };
  39817. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  39818. apply(names, function (name) {
  39819. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  39820. return (callback && callback !== binding.fn) ||
  39821. (context && context !== binding.context);
  39822. });
  39823. if (this._callbacks[name].length === 0) {
  39824. delete this._callbacks[name];
  39825. }
  39826. }, this);
  39827. };
  39828. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  39829. apply(names, function (name) {
  39830. delete this._callbacks[name];
  39831. }, this);
  39832. };
  39833. return CallbackRegistry;
  39834. }());
  39835. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  39836. function prefix(name) {
  39837. return "_" + name;
  39838. }
  39839. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  39840. var dispatcher_Dispatcher = (function () {
  39841. function Dispatcher(failThrough) {
  39842. this.callbacks = new callback_registry();
  39843. this.global_callbacks = [];
  39844. this.failThrough = failThrough;
  39845. }
  39846. Dispatcher.prototype.bind = function (eventName, callback, context) {
  39847. this.callbacks.add(eventName, callback, context);
  39848. return this;
  39849. };
  39850. Dispatcher.prototype.bind_global = function (callback) {
  39851. this.global_callbacks.push(callback);
  39852. return this;
  39853. };
  39854. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  39855. this.callbacks.remove(eventName, callback, context);
  39856. return this;
  39857. };
  39858. Dispatcher.prototype.unbind_global = function (callback) {
  39859. if (!callback) {
  39860. this.global_callbacks = [];
  39861. return this;
  39862. }
  39863. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  39864. return this;
  39865. };
  39866. Dispatcher.prototype.unbind_all = function () {
  39867. this.unbind();
  39868. this.unbind_global();
  39869. return this;
  39870. };
  39871. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  39872. for (var i = 0; i < this.global_callbacks.length; i++) {
  39873. this.global_callbacks[i](eventName, data);
  39874. }
  39875. var callbacks = this.callbacks.get(eventName);
  39876. var args = [];
  39877. if (metadata) {
  39878. args.push(data, metadata);
  39879. }
  39880. else if (data) {
  39881. args.push(data);
  39882. }
  39883. if (callbacks && callbacks.length > 0) {
  39884. for (var i = 0; i < callbacks.length; i++) {
  39885. callbacks[i].fn.apply(callbacks[i].context || window, args);
  39886. }
  39887. }
  39888. else if (this.failThrough) {
  39889. this.failThrough(eventName, data);
  39890. }
  39891. return this;
  39892. };
  39893. return Dispatcher;
  39894. }());
  39895. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  39896. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  39897. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  39898. var extendStatics = function (d, b) {
  39899. extendStatics = Object.setPrototypeOf ||
  39900. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39901. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39902. return extendStatics(d, b);
  39903. };
  39904. return function (d, b) {
  39905. extendStatics(d, b);
  39906. function __() { this.constructor = d; }
  39907. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39908. };
  39909. })();
  39910. var transport_connection_TransportConnection = (function (_super) {
  39911. transport_connection_extends(TransportConnection, _super);
  39912. function TransportConnection(hooks, name, priority, key, options) {
  39913. var _this = _super.call(this) || this;
  39914. _this.initialize = runtime.transportConnectionInitializer;
  39915. _this.hooks = hooks;
  39916. _this.name = name;
  39917. _this.priority = priority;
  39918. _this.key = key;
  39919. _this.options = options;
  39920. _this.state = "new";
  39921. _this.timeline = options.timeline;
  39922. _this.activityTimeout = options.activityTimeout;
  39923. _this.id = _this.timeline.generateUniqueID();
  39924. return _this;
  39925. }
  39926. TransportConnection.prototype.handlesActivityChecks = function () {
  39927. return Boolean(this.hooks.handlesActivityChecks);
  39928. };
  39929. TransportConnection.prototype.supportsPing = function () {
  39930. return Boolean(this.hooks.supportsPing);
  39931. };
  39932. TransportConnection.prototype.connect = function () {
  39933. var _this = this;
  39934. if (this.socket || this.state !== "initialized") {
  39935. return false;
  39936. }
  39937. var url = this.hooks.urls.getInitial(this.key, this.options);
  39938. try {
  39939. this.socket = this.hooks.getSocket(url, this.options);
  39940. }
  39941. catch (e) {
  39942. util.defer(function () {
  39943. _this.onError(e);
  39944. _this.changeState("closed");
  39945. });
  39946. return false;
  39947. }
  39948. this.bindListeners();
  39949. logger.debug("Connecting", { transport: this.name, url: url });
  39950. this.changeState("connecting");
  39951. return true;
  39952. };
  39953. TransportConnection.prototype.close = function () {
  39954. if (this.socket) {
  39955. this.socket.close();
  39956. return true;
  39957. }
  39958. else {
  39959. return false;
  39960. }
  39961. };
  39962. TransportConnection.prototype.send = function (data) {
  39963. var _this = this;
  39964. if (this.state === "open") {
  39965. util.defer(function () {
  39966. if (_this.socket) {
  39967. _this.socket.send(data);
  39968. }
  39969. });
  39970. return true;
  39971. }
  39972. else {
  39973. return false;
  39974. }
  39975. };
  39976. TransportConnection.prototype.ping = function () {
  39977. if (this.state === "open" && this.supportsPing()) {
  39978. this.socket.ping();
  39979. }
  39980. };
  39981. TransportConnection.prototype.onOpen = function () {
  39982. if (this.hooks.beforeOpen) {
  39983. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  39984. }
  39985. this.changeState("open");
  39986. this.socket.onopen = undefined;
  39987. };
  39988. TransportConnection.prototype.onError = function (error) {
  39989. this.emit("error", { type: 'WebSocketError', error: error });
  39990. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  39991. };
  39992. TransportConnection.prototype.onClose = function (closeEvent) {
  39993. if (closeEvent) {
  39994. this.changeState("closed", {
  39995. code: closeEvent.code,
  39996. reason: closeEvent.reason,
  39997. wasClean: closeEvent.wasClean
  39998. });
  39999. }
  40000. else {
  40001. this.changeState("closed");
  40002. }
  40003. this.unbindListeners();
  40004. this.socket = undefined;
  40005. };
  40006. TransportConnection.prototype.onMessage = function (message) {
  40007. this.emit("message", message);
  40008. };
  40009. TransportConnection.prototype.onActivity = function () {
  40010. this.emit("activity");
  40011. };
  40012. TransportConnection.prototype.bindListeners = function () {
  40013. var _this = this;
  40014. this.socket.onopen = function () {
  40015. _this.onOpen();
  40016. };
  40017. this.socket.onerror = function (error) {
  40018. _this.onError(error);
  40019. };
  40020. this.socket.onclose = function (closeEvent) {
  40021. _this.onClose(closeEvent);
  40022. };
  40023. this.socket.onmessage = function (message) {
  40024. _this.onMessage(message);
  40025. };
  40026. if (this.supportsPing()) {
  40027. this.socket.onactivity = function () { _this.onActivity(); };
  40028. }
  40029. };
  40030. TransportConnection.prototype.unbindListeners = function () {
  40031. if (this.socket) {
  40032. this.socket.onopen = undefined;
  40033. this.socket.onerror = undefined;
  40034. this.socket.onclose = undefined;
  40035. this.socket.onmessage = undefined;
  40036. if (this.supportsPing()) {
  40037. this.socket.onactivity = undefined;
  40038. }
  40039. }
  40040. };
  40041. TransportConnection.prototype.changeState = function (state, params) {
  40042. this.state = state;
  40043. this.timeline.info(this.buildTimelineMessage({
  40044. state: state,
  40045. params: params
  40046. }));
  40047. this.emit(state, params);
  40048. };
  40049. TransportConnection.prototype.buildTimelineMessage = function (message) {
  40050. return extend({ cid: this.id }, message);
  40051. };
  40052. return TransportConnection;
  40053. }(dispatcher));
  40054. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  40055. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  40056. var transport_Transport = (function () {
  40057. function Transport(hooks) {
  40058. this.hooks = hooks;
  40059. }
  40060. Transport.prototype.isSupported = function (environment) {
  40061. return this.hooks.isSupported(environment);
  40062. };
  40063. Transport.prototype.createConnection = function (name, priority, key, options) {
  40064. return new transport_connection(this.hooks, name, priority, key, options);
  40065. };
  40066. return Transport;
  40067. }());
  40068. /* harmony default export */ var transports_transport = (transport_Transport);
  40069. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  40070. var WSTransport = new transports_transport({
  40071. urls: ws,
  40072. handlesActivityChecks: false,
  40073. supportsPing: false,
  40074. isInitialized: function () {
  40075. return Boolean(runtime.getWebSocketAPI());
  40076. },
  40077. isSupported: function () {
  40078. return Boolean(runtime.getWebSocketAPI());
  40079. },
  40080. getSocket: function (url) {
  40081. return runtime.createWebSocket(url);
  40082. }
  40083. });
  40084. var httpConfiguration = {
  40085. urls: http,
  40086. handlesActivityChecks: false,
  40087. supportsPing: true,
  40088. isInitialized: function () {
  40089. return true;
  40090. }
  40091. };
  40092. var streamingConfiguration = extend({ getSocket: function (url) {
  40093. return runtime.HTTPFactory.createStreamingSocket(url);
  40094. }
  40095. }, httpConfiguration);
  40096. var pollingConfiguration = extend({ getSocket: function (url) {
  40097. return runtime.HTTPFactory.createPollingSocket(url);
  40098. }
  40099. }, httpConfiguration);
  40100. var xhrConfiguration = {
  40101. isSupported: function () {
  40102. return runtime.isXHRSupported();
  40103. }
  40104. };
  40105. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  40106. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  40107. var Transports = {
  40108. ws: WSTransport,
  40109. xhr_streaming: XHRStreamingTransport,
  40110. xhr_polling: XHRPollingTransport
  40111. };
  40112. /* harmony default export */ var transports = (Transports);
  40113. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  40114. var SockJSTransport = new transports_transport({
  40115. file: "sockjs",
  40116. urls: sockjs,
  40117. handlesActivityChecks: true,
  40118. supportsPing: false,
  40119. isSupported: function () {
  40120. return true;
  40121. },
  40122. isInitialized: function () {
  40123. return window.SockJS !== undefined;
  40124. },
  40125. getSocket: function (url, options) {
  40126. return new window.SockJS(url, null, {
  40127. js_path: Dependencies.getPath("sockjs", {
  40128. useTLS: options.useTLS
  40129. }),
  40130. ignore_null_origin: options.ignoreNullOrigin
  40131. });
  40132. },
  40133. beforeOpen: function (socket, path) {
  40134. socket.send(JSON.stringify({
  40135. path: path
  40136. }));
  40137. }
  40138. });
  40139. var xdrConfiguration = {
  40140. isSupported: function (environment) {
  40141. var yes = runtime.isXDRSupported(environment.useTLS);
  40142. return yes;
  40143. }
  40144. };
  40145. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  40146. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  40147. transports.xdr_streaming = XDRStreamingTransport;
  40148. transports.xdr_polling = XDRPollingTransport;
  40149. transports.sockjs = SockJSTransport;
  40150. /* harmony default export */ var transports_transports = (transports);
  40151. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  40152. var net_info_extends = (undefined && undefined.__extends) || (function () {
  40153. var extendStatics = function (d, b) {
  40154. extendStatics = Object.setPrototypeOf ||
  40155. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40156. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40157. return extendStatics(d, b);
  40158. };
  40159. return function (d, b) {
  40160. extendStatics(d, b);
  40161. function __() { this.constructor = d; }
  40162. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40163. };
  40164. })();
  40165. var NetInfo = (function (_super) {
  40166. net_info_extends(NetInfo, _super);
  40167. function NetInfo() {
  40168. var _this = _super.call(this) || this;
  40169. var self = _this;
  40170. if (window.addEventListener !== undefined) {
  40171. window.addEventListener("online", function () {
  40172. self.emit('online');
  40173. }, false);
  40174. window.addEventListener("offline", function () {
  40175. self.emit('offline');
  40176. }, false);
  40177. }
  40178. return _this;
  40179. }
  40180. NetInfo.prototype.isOnline = function () {
  40181. if (window.navigator.onLine === undefined) {
  40182. return true;
  40183. }
  40184. else {
  40185. return window.navigator.onLine;
  40186. }
  40187. };
  40188. return NetInfo;
  40189. }(dispatcher));
  40190. var net_info_Network = new NetInfo();
  40191. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  40192. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  40193. function AssistantToTheTransportManager(manager, transport, options) {
  40194. this.manager = manager;
  40195. this.transport = transport;
  40196. this.minPingDelay = options.minPingDelay;
  40197. this.maxPingDelay = options.maxPingDelay;
  40198. this.pingDelay = undefined;
  40199. }
  40200. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  40201. var _this = this;
  40202. options = extend({}, options, {
  40203. activityTimeout: this.pingDelay
  40204. });
  40205. var connection = this.transport.createConnection(name, priority, key, options);
  40206. var openTimestamp = null;
  40207. var onOpen = function () {
  40208. connection.unbind("open", onOpen);
  40209. connection.bind("closed", onClosed);
  40210. openTimestamp = util.now();
  40211. };
  40212. var onClosed = function (closeEvent) {
  40213. connection.unbind("closed", onClosed);
  40214. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  40215. _this.manager.reportDeath();
  40216. }
  40217. else if (!closeEvent.wasClean && openTimestamp) {
  40218. var lifespan = util.now() - openTimestamp;
  40219. if (lifespan < 2 * _this.maxPingDelay) {
  40220. _this.manager.reportDeath();
  40221. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  40222. }
  40223. }
  40224. };
  40225. connection.bind("open", onOpen);
  40226. return connection;
  40227. };
  40228. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  40229. return this.manager.isAlive() && this.transport.isSupported(environment);
  40230. };
  40231. return AssistantToTheTransportManager;
  40232. }());
  40233. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  40234. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  40235. var Protocol = {
  40236. decodeMessage: function (messageEvent) {
  40237. try {
  40238. var messageData = JSON.parse(messageEvent.data);
  40239. var pusherEventData = messageData.data;
  40240. if (typeof pusherEventData === 'string') {
  40241. try {
  40242. pusherEventData = JSON.parse(messageData.data);
  40243. }
  40244. catch (e) { }
  40245. }
  40246. var pusherEvent = {
  40247. event: messageData.event,
  40248. channel: messageData.channel,
  40249. data: pusherEventData,
  40250. };
  40251. if (messageData.user_id) {
  40252. pusherEvent.user_id = messageData.user_id;
  40253. }
  40254. return pusherEvent;
  40255. }
  40256. catch (e) {
  40257. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  40258. }
  40259. },
  40260. encodeMessage: function (event) {
  40261. return JSON.stringify(event);
  40262. },
  40263. processHandshake: function (messageEvent) {
  40264. var message = Protocol.decodeMessage(messageEvent);
  40265. if (message.event === "pusher:connection_established") {
  40266. if (!message.data.activity_timeout) {
  40267. throw "No activity timeout specified in handshake";
  40268. }
  40269. return {
  40270. action: "connected",
  40271. id: message.data.socket_id,
  40272. activityTimeout: message.data.activity_timeout * 1000
  40273. };
  40274. }
  40275. else if (message.event === "pusher:error") {
  40276. return {
  40277. action: this.getCloseAction(message.data),
  40278. error: this.getCloseError(message.data)
  40279. };
  40280. }
  40281. else {
  40282. throw "Invalid handshake";
  40283. }
  40284. },
  40285. getCloseAction: function (closeEvent) {
  40286. if (closeEvent.code < 4000) {
  40287. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  40288. return "backoff";
  40289. }
  40290. else {
  40291. return null;
  40292. }
  40293. }
  40294. else if (closeEvent.code === 4000) {
  40295. return "tls_only";
  40296. }
  40297. else if (closeEvent.code < 4100) {
  40298. return "refused";
  40299. }
  40300. else if (closeEvent.code < 4200) {
  40301. return "backoff";
  40302. }
  40303. else if (closeEvent.code < 4300) {
  40304. return "retry";
  40305. }
  40306. else {
  40307. return "refused";
  40308. }
  40309. },
  40310. getCloseError: function (closeEvent) {
  40311. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  40312. return {
  40313. type: 'PusherError',
  40314. data: {
  40315. code: closeEvent.code,
  40316. message: closeEvent.reason || closeEvent.message
  40317. }
  40318. };
  40319. }
  40320. else {
  40321. return null;
  40322. }
  40323. }
  40324. };
  40325. /* harmony default export */ var protocol_protocol = (Protocol);
  40326. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  40327. var connection_extends = (undefined && undefined.__extends) || (function () {
  40328. var extendStatics = function (d, b) {
  40329. extendStatics = Object.setPrototypeOf ||
  40330. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40331. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40332. return extendStatics(d, b);
  40333. };
  40334. return function (d, b) {
  40335. extendStatics(d, b);
  40336. function __() { this.constructor = d; }
  40337. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40338. };
  40339. })();
  40340. var connection_Connection = (function (_super) {
  40341. connection_extends(Connection, _super);
  40342. function Connection(id, transport) {
  40343. var _this = _super.call(this) || this;
  40344. _this.id = id;
  40345. _this.transport = transport;
  40346. _this.activityTimeout = transport.activityTimeout;
  40347. _this.bindListeners();
  40348. return _this;
  40349. }
  40350. Connection.prototype.handlesActivityChecks = function () {
  40351. return this.transport.handlesActivityChecks();
  40352. };
  40353. Connection.prototype.send = function (data) {
  40354. return this.transport.send(data);
  40355. };
  40356. Connection.prototype.send_event = function (name, data, channel) {
  40357. var event = { event: name, data: data };
  40358. if (channel) {
  40359. event.channel = channel;
  40360. }
  40361. logger.debug('Event sent', event);
  40362. return this.send(protocol_protocol.encodeMessage(event));
  40363. };
  40364. Connection.prototype.ping = function () {
  40365. if (this.transport.supportsPing()) {
  40366. this.transport.ping();
  40367. }
  40368. else {
  40369. this.send_event('pusher:ping', {});
  40370. }
  40371. };
  40372. Connection.prototype.close = function () {
  40373. this.transport.close();
  40374. };
  40375. Connection.prototype.bindListeners = function () {
  40376. var _this = this;
  40377. var listeners = {
  40378. message: function (messageEvent) {
  40379. var pusherEvent;
  40380. try {
  40381. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  40382. }
  40383. catch (e) {
  40384. _this.emit('error', {
  40385. type: 'MessageParseError',
  40386. error: e,
  40387. data: messageEvent.data
  40388. });
  40389. }
  40390. if (pusherEvent !== undefined) {
  40391. logger.debug('Event recd', pusherEvent);
  40392. switch (pusherEvent.event) {
  40393. case 'pusher:error':
  40394. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  40395. break;
  40396. case 'pusher:ping':
  40397. _this.emit("ping");
  40398. break;
  40399. case 'pusher:pong':
  40400. _this.emit("pong");
  40401. break;
  40402. }
  40403. _this.emit('message', pusherEvent);
  40404. }
  40405. },
  40406. activity: function () {
  40407. _this.emit("activity");
  40408. },
  40409. error: function (error) {
  40410. _this.emit("error", { type: "WebSocketError", error: error });
  40411. },
  40412. closed: function (closeEvent) {
  40413. unbindListeners();
  40414. if (closeEvent && closeEvent.code) {
  40415. _this.handleCloseEvent(closeEvent);
  40416. }
  40417. _this.transport = null;
  40418. _this.emit("closed");
  40419. }
  40420. };
  40421. var unbindListeners = function () {
  40422. objectApply(listeners, function (listener, event) {
  40423. _this.transport.unbind(event, listener);
  40424. });
  40425. };
  40426. objectApply(listeners, function (listener, event) {
  40427. _this.transport.bind(event, listener);
  40428. });
  40429. };
  40430. Connection.prototype.handleCloseEvent = function (closeEvent) {
  40431. var action = protocol_protocol.getCloseAction(closeEvent);
  40432. var error = protocol_protocol.getCloseError(closeEvent);
  40433. if (error) {
  40434. this.emit('error', error);
  40435. }
  40436. if (action) {
  40437. this.emit(action, { action: action, error: error });
  40438. }
  40439. };
  40440. return Connection;
  40441. }(dispatcher));
  40442. /* harmony default export */ var connection_connection = (connection_Connection);
  40443. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  40444. var handshake_Handshake = (function () {
  40445. function Handshake(transport, callback) {
  40446. this.transport = transport;
  40447. this.callback = callback;
  40448. this.bindListeners();
  40449. }
  40450. Handshake.prototype.close = function () {
  40451. this.unbindListeners();
  40452. this.transport.close();
  40453. };
  40454. Handshake.prototype.bindListeners = function () {
  40455. var _this = this;
  40456. this.onMessage = function (m) {
  40457. _this.unbindListeners();
  40458. var result;
  40459. try {
  40460. result = protocol_protocol.processHandshake(m);
  40461. }
  40462. catch (e) {
  40463. _this.finish("error", { error: e });
  40464. _this.transport.close();
  40465. return;
  40466. }
  40467. if (result.action === "connected") {
  40468. _this.finish("connected", {
  40469. connection: new connection_connection(result.id, _this.transport),
  40470. activityTimeout: result.activityTimeout
  40471. });
  40472. }
  40473. else {
  40474. _this.finish(result.action, { error: result.error });
  40475. _this.transport.close();
  40476. }
  40477. };
  40478. this.onClosed = function (closeEvent) {
  40479. _this.unbindListeners();
  40480. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  40481. var error = protocol_protocol.getCloseError(closeEvent);
  40482. _this.finish(action, { error: error });
  40483. };
  40484. this.transport.bind("message", this.onMessage);
  40485. this.transport.bind("closed", this.onClosed);
  40486. };
  40487. Handshake.prototype.unbindListeners = function () {
  40488. this.transport.unbind("message", this.onMessage);
  40489. this.transport.unbind("closed", this.onClosed);
  40490. };
  40491. Handshake.prototype.finish = function (action, params) {
  40492. this.callback(extend({ transport: this.transport, action: action }, params));
  40493. };
  40494. return Handshake;
  40495. }());
  40496. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  40497. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  40498. var pusher_authorizer_PusherAuthorizer = (function () {
  40499. function PusherAuthorizer(channel, options) {
  40500. this.channel = channel;
  40501. var authTransport = options.authTransport;
  40502. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  40503. throw "'" + authTransport + "' is not a recognized auth transport";
  40504. }
  40505. this.type = authTransport;
  40506. this.options = options;
  40507. this.authOptions = (options || {}).auth || {};
  40508. }
  40509. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  40510. var query = 'socket_id=' + encodeURIComponent(socketId) +
  40511. '&channel_name=' + encodeURIComponent(this.channel.name);
  40512. for (var i in this.authOptions.params) {
  40513. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  40514. }
  40515. return query;
  40516. };
  40517. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  40518. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  40519. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  40520. };
  40521. return PusherAuthorizer;
  40522. }());
  40523. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  40524. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  40525. var timeline_sender_TimelineSender = (function () {
  40526. function TimelineSender(timeline, options) {
  40527. this.timeline = timeline;
  40528. this.options = options || {};
  40529. }
  40530. TimelineSender.prototype.send = function (useTLS, callback) {
  40531. if (this.timeline.isEmpty()) {
  40532. return;
  40533. }
  40534. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  40535. };
  40536. return TimelineSender;
  40537. }());
  40538. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  40539. // CONCATENATED MODULE: ./src/core/errors.ts
  40540. var errors_extends = (undefined && undefined.__extends) || (function () {
  40541. var extendStatics = function (d, b) {
  40542. extendStatics = Object.setPrototypeOf ||
  40543. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40544. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40545. return extendStatics(d, b);
  40546. };
  40547. return function (d, b) {
  40548. extendStatics(d, b);
  40549. function __() { this.constructor = d; }
  40550. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40551. };
  40552. })();
  40553. var BadEventName = (function (_super) {
  40554. errors_extends(BadEventName, _super);
  40555. function BadEventName(msg) {
  40556. var _newTarget = this.constructor;
  40557. var _this = _super.call(this, msg) || this;
  40558. Object.setPrototypeOf(_this, _newTarget.prototype);
  40559. return _this;
  40560. }
  40561. return BadEventName;
  40562. }(Error));
  40563. var RequestTimedOut = (function (_super) {
  40564. errors_extends(RequestTimedOut, _super);
  40565. function RequestTimedOut(msg) {
  40566. var _newTarget = this.constructor;
  40567. var _this = _super.call(this, msg) || this;
  40568. Object.setPrototypeOf(_this, _newTarget.prototype);
  40569. return _this;
  40570. }
  40571. return RequestTimedOut;
  40572. }(Error));
  40573. var TransportPriorityTooLow = (function (_super) {
  40574. errors_extends(TransportPriorityTooLow, _super);
  40575. function TransportPriorityTooLow(msg) {
  40576. var _newTarget = this.constructor;
  40577. var _this = _super.call(this, msg) || this;
  40578. Object.setPrototypeOf(_this, _newTarget.prototype);
  40579. return _this;
  40580. }
  40581. return TransportPriorityTooLow;
  40582. }(Error));
  40583. var TransportClosed = (function (_super) {
  40584. errors_extends(TransportClosed, _super);
  40585. function TransportClosed(msg) {
  40586. var _newTarget = this.constructor;
  40587. var _this = _super.call(this, msg) || this;
  40588. Object.setPrototypeOf(_this, _newTarget.prototype);
  40589. return _this;
  40590. }
  40591. return TransportClosed;
  40592. }(Error));
  40593. var UnsupportedFeature = (function (_super) {
  40594. errors_extends(UnsupportedFeature, _super);
  40595. function UnsupportedFeature(msg) {
  40596. var _newTarget = this.constructor;
  40597. var _this = _super.call(this, msg) || this;
  40598. Object.setPrototypeOf(_this, _newTarget.prototype);
  40599. return _this;
  40600. }
  40601. return UnsupportedFeature;
  40602. }(Error));
  40603. var UnsupportedTransport = (function (_super) {
  40604. errors_extends(UnsupportedTransport, _super);
  40605. function UnsupportedTransport(msg) {
  40606. var _newTarget = this.constructor;
  40607. var _this = _super.call(this, msg) || this;
  40608. Object.setPrototypeOf(_this, _newTarget.prototype);
  40609. return _this;
  40610. }
  40611. return UnsupportedTransport;
  40612. }(Error));
  40613. var UnsupportedStrategy = (function (_super) {
  40614. errors_extends(UnsupportedStrategy, _super);
  40615. function UnsupportedStrategy(msg) {
  40616. var _newTarget = this.constructor;
  40617. var _this = _super.call(this, msg) || this;
  40618. Object.setPrototypeOf(_this, _newTarget.prototype);
  40619. return _this;
  40620. }
  40621. return UnsupportedStrategy;
  40622. }(Error));
  40623. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  40624. var channel_extends = (undefined && undefined.__extends) || (function () {
  40625. var extendStatics = function (d, b) {
  40626. extendStatics = Object.setPrototypeOf ||
  40627. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40628. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40629. return extendStatics(d, b);
  40630. };
  40631. return function (d, b) {
  40632. extendStatics(d, b);
  40633. function __() { this.constructor = d; }
  40634. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40635. };
  40636. })();
  40637. var channel_Channel = (function (_super) {
  40638. channel_extends(Channel, _super);
  40639. function Channel(name, pusher) {
  40640. var _this = _super.call(this, function (event, data) {
  40641. logger.debug('No callbacks on ' + name + ' for ' + event);
  40642. }) || this;
  40643. _this.name = name;
  40644. _this.pusher = pusher;
  40645. _this.subscribed = false;
  40646. _this.subscriptionPending = false;
  40647. _this.subscriptionCancelled = false;
  40648. return _this;
  40649. }
  40650. Channel.prototype.authorize = function (socketId, callback) {
  40651. return callback(false, {});
  40652. };
  40653. Channel.prototype.trigger = function (event, data) {
  40654. if (event.indexOf("client-") !== 0) {
  40655. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  40656. }
  40657. if (!this.subscribed) {
  40658. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  40659. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  40660. }
  40661. return this.pusher.send_event(event, data, this.name);
  40662. };
  40663. Channel.prototype.disconnect = function () {
  40664. this.subscribed = false;
  40665. this.subscriptionPending = false;
  40666. };
  40667. Channel.prototype.handleEvent = function (event) {
  40668. var eventName = event.event;
  40669. var data = event.data;
  40670. if (eventName === "pusher_internal:subscription_succeeded") {
  40671. this.handleSubscriptionSucceededEvent(event);
  40672. }
  40673. else if (eventName.indexOf("pusher_internal:") !== 0) {
  40674. var metadata = {};
  40675. this.emit(eventName, data, metadata);
  40676. }
  40677. };
  40678. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40679. this.subscriptionPending = false;
  40680. this.subscribed = true;
  40681. if (this.subscriptionCancelled) {
  40682. this.pusher.unsubscribe(this.name);
  40683. }
  40684. else {
  40685. this.emit("pusher:subscription_succeeded", event.data);
  40686. }
  40687. };
  40688. Channel.prototype.subscribe = function () {
  40689. var _this = this;
  40690. if (this.subscribed) {
  40691. return;
  40692. }
  40693. this.subscriptionPending = true;
  40694. this.subscriptionCancelled = false;
  40695. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  40696. if (error) {
  40697. logger.error(data);
  40698. _this.emit('pusher:subscription_error', data);
  40699. }
  40700. else {
  40701. _this.pusher.send_event('pusher:subscribe', {
  40702. auth: data.auth,
  40703. channel_data: data.channel_data,
  40704. channel: _this.name
  40705. });
  40706. }
  40707. });
  40708. };
  40709. Channel.prototype.unsubscribe = function () {
  40710. this.subscribed = false;
  40711. this.pusher.send_event('pusher:unsubscribe', {
  40712. channel: this.name
  40713. });
  40714. };
  40715. Channel.prototype.cancelSubscription = function () {
  40716. this.subscriptionCancelled = true;
  40717. };
  40718. Channel.prototype.reinstateSubscription = function () {
  40719. this.subscriptionCancelled = false;
  40720. };
  40721. return Channel;
  40722. }(dispatcher));
  40723. /* harmony default export */ var channels_channel = (channel_Channel);
  40724. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  40725. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  40726. var extendStatics = function (d, b) {
  40727. extendStatics = Object.setPrototypeOf ||
  40728. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40729. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40730. return extendStatics(d, b);
  40731. };
  40732. return function (d, b) {
  40733. extendStatics(d, b);
  40734. function __() { this.constructor = d; }
  40735. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40736. };
  40737. })();
  40738. var private_channel_PrivateChannel = (function (_super) {
  40739. private_channel_extends(PrivateChannel, _super);
  40740. function PrivateChannel() {
  40741. return _super !== null && _super.apply(this, arguments) || this;
  40742. }
  40743. PrivateChannel.prototype.authorize = function (socketId, callback) {
  40744. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  40745. return authorizer.authorize(socketId, callback);
  40746. };
  40747. return PrivateChannel;
  40748. }(channels_channel));
  40749. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  40750. // CONCATENATED MODULE: ./src/core/channels/members.ts
  40751. var members_Members = (function () {
  40752. function Members() {
  40753. this.reset();
  40754. }
  40755. Members.prototype.get = function (id) {
  40756. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  40757. return {
  40758. id: id,
  40759. info: this.members[id]
  40760. };
  40761. }
  40762. else {
  40763. return null;
  40764. }
  40765. };
  40766. Members.prototype.each = function (callback) {
  40767. var _this = this;
  40768. objectApply(this.members, function (member, id) {
  40769. callback(_this.get(id));
  40770. });
  40771. };
  40772. Members.prototype.setMyID = function (id) {
  40773. this.myID = id;
  40774. };
  40775. Members.prototype.onSubscription = function (subscriptionData) {
  40776. this.members = subscriptionData.presence.hash;
  40777. this.count = subscriptionData.presence.count;
  40778. this.me = this.get(this.myID);
  40779. };
  40780. Members.prototype.addMember = function (memberData) {
  40781. if (this.get(memberData.user_id) === null) {
  40782. this.count++;
  40783. }
  40784. this.members[memberData.user_id] = memberData.user_info;
  40785. return this.get(memberData.user_id);
  40786. };
  40787. Members.prototype.removeMember = function (memberData) {
  40788. var member = this.get(memberData.user_id);
  40789. if (member) {
  40790. delete this.members[memberData.user_id];
  40791. this.count--;
  40792. }
  40793. return member;
  40794. };
  40795. Members.prototype.reset = function () {
  40796. this.members = {};
  40797. this.count = 0;
  40798. this.myID = null;
  40799. this.me = null;
  40800. };
  40801. return Members;
  40802. }());
  40803. /* harmony default export */ var members = (members_Members);
  40804. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  40805. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  40806. var extendStatics = function (d, b) {
  40807. extendStatics = Object.setPrototypeOf ||
  40808. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40809. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40810. return extendStatics(d, b);
  40811. };
  40812. return function (d, b) {
  40813. extendStatics(d, b);
  40814. function __() { this.constructor = d; }
  40815. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40816. };
  40817. })();
  40818. var presence_channel_PresenceChannel = (function (_super) {
  40819. presence_channel_extends(PresenceChannel, _super);
  40820. function PresenceChannel(name, pusher) {
  40821. var _this = _super.call(this, name, pusher) || this;
  40822. _this.members = new members();
  40823. return _this;
  40824. }
  40825. PresenceChannel.prototype.authorize = function (socketId, callback) {
  40826. var _this = this;
  40827. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40828. if (!error) {
  40829. if (authData.channel_data === undefined) {
  40830. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40831. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  40832. ("expected 'channel_data' field. " + suffix));
  40833. callback("Invalid auth response");
  40834. return;
  40835. }
  40836. var channelData = JSON.parse(authData.channel_data);
  40837. _this.members.setMyID(channelData.user_id);
  40838. }
  40839. callback(error, authData);
  40840. });
  40841. };
  40842. PresenceChannel.prototype.handleEvent = function (event) {
  40843. var eventName = event.event;
  40844. if (eventName.indexOf("pusher_internal:") === 0) {
  40845. this.handleInternalEvent(event);
  40846. }
  40847. else {
  40848. var data = event.data;
  40849. var metadata = {};
  40850. if (event.user_id) {
  40851. metadata.user_id = event.user_id;
  40852. }
  40853. this.emit(eventName, data, metadata);
  40854. }
  40855. };
  40856. PresenceChannel.prototype.handleInternalEvent = function (event) {
  40857. var eventName = event.event;
  40858. var data = event.data;
  40859. switch (eventName) {
  40860. case "pusher_internal:subscription_succeeded":
  40861. this.handleSubscriptionSucceededEvent(event);
  40862. break;
  40863. case "pusher_internal:member_added":
  40864. var addedMember = this.members.addMember(data);
  40865. this.emit('pusher:member_added', addedMember);
  40866. break;
  40867. case "pusher_internal:member_removed":
  40868. var removedMember = this.members.removeMember(data);
  40869. if (removedMember) {
  40870. this.emit('pusher:member_removed', removedMember);
  40871. }
  40872. break;
  40873. }
  40874. };
  40875. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40876. this.subscriptionPending = false;
  40877. this.subscribed = true;
  40878. if (this.subscriptionCancelled) {
  40879. this.pusher.unsubscribe(this.name);
  40880. }
  40881. else {
  40882. this.members.onSubscription(event.data);
  40883. this.emit("pusher:subscription_succeeded", this.members);
  40884. }
  40885. };
  40886. PresenceChannel.prototype.disconnect = function () {
  40887. this.members.reset();
  40888. _super.prototype.disconnect.call(this);
  40889. };
  40890. return PresenceChannel;
  40891. }(private_channel));
  40892. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  40893. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  40894. var nacl_fast = __webpack_require__(0);
  40895. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  40896. var nacl_util = __webpack_require__(1);
  40897. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  40898. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  40899. var extendStatics = function (d, b) {
  40900. extendStatics = Object.setPrototypeOf ||
  40901. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40902. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40903. return extendStatics(d, b);
  40904. };
  40905. return function (d, b) {
  40906. extendStatics(d, b);
  40907. function __() { this.constructor = d; }
  40908. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40909. };
  40910. })();
  40911. var encrypted_channel_EncryptedChannel = (function (_super) {
  40912. encrypted_channel_extends(EncryptedChannel, _super);
  40913. function EncryptedChannel() {
  40914. var _this = _super !== null && _super.apply(this, arguments) || this;
  40915. _this.key = null;
  40916. return _this;
  40917. }
  40918. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  40919. var _this = this;
  40920. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40921. if (error) {
  40922. callback(true, authData);
  40923. return;
  40924. }
  40925. var sharedSecret = authData["shared_secret"];
  40926. if (!sharedSecret) {
  40927. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  40928. callback(true, errorMsg);
  40929. return;
  40930. }
  40931. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  40932. delete authData["shared_secret"];
  40933. callback(false, authData);
  40934. });
  40935. };
  40936. EncryptedChannel.prototype.trigger = function (event, data) {
  40937. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  40938. };
  40939. EncryptedChannel.prototype.handleEvent = function (event) {
  40940. var eventName = event.event;
  40941. var data = event.data;
  40942. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  40943. _super.prototype.handleEvent.call(this, event);
  40944. return;
  40945. }
  40946. this.handleEncryptedEvent(eventName, data);
  40947. };
  40948. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  40949. var _this = this;
  40950. if (!this.key) {
  40951. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  40952. return;
  40953. }
  40954. if (!data.ciphertext || !data.nonce) {
  40955. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  40956. return;
  40957. }
  40958. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  40959. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  40960. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  40961. return;
  40962. }
  40963. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  40964. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  40965. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  40966. return;
  40967. }
  40968. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  40969. if (bytes === null) {
  40970. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  40971. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  40972. if (error) {
  40973. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  40974. return;
  40975. }
  40976. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  40977. if (bytes === null) {
  40978. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  40979. return;
  40980. }
  40981. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  40982. return;
  40983. });
  40984. return;
  40985. }
  40986. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  40987. };
  40988. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  40989. try {
  40990. this.emit(eventName, JSON.parse(data));
  40991. }
  40992. catch (e) {
  40993. this.emit(eventName, data);
  40994. }
  40995. return this;
  40996. };
  40997. return EncryptedChannel;
  40998. }(private_channel));
  40999. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  41000. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  41001. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  41002. var extendStatics = function (d, b) {
  41003. extendStatics = Object.setPrototypeOf ||
  41004. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41005. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41006. return extendStatics(d, b);
  41007. };
  41008. return function (d, b) {
  41009. extendStatics(d, b);
  41010. function __() { this.constructor = d; }
  41011. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41012. };
  41013. })();
  41014. var connection_manager_ConnectionManager = (function (_super) {
  41015. connection_manager_extends(ConnectionManager, _super);
  41016. function ConnectionManager(key, options) {
  41017. var _this = _super.call(this) || this;
  41018. _this.key = key;
  41019. _this.options = options || {};
  41020. _this.state = "initialized";
  41021. _this.connection = null;
  41022. _this.usingTLS = !!options.useTLS;
  41023. _this.timeline = _this.options.timeline;
  41024. _this.errorCallbacks = _this.buildErrorCallbacks();
  41025. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  41026. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  41027. var Network = runtime.getNetwork();
  41028. Network.bind("online", function () {
  41029. _this.timeline.info({ netinfo: "online" });
  41030. if (_this.state === "connecting" || _this.state === "unavailable") {
  41031. _this.retryIn(0);
  41032. }
  41033. });
  41034. Network.bind("offline", function () {
  41035. _this.timeline.info({ netinfo: "offline" });
  41036. if (_this.connection) {
  41037. _this.sendActivityCheck();
  41038. }
  41039. });
  41040. _this.updateStrategy();
  41041. return _this;
  41042. }
  41043. ConnectionManager.prototype.connect = function () {
  41044. if (this.connection || this.runner) {
  41045. return;
  41046. }
  41047. if (!this.strategy.isSupported()) {
  41048. this.updateState("failed");
  41049. return;
  41050. }
  41051. this.updateState("connecting");
  41052. this.startConnecting();
  41053. this.setUnavailableTimer();
  41054. };
  41055. ;
  41056. ConnectionManager.prototype.send = function (data) {
  41057. if (this.connection) {
  41058. return this.connection.send(data);
  41059. }
  41060. else {
  41061. return false;
  41062. }
  41063. };
  41064. ;
  41065. ConnectionManager.prototype.send_event = function (name, data, channel) {
  41066. if (this.connection) {
  41067. return this.connection.send_event(name, data, channel);
  41068. }
  41069. else {
  41070. return false;
  41071. }
  41072. };
  41073. ;
  41074. ConnectionManager.prototype.disconnect = function () {
  41075. this.disconnectInternally();
  41076. this.updateState("disconnected");
  41077. };
  41078. ;
  41079. ConnectionManager.prototype.isUsingTLS = function () {
  41080. return this.usingTLS;
  41081. };
  41082. ;
  41083. ConnectionManager.prototype.startConnecting = function () {
  41084. var _this = this;
  41085. var callback = function (error, handshake) {
  41086. if (error) {
  41087. _this.runner = _this.strategy.connect(0, callback);
  41088. }
  41089. else {
  41090. if (handshake.action === "error") {
  41091. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  41092. _this.timeline.error({ handshakeError: handshake.error });
  41093. }
  41094. else {
  41095. _this.abortConnecting();
  41096. _this.handshakeCallbacks[handshake.action](handshake);
  41097. }
  41098. }
  41099. };
  41100. this.runner = this.strategy.connect(0, callback);
  41101. };
  41102. ;
  41103. ConnectionManager.prototype.abortConnecting = function () {
  41104. if (this.runner) {
  41105. this.runner.abort();
  41106. this.runner = null;
  41107. }
  41108. };
  41109. ;
  41110. ConnectionManager.prototype.disconnectInternally = function () {
  41111. this.abortConnecting();
  41112. this.clearRetryTimer();
  41113. this.clearUnavailableTimer();
  41114. if (this.connection) {
  41115. var connection = this.abandonConnection();
  41116. connection.close();
  41117. }
  41118. };
  41119. ;
  41120. ConnectionManager.prototype.updateStrategy = function () {
  41121. this.strategy = this.options.getStrategy({
  41122. key: this.key,
  41123. timeline: this.timeline,
  41124. useTLS: this.usingTLS
  41125. });
  41126. };
  41127. ;
  41128. ConnectionManager.prototype.retryIn = function (delay) {
  41129. var _this = this;
  41130. this.timeline.info({ action: "retry", delay: delay });
  41131. if (delay > 0) {
  41132. this.emit("connecting_in", Math.round(delay / 1000));
  41133. }
  41134. this.retryTimer = new OneOffTimer(delay || 0, function () {
  41135. _this.disconnectInternally();
  41136. _this.connect();
  41137. });
  41138. };
  41139. ;
  41140. ConnectionManager.prototype.clearRetryTimer = function () {
  41141. if (this.retryTimer) {
  41142. this.retryTimer.ensureAborted();
  41143. this.retryTimer = null;
  41144. }
  41145. };
  41146. ;
  41147. ConnectionManager.prototype.setUnavailableTimer = function () {
  41148. var _this = this;
  41149. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  41150. _this.updateState("unavailable");
  41151. });
  41152. };
  41153. ;
  41154. ConnectionManager.prototype.clearUnavailableTimer = function () {
  41155. if (this.unavailableTimer) {
  41156. this.unavailableTimer.ensureAborted();
  41157. }
  41158. };
  41159. ;
  41160. ConnectionManager.prototype.sendActivityCheck = function () {
  41161. var _this = this;
  41162. this.stopActivityCheck();
  41163. this.connection.ping();
  41164. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  41165. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  41166. _this.retryIn(0);
  41167. });
  41168. };
  41169. ;
  41170. ConnectionManager.prototype.resetActivityCheck = function () {
  41171. var _this = this;
  41172. this.stopActivityCheck();
  41173. if (this.connection && !this.connection.handlesActivityChecks()) {
  41174. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  41175. _this.sendActivityCheck();
  41176. });
  41177. }
  41178. };
  41179. ;
  41180. ConnectionManager.prototype.stopActivityCheck = function () {
  41181. if (this.activityTimer) {
  41182. this.activityTimer.ensureAborted();
  41183. }
  41184. };
  41185. ;
  41186. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  41187. var _this = this;
  41188. return extend({}, errorCallbacks, {
  41189. message: function (message) {
  41190. _this.resetActivityCheck();
  41191. _this.emit('message', message);
  41192. },
  41193. ping: function () {
  41194. _this.send_event('pusher:pong', {});
  41195. },
  41196. activity: function () {
  41197. _this.resetActivityCheck();
  41198. },
  41199. error: function (error) {
  41200. _this.emit("error", { type: "WebSocketError", error: error });
  41201. },
  41202. closed: function () {
  41203. _this.abandonConnection();
  41204. if (_this.shouldRetry()) {
  41205. _this.retryIn(1000);
  41206. }
  41207. }
  41208. });
  41209. };
  41210. ;
  41211. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  41212. var _this = this;
  41213. return extend({}, errorCallbacks, {
  41214. connected: function (handshake) {
  41215. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  41216. _this.clearUnavailableTimer();
  41217. _this.setConnection(handshake.connection);
  41218. _this.socket_id = _this.connection.id;
  41219. _this.updateState("connected", { socket_id: _this.socket_id });
  41220. }
  41221. });
  41222. };
  41223. ;
  41224. ConnectionManager.prototype.buildErrorCallbacks = function () {
  41225. var _this = this;
  41226. var withErrorEmitted = function (callback) {
  41227. return function (result) {
  41228. if (result.error) {
  41229. _this.emit("error", { type: "WebSocketError", error: result.error });
  41230. }
  41231. callback(result);
  41232. };
  41233. };
  41234. return {
  41235. tls_only: withErrorEmitted(function () {
  41236. _this.usingTLS = true;
  41237. _this.updateStrategy();
  41238. _this.retryIn(0);
  41239. }),
  41240. refused: withErrorEmitted(function () {
  41241. _this.disconnect();
  41242. }),
  41243. backoff: withErrorEmitted(function () {
  41244. _this.retryIn(1000);
  41245. }),
  41246. retry: withErrorEmitted(function () {
  41247. _this.retryIn(0);
  41248. })
  41249. };
  41250. };
  41251. ;
  41252. ConnectionManager.prototype.setConnection = function (connection) {
  41253. this.connection = connection;
  41254. for (var event in this.connectionCallbacks) {
  41255. this.connection.bind(event, this.connectionCallbacks[event]);
  41256. }
  41257. this.resetActivityCheck();
  41258. };
  41259. ;
  41260. ConnectionManager.prototype.abandonConnection = function () {
  41261. if (!this.connection) {
  41262. return;
  41263. }
  41264. this.stopActivityCheck();
  41265. for (var event in this.connectionCallbacks) {
  41266. this.connection.unbind(event, this.connectionCallbacks[event]);
  41267. }
  41268. var connection = this.connection;
  41269. this.connection = null;
  41270. return connection;
  41271. };
  41272. ConnectionManager.prototype.updateState = function (newState, data) {
  41273. var previousState = this.state;
  41274. this.state = newState;
  41275. if (previousState !== newState) {
  41276. var newStateDescription = newState;
  41277. if (newStateDescription === "connected") {
  41278. newStateDescription += " with new socket ID " + data.socket_id;
  41279. }
  41280. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  41281. this.timeline.info({ state: newState, params: data });
  41282. this.emit('state_change', { previous: previousState, current: newState });
  41283. this.emit(newState, data);
  41284. }
  41285. };
  41286. ConnectionManager.prototype.shouldRetry = function () {
  41287. return this.state === "connecting" || this.state === "connected";
  41288. };
  41289. return ConnectionManager;
  41290. }(dispatcher));
  41291. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  41292. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  41293. var channels_Channels = (function () {
  41294. function Channels() {
  41295. this.channels = {};
  41296. }
  41297. Channels.prototype.add = function (name, pusher) {
  41298. if (!this.channels[name]) {
  41299. this.channels[name] = createChannel(name, pusher);
  41300. }
  41301. return this.channels[name];
  41302. };
  41303. Channels.prototype.all = function () {
  41304. return values(this.channels);
  41305. };
  41306. Channels.prototype.find = function (name) {
  41307. return this.channels[name];
  41308. };
  41309. Channels.prototype.remove = function (name) {
  41310. var channel = this.channels[name];
  41311. delete this.channels[name];
  41312. return channel;
  41313. };
  41314. Channels.prototype.disconnect = function () {
  41315. objectApply(this.channels, function (channel) {
  41316. channel.disconnect();
  41317. });
  41318. };
  41319. return Channels;
  41320. }());
  41321. /* harmony default export */ var channels = (channels_Channels);
  41322. function createChannel(name, pusher) {
  41323. if (name.indexOf('private-encrypted-') === 0) {
  41324. if (false) { var errorMsg; }
  41325. return factory.createEncryptedChannel(name, pusher);
  41326. }
  41327. else if (name.indexOf('private-') === 0) {
  41328. return factory.createPrivateChannel(name, pusher);
  41329. }
  41330. else if (name.indexOf('presence-') === 0) {
  41331. return factory.createPresenceChannel(name, pusher);
  41332. }
  41333. else {
  41334. return factory.createChannel(name, pusher);
  41335. }
  41336. }
  41337. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  41338. var Factory = {
  41339. createChannels: function () {
  41340. return new channels();
  41341. },
  41342. createConnectionManager: function (key, options) {
  41343. return new connection_manager(key, options);
  41344. },
  41345. createChannel: function (name, pusher) {
  41346. return new channels_channel(name, pusher);
  41347. },
  41348. createPrivateChannel: function (name, pusher) {
  41349. return new private_channel(name, pusher);
  41350. },
  41351. createPresenceChannel: function (name, pusher) {
  41352. return new presence_channel(name, pusher);
  41353. },
  41354. createEncryptedChannel: function (name, pusher) {
  41355. return new encrypted_channel(name, pusher);
  41356. },
  41357. createTimelineSender: function (timeline, options) {
  41358. return new timeline_sender(timeline, options);
  41359. },
  41360. createAuthorizer: function (channel, options) {
  41361. if (options.authorizer) {
  41362. return options.authorizer(channel, options);
  41363. }
  41364. return new pusher_authorizer(channel, options);
  41365. },
  41366. createHandshake: function (transport, callback) {
  41367. return new connection_handshake(transport, callback);
  41368. },
  41369. createAssistantToTheTransportManager: function (manager, transport, options) {
  41370. return new assistant_to_the_transport_manager(manager, transport, options);
  41371. }
  41372. };
  41373. /* harmony default export */ var factory = (Factory);
  41374. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  41375. var transport_manager_TransportManager = (function () {
  41376. function TransportManager(options) {
  41377. this.options = options || {};
  41378. this.livesLeft = this.options.lives || Infinity;
  41379. }
  41380. TransportManager.prototype.getAssistant = function (transport) {
  41381. return factory.createAssistantToTheTransportManager(this, transport, {
  41382. minPingDelay: this.options.minPingDelay,
  41383. maxPingDelay: this.options.maxPingDelay
  41384. });
  41385. };
  41386. TransportManager.prototype.isAlive = function () {
  41387. return this.livesLeft > 0;
  41388. };
  41389. TransportManager.prototype.reportDeath = function () {
  41390. this.livesLeft -= 1;
  41391. };
  41392. return TransportManager;
  41393. }());
  41394. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  41395. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  41396. var sequential_strategy_SequentialStrategy = (function () {
  41397. function SequentialStrategy(strategies, options) {
  41398. this.strategies = strategies;
  41399. this.loop = Boolean(options.loop);
  41400. this.failFast = Boolean(options.failFast);
  41401. this.timeout = options.timeout;
  41402. this.timeoutLimit = options.timeoutLimit;
  41403. }
  41404. SequentialStrategy.prototype.isSupported = function () {
  41405. return any(this.strategies, util.method("isSupported"));
  41406. };
  41407. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  41408. var _this = this;
  41409. var strategies = this.strategies;
  41410. var current = 0;
  41411. var timeout = this.timeout;
  41412. var runner = null;
  41413. var tryNextStrategy = function (error, handshake) {
  41414. if (handshake) {
  41415. callback(null, handshake);
  41416. }
  41417. else {
  41418. current = current + 1;
  41419. if (_this.loop) {
  41420. current = current % strategies.length;
  41421. }
  41422. if (current < strategies.length) {
  41423. if (timeout) {
  41424. timeout = timeout * 2;
  41425. if (_this.timeoutLimit) {
  41426. timeout = Math.min(timeout, _this.timeoutLimit);
  41427. }
  41428. }
  41429. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  41430. }
  41431. else {
  41432. callback(true);
  41433. }
  41434. }
  41435. };
  41436. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  41437. return {
  41438. abort: function () {
  41439. runner.abort();
  41440. },
  41441. forceMinPriority: function (p) {
  41442. minPriority = p;
  41443. if (runner) {
  41444. runner.forceMinPriority(p);
  41445. }
  41446. }
  41447. };
  41448. };
  41449. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  41450. var timer = null;
  41451. var runner = null;
  41452. if (options.timeout > 0) {
  41453. timer = new OneOffTimer(options.timeout, function () {
  41454. runner.abort();
  41455. callback(true);
  41456. });
  41457. }
  41458. runner = strategy.connect(minPriority, function (error, handshake) {
  41459. if (error && timer && timer.isRunning() && !options.failFast) {
  41460. return;
  41461. }
  41462. if (timer) {
  41463. timer.ensureAborted();
  41464. }
  41465. callback(error, handshake);
  41466. });
  41467. return {
  41468. abort: function () {
  41469. if (timer) {
  41470. timer.ensureAborted();
  41471. }
  41472. runner.abort();
  41473. },
  41474. forceMinPriority: function (p) {
  41475. runner.forceMinPriority(p);
  41476. }
  41477. };
  41478. };
  41479. return SequentialStrategy;
  41480. }());
  41481. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  41482. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  41483. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  41484. function BestConnectedEverStrategy(strategies) {
  41485. this.strategies = strategies;
  41486. }
  41487. BestConnectedEverStrategy.prototype.isSupported = function () {
  41488. return any(this.strategies, util.method("isSupported"));
  41489. };
  41490. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  41491. return connect(this.strategies, minPriority, function (i, runners) {
  41492. return function (error, handshake) {
  41493. runners[i].error = error;
  41494. if (error) {
  41495. if (allRunnersFailed(runners)) {
  41496. callback(true);
  41497. }
  41498. return;
  41499. }
  41500. apply(runners, function (runner) {
  41501. runner.forceMinPriority(handshake.transport.priority);
  41502. });
  41503. callback(null, handshake);
  41504. };
  41505. });
  41506. };
  41507. return BestConnectedEverStrategy;
  41508. }());
  41509. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  41510. function connect(strategies, minPriority, callbackBuilder) {
  41511. var runners = map(strategies, function (strategy, i, _, rs) {
  41512. return strategy.connect(minPriority, callbackBuilder(i, rs));
  41513. });
  41514. return {
  41515. abort: function () {
  41516. apply(runners, abortRunner);
  41517. },
  41518. forceMinPriority: function (p) {
  41519. apply(runners, function (runner) {
  41520. runner.forceMinPriority(p);
  41521. });
  41522. }
  41523. };
  41524. }
  41525. function allRunnersFailed(runners) {
  41526. return collections_all(runners, function (runner) {
  41527. return Boolean(runner.error);
  41528. });
  41529. }
  41530. function abortRunner(runner) {
  41531. if (!runner.error && !runner.aborted) {
  41532. runner.abort();
  41533. runner.aborted = true;
  41534. }
  41535. }
  41536. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  41537. var cached_strategy_CachedStrategy = (function () {
  41538. function CachedStrategy(strategy, transports, options) {
  41539. this.strategy = strategy;
  41540. this.transports = transports;
  41541. this.ttl = options.ttl || 1800 * 1000;
  41542. this.usingTLS = options.useTLS;
  41543. this.timeline = options.timeline;
  41544. }
  41545. CachedStrategy.prototype.isSupported = function () {
  41546. return this.strategy.isSupported();
  41547. };
  41548. CachedStrategy.prototype.connect = function (minPriority, callback) {
  41549. var usingTLS = this.usingTLS;
  41550. var info = fetchTransportCache(usingTLS);
  41551. var strategies = [this.strategy];
  41552. if (info && info.timestamp + this.ttl >= util.now()) {
  41553. var transport = this.transports[info.transport];
  41554. if (transport) {
  41555. this.timeline.info({
  41556. cached: true,
  41557. transport: info.transport,
  41558. latency: info.latency
  41559. });
  41560. strategies.push(new sequential_strategy([transport], {
  41561. timeout: info.latency * 2 + 1000,
  41562. failFast: true
  41563. }));
  41564. }
  41565. }
  41566. var startTimestamp = util.now();
  41567. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  41568. if (error) {
  41569. flushTransportCache(usingTLS);
  41570. if (strategies.length > 0) {
  41571. startTimestamp = util.now();
  41572. runner = strategies.pop().connect(minPriority, cb);
  41573. }
  41574. else {
  41575. callback(error);
  41576. }
  41577. }
  41578. else {
  41579. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  41580. callback(null, handshake);
  41581. }
  41582. });
  41583. return {
  41584. abort: function () {
  41585. runner.abort();
  41586. },
  41587. forceMinPriority: function (p) {
  41588. minPriority = p;
  41589. if (runner) {
  41590. runner.forceMinPriority(p);
  41591. }
  41592. }
  41593. };
  41594. };
  41595. return CachedStrategy;
  41596. }());
  41597. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  41598. function getTransportCacheKey(usingTLS) {
  41599. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  41600. }
  41601. function fetchTransportCache(usingTLS) {
  41602. var storage = runtime.getLocalStorage();
  41603. if (storage) {
  41604. try {
  41605. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  41606. if (serializedCache) {
  41607. return JSON.parse(serializedCache);
  41608. }
  41609. }
  41610. catch (e) {
  41611. flushTransportCache(usingTLS);
  41612. }
  41613. }
  41614. return null;
  41615. }
  41616. function storeTransportCache(usingTLS, transport, latency) {
  41617. var storage = runtime.getLocalStorage();
  41618. if (storage) {
  41619. try {
  41620. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  41621. timestamp: util.now(),
  41622. transport: transport,
  41623. latency: latency
  41624. });
  41625. }
  41626. catch (e) {
  41627. }
  41628. }
  41629. }
  41630. function flushTransportCache(usingTLS) {
  41631. var storage = runtime.getLocalStorage();
  41632. if (storage) {
  41633. try {
  41634. delete storage[getTransportCacheKey(usingTLS)];
  41635. }
  41636. catch (e) {
  41637. }
  41638. }
  41639. }
  41640. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  41641. var delayed_strategy_DelayedStrategy = (function () {
  41642. function DelayedStrategy(strategy, _a) {
  41643. var number = _a.delay;
  41644. this.strategy = strategy;
  41645. this.options = { delay: number };
  41646. }
  41647. DelayedStrategy.prototype.isSupported = function () {
  41648. return this.strategy.isSupported();
  41649. };
  41650. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  41651. var strategy = this.strategy;
  41652. var runner;
  41653. var timer = new OneOffTimer(this.options.delay, function () {
  41654. runner = strategy.connect(minPriority, callback);
  41655. });
  41656. return {
  41657. abort: function () {
  41658. timer.ensureAborted();
  41659. if (runner) {
  41660. runner.abort();
  41661. }
  41662. },
  41663. forceMinPriority: function (p) {
  41664. minPriority = p;
  41665. if (runner) {
  41666. runner.forceMinPriority(p);
  41667. }
  41668. }
  41669. };
  41670. };
  41671. return DelayedStrategy;
  41672. }());
  41673. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  41674. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  41675. var IfStrategy = (function () {
  41676. function IfStrategy(test, trueBranch, falseBranch) {
  41677. this.test = test;
  41678. this.trueBranch = trueBranch;
  41679. this.falseBranch = falseBranch;
  41680. }
  41681. IfStrategy.prototype.isSupported = function () {
  41682. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41683. return branch.isSupported();
  41684. };
  41685. IfStrategy.prototype.connect = function (minPriority, callback) {
  41686. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41687. return branch.connect(minPriority, callback);
  41688. };
  41689. return IfStrategy;
  41690. }());
  41691. /* harmony default export */ var if_strategy = (IfStrategy);
  41692. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  41693. var FirstConnectedStrategy = (function () {
  41694. function FirstConnectedStrategy(strategy) {
  41695. this.strategy = strategy;
  41696. }
  41697. FirstConnectedStrategy.prototype.isSupported = function () {
  41698. return this.strategy.isSupported();
  41699. };
  41700. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  41701. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  41702. if (handshake) {
  41703. runner.abort();
  41704. }
  41705. callback(error, handshake);
  41706. });
  41707. return runner;
  41708. };
  41709. return FirstConnectedStrategy;
  41710. }());
  41711. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  41712. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  41713. function testSupportsStrategy(strategy) {
  41714. return function () {
  41715. return strategy.isSupported();
  41716. };
  41717. }
  41718. var getDefaultStrategy = function (config, defineTransport) {
  41719. var definedTransports = {};
  41720. function defineTransportStrategy(name, type, priority, options, manager) {
  41721. var transport = defineTransport(config, name, type, priority, options, manager);
  41722. definedTransports[name] = transport;
  41723. return transport;
  41724. }
  41725. var ws_options = {
  41726. hostNonTLS: config.wsHost + ":" + config.wsPort,
  41727. hostTLS: config.wsHost + ":" + config.wssPort,
  41728. httpPath: config.wsPath
  41729. };
  41730. var wss_options = extend({}, ws_options, {
  41731. useTLS: true
  41732. });
  41733. var sockjs_options = {
  41734. hostNonTLS: config.httpHost + ":" + config.httpPort,
  41735. hostTLS: config.httpHost + ":" + config.httpsPort,
  41736. httpPath: config.httpPath
  41737. };
  41738. var timeouts = {
  41739. loop: true,
  41740. timeout: 15000,
  41741. timeoutLimit: 60000
  41742. };
  41743. var ws_manager = new transport_manager({
  41744. lives: 2,
  41745. minPingDelay: 10000,
  41746. maxPingDelay: config.activity_timeout
  41747. });
  41748. var streaming_manager = new transport_manager({
  41749. lives: 2,
  41750. minPingDelay: 10000,
  41751. maxPingDelay: config.activity_timeout
  41752. });
  41753. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  41754. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  41755. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  41756. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  41757. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  41758. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  41759. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  41760. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  41761. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  41762. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  41763. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  41764. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  41765. 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);
  41766. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  41767. var wsStrategy;
  41768. if (config.useTLS) {
  41769. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  41770. }
  41771. else {
  41772. wsStrategy = new best_connected_ever_strategy([
  41773. ws_loop,
  41774. new delayed_strategy(wss_loop, { delay: 2000 }),
  41775. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  41776. ]);
  41777. }
  41778. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  41779. ttl: 1800000,
  41780. timeline: config.timeline,
  41781. useTLS: config.useTLS
  41782. });
  41783. };
  41784. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  41785. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  41786. /* harmony default export */ var transport_connection_initializer = (function () {
  41787. var self = this;
  41788. self.timeline.info(self.buildTimelineMessage({
  41789. transport: self.name + (self.options.useTLS ? "s" : "")
  41790. }));
  41791. if (self.hooks.isInitialized()) {
  41792. self.changeState("initialized");
  41793. }
  41794. else if (self.hooks.file) {
  41795. self.changeState("initializing");
  41796. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  41797. if (self.hooks.isInitialized()) {
  41798. self.changeState("initialized");
  41799. callback(true);
  41800. }
  41801. else {
  41802. if (error) {
  41803. self.onError(error);
  41804. }
  41805. self.onClose();
  41806. callback(false);
  41807. }
  41808. });
  41809. }
  41810. else {
  41811. self.onClose();
  41812. }
  41813. });
  41814. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  41815. var http_xdomain_request_hooks = {
  41816. getRequest: function (socket) {
  41817. var xdr = new window.XDomainRequest();
  41818. xdr.ontimeout = function () {
  41819. socket.emit("error", new RequestTimedOut());
  41820. socket.close();
  41821. };
  41822. xdr.onerror = function (e) {
  41823. socket.emit("error", e);
  41824. socket.close();
  41825. };
  41826. xdr.onprogress = function () {
  41827. if (xdr.responseText && xdr.responseText.length > 0) {
  41828. socket.onChunk(200, xdr.responseText);
  41829. }
  41830. };
  41831. xdr.onload = function () {
  41832. if (xdr.responseText && xdr.responseText.length > 0) {
  41833. socket.onChunk(200, xdr.responseText);
  41834. }
  41835. socket.emit("finished", 200);
  41836. socket.close();
  41837. };
  41838. return xdr;
  41839. },
  41840. abortRequest: function (xdr) {
  41841. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  41842. xdr.abort();
  41843. }
  41844. };
  41845. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  41846. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  41847. var http_request_extends = (undefined && undefined.__extends) || (function () {
  41848. var extendStatics = function (d, b) {
  41849. extendStatics = Object.setPrototypeOf ||
  41850. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41851. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41852. return extendStatics(d, b);
  41853. };
  41854. return function (d, b) {
  41855. extendStatics(d, b);
  41856. function __() { this.constructor = d; }
  41857. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41858. };
  41859. })();
  41860. var MAX_BUFFER_LENGTH = 256 * 1024;
  41861. var http_request_HTTPRequest = (function (_super) {
  41862. http_request_extends(HTTPRequest, _super);
  41863. function HTTPRequest(hooks, method, url) {
  41864. var _this = _super.call(this) || this;
  41865. _this.hooks = hooks;
  41866. _this.method = method;
  41867. _this.url = url;
  41868. return _this;
  41869. }
  41870. HTTPRequest.prototype.start = function (payload) {
  41871. var _this = this;
  41872. this.position = 0;
  41873. this.xhr = this.hooks.getRequest(this);
  41874. this.unloader = function () {
  41875. _this.close();
  41876. };
  41877. runtime.addUnloadListener(this.unloader);
  41878. this.xhr.open(this.method, this.url, true);
  41879. if (this.xhr.setRequestHeader) {
  41880. this.xhr.setRequestHeader("Content-Type", "application/json");
  41881. }
  41882. this.xhr.send(payload);
  41883. };
  41884. HTTPRequest.prototype.close = function () {
  41885. if (this.unloader) {
  41886. runtime.removeUnloadListener(this.unloader);
  41887. this.unloader = null;
  41888. }
  41889. if (this.xhr) {
  41890. this.hooks.abortRequest(this.xhr);
  41891. this.xhr = null;
  41892. }
  41893. };
  41894. HTTPRequest.prototype.onChunk = function (status, data) {
  41895. while (true) {
  41896. var chunk = this.advanceBuffer(data);
  41897. if (chunk) {
  41898. this.emit("chunk", { status: status, data: chunk });
  41899. }
  41900. else {
  41901. break;
  41902. }
  41903. }
  41904. if (this.isBufferTooLong(data)) {
  41905. this.emit("buffer_too_long");
  41906. }
  41907. };
  41908. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  41909. var unreadData = buffer.slice(this.position);
  41910. var endOfLinePosition = unreadData.indexOf("\n");
  41911. if (endOfLinePosition !== -1) {
  41912. this.position += endOfLinePosition + 1;
  41913. return unreadData.slice(0, endOfLinePosition);
  41914. }
  41915. else {
  41916. return null;
  41917. }
  41918. };
  41919. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  41920. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  41921. };
  41922. return HTTPRequest;
  41923. }(dispatcher));
  41924. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  41925. // CONCATENATED MODULE: ./src/core/http/state.ts
  41926. var State;
  41927. (function (State) {
  41928. State[State["CONNECTING"] = 0] = "CONNECTING";
  41929. State[State["OPEN"] = 1] = "OPEN";
  41930. State[State["CLOSED"] = 3] = "CLOSED";
  41931. })(State || (State = {}));
  41932. /* harmony default export */ var state = (State);
  41933. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  41934. var autoIncrement = 1;
  41935. var http_socket_HTTPSocket = (function () {
  41936. function HTTPSocket(hooks, url) {
  41937. this.hooks = hooks;
  41938. this.session = randomNumber(1000) + "/" + randomString(8);
  41939. this.location = getLocation(url);
  41940. this.readyState = state.CONNECTING;
  41941. this.openStream();
  41942. }
  41943. HTTPSocket.prototype.send = function (payload) {
  41944. return this.sendRaw(JSON.stringify([payload]));
  41945. };
  41946. HTTPSocket.prototype.ping = function () {
  41947. this.hooks.sendHeartbeat(this);
  41948. };
  41949. HTTPSocket.prototype.close = function (code, reason) {
  41950. this.onClose(code, reason, true);
  41951. };
  41952. HTTPSocket.prototype.sendRaw = function (payload) {
  41953. if (this.readyState === state.OPEN) {
  41954. try {
  41955. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  41956. return true;
  41957. }
  41958. catch (e) {
  41959. return false;
  41960. }
  41961. }
  41962. else {
  41963. return false;
  41964. }
  41965. };
  41966. HTTPSocket.prototype.reconnect = function () {
  41967. this.closeStream();
  41968. this.openStream();
  41969. };
  41970. ;
  41971. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  41972. this.closeStream();
  41973. this.readyState = state.CLOSED;
  41974. if (this.onclose) {
  41975. this.onclose({
  41976. code: code,
  41977. reason: reason,
  41978. wasClean: wasClean
  41979. });
  41980. }
  41981. };
  41982. HTTPSocket.prototype.onChunk = function (chunk) {
  41983. if (chunk.status !== 200) {
  41984. return;
  41985. }
  41986. if (this.readyState === state.OPEN) {
  41987. this.onActivity();
  41988. }
  41989. var payload;
  41990. var type = chunk.data.slice(0, 1);
  41991. switch (type) {
  41992. case 'o':
  41993. payload = JSON.parse(chunk.data.slice(1) || '{}');
  41994. this.onOpen(payload);
  41995. break;
  41996. case 'a':
  41997. payload = JSON.parse(chunk.data.slice(1) || '[]');
  41998. for (var i = 0; i < payload.length; i++) {
  41999. this.onEvent(payload[i]);
  42000. }
  42001. break;
  42002. case 'm':
  42003. payload = JSON.parse(chunk.data.slice(1) || 'null');
  42004. this.onEvent(payload);
  42005. break;
  42006. case 'h':
  42007. this.hooks.onHeartbeat(this);
  42008. break;
  42009. case 'c':
  42010. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42011. this.onClose(payload[0], payload[1], true);
  42012. break;
  42013. }
  42014. };
  42015. HTTPSocket.prototype.onOpen = function (options) {
  42016. if (this.readyState === state.CONNECTING) {
  42017. if (options && options.hostname) {
  42018. this.location.base = replaceHost(this.location.base, options.hostname);
  42019. }
  42020. this.readyState = state.OPEN;
  42021. if (this.onopen) {
  42022. this.onopen();
  42023. }
  42024. }
  42025. else {
  42026. this.onClose(1006, "Server lost session", true);
  42027. }
  42028. };
  42029. HTTPSocket.prototype.onEvent = function (event) {
  42030. if (this.readyState === state.OPEN && this.onmessage) {
  42031. this.onmessage({ data: event });
  42032. }
  42033. };
  42034. HTTPSocket.prototype.onActivity = function () {
  42035. if (this.onactivity) {
  42036. this.onactivity();
  42037. }
  42038. };
  42039. HTTPSocket.prototype.onError = function (error) {
  42040. if (this.onerror) {
  42041. this.onerror(error);
  42042. }
  42043. };
  42044. HTTPSocket.prototype.openStream = function () {
  42045. var _this = this;
  42046. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  42047. this.stream.bind("chunk", function (chunk) {
  42048. _this.onChunk(chunk);
  42049. });
  42050. this.stream.bind("finished", function (status) {
  42051. _this.hooks.onFinished(_this, status);
  42052. });
  42053. this.stream.bind("buffer_too_long", function () {
  42054. _this.reconnect();
  42055. });
  42056. try {
  42057. this.stream.start();
  42058. }
  42059. catch (error) {
  42060. util.defer(function () {
  42061. _this.onError(error);
  42062. _this.onClose(1006, "Could not start streaming", false);
  42063. });
  42064. }
  42065. };
  42066. HTTPSocket.prototype.closeStream = function () {
  42067. if (this.stream) {
  42068. this.stream.unbind_all();
  42069. this.stream.close();
  42070. this.stream = null;
  42071. }
  42072. };
  42073. return HTTPSocket;
  42074. }());
  42075. function getLocation(url) {
  42076. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  42077. return {
  42078. base: parts[1],
  42079. queryString: parts[2]
  42080. };
  42081. }
  42082. function getSendURL(url, session) {
  42083. return url.base + "/" + session + "/xhr_send";
  42084. }
  42085. function getUniqueURL(url) {
  42086. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  42087. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  42088. }
  42089. function replaceHost(url, hostname) {
  42090. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  42091. return urlParts[1] + hostname + urlParts[3];
  42092. }
  42093. function randomNumber(max) {
  42094. return Math.floor(Math.random() * max);
  42095. }
  42096. function randomString(length) {
  42097. var result = [];
  42098. for (var i = 0; i < length; i++) {
  42099. result.push(randomNumber(32).toString(32));
  42100. }
  42101. return result.join('');
  42102. }
  42103. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  42104. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  42105. var http_streaming_socket_hooks = {
  42106. getReceiveURL: function (url, session) {
  42107. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  42108. },
  42109. onHeartbeat: function (socket) {
  42110. socket.sendRaw("[]");
  42111. },
  42112. sendHeartbeat: function (socket) {
  42113. socket.sendRaw("[]");
  42114. },
  42115. onFinished: function (socket, status) {
  42116. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42117. }
  42118. };
  42119. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  42120. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  42121. var http_polling_socket_hooks = {
  42122. getReceiveURL: function (url, session) {
  42123. return url.base + "/" + session + "/xhr" + url.queryString;
  42124. },
  42125. onHeartbeat: function () {
  42126. },
  42127. sendHeartbeat: function (socket) {
  42128. socket.sendRaw("[]");
  42129. },
  42130. onFinished: function (socket, status) {
  42131. if (status === 200) {
  42132. socket.reconnect();
  42133. }
  42134. else {
  42135. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42136. }
  42137. }
  42138. };
  42139. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  42140. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  42141. var http_xhr_request_hooks = {
  42142. getRequest: function (socket) {
  42143. var Constructor = runtime.getXHRAPI();
  42144. var xhr = new Constructor();
  42145. xhr.onreadystatechange = xhr.onprogress = function () {
  42146. switch (xhr.readyState) {
  42147. case 3:
  42148. if (xhr.responseText && xhr.responseText.length > 0) {
  42149. socket.onChunk(xhr.status, xhr.responseText);
  42150. }
  42151. break;
  42152. case 4:
  42153. if (xhr.responseText && xhr.responseText.length > 0) {
  42154. socket.onChunk(xhr.status, xhr.responseText);
  42155. }
  42156. socket.emit("finished", xhr.status);
  42157. socket.close();
  42158. break;
  42159. }
  42160. };
  42161. return xhr;
  42162. },
  42163. abortRequest: function (xhr) {
  42164. xhr.onreadystatechange = null;
  42165. xhr.abort();
  42166. }
  42167. };
  42168. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  42169. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  42170. var HTTP = {
  42171. createStreamingSocket: function (url) {
  42172. return this.createSocket(http_streaming_socket, url);
  42173. },
  42174. createPollingSocket: function (url) {
  42175. return this.createSocket(http_polling_socket, url);
  42176. },
  42177. createSocket: function (hooks, url) {
  42178. return new http_socket(hooks, url);
  42179. },
  42180. createXHR: function (method, url) {
  42181. return this.createRequest(http_xhr_request, method, url);
  42182. },
  42183. createRequest: function (hooks, method, url) {
  42184. return new http_request(hooks, method, url);
  42185. }
  42186. };
  42187. /* harmony default export */ var http_http = (HTTP);
  42188. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  42189. http_http.createXDR = function (method, url) {
  42190. return this.createRequest(http_xdomain_request, method, url);
  42191. };
  42192. /* harmony default export */ var web_http_http = (http_http);
  42193. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  42194. var Runtime = {
  42195. nextAuthCallbackID: 1,
  42196. auth_callbacks: {},
  42197. ScriptReceivers: ScriptReceivers,
  42198. DependenciesReceivers: DependenciesReceivers,
  42199. getDefaultStrategy: default_strategy,
  42200. Transports: transports_transports,
  42201. transportConnectionInitializer: transport_connection_initializer,
  42202. HTTPFactory: web_http_http,
  42203. TimelineTransport: jsonp_timeline,
  42204. getXHRAPI: function () {
  42205. return window.XMLHttpRequest;
  42206. },
  42207. getWebSocketAPI: function () {
  42208. return window.WebSocket || window.MozWebSocket;
  42209. },
  42210. setup: function (PusherClass) {
  42211. var _this = this;
  42212. window.Pusher = PusherClass;
  42213. var initializeOnDocumentBody = function () {
  42214. _this.onDocumentBody(PusherClass.ready);
  42215. };
  42216. if (!window.JSON) {
  42217. Dependencies.load("json2", {}, initializeOnDocumentBody);
  42218. }
  42219. else {
  42220. initializeOnDocumentBody();
  42221. }
  42222. },
  42223. getDocument: function () {
  42224. return document;
  42225. },
  42226. getProtocol: function () {
  42227. return this.getDocument().location.protocol;
  42228. },
  42229. getAuthorizers: function () {
  42230. return { ajax: xhr_auth, jsonp: jsonp_auth };
  42231. },
  42232. onDocumentBody: function (callback) {
  42233. var _this = this;
  42234. if (document.body) {
  42235. callback();
  42236. }
  42237. else {
  42238. setTimeout(function () {
  42239. _this.onDocumentBody(callback);
  42240. }, 0);
  42241. }
  42242. },
  42243. createJSONPRequest: function (url, data) {
  42244. return new jsonp_request(url, data);
  42245. },
  42246. createScriptRequest: function (src) {
  42247. return new script_request(src);
  42248. },
  42249. getLocalStorage: function () {
  42250. try {
  42251. return window.localStorage;
  42252. }
  42253. catch (e) {
  42254. return undefined;
  42255. }
  42256. },
  42257. createXHR: function () {
  42258. if (this.getXHRAPI()) {
  42259. return this.createXMLHttpRequest();
  42260. }
  42261. else {
  42262. return this.createMicrosoftXHR();
  42263. }
  42264. },
  42265. createXMLHttpRequest: function () {
  42266. var Constructor = this.getXHRAPI();
  42267. return new Constructor();
  42268. },
  42269. createMicrosoftXHR: function () {
  42270. return new ActiveXObject("Microsoft.XMLHTTP");
  42271. },
  42272. getNetwork: function () {
  42273. return net_info_Network;
  42274. },
  42275. createWebSocket: function (url) {
  42276. var Constructor = this.getWebSocketAPI();
  42277. return new Constructor(url);
  42278. },
  42279. createSocketRequest: function (method, url) {
  42280. if (this.isXHRSupported()) {
  42281. return this.HTTPFactory.createXHR(method, url);
  42282. }
  42283. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  42284. return this.HTTPFactory.createXDR(method, url);
  42285. }
  42286. else {
  42287. throw "Cross-origin HTTP requests are not supported";
  42288. }
  42289. },
  42290. isXHRSupported: function () {
  42291. var Constructor = this.getXHRAPI();
  42292. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  42293. },
  42294. isXDRSupported: function (useTLS) {
  42295. var protocol = useTLS ? "https:" : "http:";
  42296. var documentProtocol = this.getProtocol();
  42297. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  42298. },
  42299. addUnloadListener: function (listener) {
  42300. if (window.addEventListener !== undefined) {
  42301. window.addEventListener("unload", listener, false);
  42302. }
  42303. else if (window.attachEvent !== undefined) {
  42304. window.attachEvent("onunload", listener);
  42305. }
  42306. },
  42307. removeUnloadListener: function (listener) {
  42308. if (window.addEventListener !== undefined) {
  42309. window.removeEventListener("unload", listener, false);
  42310. }
  42311. else if (window.detachEvent !== undefined) {
  42312. window.detachEvent("onunload", listener);
  42313. }
  42314. }
  42315. };
  42316. /* harmony default export */ var runtime = (Runtime);
  42317. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  42318. var TimelineLevel;
  42319. (function (TimelineLevel) {
  42320. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  42321. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  42322. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  42323. })(TimelineLevel || (TimelineLevel = {}));
  42324. /* harmony default export */ var timeline_level = (TimelineLevel);
  42325. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  42326. var timeline_Timeline = (function () {
  42327. function Timeline(key, session, options) {
  42328. this.key = key;
  42329. this.session = session;
  42330. this.events = [];
  42331. this.options = options || {};
  42332. this.sent = 0;
  42333. this.uniqueID = 0;
  42334. }
  42335. Timeline.prototype.log = function (level, event) {
  42336. if (level <= this.options.level) {
  42337. this.events.push(extend({}, event, { timestamp: util.now() }));
  42338. if (this.options.limit && this.events.length > this.options.limit) {
  42339. this.events.shift();
  42340. }
  42341. }
  42342. };
  42343. Timeline.prototype.error = function (event) {
  42344. this.log(timeline_level.ERROR, event);
  42345. };
  42346. Timeline.prototype.info = function (event) {
  42347. this.log(timeline_level.INFO, event);
  42348. };
  42349. Timeline.prototype.debug = function (event) {
  42350. this.log(timeline_level.DEBUG, event);
  42351. };
  42352. Timeline.prototype.isEmpty = function () {
  42353. return this.events.length === 0;
  42354. };
  42355. Timeline.prototype.send = function (sendfn, callback) {
  42356. var _this = this;
  42357. var data = extend({
  42358. session: this.session,
  42359. bundle: this.sent + 1,
  42360. key: this.key,
  42361. lib: "js",
  42362. version: this.options.version,
  42363. cluster: this.options.cluster,
  42364. features: this.options.features,
  42365. timeline: this.events
  42366. }, this.options.params);
  42367. this.events = [];
  42368. sendfn(data, function (error, result) {
  42369. if (!error) {
  42370. _this.sent++;
  42371. }
  42372. if (callback) {
  42373. callback(error, result);
  42374. }
  42375. });
  42376. return true;
  42377. };
  42378. Timeline.prototype.generateUniqueID = function () {
  42379. this.uniqueID++;
  42380. return this.uniqueID;
  42381. };
  42382. return Timeline;
  42383. }());
  42384. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  42385. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  42386. var transport_strategy_TransportStrategy = (function () {
  42387. function TransportStrategy(name, priority, transport, options) {
  42388. this.name = name;
  42389. this.priority = priority;
  42390. this.transport = transport;
  42391. this.options = options || {};
  42392. }
  42393. TransportStrategy.prototype.isSupported = function () {
  42394. return this.transport.isSupported({
  42395. useTLS: this.options.useTLS
  42396. });
  42397. };
  42398. TransportStrategy.prototype.connect = function (minPriority, callback) {
  42399. var _this = this;
  42400. if (!this.isSupported()) {
  42401. return failAttempt(new UnsupportedStrategy(), callback);
  42402. }
  42403. else if (this.priority < minPriority) {
  42404. return failAttempt(new TransportPriorityTooLow(), callback);
  42405. }
  42406. var connected = false;
  42407. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  42408. var handshake = null;
  42409. var onInitialized = function () {
  42410. transport.unbind("initialized", onInitialized);
  42411. transport.connect();
  42412. };
  42413. var onOpen = function () {
  42414. handshake = factory.createHandshake(transport, function (result) {
  42415. connected = true;
  42416. unbindListeners();
  42417. callback(null, result);
  42418. });
  42419. };
  42420. var onError = function (error) {
  42421. unbindListeners();
  42422. callback(error);
  42423. };
  42424. var onClosed = function () {
  42425. unbindListeners();
  42426. var serializedTransport;
  42427. serializedTransport = safeJSONStringify(transport);
  42428. callback(new TransportClosed(serializedTransport));
  42429. };
  42430. var unbindListeners = function () {
  42431. transport.unbind("initialized", onInitialized);
  42432. transport.unbind("open", onOpen);
  42433. transport.unbind("error", onError);
  42434. transport.unbind("closed", onClosed);
  42435. };
  42436. transport.bind("initialized", onInitialized);
  42437. transport.bind("open", onOpen);
  42438. transport.bind("error", onError);
  42439. transport.bind("closed", onClosed);
  42440. transport.initialize();
  42441. return {
  42442. abort: function () {
  42443. if (connected) {
  42444. return;
  42445. }
  42446. unbindListeners();
  42447. if (handshake) {
  42448. handshake.close();
  42449. }
  42450. else {
  42451. transport.close();
  42452. }
  42453. },
  42454. forceMinPriority: function (p) {
  42455. if (connected) {
  42456. return;
  42457. }
  42458. if (_this.priority < p) {
  42459. if (handshake) {
  42460. handshake.close();
  42461. }
  42462. else {
  42463. transport.close();
  42464. }
  42465. }
  42466. }
  42467. };
  42468. };
  42469. return TransportStrategy;
  42470. }());
  42471. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  42472. function failAttempt(error, callback) {
  42473. util.defer(function () {
  42474. callback(error);
  42475. });
  42476. return {
  42477. abort: function () { },
  42478. forceMinPriority: function () { }
  42479. };
  42480. }
  42481. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  42482. var strategy_builder_Transports = runtime.Transports;
  42483. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  42484. var transportClass = strategy_builder_Transports[type];
  42485. if (!transportClass) {
  42486. throw new UnsupportedTransport(type);
  42487. }
  42488. var enabled = (!config.enabledTransports ||
  42489. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  42490. (!config.disabledTransports ||
  42491. arrayIndexOf(config.disabledTransports, name) === -1);
  42492. var transport;
  42493. if (enabled) {
  42494. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  42495. key: config.key,
  42496. useTLS: config.useTLS,
  42497. timeline: config.timeline,
  42498. ignoreNullOrigin: config.ignoreNullOrigin
  42499. }, options));
  42500. }
  42501. else {
  42502. transport = strategy_builder_UnsupportedStrategy;
  42503. }
  42504. return transport;
  42505. };
  42506. var strategy_builder_UnsupportedStrategy = {
  42507. isSupported: function () {
  42508. return false;
  42509. },
  42510. connect: function (_, callback) {
  42511. var deferred = util.defer(function () {
  42512. callback(new UnsupportedStrategy());
  42513. });
  42514. return {
  42515. abort: function () {
  42516. deferred.ensureAborted();
  42517. },
  42518. forceMinPriority: function () { }
  42519. };
  42520. }
  42521. };
  42522. // CONCATENATED MODULE: ./src/core/config.ts
  42523. var getGlobalConfig = function () {
  42524. return {
  42525. wsHost: defaults.host,
  42526. wsPort: defaults.ws_port,
  42527. wssPort: defaults.wss_port,
  42528. wsPath: defaults.ws_path,
  42529. httpHost: defaults.sockjs_host,
  42530. httpPort: defaults.sockjs_http_port,
  42531. httpsPort: defaults.sockjs_https_port,
  42532. httpPath: defaults.sockjs_path,
  42533. statsHost: defaults.stats_host,
  42534. authEndpoint: defaults.channel_auth_endpoint,
  42535. authTransport: defaults.channel_auth_transport,
  42536. activity_timeout: defaults.activity_timeout,
  42537. pong_timeout: defaults.pong_timeout,
  42538. unavailable_timeout: defaults.unavailable_timeout
  42539. };
  42540. };
  42541. var getClusterConfig = function (clusterName) {
  42542. return {
  42543. wsHost: 'ws-' + clusterName + '.pusher.com',
  42544. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  42545. };
  42546. };
  42547. // CONCATENATED MODULE: ./src/core/pusher.ts
  42548. var pusher_Pusher = (function () {
  42549. function Pusher(app_key, options) {
  42550. var _this = this;
  42551. checkAppKey(app_key);
  42552. options = options || {};
  42553. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  42554. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  42555. logger.warn("You should always specify a cluster when connecting. " + suffix);
  42556. }
  42557. this.key = app_key;
  42558. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  42559. this.channels = factory.createChannels();
  42560. this.global_emitter = new dispatcher();
  42561. this.sessionID = Math.floor(Math.random() * 1000000000);
  42562. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  42563. cluster: this.config.cluster,
  42564. features: Pusher.getClientFeatures(),
  42565. params: this.config.timelineParams || {},
  42566. limit: 50,
  42567. level: timeline_level.INFO,
  42568. version: defaults.VERSION
  42569. });
  42570. if (!this.config.disableStats) {
  42571. this.timelineSender = factory.createTimelineSender(this.timeline, {
  42572. host: this.config.statsHost,
  42573. path: '/timeline/v2/' + runtime.TimelineTransport.name
  42574. });
  42575. }
  42576. var getStrategy = function (options) {
  42577. var config = extend({}, _this.config, options);
  42578. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  42579. };
  42580. this.connection = factory.createConnectionManager(this.key, extend({
  42581. getStrategy: getStrategy,
  42582. timeline: this.timeline,
  42583. activityTimeout: this.config.activity_timeout,
  42584. pongTimeout: this.config.pong_timeout,
  42585. unavailableTimeout: this.config.unavailable_timeout
  42586. }, this.config, { useTLS: this.shouldUseTLS() }));
  42587. this.connection.bind('connected', function () {
  42588. _this.subscribeAll();
  42589. if (_this.timelineSender) {
  42590. _this.timelineSender.send(_this.connection.isUsingTLS());
  42591. }
  42592. });
  42593. this.connection.bind('message', function (event) {
  42594. var eventName = event.event;
  42595. var internal = eventName.indexOf('pusher_internal:') === 0;
  42596. if (event.channel) {
  42597. var channel = _this.channel(event.channel);
  42598. if (channel) {
  42599. channel.handleEvent(event);
  42600. }
  42601. }
  42602. if (!internal) {
  42603. _this.global_emitter.emit(event.event, event.data);
  42604. }
  42605. });
  42606. this.connection.bind('connecting', function () {
  42607. _this.channels.disconnect();
  42608. });
  42609. this.connection.bind('disconnected', function () {
  42610. _this.channels.disconnect();
  42611. });
  42612. this.connection.bind('error', function (err) {
  42613. logger.warn(err);
  42614. });
  42615. Pusher.instances.push(this);
  42616. this.timeline.info({ instances: Pusher.instances.length });
  42617. if (Pusher.isReady) {
  42618. this.connect();
  42619. }
  42620. }
  42621. Pusher.ready = function () {
  42622. Pusher.isReady = true;
  42623. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  42624. Pusher.instances[i].connect();
  42625. }
  42626. };
  42627. Pusher.getClientFeatures = function () {
  42628. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  42629. return t.isSupported({});
  42630. }));
  42631. };
  42632. Pusher.prototype.channel = function (name) {
  42633. return this.channels.find(name);
  42634. };
  42635. Pusher.prototype.allChannels = function () {
  42636. return this.channels.all();
  42637. };
  42638. Pusher.prototype.connect = function () {
  42639. this.connection.connect();
  42640. if (this.timelineSender) {
  42641. if (!this.timelineSenderTimer) {
  42642. var usingTLS = this.connection.isUsingTLS();
  42643. var timelineSender = this.timelineSender;
  42644. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  42645. timelineSender.send(usingTLS);
  42646. });
  42647. }
  42648. }
  42649. };
  42650. Pusher.prototype.disconnect = function () {
  42651. this.connection.disconnect();
  42652. if (this.timelineSenderTimer) {
  42653. this.timelineSenderTimer.ensureAborted();
  42654. this.timelineSenderTimer = null;
  42655. }
  42656. };
  42657. Pusher.prototype.bind = function (event_name, callback, context) {
  42658. this.global_emitter.bind(event_name, callback, context);
  42659. return this;
  42660. };
  42661. Pusher.prototype.unbind = function (event_name, callback, context) {
  42662. this.global_emitter.unbind(event_name, callback, context);
  42663. return this;
  42664. };
  42665. Pusher.prototype.bind_global = function (callback) {
  42666. this.global_emitter.bind_global(callback);
  42667. return this;
  42668. };
  42669. Pusher.prototype.unbind_global = function (callback) {
  42670. this.global_emitter.unbind_global(callback);
  42671. return this;
  42672. };
  42673. Pusher.prototype.unbind_all = function (callback) {
  42674. this.global_emitter.unbind_all();
  42675. return this;
  42676. };
  42677. Pusher.prototype.subscribeAll = function () {
  42678. var channelName;
  42679. for (channelName in this.channels.channels) {
  42680. if (this.channels.channels.hasOwnProperty(channelName)) {
  42681. this.subscribe(channelName);
  42682. }
  42683. }
  42684. };
  42685. Pusher.prototype.subscribe = function (channel_name) {
  42686. var channel = this.channels.add(channel_name, this);
  42687. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  42688. channel.reinstateSubscription();
  42689. }
  42690. else if (!channel.subscriptionPending &&
  42691. this.connection.state === 'connected') {
  42692. channel.subscribe();
  42693. }
  42694. return channel;
  42695. };
  42696. Pusher.prototype.unsubscribe = function (channel_name) {
  42697. var channel = this.channels.find(channel_name);
  42698. if (channel && channel.subscriptionPending) {
  42699. channel.cancelSubscription();
  42700. }
  42701. else {
  42702. channel = this.channels.remove(channel_name);
  42703. if (channel && this.connection.state === 'connected') {
  42704. channel.unsubscribe();
  42705. }
  42706. }
  42707. };
  42708. Pusher.prototype.send_event = function (event_name, data, channel) {
  42709. return this.connection.send_event(event_name, data, channel);
  42710. };
  42711. Pusher.prototype.shouldUseTLS = function () {
  42712. if (runtime.getProtocol() === 'https:') {
  42713. return true;
  42714. }
  42715. else if (this.config.forceTLS === true) {
  42716. return true;
  42717. }
  42718. else {
  42719. return Boolean(this.config.encrypted);
  42720. }
  42721. };
  42722. Pusher.instances = [];
  42723. Pusher.isReady = false;
  42724. Pusher.logToConsole = false;
  42725. Pusher.Runtime = runtime;
  42726. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  42727. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  42728. Pusher.auth_callbacks = runtime.auth_callbacks;
  42729. return Pusher;
  42730. }());
  42731. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  42732. function checkAppKey(key) {
  42733. if (key === null || key === undefined) {
  42734. throw 'You must pass your app key when you instantiate Pusher.';
  42735. }
  42736. }
  42737. runtime.setup(pusher_Pusher);
  42738. /***/ })
  42739. /******/ ]);
  42740. });
  42741. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  42742. /***/ }),
  42743. /***/ "./node_modules/setimmediate/setImmediate.js":
  42744. /*!***************************************************!*\
  42745. !*** ./node_modules/setimmediate/setImmediate.js ***!
  42746. \***************************************************/
  42747. /*! no static exports found */
  42748. /***/ (function(module, exports, __webpack_require__) {
  42749. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  42750. "use strict";
  42751. if (global.setImmediate) {
  42752. return;
  42753. }
  42754. var nextHandle = 1; // Spec says greater than zero
  42755. var tasksByHandle = {};
  42756. var currentlyRunningATask = false;
  42757. var doc = global.document;
  42758. var registerImmediate;
  42759. function setImmediate(callback) {
  42760. // Callback can either be a function or a string
  42761. if (typeof callback !== "function") {
  42762. callback = new Function("" + callback);
  42763. }
  42764. // Copy function arguments
  42765. var args = new Array(arguments.length - 1);
  42766. for (var i = 0; i < args.length; i++) {
  42767. args[i] = arguments[i + 1];
  42768. }
  42769. // Store and register the task
  42770. var task = { callback: callback, args: args };
  42771. tasksByHandle[nextHandle] = task;
  42772. registerImmediate(nextHandle);
  42773. return nextHandle++;
  42774. }
  42775. function clearImmediate(handle) {
  42776. delete tasksByHandle[handle];
  42777. }
  42778. function run(task) {
  42779. var callback = task.callback;
  42780. var args = task.args;
  42781. switch (args.length) {
  42782. case 0:
  42783. callback();
  42784. break;
  42785. case 1:
  42786. callback(args[0]);
  42787. break;
  42788. case 2:
  42789. callback(args[0], args[1]);
  42790. break;
  42791. case 3:
  42792. callback(args[0], args[1], args[2]);
  42793. break;
  42794. default:
  42795. callback.apply(undefined, args);
  42796. break;
  42797. }
  42798. }
  42799. function runIfPresent(handle) {
  42800. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  42801. // So if we're currently running a task, we'll need to delay this invocation.
  42802. if (currentlyRunningATask) {
  42803. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  42804. // "too much recursion" error.
  42805. setTimeout(runIfPresent, 0, handle);
  42806. } else {
  42807. var task = tasksByHandle[handle];
  42808. if (task) {
  42809. currentlyRunningATask = true;
  42810. try {
  42811. run(task);
  42812. } finally {
  42813. clearImmediate(handle);
  42814. currentlyRunningATask = false;
  42815. }
  42816. }
  42817. }
  42818. }
  42819. function installNextTickImplementation() {
  42820. registerImmediate = function(handle) {
  42821. process.nextTick(function () { runIfPresent(handle); });
  42822. };
  42823. }
  42824. function canUsePostMessage() {
  42825. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  42826. // where `global.postMessage` means something completely different and can't be used for this purpose.
  42827. if (global.postMessage && !global.importScripts) {
  42828. var postMessageIsAsynchronous = true;
  42829. var oldOnMessage = global.onmessage;
  42830. global.onmessage = function() {
  42831. postMessageIsAsynchronous = false;
  42832. };
  42833. global.postMessage("", "*");
  42834. global.onmessage = oldOnMessage;
  42835. return postMessageIsAsynchronous;
  42836. }
  42837. }
  42838. function installPostMessageImplementation() {
  42839. // Installs an event handler on `global` for the `message` event: see
  42840. // * https://developer.mozilla.org/en/DOM/window.postMessage
  42841. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  42842. var messagePrefix = "setImmediate$" + Math.random() + "$";
  42843. var onGlobalMessage = function(event) {
  42844. if (event.source === global &&
  42845. typeof event.data === "string" &&
  42846. event.data.indexOf(messagePrefix) === 0) {
  42847. runIfPresent(+event.data.slice(messagePrefix.length));
  42848. }
  42849. };
  42850. if (global.addEventListener) {
  42851. global.addEventListener("message", onGlobalMessage, false);
  42852. } else {
  42853. global.attachEvent("onmessage", onGlobalMessage);
  42854. }
  42855. registerImmediate = function(handle) {
  42856. global.postMessage(messagePrefix + handle, "*");
  42857. };
  42858. }
  42859. function installMessageChannelImplementation() {
  42860. var channel = new MessageChannel();
  42861. channel.port1.onmessage = function(event) {
  42862. var handle = event.data;
  42863. runIfPresent(handle);
  42864. };
  42865. registerImmediate = function(handle) {
  42866. channel.port2.postMessage(handle);
  42867. };
  42868. }
  42869. function installReadyStateChangeImplementation() {
  42870. var html = doc.documentElement;
  42871. registerImmediate = function(handle) {
  42872. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  42873. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  42874. var script = doc.createElement("script");
  42875. script.onreadystatechange = function () {
  42876. runIfPresent(handle);
  42877. script.onreadystatechange = null;
  42878. html.removeChild(script);
  42879. script = null;
  42880. };
  42881. html.appendChild(script);
  42882. };
  42883. }
  42884. function installSetTimeoutImplementation() {
  42885. registerImmediate = function(handle) {
  42886. setTimeout(runIfPresent, 0, handle);
  42887. };
  42888. }
  42889. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  42890. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  42891. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  42892. // Don't get fooled by e.g. browserify environments.
  42893. if ({}.toString.call(global.process) === "[object process]") {
  42894. // For Node.js before 0.9
  42895. installNextTickImplementation();
  42896. } else if (canUsePostMessage()) {
  42897. // For non-IE10 modern browsers
  42898. installPostMessageImplementation();
  42899. } else if (global.MessageChannel) {
  42900. // For web workers, where supported
  42901. installMessageChannelImplementation();
  42902. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  42903. // For IE 6–8
  42904. installReadyStateChangeImplementation();
  42905. } else {
  42906. // For older browsers
  42907. installSetTimeoutImplementation();
  42908. }
  42909. attachTo.setImmediate = setImmediate;
  42910. attachTo.clearImmediate = clearImmediate;
  42911. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  42912. /* 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")))
  42913. /***/ }),
  42914. /***/ "./node_modules/timers-browserify/main.js":
  42915. /*!************************************************!*\
  42916. !*** ./node_modules/timers-browserify/main.js ***!
  42917. \************************************************/
  42918. /*! no static exports found */
  42919. /***/ (function(module, exports, __webpack_require__) {
  42920. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  42921. (typeof self !== "undefined" && self) ||
  42922. window;
  42923. var apply = Function.prototype.apply;
  42924. // DOM APIs, for completeness
  42925. exports.setTimeout = function() {
  42926. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  42927. };
  42928. exports.setInterval = function() {
  42929. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  42930. };
  42931. exports.clearTimeout =
  42932. exports.clearInterval = function(timeout) {
  42933. if (timeout) {
  42934. timeout.close();
  42935. }
  42936. };
  42937. function Timeout(id, clearFn) {
  42938. this._id = id;
  42939. this._clearFn = clearFn;
  42940. }
  42941. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  42942. Timeout.prototype.close = function() {
  42943. this._clearFn.call(scope, this._id);
  42944. };
  42945. // Does not start the time, just sets up the members needed.
  42946. exports.enroll = function(item, msecs) {
  42947. clearTimeout(item._idleTimeoutId);
  42948. item._idleTimeout = msecs;
  42949. };
  42950. exports.unenroll = function(item) {
  42951. clearTimeout(item._idleTimeoutId);
  42952. item._idleTimeout = -1;
  42953. };
  42954. exports._unrefActive = exports.active = function(item) {
  42955. clearTimeout(item._idleTimeoutId);
  42956. var msecs = item._idleTimeout;
  42957. if (msecs >= 0) {
  42958. item._idleTimeoutId = setTimeout(function onTimeout() {
  42959. if (item._onTimeout)
  42960. item._onTimeout();
  42961. }, msecs);
  42962. }
  42963. };
  42964. // setimmediate attaches itself to the global object
  42965. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  42966. // On some exotic environments, it's not clear which object `setimmediate` was
  42967. // able to install onto. Search each possibility in the same order as the
  42968. // `setimmediate` library.
  42969. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  42970. (typeof global !== "undefined" && global.setImmediate) ||
  42971. (this && this.setImmediate);
  42972. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  42973. (typeof global !== "undefined" && global.clearImmediate) ||
  42974. (this && this.clearImmediate);
  42975. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  42976. /***/ }),
  42977. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  42978. /*!*******************************************************************************************************************************************************************************************************************!*\
  42979. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  42980. \*******************************************************************************************************************************************************************************************************************/
  42981. /*! exports provided: render, staticRenderFns */
  42982. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42983. "use strict";
  42984. __webpack_require__.r(__webpack_exports__);
  42985. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42986. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42987. var render = function() {
  42988. var _vm = this
  42989. var _h = _vm.$createElement
  42990. var _c = _vm._self._c || _h
  42991. return _vm._m(0)
  42992. }
  42993. var staticRenderFns = [
  42994. function() {
  42995. var _vm = this
  42996. var _h = _vm.$createElement
  42997. var _c = _vm._self._c || _h
  42998. return _c("div", { staticClass: "container" }, [
  42999. _c("div", { staticClass: "row justify-content-center" }, [
  43000. _c("div", { staticClass: "col-md-8" }, [
  43001. _c("div", { staticClass: "card" }, [
  43002. _c("div", { staticClass: "card-header" }, [
  43003. _vm._v("Example Component")
  43004. ]),
  43005. _vm._v(" "),
  43006. _c("div", { staticClass: "card-body" }, [
  43007. _vm._v(
  43008. "\n I'm an example component.\n "
  43009. )
  43010. ])
  43011. ])
  43012. ])
  43013. ])
  43014. ])
  43015. }
  43016. ]
  43017. render._withStripped = true
  43018. /***/ }),
  43019. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&":
  43020. /*!************************************************************************************************************************************************************************************************************!*\
  43021. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3& ***!
  43022. \************************************************************************************************************************************************************************************************************/
  43023. /*! exports provided: render, staticRenderFns */
  43024. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43025. "use strict";
  43026. __webpack_require__.r(__webpack_exports__);
  43027. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43028. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43029. var render = function() {
  43030. var _vm = this
  43031. var _h = _vm.$createElement
  43032. var _c = _vm._self._c || _h
  43033. return _c(
  43034. "div",
  43035. [
  43036. _c(
  43037. "modal",
  43038. {
  43039. attrs: {
  43040. id: "asseteditModal",
  43041. tabindex: "-1",
  43042. role: "dialog",
  43043. "aria-labelledby": "asseteditModalLabel"
  43044. }
  43045. },
  43046. [
  43047. _c(
  43048. "h5",
  43049. {
  43050. staticClass: "modal-title",
  43051. attrs: { slot: "header", id: "asseteditModalLabel" },
  43052. slot: "header"
  43053. },
  43054. [_vm._v("\n Edit Work Order Information\n ")]
  43055. ),
  43056. _vm._v(" "),
  43057. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43058. _c("div", { staticClass: "form-group" }, [
  43059. _c("label", { attrs: { for: "manufacturer" } }, [
  43060. _vm._v("Manufacturer")
  43061. ]),
  43062. _vm._v(" "),
  43063. _c("input", {
  43064. directives: [
  43065. {
  43066. name: "model",
  43067. rawName: "v-model.lazy",
  43068. value: _vm.data.pcmanu,
  43069. expression: "data.pcmanu",
  43070. modifiers: { lazy: true }
  43071. }
  43072. ],
  43073. staticClass: "form-control",
  43074. attrs: {
  43075. type: "text",
  43076. name: "manufacturer",
  43077. id: "manufacturer"
  43078. },
  43079. domProps: { value: _vm.data.pcmanu },
  43080. on: {
  43081. change: function($event) {
  43082. return _vm.$set(_vm.data, "pcmanu", $event.target.value)
  43083. }
  43084. }
  43085. })
  43086. ]),
  43087. _vm._v(" "),
  43088. _c("div", { staticClass: "form-group" }, [
  43089. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  43090. _vm._v(" "),
  43091. _c("input", {
  43092. directives: [
  43093. {
  43094. name: "model",
  43095. rawName: "v-model.lazy",
  43096. value: _vm.data.pcmake,
  43097. expression: "data.pcmake",
  43098. modifiers: { lazy: true }
  43099. }
  43100. ],
  43101. staticClass: "form-control",
  43102. attrs: { type: "text", name: "make", id: "make" },
  43103. domProps: { value: _vm.data.pcmake },
  43104. on: {
  43105. change: function($event) {
  43106. return _vm.$set(_vm.data, "pcmake", $event.target.value)
  43107. }
  43108. }
  43109. })
  43110. ]),
  43111. _vm._v(" "),
  43112. _c("div", { staticClass: "form-group" }, [
  43113. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  43114. _vm._v(" "),
  43115. _c("input", {
  43116. directives: [
  43117. {
  43118. name: "model",
  43119. rawName: "v-model.lazy",
  43120. value: _vm.data.pcnickname,
  43121. expression: "data.pcnickname",
  43122. modifiers: { lazy: true }
  43123. }
  43124. ],
  43125. staticClass: "form-control",
  43126. attrs: { type: "text", name: "nickname", id: "nickname" },
  43127. domProps: { value: _vm.data.pcnickname },
  43128. on: {
  43129. change: function($event) {
  43130. return _vm.$set(_vm.data, "pcnickname", $event.target.value)
  43131. }
  43132. }
  43133. })
  43134. ]),
  43135. _vm._v(" "),
  43136. _c("div", { staticClass: "form-group" }, [
  43137. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  43138. _vm._v(" "),
  43139. _c("input", {
  43140. directives: [
  43141. {
  43142. name: "model",
  43143. rawName: "v-model.lazy",
  43144. value: _vm.pcextra[2],
  43145. expression: "pcextra[2]",
  43146. modifiers: { lazy: true }
  43147. }
  43148. ],
  43149. staticClass: "form-control",
  43150. attrs: { type: "text", name: "os", id: "os" },
  43151. domProps: { value: _vm.pcextra[2] },
  43152. on: {
  43153. change: function($event) {
  43154. return _vm.$set(_vm.pcextra, 2, $event.target.value)
  43155. }
  43156. }
  43157. })
  43158. ]),
  43159. _vm._v(" "),
  43160. _c("div", { staticClass: "form-group" }, [
  43161. _c("label", { attrs: { for: "serial" } }, [
  43162. _vm._v("Serial Number")
  43163. ]),
  43164. _vm._v(" "),
  43165. _c("input", {
  43166. directives: [
  43167. {
  43168. name: "model",
  43169. rawName: "v-model.lazy",
  43170. value: _vm.pcextra[104],
  43171. expression: "pcextra[104]",
  43172. modifiers: { lazy: true }
  43173. }
  43174. ],
  43175. staticClass: "form-control",
  43176. attrs: { type: "text", id: "serial", name: "serial" },
  43177. domProps: { value: _vm.pcextra[104] },
  43178. on: {
  43179. change: function($event) {
  43180. return _vm.$set(_vm.pcextra, 104, $event.target.value)
  43181. }
  43182. }
  43183. })
  43184. ]),
  43185. _vm._v(" "),
  43186. _c("div", { staticClass: "form-group" }, [
  43187. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  43188. _vm._v(" "),
  43189. _c("input", {
  43190. directives: [
  43191. {
  43192. name: "model",
  43193. rawName: "v-model.lazy",
  43194. value: _vm.pcextra[101],
  43195. expression: "pcextra[101]",
  43196. modifiers: { lazy: true }
  43197. }
  43198. ],
  43199. staticClass: "form-control",
  43200. attrs: { type: "text", id: "cpu", name: "cpu" },
  43201. domProps: { value: _vm.pcextra[101] },
  43202. on: {
  43203. change: function($event) {
  43204. return _vm.$set(_vm.pcextra, 101, $event.target.value)
  43205. }
  43206. }
  43207. })
  43208. ]),
  43209. _vm._v(" "),
  43210. _c("div", { staticClass: "form-group" }, [
  43211. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  43212. _vm._v(" "),
  43213. _c("input", {
  43214. directives: [
  43215. {
  43216. name: "model",
  43217. rawName: "v-model.lazy",
  43218. value: _vm.pcextra[100],
  43219. expression: "pcextra[100]",
  43220. modifiers: { lazy: true }
  43221. }
  43222. ],
  43223. staticClass: "form-control",
  43224. attrs: { type: "text", name: "ram", id: "ram" },
  43225. domProps: { value: _vm.pcextra[100] },
  43226. on: {
  43227. change: function($event) {
  43228. return _vm.$set(_vm.pcextra, 100, $event.target.value)
  43229. }
  43230. }
  43231. })
  43232. ]),
  43233. _vm._v(" "),
  43234. _c("div", { staticClass: "form-group" }, [
  43235. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  43236. _vm._v(" "),
  43237. _c("input", {
  43238. directives: [
  43239. {
  43240. name: "model",
  43241. rawName: "v-model.lazy",
  43242. value: _vm.pcextra[4],
  43243. expression: "pcextra[4]",
  43244. modifiers: { lazy: true }
  43245. }
  43246. ],
  43247. staticClass: "form-control",
  43248. attrs: { type: "text", name: "graphics", id: "grapics" },
  43249. domProps: { value: _vm.pcextra[4] },
  43250. on: {
  43251. change: function($event) {
  43252. return _vm.$set(_vm.pcextra, 4, $event.target.value)
  43253. }
  43254. }
  43255. })
  43256. ])
  43257. ]),
  43258. _vm._v(" "),
  43259. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43260. _c(
  43261. "button",
  43262. {
  43263. staticClass: "btn btn-secondary",
  43264. attrs: { type: "button", "data-dismiss": "modal" }
  43265. },
  43266. [_vm._v("Close")]
  43267. ),
  43268. _vm._v(" "),
  43269. _c(
  43270. "button",
  43271. {
  43272. staticClass: "btn btn-primary",
  43273. attrs: { type: "button" },
  43274. on: {
  43275. click: function($event) {
  43276. return _vm.updateAsset()
  43277. }
  43278. }
  43279. },
  43280. [_vm._v("Save")]
  43281. )
  43282. ])
  43283. ]
  43284. ),
  43285. _vm._v(" "),
  43286. _c("h4", { staticClass: "text-center" }, [
  43287. _vm._v(
  43288. _vm._s(this.data.pcmanu) + " " + _vm._s(this.data.pcmake) + " - "
  43289. ),
  43290. _c("small", { staticClass: "text-muted" }, [
  43291. _vm._v(_vm._s(this.data.pcnickname))
  43292. ])
  43293. ]),
  43294. _vm._v(" "),
  43295. _c("p", [_vm._v("OS: " + _vm._s(this.pcextra[2]))]),
  43296. _vm._v(" "),
  43297. _c("p", [_vm._v("S/N: " + _vm._s(this.pcextra[104]))]),
  43298. _vm._v(" "),
  43299. _c("p", [_vm._v("CPU: " + _vm._s(this.pcextra[101]))]),
  43300. _vm._v(" "),
  43301. _c("p", [_vm._v("RAM: " + _vm._s(this.pcextra[100]))]),
  43302. _vm._v(" "),
  43303. _c("p", [_vm._v("Graphics: " + _vm._s(this.pcextra[4]))]),
  43304. _vm._v(" "),
  43305. _c(
  43306. "button",
  43307. {
  43308. staticClass: "btn btn-primary",
  43309. attrs: {
  43310. type: "button",
  43311. "data-toggle": "modal",
  43312. "data-target": "#asseteditModal"
  43313. }
  43314. },
  43315. [_vm._v("Edit")]
  43316. )
  43317. ],
  43318. 1
  43319. )
  43320. }
  43321. var staticRenderFns = []
  43322. render._withStripped = true
  43323. /***/ }),
  43324. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a&":
  43325. /*!*******************************************************************************************************************************************************************************************************************************!*\
  43326. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a& ***!
  43327. \*******************************************************************************************************************************************************************************************************************************/
  43328. /*! exports provided: render, staticRenderFns */
  43329. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43330. "use strict";
  43331. __webpack_require__.r(__webpack_exports__);
  43332. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43333. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43334. var render = function() {
  43335. var _vm = this
  43336. var _h = _vm.$createElement
  43337. var _c = _vm._self._c || _h
  43338. return _c("div", { staticClass: "dropdown", class: { open: _vm.open } }, [
  43339. _c("div", { staticClass: "input-group" }, [
  43340. _c("input", {
  43341. directives: [
  43342. {
  43343. name: "model",
  43344. rawName: "v-model",
  43345. value: _vm.searchText,
  43346. expression: "searchText"
  43347. }
  43348. ],
  43349. staticClass: "form-control",
  43350. attrs: { type: "text" },
  43351. domProps: { value: _vm.searchText },
  43352. on: {
  43353. input: [
  43354. function($event) {
  43355. if ($event.target.composing) {
  43356. return
  43357. }
  43358. _vm.searchText = $event.target.value
  43359. },
  43360. _vm.searchChanged
  43361. ]
  43362. }
  43363. }),
  43364. _vm._v(" "),
  43365. _c("div", { staticClass: "form-group-append" }, [
  43366. _c(
  43367. "a",
  43368. {
  43369. staticClass: "toggle input-group-text bg-primary text-light",
  43370. on: {
  43371. mousedown: function($event) {
  43372. $event.preventDefault()
  43373. },
  43374. click: function($event) {
  43375. return _vm.setOpen(!_vm.open)
  43376. }
  43377. }
  43378. },
  43379. [
  43380. _c("span", { staticClass: "arrow-up" }, [_vm._v("▲")]),
  43381. _vm._v(" "),
  43382. _c("span", { staticClass: "arrow-down" }, [_vm._v("▼")])
  43383. ]
  43384. )
  43385. ])
  43386. ]),
  43387. _vm._v(" "),
  43388. _c(
  43389. "ul",
  43390. { staticClass: "suggestion-list list-unstyled" },
  43391. _vm._l(_vm.matches, function(suggestion, index) {
  43392. return _c(
  43393. "li",
  43394. {
  43395. key: index,
  43396. on: {
  43397. mousedown: function($event) {
  43398. $event.preventDefault()
  43399. },
  43400. click: function($event) {
  43401. return _vm.suggestionSelected(suggestion)
  43402. }
  43403. }
  43404. },
  43405. [_vm._v("\n " + _vm._s(suggestion[1]) + "\n ")]
  43406. )
  43407. }),
  43408. 0
  43409. )
  43410. ])
  43411. }
  43412. var staticRenderFns = []
  43413. render._withStripped = true
  43414. /***/ }),
  43415. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42&":
  43416. /*!************************************************************************************************************************************************************************************************************************!*\
  43417. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42& ***!
  43418. \************************************************************************************************************************************************************************************************************************/
  43419. /*! exports provided: render, staticRenderFns */
  43420. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43421. "use strict";
  43422. __webpack_require__.r(__webpack_exports__);
  43423. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43424. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43425. var render = function() {
  43426. var _vm = this
  43427. var _h = _vm.$createElement
  43428. var _c = _vm._self._c || _h
  43429. return _c(
  43430. "modal",
  43431. {
  43432. attrs: {
  43433. id: _vm.id,
  43434. tabindex: "-1",
  43435. role: "dialog",
  43436. "aria-labelledby": _vm.id + "Label"
  43437. }
  43438. },
  43439. [
  43440. _c(
  43441. "h5",
  43442. {
  43443. staticClass: "modal-title",
  43444. attrs: { slot: "header", id: _vm.id + "Label" },
  43445. slot: "header"
  43446. },
  43447. [_vm._v("\n Edit Credential\n ")]
  43448. ),
  43449. _vm._v(" "),
  43450. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43451. _c(
  43452. "div",
  43453. { staticClass: "form" },
  43454. [
  43455. _c("autocomplete-custom-dropdown", {
  43456. attrs: {
  43457. options: _vm.descriptions,
  43458. value: _vm.creddesc,
  43459. "allow-custom": true
  43460. },
  43461. model: {
  43462. value: _vm.creddesc,
  43463. callback: function($$v) {
  43464. _vm.creddesc = $$v
  43465. },
  43466. expression: "creddesc"
  43467. }
  43468. })
  43469. ],
  43470. 1
  43471. ),
  43472. _vm._v(" "),
  43473. _c("div", { staticClass: "form-group" }, [
  43474. _c("label", { attrs: { for: "newusername" } }, [_vm._v("Username")]),
  43475. _vm._v(" "),
  43476. _c("input", {
  43477. directives: [
  43478. {
  43479. name: "model",
  43480. rawName: "v-model",
  43481. value: _vm.data.creduser,
  43482. expression: "data.creduser"
  43483. }
  43484. ],
  43485. staticClass: "form-control credential",
  43486. attrs: {
  43487. type: "text",
  43488. name: "newusername" + _vm.data.credid,
  43489. id: "newusername" + _vm.data.credid
  43490. },
  43491. domProps: { value: _vm.data.creduser },
  43492. on: {
  43493. input: function($event) {
  43494. if ($event.target.composing) {
  43495. return
  43496. }
  43497. _vm.$set(_vm.data, "creduser", $event.target.value)
  43498. }
  43499. }
  43500. })
  43501. ]),
  43502. _vm._v(" "),
  43503. _c("div", { staticClass: "form-group" }, [
  43504. _c("label", { attrs: { for: "newpassword" } }, [_vm._v("Password")]),
  43505. _vm._v(" "),
  43506. _c("input", {
  43507. directives: [
  43508. {
  43509. name: "model",
  43510. rawName: "v-model",
  43511. value: _vm.data.credpass,
  43512. expression: "data.credpass"
  43513. }
  43514. ],
  43515. staticClass: "form-control credential",
  43516. attrs: {
  43517. type: "text",
  43518. name: "newpassword" + _vm.data.credid,
  43519. id: "newpassword" + _vm.data.credid
  43520. },
  43521. domProps: { value: _vm.data.credpass },
  43522. on: {
  43523. input: function($event) {
  43524. if ($event.target.composing) {
  43525. return
  43526. }
  43527. _vm.$set(_vm.data, "credpass", $event.target.value)
  43528. }
  43529. }
  43530. }),
  43531. _vm._v(" "),
  43532. _c(
  43533. "button",
  43534. {
  43535. staticClass: "btn btn-secondary",
  43536. attrs: { type: "button" },
  43537. on: {
  43538. click: function($event) {
  43539. return _vm.getRandomPassword(_vm.data.credid)
  43540. }
  43541. }
  43542. },
  43543. [_vm._v("Generate Random")]
  43544. )
  43545. ]),
  43546. _vm._v(" "),
  43547. _c("div", { staticClass: "form-group" })
  43548. ]),
  43549. _vm._v(" "),
  43550. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43551. _c(
  43552. "button",
  43553. {
  43554. staticClass: "btn btn-secondary",
  43555. attrs: { type: "button", "data-dismiss": "modal" }
  43556. },
  43557. [_vm._v("Close")]
  43558. ),
  43559. _vm._v(" "),
  43560. _c(
  43561. "button",
  43562. {
  43563. staticClass: "btn btn-primary",
  43564. attrs: { type: "button" },
  43565. on: {
  43566. click: function($event) {
  43567. return _vm.updateCredential()
  43568. }
  43569. }
  43570. },
  43571. [_vm._v("Save")]
  43572. )
  43573. ])
  43574. ]
  43575. )
  43576. }
  43577. var staticRenderFns = []
  43578. render._withStripped = true
  43579. /***/ }),
  43580. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&":
  43581. /*!******************************************************************************************************************************************************************************************************************!*\
  43582. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e& ***!
  43583. \******************************************************************************************************************************************************************************************************************/
  43584. /*! exports provided: render, staticRenderFns */
  43585. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43586. "use strict";
  43587. __webpack_require__.r(__webpack_exports__);
  43588. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43589. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43590. var render = function() {
  43591. var _vm = this
  43592. var _h = _vm.$createElement
  43593. var _c = _vm._self._c || _h
  43594. return _c(
  43595. "div",
  43596. [
  43597. _c("credential-form-modal", {
  43598. attrs: {
  43599. "modal-id": "newCredentialModal",
  43600. descriptions: _vm.creddescList,
  43601. create: true,
  43602. pcid: _vm.pcid
  43603. }
  43604. }),
  43605. _vm._v(" "),
  43606. _c(
  43607. "button",
  43608. {
  43609. staticClass: "btn btn-primary",
  43610. attrs: {
  43611. type: "button",
  43612. "data-toggle": "modal",
  43613. "data-target": "#newCredentialModal"
  43614. }
  43615. },
  43616. [_vm._v("New Credential")]
  43617. ),
  43618. _vm._v(" "),
  43619. _vm._l(_vm.credentials, function(credential) {
  43620. return _c(
  43621. "div",
  43622. { key: credential.credid },
  43623. [
  43624. _c("credential", {
  43625. attrs: { credential: credential, descriptions: _vm.creddescList }
  43626. })
  43627. ],
  43628. 1
  43629. )
  43630. })
  43631. ],
  43632. 2
  43633. )
  43634. }
  43635. var staticRenderFns = []
  43636. render._withStripped = true
  43637. /***/ }),
  43638. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&":
  43639. /*!*************************************************************************************************************************************************************************************************************!*\
  43640. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential.vue?vue&type=template&id=0f5cc562& ***!
  43641. \*************************************************************************************************************************************************************************************************************/
  43642. /*! exports provided: render, staticRenderFns */
  43643. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43644. "use strict";
  43645. __webpack_require__.r(__webpack_exports__);
  43646. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43647. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43648. var render = function() {
  43649. var _vm = this
  43650. var _h = _vm.$createElement
  43651. var _c = _vm._self._c || _h
  43652. return _c(
  43653. "div",
  43654. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  43655. [
  43656. _c("credential-form-modal", {
  43657. attrs: {
  43658. descriptions: _vm.creddescList,
  43659. "modal-id": "credential" + this.data.credid + "editModal",
  43660. populateWith: this.data
  43661. }
  43662. }),
  43663. _vm._v(" "),
  43664. _c(
  43665. "modal",
  43666. {
  43667. attrs: {
  43668. id: "credential" + this.data.credid + "deleteModal",
  43669. tabindex: "-1"
  43670. }
  43671. },
  43672. [
  43673. _c(
  43674. "h5",
  43675. {
  43676. staticClass: "modal-title",
  43677. attrs: {
  43678. slot: "header",
  43679. id: "credential" + this.data.credid + "deleteModalLabel"
  43680. },
  43681. slot: "header"
  43682. },
  43683. [_vm._v("\r\n Delete Credential\r\n ")]
  43684. ),
  43685. _vm._v(" "),
  43686. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43687. _vm._v("\r\n Are you sure?\r\n ")
  43688. ]),
  43689. _vm._v(" "),
  43690. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43691. _c(
  43692. "button",
  43693. {
  43694. staticClass: "btn btn-secondary",
  43695. attrs: { type: "button", "data-dismiss": "modal" }
  43696. },
  43697. [_vm._v("Cancel")]
  43698. ),
  43699. _vm._v(" "),
  43700. _c(
  43701. "button",
  43702. {
  43703. staticClass: "btn btn-danger",
  43704. attrs: { type: "button" },
  43705. on: {
  43706. click: function($event) {
  43707. return _vm.deleteCredential()
  43708. }
  43709. }
  43710. },
  43711. [_vm._v("Confirm")]
  43712. )
  43713. ])
  43714. ]
  43715. ),
  43716. _vm._v(" "),
  43717. _c("div", { staticClass: "row no-gutters" }, [
  43718. _c("div", { staticClass: "h5 col-3 text-left" }, [
  43719. _vm._v(_vm._s(this.data.creddesc))
  43720. ]),
  43721. _vm._v(" "),
  43722. _c("div", { staticClass: "col-9 text-right" }, [
  43723. _vm._v(_vm._s(this.data.creddate))
  43724. ])
  43725. ]),
  43726. _vm._v(" "),
  43727. _c("div", { staticClass: "row" }, [
  43728. _c("div", { staticClass: "col-lg-9" }, [
  43729. _c("div", [
  43730. _vm._m(0),
  43731. _vm._v(" "),
  43732. _c("input", {
  43733. staticClass: "border-0 credential",
  43734. attrs: {
  43735. type: "text",
  43736. id: "username" + this.data.credid,
  43737. readonly: ""
  43738. },
  43739. domProps: { value: this.data.creduser }
  43740. }),
  43741. _vm._v(" "),
  43742. _c(
  43743. "button",
  43744. {
  43745. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43746. attrs: {
  43747. id: "btn-username" + this.data.credid,
  43748. "data-clipboard-target": "#username" + this.data.credid
  43749. }
  43750. },
  43751. [_c("i", { staticClass: "far fa-clone" })]
  43752. )
  43753. ]),
  43754. _vm._v(" "),
  43755. _c("div", [
  43756. _vm._m(1),
  43757. _vm._v(" "),
  43758. _c("input", {
  43759. staticClass: "border-0 credential",
  43760. attrs: {
  43761. type: "text",
  43762. id: "password" + this.data.credid,
  43763. readonly: ""
  43764. },
  43765. domProps: { value: this.data.credpass }
  43766. }),
  43767. _vm._v(" "),
  43768. _c(
  43769. "button",
  43770. {
  43771. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43772. attrs: {
  43773. id: "btn-password" + this.data.credid,
  43774. "data-clipboard-target": "#password" + this.data.credid
  43775. }
  43776. },
  43777. [_c("i", { staticClass: "far fa-clone" })]
  43778. )
  43779. ])
  43780. ]),
  43781. _vm._v(" "),
  43782. _c(
  43783. "div",
  43784. {
  43785. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  43786. attrs: { role: "group", "aria-label": "Edit and Delete" }
  43787. },
  43788. [
  43789. _c(
  43790. "button",
  43791. {
  43792. staticClass: "btn btn-sm btn-secondary p-lg-1",
  43793. attrs: {
  43794. type: "button",
  43795. "data-toggle": "modal",
  43796. "data-target": "#credential" + this.data.credid + "editModal"
  43797. }
  43798. },
  43799. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  43800. ),
  43801. _vm._v(" "),
  43802. _c(
  43803. "button",
  43804. {
  43805. staticClass: "btn btn-sm btn-danger p-lg-1",
  43806. attrs: {
  43807. type: "button",
  43808. "data-toggle": "modal",
  43809. "data-target":
  43810. "#credential" + this.data.credid + "deleteModal"
  43811. }
  43812. },
  43813. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  43814. )
  43815. ]
  43816. )
  43817. ])
  43818. ],
  43819. 1
  43820. )
  43821. }
  43822. var staticRenderFns = [
  43823. function() {
  43824. var _vm = this
  43825. var _h = _vm.$createElement
  43826. var _c = _vm._self._c || _h
  43827. return _c("label", { attrs: { for: "username" } }, [
  43828. _c("i", { staticClass: "fas fa-fw fa-user" })
  43829. ])
  43830. },
  43831. function() {
  43832. var _vm = this
  43833. var _h = _vm.$createElement
  43834. var _c = _vm._self._c || _h
  43835. return _c("label", { attrs: { for: "password" } }, [
  43836. _c("i", { staticClass: "fas fa-fw fa-key" })
  43837. ])
  43838. }
  43839. ]
  43840. render._withStripped = true
  43841. /***/ }),
  43842. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb&":
  43843. /*!************************************************************************************************************************************************************************************************************!*\
  43844. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb& ***!
  43845. \************************************************************************************************************************************************************************************************************/
  43846. /*! exports provided: render, staticRenderFns */
  43847. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43848. "use strict";
  43849. __webpack_require__.r(__webpack_exports__);
  43850. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43851. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43852. var render = function() {
  43853. var _vm = this
  43854. var _h = _vm.$createElement
  43855. var _c = _vm._self._c || _h
  43856. return _c(
  43857. "ul",
  43858. { staticClass: "list-unstyled" },
  43859. _vm._l(_vm.errorList, function(error) {
  43860. return _c("li", { key: error, staticClass: "text-danger" }, [
  43861. _vm._v(" " + _vm._s(error) + " ")
  43862. ])
  43863. }),
  43864. 0
  43865. )
  43866. }
  43867. var staticRenderFns = []
  43868. render._withStripped = true
  43869. /***/ }),
  43870. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/modal.vue?vue&type=template&id=478d961c&":
  43871. /*!********************************************************************************************************************************************************************************************************!*\
  43872. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/modal.vue?vue&type=template&id=478d961c& ***!
  43873. \********************************************************************************************************************************************************************************************************/
  43874. /*! exports provided: render, staticRenderFns */
  43875. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43876. "use strict";
  43877. __webpack_require__.r(__webpack_exports__);
  43878. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43879. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43880. var render = function() {
  43881. var _vm = this
  43882. var _h = _vm.$createElement
  43883. var _c = _vm._self._c || _h
  43884. return _c("div", { staticClass: "modal fade" }, [
  43885. _c(
  43886. "div",
  43887. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  43888. [
  43889. _c("div", { staticClass: "modal-content" }, [
  43890. _c(
  43891. "div",
  43892. { staticClass: "modal-header" },
  43893. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  43894. 2
  43895. ),
  43896. _vm._v(" "),
  43897. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  43898. _vm._v(" "),
  43899. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  43900. ])
  43901. ]
  43902. )
  43903. ])
  43904. }
  43905. var staticRenderFns = [
  43906. function() {
  43907. var _vm = this
  43908. var _h = _vm.$createElement
  43909. var _c = _vm._self._c || _h
  43910. return _c(
  43911. "button",
  43912. {
  43913. staticClass: "close",
  43914. attrs: {
  43915. type: "button",
  43916. "data-dismiss": "modal",
  43917. "aria-label": "Close"
  43918. }
  43919. },
  43920. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  43921. )
  43922. }
  43923. ]
  43924. render._withStripped = true
  43925. /***/ }),
  43926. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=template&id=73d141f4&":
  43927. /*!********************************************************************************************************************************************************************************************************!*\
  43928. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/notes.vue?vue&type=template&id=73d141f4& ***!
  43929. \********************************************************************************************************************************************************************************************************/
  43930. /*! exports provided: render, staticRenderFns */
  43931. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43932. "use strict";
  43933. __webpack_require__.r(__webpack_exports__);
  43934. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43935. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43936. var render = function() {
  43937. var _vm = this
  43938. var _h = _vm.$createElement
  43939. var _c = _vm._self._c || _h
  43940. return _c(
  43941. "ul",
  43942. { staticClass: "list-unstyled" },
  43943. _vm._l(this.notes, function(note) {
  43944. return _c(
  43945. "li",
  43946. { key: note.noteid, staticClass: "row no-gutters mb-2" },
  43947. [
  43948. _c(
  43949. "modal",
  43950. {
  43951. attrs: {
  43952. id: "note" + note.noteid + "editModal",
  43953. tabindex: "-1",
  43954. role: "dialog",
  43955. "aria-labelledby": "note" + note.noteid + "editModalLabel"
  43956. }
  43957. },
  43958. [
  43959. _c(
  43960. "h5",
  43961. {
  43962. staticClass: "modal-title",
  43963. attrs: {
  43964. slot: "header",
  43965. id: "note" + note.noteid + "editModalLabel"
  43966. },
  43967. slot: "header"
  43968. },
  43969. [_vm._v("\n Edit Note\n ")]
  43970. ),
  43971. _vm._v(" "),
  43972. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43973. _c("div", { staticClass: "form-group" }, [
  43974. _c("label", { attrs: { for: "content" } }, [
  43975. _vm._v("Content")
  43976. ]),
  43977. _vm._v(" "),
  43978. _c("textarea", {
  43979. directives: [
  43980. {
  43981. name: "model",
  43982. rawName: "v-model",
  43983. value: note.thenote,
  43984. expression: "note.thenote"
  43985. }
  43986. ],
  43987. staticClass: "form-control",
  43988. attrs: {
  43989. name: "content" + note.noteid,
  43990. id: "content" + note.noteid
  43991. },
  43992. domProps: { value: note.thenote },
  43993. on: {
  43994. input: function($event) {
  43995. if ($event.target.composing) {
  43996. return
  43997. }
  43998. _vm.$set(note, "thenote", $event.target.value)
  43999. }
  44000. }
  44001. })
  44002. ])
  44003. ]),
  44004. _vm._v(" "),
  44005. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44006. _c(
  44007. "button",
  44008. {
  44009. staticClass: "btn btn-secondary",
  44010. attrs: { type: "button", "data-dismiss": "modal" }
  44011. },
  44012. [_vm._v("Close")]
  44013. ),
  44014. _vm._v(" "),
  44015. _c(
  44016. "button",
  44017. {
  44018. staticClass: "btn btn-primary",
  44019. attrs: { type: "button" },
  44020. on: {
  44021. click: function($event) {
  44022. return _vm.updateNote(note.noteid)
  44023. }
  44024. }
  44025. },
  44026. [_vm._v("Save")]
  44027. )
  44028. ])
  44029. ]
  44030. ),
  44031. _vm._v(" "),
  44032. _c("div", { staticClass: "col-md-1 d-flex flex-column mx-md-3" }, [
  44033. _c("div", { staticClass: "text-center p-0 m-0" }, [
  44034. _vm._v(_vm._s(note.noteuser))
  44035. ]),
  44036. _vm._v(" "),
  44037. _c(
  44038. "div",
  44039. { staticClass: "text-muted text-small text-center p-0 m-0" },
  44040. [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
  44041. ),
  44042. _vm._v(" "),
  44043. _c(
  44044. "div",
  44045. { staticClass: "btn-group justify-content-center p-0 m-0" },
  44046. [
  44047. _vm.authusername === note.noteuser ||
  44048. _vm.authusername === "admin"
  44049. ? [
  44050. _c(
  44051. "button",
  44052. {
  44053. staticClass: "btn btn-sm btn-primary m-1",
  44054. attrs: {
  44055. "data-toggle": "modal",
  44056. "data-target": "#note" + note.noteid + "editModal"
  44057. }
  44058. },
  44059. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  44060. ),
  44061. _vm._v(" "),
  44062. _vm._m(0, true),
  44063. _vm._v(" "),
  44064. _vm._m(1, true)
  44065. ]
  44066. : _vm._e()
  44067. ],
  44068. 2
  44069. )
  44070. ]),
  44071. _vm._v(" "),
  44072. _c("div", { staticClass: "col-md-10" }, [
  44073. _c("div", { staticClass: "card m-2" }, [
  44074. _c("div", { staticClass: "card-body p-2" }, [
  44075. _vm._v(
  44076. "\n " +
  44077. _vm._s(note.thenote) +
  44078. "\n "
  44079. )
  44080. ])
  44081. ])
  44082. ])
  44083. ],
  44084. 1
  44085. )
  44086. }),
  44087. 0
  44088. )
  44089. }
  44090. var staticRenderFns = [
  44091. function() {
  44092. var _vm = this
  44093. var _h = _vm.$createElement
  44094. var _c = _vm._self._c || _h
  44095. return _c("button", { staticClass: "btn btn-sm btn-danger m-1" }, [
  44096. _c("i", { staticClass: "fas fa-fw fa-trash-alt" })
  44097. ])
  44098. },
  44099. function() {
  44100. var _vm = this
  44101. var _h = _vm.$createElement
  44102. var _c = _vm._self._c || _h
  44103. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  44104. _c("i", { staticClass: "fa fa-fw fa-random" })
  44105. ])
  44106. }
  44107. ]
  44108. render._withStripped = true
  44109. /***/ }),
  44110. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4&":
  44111. /*!********************************************************************************************************************************************************************************************************************!*\
  44112. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4& ***!
  44113. \********************************************************************************************************************************************************************************************************************/
  44114. /*! exports provided: render, staticRenderFns */
  44115. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44116. "use strict";
  44117. __webpack_require__.r(__webpack_exports__);
  44118. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44119. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44120. var render = function() {
  44121. var _vm = this
  44122. var _h = _vm.$createElement
  44123. var _c = _vm._self._c || _h
  44124. return _c(
  44125. "modal",
  44126. {
  44127. attrs: {
  44128. id: _vm.id,
  44129. tabindex: "-1",
  44130. role: "dialog",
  44131. "aria-labelledby": _vm.id + "Label"
  44132. }
  44133. },
  44134. [
  44135. _c(
  44136. "h5",
  44137. {
  44138. staticClass: "modal-title",
  44139. attrs: { slot: "header", id: _vm.id + "Label" },
  44140. slot: "header"
  44141. },
  44142. [_vm._v("\r\n Edit Work Order Information\r\n ")]
  44143. ),
  44144. _vm._v(" "),
  44145. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44146. _c(
  44147. "div",
  44148. { staticClass: "form-group" },
  44149. [
  44150. _c("label", { attrs: { for: "probdesc" } }, [
  44151. _vm._v("Problem Description")
  44152. ]),
  44153. _vm._v(" "),
  44154. _c("textarea", {
  44155. directives: [
  44156. {
  44157. name: "model",
  44158. rawName: "v-model",
  44159. value: _vm.data.probdesc,
  44160. expression: "data.probdesc"
  44161. }
  44162. ],
  44163. class: {
  44164. "form-control": true,
  44165. "is-invalid": _vm.errors.probdesc
  44166. },
  44167. attrs: { id: "probdesc", name: "probdesc" },
  44168. domProps: { value: _vm.data.probdesc },
  44169. on: {
  44170. input: function($event) {
  44171. if ($event.target.composing) {
  44172. return
  44173. }
  44174. _vm.$set(_vm.data, "probdesc", $event.target.value)
  44175. }
  44176. }
  44177. }),
  44178. _vm._v(" "),
  44179. _c("errorlist", { attrs: { errors: _vm.errors.probdesc } })
  44180. ],
  44181. 1
  44182. ),
  44183. _vm._v(" "),
  44184. _c(
  44185. "div",
  44186. { staticClass: "form-group" },
  44187. [
  44188. _c("label", { attrs: { for: "suggested" } }, [
  44189. _vm._v("Suggested Solution")
  44190. ]),
  44191. _vm._v(" "),
  44192. _c("textarea", {
  44193. directives: [
  44194. {
  44195. name: "model",
  44196. rawName: "v-model",
  44197. value: _vm.data.suggested,
  44198. expression: "data.suggested"
  44199. }
  44200. ],
  44201. class: {
  44202. "form-control": true,
  44203. "is-invalid": _vm.errors.suggested
  44204. },
  44205. attrs: { id: "suggested", name: "suggested" },
  44206. domProps: { value: _vm.data.suggested },
  44207. on: {
  44208. input: function($event) {
  44209. if ($event.target.composing) {
  44210. return
  44211. }
  44212. _vm.$set(_vm.data, "suggested", $event.target.value)
  44213. }
  44214. }
  44215. }),
  44216. _vm._v(" "),
  44217. _c("errorlist", { attrs: { errors: _vm.errors.suggested } })
  44218. ],
  44219. 1
  44220. ),
  44221. _vm._v(" "),
  44222. _c(
  44223. "div",
  44224. { staticClass: "form-group" },
  44225. [
  44226. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  44227. _vm._v(" "),
  44228. _c("autocomplete-custom-dropdown", {
  44229. attrs: { options: _vm.storeList, value: this.store },
  44230. model: {
  44231. value: _vm.store,
  44232. callback: function($$v) {
  44233. _vm.store = $$v
  44234. },
  44235. expression: "store"
  44236. }
  44237. })
  44238. ],
  44239. 1
  44240. )
  44241. ]),
  44242. _vm._v(" "),
  44243. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44244. _c(
  44245. "button",
  44246. {
  44247. staticClass: "btn btn-secondary",
  44248. attrs: { type: "button", "data-dismiss": "modal" }
  44249. },
  44250. [_vm._v("Close")]
  44251. ),
  44252. _vm._v(" "),
  44253. _c(
  44254. "button",
  44255. {
  44256. staticClass: "btn btn-primary",
  44257. attrs: { type: "button" },
  44258. on: {
  44259. click: function($event) {
  44260. return _vm.updateWorkOrder()
  44261. }
  44262. }
  44263. },
  44264. [_vm._v("Save")]
  44265. )
  44266. ])
  44267. ]
  44268. )
  44269. }
  44270. var staticRenderFns = []
  44271. render._withStripped = true
  44272. /***/ }),
  44273. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&":
  44274. /*!*********************************************************************************************************************************************************************************************************!*\
  44275. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de& ***!
  44276. \*********************************************************************************************************************************************************************************************************/
  44277. /*! exports provided: render, staticRenderFns */
  44278. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44279. "use strict";
  44280. __webpack_require__.r(__webpack_exports__);
  44281. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44282. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44283. var render = function() {
  44284. var _vm = this
  44285. var _h = _vm.$createElement
  44286. var _c = _vm._self._c || _h
  44287. return _c(
  44288. "div",
  44289. [
  44290. _c("woinfo-edit-modal", {
  44291. attrs: {
  44292. "modal-id": "workordereditModal",
  44293. "populate-with": this.data,
  44294. "store-list": this.storeList
  44295. }
  44296. }),
  44297. _vm._v(" "),
  44298. _c("p", [
  44299. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  44300. _vm._v(" "),
  44301. _c("span", { domProps: { textContent: _vm._s(this.data.probdesc) } })
  44302. ]),
  44303. _vm._v(" "),
  44304. _c("p", [
  44305. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  44306. _vm._v(" "),
  44307. _c("span", { domProps: { textContent: _vm._s(this.data.suggested) } })
  44308. ]),
  44309. _vm._v(" "),
  44310. _c("p", [
  44311. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  44312. _vm._v(" "),
  44313. _c("span", { domProps: { textContent: _vm._s(this.data.woid) } })
  44314. ]),
  44315. _vm._v(" "),
  44316. _c("p", [
  44317. _c("i", { staticClass: "fas fa-fw fa-building" }),
  44318. _vm._v(" "),
  44319. _c("span", [_vm._v(_vm._s(_vm.storeList[_vm.data.storeid]))])
  44320. ]),
  44321. _vm._v(" "),
  44322. _c("p", [
  44323. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  44324. _vm._v(" "),
  44325. _c(
  44326. "span",
  44327. {
  44328. staticClass: "dashed-underline",
  44329. attrs: {
  44330. "data-toggle": "tooltip",
  44331. "data-placement": "bottom",
  44332. title: this.getHRDate(this.data.dropdate)
  44333. }
  44334. },
  44335. [
  44336. _vm._v(
  44337. "\n " +
  44338. _vm._s(Math.floor(this.daysSinceToday(this.data.dropdate))) +
  44339. " days ago\n "
  44340. )
  44341. ]
  44342. )
  44343. ]),
  44344. _vm._v(" "),
  44345. _c("p", [
  44346. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  44347. _vm._v(" "),
  44348. !this.isZero(this.data.pickupdate)
  44349. ? _c(
  44350. "span",
  44351. {
  44352. staticClass: "dashed-underline",
  44353. attrs: {
  44354. "data-toggle": "tooltip",
  44355. "data-placement": "bottom",
  44356. title: this.getHRDate(this.data.pickupdate)
  44357. }
  44358. },
  44359. [
  44360. _vm._v(
  44361. "\n " +
  44362. _vm._s(
  44363. Math.floor(this.daysSinceToday(this.data.pickupdate))
  44364. ) +
  44365. " days ago\n "
  44366. )
  44367. ]
  44368. )
  44369. : _vm._e()
  44370. ]),
  44371. _vm._v(" "),
  44372. _c(
  44373. "button",
  44374. {
  44375. staticClass: "btn btn-primary",
  44376. attrs: {
  44377. type: "button",
  44378. "data-toggle": "modal",
  44379. "data-target": "#workordereditModal"
  44380. }
  44381. },
  44382. [_vm._v("Edit")]
  44383. )
  44384. ],
  44385. 1
  44386. )
  44387. }
  44388. var staticRenderFns = []
  44389. render._withStripped = true
  44390. /***/ }),
  44391. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  44392. /*!********************************************************************!*\
  44393. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  44394. \********************************************************************/
  44395. /*! exports provided: default */
  44396. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44397. "use strict";
  44398. __webpack_require__.r(__webpack_exports__);
  44399. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  44400. /* globals __VUE_SSR_CONTEXT__ */
  44401. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  44402. // This module is a runtime utility for cleaner component module output and will
  44403. // be included in the final webpack user bundle.
  44404. function normalizeComponent (
  44405. scriptExports,
  44406. render,
  44407. staticRenderFns,
  44408. functionalTemplate,
  44409. injectStyles,
  44410. scopeId,
  44411. moduleIdentifier, /* server only */
  44412. shadowMode /* vue-cli only */
  44413. ) {
  44414. // Vue.extend constructor export interop
  44415. var options = typeof scriptExports === 'function'
  44416. ? scriptExports.options
  44417. : scriptExports
  44418. // render functions
  44419. if (render) {
  44420. options.render = render
  44421. options.staticRenderFns = staticRenderFns
  44422. options._compiled = true
  44423. }
  44424. // functional template
  44425. if (functionalTemplate) {
  44426. options.functional = true
  44427. }
  44428. // scopedId
  44429. if (scopeId) {
  44430. options._scopeId = 'data-v-' + scopeId
  44431. }
  44432. var hook
  44433. if (moduleIdentifier) { // server build
  44434. hook = function (context) {
  44435. // 2.3 injection
  44436. context =
  44437. context || // cached call
  44438. (this.$vnode && this.$vnode.ssrContext) || // stateful
  44439. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  44440. // 2.2 with runInNewContext: true
  44441. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  44442. context = __VUE_SSR_CONTEXT__
  44443. }
  44444. // inject component styles
  44445. if (injectStyles) {
  44446. injectStyles.call(this, context)
  44447. }
  44448. // register component module identifier for async chunk inferrence
  44449. if (context && context._registeredComponents) {
  44450. context._registeredComponents.add(moduleIdentifier)
  44451. }
  44452. }
  44453. // used by ssr in case component is cached and beforeCreate
  44454. // never gets called
  44455. options._ssrRegister = hook
  44456. } else if (injectStyles) {
  44457. hook = shadowMode
  44458. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  44459. : injectStyles
  44460. }
  44461. if (hook) {
  44462. if (options.functional) {
  44463. // for template-only hot-reload because in that case the render fn doesn't
  44464. // go through the normalizer
  44465. options._injectStyles = hook
  44466. // register for functioal component in vue file
  44467. var originalRender = options.render
  44468. options.render = function renderWithStyleInjection (h, context) {
  44469. hook.call(context)
  44470. return originalRender(h, context)
  44471. }
  44472. } else {
  44473. // inject component registration as beforeCreate hook
  44474. var existing = options.beforeCreate
  44475. options.beforeCreate = existing
  44476. ? [].concat(existing, hook)
  44477. : [hook]
  44478. }
  44479. }
  44480. return {
  44481. exports: scriptExports,
  44482. options: options
  44483. }
  44484. }
  44485. /***/ }),
  44486. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  44487. /*!*************************************************!*\
  44488. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  44489. \*************************************************/
  44490. /*! no static exports found */
  44491. /***/ (function(module, exports, __webpack_require__) {
  44492. "use strict";
  44493. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  44494. * Vue.js v2.6.11
  44495. * (c) 2014-2019 Evan You
  44496. * Released under the MIT License.
  44497. */
  44498. /* */
  44499. var emptyObject = Object.freeze({});
  44500. // These helpers produce better VM code in JS engines due to their
  44501. // explicitness and function inlining.
  44502. function isUndef (v) {
  44503. return v === undefined || v === null
  44504. }
  44505. function isDef (v) {
  44506. return v !== undefined && v !== null
  44507. }
  44508. function isTrue (v) {
  44509. return v === true
  44510. }
  44511. function isFalse (v) {
  44512. return v === false
  44513. }
  44514. /**
  44515. * Check if value is primitive.
  44516. */
  44517. function isPrimitive (value) {
  44518. return (
  44519. typeof value === 'string' ||
  44520. typeof value === 'number' ||
  44521. // $flow-disable-line
  44522. typeof value === 'symbol' ||
  44523. typeof value === 'boolean'
  44524. )
  44525. }
  44526. /**
  44527. * Quick object check - this is primarily used to tell
  44528. * Objects from primitive values when we know the value
  44529. * is a JSON-compliant type.
  44530. */
  44531. function isObject (obj) {
  44532. return obj !== null && typeof obj === 'object'
  44533. }
  44534. /**
  44535. * Get the raw type string of a value, e.g., [object Object].
  44536. */
  44537. var _toString = Object.prototype.toString;
  44538. function toRawType (value) {
  44539. return _toString.call(value).slice(8, -1)
  44540. }
  44541. /**
  44542. * Strict object type check. Only returns true
  44543. * for plain JavaScript objects.
  44544. */
  44545. function isPlainObject (obj) {
  44546. return _toString.call(obj) === '[object Object]'
  44547. }
  44548. function isRegExp (v) {
  44549. return _toString.call(v) === '[object RegExp]'
  44550. }
  44551. /**
  44552. * Check if val is a valid array index.
  44553. */
  44554. function isValidArrayIndex (val) {
  44555. var n = parseFloat(String(val));
  44556. return n >= 0 && Math.floor(n) === n && isFinite(val)
  44557. }
  44558. function isPromise (val) {
  44559. return (
  44560. isDef(val) &&
  44561. typeof val.then === 'function' &&
  44562. typeof val.catch === 'function'
  44563. )
  44564. }
  44565. /**
  44566. * Convert a value to a string that is actually rendered.
  44567. */
  44568. function toString (val) {
  44569. return val == null
  44570. ? ''
  44571. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  44572. ? JSON.stringify(val, null, 2)
  44573. : String(val)
  44574. }
  44575. /**
  44576. * Convert an input value to a number for persistence.
  44577. * If the conversion fails, return original string.
  44578. */
  44579. function toNumber (val) {
  44580. var n = parseFloat(val);
  44581. return isNaN(n) ? val : n
  44582. }
  44583. /**
  44584. * Make a map and return a function for checking if a key
  44585. * is in that map.
  44586. */
  44587. function makeMap (
  44588. str,
  44589. expectsLowerCase
  44590. ) {
  44591. var map = Object.create(null);
  44592. var list = str.split(',');
  44593. for (var i = 0; i < list.length; i++) {
  44594. map[list[i]] = true;
  44595. }
  44596. return expectsLowerCase
  44597. ? function (val) { return map[val.toLowerCase()]; }
  44598. : function (val) { return map[val]; }
  44599. }
  44600. /**
  44601. * Check if a tag is a built-in tag.
  44602. */
  44603. var isBuiltInTag = makeMap('slot,component', true);
  44604. /**
  44605. * Check if an attribute is a reserved attribute.
  44606. */
  44607. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  44608. /**
  44609. * Remove an item from an array.
  44610. */
  44611. function remove (arr, item) {
  44612. if (arr.length) {
  44613. var index = arr.indexOf(item);
  44614. if (index > -1) {
  44615. return arr.splice(index, 1)
  44616. }
  44617. }
  44618. }
  44619. /**
  44620. * Check whether an object has the property.
  44621. */
  44622. var hasOwnProperty = Object.prototype.hasOwnProperty;
  44623. function hasOwn (obj, key) {
  44624. return hasOwnProperty.call(obj, key)
  44625. }
  44626. /**
  44627. * Create a cached version of a pure function.
  44628. */
  44629. function cached (fn) {
  44630. var cache = Object.create(null);
  44631. return (function cachedFn (str) {
  44632. var hit = cache[str];
  44633. return hit || (cache[str] = fn(str))
  44634. })
  44635. }
  44636. /**
  44637. * Camelize a hyphen-delimited string.
  44638. */
  44639. var camelizeRE = /-(\w)/g;
  44640. var camelize = cached(function (str) {
  44641. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  44642. });
  44643. /**
  44644. * Capitalize a string.
  44645. */
  44646. var capitalize = cached(function (str) {
  44647. return str.charAt(0).toUpperCase() + str.slice(1)
  44648. });
  44649. /**
  44650. * Hyphenate a camelCase string.
  44651. */
  44652. var hyphenateRE = /\B([A-Z])/g;
  44653. var hyphenate = cached(function (str) {
  44654. return str.replace(hyphenateRE, '-$1').toLowerCase()
  44655. });
  44656. /**
  44657. * Simple bind polyfill for environments that do not support it,
  44658. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  44659. * since native bind is now performant enough in most browsers.
  44660. * But removing it would mean breaking code that was able to run in
  44661. * PhantomJS 1.x, so this must be kept for backward compatibility.
  44662. */
  44663. /* istanbul ignore next */
  44664. function polyfillBind (fn, ctx) {
  44665. function boundFn (a) {
  44666. var l = arguments.length;
  44667. return l
  44668. ? l > 1
  44669. ? fn.apply(ctx, arguments)
  44670. : fn.call(ctx, a)
  44671. : fn.call(ctx)
  44672. }
  44673. boundFn._length = fn.length;
  44674. return boundFn
  44675. }
  44676. function nativeBind (fn, ctx) {
  44677. return fn.bind(ctx)
  44678. }
  44679. var bind = Function.prototype.bind
  44680. ? nativeBind
  44681. : polyfillBind;
  44682. /**
  44683. * Convert an Array-like object to a real Array.
  44684. */
  44685. function toArray (list, start) {
  44686. start = start || 0;
  44687. var i = list.length - start;
  44688. var ret = new Array(i);
  44689. while (i--) {
  44690. ret[i] = list[i + start];
  44691. }
  44692. return ret
  44693. }
  44694. /**
  44695. * Mix properties into target object.
  44696. */
  44697. function extend (to, _from) {
  44698. for (var key in _from) {
  44699. to[key] = _from[key];
  44700. }
  44701. return to
  44702. }
  44703. /**
  44704. * Merge an Array of Objects into a single Object.
  44705. */
  44706. function toObject (arr) {
  44707. var res = {};
  44708. for (var i = 0; i < arr.length; i++) {
  44709. if (arr[i]) {
  44710. extend(res, arr[i]);
  44711. }
  44712. }
  44713. return res
  44714. }
  44715. /* eslint-disable no-unused-vars */
  44716. /**
  44717. * Perform no operation.
  44718. * Stubbing args to make Flow happy without leaving useless transpiled code
  44719. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  44720. */
  44721. function noop (a, b, c) {}
  44722. /**
  44723. * Always return false.
  44724. */
  44725. var no = function (a, b, c) { return false; };
  44726. /* eslint-enable no-unused-vars */
  44727. /**
  44728. * Return the same value.
  44729. */
  44730. var identity = function (_) { return _; };
  44731. /**
  44732. * Generate a string containing static keys from compiler modules.
  44733. */
  44734. function genStaticKeys (modules) {
  44735. return modules.reduce(function (keys, m) {
  44736. return keys.concat(m.staticKeys || [])
  44737. }, []).join(',')
  44738. }
  44739. /**
  44740. * Check if two values are loosely equal - that is,
  44741. * if they are plain objects, do they have the same shape?
  44742. */
  44743. function looseEqual (a, b) {
  44744. if (a === b) { return true }
  44745. var isObjectA = isObject(a);
  44746. var isObjectB = isObject(b);
  44747. if (isObjectA && isObjectB) {
  44748. try {
  44749. var isArrayA = Array.isArray(a);
  44750. var isArrayB = Array.isArray(b);
  44751. if (isArrayA && isArrayB) {
  44752. return a.length === b.length && a.every(function (e, i) {
  44753. return looseEqual(e, b[i])
  44754. })
  44755. } else if (a instanceof Date && b instanceof Date) {
  44756. return a.getTime() === b.getTime()
  44757. } else if (!isArrayA && !isArrayB) {
  44758. var keysA = Object.keys(a);
  44759. var keysB = Object.keys(b);
  44760. return keysA.length === keysB.length && keysA.every(function (key) {
  44761. return looseEqual(a[key], b[key])
  44762. })
  44763. } else {
  44764. /* istanbul ignore next */
  44765. return false
  44766. }
  44767. } catch (e) {
  44768. /* istanbul ignore next */
  44769. return false
  44770. }
  44771. } else if (!isObjectA && !isObjectB) {
  44772. return String(a) === String(b)
  44773. } else {
  44774. return false
  44775. }
  44776. }
  44777. /**
  44778. * Return the first index at which a loosely equal value can be
  44779. * found in the array (if value is a plain object, the array must
  44780. * contain an object of the same shape), or -1 if it is not present.
  44781. */
  44782. function looseIndexOf (arr, val) {
  44783. for (var i = 0; i < arr.length; i++) {
  44784. if (looseEqual(arr[i], val)) { return i }
  44785. }
  44786. return -1
  44787. }
  44788. /**
  44789. * Ensure a function is called only once.
  44790. */
  44791. function once (fn) {
  44792. var called = false;
  44793. return function () {
  44794. if (!called) {
  44795. called = true;
  44796. fn.apply(this, arguments);
  44797. }
  44798. }
  44799. }
  44800. var SSR_ATTR = 'data-server-rendered';
  44801. var ASSET_TYPES = [
  44802. 'component',
  44803. 'directive',
  44804. 'filter'
  44805. ];
  44806. var LIFECYCLE_HOOKS = [
  44807. 'beforeCreate',
  44808. 'created',
  44809. 'beforeMount',
  44810. 'mounted',
  44811. 'beforeUpdate',
  44812. 'updated',
  44813. 'beforeDestroy',
  44814. 'destroyed',
  44815. 'activated',
  44816. 'deactivated',
  44817. 'errorCaptured',
  44818. 'serverPrefetch'
  44819. ];
  44820. /* */
  44821. var config = ({
  44822. /**
  44823. * Option merge strategies (used in core/util/options)
  44824. */
  44825. // $flow-disable-line
  44826. optionMergeStrategies: Object.create(null),
  44827. /**
  44828. * Whether to suppress warnings.
  44829. */
  44830. silent: false,
  44831. /**
  44832. * Show production mode tip message on boot?
  44833. */
  44834. productionTip: "development" !== 'production',
  44835. /**
  44836. * Whether to enable devtools
  44837. */
  44838. devtools: "development" !== 'production',
  44839. /**
  44840. * Whether to record perf
  44841. */
  44842. performance: false,
  44843. /**
  44844. * Error handler for watcher errors
  44845. */
  44846. errorHandler: null,
  44847. /**
  44848. * Warn handler for watcher warns
  44849. */
  44850. warnHandler: null,
  44851. /**
  44852. * Ignore certain custom elements
  44853. */
  44854. ignoredElements: [],
  44855. /**
  44856. * Custom user key aliases for v-on
  44857. */
  44858. // $flow-disable-line
  44859. keyCodes: Object.create(null),
  44860. /**
  44861. * Check if a tag is reserved so that it cannot be registered as a
  44862. * component. This is platform-dependent and may be overwritten.
  44863. */
  44864. isReservedTag: no,
  44865. /**
  44866. * Check if an attribute is reserved so that it cannot be used as a component
  44867. * prop. This is platform-dependent and may be overwritten.
  44868. */
  44869. isReservedAttr: no,
  44870. /**
  44871. * Check if a tag is an unknown element.
  44872. * Platform-dependent.
  44873. */
  44874. isUnknownElement: no,
  44875. /**
  44876. * Get the namespace of an element
  44877. */
  44878. getTagNamespace: noop,
  44879. /**
  44880. * Parse the real tag name for the specific platform.
  44881. */
  44882. parsePlatformTagName: identity,
  44883. /**
  44884. * Check if an attribute must be bound using property, e.g. value
  44885. * Platform-dependent.
  44886. */
  44887. mustUseProp: no,
  44888. /**
  44889. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  44890. * This will significantly reduce performance if set to false.
  44891. */
  44892. async: true,
  44893. /**
  44894. * Exposed for legacy reasons
  44895. */
  44896. _lifecycleHooks: LIFECYCLE_HOOKS
  44897. });
  44898. /* */
  44899. /**
  44900. * unicode letters used for parsing html tags, component names and property paths.
  44901. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  44902. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  44903. */
  44904. 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/;
  44905. /**
  44906. * Check if a string starts with $ or _
  44907. */
  44908. function isReserved (str) {
  44909. var c = (str + '').charCodeAt(0);
  44910. return c === 0x24 || c === 0x5F
  44911. }
  44912. /**
  44913. * Define a property.
  44914. */
  44915. function def (obj, key, val, enumerable) {
  44916. Object.defineProperty(obj, key, {
  44917. value: val,
  44918. enumerable: !!enumerable,
  44919. writable: true,
  44920. configurable: true
  44921. });
  44922. }
  44923. /**
  44924. * Parse simple path.
  44925. */
  44926. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  44927. function parsePath (path) {
  44928. if (bailRE.test(path)) {
  44929. return
  44930. }
  44931. var segments = path.split('.');
  44932. return function (obj) {
  44933. for (var i = 0; i < segments.length; i++) {
  44934. if (!obj) { return }
  44935. obj = obj[segments[i]];
  44936. }
  44937. return obj
  44938. }
  44939. }
  44940. /* */
  44941. // can we use __proto__?
  44942. var hasProto = '__proto__' in {};
  44943. // Browser environment sniffing
  44944. var inBrowser = typeof window !== 'undefined';
  44945. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  44946. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  44947. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  44948. var isIE = UA && /msie|trident/.test(UA);
  44949. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  44950. var isEdge = UA && UA.indexOf('edge/') > 0;
  44951. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  44952. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  44953. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  44954. var isPhantomJS = UA && /phantomjs/.test(UA);
  44955. var isFF = UA && UA.match(/firefox\/(\d+)/);
  44956. // Firefox has a "watch" function on Object.prototype...
  44957. var nativeWatch = ({}).watch;
  44958. var supportsPassive = false;
  44959. if (inBrowser) {
  44960. try {
  44961. var opts = {};
  44962. Object.defineProperty(opts, 'passive', ({
  44963. get: function get () {
  44964. /* istanbul ignore next */
  44965. supportsPassive = true;
  44966. }
  44967. })); // https://github.com/facebook/flow/issues/285
  44968. window.addEventListener('test-passive', null, opts);
  44969. } catch (e) {}
  44970. }
  44971. // this needs to be lazy-evaled because vue may be required before
  44972. // vue-server-renderer can set VUE_ENV
  44973. var _isServer;
  44974. var isServerRendering = function () {
  44975. if (_isServer === undefined) {
  44976. /* istanbul ignore if */
  44977. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  44978. // detect presence of vue-server-renderer and avoid
  44979. // Webpack shimming the process
  44980. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  44981. } else {
  44982. _isServer = false;
  44983. }
  44984. }
  44985. return _isServer
  44986. };
  44987. // detect devtools
  44988. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  44989. /* istanbul ignore next */
  44990. function isNative (Ctor) {
  44991. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  44992. }
  44993. var hasSymbol =
  44994. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  44995. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  44996. var _Set;
  44997. /* istanbul ignore if */ // $flow-disable-line
  44998. if (typeof Set !== 'undefined' && isNative(Set)) {
  44999. // use native Set when available.
  45000. _Set = Set;
  45001. } else {
  45002. // a non-standard Set polyfill that only works with primitive keys.
  45003. _Set = /*@__PURE__*/(function () {
  45004. function Set () {
  45005. this.set = Object.create(null);
  45006. }
  45007. Set.prototype.has = function has (key) {
  45008. return this.set[key] === true
  45009. };
  45010. Set.prototype.add = function add (key) {
  45011. this.set[key] = true;
  45012. };
  45013. Set.prototype.clear = function clear () {
  45014. this.set = Object.create(null);
  45015. };
  45016. return Set;
  45017. }());
  45018. }
  45019. /* */
  45020. var warn = noop;
  45021. var tip = noop;
  45022. var generateComponentTrace = (noop); // work around flow check
  45023. var formatComponentName = (noop);
  45024. {
  45025. var hasConsole = typeof console !== 'undefined';
  45026. var classifyRE = /(?:^|[-_])(\w)/g;
  45027. var classify = function (str) { return str
  45028. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  45029. .replace(/[-_]/g, ''); };
  45030. warn = function (msg, vm) {
  45031. var trace = vm ? generateComponentTrace(vm) : '';
  45032. if (config.warnHandler) {
  45033. config.warnHandler.call(null, msg, vm, trace);
  45034. } else if (hasConsole && (!config.silent)) {
  45035. console.error(("[Vue warn]: " + msg + trace));
  45036. }
  45037. };
  45038. tip = function (msg, vm) {
  45039. if (hasConsole && (!config.silent)) {
  45040. console.warn("[Vue tip]: " + msg + (
  45041. vm ? generateComponentTrace(vm) : ''
  45042. ));
  45043. }
  45044. };
  45045. formatComponentName = function (vm, includeFile) {
  45046. if (vm.$root === vm) {
  45047. return '<Root>'
  45048. }
  45049. var options = typeof vm === 'function' && vm.cid != null
  45050. ? vm.options
  45051. : vm._isVue
  45052. ? vm.$options || vm.constructor.options
  45053. : vm;
  45054. var name = options.name || options._componentTag;
  45055. var file = options.__file;
  45056. if (!name && file) {
  45057. var match = file.match(/([^/\\]+)\.vue$/);
  45058. name = match && match[1];
  45059. }
  45060. return (
  45061. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  45062. (file && includeFile !== false ? (" at " + file) : '')
  45063. )
  45064. };
  45065. var repeat = function (str, n) {
  45066. var res = '';
  45067. while (n) {
  45068. if (n % 2 === 1) { res += str; }
  45069. if (n > 1) { str += str; }
  45070. n >>= 1;
  45071. }
  45072. return res
  45073. };
  45074. generateComponentTrace = function (vm) {
  45075. if (vm._isVue && vm.$parent) {
  45076. var tree = [];
  45077. var currentRecursiveSequence = 0;
  45078. while (vm) {
  45079. if (tree.length > 0) {
  45080. var last = tree[tree.length - 1];
  45081. if (last.constructor === vm.constructor) {
  45082. currentRecursiveSequence++;
  45083. vm = vm.$parent;
  45084. continue
  45085. } else if (currentRecursiveSequence > 0) {
  45086. tree[tree.length - 1] = [last, currentRecursiveSequence];
  45087. currentRecursiveSequence = 0;
  45088. }
  45089. }
  45090. tree.push(vm);
  45091. vm = vm.$parent;
  45092. }
  45093. return '\n\nfound in\n\n' + tree
  45094. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  45095. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  45096. : formatComponentName(vm))); })
  45097. .join('\n')
  45098. } else {
  45099. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  45100. }
  45101. };
  45102. }
  45103. /* */
  45104. var uid = 0;
  45105. /**
  45106. * A dep is an observable that can have multiple
  45107. * directives subscribing to it.
  45108. */
  45109. var Dep = function Dep () {
  45110. this.id = uid++;
  45111. this.subs = [];
  45112. };
  45113. Dep.prototype.addSub = function addSub (sub) {
  45114. this.subs.push(sub);
  45115. };
  45116. Dep.prototype.removeSub = function removeSub (sub) {
  45117. remove(this.subs, sub);
  45118. };
  45119. Dep.prototype.depend = function depend () {
  45120. if (Dep.target) {
  45121. Dep.target.addDep(this);
  45122. }
  45123. };
  45124. Dep.prototype.notify = function notify () {
  45125. // stabilize the subscriber list first
  45126. var subs = this.subs.slice();
  45127. if (!config.async) {
  45128. // subs aren't sorted in scheduler if not running async
  45129. // we need to sort them now to make sure they fire in correct
  45130. // order
  45131. subs.sort(function (a, b) { return a.id - b.id; });
  45132. }
  45133. for (var i = 0, l = subs.length; i < l; i++) {
  45134. subs[i].update();
  45135. }
  45136. };
  45137. // The current target watcher being evaluated.
  45138. // This is globally unique because only one watcher
  45139. // can be evaluated at a time.
  45140. Dep.target = null;
  45141. var targetStack = [];
  45142. function pushTarget (target) {
  45143. targetStack.push(target);
  45144. Dep.target = target;
  45145. }
  45146. function popTarget () {
  45147. targetStack.pop();
  45148. Dep.target = targetStack[targetStack.length - 1];
  45149. }
  45150. /* */
  45151. var VNode = function VNode (
  45152. tag,
  45153. data,
  45154. children,
  45155. text,
  45156. elm,
  45157. context,
  45158. componentOptions,
  45159. asyncFactory
  45160. ) {
  45161. this.tag = tag;
  45162. this.data = data;
  45163. this.children = children;
  45164. this.text = text;
  45165. this.elm = elm;
  45166. this.ns = undefined;
  45167. this.context = context;
  45168. this.fnContext = undefined;
  45169. this.fnOptions = undefined;
  45170. this.fnScopeId = undefined;
  45171. this.key = data && data.key;
  45172. this.componentOptions = componentOptions;
  45173. this.componentInstance = undefined;
  45174. this.parent = undefined;
  45175. this.raw = false;
  45176. this.isStatic = false;
  45177. this.isRootInsert = true;
  45178. this.isComment = false;
  45179. this.isCloned = false;
  45180. this.isOnce = false;
  45181. this.asyncFactory = asyncFactory;
  45182. this.asyncMeta = undefined;
  45183. this.isAsyncPlaceholder = false;
  45184. };
  45185. var prototypeAccessors = { child: { configurable: true } };
  45186. // DEPRECATED: alias for componentInstance for backwards compat.
  45187. /* istanbul ignore next */
  45188. prototypeAccessors.child.get = function () {
  45189. return this.componentInstance
  45190. };
  45191. Object.defineProperties( VNode.prototype, prototypeAccessors );
  45192. var createEmptyVNode = function (text) {
  45193. if ( text === void 0 ) text = '';
  45194. var node = new VNode();
  45195. node.text = text;
  45196. node.isComment = true;
  45197. return node
  45198. };
  45199. function createTextVNode (val) {
  45200. return new VNode(undefined, undefined, undefined, String(val))
  45201. }
  45202. // optimized shallow clone
  45203. // used for static nodes and slot nodes because they may be reused across
  45204. // multiple renders, cloning them avoids errors when DOM manipulations rely
  45205. // on their elm reference.
  45206. function cloneVNode (vnode) {
  45207. var cloned = new VNode(
  45208. vnode.tag,
  45209. vnode.data,
  45210. // #7975
  45211. // clone children array to avoid mutating original in case of cloning
  45212. // a child.
  45213. vnode.children && vnode.children.slice(),
  45214. vnode.text,
  45215. vnode.elm,
  45216. vnode.context,
  45217. vnode.componentOptions,
  45218. vnode.asyncFactory
  45219. );
  45220. cloned.ns = vnode.ns;
  45221. cloned.isStatic = vnode.isStatic;
  45222. cloned.key = vnode.key;
  45223. cloned.isComment = vnode.isComment;
  45224. cloned.fnContext = vnode.fnContext;
  45225. cloned.fnOptions = vnode.fnOptions;
  45226. cloned.fnScopeId = vnode.fnScopeId;
  45227. cloned.asyncMeta = vnode.asyncMeta;
  45228. cloned.isCloned = true;
  45229. return cloned
  45230. }
  45231. /*
  45232. * not type checking this file because flow doesn't play well with
  45233. * dynamically accessing methods on Array prototype
  45234. */
  45235. var arrayProto = Array.prototype;
  45236. var arrayMethods = Object.create(arrayProto);
  45237. var methodsToPatch = [
  45238. 'push',
  45239. 'pop',
  45240. 'shift',
  45241. 'unshift',
  45242. 'splice',
  45243. 'sort',
  45244. 'reverse'
  45245. ];
  45246. /**
  45247. * Intercept mutating methods and emit events
  45248. */
  45249. methodsToPatch.forEach(function (method) {
  45250. // cache original method
  45251. var original = arrayProto[method];
  45252. def(arrayMethods, method, function mutator () {
  45253. var args = [], len = arguments.length;
  45254. while ( len-- ) args[ len ] = arguments[ len ];
  45255. var result = original.apply(this, args);
  45256. var ob = this.__ob__;
  45257. var inserted;
  45258. switch (method) {
  45259. case 'push':
  45260. case 'unshift':
  45261. inserted = args;
  45262. break
  45263. case 'splice':
  45264. inserted = args.slice(2);
  45265. break
  45266. }
  45267. if (inserted) { ob.observeArray(inserted); }
  45268. // notify change
  45269. ob.dep.notify();
  45270. return result
  45271. });
  45272. });
  45273. /* */
  45274. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  45275. /**
  45276. * In some cases we may want to disable observation inside a component's
  45277. * update computation.
  45278. */
  45279. var shouldObserve = true;
  45280. function toggleObserving (value) {
  45281. shouldObserve = value;
  45282. }
  45283. /**
  45284. * Observer class that is attached to each observed
  45285. * object. Once attached, the observer converts the target
  45286. * object's property keys into getter/setters that
  45287. * collect dependencies and dispatch updates.
  45288. */
  45289. var Observer = function Observer (value) {
  45290. this.value = value;
  45291. this.dep = new Dep();
  45292. this.vmCount = 0;
  45293. def(value, '__ob__', this);
  45294. if (Array.isArray(value)) {
  45295. if (hasProto) {
  45296. protoAugment(value, arrayMethods);
  45297. } else {
  45298. copyAugment(value, arrayMethods, arrayKeys);
  45299. }
  45300. this.observeArray(value);
  45301. } else {
  45302. this.walk(value);
  45303. }
  45304. };
  45305. /**
  45306. * Walk through all properties and convert them into
  45307. * getter/setters. This method should only be called when
  45308. * value type is Object.
  45309. */
  45310. Observer.prototype.walk = function walk (obj) {
  45311. var keys = Object.keys(obj);
  45312. for (var i = 0; i < keys.length; i++) {
  45313. defineReactive$$1(obj, keys[i]);
  45314. }
  45315. };
  45316. /**
  45317. * Observe a list of Array items.
  45318. */
  45319. Observer.prototype.observeArray = function observeArray (items) {
  45320. for (var i = 0, l = items.length; i < l; i++) {
  45321. observe(items[i]);
  45322. }
  45323. };
  45324. // helpers
  45325. /**
  45326. * Augment a target Object or Array by intercepting
  45327. * the prototype chain using __proto__
  45328. */
  45329. function protoAugment (target, src) {
  45330. /* eslint-disable no-proto */
  45331. target.__proto__ = src;
  45332. /* eslint-enable no-proto */
  45333. }
  45334. /**
  45335. * Augment a target Object or Array by defining
  45336. * hidden properties.
  45337. */
  45338. /* istanbul ignore next */
  45339. function copyAugment (target, src, keys) {
  45340. for (var i = 0, l = keys.length; i < l; i++) {
  45341. var key = keys[i];
  45342. def(target, key, src[key]);
  45343. }
  45344. }
  45345. /**
  45346. * Attempt to create an observer instance for a value,
  45347. * returns the new observer if successfully observed,
  45348. * or the existing observer if the value already has one.
  45349. */
  45350. function observe (value, asRootData) {
  45351. if (!isObject(value) || value instanceof VNode) {
  45352. return
  45353. }
  45354. var ob;
  45355. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  45356. ob = value.__ob__;
  45357. } else if (
  45358. shouldObserve &&
  45359. !isServerRendering() &&
  45360. (Array.isArray(value) || isPlainObject(value)) &&
  45361. Object.isExtensible(value) &&
  45362. !value._isVue
  45363. ) {
  45364. ob = new Observer(value);
  45365. }
  45366. if (asRootData && ob) {
  45367. ob.vmCount++;
  45368. }
  45369. return ob
  45370. }
  45371. /**
  45372. * Define a reactive property on an Object.
  45373. */
  45374. function defineReactive$$1 (
  45375. obj,
  45376. key,
  45377. val,
  45378. customSetter,
  45379. shallow
  45380. ) {
  45381. var dep = new Dep();
  45382. var property = Object.getOwnPropertyDescriptor(obj, key);
  45383. if (property && property.configurable === false) {
  45384. return
  45385. }
  45386. // cater for pre-defined getter/setters
  45387. var getter = property && property.get;
  45388. var setter = property && property.set;
  45389. if ((!getter || setter) && arguments.length === 2) {
  45390. val = obj[key];
  45391. }
  45392. var childOb = !shallow && observe(val);
  45393. Object.defineProperty(obj, key, {
  45394. enumerable: true,
  45395. configurable: true,
  45396. get: function reactiveGetter () {
  45397. var value = getter ? getter.call(obj) : val;
  45398. if (Dep.target) {
  45399. dep.depend();
  45400. if (childOb) {
  45401. childOb.dep.depend();
  45402. if (Array.isArray(value)) {
  45403. dependArray(value);
  45404. }
  45405. }
  45406. }
  45407. return value
  45408. },
  45409. set: function reactiveSetter (newVal) {
  45410. var value = getter ? getter.call(obj) : val;
  45411. /* eslint-disable no-self-compare */
  45412. if (newVal === value || (newVal !== newVal && value !== value)) {
  45413. return
  45414. }
  45415. /* eslint-enable no-self-compare */
  45416. if (customSetter) {
  45417. customSetter();
  45418. }
  45419. // #7981: for accessor properties without setter
  45420. if (getter && !setter) { return }
  45421. if (setter) {
  45422. setter.call(obj, newVal);
  45423. } else {
  45424. val = newVal;
  45425. }
  45426. childOb = !shallow && observe(newVal);
  45427. dep.notify();
  45428. }
  45429. });
  45430. }
  45431. /**
  45432. * Set a property on an object. Adds the new property and
  45433. * triggers change notification if the property doesn't
  45434. * already exist.
  45435. */
  45436. function set (target, key, val) {
  45437. if (isUndef(target) || isPrimitive(target)
  45438. ) {
  45439. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  45440. }
  45441. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45442. target.length = Math.max(target.length, key);
  45443. target.splice(key, 1, val);
  45444. return val
  45445. }
  45446. if (key in target && !(key in Object.prototype)) {
  45447. target[key] = val;
  45448. return val
  45449. }
  45450. var ob = (target).__ob__;
  45451. if (target._isVue || (ob && ob.vmCount)) {
  45452. warn(
  45453. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  45454. 'at runtime - declare it upfront in the data option.'
  45455. );
  45456. return val
  45457. }
  45458. if (!ob) {
  45459. target[key] = val;
  45460. return val
  45461. }
  45462. defineReactive$$1(ob.value, key, val);
  45463. ob.dep.notify();
  45464. return val
  45465. }
  45466. /**
  45467. * Delete a property and trigger change if necessary.
  45468. */
  45469. function del (target, key) {
  45470. if (isUndef(target) || isPrimitive(target)
  45471. ) {
  45472. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  45473. }
  45474. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45475. target.splice(key, 1);
  45476. return
  45477. }
  45478. var ob = (target).__ob__;
  45479. if (target._isVue || (ob && ob.vmCount)) {
  45480. warn(
  45481. 'Avoid deleting properties on a Vue instance or its root $data ' +
  45482. '- just set it to null.'
  45483. );
  45484. return
  45485. }
  45486. if (!hasOwn(target, key)) {
  45487. return
  45488. }
  45489. delete target[key];
  45490. if (!ob) {
  45491. return
  45492. }
  45493. ob.dep.notify();
  45494. }
  45495. /**
  45496. * Collect dependencies on array elements when the array is touched, since
  45497. * we cannot intercept array element access like property getters.
  45498. */
  45499. function dependArray (value) {
  45500. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  45501. e = value[i];
  45502. e && e.__ob__ && e.__ob__.dep.depend();
  45503. if (Array.isArray(e)) {
  45504. dependArray(e);
  45505. }
  45506. }
  45507. }
  45508. /* */
  45509. /**
  45510. * Option overwriting strategies are functions that handle
  45511. * how to merge a parent option value and a child option
  45512. * value into the final value.
  45513. */
  45514. var strats = config.optionMergeStrategies;
  45515. /**
  45516. * Options with restrictions
  45517. */
  45518. {
  45519. strats.el = strats.propsData = function (parent, child, vm, key) {
  45520. if (!vm) {
  45521. warn(
  45522. "option \"" + key + "\" can only be used during instance " +
  45523. 'creation with the `new` keyword.'
  45524. );
  45525. }
  45526. return defaultStrat(parent, child)
  45527. };
  45528. }
  45529. /**
  45530. * Helper that recursively merges two data objects together.
  45531. */
  45532. function mergeData (to, from) {
  45533. if (!from) { return to }
  45534. var key, toVal, fromVal;
  45535. var keys = hasSymbol
  45536. ? Reflect.ownKeys(from)
  45537. : Object.keys(from);
  45538. for (var i = 0; i < keys.length; i++) {
  45539. key = keys[i];
  45540. // in case the object is already observed...
  45541. if (key === '__ob__') { continue }
  45542. toVal = to[key];
  45543. fromVal = from[key];
  45544. if (!hasOwn(to, key)) {
  45545. set(to, key, fromVal);
  45546. } else if (
  45547. toVal !== fromVal &&
  45548. isPlainObject(toVal) &&
  45549. isPlainObject(fromVal)
  45550. ) {
  45551. mergeData(toVal, fromVal);
  45552. }
  45553. }
  45554. return to
  45555. }
  45556. /**
  45557. * Data
  45558. */
  45559. function mergeDataOrFn (
  45560. parentVal,
  45561. childVal,
  45562. vm
  45563. ) {
  45564. if (!vm) {
  45565. // in a Vue.extend merge, both should be functions
  45566. if (!childVal) {
  45567. return parentVal
  45568. }
  45569. if (!parentVal) {
  45570. return childVal
  45571. }
  45572. // when parentVal & childVal are both present,
  45573. // we need to return a function that returns the
  45574. // merged result of both functions... no need to
  45575. // check if parentVal is a function here because
  45576. // it has to be a function to pass previous merges.
  45577. return function mergedDataFn () {
  45578. return mergeData(
  45579. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  45580. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  45581. )
  45582. }
  45583. } else {
  45584. return function mergedInstanceDataFn () {
  45585. // instance merge
  45586. var instanceData = typeof childVal === 'function'
  45587. ? childVal.call(vm, vm)
  45588. : childVal;
  45589. var defaultData = typeof parentVal === 'function'
  45590. ? parentVal.call(vm, vm)
  45591. : parentVal;
  45592. if (instanceData) {
  45593. return mergeData(instanceData, defaultData)
  45594. } else {
  45595. return defaultData
  45596. }
  45597. }
  45598. }
  45599. }
  45600. strats.data = function (
  45601. parentVal,
  45602. childVal,
  45603. vm
  45604. ) {
  45605. if (!vm) {
  45606. if (childVal && typeof childVal !== 'function') {
  45607. warn(
  45608. 'The "data" option should be a function ' +
  45609. 'that returns a per-instance value in component ' +
  45610. 'definitions.',
  45611. vm
  45612. );
  45613. return parentVal
  45614. }
  45615. return mergeDataOrFn(parentVal, childVal)
  45616. }
  45617. return mergeDataOrFn(parentVal, childVal, vm)
  45618. };
  45619. /**
  45620. * Hooks and props are merged as arrays.
  45621. */
  45622. function mergeHook (
  45623. parentVal,
  45624. childVal
  45625. ) {
  45626. var res = childVal
  45627. ? parentVal
  45628. ? parentVal.concat(childVal)
  45629. : Array.isArray(childVal)
  45630. ? childVal
  45631. : [childVal]
  45632. : parentVal;
  45633. return res
  45634. ? dedupeHooks(res)
  45635. : res
  45636. }
  45637. function dedupeHooks (hooks) {
  45638. var res = [];
  45639. for (var i = 0; i < hooks.length; i++) {
  45640. if (res.indexOf(hooks[i]) === -1) {
  45641. res.push(hooks[i]);
  45642. }
  45643. }
  45644. return res
  45645. }
  45646. LIFECYCLE_HOOKS.forEach(function (hook) {
  45647. strats[hook] = mergeHook;
  45648. });
  45649. /**
  45650. * Assets
  45651. *
  45652. * When a vm is present (instance creation), we need to do
  45653. * a three-way merge between constructor options, instance
  45654. * options and parent options.
  45655. */
  45656. function mergeAssets (
  45657. parentVal,
  45658. childVal,
  45659. vm,
  45660. key
  45661. ) {
  45662. var res = Object.create(parentVal || null);
  45663. if (childVal) {
  45664. assertObjectType(key, childVal, vm);
  45665. return extend(res, childVal)
  45666. } else {
  45667. return res
  45668. }
  45669. }
  45670. ASSET_TYPES.forEach(function (type) {
  45671. strats[type + 's'] = mergeAssets;
  45672. });
  45673. /**
  45674. * Watchers.
  45675. *
  45676. * Watchers hashes should not overwrite one
  45677. * another, so we merge them as arrays.
  45678. */
  45679. strats.watch = function (
  45680. parentVal,
  45681. childVal,
  45682. vm,
  45683. key
  45684. ) {
  45685. // work around Firefox's Object.prototype.watch...
  45686. if (parentVal === nativeWatch) { parentVal = undefined; }
  45687. if (childVal === nativeWatch) { childVal = undefined; }
  45688. /* istanbul ignore if */
  45689. if (!childVal) { return Object.create(parentVal || null) }
  45690. {
  45691. assertObjectType(key, childVal, vm);
  45692. }
  45693. if (!parentVal) { return childVal }
  45694. var ret = {};
  45695. extend(ret, parentVal);
  45696. for (var key$1 in childVal) {
  45697. var parent = ret[key$1];
  45698. var child = childVal[key$1];
  45699. if (parent && !Array.isArray(parent)) {
  45700. parent = [parent];
  45701. }
  45702. ret[key$1] = parent
  45703. ? parent.concat(child)
  45704. : Array.isArray(child) ? child : [child];
  45705. }
  45706. return ret
  45707. };
  45708. /**
  45709. * Other object hashes.
  45710. */
  45711. strats.props =
  45712. strats.methods =
  45713. strats.inject =
  45714. strats.computed = function (
  45715. parentVal,
  45716. childVal,
  45717. vm,
  45718. key
  45719. ) {
  45720. if (childVal && "development" !== 'production') {
  45721. assertObjectType(key, childVal, vm);
  45722. }
  45723. if (!parentVal) { return childVal }
  45724. var ret = Object.create(null);
  45725. extend(ret, parentVal);
  45726. if (childVal) { extend(ret, childVal); }
  45727. return ret
  45728. };
  45729. strats.provide = mergeDataOrFn;
  45730. /**
  45731. * Default strategy.
  45732. */
  45733. var defaultStrat = function (parentVal, childVal) {
  45734. return childVal === undefined
  45735. ? parentVal
  45736. : childVal
  45737. };
  45738. /**
  45739. * Validate component names
  45740. */
  45741. function checkComponents (options) {
  45742. for (var key in options.components) {
  45743. validateComponentName(key);
  45744. }
  45745. }
  45746. function validateComponentName (name) {
  45747. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  45748. warn(
  45749. 'Invalid component name: "' + name + '". Component names ' +
  45750. 'should conform to valid custom element name in html5 specification.'
  45751. );
  45752. }
  45753. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  45754. warn(
  45755. 'Do not use built-in or reserved HTML elements as component ' +
  45756. 'id: ' + name
  45757. );
  45758. }
  45759. }
  45760. /**
  45761. * Ensure all props option syntax are normalized into the
  45762. * Object-based format.
  45763. */
  45764. function normalizeProps (options, vm) {
  45765. var props = options.props;
  45766. if (!props) { return }
  45767. var res = {};
  45768. var i, val, name;
  45769. if (Array.isArray(props)) {
  45770. i = props.length;
  45771. while (i--) {
  45772. val = props[i];
  45773. if (typeof val === 'string') {
  45774. name = camelize(val);
  45775. res[name] = { type: null };
  45776. } else {
  45777. warn('props must be strings when using array syntax.');
  45778. }
  45779. }
  45780. } else if (isPlainObject(props)) {
  45781. for (var key in props) {
  45782. val = props[key];
  45783. name = camelize(key);
  45784. res[name] = isPlainObject(val)
  45785. ? val
  45786. : { type: val };
  45787. }
  45788. } else {
  45789. warn(
  45790. "Invalid value for option \"props\": expected an Array or an Object, " +
  45791. "but got " + (toRawType(props)) + ".",
  45792. vm
  45793. );
  45794. }
  45795. options.props = res;
  45796. }
  45797. /**
  45798. * Normalize all injections into Object-based format
  45799. */
  45800. function normalizeInject (options, vm) {
  45801. var inject = options.inject;
  45802. if (!inject) { return }
  45803. var normalized = options.inject = {};
  45804. if (Array.isArray(inject)) {
  45805. for (var i = 0; i < inject.length; i++) {
  45806. normalized[inject[i]] = { from: inject[i] };
  45807. }
  45808. } else if (isPlainObject(inject)) {
  45809. for (var key in inject) {
  45810. var val = inject[key];
  45811. normalized[key] = isPlainObject(val)
  45812. ? extend({ from: key }, val)
  45813. : { from: val };
  45814. }
  45815. } else {
  45816. warn(
  45817. "Invalid value for option \"inject\": expected an Array or an Object, " +
  45818. "but got " + (toRawType(inject)) + ".",
  45819. vm
  45820. );
  45821. }
  45822. }
  45823. /**
  45824. * Normalize raw function directives into object format.
  45825. */
  45826. function normalizeDirectives (options) {
  45827. var dirs = options.directives;
  45828. if (dirs) {
  45829. for (var key in dirs) {
  45830. var def$$1 = dirs[key];
  45831. if (typeof def$$1 === 'function') {
  45832. dirs[key] = { bind: def$$1, update: def$$1 };
  45833. }
  45834. }
  45835. }
  45836. }
  45837. function assertObjectType (name, value, vm) {
  45838. if (!isPlainObject(value)) {
  45839. warn(
  45840. "Invalid value for option \"" + name + "\": expected an Object, " +
  45841. "but got " + (toRawType(value)) + ".",
  45842. vm
  45843. );
  45844. }
  45845. }
  45846. /**
  45847. * Merge two option objects into a new one.
  45848. * Core utility used in both instantiation and inheritance.
  45849. */
  45850. function mergeOptions (
  45851. parent,
  45852. child,
  45853. vm
  45854. ) {
  45855. {
  45856. checkComponents(child);
  45857. }
  45858. if (typeof child === 'function') {
  45859. child = child.options;
  45860. }
  45861. normalizeProps(child, vm);
  45862. normalizeInject(child, vm);
  45863. normalizeDirectives(child);
  45864. // Apply extends and mixins on the child options,
  45865. // but only if it is a raw options object that isn't
  45866. // the result of another mergeOptions call.
  45867. // Only merged options has the _base property.
  45868. if (!child._base) {
  45869. if (child.extends) {
  45870. parent = mergeOptions(parent, child.extends, vm);
  45871. }
  45872. if (child.mixins) {
  45873. for (var i = 0, l = child.mixins.length; i < l; i++) {
  45874. parent = mergeOptions(parent, child.mixins[i], vm);
  45875. }
  45876. }
  45877. }
  45878. var options = {};
  45879. var key;
  45880. for (key in parent) {
  45881. mergeField(key);
  45882. }
  45883. for (key in child) {
  45884. if (!hasOwn(parent, key)) {
  45885. mergeField(key);
  45886. }
  45887. }
  45888. function mergeField (key) {
  45889. var strat = strats[key] || defaultStrat;
  45890. options[key] = strat(parent[key], child[key], vm, key);
  45891. }
  45892. return options
  45893. }
  45894. /**
  45895. * Resolve an asset.
  45896. * This function is used because child instances need access
  45897. * to assets defined in its ancestor chain.
  45898. */
  45899. function resolveAsset (
  45900. options,
  45901. type,
  45902. id,
  45903. warnMissing
  45904. ) {
  45905. /* istanbul ignore if */
  45906. if (typeof id !== 'string') {
  45907. return
  45908. }
  45909. var assets = options[type];
  45910. // check local registration variations first
  45911. if (hasOwn(assets, id)) { return assets[id] }
  45912. var camelizedId = camelize(id);
  45913. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  45914. var PascalCaseId = capitalize(camelizedId);
  45915. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  45916. // fallback to prototype chain
  45917. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  45918. if (warnMissing && !res) {
  45919. warn(
  45920. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  45921. options
  45922. );
  45923. }
  45924. return res
  45925. }
  45926. /* */
  45927. function validateProp (
  45928. key,
  45929. propOptions,
  45930. propsData,
  45931. vm
  45932. ) {
  45933. var prop = propOptions[key];
  45934. var absent = !hasOwn(propsData, key);
  45935. var value = propsData[key];
  45936. // boolean casting
  45937. var booleanIndex = getTypeIndex(Boolean, prop.type);
  45938. if (booleanIndex > -1) {
  45939. if (absent && !hasOwn(prop, 'default')) {
  45940. value = false;
  45941. } else if (value === '' || value === hyphenate(key)) {
  45942. // only cast empty string / same name to boolean if
  45943. // boolean has higher priority
  45944. var stringIndex = getTypeIndex(String, prop.type);
  45945. if (stringIndex < 0 || booleanIndex < stringIndex) {
  45946. value = true;
  45947. }
  45948. }
  45949. }
  45950. // check default value
  45951. if (value === undefined) {
  45952. value = getPropDefaultValue(vm, prop, key);
  45953. // since the default value is a fresh copy,
  45954. // make sure to observe it.
  45955. var prevShouldObserve = shouldObserve;
  45956. toggleObserving(true);
  45957. observe(value);
  45958. toggleObserving(prevShouldObserve);
  45959. }
  45960. {
  45961. assertProp(prop, key, value, vm, absent);
  45962. }
  45963. return value
  45964. }
  45965. /**
  45966. * Get the default value of a prop.
  45967. */
  45968. function getPropDefaultValue (vm, prop, key) {
  45969. // no default, return undefined
  45970. if (!hasOwn(prop, 'default')) {
  45971. return undefined
  45972. }
  45973. var def = prop.default;
  45974. // warn against non-factory defaults for Object & Array
  45975. if (isObject(def)) {
  45976. warn(
  45977. 'Invalid default value for prop "' + key + '": ' +
  45978. 'Props with type Object/Array must use a factory function ' +
  45979. 'to return the default value.',
  45980. vm
  45981. );
  45982. }
  45983. // the raw prop value was also undefined from previous render,
  45984. // return previous default value to avoid unnecessary watcher trigger
  45985. if (vm && vm.$options.propsData &&
  45986. vm.$options.propsData[key] === undefined &&
  45987. vm._props[key] !== undefined
  45988. ) {
  45989. return vm._props[key]
  45990. }
  45991. // call factory function for non-Function types
  45992. // a value is Function if its prototype is function even across different execution context
  45993. return typeof def === 'function' && getType(prop.type) !== 'Function'
  45994. ? def.call(vm)
  45995. : def
  45996. }
  45997. /**
  45998. * Assert whether a prop is valid.
  45999. */
  46000. function assertProp (
  46001. prop,
  46002. name,
  46003. value,
  46004. vm,
  46005. absent
  46006. ) {
  46007. if (prop.required && absent) {
  46008. warn(
  46009. 'Missing required prop: "' + name + '"',
  46010. vm
  46011. );
  46012. return
  46013. }
  46014. if (value == null && !prop.required) {
  46015. return
  46016. }
  46017. var type = prop.type;
  46018. var valid = !type || type === true;
  46019. var expectedTypes = [];
  46020. if (type) {
  46021. if (!Array.isArray(type)) {
  46022. type = [type];
  46023. }
  46024. for (var i = 0; i < type.length && !valid; i++) {
  46025. var assertedType = assertType(value, type[i]);
  46026. expectedTypes.push(assertedType.expectedType || '');
  46027. valid = assertedType.valid;
  46028. }
  46029. }
  46030. if (!valid) {
  46031. warn(
  46032. getInvalidTypeMessage(name, value, expectedTypes),
  46033. vm
  46034. );
  46035. return
  46036. }
  46037. var validator = prop.validator;
  46038. if (validator) {
  46039. if (!validator(value)) {
  46040. warn(
  46041. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  46042. vm
  46043. );
  46044. }
  46045. }
  46046. }
  46047. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  46048. function assertType (value, type) {
  46049. var valid;
  46050. var expectedType = getType(type);
  46051. if (simpleCheckRE.test(expectedType)) {
  46052. var t = typeof value;
  46053. valid = t === expectedType.toLowerCase();
  46054. // for primitive wrapper objects
  46055. if (!valid && t === 'object') {
  46056. valid = value instanceof type;
  46057. }
  46058. } else if (expectedType === 'Object') {
  46059. valid = isPlainObject(value);
  46060. } else if (expectedType === 'Array') {
  46061. valid = Array.isArray(value);
  46062. } else {
  46063. valid = value instanceof type;
  46064. }
  46065. return {
  46066. valid: valid,
  46067. expectedType: expectedType
  46068. }
  46069. }
  46070. /**
  46071. * Use function string name to check built-in types,
  46072. * because a simple equality check will fail when running
  46073. * across different vms / iframes.
  46074. */
  46075. function getType (fn) {
  46076. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  46077. return match ? match[1] : ''
  46078. }
  46079. function isSameType (a, b) {
  46080. return getType(a) === getType(b)
  46081. }
  46082. function getTypeIndex (type, expectedTypes) {
  46083. if (!Array.isArray(expectedTypes)) {
  46084. return isSameType(expectedTypes, type) ? 0 : -1
  46085. }
  46086. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  46087. if (isSameType(expectedTypes[i], type)) {
  46088. return i
  46089. }
  46090. }
  46091. return -1
  46092. }
  46093. function getInvalidTypeMessage (name, value, expectedTypes) {
  46094. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  46095. " Expected " + (expectedTypes.map(capitalize).join(', '));
  46096. var expectedType = expectedTypes[0];
  46097. var receivedType = toRawType(value);
  46098. var expectedValue = styleValue(value, expectedType);
  46099. var receivedValue = styleValue(value, receivedType);
  46100. // check if we need to specify expected value
  46101. if (expectedTypes.length === 1 &&
  46102. isExplicable(expectedType) &&
  46103. !isBoolean(expectedType, receivedType)) {
  46104. message += " with value " + expectedValue;
  46105. }
  46106. message += ", got " + receivedType + " ";
  46107. // check if we need to specify received value
  46108. if (isExplicable(receivedType)) {
  46109. message += "with value " + receivedValue + ".";
  46110. }
  46111. return message
  46112. }
  46113. function styleValue (value, type) {
  46114. if (type === 'String') {
  46115. return ("\"" + value + "\"")
  46116. } else if (type === 'Number') {
  46117. return ("" + (Number(value)))
  46118. } else {
  46119. return ("" + value)
  46120. }
  46121. }
  46122. function isExplicable (value) {
  46123. var explicitTypes = ['string', 'number', 'boolean'];
  46124. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  46125. }
  46126. function isBoolean () {
  46127. var args = [], len = arguments.length;
  46128. while ( len-- ) args[ len ] = arguments[ len ];
  46129. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  46130. }
  46131. /* */
  46132. function handleError (err, vm, info) {
  46133. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  46134. // See: https://github.com/vuejs/vuex/issues/1505
  46135. pushTarget();
  46136. try {
  46137. if (vm) {
  46138. var cur = vm;
  46139. while ((cur = cur.$parent)) {
  46140. var hooks = cur.$options.errorCaptured;
  46141. if (hooks) {
  46142. for (var i = 0; i < hooks.length; i++) {
  46143. try {
  46144. var capture = hooks[i].call(cur, err, vm, info) === false;
  46145. if (capture) { return }
  46146. } catch (e) {
  46147. globalHandleError(e, cur, 'errorCaptured hook');
  46148. }
  46149. }
  46150. }
  46151. }
  46152. }
  46153. globalHandleError(err, vm, info);
  46154. } finally {
  46155. popTarget();
  46156. }
  46157. }
  46158. function invokeWithErrorHandling (
  46159. handler,
  46160. context,
  46161. args,
  46162. vm,
  46163. info
  46164. ) {
  46165. var res;
  46166. try {
  46167. res = args ? handler.apply(context, args) : handler.call(context);
  46168. if (res && !res._isVue && isPromise(res) && !res._handled) {
  46169. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  46170. // issue #9511
  46171. // avoid catch triggering multiple times when nested calls
  46172. res._handled = true;
  46173. }
  46174. } catch (e) {
  46175. handleError(e, vm, info);
  46176. }
  46177. return res
  46178. }
  46179. function globalHandleError (err, vm, info) {
  46180. if (config.errorHandler) {
  46181. try {
  46182. return config.errorHandler.call(null, err, vm, info)
  46183. } catch (e) {
  46184. // if the user intentionally throws the original error in the handler,
  46185. // do not log it twice
  46186. if (e !== err) {
  46187. logError(e, null, 'config.errorHandler');
  46188. }
  46189. }
  46190. }
  46191. logError(err, vm, info);
  46192. }
  46193. function logError (err, vm, info) {
  46194. {
  46195. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  46196. }
  46197. /* istanbul ignore else */
  46198. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  46199. console.error(err);
  46200. } else {
  46201. throw err
  46202. }
  46203. }
  46204. /* */
  46205. var isUsingMicroTask = false;
  46206. var callbacks = [];
  46207. var pending = false;
  46208. function flushCallbacks () {
  46209. pending = false;
  46210. var copies = callbacks.slice(0);
  46211. callbacks.length = 0;
  46212. for (var i = 0; i < copies.length; i++) {
  46213. copies[i]();
  46214. }
  46215. }
  46216. // Here we have async deferring wrappers using microtasks.
  46217. // In 2.5 we used (macro) tasks (in combination with microtasks).
  46218. // However, it has subtle problems when state is changed right before repaint
  46219. // (e.g. #6813, out-in transitions).
  46220. // Also, using (macro) tasks in event handler would cause some weird behaviors
  46221. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  46222. // So we now use microtasks everywhere, again.
  46223. // A major drawback of this tradeoff is that there are some scenarios
  46224. // where microtasks have too high a priority and fire in between supposedly
  46225. // sequential events (e.g. #4521, #6690, which have workarounds)
  46226. // or even between bubbling of the same event (#6566).
  46227. var timerFunc;
  46228. // The nextTick behavior leverages the microtask queue, which can be accessed
  46229. // via either native Promise.then or MutationObserver.
  46230. // MutationObserver has wider support, however it is seriously bugged in
  46231. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  46232. // completely stops working after triggering a few times... so, if native
  46233. // Promise is available, we will use it:
  46234. /* istanbul ignore next, $flow-disable-line */
  46235. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  46236. var p = Promise.resolve();
  46237. timerFunc = function () {
  46238. p.then(flushCallbacks);
  46239. // In problematic UIWebViews, Promise.then doesn't completely break, but
  46240. // it can get stuck in a weird state where callbacks are pushed into the
  46241. // microtask queue but the queue isn't being flushed, until the browser
  46242. // needs to do some other work, e.g. handle a timer. Therefore we can
  46243. // "force" the microtask queue to be flushed by adding an empty timer.
  46244. if (isIOS) { setTimeout(noop); }
  46245. };
  46246. isUsingMicroTask = true;
  46247. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  46248. isNative(MutationObserver) ||
  46249. // PhantomJS and iOS 7.x
  46250. MutationObserver.toString() === '[object MutationObserverConstructor]'
  46251. )) {
  46252. // Use MutationObserver where native Promise is not available,
  46253. // e.g. PhantomJS, iOS7, Android 4.4
  46254. // (#6466 MutationObserver is unreliable in IE11)
  46255. var counter = 1;
  46256. var observer = new MutationObserver(flushCallbacks);
  46257. var textNode = document.createTextNode(String(counter));
  46258. observer.observe(textNode, {
  46259. characterData: true
  46260. });
  46261. timerFunc = function () {
  46262. counter = (counter + 1) % 2;
  46263. textNode.data = String(counter);
  46264. };
  46265. isUsingMicroTask = true;
  46266. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  46267. // Fallback to setImmediate.
  46268. // Technically it leverages the (macro) task queue,
  46269. // but it is still a better choice than setTimeout.
  46270. timerFunc = function () {
  46271. setImmediate(flushCallbacks);
  46272. };
  46273. } else {
  46274. // Fallback to setTimeout.
  46275. timerFunc = function () {
  46276. setTimeout(flushCallbacks, 0);
  46277. };
  46278. }
  46279. function nextTick (cb, ctx) {
  46280. var _resolve;
  46281. callbacks.push(function () {
  46282. if (cb) {
  46283. try {
  46284. cb.call(ctx);
  46285. } catch (e) {
  46286. handleError(e, ctx, 'nextTick');
  46287. }
  46288. } else if (_resolve) {
  46289. _resolve(ctx);
  46290. }
  46291. });
  46292. if (!pending) {
  46293. pending = true;
  46294. timerFunc();
  46295. }
  46296. // $flow-disable-line
  46297. if (!cb && typeof Promise !== 'undefined') {
  46298. return new Promise(function (resolve) {
  46299. _resolve = resolve;
  46300. })
  46301. }
  46302. }
  46303. /* */
  46304. var mark;
  46305. var measure;
  46306. {
  46307. var perf = inBrowser && window.performance;
  46308. /* istanbul ignore if */
  46309. if (
  46310. perf &&
  46311. perf.mark &&
  46312. perf.measure &&
  46313. perf.clearMarks &&
  46314. perf.clearMeasures
  46315. ) {
  46316. mark = function (tag) { return perf.mark(tag); };
  46317. measure = function (name, startTag, endTag) {
  46318. perf.measure(name, startTag, endTag);
  46319. perf.clearMarks(startTag);
  46320. perf.clearMarks(endTag);
  46321. // perf.clearMeasures(name)
  46322. };
  46323. }
  46324. }
  46325. /* not type checking this file because flow doesn't play well with Proxy */
  46326. var initProxy;
  46327. {
  46328. var allowedGlobals = makeMap(
  46329. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  46330. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  46331. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  46332. 'require' // for Webpack/Browserify
  46333. );
  46334. var warnNonPresent = function (target, key) {
  46335. warn(
  46336. "Property or method \"" + key + "\" is not defined on the instance but " +
  46337. 'referenced during render. Make sure that this property is reactive, ' +
  46338. 'either in the data option, or for class-based components, by ' +
  46339. 'initializing the property. ' +
  46340. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  46341. target
  46342. );
  46343. };
  46344. var warnReservedPrefix = function (target, key) {
  46345. warn(
  46346. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  46347. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  46348. 'prevent conflicts with Vue internals. ' +
  46349. 'See: https://vuejs.org/v2/api/#data',
  46350. target
  46351. );
  46352. };
  46353. var hasProxy =
  46354. typeof Proxy !== 'undefined' && isNative(Proxy);
  46355. if (hasProxy) {
  46356. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  46357. config.keyCodes = new Proxy(config.keyCodes, {
  46358. set: function set (target, key, value) {
  46359. if (isBuiltInModifier(key)) {
  46360. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  46361. return false
  46362. } else {
  46363. target[key] = value;
  46364. return true
  46365. }
  46366. }
  46367. });
  46368. }
  46369. var hasHandler = {
  46370. has: function has (target, key) {
  46371. var has = key in target;
  46372. var isAllowed = allowedGlobals(key) ||
  46373. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  46374. if (!has && !isAllowed) {
  46375. if (key in target.$data) { warnReservedPrefix(target, key); }
  46376. else { warnNonPresent(target, key); }
  46377. }
  46378. return has || !isAllowed
  46379. }
  46380. };
  46381. var getHandler = {
  46382. get: function get (target, key) {
  46383. if (typeof key === 'string' && !(key in target)) {
  46384. if (key in target.$data) { warnReservedPrefix(target, key); }
  46385. else { warnNonPresent(target, key); }
  46386. }
  46387. return target[key]
  46388. }
  46389. };
  46390. initProxy = function initProxy (vm) {
  46391. if (hasProxy) {
  46392. // determine which proxy handler to use
  46393. var options = vm.$options;
  46394. var handlers = options.render && options.render._withStripped
  46395. ? getHandler
  46396. : hasHandler;
  46397. vm._renderProxy = new Proxy(vm, handlers);
  46398. } else {
  46399. vm._renderProxy = vm;
  46400. }
  46401. };
  46402. }
  46403. /* */
  46404. var seenObjects = new _Set();
  46405. /**
  46406. * Recursively traverse an object to evoke all converted
  46407. * getters, so that every nested property inside the object
  46408. * is collected as a "deep" dependency.
  46409. */
  46410. function traverse (val) {
  46411. _traverse(val, seenObjects);
  46412. seenObjects.clear();
  46413. }
  46414. function _traverse (val, seen) {
  46415. var i, keys;
  46416. var isA = Array.isArray(val);
  46417. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  46418. return
  46419. }
  46420. if (val.__ob__) {
  46421. var depId = val.__ob__.dep.id;
  46422. if (seen.has(depId)) {
  46423. return
  46424. }
  46425. seen.add(depId);
  46426. }
  46427. if (isA) {
  46428. i = val.length;
  46429. while (i--) { _traverse(val[i], seen); }
  46430. } else {
  46431. keys = Object.keys(val);
  46432. i = keys.length;
  46433. while (i--) { _traverse(val[keys[i]], seen); }
  46434. }
  46435. }
  46436. /* */
  46437. var normalizeEvent = cached(function (name) {
  46438. var passive = name.charAt(0) === '&';
  46439. name = passive ? name.slice(1) : name;
  46440. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  46441. name = once$$1 ? name.slice(1) : name;
  46442. var capture = name.charAt(0) === '!';
  46443. name = capture ? name.slice(1) : name;
  46444. return {
  46445. name: name,
  46446. once: once$$1,
  46447. capture: capture,
  46448. passive: passive
  46449. }
  46450. });
  46451. function createFnInvoker (fns, vm) {
  46452. function invoker () {
  46453. var arguments$1 = arguments;
  46454. var fns = invoker.fns;
  46455. if (Array.isArray(fns)) {
  46456. var cloned = fns.slice();
  46457. for (var i = 0; i < cloned.length; i++) {
  46458. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  46459. }
  46460. } else {
  46461. // return handler return value for single handlers
  46462. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  46463. }
  46464. }
  46465. invoker.fns = fns;
  46466. return invoker
  46467. }
  46468. function updateListeners (
  46469. on,
  46470. oldOn,
  46471. add,
  46472. remove$$1,
  46473. createOnceHandler,
  46474. vm
  46475. ) {
  46476. var name, def$$1, cur, old, event;
  46477. for (name in on) {
  46478. def$$1 = cur = on[name];
  46479. old = oldOn[name];
  46480. event = normalizeEvent(name);
  46481. if (isUndef(cur)) {
  46482. warn(
  46483. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  46484. vm
  46485. );
  46486. } else if (isUndef(old)) {
  46487. if (isUndef(cur.fns)) {
  46488. cur = on[name] = createFnInvoker(cur, vm);
  46489. }
  46490. if (isTrue(event.once)) {
  46491. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  46492. }
  46493. add(event.name, cur, event.capture, event.passive, event.params);
  46494. } else if (cur !== old) {
  46495. old.fns = cur;
  46496. on[name] = old;
  46497. }
  46498. }
  46499. for (name in oldOn) {
  46500. if (isUndef(on[name])) {
  46501. event = normalizeEvent(name);
  46502. remove$$1(event.name, oldOn[name], event.capture);
  46503. }
  46504. }
  46505. }
  46506. /* */
  46507. function mergeVNodeHook (def, hookKey, hook) {
  46508. if (def instanceof VNode) {
  46509. def = def.data.hook || (def.data.hook = {});
  46510. }
  46511. var invoker;
  46512. var oldHook = def[hookKey];
  46513. function wrappedHook () {
  46514. hook.apply(this, arguments);
  46515. // important: remove merged hook to ensure it's called only once
  46516. // and prevent memory leak
  46517. remove(invoker.fns, wrappedHook);
  46518. }
  46519. if (isUndef(oldHook)) {
  46520. // no existing hook
  46521. invoker = createFnInvoker([wrappedHook]);
  46522. } else {
  46523. /* istanbul ignore if */
  46524. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  46525. // already a merged invoker
  46526. invoker = oldHook;
  46527. invoker.fns.push(wrappedHook);
  46528. } else {
  46529. // existing plain hook
  46530. invoker = createFnInvoker([oldHook, wrappedHook]);
  46531. }
  46532. }
  46533. invoker.merged = true;
  46534. def[hookKey] = invoker;
  46535. }
  46536. /* */
  46537. function extractPropsFromVNodeData (
  46538. data,
  46539. Ctor,
  46540. tag
  46541. ) {
  46542. // we are only extracting raw values here.
  46543. // validation and default values are handled in the child
  46544. // component itself.
  46545. var propOptions = Ctor.options.props;
  46546. if (isUndef(propOptions)) {
  46547. return
  46548. }
  46549. var res = {};
  46550. var attrs = data.attrs;
  46551. var props = data.props;
  46552. if (isDef(attrs) || isDef(props)) {
  46553. for (var key in propOptions) {
  46554. var altKey = hyphenate(key);
  46555. {
  46556. var keyInLowerCase = key.toLowerCase();
  46557. if (
  46558. key !== keyInLowerCase &&
  46559. attrs && hasOwn(attrs, keyInLowerCase)
  46560. ) {
  46561. tip(
  46562. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  46563. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  46564. " \"" + key + "\". " +
  46565. "Note that HTML attributes are case-insensitive and camelCased " +
  46566. "props need to use their kebab-case equivalents when using in-DOM " +
  46567. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  46568. );
  46569. }
  46570. }
  46571. checkProp(res, props, key, altKey, true) ||
  46572. checkProp(res, attrs, key, altKey, false);
  46573. }
  46574. }
  46575. return res
  46576. }
  46577. function checkProp (
  46578. res,
  46579. hash,
  46580. key,
  46581. altKey,
  46582. preserve
  46583. ) {
  46584. if (isDef(hash)) {
  46585. if (hasOwn(hash, key)) {
  46586. res[key] = hash[key];
  46587. if (!preserve) {
  46588. delete hash[key];
  46589. }
  46590. return true
  46591. } else if (hasOwn(hash, altKey)) {
  46592. res[key] = hash[altKey];
  46593. if (!preserve) {
  46594. delete hash[altKey];
  46595. }
  46596. return true
  46597. }
  46598. }
  46599. return false
  46600. }
  46601. /* */
  46602. // The template compiler attempts to minimize the need for normalization by
  46603. // statically analyzing the template at compile time.
  46604. //
  46605. // For plain HTML markup, normalization can be completely skipped because the
  46606. // generated render function is guaranteed to return Array<VNode>. There are
  46607. // two cases where extra normalization is needed:
  46608. // 1. When the children contains components - because a functional component
  46609. // may return an Array instead of a single root. In this case, just a simple
  46610. // normalization is needed - if any child is an Array, we flatten the whole
  46611. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  46612. // because functional components already normalize their own children.
  46613. function simpleNormalizeChildren (children) {
  46614. for (var i = 0; i < children.length; i++) {
  46615. if (Array.isArray(children[i])) {
  46616. return Array.prototype.concat.apply([], children)
  46617. }
  46618. }
  46619. return children
  46620. }
  46621. // 2. When the children contains constructs that always generated nested Arrays,
  46622. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  46623. // with hand-written render functions / JSX. In such cases a full normalization
  46624. // is needed to cater to all possible types of children values.
  46625. function normalizeChildren (children) {
  46626. return isPrimitive(children)
  46627. ? [createTextVNode(children)]
  46628. : Array.isArray(children)
  46629. ? normalizeArrayChildren(children)
  46630. : undefined
  46631. }
  46632. function isTextNode (node) {
  46633. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  46634. }
  46635. function normalizeArrayChildren (children, nestedIndex) {
  46636. var res = [];
  46637. var i, c, lastIndex, last;
  46638. for (i = 0; i < children.length; i++) {
  46639. c = children[i];
  46640. if (isUndef(c) || typeof c === 'boolean') { continue }
  46641. lastIndex = res.length - 1;
  46642. last = res[lastIndex];
  46643. // nested
  46644. if (Array.isArray(c)) {
  46645. if (c.length > 0) {
  46646. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  46647. // merge adjacent text nodes
  46648. if (isTextNode(c[0]) && isTextNode(last)) {
  46649. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  46650. c.shift();
  46651. }
  46652. res.push.apply(res, c);
  46653. }
  46654. } else if (isPrimitive(c)) {
  46655. if (isTextNode(last)) {
  46656. // merge adjacent text nodes
  46657. // this is necessary for SSR hydration because text nodes are
  46658. // essentially merged when rendered to HTML strings
  46659. res[lastIndex] = createTextVNode(last.text + c);
  46660. } else if (c !== '') {
  46661. // convert primitive to vnode
  46662. res.push(createTextVNode(c));
  46663. }
  46664. } else {
  46665. if (isTextNode(c) && isTextNode(last)) {
  46666. // merge adjacent text nodes
  46667. res[lastIndex] = createTextVNode(last.text + c.text);
  46668. } else {
  46669. // default key for nested array children (likely generated by v-for)
  46670. if (isTrue(children._isVList) &&
  46671. isDef(c.tag) &&
  46672. isUndef(c.key) &&
  46673. isDef(nestedIndex)) {
  46674. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  46675. }
  46676. res.push(c);
  46677. }
  46678. }
  46679. }
  46680. return res
  46681. }
  46682. /* */
  46683. function initProvide (vm) {
  46684. var provide = vm.$options.provide;
  46685. if (provide) {
  46686. vm._provided = typeof provide === 'function'
  46687. ? provide.call(vm)
  46688. : provide;
  46689. }
  46690. }
  46691. function initInjections (vm) {
  46692. var result = resolveInject(vm.$options.inject, vm);
  46693. if (result) {
  46694. toggleObserving(false);
  46695. Object.keys(result).forEach(function (key) {
  46696. /* istanbul ignore else */
  46697. {
  46698. defineReactive$$1(vm, key, result[key], function () {
  46699. warn(
  46700. "Avoid mutating an injected value directly since the changes will be " +
  46701. "overwritten whenever the provided component re-renders. " +
  46702. "injection being mutated: \"" + key + "\"",
  46703. vm
  46704. );
  46705. });
  46706. }
  46707. });
  46708. toggleObserving(true);
  46709. }
  46710. }
  46711. function resolveInject (inject, vm) {
  46712. if (inject) {
  46713. // inject is :any because flow is not smart enough to figure out cached
  46714. var result = Object.create(null);
  46715. var keys = hasSymbol
  46716. ? Reflect.ownKeys(inject)
  46717. : Object.keys(inject);
  46718. for (var i = 0; i < keys.length; i++) {
  46719. var key = keys[i];
  46720. // #6574 in case the inject object is observed...
  46721. if (key === '__ob__') { continue }
  46722. var provideKey = inject[key].from;
  46723. var source = vm;
  46724. while (source) {
  46725. if (source._provided && hasOwn(source._provided, provideKey)) {
  46726. result[key] = source._provided[provideKey];
  46727. break
  46728. }
  46729. source = source.$parent;
  46730. }
  46731. if (!source) {
  46732. if ('default' in inject[key]) {
  46733. var provideDefault = inject[key].default;
  46734. result[key] = typeof provideDefault === 'function'
  46735. ? provideDefault.call(vm)
  46736. : provideDefault;
  46737. } else {
  46738. warn(("Injection \"" + key + "\" not found"), vm);
  46739. }
  46740. }
  46741. }
  46742. return result
  46743. }
  46744. }
  46745. /* */
  46746. /**
  46747. * Runtime helper for resolving raw children VNodes into a slot object.
  46748. */
  46749. function resolveSlots (
  46750. children,
  46751. context
  46752. ) {
  46753. if (!children || !children.length) {
  46754. return {}
  46755. }
  46756. var slots = {};
  46757. for (var i = 0, l = children.length; i < l; i++) {
  46758. var child = children[i];
  46759. var data = child.data;
  46760. // remove slot attribute if the node is resolved as a Vue slot node
  46761. if (data && data.attrs && data.attrs.slot) {
  46762. delete data.attrs.slot;
  46763. }
  46764. // named slots should only be respected if the vnode was rendered in the
  46765. // same context.
  46766. if ((child.context === context || child.fnContext === context) &&
  46767. data && data.slot != null
  46768. ) {
  46769. var name = data.slot;
  46770. var slot = (slots[name] || (slots[name] = []));
  46771. if (child.tag === 'template') {
  46772. slot.push.apply(slot, child.children || []);
  46773. } else {
  46774. slot.push(child);
  46775. }
  46776. } else {
  46777. (slots.default || (slots.default = [])).push(child);
  46778. }
  46779. }
  46780. // ignore slots that contains only whitespace
  46781. for (var name$1 in slots) {
  46782. if (slots[name$1].every(isWhitespace)) {
  46783. delete slots[name$1];
  46784. }
  46785. }
  46786. return slots
  46787. }
  46788. function isWhitespace (node) {
  46789. return (node.isComment && !node.asyncFactory) || node.text === ' '
  46790. }
  46791. /* */
  46792. function normalizeScopedSlots (
  46793. slots,
  46794. normalSlots,
  46795. prevSlots
  46796. ) {
  46797. var res;
  46798. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  46799. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  46800. var key = slots && slots.$key;
  46801. if (!slots) {
  46802. res = {};
  46803. } else if (slots._normalized) {
  46804. // fast path 1: child component re-render only, parent did not change
  46805. return slots._normalized
  46806. } else if (
  46807. isStable &&
  46808. prevSlots &&
  46809. prevSlots !== emptyObject &&
  46810. key === prevSlots.$key &&
  46811. !hasNormalSlots &&
  46812. !prevSlots.$hasNormal
  46813. ) {
  46814. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  46815. // only need to normalize once
  46816. return prevSlots
  46817. } else {
  46818. res = {};
  46819. for (var key$1 in slots) {
  46820. if (slots[key$1] && key$1[0] !== '$') {
  46821. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  46822. }
  46823. }
  46824. }
  46825. // expose normal slots on scopedSlots
  46826. for (var key$2 in normalSlots) {
  46827. if (!(key$2 in res)) {
  46828. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  46829. }
  46830. }
  46831. // avoriaz seems to mock a non-extensible $scopedSlots object
  46832. // and when that is passed down this would cause an error
  46833. if (slots && Object.isExtensible(slots)) {
  46834. (slots)._normalized = res;
  46835. }
  46836. def(res, '$stable', isStable);
  46837. def(res, '$key', key);
  46838. def(res, '$hasNormal', hasNormalSlots);
  46839. return res
  46840. }
  46841. function normalizeScopedSlot(normalSlots, key, fn) {
  46842. var normalized = function () {
  46843. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  46844. res = res && typeof res === 'object' && !Array.isArray(res)
  46845. ? [res] // single vnode
  46846. : normalizeChildren(res);
  46847. return res && (
  46848. res.length === 0 ||
  46849. (res.length === 1 && res[0].isComment) // #9658
  46850. ) ? undefined
  46851. : res
  46852. };
  46853. // this is a slot using the new v-slot syntax without scope. although it is
  46854. // compiled as a scoped slot, render fn users would expect it to be present
  46855. // on this.$slots because the usage is semantically a normal slot.
  46856. if (fn.proxy) {
  46857. Object.defineProperty(normalSlots, key, {
  46858. get: normalized,
  46859. enumerable: true,
  46860. configurable: true
  46861. });
  46862. }
  46863. return normalized
  46864. }
  46865. function proxyNormalSlot(slots, key) {
  46866. return function () { return slots[key]; }
  46867. }
  46868. /* */
  46869. /**
  46870. * Runtime helper for rendering v-for lists.
  46871. */
  46872. function renderList (
  46873. val,
  46874. render
  46875. ) {
  46876. var ret, i, l, keys, key;
  46877. if (Array.isArray(val) || typeof val === 'string') {
  46878. ret = new Array(val.length);
  46879. for (i = 0, l = val.length; i < l; i++) {
  46880. ret[i] = render(val[i], i);
  46881. }
  46882. } else if (typeof val === 'number') {
  46883. ret = new Array(val);
  46884. for (i = 0; i < val; i++) {
  46885. ret[i] = render(i + 1, i);
  46886. }
  46887. } else if (isObject(val)) {
  46888. if (hasSymbol && val[Symbol.iterator]) {
  46889. ret = [];
  46890. var iterator = val[Symbol.iterator]();
  46891. var result = iterator.next();
  46892. while (!result.done) {
  46893. ret.push(render(result.value, ret.length));
  46894. result = iterator.next();
  46895. }
  46896. } else {
  46897. keys = Object.keys(val);
  46898. ret = new Array(keys.length);
  46899. for (i = 0, l = keys.length; i < l; i++) {
  46900. key = keys[i];
  46901. ret[i] = render(val[key], key, i);
  46902. }
  46903. }
  46904. }
  46905. if (!isDef(ret)) {
  46906. ret = [];
  46907. }
  46908. (ret)._isVList = true;
  46909. return ret
  46910. }
  46911. /* */
  46912. /**
  46913. * Runtime helper for rendering <slot>
  46914. */
  46915. function renderSlot (
  46916. name,
  46917. fallback,
  46918. props,
  46919. bindObject
  46920. ) {
  46921. var scopedSlotFn = this.$scopedSlots[name];
  46922. var nodes;
  46923. if (scopedSlotFn) { // scoped slot
  46924. props = props || {};
  46925. if (bindObject) {
  46926. if (!isObject(bindObject)) {
  46927. warn(
  46928. 'slot v-bind without argument expects an Object',
  46929. this
  46930. );
  46931. }
  46932. props = extend(extend({}, bindObject), props);
  46933. }
  46934. nodes = scopedSlotFn(props) || fallback;
  46935. } else {
  46936. nodes = this.$slots[name] || fallback;
  46937. }
  46938. var target = props && props.slot;
  46939. if (target) {
  46940. return this.$createElement('template', { slot: target }, nodes)
  46941. } else {
  46942. return nodes
  46943. }
  46944. }
  46945. /* */
  46946. /**
  46947. * Runtime helper for resolving filters
  46948. */
  46949. function resolveFilter (id) {
  46950. return resolveAsset(this.$options, 'filters', id, true) || identity
  46951. }
  46952. /* */
  46953. function isKeyNotMatch (expect, actual) {
  46954. if (Array.isArray(expect)) {
  46955. return expect.indexOf(actual) === -1
  46956. } else {
  46957. return expect !== actual
  46958. }
  46959. }
  46960. /**
  46961. * Runtime helper for checking keyCodes from config.
  46962. * exposed as Vue.prototype._k
  46963. * passing in eventKeyName as last argument separately for backwards compat
  46964. */
  46965. function checkKeyCodes (
  46966. eventKeyCode,
  46967. key,
  46968. builtInKeyCode,
  46969. eventKeyName,
  46970. builtInKeyName
  46971. ) {
  46972. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  46973. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  46974. return isKeyNotMatch(builtInKeyName, eventKeyName)
  46975. } else if (mappedKeyCode) {
  46976. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  46977. } else if (eventKeyName) {
  46978. return hyphenate(eventKeyName) !== key
  46979. }
  46980. }
  46981. /* */
  46982. /**
  46983. * Runtime helper for merging v-bind="object" into a VNode's data.
  46984. */
  46985. function bindObjectProps (
  46986. data,
  46987. tag,
  46988. value,
  46989. asProp,
  46990. isSync
  46991. ) {
  46992. if (value) {
  46993. if (!isObject(value)) {
  46994. warn(
  46995. 'v-bind without argument expects an Object or Array value',
  46996. this
  46997. );
  46998. } else {
  46999. if (Array.isArray(value)) {
  47000. value = toObject(value);
  47001. }
  47002. var hash;
  47003. var loop = function ( key ) {
  47004. if (
  47005. key === 'class' ||
  47006. key === 'style' ||
  47007. isReservedAttribute(key)
  47008. ) {
  47009. hash = data;
  47010. } else {
  47011. var type = data.attrs && data.attrs.type;
  47012. hash = asProp || config.mustUseProp(tag, type, key)
  47013. ? data.domProps || (data.domProps = {})
  47014. : data.attrs || (data.attrs = {});
  47015. }
  47016. var camelizedKey = camelize(key);
  47017. var hyphenatedKey = hyphenate(key);
  47018. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  47019. hash[key] = value[key];
  47020. if (isSync) {
  47021. var on = data.on || (data.on = {});
  47022. on[("update:" + key)] = function ($event) {
  47023. value[key] = $event;
  47024. };
  47025. }
  47026. }
  47027. };
  47028. for (var key in value) loop( key );
  47029. }
  47030. }
  47031. return data
  47032. }
  47033. /* */
  47034. /**
  47035. * Runtime helper for rendering static trees.
  47036. */
  47037. function renderStatic (
  47038. index,
  47039. isInFor
  47040. ) {
  47041. var cached = this._staticTrees || (this._staticTrees = []);
  47042. var tree = cached[index];
  47043. // if has already-rendered static tree and not inside v-for,
  47044. // we can reuse the same tree.
  47045. if (tree && !isInFor) {
  47046. return tree
  47047. }
  47048. // otherwise, render a fresh tree.
  47049. tree = cached[index] = this.$options.staticRenderFns[index].call(
  47050. this._renderProxy,
  47051. null,
  47052. this // for render fns generated for functional component templates
  47053. );
  47054. markStatic(tree, ("__static__" + index), false);
  47055. return tree
  47056. }
  47057. /**
  47058. * Runtime helper for v-once.
  47059. * Effectively it means marking the node as static with a unique key.
  47060. */
  47061. function markOnce (
  47062. tree,
  47063. index,
  47064. key
  47065. ) {
  47066. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  47067. return tree
  47068. }
  47069. function markStatic (
  47070. tree,
  47071. key,
  47072. isOnce
  47073. ) {
  47074. if (Array.isArray(tree)) {
  47075. for (var i = 0; i < tree.length; i++) {
  47076. if (tree[i] && typeof tree[i] !== 'string') {
  47077. markStaticNode(tree[i], (key + "_" + i), isOnce);
  47078. }
  47079. }
  47080. } else {
  47081. markStaticNode(tree, key, isOnce);
  47082. }
  47083. }
  47084. function markStaticNode (node, key, isOnce) {
  47085. node.isStatic = true;
  47086. node.key = key;
  47087. node.isOnce = isOnce;
  47088. }
  47089. /* */
  47090. function bindObjectListeners (data, value) {
  47091. if (value) {
  47092. if (!isPlainObject(value)) {
  47093. warn(
  47094. 'v-on without argument expects an Object value',
  47095. this
  47096. );
  47097. } else {
  47098. var on = data.on = data.on ? extend({}, data.on) : {};
  47099. for (var key in value) {
  47100. var existing = on[key];
  47101. var ours = value[key];
  47102. on[key] = existing ? [].concat(existing, ours) : ours;
  47103. }
  47104. }
  47105. }
  47106. return data
  47107. }
  47108. /* */
  47109. function resolveScopedSlots (
  47110. fns, // see flow/vnode
  47111. res,
  47112. // the following are added in 2.6
  47113. hasDynamicKeys,
  47114. contentHashKey
  47115. ) {
  47116. res = res || { $stable: !hasDynamicKeys };
  47117. for (var i = 0; i < fns.length; i++) {
  47118. var slot = fns[i];
  47119. if (Array.isArray(slot)) {
  47120. resolveScopedSlots(slot, res, hasDynamicKeys);
  47121. } else if (slot) {
  47122. // marker for reverse proxying v-slot without scope on this.$slots
  47123. if (slot.proxy) {
  47124. slot.fn.proxy = true;
  47125. }
  47126. res[slot.key] = slot.fn;
  47127. }
  47128. }
  47129. if (contentHashKey) {
  47130. (res).$key = contentHashKey;
  47131. }
  47132. return res
  47133. }
  47134. /* */
  47135. function bindDynamicKeys (baseObj, values) {
  47136. for (var i = 0; i < values.length; i += 2) {
  47137. var key = values[i];
  47138. if (typeof key === 'string' && key) {
  47139. baseObj[values[i]] = values[i + 1];
  47140. } else if (key !== '' && key !== null) {
  47141. // null is a special value for explicitly removing a binding
  47142. warn(
  47143. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  47144. this
  47145. );
  47146. }
  47147. }
  47148. return baseObj
  47149. }
  47150. // helper to dynamically append modifier runtime markers to event names.
  47151. // ensure only append when value is already string, otherwise it will be cast
  47152. // to string and cause the type check to miss.
  47153. function prependModifier (value, symbol) {
  47154. return typeof value === 'string' ? symbol + value : value
  47155. }
  47156. /* */
  47157. function installRenderHelpers (target) {
  47158. target._o = markOnce;
  47159. target._n = toNumber;
  47160. target._s = toString;
  47161. target._l = renderList;
  47162. target._t = renderSlot;
  47163. target._q = looseEqual;
  47164. target._i = looseIndexOf;
  47165. target._m = renderStatic;
  47166. target._f = resolveFilter;
  47167. target._k = checkKeyCodes;
  47168. target._b = bindObjectProps;
  47169. target._v = createTextVNode;
  47170. target._e = createEmptyVNode;
  47171. target._u = resolveScopedSlots;
  47172. target._g = bindObjectListeners;
  47173. target._d = bindDynamicKeys;
  47174. target._p = prependModifier;
  47175. }
  47176. /* */
  47177. function FunctionalRenderContext (
  47178. data,
  47179. props,
  47180. children,
  47181. parent,
  47182. Ctor
  47183. ) {
  47184. var this$1 = this;
  47185. var options = Ctor.options;
  47186. // ensure the createElement function in functional components
  47187. // gets a unique context - this is necessary for correct named slot check
  47188. var contextVm;
  47189. if (hasOwn(parent, '_uid')) {
  47190. contextVm = Object.create(parent);
  47191. // $flow-disable-line
  47192. contextVm._original = parent;
  47193. } else {
  47194. // the context vm passed in is a functional context as well.
  47195. // in this case we want to make sure we are able to get a hold to the
  47196. // real context instance.
  47197. contextVm = parent;
  47198. // $flow-disable-line
  47199. parent = parent._original;
  47200. }
  47201. var isCompiled = isTrue(options._compiled);
  47202. var needNormalization = !isCompiled;
  47203. this.data = data;
  47204. this.props = props;
  47205. this.children = children;
  47206. this.parent = parent;
  47207. this.listeners = data.on || emptyObject;
  47208. this.injections = resolveInject(options.inject, parent);
  47209. this.slots = function () {
  47210. if (!this$1.$slots) {
  47211. normalizeScopedSlots(
  47212. data.scopedSlots,
  47213. this$1.$slots = resolveSlots(children, parent)
  47214. );
  47215. }
  47216. return this$1.$slots
  47217. };
  47218. Object.defineProperty(this, 'scopedSlots', ({
  47219. enumerable: true,
  47220. get: function get () {
  47221. return normalizeScopedSlots(data.scopedSlots, this.slots())
  47222. }
  47223. }));
  47224. // support for compiled functional template
  47225. if (isCompiled) {
  47226. // exposing $options for renderStatic()
  47227. this.$options = options;
  47228. // pre-resolve slots for renderSlot()
  47229. this.$slots = this.slots();
  47230. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  47231. }
  47232. if (options._scopeId) {
  47233. this._c = function (a, b, c, d) {
  47234. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  47235. if (vnode && !Array.isArray(vnode)) {
  47236. vnode.fnScopeId = options._scopeId;
  47237. vnode.fnContext = parent;
  47238. }
  47239. return vnode
  47240. };
  47241. } else {
  47242. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  47243. }
  47244. }
  47245. installRenderHelpers(FunctionalRenderContext.prototype);
  47246. function createFunctionalComponent (
  47247. Ctor,
  47248. propsData,
  47249. data,
  47250. contextVm,
  47251. children
  47252. ) {
  47253. var options = Ctor.options;
  47254. var props = {};
  47255. var propOptions = options.props;
  47256. if (isDef(propOptions)) {
  47257. for (var key in propOptions) {
  47258. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  47259. }
  47260. } else {
  47261. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  47262. if (isDef(data.props)) { mergeProps(props, data.props); }
  47263. }
  47264. var renderContext = new FunctionalRenderContext(
  47265. data,
  47266. props,
  47267. children,
  47268. contextVm,
  47269. Ctor
  47270. );
  47271. var vnode = options.render.call(null, renderContext._c, renderContext);
  47272. if (vnode instanceof VNode) {
  47273. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  47274. } else if (Array.isArray(vnode)) {
  47275. var vnodes = normalizeChildren(vnode) || [];
  47276. var res = new Array(vnodes.length);
  47277. for (var i = 0; i < vnodes.length; i++) {
  47278. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  47279. }
  47280. return res
  47281. }
  47282. }
  47283. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  47284. // #7817 clone node before setting fnContext, otherwise if the node is reused
  47285. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  47286. // that should not be matched to match.
  47287. var clone = cloneVNode(vnode);
  47288. clone.fnContext = contextVm;
  47289. clone.fnOptions = options;
  47290. {
  47291. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  47292. }
  47293. if (data.slot) {
  47294. (clone.data || (clone.data = {})).slot = data.slot;
  47295. }
  47296. return clone
  47297. }
  47298. function mergeProps (to, from) {
  47299. for (var key in from) {
  47300. to[camelize(key)] = from[key];
  47301. }
  47302. }
  47303. /* */
  47304. /* */
  47305. /* */
  47306. /* */
  47307. // inline hooks to be invoked on component VNodes during patch
  47308. var componentVNodeHooks = {
  47309. init: function init (vnode, hydrating) {
  47310. if (
  47311. vnode.componentInstance &&
  47312. !vnode.componentInstance._isDestroyed &&
  47313. vnode.data.keepAlive
  47314. ) {
  47315. // kept-alive components, treat as a patch
  47316. var mountedNode = vnode; // work around flow
  47317. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  47318. } else {
  47319. var child = vnode.componentInstance = createComponentInstanceForVnode(
  47320. vnode,
  47321. activeInstance
  47322. );
  47323. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  47324. }
  47325. },
  47326. prepatch: function prepatch (oldVnode, vnode) {
  47327. var options = vnode.componentOptions;
  47328. var child = vnode.componentInstance = oldVnode.componentInstance;
  47329. updateChildComponent(
  47330. child,
  47331. options.propsData, // updated props
  47332. options.listeners, // updated listeners
  47333. vnode, // new parent vnode
  47334. options.children // new children
  47335. );
  47336. },
  47337. insert: function insert (vnode) {
  47338. var context = vnode.context;
  47339. var componentInstance = vnode.componentInstance;
  47340. if (!componentInstance._isMounted) {
  47341. componentInstance._isMounted = true;
  47342. callHook(componentInstance, 'mounted');
  47343. }
  47344. if (vnode.data.keepAlive) {
  47345. if (context._isMounted) {
  47346. // vue-router#1212
  47347. // During updates, a kept-alive component's child components may
  47348. // change, so directly walking the tree here may call activated hooks
  47349. // on incorrect children. Instead we push them into a queue which will
  47350. // be processed after the whole patch process ended.
  47351. queueActivatedComponent(componentInstance);
  47352. } else {
  47353. activateChildComponent(componentInstance, true /* direct */);
  47354. }
  47355. }
  47356. },
  47357. destroy: function destroy (vnode) {
  47358. var componentInstance = vnode.componentInstance;
  47359. if (!componentInstance._isDestroyed) {
  47360. if (!vnode.data.keepAlive) {
  47361. componentInstance.$destroy();
  47362. } else {
  47363. deactivateChildComponent(componentInstance, true /* direct */);
  47364. }
  47365. }
  47366. }
  47367. };
  47368. var hooksToMerge = Object.keys(componentVNodeHooks);
  47369. function createComponent (
  47370. Ctor,
  47371. data,
  47372. context,
  47373. children,
  47374. tag
  47375. ) {
  47376. if (isUndef(Ctor)) {
  47377. return
  47378. }
  47379. var baseCtor = context.$options._base;
  47380. // plain options object: turn it into a constructor
  47381. if (isObject(Ctor)) {
  47382. Ctor = baseCtor.extend(Ctor);
  47383. }
  47384. // if at this stage it's not a constructor or an async component factory,
  47385. // reject.
  47386. if (typeof Ctor !== 'function') {
  47387. {
  47388. warn(("Invalid Component definition: " + (String(Ctor))), context);
  47389. }
  47390. return
  47391. }
  47392. // async component
  47393. var asyncFactory;
  47394. if (isUndef(Ctor.cid)) {
  47395. asyncFactory = Ctor;
  47396. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  47397. if (Ctor === undefined) {
  47398. // return a placeholder node for async component, which is rendered
  47399. // as a comment node but preserves all the raw information for the node.
  47400. // the information will be used for async server-rendering and hydration.
  47401. return createAsyncPlaceholder(
  47402. asyncFactory,
  47403. data,
  47404. context,
  47405. children,
  47406. tag
  47407. )
  47408. }
  47409. }
  47410. data = data || {};
  47411. // resolve constructor options in case global mixins are applied after
  47412. // component constructor creation
  47413. resolveConstructorOptions(Ctor);
  47414. // transform component v-model data into props & events
  47415. if (isDef(data.model)) {
  47416. transformModel(Ctor.options, data);
  47417. }
  47418. // extract props
  47419. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  47420. // functional component
  47421. if (isTrue(Ctor.options.functional)) {
  47422. return createFunctionalComponent(Ctor, propsData, data, context, children)
  47423. }
  47424. // extract listeners, since these needs to be treated as
  47425. // child component listeners instead of DOM listeners
  47426. var listeners = data.on;
  47427. // replace with listeners with .native modifier
  47428. // so it gets processed during parent component patch.
  47429. data.on = data.nativeOn;
  47430. if (isTrue(Ctor.options.abstract)) {
  47431. // abstract components do not keep anything
  47432. // other than props & listeners & slot
  47433. // work around flow
  47434. var slot = data.slot;
  47435. data = {};
  47436. if (slot) {
  47437. data.slot = slot;
  47438. }
  47439. }
  47440. // install component management hooks onto the placeholder node
  47441. installComponentHooks(data);
  47442. // return a placeholder vnode
  47443. var name = Ctor.options.name || tag;
  47444. var vnode = new VNode(
  47445. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  47446. data, undefined, undefined, undefined, context,
  47447. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  47448. asyncFactory
  47449. );
  47450. return vnode
  47451. }
  47452. function createComponentInstanceForVnode (
  47453. vnode, // we know it's MountedComponentVNode but flow doesn't
  47454. parent // activeInstance in lifecycle state
  47455. ) {
  47456. var options = {
  47457. _isComponent: true,
  47458. _parentVnode: vnode,
  47459. parent: parent
  47460. };
  47461. // check inline-template render functions
  47462. var inlineTemplate = vnode.data.inlineTemplate;
  47463. if (isDef(inlineTemplate)) {
  47464. options.render = inlineTemplate.render;
  47465. options.staticRenderFns = inlineTemplate.staticRenderFns;
  47466. }
  47467. return new vnode.componentOptions.Ctor(options)
  47468. }
  47469. function installComponentHooks (data) {
  47470. var hooks = data.hook || (data.hook = {});
  47471. for (var i = 0; i < hooksToMerge.length; i++) {
  47472. var key = hooksToMerge[i];
  47473. var existing = hooks[key];
  47474. var toMerge = componentVNodeHooks[key];
  47475. if (existing !== toMerge && !(existing && existing._merged)) {
  47476. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  47477. }
  47478. }
  47479. }
  47480. function mergeHook$1 (f1, f2) {
  47481. var merged = function (a, b) {
  47482. // flow complains about extra args which is why we use any
  47483. f1(a, b);
  47484. f2(a, b);
  47485. };
  47486. merged._merged = true;
  47487. return merged
  47488. }
  47489. // transform component v-model info (value and callback) into
  47490. // prop and event handler respectively.
  47491. function transformModel (options, data) {
  47492. var prop = (options.model && options.model.prop) || 'value';
  47493. var event = (options.model && options.model.event) || 'input'
  47494. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  47495. var on = data.on || (data.on = {});
  47496. var existing = on[event];
  47497. var callback = data.model.callback;
  47498. if (isDef(existing)) {
  47499. if (
  47500. Array.isArray(existing)
  47501. ? existing.indexOf(callback) === -1
  47502. : existing !== callback
  47503. ) {
  47504. on[event] = [callback].concat(existing);
  47505. }
  47506. } else {
  47507. on[event] = callback;
  47508. }
  47509. }
  47510. /* */
  47511. var SIMPLE_NORMALIZE = 1;
  47512. var ALWAYS_NORMALIZE = 2;
  47513. // wrapper function for providing a more flexible interface
  47514. // without getting yelled at by flow
  47515. function createElement (
  47516. context,
  47517. tag,
  47518. data,
  47519. children,
  47520. normalizationType,
  47521. alwaysNormalize
  47522. ) {
  47523. if (Array.isArray(data) || isPrimitive(data)) {
  47524. normalizationType = children;
  47525. children = data;
  47526. data = undefined;
  47527. }
  47528. if (isTrue(alwaysNormalize)) {
  47529. normalizationType = ALWAYS_NORMALIZE;
  47530. }
  47531. return _createElement(context, tag, data, children, normalizationType)
  47532. }
  47533. function _createElement (
  47534. context,
  47535. tag,
  47536. data,
  47537. children,
  47538. normalizationType
  47539. ) {
  47540. if (isDef(data) && isDef((data).__ob__)) {
  47541. warn(
  47542. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  47543. 'Always create fresh vnode data objects in each render!',
  47544. context
  47545. );
  47546. return createEmptyVNode()
  47547. }
  47548. // object syntax in v-bind
  47549. if (isDef(data) && isDef(data.is)) {
  47550. tag = data.is;
  47551. }
  47552. if (!tag) {
  47553. // in case of component :is set to falsy value
  47554. return createEmptyVNode()
  47555. }
  47556. // warn against non-primitive key
  47557. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  47558. ) {
  47559. {
  47560. warn(
  47561. 'Avoid using non-primitive value as key, ' +
  47562. 'use string/number value instead.',
  47563. context
  47564. );
  47565. }
  47566. }
  47567. // support single function children as default scoped slot
  47568. if (Array.isArray(children) &&
  47569. typeof children[0] === 'function'
  47570. ) {
  47571. data = data || {};
  47572. data.scopedSlots = { default: children[0] };
  47573. children.length = 0;
  47574. }
  47575. if (normalizationType === ALWAYS_NORMALIZE) {
  47576. children = normalizeChildren(children);
  47577. } else if (normalizationType === SIMPLE_NORMALIZE) {
  47578. children = simpleNormalizeChildren(children);
  47579. }
  47580. var vnode, ns;
  47581. if (typeof tag === 'string') {
  47582. var Ctor;
  47583. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  47584. if (config.isReservedTag(tag)) {
  47585. // platform built-in elements
  47586. if (isDef(data) && isDef(data.nativeOn)) {
  47587. warn(
  47588. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  47589. context
  47590. );
  47591. }
  47592. vnode = new VNode(
  47593. config.parsePlatformTagName(tag), data, children,
  47594. undefined, undefined, context
  47595. );
  47596. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  47597. // component
  47598. vnode = createComponent(Ctor, data, context, children, tag);
  47599. } else {
  47600. // unknown or unlisted namespaced elements
  47601. // check at runtime because it may get assigned a namespace when its
  47602. // parent normalizes children
  47603. vnode = new VNode(
  47604. tag, data, children,
  47605. undefined, undefined, context
  47606. );
  47607. }
  47608. } else {
  47609. // direct component options / constructor
  47610. vnode = createComponent(tag, data, context, children);
  47611. }
  47612. if (Array.isArray(vnode)) {
  47613. return vnode
  47614. } else if (isDef(vnode)) {
  47615. if (isDef(ns)) { applyNS(vnode, ns); }
  47616. if (isDef(data)) { registerDeepBindings(data); }
  47617. return vnode
  47618. } else {
  47619. return createEmptyVNode()
  47620. }
  47621. }
  47622. function applyNS (vnode, ns, force) {
  47623. vnode.ns = ns;
  47624. if (vnode.tag === 'foreignObject') {
  47625. // use default namespace inside foreignObject
  47626. ns = undefined;
  47627. force = true;
  47628. }
  47629. if (isDef(vnode.children)) {
  47630. for (var i = 0, l = vnode.children.length; i < l; i++) {
  47631. var child = vnode.children[i];
  47632. if (isDef(child.tag) && (
  47633. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  47634. applyNS(child, ns, force);
  47635. }
  47636. }
  47637. }
  47638. }
  47639. // ref #5318
  47640. // necessary to ensure parent re-render when deep bindings like :style and
  47641. // :class are used on slot nodes
  47642. function registerDeepBindings (data) {
  47643. if (isObject(data.style)) {
  47644. traverse(data.style);
  47645. }
  47646. if (isObject(data.class)) {
  47647. traverse(data.class);
  47648. }
  47649. }
  47650. /* */
  47651. function initRender (vm) {
  47652. vm._vnode = null; // the root of the child tree
  47653. vm._staticTrees = null; // v-once cached trees
  47654. var options = vm.$options;
  47655. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  47656. var renderContext = parentVnode && parentVnode.context;
  47657. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  47658. vm.$scopedSlots = emptyObject;
  47659. // bind the createElement fn to this instance
  47660. // so that we get proper render context inside it.
  47661. // args order: tag, data, children, normalizationType, alwaysNormalize
  47662. // internal version is used by render functions compiled from templates
  47663. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  47664. // normalization is always applied for the public version, used in
  47665. // user-written render functions.
  47666. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  47667. // $attrs & $listeners are exposed for easier HOC creation.
  47668. // they need to be reactive so that HOCs using them are always updated
  47669. var parentData = parentVnode && parentVnode.data;
  47670. /* istanbul ignore else */
  47671. {
  47672. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  47673. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  47674. }, true);
  47675. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  47676. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  47677. }, true);
  47678. }
  47679. }
  47680. var currentRenderingInstance = null;
  47681. function renderMixin (Vue) {
  47682. // install runtime convenience helpers
  47683. installRenderHelpers(Vue.prototype);
  47684. Vue.prototype.$nextTick = function (fn) {
  47685. return nextTick(fn, this)
  47686. };
  47687. Vue.prototype._render = function () {
  47688. var vm = this;
  47689. var ref = vm.$options;
  47690. var render = ref.render;
  47691. var _parentVnode = ref._parentVnode;
  47692. if (_parentVnode) {
  47693. vm.$scopedSlots = normalizeScopedSlots(
  47694. _parentVnode.data.scopedSlots,
  47695. vm.$slots,
  47696. vm.$scopedSlots
  47697. );
  47698. }
  47699. // set parent vnode. this allows render functions to have access
  47700. // to the data on the placeholder node.
  47701. vm.$vnode = _parentVnode;
  47702. // render self
  47703. var vnode;
  47704. try {
  47705. // There's no need to maintain a stack because all render fns are called
  47706. // separately from one another. Nested component's render fns are called
  47707. // when parent component is patched.
  47708. currentRenderingInstance = vm;
  47709. vnode = render.call(vm._renderProxy, vm.$createElement);
  47710. } catch (e) {
  47711. handleError(e, vm, "render");
  47712. // return error render result,
  47713. // or previous vnode to prevent render error causing blank component
  47714. /* istanbul ignore else */
  47715. if (vm.$options.renderError) {
  47716. try {
  47717. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  47718. } catch (e) {
  47719. handleError(e, vm, "renderError");
  47720. vnode = vm._vnode;
  47721. }
  47722. } else {
  47723. vnode = vm._vnode;
  47724. }
  47725. } finally {
  47726. currentRenderingInstance = null;
  47727. }
  47728. // if the returned array contains only a single node, allow it
  47729. if (Array.isArray(vnode) && vnode.length === 1) {
  47730. vnode = vnode[0];
  47731. }
  47732. // return empty vnode in case the render function errored out
  47733. if (!(vnode instanceof VNode)) {
  47734. if (Array.isArray(vnode)) {
  47735. warn(
  47736. 'Multiple root nodes returned from render function. Render function ' +
  47737. 'should return a single root node.',
  47738. vm
  47739. );
  47740. }
  47741. vnode = createEmptyVNode();
  47742. }
  47743. // set parent
  47744. vnode.parent = _parentVnode;
  47745. return vnode
  47746. };
  47747. }
  47748. /* */
  47749. function ensureCtor (comp, base) {
  47750. if (
  47751. comp.__esModule ||
  47752. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  47753. ) {
  47754. comp = comp.default;
  47755. }
  47756. return isObject(comp)
  47757. ? base.extend(comp)
  47758. : comp
  47759. }
  47760. function createAsyncPlaceholder (
  47761. factory,
  47762. data,
  47763. context,
  47764. children,
  47765. tag
  47766. ) {
  47767. var node = createEmptyVNode();
  47768. node.asyncFactory = factory;
  47769. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  47770. return node
  47771. }
  47772. function resolveAsyncComponent (
  47773. factory,
  47774. baseCtor
  47775. ) {
  47776. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  47777. return factory.errorComp
  47778. }
  47779. if (isDef(factory.resolved)) {
  47780. return factory.resolved
  47781. }
  47782. var owner = currentRenderingInstance;
  47783. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  47784. // already pending
  47785. factory.owners.push(owner);
  47786. }
  47787. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  47788. return factory.loadingComp
  47789. }
  47790. if (owner && !isDef(factory.owners)) {
  47791. var owners = factory.owners = [owner];
  47792. var sync = true;
  47793. var timerLoading = null;
  47794. var timerTimeout = null
  47795. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  47796. var forceRender = function (renderCompleted) {
  47797. for (var i = 0, l = owners.length; i < l; i++) {
  47798. (owners[i]).$forceUpdate();
  47799. }
  47800. if (renderCompleted) {
  47801. owners.length = 0;
  47802. if (timerLoading !== null) {
  47803. clearTimeout(timerLoading);
  47804. timerLoading = null;
  47805. }
  47806. if (timerTimeout !== null) {
  47807. clearTimeout(timerTimeout);
  47808. timerTimeout = null;
  47809. }
  47810. }
  47811. };
  47812. var resolve = once(function (res) {
  47813. // cache resolved
  47814. factory.resolved = ensureCtor(res, baseCtor);
  47815. // invoke callbacks only if this is not a synchronous resolve
  47816. // (async resolves are shimmed as synchronous during SSR)
  47817. if (!sync) {
  47818. forceRender(true);
  47819. } else {
  47820. owners.length = 0;
  47821. }
  47822. });
  47823. var reject = once(function (reason) {
  47824. warn(
  47825. "Failed to resolve async component: " + (String(factory)) +
  47826. (reason ? ("\nReason: " + reason) : '')
  47827. );
  47828. if (isDef(factory.errorComp)) {
  47829. factory.error = true;
  47830. forceRender(true);
  47831. }
  47832. });
  47833. var res = factory(resolve, reject);
  47834. if (isObject(res)) {
  47835. if (isPromise(res)) {
  47836. // () => Promise
  47837. if (isUndef(factory.resolved)) {
  47838. res.then(resolve, reject);
  47839. }
  47840. } else if (isPromise(res.component)) {
  47841. res.component.then(resolve, reject);
  47842. if (isDef(res.error)) {
  47843. factory.errorComp = ensureCtor(res.error, baseCtor);
  47844. }
  47845. if (isDef(res.loading)) {
  47846. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  47847. if (res.delay === 0) {
  47848. factory.loading = true;
  47849. } else {
  47850. timerLoading = setTimeout(function () {
  47851. timerLoading = null;
  47852. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  47853. factory.loading = true;
  47854. forceRender(false);
  47855. }
  47856. }, res.delay || 200);
  47857. }
  47858. }
  47859. if (isDef(res.timeout)) {
  47860. timerTimeout = setTimeout(function () {
  47861. timerTimeout = null;
  47862. if (isUndef(factory.resolved)) {
  47863. reject(
  47864. "timeout (" + (res.timeout) + "ms)"
  47865. );
  47866. }
  47867. }, res.timeout);
  47868. }
  47869. }
  47870. }
  47871. sync = false;
  47872. // return in case resolved synchronously
  47873. return factory.loading
  47874. ? factory.loadingComp
  47875. : factory.resolved
  47876. }
  47877. }
  47878. /* */
  47879. function isAsyncPlaceholder (node) {
  47880. return node.isComment && node.asyncFactory
  47881. }
  47882. /* */
  47883. function getFirstComponentChild (children) {
  47884. if (Array.isArray(children)) {
  47885. for (var i = 0; i < children.length; i++) {
  47886. var c = children[i];
  47887. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  47888. return c
  47889. }
  47890. }
  47891. }
  47892. }
  47893. /* */
  47894. /* */
  47895. function initEvents (vm) {
  47896. vm._events = Object.create(null);
  47897. vm._hasHookEvent = false;
  47898. // init parent attached events
  47899. var listeners = vm.$options._parentListeners;
  47900. if (listeners) {
  47901. updateComponentListeners(vm, listeners);
  47902. }
  47903. }
  47904. var target;
  47905. function add (event, fn) {
  47906. target.$on(event, fn);
  47907. }
  47908. function remove$1 (event, fn) {
  47909. target.$off(event, fn);
  47910. }
  47911. function createOnceHandler (event, fn) {
  47912. var _target = target;
  47913. return function onceHandler () {
  47914. var res = fn.apply(null, arguments);
  47915. if (res !== null) {
  47916. _target.$off(event, onceHandler);
  47917. }
  47918. }
  47919. }
  47920. function updateComponentListeners (
  47921. vm,
  47922. listeners,
  47923. oldListeners
  47924. ) {
  47925. target = vm;
  47926. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  47927. target = undefined;
  47928. }
  47929. function eventsMixin (Vue) {
  47930. var hookRE = /^hook:/;
  47931. Vue.prototype.$on = function (event, fn) {
  47932. var vm = this;
  47933. if (Array.isArray(event)) {
  47934. for (var i = 0, l = event.length; i < l; i++) {
  47935. vm.$on(event[i], fn);
  47936. }
  47937. } else {
  47938. (vm._events[event] || (vm._events[event] = [])).push(fn);
  47939. // optimize hook:event cost by using a boolean flag marked at registration
  47940. // instead of a hash lookup
  47941. if (hookRE.test(event)) {
  47942. vm._hasHookEvent = true;
  47943. }
  47944. }
  47945. return vm
  47946. };
  47947. Vue.prototype.$once = function (event, fn) {
  47948. var vm = this;
  47949. function on () {
  47950. vm.$off(event, on);
  47951. fn.apply(vm, arguments);
  47952. }
  47953. on.fn = fn;
  47954. vm.$on(event, on);
  47955. return vm
  47956. };
  47957. Vue.prototype.$off = function (event, fn) {
  47958. var vm = this;
  47959. // all
  47960. if (!arguments.length) {
  47961. vm._events = Object.create(null);
  47962. return vm
  47963. }
  47964. // array of events
  47965. if (Array.isArray(event)) {
  47966. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  47967. vm.$off(event[i$1], fn);
  47968. }
  47969. return vm
  47970. }
  47971. // specific event
  47972. var cbs = vm._events[event];
  47973. if (!cbs) {
  47974. return vm
  47975. }
  47976. if (!fn) {
  47977. vm._events[event] = null;
  47978. return vm
  47979. }
  47980. // specific handler
  47981. var cb;
  47982. var i = cbs.length;
  47983. while (i--) {
  47984. cb = cbs[i];
  47985. if (cb === fn || cb.fn === fn) {
  47986. cbs.splice(i, 1);
  47987. break
  47988. }
  47989. }
  47990. return vm
  47991. };
  47992. Vue.prototype.$emit = function (event) {
  47993. var vm = this;
  47994. {
  47995. var lowerCaseEvent = event.toLowerCase();
  47996. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  47997. tip(
  47998. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  47999. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  48000. "Note that HTML attributes are case-insensitive and you cannot use " +
  48001. "v-on to listen to camelCase events when using in-DOM templates. " +
  48002. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  48003. );
  48004. }
  48005. }
  48006. var cbs = vm._events[event];
  48007. if (cbs) {
  48008. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  48009. var args = toArray(arguments, 1);
  48010. var info = "event handler for \"" + event + "\"";
  48011. for (var i = 0, l = cbs.length; i < l; i++) {
  48012. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  48013. }
  48014. }
  48015. return vm
  48016. };
  48017. }
  48018. /* */
  48019. var activeInstance = null;
  48020. var isUpdatingChildComponent = false;
  48021. function setActiveInstance(vm) {
  48022. var prevActiveInstance = activeInstance;
  48023. activeInstance = vm;
  48024. return function () {
  48025. activeInstance = prevActiveInstance;
  48026. }
  48027. }
  48028. function initLifecycle (vm) {
  48029. var options = vm.$options;
  48030. // locate first non-abstract parent
  48031. var parent = options.parent;
  48032. if (parent && !options.abstract) {
  48033. while (parent.$options.abstract && parent.$parent) {
  48034. parent = parent.$parent;
  48035. }
  48036. parent.$children.push(vm);
  48037. }
  48038. vm.$parent = parent;
  48039. vm.$root = parent ? parent.$root : vm;
  48040. vm.$children = [];
  48041. vm.$refs = {};
  48042. vm._watcher = null;
  48043. vm._inactive = null;
  48044. vm._directInactive = false;
  48045. vm._isMounted = false;
  48046. vm._isDestroyed = false;
  48047. vm._isBeingDestroyed = false;
  48048. }
  48049. function lifecycleMixin (Vue) {
  48050. Vue.prototype._update = function (vnode, hydrating) {
  48051. var vm = this;
  48052. var prevEl = vm.$el;
  48053. var prevVnode = vm._vnode;
  48054. var restoreActiveInstance = setActiveInstance(vm);
  48055. vm._vnode = vnode;
  48056. // Vue.prototype.__patch__ is injected in entry points
  48057. // based on the rendering backend used.
  48058. if (!prevVnode) {
  48059. // initial render
  48060. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  48061. } else {
  48062. // updates
  48063. vm.$el = vm.__patch__(prevVnode, vnode);
  48064. }
  48065. restoreActiveInstance();
  48066. // update __vue__ reference
  48067. if (prevEl) {
  48068. prevEl.__vue__ = null;
  48069. }
  48070. if (vm.$el) {
  48071. vm.$el.__vue__ = vm;
  48072. }
  48073. // if parent is an HOC, update its $el as well
  48074. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  48075. vm.$parent.$el = vm.$el;
  48076. }
  48077. // updated hook is called by the scheduler to ensure that children are
  48078. // updated in a parent's updated hook.
  48079. };
  48080. Vue.prototype.$forceUpdate = function () {
  48081. var vm = this;
  48082. if (vm._watcher) {
  48083. vm._watcher.update();
  48084. }
  48085. };
  48086. Vue.prototype.$destroy = function () {
  48087. var vm = this;
  48088. if (vm._isBeingDestroyed) {
  48089. return
  48090. }
  48091. callHook(vm, 'beforeDestroy');
  48092. vm._isBeingDestroyed = true;
  48093. // remove self from parent
  48094. var parent = vm.$parent;
  48095. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  48096. remove(parent.$children, vm);
  48097. }
  48098. // teardown watchers
  48099. if (vm._watcher) {
  48100. vm._watcher.teardown();
  48101. }
  48102. var i = vm._watchers.length;
  48103. while (i--) {
  48104. vm._watchers[i].teardown();
  48105. }
  48106. // remove reference from data ob
  48107. // frozen object may not have observer.
  48108. if (vm._data.__ob__) {
  48109. vm._data.__ob__.vmCount--;
  48110. }
  48111. // call the last hook...
  48112. vm._isDestroyed = true;
  48113. // invoke destroy hooks on current rendered tree
  48114. vm.__patch__(vm._vnode, null);
  48115. // fire destroyed hook
  48116. callHook(vm, 'destroyed');
  48117. // turn off all instance listeners.
  48118. vm.$off();
  48119. // remove __vue__ reference
  48120. if (vm.$el) {
  48121. vm.$el.__vue__ = null;
  48122. }
  48123. // release circular reference (#6759)
  48124. if (vm.$vnode) {
  48125. vm.$vnode.parent = null;
  48126. }
  48127. };
  48128. }
  48129. function mountComponent (
  48130. vm,
  48131. el,
  48132. hydrating
  48133. ) {
  48134. vm.$el = el;
  48135. if (!vm.$options.render) {
  48136. vm.$options.render = createEmptyVNode;
  48137. {
  48138. /* istanbul ignore if */
  48139. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  48140. vm.$options.el || el) {
  48141. warn(
  48142. 'You are using the runtime-only build of Vue where the template ' +
  48143. 'compiler is not available. Either pre-compile the templates into ' +
  48144. 'render functions, or use the compiler-included build.',
  48145. vm
  48146. );
  48147. } else {
  48148. warn(
  48149. 'Failed to mount component: template or render function not defined.',
  48150. vm
  48151. );
  48152. }
  48153. }
  48154. }
  48155. callHook(vm, 'beforeMount');
  48156. var updateComponent;
  48157. /* istanbul ignore if */
  48158. if (config.performance && mark) {
  48159. updateComponent = function () {
  48160. var name = vm._name;
  48161. var id = vm._uid;
  48162. var startTag = "vue-perf-start:" + id;
  48163. var endTag = "vue-perf-end:" + id;
  48164. mark(startTag);
  48165. var vnode = vm._render();
  48166. mark(endTag);
  48167. measure(("vue " + name + " render"), startTag, endTag);
  48168. mark(startTag);
  48169. vm._update(vnode, hydrating);
  48170. mark(endTag);
  48171. measure(("vue " + name + " patch"), startTag, endTag);
  48172. };
  48173. } else {
  48174. updateComponent = function () {
  48175. vm._update(vm._render(), hydrating);
  48176. };
  48177. }
  48178. // we set this to vm._watcher inside the watcher's constructor
  48179. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  48180. // component's mounted hook), which relies on vm._watcher being already defined
  48181. new Watcher(vm, updateComponent, noop, {
  48182. before: function before () {
  48183. if (vm._isMounted && !vm._isDestroyed) {
  48184. callHook(vm, 'beforeUpdate');
  48185. }
  48186. }
  48187. }, true /* isRenderWatcher */);
  48188. hydrating = false;
  48189. // manually mounted instance, call mounted on self
  48190. // mounted is called for render-created child components in its inserted hook
  48191. if (vm.$vnode == null) {
  48192. vm._isMounted = true;
  48193. callHook(vm, 'mounted');
  48194. }
  48195. return vm
  48196. }
  48197. function updateChildComponent (
  48198. vm,
  48199. propsData,
  48200. listeners,
  48201. parentVnode,
  48202. renderChildren
  48203. ) {
  48204. {
  48205. isUpdatingChildComponent = true;
  48206. }
  48207. // determine whether component has slot children
  48208. // we need to do this before overwriting $options._renderChildren.
  48209. // check if there are dynamic scopedSlots (hand-written or compiled but with
  48210. // dynamic slot names). Static scoped slots compiled from template has the
  48211. // "$stable" marker.
  48212. var newScopedSlots = parentVnode.data.scopedSlots;
  48213. var oldScopedSlots = vm.$scopedSlots;
  48214. var hasDynamicScopedSlot = !!(
  48215. (newScopedSlots && !newScopedSlots.$stable) ||
  48216. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  48217. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  48218. );
  48219. // Any static slot children from the parent may have changed during parent's
  48220. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  48221. // update is necessary to ensure correctness.
  48222. var needsForceUpdate = !!(
  48223. renderChildren || // has new static slots
  48224. vm.$options._renderChildren || // has old static slots
  48225. hasDynamicScopedSlot
  48226. );
  48227. vm.$options._parentVnode = parentVnode;
  48228. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  48229. if (vm._vnode) { // update child tree's parent
  48230. vm._vnode.parent = parentVnode;
  48231. }
  48232. vm.$options._renderChildren = renderChildren;
  48233. // update $attrs and $listeners hash
  48234. // these are also reactive so they may trigger child update if the child
  48235. // used them during render
  48236. vm.$attrs = parentVnode.data.attrs || emptyObject;
  48237. vm.$listeners = listeners || emptyObject;
  48238. // update props
  48239. if (propsData && vm.$options.props) {
  48240. toggleObserving(false);
  48241. var props = vm._props;
  48242. var propKeys = vm.$options._propKeys || [];
  48243. for (var i = 0; i < propKeys.length; i++) {
  48244. var key = propKeys[i];
  48245. var propOptions = vm.$options.props; // wtf flow?
  48246. props[key] = validateProp(key, propOptions, propsData, vm);
  48247. }
  48248. toggleObserving(true);
  48249. // keep a copy of raw propsData
  48250. vm.$options.propsData = propsData;
  48251. }
  48252. // update listeners
  48253. listeners = listeners || emptyObject;
  48254. var oldListeners = vm.$options._parentListeners;
  48255. vm.$options._parentListeners = listeners;
  48256. updateComponentListeners(vm, listeners, oldListeners);
  48257. // resolve slots + force update if has children
  48258. if (needsForceUpdate) {
  48259. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  48260. vm.$forceUpdate();
  48261. }
  48262. {
  48263. isUpdatingChildComponent = false;
  48264. }
  48265. }
  48266. function isInInactiveTree (vm) {
  48267. while (vm && (vm = vm.$parent)) {
  48268. if (vm._inactive) { return true }
  48269. }
  48270. return false
  48271. }
  48272. function activateChildComponent (vm, direct) {
  48273. if (direct) {
  48274. vm._directInactive = false;
  48275. if (isInInactiveTree(vm)) {
  48276. return
  48277. }
  48278. } else if (vm._directInactive) {
  48279. return
  48280. }
  48281. if (vm._inactive || vm._inactive === null) {
  48282. vm._inactive = false;
  48283. for (var i = 0; i < vm.$children.length; i++) {
  48284. activateChildComponent(vm.$children[i]);
  48285. }
  48286. callHook(vm, 'activated');
  48287. }
  48288. }
  48289. function deactivateChildComponent (vm, direct) {
  48290. if (direct) {
  48291. vm._directInactive = true;
  48292. if (isInInactiveTree(vm)) {
  48293. return
  48294. }
  48295. }
  48296. if (!vm._inactive) {
  48297. vm._inactive = true;
  48298. for (var i = 0; i < vm.$children.length; i++) {
  48299. deactivateChildComponent(vm.$children[i]);
  48300. }
  48301. callHook(vm, 'deactivated');
  48302. }
  48303. }
  48304. function callHook (vm, hook) {
  48305. // #7573 disable dep collection when invoking lifecycle hooks
  48306. pushTarget();
  48307. var handlers = vm.$options[hook];
  48308. var info = hook + " hook";
  48309. if (handlers) {
  48310. for (var i = 0, j = handlers.length; i < j; i++) {
  48311. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  48312. }
  48313. }
  48314. if (vm._hasHookEvent) {
  48315. vm.$emit('hook:' + hook);
  48316. }
  48317. popTarget();
  48318. }
  48319. /* */
  48320. var MAX_UPDATE_COUNT = 100;
  48321. var queue = [];
  48322. var activatedChildren = [];
  48323. var has = {};
  48324. var circular = {};
  48325. var waiting = false;
  48326. var flushing = false;
  48327. var index = 0;
  48328. /**
  48329. * Reset the scheduler's state.
  48330. */
  48331. function resetSchedulerState () {
  48332. index = queue.length = activatedChildren.length = 0;
  48333. has = {};
  48334. {
  48335. circular = {};
  48336. }
  48337. waiting = flushing = false;
  48338. }
  48339. // Async edge case #6566 requires saving the timestamp when event listeners are
  48340. // attached. However, calling performance.now() has a perf overhead especially
  48341. // if the page has thousands of event listeners. Instead, we take a timestamp
  48342. // every time the scheduler flushes and use that for all event listeners
  48343. // attached during that flush.
  48344. var currentFlushTimestamp = 0;
  48345. // Async edge case fix requires storing an event listener's attach timestamp.
  48346. var getNow = Date.now;
  48347. // Determine what event timestamp the browser is using. Annoyingly, the
  48348. // timestamp can either be hi-res (relative to page load) or low-res
  48349. // (relative to UNIX epoch), so in order to compare time we have to use the
  48350. // same timestamp type when saving the flush timestamp.
  48351. // All IE versions use low-res event timestamps, and have problematic clock
  48352. // implementations (#9632)
  48353. if (inBrowser && !isIE) {
  48354. var performance = window.performance;
  48355. if (
  48356. performance &&
  48357. typeof performance.now === 'function' &&
  48358. getNow() > document.createEvent('Event').timeStamp
  48359. ) {
  48360. // if the event timestamp, although evaluated AFTER the Date.now(), is
  48361. // smaller than it, it means the event is using a hi-res timestamp,
  48362. // and we need to use the hi-res version for event listener timestamps as
  48363. // well.
  48364. getNow = function () { return performance.now(); };
  48365. }
  48366. }
  48367. /**
  48368. * Flush both queues and run the watchers.
  48369. */
  48370. function flushSchedulerQueue () {
  48371. currentFlushTimestamp = getNow();
  48372. flushing = true;
  48373. var watcher, id;
  48374. // Sort queue before flush.
  48375. // This ensures that:
  48376. // 1. Components are updated from parent to child. (because parent is always
  48377. // created before the child)
  48378. // 2. A component's user watchers are run before its render watcher (because
  48379. // user watchers are created before the render watcher)
  48380. // 3. If a component is destroyed during a parent component's watcher run,
  48381. // its watchers can be skipped.
  48382. queue.sort(function (a, b) { return a.id - b.id; });
  48383. // do not cache length because more watchers might be pushed
  48384. // as we run existing watchers
  48385. for (index = 0; index < queue.length; index++) {
  48386. watcher = queue[index];
  48387. if (watcher.before) {
  48388. watcher.before();
  48389. }
  48390. id = watcher.id;
  48391. has[id] = null;
  48392. watcher.run();
  48393. // in dev build, check and stop circular updates.
  48394. if (has[id] != null) {
  48395. circular[id] = (circular[id] || 0) + 1;
  48396. if (circular[id] > MAX_UPDATE_COUNT) {
  48397. warn(
  48398. 'You may have an infinite update loop ' + (
  48399. watcher.user
  48400. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  48401. : "in a component render function."
  48402. ),
  48403. watcher.vm
  48404. );
  48405. break
  48406. }
  48407. }
  48408. }
  48409. // keep copies of post queues before resetting state
  48410. var activatedQueue = activatedChildren.slice();
  48411. var updatedQueue = queue.slice();
  48412. resetSchedulerState();
  48413. // call component updated and activated hooks
  48414. callActivatedHooks(activatedQueue);
  48415. callUpdatedHooks(updatedQueue);
  48416. // devtool hook
  48417. /* istanbul ignore if */
  48418. if (devtools && config.devtools) {
  48419. devtools.emit('flush');
  48420. }
  48421. }
  48422. function callUpdatedHooks (queue) {
  48423. var i = queue.length;
  48424. while (i--) {
  48425. var watcher = queue[i];
  48426. var vm = watcher.vm;
  48427. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  48428. callHook(vm, 'updated');
  48429. }
  48430. }
  48431. }
  48432. /**
  48433. * Queue a kept-alive component that was activated during patch.
  48434. * The queue will be processed after the entire tree has been patched.
  48435. */
  48436. function queueActivatedComponent (vm) {
  48437. // setting _inactive to false here so that a render function can
  48438. // rely on checking whether it's in an inactive tree (e.g. router-view)
  48439. vm._inactive = false;
  48440. activatedChildren.push(vm);
  48441. }
  48442. function callActivatedHooks (queue) {
  48443. for (var i = 0; i < queue.length; i++) {
  48444. queue[i]._inactive = true;
  48445. activateChildComponent(queue[i], true /* true */);
  48446. }
  48447. }
  48448. /**
  48449. * Push a watcher into the watcher queue.
  48450. * Jobs with duplicate IDs will be skipped unless it's
  48451. * pushed when the queue is being flushed.
  48452. */
  48453. function queueWatcher (watcher) {
  48454. var id = watcher.id;
  48455. if (has[id] == null) {
  48456. has[id] = true;
  48457. if (!flushing) {
  48458. queue.push(watcher);
  48459. } else {
  48460. // if already flushing, splice the watcher based on its id
  48461. // if already past its id, it will be run next immediately.
  48462. var i = queue.length - 1;
  48463. while (i > index && queue[i].id > watcher.id) {
  48464. i--;
  48465. }
  48466. queue.splice(i + 1, 0, watcher);
  48467. }
  48468. // queue the flush
  48469. if (!waiting) {
  48470. waiting = true;
  48471. if (!config.async) {
  48472. flushSchedulerQueue();
  48473. return
  48474. }
  48475. nextTick(flushSchedulerQueue);
  48476. }
  48477. }
  48478. }
  48479. /* */
  48480. var uid$2 = 0;
  48481. /**
  48482. * A watcher parses an expression, collects dependencies,
  48483. * and fires callback when the expression value changes.
  48484. * This is used for both the $watch() api and directives.
  48485. */
  48486. var Watcher = function Watcher (
  48487. vm,
  48488. expOrFn,
  48489. cb,
  48490. options,
  48491. isRenderWatcher
  48492. ) {
  48493. this.vm = vm;
  48494. if (isRenderWatcher) {
  48495. vm._watcher = this;
  48496. }
  48497. vm._watchers.push(this);
  48498. // options
  48499. if (options) {
  48500. this.deep = !!options.deep;
  48501. this.user = !!options.user;
  48502. this.lazy = !!options.lazy;
  48503. this.sync = !!options.sync;
  48504. this.before = options.before;
  48505. } else {
  48506. this.deep = this.user = this.lazy = this.sync = false;
  48507. }
  48508. this.cb = cb;
  48509. this.id = ++uid$2; // uid for batching
  48510. this.active = true;
  48511. this.dirty = this.lazy; // for lazy watchers
  48512. this.deps = [];
  48513. this.newDeps = [];
  48514. this.depIds = new _Set();
  48515. this.newDepIds = new _Set();
  48516. this.expression = expOrFn.toString();
  48517. // parse expression for getter
  48518. if (typeof expOrFn === 'function') {
  48519. this.getter = expOrFn;
  48520. } else {
  48521. this.getter = parsePath(expOrFn);
  48522. if (!this.getter) {
  48523. this.getter = noop;
  48524. warn(
  48525. "Failed watching path: \"" + expOrFn + "\" " +
  48526. 'Watcher only accepts simple dot-delimited paths. ' +
  48527. 'For full control, use a function instead.',
  48528. vm
  48529. );
  48530. }
  48531. }
  48532. this.value = this.lazy
  48533. ? undefined
  48534. : this.get();
  48535. };
  48536. /**
  48537. * Evaluate the getter, and re-collect dependencies.
  48538. */
  48539. Watcher.prototype.get = function get () {
  48540. pushTarget(this);
  48541. var value;
  48542. var vm = this.vm;
  48543. try {
  48544. value = this.getter.call(vm, vm);
  48545. } catch (e) {
  48546. if (this.user) {
  48547. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  48548. } else {
  48549. throw e
  48550. }
  48551. } finally {
  48552. // "touch" every property so they are all tracked as
  48553. // dependencies for deep watching
  48554. if (this.deep) {
  48555. traverse(value);
  48556. }
  48557. popTarget();
  48558. this.cleanupDeps();
  48559. }
  48560. return value
  48561. };
  48562. /**
  48563. * Add a dependency to this directive.
  48564. */
  48565. Watcher.prototype.addDep = function addDep (dep) {
  48566. var id = dep.id;
  48567. if (!this.newDepIds.has(id)) {
  48568. this.newDepIds.add(id);
  48569. this.newDeps.push(dep);
  48570. if (!this.depIds.has(id)) {
  48571. dep.addSub(this);
  48572. }
  48573. }
  48574. };
  48575. /**
  48576. * Clean up for dependency collection.
  48577. */
  48578. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  48579. var i = this.deps.length;
  48580. while (i--) {
  48581. var dep = this.deps[i];
  48582. if (!this.newDepIds.has(dep.id)) {
  48583. dep.removeSub(this);
  48584. }
  48585. }
  48586. var tmp = this.depIds;
  48587. this.depIds = this.newDepIds;
  48588. this.newDepIds = tmp;
  48589. this.newDepIds.clear();
  48590. tmp = this.deps;
  48591. this.deps = this.newDeps;
  48592. this.newDeps = tmp;
  48593. this.newDeps.length = 0;
  48594. };
  48595. /**
  48596. * Subscriber interface.
  48597. * Will be called when a dependency changes.
  48598. */
  48599. Watcher.prototype.update = function update () {
  48600. /* istanbul ignore else */
  48601. if (this.lazy) {
  48602. this.dirty = true;
  48603. } else if (this.sync) {
  48604. this.run();
  48605. } else {
  48606. queueWatcher(this);
  48607. }
  48608. };
  48609. /**
  48610. * Scheduler job interface.
  48611. * Will be called by the scheduler.
  48612. */
  48613. Watcher.prototype.run = function run () {
  48614. if (this.active) {
  48615. var value = this.get();
  48616. if (
  48617. value !== this.value ||
  48618. // Deep watchers and watchers on Object/Arrays should fire even
  48619. // when the value is the same, because the value may
  48620. // have mutated.
  48621. isObject(value) ||
  48622. this.deep
  48623. ) {
  48624. // set new value
  48625. var oldValue = this.value;
  48626. this.value = value;
  48627. if (this.user) {
  48628. try {
  48629. this.cb.call(this.vm, value, oldValue);
  48630. } catch (e) {
  48631. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  48632. }
  48633. } else {
  48634. this.cb.call(this.vm, value, oldValue);
  48635. }
  48636. }
  48637. }
  48638. };
  48639. /**
  48640. * Evaluate the value of the watcher.
  48641. * This only gets called for lazy watchers.
  48642. */
  48643. Watcher.prototype.evaluate = function evaluate () {
  48644. this.value = this.get();
  48645. this.dirty = false;
  48646. };
  48647. /**
  48648. * Depend on all deps collected by this watcher.
  48649. */
  48650. Watcher.prototype.depend = function depend () {
  48651. var i = this.deps.length;
  48652. while (i--) {
  48653. this.deps[i].depend();
  48654. }
  48655. };
  48656. /**
  48657. * Remove self from all dependencies' subscriber list.
  48658. */
  48659. Watcher.prototype.teardown = function teardown () {
  48660. if (this.active) {
  48661. // remove self from vm's watcher list
  48662. // this is a somewhat expensive operation so we skip it
  48663. // if the vm is being destroyed.
  48664. if (!this.vm._isBeingDestroyed) {
  48665. remove(this.vm._watchers, this);
  48666. }
  48667. var i = this.deps.length;
  48668. while (i--) {
  48669. this.deps[i].removeSub(this);
  48670. }
  48671. this.active = false;
  48672. }
  48673. };
  48674. /* */
  48675. var sharedPropertyDefinition = {
  48676. enumerable: true,
  48677. configurable: true,
  48678. get: noop,
  48679. set: noop
  48680. };
  48681. function proxy (target, sourceKey, key) {
  48682. sharedPropertyDefinition.get = function proxyGetter () {
  48683. return this[sourceKey][key]
  48684. };
  48685. sharedPropertyDefinition.set = function proxySetter (val) {
  48686. this[sourceKey][key] = val;
  48687. };
  48688. Object.defineProperty(target, key, sharedPropertyDefinition);
  48689. }
  48690. function initState (vm) {
  48691. vm._watchers = [];
  48692. var opts = vm.$options;
  48693. if (opts.props) { initProps(vm, opts.props); }
  48694. if (opts.methods) { initMethods(vm, opts.methods); }
  48695. if (opts.data) {
  48696. initData(vm);
  48697. } else {
  48698. observe(vm._data = {}, true /* asRootData */);
  48699. }
  48700. if (opts.computed) { initComputed(vm, opts.computed); }
  48701. if (opts.watch && opts.watch !== nativeWatch) {
  48702. initWatch(vm, opts.watch);
  48703. }
  48704. }
  48705. function initProps (vm, propsOptions) {
  48706. var propsData = vm.$options.propsData || {};
  48707. var props = vm._props = {};
  48708. // cache prop keys so that future props updates can iterate using Array
  48709. // instead of dynamic object key enumeration.
  48710. var keys = vm.$options._propKeys = [];
  48711. var isRoot = !vm.$parent;
  48712. // root instance props should be converted
  48713. if (!isRoot) {
  48714. toggleObserving(false);
  48715. }
  48716. var loop = function ( key ) {
  48717. keys.push(key);
  48718. var value = validateProp(key, propsOptions, propsData, vm);
  48719. /* istanbul ignore else */
  48720. {
  48721. var hyphenatedKey = hyphenate(key);
  48722. if (isReservedAttribute(hyphenatedKey) ||
  48723. config.isReservedAttr(hyphenatedKey)) {
  48724. warn(
  48725. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  48726. vm
  48727. );
  48728. }
  48729. defineReactive$$1(props, key, value, function () {
  48730. if (!isRoot && !isUpdatingChildComponent) {
  48731. warn(
  48732. "Avoid mutating a prop directly since the value will be " +
  48733. "overwritten whenever the parent component re-renders. " +
  48734. "Instead, use a data or computed property based on the prop's " +
  48735. "value. Prop being mutated: \"" + key + "\"",
  48736. vm
  48737. );
  48738. }
  48739. });
  48740. }
  48741. // static props are already proxied on the component's prototype
  48742. // during Vue.extend(). We only need to proxy props defined at
  48743. // instantiation here.
  48744. if (!(key in vm)) {
  48745. proxy(vm, "_props", key);
  48746. }
  48747. };
  48748. for (var key in propsOptions) loop( key );
  48749. toggleObserving(true);
  48750. }
  48751. function initData (vm) {
  48752. var data = vm.$options.data;
  48753. data = vm._data = typeof data === 'function'
  48754. ? getData(data, vm)
  48755. : data || {};
  48756. if (!isPlainObject(data)) {
  48757. data = {};
  48758. warn(
  48759. 'data functions should return an object:\n' +
  48760. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  48761. vm
  48762. );
  48763. }
  48764. // proxy data on instance
  48765. var keys = Object.keys(data);
  48766. var props = vm.$options.props;
  48767. var methods = vm.$options.methods;
  48768. var i = keys.length;
  48769. while (i--) {
  48770. var key = keys[i];
  48771. {
  48772. if (methods && hasOwn(methods, key)) {
  48773. warn(
  48774. ("Method \"" + key + "\" has already been defined as a data property."),
  48775. vm
  48776. );
  48777. }
  48778. }
  48779. if (props && hasOwn(props, key)) {
  48780. warn(
  48781. "The data property \"" + key + "\" is already declared as a prop. " +
  48782. "Use prop default value instead.",
  48783. vm
  48784. );
  48785. } else if (!isReserved(key)) {
  48786. proxy(vm, "_data", key);
  48787. }
  48788. }
  48789. // observe data
  48790. observe(data, true /* asRootData */);
  48791. }
  48792. function getData (data, vm) {
  48793. // #7573 disable dep collection when invoking data getters
  48794. pushTarget();
  48795. try {
  48796. return data.call(vm, vm)
  48797. } catch (e) {
  48798. handleError(e, vm, "data()");
  48799. return {}
  48800. } finally {
  48801. popTarget();
  48802. }
  48803. }
  48804. var computedWatcherOptions = { lazy: true };
  48805. function initComputed (vm, computed) {
  48806. // $flow-disable-line
  48807. var watchers = vm._computedWatchers = Object.create(null);
  48808. // computed properties are just getters during SSR
  48809. var isSSR = isServerRendering();
  48810. for (var key in computed) {
  48811. var userDef = computed[key];
  48812. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  48813. if (getter == null) {
  48814. warn(
  48815. ("Getter is missing for computed property \"" + key + "\"."),
  48816. vm
  48817. );
  48818. }
  48819. if (!isSSR) {
  48820. // create internal watcher for the computed property.
  48821. watchers[key] = new Watcher(
  48822. vm,
  48823. getter || noop,
  48824. noop,
  48825. computedWatcherOptions
  48826. );
  48827. }
  48828. // component-defined computed properties are already defined on the
  48829. // component prototype. We only need to define computed properties defined
  48830. // at instantiation here.
  48831. if (!(key in vm)) {
  48832. defineComputed(vm, key, userDef);
  48833. } else {
  48834. if (key in vm.$data) {
  48835. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  48836. } else if (vm.$options.props && key in vm.$options.props) {
  48837. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  48838. }
  48839. }
  48840. }
  48841. }
  48842. function defineComputed (
  48843. target,
  48844. key,
  48845. userDef
  48846. ) {
  48847. var shouldCache = !isServerRendering();
  48848. if (typeof userDef === 'function') {
  48849. sharedPropertyDefinition.get = shouldCache
  48850. ? createComputedGetter(key)
  48851. : createGetterInvoker(userDef);
  48852. sharedPropertyDefinition.set = noop;
  48853. } else {
  48854. sharedPropertyDefinition.get = userDef.get
  48855. ? shouldCache && userDef.cache !== false
  48856. ? createComputedGetter(key)
  48857. : createGetterInvoker(userDef.get)
  48858. : noop;
  48859. sharedPropertyDefinition.set = userDef.set || noop;
  48860. }
  48861. if (sharedPropertyDefinition.set === noop) {
  48862. sharedPropertyDefinition.set = function () {
  48863. warn(
  48864. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  48865. this
  48866. );
  48867. };
  48868. }
  48869. Object.defineProperty(target, key, sharedPropertyDefinition);
  48870. }
  48871. function createComputedGetter (key) {
  48872. return function computedGetter () {
  48873. var watcher = this._computedWatchers && this._computedWatchers[key];
  48874. if (watcher) {
  48875. if (watcher.dirty) {
  48876. watcher.evaluate();
  48877. }
  48878. if (Dep.target) {
  48879. watcher.depend();
  48880. }
  48881. return watcher.value
  48882. }
  48883. }
  48884. }
  48885. function createGetterInvoker(fn) {
  48886. return function computedGetter () {
  48887. return fn.call(this, this)
  48888. }
  48889. }
  48890. function initMethods (vm, methods) {
  48891. var props = vm.$options.props;
  48892. for (var key in methods) {
  48893. {
  48894. if (typeof methods[key] !== 'function') {
  48895. warn(
  48896. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  48897. "Did you reference the function correctly?",
  48898. vm
  48899. );
  48900. }
  48901. if (props && hasOwn(props, key)) {
  48902. warn(
  48903. ("Method \"" + key + "\" has already been defined as a prop."),
  48904. vm
  48905. );
  48906. }
  48907. if ((key in vm) && isReserved(key)) {
  48908. warn(
  48909. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  48910. "Avoid defining component methods that start with _ or $."
  48911. );
  48912. }
  48913. }
  48914. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  48915. }
  48916. }
  48917. function initWatch (vm, watch) {
  48918. for (var key in watch) {
  48919. var handler = watch[key];
  48920. if (Array.isArray(handler)) {
  48921. for (var i = 0; i < handler.length; i++) {
  48922. createWatcher(vm, key, handler[i]);
  48923. }
  48924. } else {
  48925. createWatcher(vm, key, handler);
  48926. }
  48927. }
  48928. }
  48929. function createWatcher (
  48930. vm,
  48931. expOrFn,
  48932. handler,
  48933. options
  48934. ) {
  48935. if (isPlainObject(handler)) {
  48936. options = handler;
  48937. handler = handler.handler;
  48938. }
  48939. if (typeof handler === 'string') {
  48940. handler = vm[handler];
  48941. }
  48942. return vm.$watch(expOrFn, handler, options)
  48943. }
  48944. function stateMixin (Vue) {
  48945. // flow somehow has problems with directly declared definition object
  48946. // when using Object.defineProperty, so we have to procedurally build up
  48947. // the object here.
  48948. var dataDef = {};
  48949. dataDef.get = function () { return this._data };
  48950. var propsDef = {};
  48951. propsDef.get = function () { return this._props };
  48952. {
  48953. dataDef.set = function () {
  48954. warn(
  48955. 'Avoid replacing instance root $data. ' +
  48956. 'Use nested data properties instead.',
  48957. this
  48958. );
  48959. };
  48960. propsDef.set = function () {
  48961. warn("$props is readonly.", this);
  48962. };
  48963. }
  48964. Object.defineProperty(Vue.prototype, '$data', dataDef);
  48965. Object.defineProperty(Vue.prototype, '$props', propsDef);
  48966. Vue.prototype.$set = set;
  48967. Vue.prototype.$delete = del;
  48968. Vue.prototype.$watch = function (
  48969. expOrFn,
  48970. cb,
  48971. options
  48972. ) {
  48973. var vm = this;
  48974. if (isPlainObject(cb)) {
  48975. return createWatcher(vm, expOrFn, cb, options)
  48976. }
  48977. options = options || {};
  48978. options.user = true;
  48979. var watcher = new Watcher(vm, expOrFn, cb, options);
  48980. if (options.immediate) {
  48981. try {
  48982. cb.call(vm, watcher.value);
  48983. } catch (error) {
  48984. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  48985. }
  48986. }
  48987. return function unwatchFn () {
  48988. watcher.teardown();
  48989. }
  48990. };
  48991. }
  48992. /* */
  48993. var uid$3 = 0;
  48994. function initMixin (Vue) {
  48995. Vue.prototype._init = function (options) {
  48996. var vm = this;
  48997. // a uid
  48998. vm._uid = uid$3++;
  48999. var startTag, endTag;
  49000. /* istanbul ignore if */
  49001. if (config.performance && mark) {
  49002. startTag = "vue-perf-start:" + (vm._uid);
  49003. endTag = "vue-perf-end:" + (vm._uid);
  49004. mark(startTag);
  49005. }
  49006. // a flag to avoid this being observed
  49007. vm._isVue = true;
  49008. // merge options
  49009. if (options && options._isComponent) {
  49010. // optimize internal component instantiation
  49011. // since dynamic options merging is pretty slow, and none of the
  49012. // internal component options needs special treatment.
  49013. initInternalComponent(vm, options);
  49014. } else {
  49015. vm.$options = mergeOptions(
  49016. resolveConstructorOptions(vm.constructor),
  49017. options || {},
  49018. vm
  49019. );
  49020. }
  49021. /* istanbul ignore else */
  49022. {
  49023. initProxy(vm);
  49024. }
  49025. // expose real self
  49026. vm._self = vm;
  49027. initLifecycle(vm);
  49028. initEvents(vm);
  49029. initRender(vm);
  49030. callHook(vm, 'beforeCreate');
  49031. initInjections(vm); // resolve injections before data/props
  49032. initState(vm);
  49033. initProvide(vm); // resolve provide after data/props
  49034. callHook(vm, 'created');
  49035. /* istanbul ignore if */
  49036. if (config.performance && mark) {
  49037. vm._name = formatComponentName(vm, false);
  49038. mark(endTag);
  49039. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  49040. }
  49041. if (vm.$options.el) {
  49042. vm.$mount(vm.$options.el);
  49043. }
  49044. };
  49045. }
  49046. function initInternalComponent (vm, options) {
  49047. var opts = vm.$options = Object.create(vm.constructor.options);
  49048. // doing this because it's faster than dynamic enumeration.
  49049. var parentVnode = options._parentVnode;
  49050. opts.parent = options.parent;
  49051. opts._parentVnode = parentVnode;
  49052. var vnodeComponentOptions = parentVnode.componentOptions;
  49053. opts.propsData = vnodeComponentOptions.propsData;
  49054. opts._parentListeners = vnodeComponentOptions.listeners;
  49055. opts._renderChildren = vnodeComponentOptions.children;
  49056. opts._componentTag = vnodeComponentOptions.tag;
  49057. if (options.render) {
  49058. opts.render = options.render;
  49059. opts.staticRenderFns = options.staticRenderFns;
  49060. }
  49061. }
  49062. function resolveConstructorOptions (Ctor) {
  49063. var options = Ctor.options;
  49064. if (Ctor.super) {
  49065. var superOptions = resolveConstructorOptions(Ctor.super);
  49066. var cachedSuperOptions = Ctor.superOptions;
  49067. if (superOptions !== cachedSuperOptions) {
  49068. // super option changed,
  49069. // need to resolve new options.
  49070. Ctor.superOptions = superOptions;
  49071. // check if there are any late-modified/attached options (#4976)
  49072. var modifiedOptions = resolveModifiedOptions(Ctor);
  49073. // update base extend options
  49074. if (modifiedOptions) {
  49075. extend(Ctor.extendOptions, modifiedOptions);
  49076. }
  49077. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  49078. if (options.name) {
  49079. options.components[options.name] = Ctor;
  49080. }
  49081. }
  49082. }
  49083. return options
  49084. }
  49085. function resolveModifiedOptions (Ctor) {
  49086. var modified;
  49087. var latest = Ctor.options;
  49088. var sealed = Ctor.sealedOptions;
  49089. for (var key in latest) {
  49090. if (latest[key] !== sealed[key]) {
  49091. if (!modified) { modified = {}; }
  49092. modified[key] = latest[key];
  49093. }
  49094. }
  49095. return modified
  49096. }
  49097. function Vue (options) {
  49098. if (!(this instanceof Vue)
  49099. ) {
  49100. warn('Vue is a constructor and should be called with the `new` keyword');
  49101. }
  49102. this._init(options);
  49103. }
  49104. initMixin(Vue);
  49105. stateMixin(Vue);
  49106. eventsMixin(Vue);
  49107. lifecycleMixin(Vue);
  49108. renderMixin(Vue);
  49109. /* */
  49110. function initUse (Vue) {
  49111. Vue.use = function (plugin) {
  49112. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  49113. if (installedPlugins.indexOf(plugin) > -1) {
  49114. return this
  49115. }
  49116. // additional parameters
  49117. var args = toArray(arguments, 1);
  49118. args.unshift(this);
  49119. if (typeof plugin.install === 'function') {
  49120. plugin.install.apply(plugin, args);
  49121. } else if (typeof plugin === 'function') {
  49122. plugin.apply(null, args);
  49123. }
  49124. installedPlugins.push(plugin);
  49125. return this
  49126. };
  49127. }
  49128. /* */
  49129. function initMixin$1 (Vue) {
  49130. Vue.mixin = function (mixin) {
  49131. this.options = mergeOptions(this.options, mixin);
  49132. return this
  49133. };
  49134. }
  49135. /* */
  49136. function initExtend (Vue) {
  49137. /**
  49138. * Each instance constructor, including Vue, has a unique
  49139. * cid. This enables us to create wrapped "child
  49140. * constructors" for prototypal inheritance and cache them.
  49141. */
  49142. Vue.cid = 0;
  49143. var cid = 1;
  49144. /**
  49145. * Class inheritance
  49146. */
  49147. Vue.extend = function (extendOptions) {
  49148. extendOptions = extendOptions || {};
  49149. var Super = this;
  49150. var SuperId = Super.cid;
  49151. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  49152. if (cachedCtors[SuperId]) {
  49153. return cachedCtors[SuperId]
  49154. }
  49155. var name = extendOptions.name || Super.options.name;
  49156. if (name) {
  49157. validateComponentName(name);
  49158. }
  49159. var Sub = function VueComponent (options) {
  49160. this._init(options);
  49161. };
  49162. Sub.prototype = Object.create(Super.prototype);
  49163. Sub.prototype.constructor = Sub;
  49164. Sub.cid = cid++;
  49165. Sub.options = mergeOptions(
  49166. Super.options,
  49167. extendOptions
  49168. );
  49169. Sub['super'] = Super;
  49170. // For props and computed properties, we define the proxy getters on
  49171. // the Vue instances at extension time, on the extended prototype. This
  49172. // avoids Object.defineProperty calls for each instance created.
  49173. if (Sub.options.props) {
  49174. initProps$1(Sub);
  49175. }
  49176. if (Sub.options.computed) {
  49177. initComputed$1(Sub);
  49178. }
  49179. // allow further extension/mixin/plugin usage
  49180. Sub.extend = Super.extend;
  49181. Sub.mixin = Super.mixin;
  49182. Sub.use = Super.use;
  49183. // create asset registers, so extended classes
  49184. // can have their private assets too.
  49185. ASSET_TYPES.forEach(function (type) {
  49186. Sub[type] = Super[type];
  49187. });
  49188. // enable recursive self-lookup
  49189. if (name) {
  49190. Sub.options.components[name] = Sub;
  49191. }
  49192. // keep a reference to the super options at extension time.
  49193. // later at instantiation we can check if Super's options have
  49194. // been updated.
  49195. Sub.superOptions = Super.options;
  49196. Sub.extendOptions = extendOptions;
  49197. Sub.sealedOptions = extend({}, Sub.options);
  49198. // cache constructor
  49199. cachedCtors[SuperId] = Sub;
  49200. return Sub
  49201. };
  49202. }
  49203. function initProps$1 (Comp) {
  49204. var props = Comp.options.props;
  49205. for (var key in props) {
  49206. proxy(Comp.prototype, "_props", key);
  49207. }
  49208. }
  49209. function initComputed$1 (Comp) {
  49210. var computed = Comp.options.computed;
  49211. for (var key in computed) {
  49212. defineComputed(Comp.prototype, key, computed[key]);
  49213. }
  49214. }
  49215. /* */
  49216. function initAssetRegisters (Vue) {
  49217. /**
  49218. * Create asset registration methods.
  49219. */
  49220. ASSET_TYPES.forEach(function (type) {
  49221. Vue[type] = function (
  49222. id,
  49223. definition
  49224. ) {
  49225. if (!definition) {
  49226. return this.options[type + 's'][id]
  49227. } else {
  49228. /* istanbul ignore if */
  49229. if (type === 'component') {
  49230. validateComponentName(id);
  49231. }
  49232. if (type === 'component' && isPlainObject(definition)) {
  49233. definition.name = definition.name || id;
  49234. definition = this.options._base.extend(definition);
  49235. }
  49236. if (type === 'directive' && typeof definition === 'function') {
  49237. definition = { bind: definition, update: definition };
  49238. }
  49239. this.options[type + 's'][id] = definition;
  49240. return definition
  49241. }
  49242. };
  49243. });
  49244. }
  49245. /* */
  49246. function getComponentName (opts) {
  49247. return opts && (opts.Ctor.options.name || opts.tag)
  49248. }
  49249. function matches (pattern, name) {
  49250. if (Array.isArray(pattern)) {
  49251. return pattern.indexOf(name) > -1
  49252. } else if (typeof pattern === 'string') {
  49253. return pattern.split(',').indexOf(name) > -1
  49254. } else if (isRegExp(pattern)) {
  49255. return pattern.test(name)
  49256. }
  49257. /* istanbul ignore next */
  49258. return false
  49259. }
  49260. function pruneCache (keepAliveInstance, filter) {
  49261. var cache = keepAliveInstance.cache;
  49262. var keys = keepAliveInstance.keys;
  49263. var _vnode = keepAliveInstance._vnode;
  49264. for (var key in cache) {
  49265. var cachedNode = cache[key];
  49266. if (cachedNode) {
  49267. var name = getComponentName(cachedNode.componentOptions);
  49268. if (name && !filter(name)) {
  49269. pruneCacheEntry(cache, key, keys, _vnode);
  49270. }
  49271. }
  49272. }
  49273. }
  49274. function pruneCacheEntry (
  49275. cache,
  49276. key,
  49277. keys,
  49278. current
  49279. ) {
  49280. var cached$$1 = cache[key];
  49281. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  49282. cached$$1.componentInstance.$destroy();
  49283. }
  49284. cache[key] = null;
  49285. remove(keys, key);
  49286. }
  49287. var patternTypes = [String, RegExp, Array];
  49288. var KeepAlive = {
  49289. name: 'keep-alive',
  49290. abstract: true,
  49291. props: {
  49292. include: patternTypes,
  49293. exclude: patternTypes,
  49294. max: [String, Number]
  49295. },
  49296. created: function created () {
  49297. this.cache = Object.create(null);
  49298. this.keys = [];
  49299. },
  49300. destroyed: function destroyed () {
  49301. for (var key in this.cache) {
  49302. pruneCacheEntry(this.cache, key, this.keys);
  49303. }
  49304. },
  49305. mounted: function mounted () {
  49306. var this$1 = this;
  49307. this.$watch('include', function (val) {
  49308. pruneCache(this$1, function (name) { return matches(val, name); });
  49309. });
  49310. this.$watch('exclude', function (val) {
  49311. pruneCache(this$1, function (name) { return !matches(val, name); });
  49312. });
  49313. },
  49314. render: function render () {
  49315. var slot = this.$slots.default;
  49316. var vnode = getFirstComponentChild(slot);
  49317. var componentOptions = vnode && vnode.componentOptions;
  49318. if (componentOptions) {
  49319. // check pattern
  49320. var name = getComponentName(componentOptions);
  49321. var ref = this;
  49322. var include = ref.include;
  49323. var exclude = ref.exclude;
  49324. if (
  49325. // not included
  49326. (include && (!name || !matches(include, name))) ||
  49327. // excluded
  49328. (exclude && name && matches(exclude, name))
  49329. ) {
  49330. return vnode
  49331. }
  49332. var ref$1 = this;
  49333. var cache = ref$1.cache;
  49334. var keys = ref$1.keys;
  49335. var key = vnode.key == null
  49336. // same constructor may get registered as different local components
  49337. // so cid alone is not enough (#3269)
  49338. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  49339. : vnode.key;
  49340. if (cache[key]) {
  49341. vnode.componentInstance = cache[key].componentInstance;
  49342. // make current key freshest
  49343. remove(keys, key);
  49344. keys.push(key);
  49345. } else {
  49346. cache[key] = vnode;
  49347. keys.push(key);
  49348. // prune oldest entry
  49349. if (this.max && keys.length > parseInt(this.max)) {
  49350. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  49351. }
  49352. }
  49353. vnode.data.keepAlive = true;
  49354. }
  49355. return vnode || (slot && slot[0])
  49356. }
  49357. };
  49358. var builtInComponents = {
  49359. KeepAlive: KeepAlive
  49360. };
  49361. /* */
  49362. function initGlobalAPI (Vue) {
  49363. // config
  49364. var configDef = {};
  49365. configDef.get = function () { return config; };
  49366. {
  49367. configDef.set = function () {
  49368. warn(
  49369. 'Do not replace the Vue.config object, set individual fields instead.'
  49370. );
  49371. };
  49372. }
  49373. Object.defineProperty(Vue, 'config', configDef);
  49374. // exposed util methods.
  49375. // NOTE: these are not considered part of the public API - avoid relying on
  49376. // them unless you are aware of the risk.
  49377. Vue.util = {
  49378. warn: warn,
  49379. extend: extend,
  49380. mergeOptions: mergeOptions,
  49381. defineReactive: defineReactive$$1
  49382. };
  49383. Vue.set = set;
  49384. Vue.delete = del;
  49385. Vue.nextTick = nextTick;
  49386. // 2.6 explicit observable API
  49387. Vue.observable = function (obj) {
  49388. observe(obj);
  49389. return obj
  49390. };
  49391. Vue.options = Object.create(null);
  49392. ASSET_TYPES.forEach(function (type) {
  49393. Vue.options[type + 's'] = Object.create(null);
  49394. });
  49395. // this is used to identify the "base" constructor to extend all plain-object
  49396. // components with in Weex's multi-instance scenarios.
  49397. Vue.options._base = Vue;
  49398. extend(Vue.options.components, builtInComponents);
  49399. initUse(Vue);
  49400. initMixin$1(Vue);
  49401. initExtend(Vue);
  49402. initAssetRegisters(Vue);
  49403. }
  49404. initGlobalAPI(Vue);
  49405. Object.defineProperty(Vue.prototype, '$isServer', {
  49406. get: isServerRendering
  49407. });
  49408. Object.defineProperty(Vue.prototype, '$ssrContext', {
  49409. get: function get () {
  49410. /* istanbul ignore next */
  49411. return this.$vnode && this.$vnode.ssrContext
  49412. }
  49413. });
  49414. // expose FunctionalRenderContext for ssr runtime helper installation
  49415. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  49416. value: FunctionalRenderContext
  49417. });
  49418. Vue.version = '2.6.11';
  49419. /* */
  49420. // these are reserved for web because they are directly compiled away
  49421. // during template compilation
  49422. var isReservedAttr = makeMap('style,class');
  49423. // attributes that should be using props for binding
  49424. var acceptValue = makeMap('input,textarea,option,select,progress');
  49425. var mustUseProp = function (tag, type, attr) {
  49426. return (
  49427. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  49428. (attr === 'selected' && tag === 'option') ||
  49429. (attr === 'checked' && tag === 'input') ||
  49430. (attr === 'muted' && tag === 'video')
  49431. )
  49432. };
  49433. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  49434. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  49435. var convertEnumeratedValue = function (key, value) {
  49436. return isFalsyAttrValue(value) || value === 'false'
  49437. ? 'false'
  49438. // allow arbitrary string value for contenteditable
  49439. : key === 'contenteditable' && isValidContentEditableValue(value)
  49440. ? value
  49441. : 'true'
  49442. };
  49443. var isBooleanAttr = makeMap(
  49444. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  49445. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  49446. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  49447. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  49448. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  49449. 'truespeed,typemustmatch,visible'
  49450. );
  49451. var xlinkNS = 'http://www.w3.org/1999/xlink';
  49452. var isXlink = function (name) {
  49453. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  49454. };
  49455. var getXlinkProp = function (name) {
  49456. return isXlink(name) ? name.slice(6, name.length) : ''
  49457. };
  49458. var isFalsyAttrValue = function (val) {
  49459. return val == null || val === false
  49460. };
  49461. /* */
  49462. function genClassForVnode (vnode) {
  49463. var data = vnode.data;
  49464. var parentNode = vnode;
  49465. var childNode = vnode;
  49466. while (isDef(childNode.componentInstance)) {
  49467. childNode = childNode.componentInstance._vnode;
  49468. if (childNode && childNode.data) {
  49469. data = mergeClassData(childNode.data, data);
  49470. }
  49471. }
  49472. while (isDef(parentNode = parentNode.parent)) {
  49473. if (parentNode && parentNode.data) {
  49474. data = mergeClassData(data, parentNode.data);
  49475. }
  49476. }
  49477. return renderClass(data.staticClass, data.class)
  49478. }
  49479. function mergeClassData (child, parent) {
  49480. return {
  49481. staticClass: concat(child.staticClass, parent.staticClass),
  49482. class: isDef(child.class)
  49483. ? [child.class, parent.class]
  49484. : parent.class
  49485. }
  49486. }
  49487. function renderClass (
  49488. staticClass,
  49489. dynamicClass
  49490. ) {
  49491. if (isDef(staticClass) || isDef(dynamicClass)) {
  49492. return concat(staticClass, stringifyClass(dynamicClass))
  49493. }
  49494. /* istanbul ignore next */
  49495. return ''
  49496. }
  49497. function concat (a, b) {
  49498. return a ? b ? (a + ' ' + b) : a : (b || '')
  49499. }
  49500. function stringifyClass (value) {
  49501. if (Array.isArray(value)) {
  49502. return stringifyArray(value)
  49503. }
  49504. if (isObject(value)) {
  49505. return stringifyObject(value)
  49506. }
  49507. if (typeof value === 'string') {
  49508. return value
  49509. }
  49510. /* istanbul ignore next */
  49511. return ''
  49512. }
  49513. function stringifyArray (value) {
  49514. var res = '';
  49515. var stringified;
  49516. for (var i = 0, l = value.length; i < l; i++) {
  49517. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  49518. if (res) { res += ' '; }
  49519. res += stringified;
  49520. }
  49521. }
  49522. return res
  49523. }
  49524. function stringifyObject (value) {
  49525. var res = '';
  49526. for (var key in value) {
  49527. if (value[key]) {
  49528. if (res) { res += ' '; }
  49529. res += key;
  49530. }
  49531. }
  49532. return res
  49533. }
  49534. /* */
  49535. var namespaceMap = {
  49536. svg: 'http://www.w3.org/2000/svg',
  49537. math: 'http://www.w3.org/1998/Math/MathML'
  49538. };
  49539. var isHTMLTag = makeMap(
  49540. 'html,body,base,head,link,meta,style,title,' +
  49541. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  49542. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  49543. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  49544. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  49545. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  49546. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  49547. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  49548. 'output,progress,select,textarea,' +
  49549. 'details,dialog,menu,menuitem,summary,' +
  49550. 'content,element,shadow,template,blockquote,iframe,tfoot'
  49551. );
  49552. // this map is intentionally selective, only covering SVG elements that may
  49553. // contain child elements.
  49554. var isSVG = makeMap(
  49555. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  49556. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  49557. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  49558. true
  49559. );
  49560. var isPreTag = function (tag) { return tag === 'pre'; };
  49561. var isReservedTag = function (tag) {
  49562. return isHTMLTag(tag) || isSVG(tag)
  49563. };
  49564. function getTagNamespace (tag) {
  49565. if (isSVG(tag)) {
  49566. return 'svg'
  49567. }
  49568. // basic support for MathML
  49569. // note it doesn't support other MathML elements being component roots
  49570. if (tag === 'math') {
  49571. return 'math'
  49572. }
  49573. }
  49574. var unknownElementCache = Object.create(null);
  49575. function isUnknownElement (tag) {
  49576. /* istanbul ignore if */
  49577. if (!inBrowser) {
  49578. return true
  49579. }
  49580. if (isReservedTag(tag)) {
  49581. return false
  49582. }
  49583. tag = tag.toLowerCase();
  49584. /* istanbul ignore if */
  49585. if (unknownElementCache[tag] != null) {
  49586. return unknownElementCache[tag]
  49587. }
  49588. var el = document.createElement(tag);
  49589. if (tag.indexOf('-') > -1) {
  49590. // http://stackoverflow.com/a/28210364/1070244
  49591. return (unknownElementCache[tag] = (
  49592. el.constructor === window.HTMLUnknownElement ||
  49593. el.constructor === window.HTMLElement
  49594. ))
  49595. } else {
  49596. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  49597. }
  49598. }
  49599. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  49600. /* */
  49601. /**
  49602. * Query an element selector if it's not an element already.
  49603. */
  49604. function query (el) {
  49605. if (typeof el === 'string') {
  49606. var selected = document.querySelector(el);
  49607. if (!selected) {
  49608. warn(
  49609. 'Cannot find element: ' + el
  49610. );
  49611. return document.createElement('div')
  49612. }
  49613. return selected
  49614. } else {
  49615. return el
  49616. }
  49617. }
  49618. /* */
  49619. function createElement$1 (tagName, vnode) {
  49620. var elm = document.createElement(tagName);
  49621. if (tagName !== 'select') {
  49622. return elm
  49623. }
  49624. // false or null will remove the attribute but undefined will not
  49625. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  49626. elm.setAttribute('multiple', 'multiple');
  49627. }
  49628. return elm
  49629. }
  49630. function createElementNS (namespace, tagName) {
  49631. return document.createElementNS(namespaceMap[namespace], tagName)
  49632. }
  49633. function createTextNode (text) {
  49634. return document.createTextNode(text)
  49635. }
  49636. function createComment (text) {
  49637. return document.createComment(text)
  49638. }
  49639. function insertBefore (parentNode, newNode, referenceNode) {
  49640. parentNode.insertBefore(newNode, referenceNode);
  49641. }
  49642. function removeChild (node, child) {
  49643. node.removeChild(child);
  49644. }
  49645. function appendChild (node, child) {
  49646. node.appendChild(child);
  49647. }
  49648. function parentNode (node) {
  49649. return node.parentNode
  49650. }
  49651. function nextSibling (node) {
  49652. return node.nextSibling
  49653. }
  49654. function tagName (node) {
  49655. return node.tagName
  49656. }
  49657. function setTextContent (node, text) {
  49658. node.textContent = text;
  49659. }
  49660. function setStyleScope (node, scopeId) {
  49661. node.setAttribute(scopeId, '');
  49662. }
  49663. var nodeOps = /*#__PURE__*/Object.freeze({
  49664. createElement: createElement$1,
  49665. createElementNS: createElementNS,
  49666. createTextNode: createTextNode,
  49667. createComment: createComment,
  49668. insertBefore: insertBefore,
  49669. removeChild: removeChild,
  49670. appendChild: appendChild,
  49671. parentNode: parentNode,
  49672. nextSibling: nextSibling,
  49673. tagName: tagName,
  49674. setTextContent: setTextContent,
  49675. setStyleScope: setStyleScope
  49676. });
  49677. /* */
  49678. var ref = {
  49679. create: function create (_, vnode) {
  49680. registerRef(vnode);
  49681. },
  49682. update: function update (oldVnode, vnode) {
  49683. if (oldVnode.data.ref !== vnode.data.ref) {
  49684. registerRef(oldVnode, true);
  49685. registerRef(vnode);
  49686. }
  49687. },
  49688. destroy: function destroy (vnode) {
  49689. registerRef(vnode, true);
  49690. }
  49691. };
  49692. function registerRef (vnode, isRemoval) {
  49693. var key = vnode.data.ref;
  49694. if (!isDef(key)) { return }
  49695. var vm = vnode.context;
  49696. var ref = vnode.componentInstance || vnode.elm;
  49697. var refs = vm.$refs;
  49698. if (isRemoval) {
  49699. if (Array.isArray(refs[key])) {
  49700. remove(refs[key], ref);
  49701. } else if (refs[key] === ref) {
  49702. refs[key] = undefined;
  49703. }
  49704. } else {
  49705. if (vnode.data.refInFor) {
  49706. if (!Array.isArray(refs[key])) {
  49707. refs[key] = [ref];
  49708. } else if (refs[key].indexOf(ref) < 0) {
  49709. // $flow-disable-line
  49710. refs[key].push(ref);
  49711. }
  49712. } else {
  49713. refs[key] = ref;
  49714. }
  49715. }
  49716. }
  49717. /**
  49718. * Virtual DOM patching algorithm based on Snabbdom by
  49719. * Simon Friis Vindum (@paldepind)
  49720. * Licensed under the MIT License
  49721. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  49722. *
  49723. * modified by Evan You (@yyx990803)
  49724. *
  49725. * Not type-checking this because this file is perf-critical and the cost
  49726. * of making flow understand it is not worth it.
  49727. */
  49728. var emptyNode = new VNode('', {}, []);
  49729. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  49730. function sameVnode (a, b) {
  49731. return (
  49732. a.key === b.key && (
  49733. (
  49734. a.tag === b.tag &&
  49735. a.isComment === b.isComment &&
  49736. isDef(a.data) === isDef(b.data) &&
  49737. sameInputType(a, b)
  49738. ) || (
  49739. isTrue(a.isAsyncPlaceholder) &&
  49740. a.asyncFactory === b.asyncFactory &&
  49741. isUndef(b.asyncFactory.error)
  49742. )
  49743. )
  49744. )
  49745. }
  49746. function sameInputType (a, b) {
  49747. if (a.tag !== 'input') { return true }
  49748. var i;
  49749. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  49750. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  49751. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  49752. }
  49753. function createKeyToOldIdx (children, beginIdx, endIdx) {
  49754. var i, key;
  49755. var map = {};
  49756. for (i = beginIdx; i <= endIdx; ++i) {
  49757. key = children[i].key;
  49758. if (isDef(key)) { map[key] = i; }
  49759. }
  49760. return map
  49761. }
  49762. function createPatchFunction (backend) {
  49763. var i, j;
  49764. var cbs = {};
  49765. var modules = backend.modules;
  49766. var nodeOps = backend.nodeOps;
  49767. for (i = 0; i < hooks.length; ++i) {
  49768. cbs[hooks[i]] = [];
  49769. for (j = 0; j < modules.length; ++j) {
  49770. if (isDef(modules[j][hooks[i]])) {
  49771. cbs[hooks[i]].push(modules[j][hooks[i]]);
  49772. }
  49773. }
  49774. }
  49775. function emptyNodeAt (elm) {
  49776. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  49777. }
  49778. function createRmCb (childElm, listeners) {
  49779. function remove$$1 () {
  49780. if (--remove$$1.listeners === 0) {
  49781. removeNode(childElm);
  49782. }
  49783. }
  49784. remove$$1.listeners = listeners;
  49785. return remove$$1
  49786. }
  49787. function removeNode (el) {
  49788. var parent = nodeOps.parentNode(el);
  49789. // element may have already been removed due to v-html / v-text
  49790. if (isDef(parent)) {
  49791. nodeOps.removeChild(parent, el);
  49792. }
  49793. }
  49794. function isUnknownElement$$1 (vnode, inVPre) {
  49795. return (
  49796. !inVPre &&
  49797. !vnode.ns &&
  49798. !(
  49799. config.ignoredElements.length &&
  49800. config.ignoredElements.some(function (ignore) {
  49801. return isRegExp(ignore)
  49802. ? ignore.test(vnode.tag)
  49803. : ignore === vnode.tag
  49804. })
  49805. ) &&
  49806. config.isUnknownElement(vnode.tag)
  49807. )
  49808. }
  49809. var creatingElmInVPre = 0;
  49810. function createElm (
  49811. vnode,
  49812. insertedVnodeQueue,
  49813. parentElm,
  49814. refElm,
  49815. nested,
  49816. ownerArray,
  49817. index
  49818. ) {
  49819. if (isDef(vnode.elm) && isDef(ownerArray)) {
  49820. // This vnode was used in a previous render!
  49821. // now it's used as a new node, overwriting its elm would cause
  49822. // potential patch errors down the road when it's used as an insertion
  49823. // reference node. Instead, we clone the node on-demand before creating
  49824. // associated DOM element for it.
  49825. vnode = ownerArray[index] = cloneVNode(vnode);
  49826. }
  49827. vnode.isRootInsert = !nested; // for transition enter check
  49828. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  49829. return
  49830. }
  49831. var data = vnode.data;
  49832. var children = vnode.children;
  49833. var tag = vnode.tag;
  49834. if (isDef(tag)) {
  49835. {
  49836. if (data && data.pre) {
  49837. creatingElmInVPre++;
  49838. }
  49839. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  49840. warn(
  49841. 'Unknown custom element: <' + tag + '> - did you ' +
  49842. 'register the component correctly? For recursive components, ' +
  49843. 'make sure to provide the "name" option.',
  49844. vnode.context
  49845. );
  49846. }
  49847. }
  49848. vnode.elm = vnode.ns
  49849. ? nodeOps.createElementNS(vnode.ns, tag)
  49850. : nodeOps.createElement(tag, vnode);
  49851. setScope(vnode);
  49852. /* istanbul ignore if */
  49853. {
  49854. createChildren(vnode, children, insertedVnodeQueue);
  49855. if (isDef(data)) {
  49856. invokeCreateHooks(vnode, insertedVnodeQueue);
  49857. }
  49858. insert(parentElm, vnode.elm, refElm);
  49859. }
  49860. if (data && data.pre) {
  49861. creatingElmInVPre--;
  49862. }
  49863. } else if (isTrue(vnode.isComment)) {
  49864. vnode.elm = nodeOps.createComment(vnode.text);
  49865. insert(parentElm, vnode.elm, refElm);
  49866. } else {
  49867. vnode.elm = nodeOps.createTextNode(vnode.text);
  49868. insert(parentElm, vnode.elm, refElm);
  49869. }
  49870. }
  49871. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  49872. var i = vnode.data;
  49873. if (isDef(i)) {
  49874. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  49875. if (isDef(i = i.hook) && isDef(i = i.init)) {
  49876. i(vnode, false /* hydrating */);
  49877. }
  49878. // after calling the init hook, if the vnode is a child component
  49879. // it should've created a child instance and mounted it. the child
  49880. // component also has set the placeholder vnode's elm.
  49881. // in that case we can just return the element and be done.
  49882. if (isDef(vnode.componentInstance)) {
  49883. initComponent(vnode, insertedVnodeQueue);
  49884. insert(parentElm, vnode.elm, refElm);
  49885. if (isTrue(isReactivated)) {
  49886. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  49887. }
  49888. return true
  49889. }
  49890. }
  49891. }
  49892. function initComponent (vnode, insertedVnodeQueue) {
  49893. if (isDef(vnode.data.pendingInsert)) {
  49894. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  49895. vnode.data.pendingInsert = null;
  49896. }
  49897. vnode.elm = vnode.componentInstance.$el;
  49898. if (isPatchable(vnode)) {
  49899. invokeCreateHooks(vnode, insertedVnodeQueue);
  49900. setScope(vnode);
  49901. } else {
  49902. // empty component root.
  49903. // skip all element-related modules except for ref (#3455)
  49904. registerRef(vnode);
  49905. // make sure to invoke the insert hook
  49906. insertedVnodeQueue.push(vnode);
  49907. }
  49908. }
  49909. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  49910. var i;
  49911. // hack for #4339: a reactivated component with inner transition
  49912. // does not trigger because the inner node's created hooks are not called
  49913. // again. It's not ideal to involve module-specific logic in here but
  49914. // there doesn't seem to be a better way to do it.
  49915. var innerNode = vnode;
  49916. while (innerNode.componentInstance) {
  49917. innerNode = innerNode.componentInstance._vnode;
  49918. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  49919. for (i = 0; i < cbs.activate.length; ++i) {
  49920. cbs.activate[i](emptyNode, innerNode);
  49921. }
  49922. insertedVnodeQueue.push(innerNode);
  49923. break
  49924. }
  49925. }
  49926. // unlike a newly created component,
  49927. // a reactivated keep-alive component doesn't insert itself
  49928. insert(parentElm, vnode.elm, refElm);
  49929. }
  49930. function insert (parent, elm, ref$$1) {
  49931. if (isDef(parent)) {
  49932. if (isDef(ref$$1)) {
  49933. if (nodeOps.parentNode(ref$$1) === parent) {
  49934. nodeOps.insertBefore(parent, elm, ref$$1);
  49935. }
  49936. } else {
  49937. nodeOps.appendChild(parent, elm);
  49938. }
  49939. }
  49940. }
  49941. function createChildren (vnode, children, insertedVnodeQueue) {
  49942. if (Array.isArray(children)) {
  49943. {
  49944. checkDuplicateKeys(children);
  49945. }
  49946. for (var i = 0; i < children.length; ++i) {
  49947. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  49948. }
  49949. } else if (isPrimitive(vnode.text)) {
  49950. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  49951. }
  49952. }
  49953. function isPatchable (vnode) {
  49954. while (vnode.componentInstance) {
  49955. vnode = vnode.componentInstance._vnode;
  49956. }
  49957. return isDef(vnode.tag)
  49958. }
  49959. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  49960. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  49961. cbs.create[i$1](emptyNode, vnode);
  49962. }
  49963. i = vnode.data.hook; // Reuse variable
  49964. if (isDef(i)) {
  49965. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  49966. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  49967. }
  49968. }
  49969. // set scope id attribute for scoped CSS.
  49970. // this is implemented as a special case to avoid the overhead
  49971. // of going through the normal attribute patching process.
  49972. function setScope (vnode) {
  49973. var i;
  49974. if (isDef(i = vnode.fnScopeId)) {
  49975. nodeOps.setStyleScope(vnode.elm, i);
  49976. } else {
  49977. var ancestor = vnode;
  49978. while (ancestor) {
  49979. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  49980. nodeOps.setStyleScope(vnode.elm, i);
  49981. }
  49982. ancestor = ancestor.parent;
  49983. }
  49984. }
  49985. // for slot content they should also get the scopeId from the host instance.
  49986. if (isDef(i = activeInstance) &&
  49987. i !== vnode.context &&
  49988. i !== vnode.fnContext &&
  49989. isDef(i = i.$options._scopeId)
  49990. ) {
  49991. nodeOps.setStyleScope(vnode.elm, i);
  49992. }
  49993. }
  49994. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  49995. for (; startIdx <= endIdx; ++startIdx) {
  49996. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  49997. }
  49998. }
  49999. function invokeDestroyHook (vnode) {
  50000. var i, j;
  50001. var data = vnode.data;
  50002. if (isDef(data)) {
  50003. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  50004. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  50005. }
  50006. if (isDef(i = vnode.children)) {
  50007. for (j = 0; j < vnode.children.length; ++j) {
  50008. invokeDestroyHook(vnode.children[j]);
  50009. }
  50010. }
  50011. }
  50012. function removeVnodes (vnodes, startIdx, endIdx) {
  50013. for (; startIdx <= endIdx; ++startIdx) {
  50014. var ch = vnodes[startIdx];
  50015. if (isDef(ch)) {
  50016. if (isDef(ch.tag)) {
  50017. removeAndInvokeRemoveHook(ch);
  50018. invokeDestroyHook(ch);
  50019. } else { // Text node
  50020. removeNode(ch.elm);
  50021. }
  50022. }
  50023. }
  50024. }
  50025. function removeAndInvokeRemoveHook (vnode, rm) {
  50026. if (isDef(rm) || isDef(vnode.data)) {
  50027. var i;
  50028. var listeners = cbs.remove.length + 1;
  50029. if (isDef(rm)) {
  50030. // we have a recursively passed down rm callback
  50031. // increase the listeners count
  50032. rm.listeners += listeners;
  50033. } else {
  50034. // directly removing
  50035. rm = createRmCb(vnode.elm, listeners);
  50036. }
  50037. // recursively invoke hooks on child component root node
  50038. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  50039. removeAndInvokeRemoveHook(i, rm);
  50040. }
  50041. for (i = 0; i < cbs.remove.length; ++i) {
  50042. cbs.remove[i](vnode, rm);
  50043. }
  50044. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  50045. i(vnode, rm);
  50046. } else {
  50047. rm();
  50048. }
  50049. } else {
  50050. removeNode(vnode.elm);
  50051. }
  50052. }
  50053. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  50054. var oldStartIdx = 0;
  50055. var newStartIdx = 0;
  50056. var oldEndIdx = oldCh.length - 1;
  50057. var oldStartVnode = oldCh[0];
  50058. var oldEndVnode = oldCh[oldEndIdx];
  50059. var newEndIdx = newCh.length - 1;
  50060. var newStartVnode = newCh[0];
  50061. var newEndVnode = newCh[newEndIdx];
  50062. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  50063. // removeOnly is a special flag used only by <transition-group>
  50064. // to ensure removed elements stay in correct relative positions
  50065. // during leaving transitions
  50066. var canMove = !removeOnly;
  50067. {
  50068. checkDuplicateKeys(newCh);
  50069. }
  50070. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  50071. if (isUndef(oldStartVnode)) {
  50072. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  50073. } else if (isUndef(oldEndVnode)) {
  50074. oldEndVnode = oldCh[--oldEndIdx];
  50075. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  50076. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50077. oldStartVnode = oldCh[++oldStartIdx];
  50078. newStartVnode = newCh[++newStartIdx];
  50079. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  50080. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  50081. oldEndVnode = oldCh[--oldEndIdx];
  50082. newEndVnode = newCh[--newEndIdx];
  50083. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  50084. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  50085. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  50086. oldStartVnode = oldCh[++oldStartIdx];
  50087. newEndVnode = newCh[--newEndIdx];
  50088. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  50089. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50090. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  50091. oldEndVnode = oldCh[--oldEndIdx];
  50092. newStartVnode = newCh[++newStartIdx];
  50093. } else {
  50094. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  50095. idxInOld = isDef(newStartVnode.key)
  50096. ? oldKeyToIdx[newStartVnode.key]
  50097. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  50098. if (isUndef(idxInOld)) { // New element
  50099. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  50100. } else {
  50101. vnodeToMove = oldCh[idxInOld];
  50102. if (sameVnode(vnodeToMove, newStartVnode)) {
  50103. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50104. oldCh[idxInOld] = undefined;
  50105. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  50106. } else {
  50107. // same key but different element. treat as new element
  50108. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  50109. }
  50110. }
  50111. newStartVnode = newCh[++newStartIdx];
  50112. }
  50113. }
  50114. if (oldStartIdx > oldEndIdx) {
  50115. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  50116. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  50117. } else if (newStartIdx > newEndIdx) {
  50118. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  50119. }
  50120. }
  50121. function checkDuplicateKeys (children) {
  50122. var seenKeys = {};
  50123. for (var i = 0; i < children.length; i++) {
  50124. var vnode = children[i];
  50125. var key = vnode.key;
  50126. if (isDef(key)) {
  50127. if (seenKeys[key]) {
  50128. warn(
  50129. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  50130. vnode.context
  50131. );
  50132. } else {
  50133. seenKeys[key] = true;
  50134. }
  50135. }
  50136. }
  50137. }
  50138. function findIdxInOld (node, oldCh, start, end) {
  50139. for (var i = start; i < end; i++) {
  50140. var c = oldCh[i];
  50141. if (isDef(c) && sameVnode(node, c)) { return i }
  50142. }
  50143. }
  50144. function patchVnode (
  50145. oldVnode,
  50146. vnode,
  50147. insertedVnodeQueue,
  50148. ownerArray,
  50149. index,
  50150. removeOnly
  50151. ) {
  50152. if (oldVnode === vnode) {
  50153. return
  50154. }
  50155. if (isDef(vnode.elm) && isDef(ownerArray)) {
  50156. // clone reused vnode
  50157. vnode = ownerArray[index] = cloneVNode(vnode);
  50158. }
  50159. var elm = vnode.elm = oldVnode.elm;
  50160. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  50161. if (isDef(vnode.asyncFactory.resolved)) {
  50162. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  50163. } else {
  50164. vnode.isAsyncPlaceholder = true;
  50165. }
  50166. return
  50167. }
  50168. // reuse element for static trees.
  50169. // note we only do this if the vnode is cloned -
  50170. // if the new node is not cloned it means the render functions have been
  50171. // reset by the hot-reload-api and we need to do a proper re-render.
  50172. if (isTrue(vnode.isStatic) &&
  50173. isTrue(oldVnode.isStatic) &&
  50174. vnode.key === oldVnode.key &&
  50175. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  50176. ) {
  50177. vnode.componentInstance = oldVnode.componentInstance;
  50178. return
  50179. }
  50180. var i;
  50181. var data = vnode.data;
  50182. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  50183. i(oldVnode, vnode);
  50184. }
  50185. var oldCh = oldVnode.children;
  50186. var ch = vnode.children;
  50187. if (isDef(data) && isPatchable(vnode)) {
  50188. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  50189. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  50190. }
  50191. if (isUndef(vnode.text)) {
  50192. if (isDef(oldCh) && isDef(ch)) {
  50193. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  50194. } else if (isDef(ch)) {
  50195. {
  50196. checkDuplicateKeys(ch);
  50197. }
  50198. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  50199. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  50200. } else if (isDef(oldCh)) {
  50201. removeVnodes(oldCh, 0, oldCh.length - 1);
  50202. } else if (isDef(oldVnode.text)) {
  50203. nodeOps.setTextContent(elm, '');
  50204. }
  50205. } else if (oldVnode.text !== vnode.text) {
  50206. nodeOps.setTextContent(elm, vnode.text);
  50207. }
  50208. if (isDef(data)) {
  50209. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  50210. }
  50211. }
  50212. function invokeInsertHook (vnode, queue, initial) {
  50213. // delay insert hooks for component root nodes, invoke them after the
  50214. // element is really inserted
  50215. if (isTrue(initial) && isDef(vnode.parent)) {
  50216. vnode.parent.data.pendingInsert = queue;
  50217. } else {
  50218. for (var i = 0; i < queue.length; ++i) {
  50219. queue[i].data.hook.insert(queue[i]);
  50220. }
  50221. }
  50222. }
  50223. var hydrationBailed = false;
  50224. // list of modules that can skip create hook during hydration because they
  50225. // are already rendered on the client or has no need for initialization
  50226. // Note: style is excluded because it relies on initial clone for future
  50227. // deep updates (#7063).
  50228. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  50229. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  50230. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  50231. var i;
  50232. var tag = vnode.tag;
  50233. var data = vnode.data;
  50234. var children = vnode.children;
  50235. inVPre = inVPre || (data && data.pre);
  50236. vnode.elm = elm;
  50237. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  50238. vnode.isAsyncPlaceholder = true;
  50239. return true
  50240. }
  50241. // assert node match
  50242. {
  50243. if (!assertNodeMatch(elm, vnode, inVPre)) {
  50244. return false
  50245. }
  50246. }
  50247. if (isDef(data)) {
  50248. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  50249. if (isDef(i = vnode.componentInstance)) {
  50250. // child component. it should have hydrated its own tree.
  50251. initComponent(vnode, insertedVnodeQueue);
  50252. return true
  50253. }
  50254. }
  50255. if (isDef(tag)) {
  50256. if (isDef(children)) {
  50257. // empty element, allow client to pick up and populate children
  50258. if (!elm.hasChildNodes()) {
  50259. createChildren(vnode, children, insertedVnodeQueue);
  50260. } else {
  50261. // v-html and domProps: innerHTML
  50262. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  50263. if (i !== elm.innerHTML) {
  50264. /* istanbul ignore if */
  50265. if (typeof console !== 'undefined' &&
  50266. !hydrationBailed
  50267. ) {
  50268. hydrationBailed = true;
  50269. console.warn('Parent: ', elm);
  50270. console.warn('server innerHTML: ', i);
  50271. console.warn('client innerHTML: ', elm.innerHTML);
  50272. }
  50273. return false
  50274. }
  50275. } else {
  50276. // iterate and compare children lists
  50277. var childrenMatch = true;
  50278. var childNode = elm.firstChild;
  50279. for (var i$1 = 0; i$1 < children.length; i$1++) {
  50280. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  50281. childrenMatch = false;
  50282. break
  50283. }
  50284. childNode = childNode.nextSibling;
  50285. }
  50286. // if childNode is not null, it means the actual childNodes list is
  50287. // longer than the virtual children list.
  50288. if (!childrenMatch || childNode) {
  50289. /* istanbul ignore if */
  50290. if (typeof console !== 'undefined' &&
  50291. !hydrationBailed
  50292. ) {
  50293. hydrationBailed = true;
  50294. console.warn('Parent: ', elm);
  50295. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  50296. }
  50297. return false
  50298. }
  50299. }
  50300. }
  50301. }
  50302. if (isDef(data)) {
  50303. var fullInvoke = false;
  50304. for (var key in data) {
  50305. if (!isRenderedModule(key)) {
  50306. fullInvoke = true;
  50307. invokeCreateHooks(vnode, insertedVnodeQueue);
  50308. break
  50309. }
  50310. }
  50311. if (!fullInvoke && data['class']) {
  50312. // ensure collecting deps for deep class bindings for future updates
  50313. traverse(data['class']);
  50314. }
  50315. }
  50316. } else if (elm.data !== vnode.text) {
  50317. elm.data = vnode.text;
  50318. }
  50319. return true
  50320. }
  50321. function assertNodeMatch (node, vnode, inVPre) {
  50322. if (isDef(vnode.tag)) {
  50323. return vnode.tag.indexOf('vue-component') === 0 || (
  50324. !isUnknownElement$$1(vnode, inVPre) &&
  50325. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  50326. )
  50327. } else {
  50328. return node.nodeType === (vnode.isComment ? 8 : 3)
  50329. }
  50330. }
  50331. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  50332. if (isUndef(vnode)) {
  50333. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  50334. return
  50335. }
  50336. var isInitialPatch = false;
  50337. var insertedVnodeQueue = [];
  50338. if (isUndef(oldVnode)) {
  50339. // empty mount (likely as component), create new root element
  50340. isInitialPatch = true;
  50341. createElm(vnode, insertedVnodeQueue);
  50342. } else {
  50343. var isRealElement = isDef(oldVnode.nodeType);
  50344. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  50345. // patch existing root node
  50346. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  50347. } else {
  50348. if (isRealElement) {
  50349. // mounting to a real element
  50350. // check if this is server-rendered content and if we can perform
  50351. // a successful hydration.
  50352. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  50353. oldVnode.removeAttribute(SSR_ATTR);
  50354. hydrating = true;
  50355. }
  50356. if (isTrue(hydrating)) {
  50357. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  50358. invokeInsertHook(vnode, insertedVnodeQueue, true);
  50359. return oldVnode
  50360. } else {
  50361. warn(
  50362. 'The client-side rendered virtual DOM tree is not matching ' +
  50363. 'server-rendered content. This is likely caused by incorrect ' +
  50364. 'HTML markup, for example nesting block-level elements inside ' +
  50365. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  50366. 'full client-side render.'
  50367. );
  50368. }
  50369. }
  50370. // either not server-rendered, or hydration failed.
  50371. // create an empty node and replace it
  50372. oldVnode = emptyNodeAt(oldVnode);
  50373. }
  50374. // replacing existing element
  50375. var oldElm = oldVnode.elm;
  50376. var parentElm = nodeOps.parentNode(oldElm);
  50377. // create new node
  50378. createElm(
  50379. vnode,
  50380. insertedVnodeQueue,
  50381. // extremely rare edge case: do not insert if old element is in a
  50382. // leaving transition. Only happens when combining transition +
  50383. // keep-alive + HOCs. (#4590)
  50384. oldElm._leaveCb ? null : parentElm,
  50385. nodeOps.nextSibling(oldElm)
  50386. );
  50387. // update parent placeholder node element, recursively
  50388. if (isDef(vnode.parent)) {
  50389. var ancestor = vnode.parent;
  50390. var patchable = isPatchable(vnode);
  50391. while (ancestor) {
  50392. for (var i = 0; i < cbs.destroy.length; ++i) {
  50393. cbs.destroy[i](ancestor);
  50394. }
  50395. ancestor.elm = vnode.elm;
  50396. if (patchable) {
  50397. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  50398. cbs.create[i$1](emptyNode, ancestor);
  50399. }
  50400. // #6513
  50401. // invoke insert hooks that may have been merged by create hooks.
  50402. // e.g. for directives that uses the "inserted" hook.
  50403. var insert = ancestor.data.hook.insert;
  50404. if (insert.merged) {
  50405. // start at index 1 to avoid re-invoking component mounted hook
  50406. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  50407. insert.fns[i$2]();
  50408. }
  50409. }
  50410. } else {
  50411. registerRef(ancestor);
  50412. }
  50413. ancestor = ancestor.parent;
  50414. }
  50415. }
  50416. // destroy old node
  50417. if (isDef(parentElm)) {
  50418. removeVnodes([oldVnode], 0, 0);
  50419. } else if (isDef(oldVnode.tag)) {
  50420. invokeDestroyHook(oldVnode);
  50421. }
  50422. }
  50423. }
  50424. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  50425. return vnode.elm
  50426. }
  50427. }
  50428. /* */
  50429. var directives = {
  50430. create: updateDirectives,
  50431. update: updateDirectives,
  50432. destroy: function unbindDirectives (vnode) {
  50433. updateDirectives(vnode, emptyNode);
  50434. }
  50435. };
  50436. function updateDirectives (oldVnode, vnode) {
  50437. if (oldVnode.data.directives || vnode.data.directives) {
  50438. _update(oldVnode, vnode);
  50439. }
  50440. }
  50441. function _update (oldVnode, vnode) {
  50442. var isCreate = oldVnode === emptyNode;
  50443. var isDestroy = vnode === emptyNode;
  50444. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  50445. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  50446. var dirsWithInsert = [];
  50447. var dirsWithPostpatch = [];
  50448. var key, oldDir, dir;
  50449. for (key in newDirs) {
  50450. oldDir = oldDirs[key];
  50451. dir = newDirs[key];
  50452. if (!oldDir) {
  50453. // new directive, bind
  50454. callHook$1(dir, 'bind', vnode, oldVnode);
  50455. if (dir.def && dir.def.inserted) {
  50456. dirsWithInsert.push(dir);
  50457. }
  50458. } else {
  50459. // existing directive, update
  50460. dir.oldValue = oldDir.value;
  50461. dir.oldArg = oldDir.arg;
  50462. callHook$1(dir, 'update', vnode, oldVnode);
  50463. if (dir.def && dir.def.componentUpdated) {
  50464. dirsWithPostpatch.push(dir);
  50465. }
  50466. }
  50467. }
  50468. if (dirsWithInsert.length) {
  50469. var callInsert = function () {
  50470. for (var i = 0; i < dirsWithInsert.length; i++) {
  50471. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  50472. }
  50473. };
  50474. if (isCreate) {
  50475. mergeVNodeHook(vnode, 'insert', callInsert);
  50476. } else {
  50477. callInsert();
  50478. }
  50479. }
  50480. if (dirsWithPostpatch.length) {
  50481. mergeVNodeHook(vnode, 'postpatch', function () {
  50482. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  50483. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  50484. }
  50485. });
  50486. }
  50487. if (!isCreate) {
  50488. for (key in oldDirs) {
  50489. if (!newDirs[key]) {
  50490. // no longer present, unbind
  50491. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  50492. }
  50493. }
  50494. }
  50495. }
  50496. var emptyModifiers = Object.create(null);
  50497. function normalizeDirectives$1 (
  50498. dirs,
  50499. vm
  50500. ) {
  50501. var res = Object.create(null);
  50502. if (!dirs) {
  50503. // $flow-disable-line
  50504. return res
  50505. }
  50506. var i, dir;
  50507. for (i = 0; i < dirs.length; i++) {
  50508. dir = dirs[i];
  50509. if (!dir.modifiers) {
  50510. // $flow-disable-line
  50511. dir.modifiers = emptyModifiers;
  50512. }
  50513. res[getRawDirName(dir)] = dir;
  50514. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  50515. }
  50516. // $flow-disable-line
  50517. return res
  50518. }
  50519. function getRawDirName (dir) {
  50520. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  50521. }
  50522. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  50523. var fn = dir.def && dir.def[hook];
  50524. if (fn) {
  50525. try {
  50526. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  50527. } catch (e) {
  50528. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  50529. }
  50530. }
  50531. }
  50532. var baseModules = [
  50533. ref,
  50534. directives
  50535. ];
  50536. /* */
  50537. function updateAttrs (oldVnode, vnode) {
  50538. var opts = vnode.componentOptions;
  50539. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  50540. return
  50541. }
  50542. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  50543. return
  50544. }
  50545. var key, cur, old;
  50546. var elm = vnode.elm;
  50547. var oldAttrs = oldVnode.data.attrs || {};
  50548. var attrs = vnode.data.attrs || {};
  50549. // clone observed objects, as the user probably wants to mutate it
  50550. if (isDef(attrs.__ob__)) {
  50551. attrs = vnode.data.attrs = extend({}, attrs);
  50552. }
  50553. for (key in attrs) {
  50554. cur = attrs[key];
  50555. old = oldAttrs[key];
  50556. if (old !== cur) {
  50557. setAttr(elm, key, cur);
  50558. }
  50559. }
  50560. // #4391: in IE9, setting type can reset value for input[type=radio]
  50561. // #6666: IE/Edge forces progress value down to 1 before setting a max
  50562. /* istanbul ignore if */
  50563. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  50564. setAttr(elm, 'value', attrs.value);
  50565. }
  50566. for (key in oldAttrs) {
  50567. if (isUndef(attrs[key])) {
  50568. if (isXlink(key)) {
  50569. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50570. } else if (!isEnumeratedAttr(key)) {
  50571. elm.removeAttribute(key);
  50572. }
  50573. }
  50574. }
  50575. }
  50576. function setAttr (el, key, value) {
  50577. if (el.tagName.indexOf('-') > -1) {
  50578. baseSetAttr(el, key, value);
  50579. } else if (isBooleanAttr(key)) {
  50580. // set attribute for blank value
  50581. // e.g. <option disabled>Select one</option>
  50582. if (isFalsyAttrValue(value)) {
  50583. el.removeAttribute(key);
  50584. } else {
  50585. // technically allowfullscreen is a boolean attribute for <iframe>,
  50586. // but Flash expects a value of "true" when used on <embed> tag
  50587. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  50588. ? 'true'
  50589. : key;
  50590. el.setAttribute(key, value);
  50591. }
  50592. } else if (isEnumeratedAttr(key)) {
  50593. el.setAttribute(key, convertEnumeratedValue(key, value));
  50594. } else if (isXlink(key)) {
  50595. if (isFalsyAttrValue(value)) {
  50596. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50597. } else {
  50598. el.setAttributeNS(xlinkNS, key, value);
  50599. }
  50600. } else {
  50601. baseSetAttr(el, key, value);
  50602. }
  50603. }
  50604. function baseSetAttr (el, key, value) {
  50605. if (isFalsyAttrValue(value)) {
  50606. el.removeAttribute(key);
  50607. } else {
  50608. // #7138: IE10 & 11 fires input event when setting placeholder on
  50609. // <textarea>... block the first input event and remove the blocker
  50610. // immediately.
  50611. /* istanbul ignore if */
  50612. if (
  50613. isIE && !isIE9 &&
  50614. el.tagName === 'TEXTAREA' &&
  50615. key === 'placeholder' && value !== '' && !el.__ieph
  50616. ) {
  50617. var blocker = function (e) {
  50618. e.stopImmediatePropagation();
  50619. el.removeEventListener('input', blocker);
  50620. };
  50621. el.addEventListener('input', blocker);
  50622. // $flow-disable-line
  50623. el.__ieph = true; /* IE placeholder patched */
  50624. }
  50625. el.setAttribute(key, value);
  50626. }
  50627. }
  50628. var attrs = {
  50629. create: updateAttrs,
  50630. update: updateAttrs
  50631. };
  50632. /* */
  50633. function updateClass (oldVnode, vnode) {
  50634. var el = vnode.elm;
  50635. var data = vnode.data;
  50636. var oldData = oldVnode.data;
  50637. if (
  50638. isUndef(data.staticClass) &&
  50639. isUndef(data.class) && (
  50640. isUndef(oldData) || (
  50641. isUndef(oldData.staticClass) &&
  50642. isUndef(oldData.class)
  50643. )
  50644. )
  50645. ) {
  50646. return
  50647. }
  50648. var cls = genClassForVnode(vnode);
  50649. // handle transition classes
  50650. var transitionClass = el._transitionClasses;
  50651. if (isDef(transitionClass)) {
  50652. cls = concat(cls, stringifyClass(transitionClass));
  50653. }
  50654. // set the class
  50655. if (cls !== el._prevClass) {
  50656. el.setAttribute('class', cls);
  50657. el._prevClass = cls;
  50658. }
  50659. }
  50660. var klass = {
  50661. create: updateClass,
  50662. update: updateClass
  50663. };
  50664. /* */
  50665. var validDivisionCharRE = /[\w).+\-_$\]]/;
  50666. function parseFilters (exp) {
  50667. var inSingle = false;
  50668. var inDouble = false;
  50669. var inTemplateString = false;
  50670. var inRegex = false;
  50671. var curly = 0;
  50672. var square = 0;
  50673. var paren = 0;
  50674. var lastFilterIndex = 0;
  50675. var c, prev, i, expression, filters;
  50676. for (i = 0; i < exp.length; i++) {
  50677. prev = c;
  50678. c = exp.charCodeAt(i);
  50679. if (inSingle) {
  50680. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  50681. } else if (inDouble) {
  50682. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  50683. } else if (inTemplateString) {
  50684. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  50685. } else if (inRegex) {
  50686. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  50687. } else if (
  50688. c === 0x7C && // pipe
  50689. exp.charCodeAt(i + 1) !== 0x7C &&
  50690. exp.charCodeAt(i - 1) !== 0x7C &&
  50691. !curly && !square && !paren
  50692. ) {
  50693. if (expression === undefined) {
  50694. // first filter, end of expression
  50695. lastFilterIndex = i + 1;
  50696. expression = exp.slice(0, i).trim();
  50697. } else {
  50698. pushFilter();
  50699. }
  50700. } else {
  50701. switch (c) {
  50702. case 0x22: inDouble = true; break // "
  50703. case 0x27: inSingle = true; break // '
  50704. case 0x60: inTemplateString = true; break // `
  50705. case 0x28: paren++; break // (
  50706. case 0x29: paren--; break // )
  50707. case 0x5B: square++; break // [
  50708. case 0x5D: square--; break // ]
  50709. case 0x7B: curly++; break // {
  50710. case 0x7D: curly--; break // }
  50711. }
  50712. if (c === 0x2f) { // /
  50713. var j = i - 1;
  50714. var p = (void 0);
  50715. // find first non-whitespace prev char
  50716. for (; j >= 0; j--) {
  50717. p = exp.charAt(j);
  50718. if (p !== ' ') { break }
  50719. }
  50720. if (!p || !validDivisionCharRE.test(p)) {
  50721. inRegex = true;
  50722. }
  50723. }
  50724. }
  50725. }
  50726. if (expression === undefined) {
  50727. expression = exp.slice(0, i).trim();
  50728. } else if (lastFilterIndex !== 0) {
  50729. pushFilter();
  50730. }
  50731. function pushFilter () {
  50732. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  50733. lastFilterIndex = i + 1;
  50734. }
  50735. if (filters) {
  50736. for (i = 0; i < filters.length; i++) {
  50737. expression = wrapFilter(expression, filters[i]);
  50738. }
  50739. }
  50740. return expression
  50741. }
  50742. function wrapFilter (exp, filter) {
  50743. var i = filter.indexOf('(');
  50744. if (i < 0) {
  50745. // _f: resolveFilter
  50746. return ("_f(\"" + filter + "\")(" + exp + ")")
  50747. } else {
  50748. var name = filter.slice(0, i);
  50749. var args = filter.slice(i + 1);
  50750. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  50751. }
  50752. }
  50753. /* */
  50754. /* eslint-disable no-unused-vars */
  50755. function baseWarn (msg, range) {
  50756. console.error(("[Vue compiler]: " + msg));
  50757. }
  50758. /* eslint-enable no-unused-vars */
  50759. function pluckModuleFunction (
  50760. modules,
  50761. key
  50762. ) {
  50763. return modules
  50764. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  50765. : []
  50766. }
  50767. function addProp (el, name, value, range, dynamic) {
  50768. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50769. el.plain = false;
  50770. }
  50771. function addAttr (el, name, value, range, dynamic) {
  50772. var attrs = dynamic
  50773. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  50774. : (el.attrs || (el.attrs = []));
  50775. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50776. el.plain = false;
  50777. }
  50778. // add a raw attr (use this in preTransforms)
  50779. function addRawAttr (el, name, value, range) {
  50780. el.attrsMap[name] = value;
  50781. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  50782. }
  50783. function addDirective (
  50784. el,
  50785. name,
  50786. rawName,
  50787. value,
  50788. arg,
  50789. isDynamicArg,
  50790. modifiers,
  50791. range
  50792. ) {
  50793. (el.directives || (el.directives = [])).push(rangeSetItem({
  50794. name: name,
  50795. rawName: rawName,
  50796. value: value,
  50797. arg: arg,
  50798. isDynamicArg: isDynamicArg,
  50799. modifiers: modifiers
  50800. }, range));
  50801. el.plain = false;
  50802. }
  50803. function prependModifierMarker (symbol, name, dynamic) {
  50804. return dynamic
  50805. ? ("_p(" + name + ",\"" + symbol + "\")")
  50806. : symbol + name // mark the event as captured
  50807. }
  50808. function addHandler (
  50809. el,
  50810. name,
  50811. value,
  50812. modifiers,
  50813. important,
  50814. warn,
  50815. range,
  50816. dynamic
  50817. ) {
  50818. modifiers = modifiers || emptyObject;
  50819. // warn prevent and passive modifier
  50820. /* istanbul ignore if */
  50821. if (
  50822. warn &&
  50823. modifiers.prevent && modifiers.passive
  50824. ) {
  50825. warn(
  50826. 'passive and prevent can\'t be used together. ' +
  50827. 'Passive handler can\'t prevent default event.',
  50828. range
  50829. );
  50830. }
  50831. // normalize click.right and click.middle since they don't actually fire
  50832. // this is technically browser-specific, but at least for now browsers are
  50833. // the only target envs that have right/middle clicks.
  50834. if (modifiers.right) {
  50835. if (dynamic) {
  50836. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  50837. } else if (name === 'click') {
  50838. name = 'contextmenu';
  50839. delete modifiers.right;
  50840. }
  50841. } else if (modifiers.middle) {
  50842. if (dynamic) {
  50843. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  50844. } else if (name === 'click') {
  50845. name = 'mouseup';
  50846. }
  50847. }
  50848. // check capture modifier
  50849. if (modifiers.capture) {
  50850. delete modifiers.capture;
  50851. name = prependModifierMarker('!', name, dynamic);
  50852. }
  50853. if (modifiers.once) {
  50854. delete modifiers.once;
  50855. name = prependModifierMarker('~', name, dynamic);
  50856. }
  50857. /* istanbul ignore if */
  50858. if (modifiers.passive) {
  50859. delete modifiers.passive;
  50860. name = prependModifierMarker('&', name, dynamic);
  50861. }
  50862. var events;
  50863. if (modifiers.native) {
  50864. delete modifiers.native;
  50865. events = el.nativeEvents || (el.nativeEvents = {});
  50866. } else {
  50867. events = el.events || (el.events = {});
  50868. }
  50869. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  50870. if (modifiers !== emptyObject) {
  50871. newHandler.modifiers = modifiers;
  50872. }
  50873. var handlers = events[name];
  50874. /* istanbul ignore if */
  50875. if (Array.isArray(handlers)) {
  50876. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  50877. } else if (handlers) {
  50878. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  50879. } else {
  50880. events[name] = newHandler;
  50881. }
  50882. el.plain = false;
  50883. }
  50884. function getRawBindingAttr (
  50885. el,
  50886. name
  50887. ) {
  50888. return el.rawAttrsMap[':' + name] ||
  50889. el.rawAttrsMap['v-bind:' + name] ||
  50890. el.rawAttrsMap[name]
  50891. }
  50892. function getBindingAttr (
  50893. el,
  50894. name,
  50895. getStatic
  50896. ) {
  50897. var dynamicValue =
  50898. getAndRemoveAttr(el, ':' + name) ||
  50899. getAndRemoveAttr(el, 'v-bind:' + name);
  50900. if (dynamicValue != null) {
  50901. return parseFilters(dynamicValue)
  50902. } else if (getStatic !== false) {
  50903. var staticValue = getAndRemoveAttr(el, name);
  50904. if (staticValue != null) {
  50905. return JSON.stringify(staticValue)
  50906. }
  50907. }
  50908. }
  50909. // note: this only removes the attr from the Array (attrsList) so that it
  50910. // doesn't get processed by processAttrs.
  50911. // By default it does NOT remove it from the map (attrsMap) because the map is
  50912. // needed during codegen.
  50913. function getAndRemoveAttr (
  50914. el,
  50915. name,
  50916. removeFromMap
  50917. ) {
  50918. var val;
  50919. if ((val = el.attrsMap[name]) != null) {
  50920. var list = el.attrsList;
  50921. for (var i = 0, l = list.length; i < l; i++) {
  50922. if (list[i].name === name) {
  50923. list.splice(i, 1);
  50924. break
  50925. }
  50926. }
  50927. }
  50928. if (removeFromMap) {
  50929. delete el.attrsMap[name];
  50930. }
  50931. return val
  50932. }
  50933. function getAndRemoveAttrByRegex (
  50934. el,
  50935. name
  50936. ) {
  50937. var list = el.attrsList;
  50938. for (var i = 0, l = list.length; i < l; i++) {
  50939. var attr = list[i];
  50940. if (name.test(attr.name)) {
  50941. list.splice(i, 1);
  50942. return attr
  50943. }
  50944. }
  50945. }
  50946. function rangeSetItem (
  50947. item,
  50948. range
  50949. ) {
  50950. if (range) {
  50951. if (range.start != null) {
  50952. item.start = range.start;
  50953. }
  50954. if (range.end != null) {
  50955. item.end = range.end;
  50956. }
  50957. }
  50958. return item
  50959. }
  50960. /* */
  50961. /**
  50962. * Cross-platform code generation for component v-model
  50963. */
  50964. function genComponentModel (
  50965. el,
  50966. value,
  50967. modifiers
  50968. ) {
  50969. var ref = modifiers || {};
  50970. var number = ref.number;
  50971. var trim = ref.trim;
  50972. var baseValueExpression = '$$v';
  50973. var valueExpression = baseValueExpression;
  50974. if (trim) {
  50975. valueExpression =
  50976. "(typeof " + baseValueExpression + " === 'string'" +
  50977. "? " + baseValueExpression + ".trim()" +
  50978. ": " + baseValueExpression + ")";
  50979. }
  50980. if (number) {
  50981. valueExpression = "_n(" + valueExpression + ")";
  50982. }
  50983. var assignment = genAssignmentCode(value, valueExpression);
  50984. el.model = {
  50985. value: ("(" + value + ")"),
  50986. expression: JSON.stringify(value),
  50987. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  50988. };
  50989. }
  50990. /**
  50991. * Cross-platform codegen helper for generating v-model value assignment code.
  50992. */
  50993. function genAssignmentCode (
  50994. value,
  50995. assignment
  50996. ) {
  50997. var res = parseModel(value);
  50998. if (res.key === null) {
  50999. return (value + "=" + assignment)
  51000. } else {
  51001. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  51002. }
  51003. }
  51004. /**
  51005. * Parse a v-model expression into a base path and a final key segment.
  51006. * Handles both dot-path and possible square brackets.
  51007. *
  51008. * Possible cases:
  51009. *
  51010. * - test
  51011. * - test[key]
  51012. * - test[test1[key]]
  51013. * - test["a"][key]
  51014. * - xxx.test[a[a].test1[key]]
  51015. * - test.xxx.a["asa"][test1[key]]
  51016. *
  51017. */
  51018. var len, str, chr, index$1, expressionPos, expressionEndPos;
  51019. function parseModel (val) {
  51020. // Fix https://github.com/vuejs/vue/pull/7730
  51021. // allow v-model="obj.val " (trailing whitespace)
  51022. val = val.trim();
  51023. len = val.length;
  51024. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  51025. index$1 = val.lastIndexOf('.');
  51026. if (index$1 > -1) {
  51027. return {
  51028. exp: val.slice(0, index$1),
  51029. key: '"' + val.slice(index$1 + 1) + '"'
  51030. }
  51031. } else {
  51032. return {
  51033. exp: val,
  51034. key: null
  51035. }
  51036. }
  51037. }
  51038. str = val;
  51039. index$1 = expressionPos = expressionEndPos = 0;
  51040. while (!eof()) {
  51041. chr = next();
  51042. /* istanbul ignore if */
  51043. if (isStringStart(chr)) {
  51044. parseString(chr);
  51045. } else if (chr === 0x5B) {
  51046. parseBracket(chr);
  51047. }
  51048. }
  51049. return {
  51050. exp: val.slice(0, expressionPos),
  51051. key: val.slice(expressionPos + 1, expressionEndPos)
  51052. }
  51053. }
  51054. function next () {
  51055. return str.charCodeAt(++index$1)
  51056. }
  51057. function eof () {
  51058. return index$1 >= len
  51059. }
  51060. function isStringStart (chr) {
  51061. return chr === 0x22 || chr === 0x27
  51062. }
  51063. function parseBracket (chr) {
  51064. var inBracket = 1;
  51065. expressionPos = index$1;
  51066. while (!eof()) {
  51067. chr = next();
  51068. if (isStringStart(chr)) {
  51069. parseString(chr);
  51070. continue
  51071. }
  51072. if (chr === 0x5B) { inBracket++; }
  51073. if (chr === 0x5D) { inBracket--; }
  51074. if (inBracket === 0) {
  51075. expressionEndPos = index$1;
  51076. break
  51077. }
  51078. }
  51079. }
  51080. function parseString (chr) {
  51081. var stringQuote = chr;
  51082. while (!eof()) {
  51083. chr = next();
  51084. if (chr === stringQuote) {
  51085. break
  51086. }
  51087. }
  51088. }
  51089. /* */
  51090. var warn$1;
  51091. // in some cases, the event used has to be determined at runtime
  51092. // so we used some reserved tokens during compile.
  51093. var RANGE_TOKEN = '__r';
  51094. var CHECKBOX_RADIO_TOKEN = '__c';
  51095. function model (
  51096. el,
  51097. dir,
  51098. _warn
  51099. ) {
  51100. warn$1 = _warn;
  51101. var value = dir.value;
  51102. var modifiers = dir.modifiers;
  51103. var tag = el.tag;
  51104. var type = el.attrsMap.type;
  51105. {
  51106. // inputs with type="file" are read only and setting the input's
  51107. // value will throw an error.
  51108. if (tag === 'input' && type === 'file') {
  51109. warn$1(
  51110. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  51111. "File inputs are read only. Use a v-on:change listener instead.",
  51112. el.rawAttrsMap['v-model']
  51113. );
  51114. }
  51115. }
  51116. if (el.component) {
  51117. genComponentModel(el, value, modifiers);
  51118. // component v-model doesn't need extra runtime
  51119. return false
  51120. } else if (tag === 'select') {
  51121. genSelect(el, value, modifiers);
  51122. } else if (tag === 'input' && type === 'checkbox') {
  51123. genCheckboxModel(el, value, modifiers);
  51124. } else if (tag === 'input' && type === 'radio') {
  51125. genRadioModel(el, value, modifiers);
  51126. } else if (tag === 'input' || tag === 'textarea') {
  51127. genDefaultModel(el, value, modifiers);
  51128. } else if (!config.isReservedTag(tag)) {
  51129. genComponentModel(el, value, modifiers);
  51130. // component v-model doesn't need extra runtime
  51131. return false
  51132. } else {
  51133. warn$1(
  51134. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  51135. "v-model is not supported on this element type. " +
  51136. 'If you are working with contenteditable, it\'s recommended to ' +
  51137. 'wrap a library dedicated for that purpose inside a custom component.',
  51138. el.rawAttrsMap['v-model']
  51139. );
  51140. }
  51141. // ensure runtime directive metadata
  51142. return true
  51143. }
  51144. function genCheckboxModel (
  51145. el,
  51146. value,
  51147. modifiers
  51148. ) {
  51149. var number = modifiers && modifiers.number;
  51150. var valueBinding = getBindingAttr(el, 'value') || 'null';
  51151. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  51152. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  51153. addProp(el, 'checked',
  51154. "Array.isArray(" + value + ")" +
  51155. "?_i(" + value + "," + valueBinding + ")>-1" + (
  51156. trueValueBinding === 'true'
  51157. ? (":(" + value + ")")
  51158. : (":_q(" + value + "," + trueValueBinding + ")")
  51159. )
  51160. );
  51161. addHandler(el, 'change',
  51162. "var $$a=" + value + "," +
  51163. '$$el=$event.target,' +
  51164. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  51165. 'if(Array.isArray($$a)){' +
  51166. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  51167. '$$i=_i($$a,$$v);' +
  51168. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  51169. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  51170. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  51171. null, true
  51172. );
  51173. }
  51174. function genRadioModel (
  51175. el,
  51176. value,
  51177. modifiers
  51178. ) {
  51179. var number = modifiers && modifiers.number;
  51180. var valueBinding = getBindingAttr(el, 'value') || 'null';
  51181. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  51182. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  51183. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  51184. }
  51185. function genSelect (
  51186. el,
  51187. value,
  51188. modifiers
  51189. ) {
  51190. var number = modifiers && modifiers.number;
  51191. var selectedVal = "Array.prototype.filter" +
  51192. ".call($event.target.options,function(o){return o.selected})" +
  51193. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  51194. "return " + (number ? '_n(val)' : 'val') + "})";
  51195. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  51196. var code = "var $$selectedVal = " + selectedVal + ";";
  51197. code = code + " " + (genAssignmentCode(value, assignment));
  51198. addHandler(el, 'change', code, null, true);
  51199. }
  51200. function genDefaultModel (
  51201. el,
  51202. value,
  51203. modifiers
  51204. ) {
  51205. var type = el.attrsMap.type;
  51206. // warn if v-bind:value conflicts with v-model
  51207. // except for inputs with v-bind:type
  51208. {
  51209. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  51210. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  51211. if (value$1 && !typeBinding) {
  51212. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  51213. warn$1(
  51214. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  51215. 'because the latter already expands to a value binding internally',
  51216. el.rawAttrsMap[binding]
  51217. );
  51218. }
  51219. }
  51220. var ref = modifiers || {};
  51221. var lazy = ref.lazy;
  51222. var number = ref.number;
  51223. var trim = ref.trim;
  51224. var needCompositionGuard = !lazy && type !== 'range';
  51225. var event = lazy
  51226. ? 'change'
  51227. : type === 'range'
  51228. ? RANGE_TOKEN
  51229. : 'input';
  51230. var valueExpression = '$event.target.value';
  51231. if (trim) {
  51232. valueExpression = "$event.target.value.trim()";
  51233. }
  51234. if (number) {
  51235. valueExpression = "_n(" + valueExpression + ")";
  51236. }
  51237. var code = genAssignmentCode(value, valueExpression);
  51238. if (needCompositionGuard) {
  51239. code = "if($event.target.composing)return;" + code;
  51240. }
  51241. addProp(el, 'value', ("(" + value + ")"));
  51242. addHandler(el, event, code, null, true);
  51243. if (trim || number) {
  51244. addHandler(el, 'blur', '$forceUpdate()');
  51245. }
  51246. }
  51247. /* */
  51248. // normalize v-model event tokens that can only be determined at runtime.
  51249. // it's important to place the event as the first in the array because
  51250. // the whole point is ensuring the v-model callback gets called before
  51251. // user-attached handlers.
  51252. function normalizeEvents (on) {
  51253. /* istanbul ignore if */
  51254. if (isDef(on[RANGE_TOKEN])) {
  51255. // IE input[type=range] only supports `change` event
  51256. var event = isIE ? 'change' : 'input';
  51257. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  51258. delete on[RANGE_TOKEN];
  51259. }
  51260. // This was originally intended to fix #4521 but no longer necessary
  51261. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  51262. /* istanbul ignore if */
  51263. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  51264. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  51265. delete on[CHECKBOX_RADIO_TOKEN];
  51266. }
  51267. }
  51268. var target$1;
  51269. function createOnceHandler$1 (event, handler, capture) {
  51270. var _target = target$1; // save current target element in closure
  51271. return function onceHandler () {
  51272. var res = handler.apply(null, arguments);
  51273. if (res !== null) {
  51274. remove$2(event, onceHandler, capture, _target);
  51275. }
  51276. }
  51277. }
  51278. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  51279. // implementation and does not fire microtasks in between event propagation, so
  51280. // safe to exclude.
  51281. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  51282. function add$1 (
  51283. name,
  51284. handler,
  51285. capture,
  51286. passive
  51287. ) {
  51288. // async edge case #6566: inner click event triggers patch, event handler
  51289. // attached to outer element during patch, and triggered again. This
  51290. // happens because browsers fire microtask ticks between event propagation.
  51291. // the solution is simple: we save the timestamp when a handler is attached,
  51292. // and the handler would only fire if the event passed to it was fired
  51293. // AFTER it was attached.
  51294. if (useMicrotaskFix) {
  51295. var attachedTimestamp = currentFlushTimestamp;
  51296. var original = handler;
  51297. handler = original._wrapper = function (e) {
  51298. if (
  51299. // no bubbling, should always fire.
  51300. // this is just a safety net in case event.timeStamp is unreliable in
  51301. // certain weird environments...
  51302. e.target === e.currentTarget ||
  51303. // event is fired after handler attachment
  51304. e.timeStamp >= attachedTimestamp ||
  51305. // bail for environments that have buggy event.timeStamp implementations
  51306. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  51307. // #9681 QtWebEngine event.timeStamp is negative value
  51308. e.timeStamp <= 0 ||
  51309. // #9448 bail if event is fired in another document in a multi-page
  51310. // electron/nw.js app, since event.timeStamp will be using a different
  51311. // starting reference
  51312. e.target.ownerDocument !== document
  51313. ) {
  51314. return original.apply(this, arguments)
  51315. }
  51316. };
  51317. }
  51318. target$1.addEventListener(
  51319. name,
  51320. handler,
  51321. supportsPassive
  51322. ? { capture: capture, passive: passive }
  51323. : capture
  51324. );
  51325. }
  51326. function remove$2 (
  51327. name,
  51328. handler,
  51329. capture,
  51330. _target
  51331. ) {
  51332. (_target || target$1).removeEventListener(
  51333. name,
  51334. handler._wrapper || handler,
  51335. capture
  51336. );
  51337. }
  51338. function updateDOMListeners (oldVnode, vnode) {
  51339. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  51340. return
  51341. }
  51342. var on = vnode.data.on || {};
  51343. var oldOn = oldVnode.data.on || {};
  51344. target$1 = vnode.elm;
  51345. normalizeEvents(on);
  51346. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  51347. target$1 = undefined;
  51348. }
  51349. var events = {
  51350. create: updateDOMListeners,
  51351. update: updateDOMListeners
  51352. };
  51353. /* */
  51354. var svgContainer;
  51355. function updateDOMProps (oldVnode, vnode) {
  51356. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  51357. return
  51358. }
  51359. var key, cur;
  51360. var elm = vnode.elm;
  51361. var oldProps = oldVnode.data.domProps || {};
  51362. var props = vnode.data.domProps || {};
  51363. // clone observed objects, as the user probably wants to mutate it
  51364. if (isDef(props.__ob__)) {
  51365. props = vnode.data.domProps = extend({}, props);
  51366. }
  51367. for (key in oldProps) {
  51368. if (!(key in props)) {
  51369. elm[key] = '';
  51370. }
  51371. }
  51372. for (key in props) {
  51373. cur = props[key];
  51374. // ignore children if the node has textContent or innerHTML,
  51375. // as these will throw away existing DOM nodes and cause removal errors
  51376. // on subsequent patches (#3360)
  51377. if (key === 'textContent' || key === 'innerHTML') {
  51378. if (vnode.children) { vnode.children.length = 0; }
  51379. if (cur === oldProps[key]) { continue }
  51380. // #6601 work around Chrome version <= 55 bug where single textNode
  51381. // replaced by innerHTML/textContent retains its parentNode property
  51382. if (elm.childNodes.length === 1) {
  51383. elm.removeChild(elm.childNodes[0]);
  51384. }
  51385. }
  51386. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  51387. // store value as _value as well since
  51388. // non-string values will be stringified
  51389. elm._value = cur;
  51390. // avoid resetting cursor position when value is the same
  51391. var strCur = isUndef(cur) ? '' : String(cur);
  51392. if (shouldUpdateValue(elm, strCur)) {
  51393. elm.value = strCur;
  51394. }
  51395. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  51396. // IE doesn't support innerHTML for SVG elements
  51397. svgContainer = svgContainer || document.createElement('div');
  51398. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  51399. var svg = svgContainer.firstChild;
  51400. while (elm.firstChild) {
  51401. elm.removeChild(elm.firstChild);
  51402. }
  51403. while (svg.firstChild) {
  51404. elm.appendChild(svg.firstChild);
  51405. }
  51406. } else if (
  51407. // skip the update if old and new VDOM state is the same.
  51408. // `value` is handled separately because the DOM value may be temporarily
  51409. // out of sync with VDOM state due to focus, composition and modifiers.
  51410. // This #4521 by skipping the unnecesarry `checked` update.
  51411. cur !== oldProps[key]
  51412. ) {
  51413. // some property updates can throw
  51414. // e.g. `value` on <progress> w/ non-finite value
  51415. try {
  51416. elm[key] = cur;
  51417. } catch (e) {}
  51418. }
  51419. }
  51420. }
  51421. // check platforms/web/util/attrs.js acceptValue
  51422. function shouldUpdateValue (elm, checkVal) {
  51423. return (!elm.composing && (
  51424. elm.tagName === 'OPTION' ||
  51425. isNotInFocusAndDirty(elm, checkVal) ||
  51426. isDirtyWithModifiers(elm, checkVal)
  51427. ))
  51428. }
  51429. function isNotInFocusAndDirty (elm, checkVal) {
  51430. // return true when textbox (.number and .trim) loses focus and its value is
  51431. // not equal to the updated value
  51432. var notInFocus = true;
  51433. // #6157
  51434. // work around IE bug when accessing document.activeElement in an iframe
  51435. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  51436. return notInFocus && elm.value !== checkVal
  51437. }
  51438. function isDirtyWithModifiers (elm, newVal) {
  51439. var value = elm.value;
  51440. var modifiers = elm._vModifiers; // injected by v-model runtime
  51441. if (isDef(modifiers)) {
  51442. if (modifiers.number) {
  51443. return toNumber(value) !== toNumber(newVal)
  51444. }
  51445. if (modifiers.trim) {
  51446. return value.trim() !== newVal.trim()
  51447. }
  51448. }
  51449. return value !== newVal
  51450. }
  51451. var domProps = {
  51452. create: updateDOMProps,
  51453. update: updateDOMProps
  51454. };
  51455. /* */
  51456. var parseStyleText = cached(function (cssText) {
  51457. var res = {};
  51458. var listDelimiter = /;(?![^(]*\))/g;
  51459. var propertyDelimiter = /:(.+)/;
  51460. cssText.split(listDelimiter).forEach(function (item) {
  51461. if (item) {
  51462. var tmp = item.split(propertyDelimiter);
  51463. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  51464. }
  51465. });
  51466. return res
  51467. });
  51468. // merge static and dynamic style data on the same vnode
  51469. function normalizeStyleData (data) {
  51470. var style = normalizeStyleBinding(data.style);
  51471. // static style is pre-processed into an object during compilation
  51472. // and is always a fresh object, so it's safe to merge into it
  51473. return data.staticStyle
  51474. ? extend(data.staticStyle, style)
  51475. : style
  51476. }
  51477. // normalize possible array / string values into Object
  51478. function normalizeStyleBinding (bindingStyle) {
  51479. if (Array.isArray(bindingStyle)) {
  51480. return toObject(bindingStyle)
  51481. }
  51482. if (typeof bindingStyle === 'string') {
  51483. return parseStyleText(bindingStyle)
  51484. }
  51485. return bindingStyle
  51486. }
  51487. /**
  51488. * parent component style should be after child's
  51489. * so that parent component's style could override it
  51490. */
  51491. function getStyle (vnode, checkChild) {
  51492. var res = {};
  51493. var styleData;
  51494. if (checkChild) {
  51495. var childNode = vnode;
  51496. while (childNode.componentInstance) {
  51497. childNode = childNode.componentInstance._vnode;
  51498. if (
  51499. childNode && childNode.data &&
  51500. (styleData = normalizeStyleData(childNode.data))
  51501. ) {
  51502. extend(res, styleData);
  51503. }
  51504. }
  51505. }
  51506. if ((styleData = normalizeStyleData(vnode.data))) {
  51507. extend(res, styleData);
  51508. }
  51509. var parentNode = vnode;
  51510. while ((parentNode = parentNode.parent)) {
  51511. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  51512. extend(res, styleData);
  51513. }
  51514. }
  51515. return res
  51516. }
  51517. /* */
  51518. var cssVarRE = /^--/;
  51519. var importantRE = /\s*!important$/;
  51520. var setProp = function (el, name, val) {
  51521. /* istanbul ignore if */
  51522. if (cssVarRE.test(name)) {
  51523. el.style.setProperty(name, val);
  51524. } else if (importantRE.test(val)) {
  51525. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  51526. } else {
  51527. var normalizedName = normalize(name);
  51528. if (Array.isArray(val)) {
  51529. // Support values array created by autoprefixer, e.g.
  51530. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  51531. // Set them one by one, and the browser will only set those it can recognize
  51532. for (var i = 0, len = val.length; i < len; i++) {
  51533. el.style[normalizedName] = val[i];
  51534. }
  51535. } else {
  51536. el.style[normalizedName] = val;
  51537. }
  51538. }
  51539. };
  51540. var vendorNames = ['Webkit', 'Moz', 'ms'];
  51541. var emptyStyle;
  51542. var normalize = cached(function (prop) {
  51543. emptyStyle = emptyStyle || document.createElement('div').style;
  51544. prop = camelize(prop);
  51545. if (prop !== 'filter' && (prop in emptyStyle)) {
  51546. return prop
  51547. }
  51548. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  51549. for (var i = 0; i < vendorNames.length; i++) {
  51550. var name = vendorNames[i] + capName;
  51551. if (name in emptyStyle) {
  51552. return name
  51553. }
  51554. }
  51555. });
  51556. function updateStyle (oldVnode, vnode) {
  51557. var data = vnode.data;
  51558. var oldData = oldVnode.data;
  51559. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  51560. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  51561. ) {
  51562. return
  51563. }
  51564. var cur, name;
  51565. var el = vnode.elm;
  51566. var oldStaticStyle = oldData.staticStyle;
  51567. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  51568. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  51569. var oldStyle = oldStaticStyle || oldStyleBinding;
  51570. var style = normalizeStyleBinding(vnode.data.style) || {};
  51571. // store normalized style under a different key for next diff
  51572. // make sure to clone it if it's reactive, since the user likely wants
  51573. // to mutate it.
  51574. vnode.data.normalizedStyle = isDef(style.__ob__)
  51575. ? extend({}, style)
  51576. : style;
  51577. var newStyle = getStyle(vnode, true);
  51578. for (name in oldStyle) {
  51579. if (isUndef(newStyle[name])) {
  51580. setProp(el, name, '');
  51581. }
  51582. }
  51583. for (name in newStyle) {
  51584. cur = newStyle[name];
  51585. if (cur !== oldStyle[name]) {
  51586. // ie9 setting to null has no effect, must use empty string
  51587. setProp(el, name, cur == null ? '' : cur);
  51588. }
  51589. }
  51590. }
  51591. var style = {
  51592. create: updateStyle,
  51593. update: updateStyle
  51594. };
  51595. /* */
  51596. var whitespaceRE = /\s+/;
  51597. /**
  51598. * Add class with compatibility for SVG since classList is not supported on
  51599. * SVG elements in IE
  51600. */
  51601. function addClass (el, cls) {
  51602. /* istanbul ignore if */
  51603. if (!cls || !(cls = cls.trim())) {
  51604. return
  51605. }
  51606. /* istanbul ignore else */
  51607. if (el.classList) {
  51608. if (cls.indexOf(' ') > -1) {
  51609. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  51610. } else {
  51611. el.classList.add(cls);
  51612. }
  51613. } else {
  51614. var cur = " " + (el.getAttribute('class') || '') + " ";
  51615. if (cur.indexOf(' ' + cls + ' ') < 0) {
  51616. el.setAttribute('class', (cur + cls).trim());
  51617. }
  51618. }
  51619. }
  51620. /**
  51621. * Remove class with compatibility for SVG since classList is not supported on
  51622. * SVG elements in IE
  51623. */
  51624. function removeClass (el, cls) {
  51625. /* istanbul ignore if */
  51626. if (!cls || !(cls = cls.trim())) {
  51627. return
  51628. }
  51629. /* istanbul ignore else */
  51630. if (el.classList) {
  51631. if (cls.indexOf(' ') > -1) {
  51632. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  51633. } else {
  51634. el.classList.remove(cls);
  51635. }
  51636. if (!el.classList.length) {
  51637. el.removeAttribute('class');
  51638. }
  51639. } else {
  51640. var cur = " " + (el.getAttribute('class') || '') + " ";
  51641. var tar = ' ' + cls + ' ';
  51642. while (cur.indexOf(tar) >= 0) {
  51643. cur = cur.replace(tar, ' ');
  51644. }
  51645. cur = cur.trim();
  51646. if (cur) {
  51647. el.setAttribute('class', cur);
  51648. } else {
  51649. el.removeAttribute('class');
  51650. }
  51651. }
  51652. }
  51653. /* */
  51654. function resolveTransition (def$$1) {
  51655. if (!def$$1) {
  51656. return
  51657. }
  51658. /* istanbul ignore else */
  51659. if (typeof def$$1 === 'object') {
  51660. var res = {};
  51661. if (def$$1.css !== false) {
  51662. extend(res, autoCssTransition(def$$1.name || 'v'));
  51663. }
  51664. extend(res, def$$1);
  51665. return res
  51666. } else if (typeof def$$1 === 'string') {
  51667. return autoCssTransition(def$$1)
  51668. }
  51669. }
  51670. var autoCssTransition = cached(function (name) {
  51671. return {
  51672. enterClass: (name + "-enter"),
  51673. enterToClass: (name + "-enter-to"),
  51674. enterActiveClass: (name + "-enter-active"),
  51675. leaveClass: (name + "-leave"),
  51676. leaveToClass: (name + "-leave-to"),
  51677. leaveActiveClass: (name + "-leave-active")
  51678. }
  51679. });
  51680. var hasTransition = inBrowser && !isIE9;
  51681. var TRANSITION = 'transition';
  51682. var ANIMATION = 'animation';
  51683. // Transition property/event sniffing
  51684. var transitionProp = 'transition';
  51685. var transitionEndEvent = 'transitionend';
  51686. var animationProp = 'animation';
  51687. var animationEndEvent = 'animationend';
  51688. if (hasTransition) {
  51689. /* istanbul ignore if */
  51690. if (window.ontransitionend === undefined &&
  51691. window.onwebkittransitionend !== undefined
  51692. ) {
  51693. transitionProp = 'WebkitTransition';
  51694. transitionEndEvent = 'webkitTransitionEnd';
  51695. }
  51696. if (window.onanimationend === undefined &&
  51697. window.onwebkitanimationend !== undefined
  51698. ) {
  51699. animationProp = 'WebkitAnimation';
  51700. animationEndEvent = 'webkitAnimationEnd';
  51701. }
  51702. }
  51703. // binding to window is necessary to make hot reload work in IE in strict mode
  51704. var raf = inBrowser
  51705. ? window.requestAnimationFrame
  51706. ? window.requestAnimationFrame.bind(window)
  51707. : setTimeout
  51708. : /* istanbul ignore next */ function (fn) { return fn(); };
  51709. function nextFrame (fn) {
  51710. raf(function () {
  51711. raf(fn);
  51712. });
  51713. }
  51714. function addTransitionClass (el, cls) {
  51715. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  51716. if (transitionClasses.indexOf(cls) < 0) {
  51717. transitionClasses.push(cls);
  51718. addClass(el, cls);
  51719. }
  51720. }
  51721. function removeTransitionClass (el, cls) {
  51722. if (el._transitionClasses) {
  51723. remove(el._transitionClasses, cls);
  51724. }
  51725. removeClass(el, cls);
  51726. }
  51727. function whenTransitionEnds (
  51728. el,
  51729. expectedType,
  51730. cb
  51731. ) {
  51732. var ref = getTransitionInfo(el, expectedType);
  51733. var type = ref.type;
  51734. var timeout = ref.timeout;
  51735. var propCount = ref.propCount;
  51736. if (!type) { return cb() }
  51737. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  51738. var ended = 0;
  51739. var end = function () {
  51740. el.removeEventListener(event, onEnd);
  51741. cb();
  51742. };
  51743. var onEnd = function (e) {
  51744. if (e.target === el) {
  51745. if (++ended >= propCount) {
  51746. end();
  51747. }
  51748. }
  51749. };
  51750. setTimeout(function () {
  51751. if (ended < propCount) {
  51752. end();
  51753. }
  51754. }, timeout + 1);
  51755. el.addEventListener(event, onEnd);
  51756. }
  51757. var transformRE = /\b(transform|all)(,|$)/;
  51758. function getTransitionInfo (el, expectedType) {
  51759. var styles = window.getComputedStyle(el);
  51760. // JSDOM may return undefined for transition properties
  51761. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  51762. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  51763. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  51764. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  51765. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  51766. var animationTimeout = getTimeout(animationDelays, animationDurations);
  51767. var type;
  51768. var timeout = 0;
  51769. var propCount = 0;
  51770. /* istanbul ignore if */
  51771. if (expectedType === TRANSITION) {
  51772. if (transitionTimeout > 0) {
  51773. type = TRANSITION;
  51774. timeout = transitionTimeout;
  51775. propCount = transitionDurations.length;
  51776. }
  51777. } else if (expectedType === ANIMATION) {
  51778. if (animationTimeout > 0) {
  51779. type = ANIMATION;
  51780. timeout = animationTimeout;
  51781. propCount = animationDurations.length;
  51782. }
  51783. } else {
  51784. timeout = Math.max(transitionTimeout, animationTimeout);
  51785. type = timeout > 0
  51786. ? transitionTimeout > animationTimeout
  51787. ? TRANSITION
  51788. : ANIMATION
  51789. : null;
  51790. propCount = type
  51791. ? type === TRANSITION
  51792. ? transitionDurations.length
  51793. : animationDurations.length
  51794. : 0;
  51795. }
  51796. var hasTransform =
  51797. type === TRANSITION &&
  51798. transformRE.test(styles[transitionProp + 'Property']);
  51799. return {
  51800. type: type,
  51801. timeout: timeout,
  51802. propCount: propCount,
  51803. hasTransform: hasTransform
  51804. }
  51805. }
  51806. function getTimeout (delays, durations) {
  51807. /* istanbul ignore next */
  51808. while (delays.length < durations.length) {
  51809. delays = delays.concat(delays);
  51810. }
  51811. return Math.max.apply(null, durations.map(function (d, i) {
  51812. return toMs(d) + toMs(delays[i])
  51813. }))
  51814. }
  51815. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  51816. // in a locale-dependent way, using a comma instead of a dot.
  51817. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  51818. // as a floor function) causing unexpected behaviors
  51819. function toMs (s) {
  51820. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  51821. }
  51822. /* */
  51823. function enter (vnode, toggleDisplay) {
  51824. var el = vnode.elm;
  51825. // call leave callback now
  51826. if (isDef(el._leaveCb)) {
  51827. el._leaveCb.cancelled = true;
  51828. el._leaveCb();
  51829. }
  51830. var data = resolveTransition(vnode.data.transition);
  51831. if (isUndef(data)) {
  51832. return
  51833. }
  51834. /* istanbul ignore if */
  51835. if (isDef(el._enterCb) || el.nodeType !== 1) {
  51836. return
  51837. }
  51838. var css = data.css;
  51839. var type = data.type;
  51840. var enterClass = data.enterClass;
  51841. var enterToClass = data.enterToClass;
  51842. var enterActiveClass = data.enterActiveClass;
  51843. var appearClass = data.appearClass;
  51844. var appearToClass = data.appearToClass;
  51845. var appearActiveClass = data.appearActiveClass;
  51846. var beforeEnter = data.beforeEnter;
  51847. var enter = data.enter;
  51848. var afterEnter = data.afterEnter;
  51849. var enterCancelled = data.enterCancelled;
  51850. var beforeAppear = data.beforeAppear;
  51851. var appear = data.appear;
  51852. var afterAppear = data.afterAppear;
  51853. var appearCancelled = data.appearCancelled;
  51854. var duration = data.duration;
  51855. // activeInstance will always be the <transition> component managing this
  51856. // transition. One edge case to check is when the <transition> is placed
  51857. // as the root node of a child component. In that case we need to check
  51858. // <transition>'s parent for appear check.
  51859. var context = activeInstance;
  51860. var transitionNode = activeInstance.$vnode;
  51861. while (transitionNode && transitionNode.parent) {
  51862. context = transitionNode.context;
  51863. transitionNode = transitionNode.parent;
  51864. }
  51865. var isAppear = !context._isMounted || !vnode.isRootInsert;
  51866. if (isAppear && !appear && appear !== '') {
  51867. return
  51868. }
  51869. var startClass = isAppear && appearClass
  51870. ? appearClass
  51871. : enterClass;
  51872. var activeClass = isAppear && appearActiveClass
  51873. ? appearActiveClass
  51874. : enterActiveClass;
  51875. var toClass = isAppear && appearToClass
  51876. ? appearToClass
  51877. : enterToClass;
  51878. var beforeEnterHook = isAppear
  51879. ? (beforeAppear || beforeEnter)
  51880. : beforeEnter;
  51881. var enterHook = isAppear
  51882. ? (typeof appear === 'function' ? appear : enter)
  51883. : enter;
  51884. var afterEnterHook = isAppear
  51885. ? (afterAppear || afterEnter)
  51886. : afterEnter;
  51887. var enterCancelledHook = isAppear
  51888. ? (appearCancelled || enterCancelled)
  51889. : enterCancelled;
  51890. var explicitEnterDuration = toNumber(
  51891. isObject(duration)
  51892. ? duration.enter
  51893. : duration
  51894. );
  51895. if (explicitEnterDuration != null) {
  51896. checkDuration(explicitEnterDuration, 'enter', vnode);
  51897. }
  51898. var expectsCSS = css !== false && !isIE9;
  51899. var userWantsControl = getHookArgumentsLength(enterHook);
  51900. var cb = el._enterCb = once(function () {
  51901. if (expectsCSS) {
  51902. removeTransitionClass(el, toClass);
  51903. removeTransitionClass(el, activeClass);
  51904. }
  51905. if (cb.cancelled) {
  51906. if (expectsCSS) {
  51907. removeTransitionClass(el, startClass);
  51908. }
  51909. enterCancelledHook && enterCancelledHook(el);
  51910. } else {
  51911. afterEnterHook && afterEnterHook(el);
  51912. }
  51913. el._enterCb = null;
  51914. });
  51915. if (!vnode.data.show) {
  51916. // remove pending leave element on enter by injecting an insert hook
  51917. mergeVNodeHook(vnode, 'insert', function () {
  51918. var parent = el.parentNode;
  51919. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  51920. if (pendingNode &&
  51921. pendingNode.tag === vnode.tag &&
  51922. pendingNode.elm._leaveCb
  51923. ) {
  51924. pendingNode.elm._leaveCb();
  51925. }
  51926. enterHook && enterHook(el, cb);
  51927. });
  51928. }
  51929. // start enter transition
  51930. beforeEnterHook && beforeEnterHook(el);
  51931. if (expectsCSS) {
  51932. addTransitionClass(el, startClass);
  51933. addTransitionClass(el, activeClass);
  51934. nextFrame(function () {
  51935. removeTransitionClass(el, startClass);
  51936. if (!cb.cancelled) {
  51937. addTransitionClass(el, toClass);
  51938. if (!userWantsControl) {
  51939. if (isValidDuration(explicitEnterDuration)) {
  51940. setTimeout(cb, explicitEnterDuration);
  51941. } else {
  51942. whenTransitionEnds(el, type, cb);
  51943. }
  51944. }
  51945. }
  51946. });
  51947. }
  51948. if (vnode.data.show) {
  51949. toggleDisplay && toggleDisplay();
  51950. enterHook && enterHook(el, cb);
  51951. }
  51952. if (!expectsCSS && !userWantsControl) {
  51953. cb();
  51954. }
  51955. }
  51956. function leave (vnode, rm) {
  51957. var el = vnode.elm;
  51958. // call enter callback now
  51959. if (isDef(el._enterCb)) {
  51960. el._enterCb.cancelled = true;
  51961. el._enterCb();
  51962. }
  51963. var data = resolveTransition(vnode.data.transition);
  51964. if (isUndef(data) || el.nodeType !== 1) {
  51965. return rm()
  51966. }
  51967. /* istanbul ignore if */
  51968. if (isDef(el._leaveCb)) {
  51969. return
  51970. }
  51971. var css = data.css;
  51972. var type = data.type;
  51973. var leaveClass = data.leaveClass;
  51974. var leaveToClass = data.leaveToClass;
  51975. var leaveActiveClass = data.leaveActiveClass;
  51976. var beforeLeave = data.beforeLeave;
  51977. var leave = data.leave;
  51978. var afterLeave = data.afterLeave;
  51979. var leaveCancelled = data.leaveCancelled;
  51980. var delayLeave = data.delayLeave;
  51981. var duration = data.duration;
  51982. var expectsCSS = css !== false && !isIE9;
  51983. var userWantsControl = getHookArgumentsLength(leave);
  51984. var explicitLeaveDuration = toNumber(
  51985. isObject(duration)
  51986. ? duration.leave
  51987. : duration
  51988. );
  51989. if (isDef(explicitLeaveDuration)) {
  51990. checkDuration(explicitLeaveDuration, 'leave', vnode);
  51991. }
  51992. var cb = el._leaveCb = once(function () {
  51993. if (el.parentNode && el.parentNode._pending) {
  51994. el.parentNode._pending[vnode.key] = null;
  51995. }
  51996. if (expectsCSS) {
  51997. removeTransitionClass(el, leaveToClass);
  51998. removeTransitionClass(el, leaveActiveClass);
  51999. }
  52000. if (cb.cancelled) {
  52001. if (expectsCSS) {
  52002. removeTransitionClass(el, leaveClass);
  52003. }
  52004. leaveCancelled && leaveCancelled(el);
  52005. } else {
  52006. rm();
  52007. afterLeave && afterLeave(el);
  52008. }
  52009. el._leaveCb = null;
  52010. });
  52011. if (delayLeave) {
  52012. delayLeave(performLeave);
  52013. } else {
  52014. performLeave();
  52015. }
  52016. function performLeave () {
  52017. // the delayed leave may have already been cancelled
  52018. if (cb.cancelled) {
  52019. return
  52020. }
  52021. // record leaving element
  52022. if (!vnode.data.show && el.parentNode) {
  52023. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  52024. }
  52025. beforeLeave && beforeLeave(el);
  52026. if (expectsCSS) {
  52027. addTransitionClass(el, leaveClass);
  52028. addTransitionClass(el, leaveActiveClass);
  52029. nextFrame(function () {
  52030. removeTransitionClass(el, leaveClass);
  52031. if (!cb.cancelled) {
  52032. addTransitionClass(el, leaveToClass);
  52033. if (!userWantsControl) {
  52034. if (isValidDuration(explicitLeaveDuration)) {
  52035. setTimeout(cb, explicitLeaveDuration);
  52036. } else {
  52037. whenTransitionEnds(el, type, cb);
  52038. }
  52039. }
  52040. }
  52041. });
  52042. }
  52043. leave && leave(el, cb);
  52044. if (!expectsCSS && !userWantsControl) {
  52045. cb();
  52046. }
  52047. }
  52048. }
  52049. // only used in dev mode
  52050. function checkDuration (val, name, vnode) {
  52051. if (typeof val !== 'number') {
  52052. warn(
  52053. "<transition> explicit " + name + " duration is not a valid number - " +
  52054. "got " + (JSON.stringify(val)) + ".",
  52055. vnode.context
  52056. );
  52057. } else if (isNaN(val)) {
  52058. warn(
  52059. "<transition> explicit " + name + " duration is NaN - " +
  52060. 'the duration expression might be incorrect.',
  52061. vnode.context
  52062. );
  52063. }
  52064. }
  52065. function isValidDuration (val) {
  52066. return typeof val === 'number' && !isNaN(val)
  52067. }
  52068. /**
  52069. * Normalize a transition hook's argument length. The hook may be:
  52070. * - a merged hook (invoker) with the original in .fns
  52071. * - a wrapped component method (check ._length)
  52072. * - a plain function (.length)
  52073. */
  52074. function getHookArgumentsLength (fn) {
  52075. if (isUndef(fn)) {
  52076. return false
  52077. }
  52078. var invokerFns = fn.fns;
  52079. if (isDef(invokerFns)) {
  52080. // invoker
  52081. return getHookArgumentsLength(
  52082. Array.isArray(invokerFns)
  52083. ? invokerFns[0]
  52084. : invokerFns
  52085. )
  52086. } else {
  52087. return (fn._length || fn.length) > 1
  52088. }
  52089. }
  52090. function _enter (_, vnode) {
  52091. if (vnode.data.show !== true) {
  52092. enter(vnode);
  52093. }
  52094. }
  52095. var transition = inBrowser ? {
  52096. create: _enter,
  52097. activate: _enter,
  52098. remove: function remove$$1 (vnode, rm) {
  52099. /* istanbul ignore else */
  52100. if (vnode.data.show !== true) {
  52101. leave(vnode, rm);
  52102. } else {
  52103. rm();
  52104. }
  52105. }
  52106. } : {};
  52107. var platformModules = [
  52108. attrs,
  52109. klass,
  52110. events,
  52111. domProps,
  52112. style,
  52113. transition
  52114. ];
  52115. /* */
  52116. // the directive module should be applied last, after all
  52117. // built-in modules have been applied.
  52118. var modules = platformModules.concat(baseModules);
  52119. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  52120. /**
  52121. * Not type checking this file because flow doesn't like attaching
  52122. * properties to Elements.
  52123. */
  52124. /* istanbul ignore if */
  52125. if (isIE9) {
  52126. // http://www.matts411.com/post/internet-explorer-9-oninput/
  52127. document.addEventListener('selectionchange', function () {
  52128. var el = document.activeElement;
  52129. if (el && el.vmodel) {
  52130. trigger(el, 'input');
  52131. }
  52132. });
  52133. }
  52134. var directive = {
  52135. inserted: function inserted (el, binding, vnode, oldVnode) {
  52136. if (vnode.tag === 'select') {
  52137. // #6903
  52138. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  52139. mergeVNodeHook(vnode, 'postpatch', function () {
  52140. directive.componentUpdated(el, binding, vnode);
  52141. });
  52142. } else {
  52143. setSelected(el, binding, vnode.context);
  52144. }
  52145. el._vOptions = [].map.call(el.options, getValue);
  52146. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  52147. el._vModifiers = binding.modifiers;
  52148. if (!binding.modifiers.lazy) {
  52149. el.addEventListener('compositionstart', onCompositionStart);
  52150. el.addEventListener('compositionend', onCompositionEnd);
  52151. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  52152. // switching focus before confirming composition choice
  52153. // this also fixes the issue where some browsers e.g. iOS Chrome
  52154. // fires "change" instead of "input" on autocomplete.
  52155. el.addEventListener('change', onCompositionEnd);
  52156. /* istanbul ignore if */
  52157. if (isIE9) {
  52158. el.vmodel = true;
  52159. }
  52160. }
  52161. }
  52162. },
  52163. componentUpdated: function componentUpdated (el, binding, vnode) {
  52164. if (vnode.tag === 'select') {
  52165. setSelected(el, binding, vnode.context);
  52166. // in case the options rendered by v-for have changed,
  52167. // it's possible that the value is out-of-sync with the rendered options.
  52168. // detect such cases and filter out values that no longer has a matching
  52169. // option in the DOM.
  52170. var prevOptions = el._vOptions;
  52171. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  52172. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  52173. // trigger change event if
  52174. // no matching option found for at least one value
  52175. var needReset = el.multiple
  52176. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  52177. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  52178. if (needReset) {
  52179. trigger(el, 'change');
  52180. }
  52181. }
  52182. }
  52183. }
  52184. };
  52185. function setSelected (el, binding, vm) {
  52186. actuallySetSelected(el, binding, vm);
  52187. /* istanbul ignore if */
  52188. if (isIE || isEdge) {
  52189. setTimeout(function () {
  52190. actuallySetSelected(el, binding, vm);
  52191. }, 0);
  52192. }
  52193. }
  52194. function actuallySetSelected (el, binding, vm) {
  52195. var value = binding.value;
  52196. var isMultiple = el.multiple;
  52197. if (isMultiple && !Array.isArray(value)) {
  52198. warn(
  52199. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  52200. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  52201. vm
  52202. );
  52203. return
  52204. }
  52205. var selected, option;
  52206. for (var i = 0, l = el.options.length; i < l; i++) {
  52207. option = el.options[i];
  52208. if (isMultiple) {
  52209. selected = looseIndexOf(value, getValue(option)) > -1;
  52210. if (option.selected !== selected) {
  52211. option.selected = selected;
  52212. }
  52213. } else {
  52214. if (looseEqual(getValue(option), value)) {
  52215. if (el.selectedIndex !== i) {
  52216. el.selectedIndex = i;
  52217. }
  52218. return
  52219. }
  52220. }
  52221. }
  52222. if (!isMultiple) {
  52223. el.selectedIndex = -1;
  52224. }
  52225. }
  52226. function hasNoMatchingOption (value, options) {
  52227. return options.every(function (o) { return !looseEqual(o, value); })
  52228. }
  52229. function getValue (option) {
  52230. return '_value' in option
  52231. ? option._value
  52232. : option.value
  52233. }
  52234. function onCompositionStart (e) {
  52235. e.target.composing = true;
  52236. }
  52237. function onCompositionEnd (e) {
  52238. // prevent triggering an input event for no reason
  52239. if (!e.target.composing) { return }
  52240. e.target.composing = false;
  52241. trigger(e.target, 'input');
  52242. }
  52243. function trigger (el, type) {
  52244. var e = document.createEvent('HTMLEvents');
  52245. e.initEvent(type, true, true);
  52246. el.dispatchEvent(e);
  52247. }
  52248. /* */
  52249. // recursively search for possible transition defined inside the component root
  52250. function locateNode (vnode) {
  52251. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  52252. ? locateNode(vnode.componentInstance._vnode)
  52253. : vnode
  52254. }
  52255. var show = {
  52256. bind: function bind (el, ref, vnode) {
  52257. var value = ref.value;
  52258. vnode = locateNode(vnode);
  52259. var transition$$1 = vnode.data && vnode.data.transition;
  52260. var originalDisplay = el.__vOriginalDisplay =
  52261. el.style.display === 'none' ? '' : el.style.display;
  52262. if (value && transition$$1) {
  52263. vnode.data.show = true;
  52264. enter(vnode, function () {
  52265. el.style.display = originalDisplay;
  52266. });
  52267. } else {
  52268. el.style.display = value ? originalDisplay : 'none';
  52269. }
  52270. },
  52271. update: function update (el, ref, vnode) {
  52272. var value = ref.value;
  52273. var oldValue = ref.oldValue;
  52274. /* istanbul ignore if */
  52275. if (!value === !oldValue) { return }
  52276. vnode = locateNode(vnode);
  52277. var transition$$1 = vnode.data && vnode.data.transition;
  52278. if (transition$$1) {
  52279. vnode.data.show = true;
  52280. if (value) {
  52281. enter(vnode, function () {
  52282. el.style.display = el.__vOriginalDisplay;
  52283. });
  52284. } else {
  52285. leave(vnode, function () {
  52286. el.style.display = 'none';
  52287. });
  52288. }
  52289. } else {
  52290. el.style.display = value ? el.__vOriginalDisplay : 'none';
  52291. }
  52292. },
  52293. unbind: function unbind (
  52294. el,
  52295. binding,
  52296. vnode,
  52297. oldVnode,
  52298. isDestroy
  52299. ) {
  52300. if (!isDestroy) {
  52301. el.style.display = el.__vOriginalDisplay;
  52302. }
  52303. }
  52304. };
  52305. var platformDirectives = {
  52306. model: directive,
  52307. show: show
  52308. };
  52309. /* */
  52310. var transitionProps = {
  52311. name: String,
  52312. appear: Boolean,
  52313. css: Boolean,
  52314. mode: String,
  52315. type: String,
  52316. enterClass: String,
  52317. leaveClass: String,
  52318. enterToClass: String,
  52319. leaveToClass: String,
  52320. enterActiveClass: String,
  52321. leaveActiveClass: String,
  52322. appearClass: String,
  52323. appearActiveClass: String,
  52324. appearToClass: String,
  52325. duration: [Number, String, Object]
  52326. };
  52327. // in case the child is also an abstract component, e.g. <keep-alive>
  52328. // we want to recursively retrieve the real component to be rendered
  52329. function getRealChild (vnode) {
  52330. var compOptions = vnode && vnode.componentOptions;
  52331. if (compOptions && compOptions.Ctor.options.abstract) {
  52332. return getRealChild(getFirstComponentChild(compOptions.children))
  52333. } else {
  52334. return vnode
  52335. }
  52336. }
  52337. function extractTransitionData (comp) {
  52338. var data = {};
  52339. var options = comp.$options;
  52340. // props
  52341. for (var key in options.propsData) {
  52342. data[key] = comp[key];
  52343. }
  52344. // events.
  52345. // extract listeners and pass them directly to the transition methods
  52346. var listeners = options._parentListeners;
  52347. for (var key$1 in listeners) {
  52348. data[camelize(key$1)] = listeners[key$1];
  52349. }
  52350. return data
  52351. }
  52352. function placeholder (h, rawChild) {
  52353. if (/\d-keep-alive$/.test(rawChild.tag)) {
  52354. return h('keep-alive', {
  52355. props: rawChild.componentOptions.propsData
  52356. })
  52357. }
  52358. }
  52359. function hasParentTransition (vnode) {
  52360. while ((vnode = vnode.parent)) {
  52361. if (vnode.data.transition) {
  52362. return true
  52363. }
  52364. }
  52365. }
  52366. function isSameChild (child, oldChild) {
  52367. return oldChild.key === child.key && oldChild.tag === child.tag
  52368. }
  52369. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  52370. var isVShowDirective = function (d) { return d.name === 'show'; };
  52371. var Transition = {
  52372. name: 'transition',
  52373. props: transitionProps,
  52374. abstract: true,
  52375. render: function render (h) {
  52376. var this$1 = this;
  52377. var children = this.$slots.default;
  52378. if (!children) {
  52379. return
  52380. }
  52381. // filter out text nodes (possible whitespaces)
  52382. children = children.filter(isNotTextNode);
  52383. /* istanbul ignore if */
  52384. if (!children.length) {
  52385. return
  52386. }
  52387. // warn multiple elements
  52388. if (children.length > 1) {
  52389. warn(
  52390. '<transition> can only be used on a single element. Use ' +
  52391. '<transition-group> for lists.',
  52392. this.$parent
  52393. );
  52394. }
  52395. var mode = this.mode;
  52396. // warn invalid mode
  52397. if (mode && mode !== 'in-out' && mode !== 'out-in'
  52398. ) {
  52399. warn(
  52400. 'invalid <transition> mode: ' + mode,
  52401. this.$parent
  52402. );
  52403. }
  52404. var rawChild = children[0];
  52405. // if this is a component root node and the component's
  52406. // parent container node also has transition, skip.
  52407. if (hasParentTransition(this.$vnode)) {
  52408. return rawChild
  52409. }
  52410. // apply transition data to child
  52411. // use getRealChild() to ignore abstract components e.g. keep-alive
  52412. var child = getRealChild(rawChild);
  52413. /* istanbul ignore if */
  52414. if (!child) {
  52415. return rawChild
  52416. }
  52417. if (this._leaving) {
  52418. return placeholder(h, rawChild)
  52419. }
  52420. // ensure a key that is unique to the vnode type and to this transition
  52421. // component instance. This key will be used to remove pending leaving nodes
  52422. // during entering.
  52423. var id = "__transition-" + (this._uid) + "-";
  52424. child.key = child.key == null
  52425. ? child.isComment
  52426. ? id + 'comment'
  52427. : id + child.tag
  52428. : isPrimitive(child.key)
  52429. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  52430. : child.key;
  52431. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  52432. var oldRawChild = this._vnode;
  52433. var oldChild = getRealChild(oldRawChild);
  52434. // mark v-show
  52435. // so that the transition module can hand over the control to the directive
  52436. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  52437. child.data.show = true;
  52438. }
  52439. if (
  52440. oldChild &&
  52441. oldChild.data &&
  52442. !isSameChild(child, oldChild) &&
  52443. !isAsyncPlaceholder(oldChild) &&
  52444. // #6687 component root is a comment node
  52445. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  52446. ) {
  52447. // replace old child transition data with fresh one
  52448. // important for dynamic transitions!
  52449. var oldData = oldChild.data.transition = extend({}, data);
  52450. // handle transition mode
  52451. if (mode === 'out-in') {
  52452. // return placeholder node and queue update when leave finishes
  52453. this._leaving = true;
  52454. mergeVNodeHook(oldData, 'afterLeave', function () {
  52455. this$1._leaving = false;
  52456. this$1.$forceUpdate();
  52457. });
  52458. return placeholder(h, rawChild)
  52459. } else if (mode === 'in-out') {
  52460. if (isAsyncPlaceholder(child)) {
  52461. return oldRawChild
  52462. }
  52463. var delayedLeave;
  52464. var performLeave = function () { delayedLeave(); };
  52465. mergeVNodeHook(data, 'afterEnter', performLeave);
  52466. mergeVNodeHook(data, 'enterCancelled', performLeave);
  52467. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  52468. }
  52469. }
  52470. return rawChild
  52471. }
  52472. };
  52473. /* */
  52474. var props = extend({
  52475. tag: String,
  52476. moveClass: String
  52477. }, transitionProps);
  52478. delete props.mode;
  52479. var TransitionGroup = {
  52480. props: props,
  52481. beforeMount: function beforeMount () {
  52482. var this$1 = this;
  52483. var update = this._update;
  52484. this._update = function (vnode, hydrating) {
  52485. var restoreActiveInstance = setActiveInstance(this$1);
  52486. // force removing pass
  52487. this$1.__patch__(
  52488. this$1._vnode,
  52489. this$1.kept,
  52490. false, // hydrating
  52491. true // removeOnly (!important, avoids unnecessary moves)
  52492. );
  52493. this$1._vnode = this$1.kept;
  52494. restoreActiveInstance();
  52495. update.call(this$1, vnode, hydrating);
  52496. };
  52497. },
  52498. render: function render (h) {
  52499. var tag = this.tag || this.$vnode.data.tag || 'span';
  52500. var map = Object.create(null);
  52501. var prevChildren = this.prevChildren = this.children;
  52502. var rawChildren = this.$slots.default || [];
  52503. var children = this.children = [];
  52504. var transitionData = extractTransitionData(this);
  52505. for (var i = 0; i < rawChildren.length; i++) {
  52506. var c = rawChildren[i];
  52507. if (c.tag) {
  52508. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  52509. children.push(c);
  52510. map[c.key] = c
  52511. ;(c.data || (c.data = {})).transition = transitionData;
  52512. } else {
  52513. var opts = c.componentOptions;
  52514. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  52515. warn(("<transition-group> children must be keyed: <" + name + ">"));
  52516. }
  52517. }
  52518. }
  52519. if (prevChildren) {
  52520. var kept = [];
  52521. var removed = [];
  52522. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  52523. var c$1 = prevChildren[i$1];
  52524. c$1.data.transition = transitionData;
  52525. c$1.data.pos = c$1.elm.getBoundingClientRect();
  52526. if (map[c$1.key]) {
  52527. kept.push(c$1);
  52528. } else {
  52529. removed.push(c$1);
  52530. }
  52531. }
  52532. this.kept = h(tag, null, kept);
  52533. this.removed = removed;
  52534. }
  52535. return h(tag, null, children)
  52536. },
  52537. updated: function updated () {
  52538. var children = this.prevChildren;
  52539. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  52540. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  52541. return
  52542. }
  52543. // we divide the work into three loops to avoid mixing DOM reads and writes
  52544. // in each iteration - which helps prevent layout thrashing.
  52545. children.forEach(callPendingCbs);
  52546. children.forEach(recordPosition);
  52547. children.forEach(applyTranslation);
  52548. // force reflow to put everything in position
  52549. // assign to this to avoid being removed in tree-shaking
  52550. // $flow-disable-line
  52551. this._reflow = document.body.offsetHeight;
  52552. children.forEach(function (c) {
  52553. if (c.data.moved) {
  52554. var el = c.elm;
  52555. var s = el.style;
  52556. addTransitionClass(el, moveClass);
  52557. s.transform = s.WebkitTransform = s.transitionDuration = '';
  52558. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  52559. if (e && e.target !== el) {
  52560. return
  52561. }
  52562. if (!e || /transform$/.test(e.propertyName)) {
  52563. el.removeEventListener(transitionEndEvent, cb);
  52564. el._moveCb = null;
  52565. removeTransitionClass(el, moveClass);
  52566. }
  52567. });
  52568. }
  52569. });
  52570. },
  52571. methods: {
  52572. hasMove: function hasMove (el, moveClass) {
  52573. /* istanbul ignore if */
  52574. if (!hasTransition) {
  52575. return false
  52576. }
  52577. /* istanbul ignore if */
  52578. if (this._hasMove) {
  52579. return this._hasMove
  52580. }
  52581. // Detect whether an element with the move class applied has
  52582. // CSS transitions. Since the element may be inside an entering
  52583. // transition at this very moment, we make a clone of it and remove
  52584. // all other transition classes applied to ensure only the move class
  52585. // is applied.
  52586. var clone = el.cloneNode();
  52587. if (el._transitionClasses) {
  52588. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  52589. }
  52590. addClass(clone, moveClass);
  52591. clone.style.display = 'none';
  52592. this.$el.appendChild(clone);
  52593. var info = getTransitionInfo(clone);
  52594. this.$el.removeChild(clone);
  52595. return (this._hasMove = info.hasTransform)
  52596. }
  52597. }
  52598. };
  52599. function callPendingCbs (c) {
  52600. /* istanbul ignore if */
  52601. if (c.elm._moveCb) {
  52602. c.elm._moveCb();
  52603. }
  52604. /* istanbul ignore if */
  52605. if (c.elm._enterCb) {
  52606. c.elm._enterCb();
  52607. }
  52608. }
  52609. function recordPosition (c) {
  52610. c.data.newPos = c.elm.getBoundingClientRect();
  52611. }
  52612. function applyTranslation (c) {
  52613. var oldPos = c.data.pos;
  52614. var newPos = c.data.newPos;
  52615. var dx = oldPos.left - newPos.left;
  52616. var dy = oldPos.top - newPos.top;
  52617. if (dx || dy) {
  52618. c.data.moved = true;
  52619. var s = c.elm.style;
  52620. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  52621. s.transitionDuration = '0s';
  52622. }
  52623. }
  52624. var platformComponents = {
  52625. Transition: Transition,
  52626. TransitionGroup: TransitionGroup
  52627. };
  52628. /* */
  52629. // install platform specific utils
  52630. Vue.config.mustUseProp = mustUseProp;
  52631. Vue.config.isReservedTag = isReservedTag;
  52632. Vue.config.isReservedAttr = isReservedAttr;
  52633. Vue.config.getTagNamespace = getTagNamespace;
  52634. Vue.config.isUnknownElement = isUnknownElement;
  52635. // install platform runtime directives & components
  52636. extend(Vue.options.directives, platformDirectives);
  52637. extend(Vue.options.components, platformComponents);
  52638. // install platform patch function
  52639. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  52640. // public mount method
  52641. Vue.prototype.$mount = function (
  52642. el,
  52643. hydrating
  52644. ) {
  52645. el = el && inBrowser ? query(el) : undefined;
  52646. return mountComponent(this, el, hydrating)
  52647. };
  52648. // devtools global hook
  52649. /* istanbul ignore next */
  52650. if (inBrowser) {
  52651. setTimeout(function () {
  52652. if (config.devtools) {
  52653. if (devtools) {
  52654. devtools.emit('init', Vue);
  52655. } else {
  52656. console[console.info ? 'info' : 'log'](
  52657. 'Download the Vue Devtools extension for a better development experience:\n' +
  52658. 'https://github.com/vuejs/vue-devtools'
  52659. );
  52660. }
  52661. }
  52662. if (config.productionTip !== false &&
  52663. typeof console !== 'undefined'
  52664. ) {
  52665. console[console.info ? 'info' : 'log'](
  52666. "You are running Vue in development mode.\n" +
  52667. "Make sure to turn on production mode when deploying for production.\n" +
  52668. "See more tips at https://vuejs.org/guide/deployment.html"
  52669. );
  52670. }
  52671. }, 0);
  52672. }
  52673. /* */
  52674. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  52675. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  52676. var buildRegex = cached(function (delimiters) {
  52677. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  52678. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  52679. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  52680. });
  52681. function parseText (
  52682. text,
  52683. delimiters
  52684. ) {
  52685. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  52686. if (!tagRE.test(text)) {
  52687. return
  52688. }
  52689. var tokens = [];
  52690. var rawTokens = [];
  52691. var lastIndex = tagRE.lastIndex = 0;
  52692. var match, index, tokenValue;
  52693. while ((match = tagRE.exec(text))) {
  52694. index = match.index;
  52695. // push text token
  52696. if (index > lastIndex) {
  52697. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  52698. tokens.push(JSON.stringify(tokenValue));
  52699. }
  52700. // tag token
  52701. var exp = parseFilters(match[1].trim());
  52702. tokens.push(("_s(" + exp + ")"));
  52703. rawTokens.push({ '@binding': exp });
  52704. lastIndex = index + match[0].length;
  52705. }
  52706. if (lastIndex < text.length) {
  52707. rawTokens.push(tokenValue = text.slice(lastIndex));
  52708. tokens.push(JSON.stringify(tokenValue));
  52709. }
  52710. return {
  52711. expression: tokens.join('+'),
  52712. tokens: rawTokens
  52713. }
  52714. }
  52715. /* */
  52716. function transformNode (el, options) {
  52717. var warn = options.warn || baseWarn;
  52718. var staticClass = getAndRemoveAttr(el, 'class');
  52719. if (staticClass) {
  52720. var res = parseText(staticClass, options.delimiters);
  52721. if (res) {
  52722. warn(
  52723. "class=\"" + staticClass + "\": " +
  52724. 'Interpolation inside attributes has been removed. ' +
  52725. 'Use v-bind or the colon shorthand instead. For example, ' +
  52726. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  52727. el.rawAttrsMap['class']
  52728. );
  52729. }
  52730. }
  52731. if (staticClass) {
  52732. el.staticClass = JSON.stringify(staticClass);
  52733. }
  52734. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  52735. if (classBinding) {
  52736. el.classBinding = classBinding;
  52737. }
  52738. }
  52739. function genData (el) {
  52740. var data = '';
  52741. if (el.staticClass) {
  52742. data += "staticClass:" + (el.staticClass) + ",";
  52743. }
  52744. if (el.classBinding) {
  52745. data += "class:" + (el.classBinding) + ",";
  52746. }
  52747. return data
  52748. }
  52749. var klass$1 = {
  52750. staticKeys: ['staticClass'],
  52751. transformNode: transformNode,
  52752. genData: genData
  52753. };
  52754. /* */
  52755. function transformNode$1 (el, options) {
  52756. var warn = options.warn || baseWarn;
  52757. var staticStyle = getAndRemoveAttr(el, 'style');
  52758. if (staticStyle) {
  52759. /* istanbul ignore if */
  52760. {
  52761. var res = parseText(staticStyle, options.delimiters);
  52762. if (res) {
  52763. warn(
  52764. "style=\"" + staticStyle + "\": " +
  52765. 'Interpolation inside attributes has been removed. ' +
  52766. 'Use v-bind or the colon shorthand instead. For example, ' +
  52767. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  52768. el.rawAttrsMap['style']
  52769. );
  52770. }
  52771. }
  52772. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  52773. }
  52774. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  52775. if (styleBinding) {
  52776. el.styleBinding = styleBinding;
  52777. }
  52778. }
  52779. function genData$1 (el) {
  52780. var data = '';
  52781. if (el.staticStyle) {
  52782. data += "staticStyle:" + (el.staticStyle) + ",";
  52783. }
  52784. if (el.styleBinding) {
  52785. data += "style:(" + (el.styleBinding) + "),";
  52786. }
  52787. return data
  52788. }
  52789. var style$1 = {
  52790. staticKeys: ['staticStyle'],
  52791. transformNode: transformNode$1,
  52792. genData: genData$1
  52793. };
  52794. /* */
  52795. var decoder;
  52796. var he = {
  52797. decode: function decode (html) {
  52798. decoder = decoder || document.createElement('div');
  52799. decoder.innerHTML = html;
  52800. return decoder.textContent
  52801. }
  52802. };
  52803. /* */
  52804. var isUnaryTag = makeMap(
  52805. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  52806. 'link,meta,param,source,track,wbr'
  52807. );
  52808. // Elements that you can, intentionally, leave open
  52809. // (and which close themselves)
  52810. var canBeLeftOpenTag = makeMap(
  52811. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  52812. );
  52813. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  52814. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  52815. var isNonPhrasingTag = makeMap(
  52816. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  52817. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  52818. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  52819. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  52820. 'title,tr,track'
  52821. );
  52822. /**
  52823. * Not type-checking this file because it's mostly vendor code.
  52824. */
  52825. // Regular Expressions for parsing tags and attributes
  52826. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52827. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52828. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  52829. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  52830. var startTagOpen = new RegExp(("^<" + qnameCapture));
  52831. var startTagClose = /^\s*(\/?)>/;
  52832. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  52833. var doctype = /^<!DOCTYPE [^>]+>/i;
  52834. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  52835. var comment = /^<!\--/;
  52836. var conditionalComment = /^<!\[/;
  52837. // Special Elements (can contain anything)
  52838. var isPlainTextElement = makeMap('script,style,textarea', true);
  52839. var reCache = {};
  52840. var decodingMap = {
  52841. '&lt;': '<',
  52842. '&gt;': '>',
  52843. '&quot;': '"',
  52844. '&amp;': '&',
  52845. '&#10;': '\n',
  52846. '&#9;': '\t',
  52847. '&#39;': "'"
  52848. };
  52849. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  52850. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  52851. // #5992
  52852. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  52853. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  52854. function decodeAttr (value, shouldDecodeNewlines) {
  52855. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  52856. return value.replace(re, function (match) { return decodingMap[match]; })
  52857. }
  52858. function parseHTML (html, options) {
  52859. var stack = [];
  52860. var expectHTML = options.expectHTML;
  52861. var isUnaryTag$$1 = options.isUnaryTag || no;
  52862. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  52863. var index = 0;
  52864. var last, lastTag;
  52865. while (html) {
  52866. last = html;
  52867. // Make sure we're not in a plaintext content element like script/style
  52868. if (!lastTag || !isPlainTextElement(lastTag)) {
  52869. var textEnd = html.indexOf('<');
  52870. if (textEnd === 0) {
  52871. // Comment:
  52872. if (comment.test(html)) {
  52873. var commentEnd = html.indexOf('-->');
  52874. if (commentEnd >= 0) {
  52875. if (options.shouldKeepComment) {
  52876. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  52877. }
  52878. advance(commentEnd + 3);
  52879. continue
  52880. }
  52881. }
  52882. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  52883. if (conditionalComment.test(html)) {
  52884. var conditionalEnd = html.indexOf(']>');
  52885. if (conditionalEnd >= 0) {
  52886. advance(conditionalEnd + 2);
  52887. continue
  52888. }
  52889. }
  52890. // Doctype:
  52891. var doctypeMatch = html.match(doctype);
  52892. if (doctypeMatch) {
  52893. advance(doctypeMatch[0].length);
  52894. continue
  52895. }
  52896. // End tag:
  52897. var endTagMatch = html.match(endTag);
  52898. if (endTagMatch) {
  52899. var curIndex = index;
  52900. advance(endTagMatch[0].length);
  52901. parseEndTag(endTagMatch[1], curIndex, index);
  52902. continue
  52903. }
  52904. // Start tag:
  52905. var startTagMatch = parseStartTag();
  52906. if (startTagMatch) {
  52907. handleStartTag(startTagMatch);
  52908. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  52909. advance(1);
  52910. }
  52911. continue
  52912. }
  52913. }
  52914. var text = (void 0), rest = (void 0), next = (void 0);
  52915. if (textEnd >= 0) {
  52916. rest = html.slice(textEnd);
  52917. while (
  52918. !endTag.test(rest) &&
  52919. !startTagOpen.test(rest) &&
  52920. !comment.test(rest) &&
  52921. !conditionalComment.test(rest)
  52922. ) {
  52923. // < in plain text, be forgiving and treat it as text
  52924. next = rest.indexOf('<', 1);
  52925. if (next < 0) { break }
  52926. textEnd += next;
  52927. rest = html.slice(textEnd);
  52928. }
  52929. text = html.substring(0, textEnd);
  52930. }
  52931. if (textEnd < 0) {
  52932. text = html;
  52933. }
  52934. if (text) {
  52935. advance(text.length);
  52936. }
  52937. if (options.chars && text) {
  52938. options.chars(text, index - text.length, index);
  52939. }
  52940. } else {
  52941. var endTagLength = 0;
  52942. var stackedTag = lastTag.toLowerCase();
  52943. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  52944. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  52945. endTagLength = endTag.length;
  52946. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  52947. text = text
  52948. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  52949. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  52950. }
  52951. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  52952. text = text.slice(1);
  52953. }
  52954. if (options.chars) {
  52955. options.chars(text);
  52956. }
  52957. return ''
  52958. });
  52959. index += html.length - rest$1.length;
  52960. html = rest$1;
  52961. parseEndTag(stackedTag, index - endTagLength, index);
  52962. }
  52963. if (html === last) {
  52964. options.chars && options.chars(html);
  52965. if (!stack.length && options.warn) {
  52966. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  52967. }
  52968. break
  52969. }
  52970. }
  52971. // Clean up any remaining tags
  52972. parseEndTag();
  52973. function advance (n) {
  52974. index += n;
  52975. html = html.substring(n);
  52976. }
  52977. function parseStartTag () {
  52978. var start = html.match(startTagOpen);
  52979. if (start) {
  52980. var match = {
  52981. tagName: start[1],
  52982. attrs: [],
  52983. start: index
  52984. };
  52985. advance(start[0].length);
  52986. var end, attr;
  52987. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  52988. attr.start = index;
  52989. advance(attr[0].length);
  52990. attr.end = index;
  52991. match.attrs.push(attr);
  52992. }
  52993. if (end) {
  52994. match.unarySlash = end[1];
  52995. advance(end[0].length);
  52996. match.end = index;
  52997. return match
  52998. }
  52999. }
  53000. }
  53001. function handleStartTag (match) {
  53002. var tagName = match.tagName;
  53003. var unarySlash = match.unarySlash;
  53004. if (expectHTML) {
  53005. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  53006. parseEndTag(lastTag);
  53007. }
  53008. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  53009. parseEndTag(tagName);
  53010. }
  53011. }
  53012. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  53013. var l = match.attrs.length;
  53014. var attrs = new Array(l);
  53015. for (var i = 0; i < l; i++) {
  53016. var args = match.attrs[i];
  53017. var value = args[3] || args[4] || args[5] || '';
  53018. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  53019. ? options.shouldDecodeNewlinesForHref
  53020. : options.shouldDecodeNewlines;
  53021. attrs[i] = {
  53022. name: args[1],
  53023. value: decodeAttr(value, shouldDecodeNewlines)
  53024. };
  53025. if (options.outputSourceRange) {
  53026. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  53027. attrs[i].end = args.end;
  53028. }
  53029. }
  53030. if (!unary) {
  53031. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  53032. lastTag = tagName;
  53033. }
  53034. if (options.start) {
  53035. options.start(tagName, attrs, unary, match.start, match.end);
  53036. }
  53037. }
  53038. function parseEndTag (tagName, start, end) {
  53039. var pos, lowerCasedTagName;
  53040. if (start == null) { start = index; }
  53041. if (end == null) { end = index; }
  53042. // Find the closest opened tag of the same type
  53043. if (tagName) {
  53044. lowerCasedTagName = tagName.toLowerCase();
  53045. for (pos = stack.length - 1; pos >= 0; pos--) {
  53046. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  53047. break
  53048. }
  53049. }
  53050. } else {
  53051. // If no tag name is provided, clean shop
  53052. pos = 0;
  53053. }
  53054. if (pos >= 0) {
  53055. // Close all the open elements, up the stack
  53056. for (var i = stack.length - 1; i >= pos; i--) {
  53057. if (i > pos || !tagName &&
  53058. options.warn
  53059. ) {
  53060. options.warn(
  53061. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  53062. { start: stack[i].start, end: stack[i].end }
  53063. );
  53064. }
  53065. if (options.end) {
  53066. options.end(stack[i].tag, start, end);
  53067. }
  53068. }
  53069. // Remove the open elements from the stack
  53070. stack.length = pos;
  53071. lastTag = pos && stack[pos - 1].tag;
  53072. } else if (lowerCasedTagName === 'br') {
  53073. if (options.start) {
  53074. options.start(tagName, [], true, start, end);
  53075. }
  53076. } else if (lowerCasedTagName === 'p') {
  53077. if (options.start) {
  53078. options.start(tagName, [], false, start, end);
  53079. }
  53080. if (options.end) {
  53081. options.end(tagName, start, end);
  53082. }
  53083. }
  53084. }
  53085. }
  53086. /* */
  53087. var onRE = /^@|^v-on:/;
  53088. var dirRE = /^v-|^@|^:|^#/;
  53089. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  53090. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  53091. var stripParensRE = /^\(|\)$/g;
  53092. var dynamicArgRE = /^\[.*\]$/;
  53093. var argRE = /:(.*)$/;
  53094. var bindRE = /^:|^\.|^v-bind:/;
  53095. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  53096. var slotRE = /^v-slot(:|$)|^#/;
  53097. var lineBreakRE = /[\r\n]/;
  53098. var whitespaceRE$1 = /\s+/g;
  53099. var invalidAttributeRE = /[\s"'<>\/=]/;
  53100. var decodeHTMLCached = cached(he.decode);
  53101. var emptySlotScopeToken = "_empty_";
  53102. // configurable state
  53103. var warn$2;
  53104. var delimiters;
  53105. var transforms;
  53106. var preTransforms;
  53107. var postTransforms;
  53108. var platformIsPreTag;
  53109. var platformMustUseProp;
  53110. var platformGetTagNamespace;
  53111. var maybeComponent;
  53112. function createASTElement (
  53113. tag,
  53114. attrs,
  53115. parent
  53116. ) {
  53117. return {
  53118. type: 1,
  53119. tag: tag,
  53120. attrsList: attrs,
  53121. attrsMap: makeAttrsMap(attrs),
  53122. rawAttrsMap: {},
  53123. parent: parent,
  53124. children: []
  53125. }
  53126. }
  53127. /**
  53128. * Convert HTML string to AST.
  53129. */
  53130. function parse (
  53131. template,
  53132. options
  53133. ) {
  53134. warn$2 = options.warn || baseWarn;
  53135. platformIsPreTag = options.isPreTag || no;
  53136. platformMustUseProp = options.mustUseProp || no;
  53137. platformGetTagNamespace = options.getTagNamespace || no;
  53138. var isReservedTag = options.isReservedTag || no;
  53139. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  53140. transforms = pluckModuleFunction(options.modules, 'transformNode');
  53141. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  53142. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  53143. delimiters = options.delimiters;
  53144. var stack = [];
  53145. var preserveWhitespace = options.preserveWhitespace !== false;
  53146. var whitespaceOption = options.whitespace;
  53147. var root;
  53148. var currentParent;
  53149. var inVPre = false;
  53150. var inPre = false;
  53151. var warned = false;
  53152. function warnOnce (msg, range) {
  53153. if (!warned) {
  53154. warned = true;
  53155. warn$2(msg, range);
  53156. }
  53157. }
  53158. function closeElement (element) {
  53159. trimEndingWhitespace(element);
  53160. if (!inVPre && !element.processed) {
  53161. element = processElement(element, options);
  53162. }
  53163. // tree management
  53164. if (!stack.length && element !== root) {
  53165. // allow root elements with v-if, v-else-if and v-else
  53166. if (root.if && (element.elseif || element.else)) {
  53167. {
  53168. checkRootConstraints(element);
  53169. }
  53170. addIfCondition(root, {
  53171. exp: element.elseif,
  53172. block: element
  53173. });
  53174. } else {
  53175. warnOnce(
  53176. "Component template should contain exactly one root element. " +
  53177. "If you are using v-if on multiple elements, " +
  53178. "use v-else-if to chain them instead.",
  53179. { start: element.start }
  53180. );
  53181. }
  53182. }
  53183. if (currentParent && !element.forbidden) {
  53184. if (element.elseif || element.else) {
  53185. processIfConditions(element, currentParent);
  53186. } else {
  53187. if (element.slotScope) {
  53188. // scoped slot
  53189. // keep it in the children list so that v-else(-if) conditions can
  53190. // find it as the prev node.
  53191. var name = element.slotTarget || '"default"'
  53192. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  53193. }
  53194. currentParent.children.push(element);
  53195. element.parent = currentParent;
  53196. }
  53197. }
  53198. // final children cleanup
  53199. // filter out scoped slots
  53200. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  53201. // remove trailing whitespace node again
  53202. trimEndingWhitespace(element);
  53203. // check pre state
  53204. if (element.pre) {
  53205. inVPre = false;
  53206. }
  53207. if (platformIsPreTag(element.tag)) {
  53208. inPre = false;
  53209. }
  53210. // apply post-transforms
  53211. for (var i = 0; i < postTransforms.length; i++) {
  53212. postTransforms[i](element, options);
  53213. }
  53214. }
  53215. function trimEndingWhitespace (el) {
  53216. // remove trailing whitespace node
  53217. if (!inPre) {
  53218. var lastNode;
  53219. while (
  53220. (lastNode = el.children[el.children.length - 1]) &&
  53221. lastNode.type === 3 &&
  53222. lastNode.text === ' '
  53223. ) {
  53224. el.children.pop();
  53225. }
  53226. }
  53227. }
  53228. function checkRootConstraints (el) {
  53229. if (el.tag === 'slot' || el.tag === 'template') {
  53230. warnOnce(
  53231. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  53232. 'contain multiple nodes.',
  53233. { start: el.start }
  53234. );
  53235. }
  53236. if (el.attrsMap.hasOwnProperty('v-for')) {
  53237. warnOnce(
  53238. 'Cannot use v-for on stateful component root element because ' +
  53239. 'it renders multiple elements.',
  53240. el.rawAttrsMap['v-for']
  53241. );
  53242. }
  53243. }
  53244. parseHTML(template, {
  53245. warn: warn$2,
  53246. expectHTML: options.expectHTML,
  53247. isUnaryTag: options.isUnaryTag,
  53248. canBeLeftOpenTag: options.canBeLeftOpenTag,
  53249. shouldDecodeNewlines: options.shouldDecodeNewlines,
  53250. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  53251. shouldKeepComment: options.comments,
  53252. outputSourceRange: options.outputSourceRange,
  53253. start: function start (tag, attrs, unary, start$1, end) {
  53254. // check namespace.
  53255. // inherit parent ns if there is one
  53256. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  53257. // handle IE svg bug
  53258. /* istanbul ignore if */
  53259. if (isIE && ns === 'svg') {
  53260. attrs = guardIESVGBug(attrs);
  53261. }
  53262. var element = createASTElement(tag, attrs, currentParent);
  53263. if (ns) {
  53264. element.ns = ns;
  53265. }
  53266. {
  53267. if (options.outputSourceRange) {
  53268. element.start = start$1;
  53269. element.end = end;
  53270. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  53271. cumulated[attr.name] = attr;
  53272. return cumulated
  53273. }, {});
  53274. }
  53275. attrs.forEach(function (attr) {
  53276. if (invalidAttributeRE.test(attr.name)) {
  53277. warn$2(
  53278. "Invalid dynamic argument expression: attribute names cannot contain " +
  53279. "spaces, quotes, <, >, / or =.",
  53280. {
  53281. start: attr.start + attr.name.indexOf("["),
  53282. end: attr.start + attr.name.length
  53283. }
  53284. );
  53285. }
  53286. });
  53287. }
  53288. if (isForbiddenTag(element) && !isServerRendering()) {
  53289. element.forbidden = true;
  53290. warn$2(
  53291. 'Templates should only be responsible for mapping the state to the ' +
  53292. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  53293. "<" + tag + ">" + ', as they will not be parsed.',
  53294. { start: element.start }
  53295. );
  53296. }
  53297. // apply pre-transforms
  53298. for (var i = 0; i < preTransforms.length; i++) {
  53299. element = preTransforms[i](element, options) || element;
  53300. }
  53301. if (!inVPre) {
  53302. processPre(element);
  53303. if (element.pre) {
  53304. inVPre = true;
  53305. }
  53306. }
  53307. if (platformIsPreTag(element.tag)) {
  53308. inPre = true;
  53309. }
  53310. if (inVPre) {
  53311. processRawAttrs(element);
  53312. } else if (!element.processed) {
  53313. // structural directives
  53314. processFor(element);
  53315. processIf(element);
  53316. processOnce(element);
  53317. }
  53318. if (!root) {
  53319. root = element;
  53320. {
  53321. checkRootConstraints(root);
  53322. }
  53323. }
  53324. if (!unary) {
  53325. currentParent = element;
  53326. stack.push(element);
  53327. } else {
  53328. closeElement(element);
  53329. }
  53330. },
  53331. end: function end (tag, start, end$1) {
  53332. var element = stack[stack.length - 1];
  53333. // pop stack
  53334. stack.length -= 1;
  53335. currentParent = stack[stack.length - 1];
  53336. if (options.outputSourceRange) {
  53337. element.end = end$1;
  53338. }
  53339. closeElement(element);
  53340. },
  53341. chars: function chars (text, start, end) {
  53342. if (!currentParent) {
  53343. {
  53344. if (text === template) {
  53345. warnOnce(
  53346. 'Component template requires a root element, rather than just text.',
  53347. { start: start }
  53348. );
  53349. } else if ((text = text.trim())) {
  53350. warnOnce(
  53351. ("text \"" + text + "\" outside root element will be ignored."),
  53352. { start: start }
  53353. );
  53354. }
  53355. }
  53356. return
  53357. }
  53358. // IE textarea placeholder bug
  53359. /* istanbul ignore if */
  53360. if (isIE &&
  53361. currentParent.tag === 'textarea' &&
  53362. currentParent.attrsMap.placeholder === text
  53363. ) {
  53364. return
  53365. }
  53366. var children = currentParent.children;
  53367. if (inPre || text.trim()) {
  53368. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  53369. } else if (!children.length) {
  53370. // remove the whitespace-only node right after an opening tag
  53371. text = '';
  53372. } else if (whitespaceOption) {
  53373. if (whitespaceOption === 'condense') {
  53374. // in condense mode, remove the whitespace node if it contains
  53375. // line break, otherwise condense to a single space
  53376. text = lineBreakRE.test(text) ? '' : ' ';
  53377. } else {
  53378. text = ' ';
  53379. }
  53380. } else {
  53381. text = preserveWhitespace ? ' ' : '';
  53382. }
  53383. if (text) {
  53384. if (!inPre && whitespaceOption === 'condense') {
  53385. // condense consecutive whitespaces into single space
  53386. text = text.replace(whitespaceRE$1, ' ');
  53387. }
  53388. var res;
  53389. var child;
  53390. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  53391. child = {
  53392. type: 2,
  53393. expression: res.expression,
  53394. tokens: res.tokens,
  53395. text: text
  53396. };
  53397. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  53398. child = {
  53399. type: 3,
  53400. text: text
  53401. };
  53402. }
  53403. if (child) {
  53404. if (options.outputSourceRange) {
  53405. child.start = start;
  53406. child.end = end;
  53407. }
  53408. children.push(child);
  53409. }
  53410. }
  53411. },
  53412. comment: function comment (text, start, end) {
  53413. // adding anyting as a sibling to the root node is forbidden
  53414. // comments should still be allowed, but ignored
  53415. if (currentParent) {
  53416. var child = {
  53417. type: 3,
  53418. text: text,
  53419. isComment: true
  53420. };
  53421. if (options.outputSourceRange) {
  53422. child.start = start;
  53423. child.end = end;
  53424. }
  53425. currentParent.children.push(child);
  53426. }
  53427. }
  53428. });
  53429. return root
  53430. }
  53431. function processPre (el) {
  53432. if (getAndRemoveAttr(el, 'v-pre') != null) {
  53433. el.pre = true;
  53434. }
  53435. }
  53436. function processRawAttrs (el) {
  53437. var list = el.attrsList;
  53438. var len = list.length;
  53439. if (len) {
  53440. var attrs = el.attrs = new Array(len);
  53441. for (var i = 0; i < len; i++) {
  53442. attrs[i] = {
  53443. name: list[i].name,
  53444. value: JSON.stringify(list[i].value)
  53445. };
  53446. if (list[i].start != null) {
  53447. attrs[i].start = list[i].start;
  53448. attrs[i].end = list[i].end;
  53449. }
  53450. }
  53451. } else if (!el.pre) {
  53452. // non root node in pre blocks with no attributes
  53453. el.plain = true;
  53454. }
  53455. }
  53456. function processElement (
  53457. element,
  53458. options
  53459. ) {
  53460. processKey(element);
  53461. // determine whether this is a plain element after
  53462. // removing structural attributes
  53463. element.plain = (
  53464. !element.key &&
  53465. !element.scopedSlots &&
  53466. !element.attrsList.length
  53467. );
  53468. processRef(element);
  53469. processSlotContent(element);
  53470. processSlotOutlet(element);
  53471. processComponent(element);
  53472. for (var i = 0; i < transforms.length; i++) {
  53473. element = transforms[i](element, options) || element;
  53474. }
  53475. processAttrs(element);
  53476. return element
  53477. }
  53478. function processKey (el) {
  53479. var exp = getBindingAttr(el, 'key');
  53480. if (exp) {
  53481. {
  53482. if (el.tag === 'template') {
  53483. warn$2(
  53484. "<template> cannot be keyed. Place the key on real elements instead.",
  53485. getRawBindingAttr(el, 'key')
  53486. );
  53487. }
  53488. if (el.for) {
  53489. var iterator = el.iterator2 || el.iterator1;
  53490. var parent = el.parent;
  53491. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  53492. warn$2(
  53493. "Do not use v-for index as key on <transition-group> children, " +
  53494. "this is the same as not using keys.",
  53495. getRawBindingAttr(el, 'key'),
  53496. true /* tip */
  53497. );
  53498. }
  53499. }
  53500. }
  53501. el.key = exp;
  53502. }
  53503. }
  53504. function processRef (el) {
  53505. var ref = getBindingAttr(el, 'ref');
  53506. if (ref) {
  53507. el.ref = ref;
  53508. el.refInFor = checkInFor(el);
  53509. }
  53510. }
  53511. function processFor (el) {
  53512. var exp;
  53513. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  53514. var res = parseFor(exp);
  53515. if (res) {
  53516. extend(el, res);
  53517. } else {
  53518. warn$2(
  53519. ("Invalid v-for expression: " + exp),
  53520. el.rawAttrsMap['v-for']
  53521. );
  53522. }
  53523. }
  53524. }
  53525. function parseFor (exp) {
  53526. var inMatch = exp.match(forAliasRE);
  53527. if (!inMatch) { return }
  53528. var res = {};
  53529. res.for = inMatch[2].trim();
  53530. var alias = inMatch[1].trim().replace(stripParensRE, '');
  53531. var iteratorMatch = alias.match(forIteratorRE);
  53532. if (iteratorMatch) {
  53533. res.alias = alias.replace(forIteratorRE, '').trim();
  53534. res.iterator1 = iteratorMatch[1].trim();
  53535. if (iteratorMatch[2]) {
  53536. res.iterator2 = iteratorMatch[2].trim();
  53537. }
  53538. } else {
  53539. res.alias = alias;
  53540. }
  53541. return res
  53542. }
  53543. function processIf (el) {
  53544. var exp = getAndRemoveAttr(el, 'v-if');
  53545. if (exp) {
  53546. el.if = exp;
  53547. addIfCondition(el, {
  53548. exp: exp,
  53549. block: el
  53550. });
  53551. } else {
  53552. if (getAndRemoveAttr(el, 'v-else') != null) {
  53553. el.else = true;
  53554. }
  53555. var elseif = getAndRemoveAttr(el, 'v-else-if');
  53556. if (elseif) {
  53557. el.elseif = elseif;
  53558. }
  53559. }
  53560. }
  53561. function processIfConditions (el, parent) {
  53562. var prev = findPrevElement(parent.children);
  53563. if (prev && prev.if) {
  53564. addIfCondition(prev, {
  53565. exp: el.elseif,
  53566. block: el
  53567. });
  53568. } else {
  53569. warn$2(
  53570. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  53571. "used on element <" + (el.tag) + "> without corresponding v-if.",
  53572. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  53573. );
  53574. }
  53575. }
  53576. function findPrevElement (children) {
  53577. var i = children.length;
  53578. while (i--) {
  53579. if (children[i].type === 1) {
  53580. return children[i]
  53581. } else {
  53582. if (children[i].text !== ' ') {
  53583. warn$2(
  53584. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  53585. "will be ignored.",
  53586. children[i]
  53587. );
  53588. }
  53589. children.pop();
  53590. }
  53591. }
  53592. }
  53593. function addIfCondition (el, condition) {
  53594. if (!el.ifConditions) {
  53595. el.ifConditions = [];
  53596. }
  53597. el.ifConditions.push(condition);
  53598. }
  53599. function processOnce (el) {
  53600. var once$$1 = getAndRemoveAttr(el, 'v-once');
  53601. if (once$$1 != null) {
  53602. el.once = true;
  53603. }
  53604. }
  53605. // handle content being passed to a component as slot,
  53606. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  53607. function processSlotContent (el) {
  53608. var slotScope;
  53609. if (el.tag === 'template') {
  53610. slotScope = getAndRemoveAttr(el, 'scope');
  53611. /* istanbul ignore if */
  53612. if (slotScope) {
  53613. warn$2(
  53614. "the \"scope\" attribute for scoped slots have been deprecated and " +
  53615. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  53616. "can also be used on plain elements in addition to <template> to " +
  53617. "denote scoped slots.",
  53618. el.rawAttrsMap['scope'],
  53619. true
  53620. );
  53621. }
  53622. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  53623. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  53624. /* istanbul ignore if */
  53625. if (el.attrsMap['v-for']) {
  53626. warn$2(
  53627. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  53628. "(v-for takes higher priority). Use a wrapper <template> for the " +
  53629. "scoped slot to make it clearer.",
  53630. el.rawAttrsMap['slot-scope'],
  53631. true
  53632. );
  53633. }
  53634. el.slotScope = slotScope;
  53635. }
  53636. // slot="xxx"
  53637. var slotTarget = getBindingAttr(el, 'slot');
  53638. if (slotTarget) {
  53639. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  53640. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  53641. // preserve slot as an attribute for native shadow DOM compat
  53642. // only for non-scoped slots.
  53643. if (el.tag !== 'template' && !el.slotScope) {
  53644. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  53645. }
  53646. }
  53647. // 2.6 v-slot syntax
  53648. {
  53649. if (el.tag === 'template') {
  53650. // v-slot on <template>
  53651. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  53652. if (slotBinding) {
  53653. {
  53654. if (el.slotTarget || el.slotScope) {
  53655. warn$2(
  53656. "Unexpected mixed usage of different slot syntaxes.",
  53657. el
  53658. );
  53659. }
  53660. if (el.parent && !maybeComponent(el.parent)) {
  53661. warn$2(
  53662. "<template v-slot> can only appear at the root level inside " +
  53663. "the receiving component",
  53664. el
  53665. );
  53666. }
  53667. }
  53668. var ref = getSlotName(slotBinding);
  53669. var name = ref.name;
  53670. var dynamic = ref.dynamic;
  53671. el.slotTarget = name;
  53672. el.slotTargetDynamic = dynamic;
  53673. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  53674. }
  53675. } else {
  53676. // v-slot on component, denotes default slot
  53677. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  53678. if (slotBinding$1) {
  53679. {
  53680. if (!maybeComponent(el)) {
  53681. warn$2(
  53682. "v-slot can only be used on components or <template>.",
  53683. slotBinding$1
  53684. );
  53685. }
  53686. if (el.slotScope || el.slotTarget) {
  53687. warn$2(
  53688. "Unexpected mixed usage of different slot syntaxes.",
  53689. el
  53690. );
  53691. }
  53692. if (el.scopedSlots) {
  53693. warn$2(
  53694. "To avoid scope ambiguity, the default slot should also use " +
  53695. "<template> syntax when there are other named slots.",
  53696. slotBinding$1
  53697. );
  53698. }
  53699. }
  53700. // add the component's children to its default slot
  53701. var slots = el.scopedSlots || (el.scopedSlots = {});
  53702. var ref$1 = getSlotName(slotBinding$1);
  53703. var name$1 = ref$1.name;
  53704. var dynamic$1 = ref$1.dynamic;
  53705. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  53706. slotContainer.slotTarget = name$1;
  53707. slotContainer.slotTargetDynamic = dynamic$1;
  53708. slotContainer.children = el.children.filter(function (c) {
  53709. if (!c.slotScope) {
  53710. c.parent = slotContainer;
  53711. return true
  53712. }
  53713. });
  53714. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  53715. // remove children as they are returned from scopedSlots now
  53716. el.children = [];
  53717. // mark el non-plain so data gets generated
  53718. el.plain = false;
  53719. }
  53720. }
  53721. }
  53722. }
  53723. function getSlotName (binding) {
  53724. var name = binding.name.replace(slotRE, '');
  53725. if (!name) {
  53726. if (binding.name[0] !== '#') {
  53727. name = 'default';
  53728. } else {
  53729. warn$2(
  53730. "v-slot shorthand syntax requires a slot name.",
  53731. binding
  53732. );
  53733. }
  53734. }
  53735. return dynamicArgRE.test(name)
  53736. // dynamic [name]
  53737. ? { name: name.slice(1, -1), dynamic: true }
  53738. // static name
  53739. : { name: ("\"" + name + "\""), dynamic: false }
  53740. }
  53741. // handle <slot/> outlets
  53742. function processSlotOutlet (el) {
  53743. if (el.tag === 'slot') {
  53744. el.slotName = getBindingAttr(el, 'name');
  53745. if (el.key) {
  53746. warn$2(
  53747. "`key` does not work on <slot> because slots are abstract outlets " +
  53748. "and can possibly expand into multiple elements. " +
  53749. "Use the key on a wrapping element instead.",
  53750. getRawBindingAttr(el, 'key')
  53751. );
  53752. }
  53753. }
  53754. }
  53755. function processComponent (el) {
  53756. var binding;
  53757. if ((binding = getBindingAttr(el, 'is'))) {
  53758. el.component = binding;
  53759. }
  53760. if (getAndRemoveAttr(el, 'inline-template') != null) {
  53761. el.inlineTemplate = true;
  53762. }
  53763. }
  53764. function processAttrs (el) {
  53765. var list = el.attrsList;
  53766. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  53767. for (i = 0, l = list.length; i < l; i++) {
  53768. name = rawName = list[i].name;
  53769. value = list[i].value;
  53770. if (dirRE.test(name)) {
  53771. // mark element as dynamic
  53772. el.hasBindings = true;
  53773. // modifiers
  53774. modifiers = parseModifiers(name.replace(dirRE, ''));
  53775. // support .foo shorthand syntax for the .prop modifier
  53776. if (modifiers) {
  53777. name = name.replace(modifierRE, '');
  53778. }
  53779. if (bindRE.test(name)) { // v-bind
  53780. name = name.replace(bindRE, '');
  53781. value = parseFilters(value);
  53782. isDynamic = dynamicArgRE.test(name);
  53783. if (isDynamic) {
  53784. name = name.slice(1, -1);
  53785. }
  53786. if (
  53787. value.trim().length === 0
  53788. ) {
  53789. warn$2(
  53790. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  53791. );
  53792. }
  53793. if (modifiers) {
  53794. if (modifiers.prop && !isDynamic) {
  53795. name = camelize(name);
  53796. if (name === 'innerHtml') { name = 'innerHTML'; }
  53797. }
  53798. if (modifiers.camel && !isDynamic) {
  53799. name = camelize(name);
  53800. }
  53801. if (modifiers.sync) {
  53802. syncGen = genAssignmentCode(value, "$event");
  53803. if (!isDynamic) {
  53804. addHandler(
  53805. el,
  53806. ("update:" + (camelize(name))),
  53807. syncGen,
  53808. null,
  53809. false,
  53810. warn$2,
  53811. list[i]
  53812. );
  53813. if (hyphenate(name) !== camelize(name)) {
  53814. addHandler(
  53815. el,
  53816. ("update:" + (hyphenate(name))),
  53817. syncGen,
  53818. null,
  53819. false,
  53820. warn$2,
  53821. list[i]
  53822. );
  53823. }
  53824. } else {
  53825. // handler w/ dynamic event name
  53826. addHandler(
  53827. el,
  53828. ("\"update:\"+(" + name + ")"),
  53829. syncGen,
  53830. null,
  53831. false,
  53832. warn$2,
  53833. list[i],
  53834. true // dynamic
  53835. );
  53836. }
  53837. }
  53838. }
  53839. if ((modifiers && modifiers.prop) || (
  53840. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  53841. )) {
  53842. addProp(el, name, value, list[i], isDynamic);
  53843. } else {
  53844. addAttr(el, name, value, list[i], isDynamic);
  53845. }
  53846. } else if (onRE.test(name)) { // v-on
  53847. name = name.replace(onRE, '');
  53848. isDynamic = dynamicArgRE.test(name);
  53849. if (isDynamic) {
  53850. name = name.slice(1, -1);
  53851. }
  53852. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  53853. } else { // normal directives
  53854. name = name.replace(dirRE, '');
  53855. // parse arg
  53856. var argMatch = name.match(argRE);
  53857. var arg = argMatch && argMatch[1];
  53858. isDynamic = false;
  53859. if (arg) {
  53860. name = name.slice(0, -(arg.length + 1));
  53861. if (dynamicArgRE.test(arg)) {
  53862. arg = arg.slice(1, -1);
  53863. isDynamic = true;
  53864. }
  53865. }
  53866. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  53867. if (name === 'model') {
  53868. checkForAliasModel(el, value);
  53869. }
  53870. }
  53871. } else {
  53872. // literal attribute
  53873. {
  53874. var res = parseText(value, delimiters);
  53875. if (res) {
  53876. warn$2(
  53877. name + "=\"" + value + "\": " +
  53878. 'Interpolation inside attributes has been removed. ' +
  53879. 'Use v-bind or the colon shorthand instead. For example, ' +
  53880. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  53881. list[i]
  53882. );
  53883. }
  53884. }
  53885. addAttr(el, name, JSON.stringify(value), list[i]);
  53886. // #6887 firefox doesn't update muted state if set via attribute
  53887. // even immediately after element creation
  53888. if (!el.component &&
  53889. name === 'muted' &&
  53890. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  53891. addProp(el, name, 'true', list[i]);
  53892. }
  53893. }
  53894. }
  53895. }
  53896. function checkInFor (el) {
  53897. var parent = el;
  53898. while (parent) {
  53899. if (parent.for !== undefined) {
  53900. return true
  53901. }
  53902. parent = parent.parent;
  53903. }
  53904. return false
  53905. }
  53906. function parseModifiers (name) {
  53907. var match = name.match(modifierRE);
  53908. if (match) {
  53909. var ret = {};
  53910. match.forEach(function (m) { ret[m.slice(1)] = true; });
  53911. return ret
  53912. }
  53913. }
  53914. function makeAttrsMap (attrs) {
  53915. var map = {};
  53916. for (var i = 0, l = attrs.length; i < l; i++) {
  53917. if (
  53918. map[attrs[i].name] && !isIE && !isEdge
  53919. ) {
  53920. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  53921. }
  53922. map[attrs[i].name] = attrs[i].value;
  53923. }
  53924. return map
  53925. }
  53926. // for script (e.g. type="x/template") or style, do not decode content
  53927. function isTextTag (el) {
  53928. return el.tag === 'script' || el.tag === 'style'
  53929. }
  53930. function isForbiddenTag (el) {
  53931. return (
  53932. el.tag === 'style' ||
  53933. (el.tag === 'script' && (
  53934. !el.attrsMap.type ||
  53935. el.attrsMap.type === 'text/javascript'
  53936. ))
  53937. )
  53938. }
  53939. var ieNSBug = /^xmlns:NS\d+/;
  53940. var ieNSPrefix = /^NS\d+:/;
  53941. /* istanbul ignore next */
  53942. function guardIESVGBug (attrs) {
  53943. var res = [];
  53944. for (var i = 0; i < attrs.length; i++) {
  53945. var attr = attrs[i];
  53946. if (!ieNSBug.test(attr.name)) {
  53947. attr.name = attr.name.replace(ieNSPrefix, '');
  53948. res.push(attr);
  53949. }
  53950. }
  53951. return res
  53952. }
  53953. function checkForAliasModel (el, value) {
  53954. var _el = el;
  53955. while (_el) {
  53956. if (_el.for && _el.alias === value) {
  53957. warn$2(
  53958. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  53959. "You are binding v-model directly to a v-for iteration alias. " +
  53960. "This will not be able to modify the v-for source array because " +
  53961. "writing to the alias is like modifying a function local variable. " +
  53962. "Consider using an array of objects and use v-model on an object property instead.",
  53963. el.rawAttrsMap['v-model']
  53964. );
  53965. }
  53966. _el = _el.parent;
  53967. }
  53968. }
  53969. /* */
  53970. function preTransformNode (el, options) {
  53971. if (el.tag === 'input') {
  53972. var map = el.attrsMap;
  53973. if (!map['v-model']) {
  53974. return
  53975. }
  53976. var typeBinding;
  53977. if (map[':type'] || map['v-bind:type']) {
  53978. typeBinding = getBindingAttr(el, 'type');
  53979. }
  53980. if (!map.type && !typeBinding && map['v-bind']) {
  53981. typeBinding = "(" + (map['v-bind']) + ").type";
  53982. }
  53983. if (typeBinding) {
  53984. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  53985. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  53986. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  53987. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  53988. // 1. checkbox
  53989. var branch0 = cloneASTElement(el);
  53990. // process for on the main node
  53991. processFor(branch0);
  53992. addRawAttr(branch0, 'type', 'checkbox');
  53993. processElement(branch0, options);
  53994. branch0.processed = true; // prevent it from double-processed
  53995. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  53996. addIfCondition(branch0, {
  53997. exp: branch0.if,
  53998. block: branch0
  53999. });
  54000. // 2. add radio else-if condition
  54001. var branch1 = cloneASTElement(el);
  54002. getAndRemoveAttr(branch1, 'v-for', true);
  54003. addRawAttr(branch1, 'type', 'radio');
  54004. processElement(branch1, options);
  54005. addIfCondition(branch0, {
  54006. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  54007. block: branch1
  54008. });
  54009. // 3. other
  54010. var branch2 = cloneASTElement(el);
  54011. getAndRemoveAttr(branch2, 'v-for', true);
  54012. addRawAttr(branch2, ':type', typeBinding);
  54013. processElement(branch2, options);
  54014. addIfCondition(branch0, {
  54015. exp: ifCondition,
  54016. block: branch2
  54017. });
  54018. if (hasElse) {
  54019. branch0.else = true;
  54020. } else if (elseIfCondition) {
  54021. branch0.elseif = elseIfCondition;
  54022. }
  54023. return branch0
  54024. }
  54025. }
  54026. }
  54027. function cloneASTElement (el) {
  54028. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  54029. }
  54030. var model$1 = {
  54031. preTransformNode: preTransformNode
  54032. };
  54033. var modules$1 = [
  54034. klass$1,
  54035. style$1,
  54036. model$1
  54037. ];
  54038. /* */
  54039. function text (el, dir) {
  54040. if (dir.value) {
  54041. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  54042. }
  54043. }
  54044. /* */
  54045. function html (el, dir) {
  54046. if (dir.value) {
  54047. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  54048. }
  54049. }
  54050. var directives$1 = {
  54051. model: model,
  54052. text: text,
  54053. html: html
  54054. };
  54055. /* */
  54056. var baseOptions = {
  54057. expectHTML: true,
  54058. modules: modules$1,
  54059. directives: directives$1,
  54060. isPreTag: isPreTag,
  54061. isUnaryTag: isUnaryTag,
  54062. mustUseProp: mustUseProp,
  54063. canBeLeftOpenTag: canBeLeftOpenTag,
  54064. isReservedTag: isReservedTag,
  54065. getTagNamespace: getTagNamespace,
  54066. staticKeys: genStaticKeys(modules$1)
  54067. };
  54068. /* */
  54069. var isStaticKey;
  54070. var isPlatformReservedTag;
  54071. var genStaticKeysCached = cached(genStaticKeys$1);
  54072. /**
  54073. * Goal of the optimizer: walk the generated template AST tree
  54074. * and detect sub-trees that are purely static, i.e. parts of
  54075. * the DOM that never needs to change.
  54076. *
  54077. * Once we detect these sub-trees, we can:
  54078. *
  54079. * 1. Hoist them into constants, so that we no longer need to
  54080. * create fresh nodes for them on each re-render;
  54081. * 2. Completely skip them in the patching process.
  54082. */
  54083. function optimize (root, options) {
  54084. if (!root) { return }
  54085. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  54086. isPlatformReservedTag = options.isReservedTag || no;
  54087. // first pass: mark all non-static nodes.
  54088. markStatic$1(root);
  54089. // second pass: mark static roots.
  54090. markStaticRoots(root, false);
  54091. }
  54092. function genStaticKeys$1 (keys) {
  54093. return makeMap(
  54094. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  54095. (keys ? ',' + keys : '')
  54096. )
  54097. }
  54098. function markStatic$1 (node) {
  54099. node.static = isStatic(node);
  54100. if (node.type === 1) {
  54101. // do not make component slot content static. this avoids
  54102. // 1. components not able to mutate slot nodes
  54103. // 2. static slot content fails for hot-reloading
  54104. if (
  54105. !isPlatformReservedTag(node.tag) &&
  54106. node.tag !== 'slot' &&
  54107. node.attrsMap['inline-template'] == null
  54108. ) {
  54109. return
  54110. }
  54111. for (var i = 0, l = node.children.length; i < l; i++) {
  54112. var child = node.children[i];
  54113. markStatic$1(child);
  54114. if (!child.static) {
  54115. node.static = false;
  54116. }
  54117. }
  54118. if (node.ifConditions) {
  54119. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  54120. var block = node.ifConditions[i$1].block;
  54121. markStatic$1(block);
  54122. if (!block.static) {
  54123. node.static = false;
  54124. }
  54125. }
  54126. }
  54127. }
  54128. }
  54129. function markStaticRoots (node, isInFor) {
  54130. if (node.type === 1) {
  54131. if (node.static || node.once) {
  54132. node.staticInFor = isInFor;
  54133. }
  54134. // For a node to qualify as a static root, it should have children that
  54135. // are not just static text. Otherwise the cost of hoisting out will
  54136. // outweigh the benefits and it's better off to just always render it fresh.
  54137. if (node.static && node.children.length && !(
  54138. node.children.length === 1 &&
  54139. node.children[0].type === 3
  54140. )) {
  54141. node.staticRoot = true;
  54142. return
  54143. } else {
  54144. node.staticRoot = false;
  54145. }
  54146. if (node.children) {
  54147. for (var i = 0, l = node.children.length; i < l; i++) {
  54148. markStaticRoots(node.children[i], isInFor || !!node.for);
  54149. }
  54150. }
  54151. if (node.ifConditions) {
  54152. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  54153. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  54154. }
  54155. }
  54156. }
  54157. }
  54158. function isStatic (node) {
  54159. if (node.type === 2) { // expression
  54160. return false
  54161. }
  54162. if (node.type === 3) { // text
  54163. return true
  54164. }
  54165. return !!(node.pre || (
  54166. !node.hasBindings && // no dynamic bindings
  54167. !node.if && !node.for && // not v-if or v-for or v-else
  54168. !isBuiltInTag(node.tag) && // not a built-in
  54169. isPlatformReservedTag(node.tag) && // not a component
  54170. !isDirectChildOfTemplateFor(node) &&
  54171. Object.keys(node).every(isStaticKey)
  54172. ))
  54173. }
  54174. function isDirectChildOfTemplateFor (node) {
  54175. while (node.parent) {
  54176. node = node.parent;
  54177. if (node.tag !== 'template') {
  54178. return false
  54179. }
  54180. if (node.for) {
  54181. return true
  54182. }
  54183. }
  54184. return false
  54185. }
  54186. /* */
  54187. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  54188. var fnInvokeRE = /\([^)]*?\);*$/;
  54189. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  54190. // KeyboardEvent.keyCode aliases
  54191. var keyCodes = {
  54192. esc: 27,
  54193. tab: 9,
  54194. enter: 13,
  54195. space: 32,
  54196. up: 38,
  54197. left: 37,
  54198. right: 39,
  54199. down: 40,
  54200. 'delete': [8, 46]
  54201. };
  54202. // KeyboardEvent.key aliases
  54203. var keyNames = {
  54204. // #7880: IE11 and Edge use `Esc` for Escape key name.
  54205. esc: ['Esc', 'Escape'],
  54206. tab: 'Tab',
  54207. enter: 'Enter',
  54208. // #9112: IE11 uses `Spacebar` for Space key name.
  54209. space: [' ', 'Spacebar'],
  54210. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  54211. up: ['Up', 'ArrowUp'],
  54212. left: ['Left', 'ArrowLeft'],
  54213. right: ['Right', 'ArrowRight'],
  54214. down: ['Down', 'ArrowDown'],
  54215. // #9112: IE11 uses `Del` for Delete key name.
  54216. 'delete': ['Backspace', 'Delete', 'Del']
  54217. };
  54218. // #4868: modifiers that prevent the execution of the listener
  54219. // need to explicitly return null so that we can determine whether to remove
  54220. // the listener for .once
  54221. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  54222. var modifierCode = {
  54223. stop: '$event.stopPropagation();',
  54224. prevent: '$event.preventDefault();',
  54225. self: genGuard("$event.target !== $event.currentTarget"),
  54226. ctrl: genGuard("!$event.ctrlKey"),
  54227. shift: genGuard("!$event.shiftKey"),
  54228. alt: genGuard("!$event.altKey"),
  54229. meta: genGuard("!$event.metaKey"),
  54230. left: genGuard("'button' in $event && $event.button !== 0"),
  54231. middle: genGuard("'button' in $event && $event.button !== 1"),
  54232. right: genGuard("'button' in $event && $event.button !== 2")
  54233. };
  54234. function genHandlers (
  54235. events,
  54236. isNative
  54237. ) {
  54238. var prefix = isNative ? 'nativeOn:' : 'on:';
  54239. var staticHandlers = "";
  54240. var dynamicHandlers = "";
  54241. for (var name in events) {
  54242. var handlerCode = genHandler(events[name]);
  54243. if (events[name] && events[name].dynamic) {
  54244. dynamicHandlers += name + "," + handlerCode + ",";
  54245. } else {
  54246. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  54247. }
  54248. }
  54249. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  54250. if (dynamicHandlers) {
  54251. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  54252. } else {
  54253. return prefix + staticHandlers
  54254. }
  54255. }
  54256. function genHandler (handler) {
  54257. if (!handler) {
  54258. return 'function(){}'
  54259. }
  54260. if (Array.isArray(handler)) {
  54261. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  54262. }
  54263. var isMethodPath = simplePathRE.test(handler.value);
  54264. var isFunctionExpression = fnExpRE.test(handler.value);
  54265. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  54266. if (!handler.modifiers) {
  54267. if (isMethodPath || isFunctionExpression) {
  54268. return handler.value
  54269. }
  54270. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  54271. } else {
  54272. var code = '';
  54273. var genModifierCode = '';
  54274. var keys = [];
  54275. for (var key in handler.modifiers) {
  54276. if (modifierCode[key]) {
  54277. genModifierCode += modifierCode[key];
  54278. // left/right
  54279. if (keyCodes[key]) {
  54280. keys.push(key);
  54281. }
  54282. } else if (key === 'exact') {
  54283. var modifiers = (handler.modifiers);
  54284. genModifierCode += genGuard(
  54285. ['ctrl', 'shift', 'alt', 'meta']
  54286. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  54287. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  54288. .join('||')
  54289. );
  54290. } else {
  54291. keys.push(key);
  54292. }
  54293. }
  54294. if (keys.length) {
  54295. code += genKeyFilter(keys);
  54296. }
  54297. // Make sure modifiers like prevent and stop get executed after key filtering
  54298. if (genModifierCode) {
  54299. code += genModifierCode;
  54300. }
  54301. var handlerCode = isMethodPath
  54302. ? ("return " + (handler.value) + "($event)")
  54303. : isFunctionExpression
  54304. ? ("return (" + (handler.value) + ")($event)")
  54305. : isFunctionInvocation
  54306. ? ("return " + (handler.value))
  54307. : handler.value;
  54308. return ("function($event){" + code + handlerCode + "}")
  54309. }
  54310. }
  54311. function genKeyFilter (keys) {
  54312. return (
  54313. // make sure the key filters only apply to KeyboardEvents
  54314. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  54315. // key events that do not have keyCode property...
  54316. "if(!$event.type.indexOf('key')&&" +
  54317. (keys.map(genFilterCode).join('&&')) + ")return null;"
  54318. )
  54319. }
  54320. function genFilterCode (key) {
  54321. var keyVal = parseInt(key, 10);
  54322. if (keyVal) {
  54323. return ("$event.keyCode!==" + keyVal)
  54324. }
  54325. var keyCode = keyCodes[key];
  54326. var keyName = keyNames[key];
  54327. return (
  54328. "_k($event.keyCode," +
  54329. (JSON.stringify(key)) + "," +
  54330. (JSON.stringify(keyCode)) + "," +
  54331. "$event.key," +
  54332. "" + (JSON.stringify(keyName)) +
  54333. ")"
  54334. )
  54335. }
  54336. /* */
  54337. function on (el, dir) {
  54338. if (dir.modifiers) {
  54339. warn("v-on without argument does not support modifiers.");
  54340. }
  54341. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  54342. }
  54343. /* */
  54344. function bind$1 (el, dir) {
  54345. el.wrapData = function (code) {
  54346. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  54347. };
  54348. }
  54349. /* */
  54350. var baseDirectives = {
  54351. on: on,
  54352. bind: bind$1,
  54353. cloak: noop
  54354. };
  54355. /* */
  54356. var CodegenState = function CodegenState (options) {
  54357. this.options = options;
  54358. this.warn = options.warn || baseWarn;
  54359. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  54360. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  54361. this.directives = extend(extend({}, baseDirectives), options.directives);
  54362. var isReservedTag = options.isReservedTag || no;
  54363. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  54364. this.onceId = 0;
  54365. this.staticRenderFns = [];
  54366. this.pre = false;
  54367. };
  54368. function generate (
  54369. ast,
  54370. options
  54371. ) {
  54372. var state = new CodegenState(options);
  54373. var code = ast ? genElement(ast, state) : '_c("div")';
  54374. return {
  54375. render: ("with(this){return " + code + "}"),
  54376. staticRenderFns: state.staticRenderFns
  54377. }
  54378. }
  54379. function genElement (el, state) {
  54380. if (el.parent) {
  54381. el.pre = el.pre || el.parent.pre;
  54382. }
  54383. if (el.staticRoot && !el.staticProcessed) {
  54384. return genStatic(el, state)
  54385. } else if (el.once && !el.onceProcessed) {
  54386. return genOnce(el, state)
  54387. } else if (el.for && !el.forProcessed) {
  54388. return genFor(el, state)
  54389. } else if (el.if && !el.ifProcessed) {
  54390. return genIf(el, state)
  54391. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  54392. return genChildren(el, state) || 'void 0'
  54393. } else if (el.tag === 'slot') {
  54394. return genSlot(el, state)
  54395. } else {
  54396. // component or element
  54397. var code;
  54398. if (el.component) {
  54399. code = genComponent(el.component, el, state);
  54400. } else {
  54401. var data;
  54402. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  54403. data = genData$2(el, state);
  54404. }
  54405. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54406. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  54407. }
  54408. // module transforms
  54409. for (var i = 0; i < state.transforms.length; i++) {
  54410. code = state.transforms[i](el, code);
  54411. }
  54412. return code
  54413. }
  54414. }
  54415. // hoist static sub-trees out
  54416. function genStatic (el, state) {
  54417. el.staticProcessed = true;
  54418. // Some elements (templates) need to behave differently inside of a v-pre
  54419. // node. All pre nodes are static roots, so we can use this as a location to
  54420. // wrap a state change and reset it upon exiting the pre node.
  54421. var originalPreState = state.pre;
  54422. if (el.pre) {
  54423. state.pre = el.pre;
  54424. }
  54425. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  54426. state.pre = originalPreState;
  54427. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  54428. }
  54429. // v-once
  54430. function genOnce (el, state) {
  54431. el.onceProcessed = true;
  54432. if (el.if && !el.ifProcessed) {
  54433. return genIf(el, state)
  54434. } else if (el.staticInFor) {
  54435. var key = '';
  54436. var parent = el.parent;
  54437. while (parent) {
  54438. if (parent.for) {
  54439. key = parent.key;
  54440. break
  54441. }
  54442. parent = parent.parent;
  54443. }
  54444. if (!key) {
  54445. state.warn(
  54446. "v-once can only be used inside v-for that is keyed. ",
  54447. el.rawAttrsMap['v-once']
  54448. );
  54449. return genElement(el, state)
  54450. }
  54451. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  54452. } else {
  54453. return genStatic(el, state)
  54454. }
  54455. }
  54456. function genIf (
  54457. el,
  54458. state,
  54459. altGen,
  54460. altEmpty
  54461. ) {
  54462. el.ifProcessed = true; // avoid recursion
  54463. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  54464. }
  54465. function genIfConditions (
  54466. conditions,
  54467. state,
  54468. altGen,
  54469. altEmpty
  54470. ) {
  54471. if (!conditions.length) {
  54472. return altEmpty || '_e()'
  54473. }
  54474. var condition = conditions.shift();
  54475. if (condition.exp) {
  54476. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  54477. } else {
  54478. return ("" + (genTernaryExp(condition.block)))
  54479. }
  54480. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  54481. function genTernaryExp (el) {
  54482. return altGen
  54483. ? altGen(el, state)
  54484. : el.once
  54485. ? genOnce(el, state)
  54486. : genElement(el, state)
  54487. }
  54488. }
  54489. function genFor (
  54490. el,
  54491. state,
  54492. altGen,
  54493. altHelper
  54494. ) {
  54495. var exp = el.for;
  54496. var alias = el.alias;
  54497. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  54498. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  54499. if (state.maybeComponent(el) &&
  54500. el.tag !== 'slot' &&
  54501. el.tag !== 'template' &&
  54502. !el.key
  54503. ) {
  54504. state.warn(
  54505. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  54506. "v-for should have explicit keys. " +
  54507. "See https://vuejs.org/guide/list.html#key for more info.",
  54508. el.rawAttrsMap['v-for'],
  54509. true /* tip */
  54510. );
  54511. }
  54512. el.forProcessed = true; // avoid recursion
  54513. return (altHelper || '_l') + "((" + exp + ")," +
  54514. "function(" + alias + iterator1 + iterator2 + "){" +
  54515. "return " + ((altGen || genElement)(el, state)) +
  54516. '})'
  54517. }
  54518. function genData$2 (el, state) {
  54519. var data = '{';
  54520. // directives first.
  54521. // directives may mutate the el's other properties before they are generated.
  54522. var dirs = genDirectives(el, state);
  54523. if (dirs) { data += dirs + ','; }
  54524. // key
  54525. if (el.key) {
  54526. data += "key:" + (el.key) + ",";
  54527. }
  54528. // ref
  54529. if (el.ref) {
  54530. data += "ref:" + (el.ref) + ",";
  54531. }
  54532. if (el.refInFor) {
  54533. data += "refInFor:true,";
  54534. }
  54535. // pre
  54536. if (el.pre) {
  54537. data += "pre:true,";
  54538. }
  54539. // record original tag name for components using "is" attribute
  54540. if (el.component) {
  54541. data += "tag:\"" + (el.tag) + "\",";
  54542. }
  54543. // module data generation functions
  54544. for (var i = 0; i < state.dataGenFns.length; i++) {
  54545. data += state.dataGenFns[i](el);
  54546. }
  54547. // attributes
  54548. if (el.attrs) {
  54549. data += "attrs:" + (genProps(el.attrs)) + ",";
  54550. }
  54551. // DOM props
  54552. if (el.props) {
  54553. data += "domProps:" + (genProps(el.props)) + ",";
  54554. }
  54555. // event handlers
  54556. if (el.events) {
  54557. data += (genHandlers(el.events, false)) + ",";
  54558. }
  54559. if (el.nativeEvents) {
  54560. data += (genHandlers(el.nativeEvents, true)) + ",";
  54561. }
  54562. // slot target
  54563. // only for non-scoped slots
  54564. if (el.slotTarget && !el.slotScope) {
  54565. data += "slot:" + (el.slotTarget) + ",";
  54566. }
  54567. // scoped slots
  54568. if (el.scopedSlots) {
  54569. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  54570. }
  54571. // component v-model
  54572. if (el.model) {
  54573. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  54574. }
  54575. // inline-template
  54576. if (el.inlineTemplate) {
  54577. var inlineTemplate = genInlineTemplate(el, state);
  54578. if (inlineTemplate) {
  54579. data += inlineTemplate + ",";
  54580. }
  54581. }
  54582. data = data.replace(/,$/, '') + '}';
  54583. // v-bind dynamic argument wrap
  54584. // v-bind with dynamic arguments must be applied using the same v-bind object
  54585. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  54586. if (el.dynamicAttrs) {
  54587. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  54588. }
  54589. // v-bind data wrap
  54590. if (el.wrapData) {
  54591. data = el.wrapData(data);
  54592. }
  54593. // v-on data wrap
  54594. if (el.wrapListeners) {
  54595. data = el.wrapListeners(data);
  54596. }
  54597. return data
  54598. }
  54599. function genDirectives (el, state) {
  54600. var dirs = el.directives;
  54601. if (!dirs) { return }
  54602. var res = 'directives:[';
  54603. var hasRuntime = false;
  54604. var i, l, dir, needRuntime;
  54605. for (i = 0, l = dirs.length; i < l; i++) {
  54606. dir = dirs[i];
  54607. needRuntime = true;
  54608. var gen = state.directives[dir.name];
  54609. if (gen) {
  54610. // compile-time directive that manipulates AST.
  54611. // returns true if it also needs a runtime counterpart.
  54612. needRuntime = !!gen(el, dir, state.warn);
  54613. }
  54614. if (needRuntime) {
  54615. hasRuntime = true;
  54616. 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))) : '') + "},";
  54617. }
  54618. }
  54619. if (hasRuntime) {
  54620. return res.slice(0, -1) + ']'
  54621. }
  54622. }
  54623. function genInlineTemplate (el, state) {
  54624. var ast = el.children[0];
  54625. if (el.children.length !== 1 || ast.type !== 1) {
  54626. state.warn(
  54627. 'Inline-template components must have exactly one child element.',
  54628. { start: el.start }
  54629. );
  54630. }
  54631. if (ast && ast.type === 1) {
  54632. var inlineRenderFns = generate(ast, state.options);
  54633. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  54634. }
  54635. }
  54636. function genScopedSlots (
  54637. el,
  54638. slots,
  54639. state
  54640. ) {
  54641. // by default scoped slots are considered "stable", this allows child
  54642. // components with only scoped slots to skip forced updates from parent.
  54643. // but in some cases we have to bail-out of this optimization
  54644. // for example if the slot contains dynamic names, has v-if or v-for on them...
  54645. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  54646. var slot = slots[key];
  54647. return (
  54648. slot.slotTargetDynamic ||
  54649. slot.if ||
  54650. slot.for ||
  54651. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  54652. )
  54653. });
  54654. // #9534: if a component with scoped slots is inside a conditional branch,
  54655. // it's possible for the same component to be reused but with different
  54656. // compiled slot content. To avoid that, we generate a unique key based on
  54657. // the generated code of all the slot contents.
  54658. var needsKey = !!el.if;
  54659. // OR when it is inside another scoped slot or v-for (the reactivity may be
  54660. // disconnected due to the intermediate scope variable)
  54661. // #9438, #9506
  54662. // TODO: this can be further optimized by properly analyzing in-scope bindings
  54663. // and skip force updating ones that do not actually use scope variables.
  54664. if (!needsForceUpdate) {
  54665. var parent = el.parent;
  54666. while (parent) {
  54667. if (
  54668. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  54669. parent.for
  54670. ) {
  54671. needsForceUpdate = true;
  54672. break
  54673. }
  54674. if (parent.if) {
  54675. needsKey = true;
  54676. }
  54677. parent = parent.parent;
  54678. }
  54679. }
  54680. var generatedSlots = Object.keys(slots)
  54681. .map(function (key) { return genScopedSlot(slots[key], state); })
  54682. .join(',');
  54683. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  54684. }
  54685. function hash(str) {
  54686. var hash = 5381;
  54687. var i = str.length;
  54688. while(i) {
  54689. hash = (hash * 33) ^ str.charCodeAt(--i);
  54690. }
  54691. return hash >>> 0
  54692. }
  54693. function containsSlotChild (el) {
  54694. if (el.type === 1) {
  54695. if (el.tag === 'slot') {
  54696. return true
  54697. }
  54698. return el.children.some(containsSlotChild)
  54699. }
  54700. return false
  54701. }
  54702. function genScopedSlot (
  54703. el,
  54704. state
  54705. ) {
  54706. var isLegacySyntax = el.attrsMap['slot-scope'];
  54707. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  54708. return genIf(el, state, genScopedSlot, "null")
  54709. }
  54710. if (el.for && !el.forProcessed) {
  54711. return genFor(el, state, genScopedSlot)
  54712. }
  54713. var slotScope = el.slotScope === emptySlotScopeToken
  54714. ? ""
  54715. : String(el.slotScope);
  54716. var fn = "function(" + slotScope + "){" +
  54717. "return " + (el.tag === 'template'
  54718. ? el.if && isLegacySyntax
  54719. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  54720. : genChildren(el, state) || 'undefined'
  54721. : genElement(el, state)) + "}";
  54722. // reverse proxy v-slot without scope on this.$slots
  54723. var reverseProxy = slotScope ? "" : ",proxy:true";
  54724. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  54725. }
  54726. function genChildren (
  54727. el,
  54728. state,
  54729. checkSkip,
  54730. altGenElement,
  54731. altGenNode
  54732. ) {
  54733. var children = el.children;
  54734. if (children.length) {
  54735. var el$1 = children[0];
  54736. // optimize single v-for
  54737. if (children.length === 1 &&
  54738. el$1.for &&
  54739. el$1.tag !== 'template' &&
  54740. el$1.tag !== 'slot'
  54741. ) {
  54742. var normalizationType = checkSkip
  54743. ? state.maybeComponent(el$1) ? ",1" : ",0"
  54744. : "";
  54745. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  54746. }
  54747. var normalizationType$1 = checkSkip
  54748. ? getNormalizationType(children, state.maybeComponent)
  54749. : 0;
  54750. var gen = altGenNode || genNode;
  54751. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  54752. }
  54753. }
  54754. // determine the normalization needed for the children array.
  54755. // 0: no normalization needed
  54756. // 1: simple normalization needed (possible 1-level deep nested array)
  54757. // 2: full normalization needed
  54758. function getNormalizationType (
  54759. children,
  54760. maybeComponent
  54761. ) {
  54762. var res = 0;
  54763. for (var i = 0; i < children.length; i++) {
  54764. var el = children[i];
  54765. if (el.type !== 1) {
  54766. continue
  54767. }
  54768. if (needsNormalization(el) ||
  54769. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  54770. res = 2;
  54771. break
  54772. }
  54773. if (maybeComponent(el) ||
  54774. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  54775. res = 1;
  54776. }
  54777. }
  54778. return res
  54779. }
  54780. function needsNormalization (el) {
  54781. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  54782. }
  54783. function genNode (node, state) {
  54784. if (node.type === 1) {
  54785. return genElement(node, state)
  54786. } else if (node.type === 3 && node.isComment) {
  54787. return genComment(node)
  54788. } else {
  54789. return genText(node)
  54790. }
  54791. }
  54792. function genText (text) {
  54793. return ("_v(" + (text.type === 2
  54794. ? text.expression // no need for () because already wrapped in _s()
  54795. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  54796. }
  54797. function genComment (comment) {
  54798. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  54799. }
  54800. function genSlot (el, state) {
  54801. var slotName = el.slotName || '"default"';
  54802. var children = genChildren(el, state);
  54803. var res = "_t(" + slotName + (children ? ("," + children) : '');
  54804. var attrs = el.attrs || el.dynamicAttrs
  54805. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  54806. // slot props are camelized
  54807. name: camelize(attr.name),
  54808. value: attr.value,
  54809. dynamic: attr.dynamic
  54810. }); }))
  54811. : null;
  54812. var bind$$1 = el.attrsMap['v-bind'];
  54813. if ((attrs || bind$$1) && !children) {
  54814. res += ",null";
  54815. }
  54816. if (attrs) {
  54817. res += "," + attrs;
  54818. }
  54819. if (bind$$1) {
  54820. res += (attrs ? '' : ',null') + "," + bind$$1;
  54821. }
  54822. return res + ')'
  54823. }
  54824. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  54825. function genComponent (
  54826. componentName,
  54827. el,
  54828. state
  54829. ) {
  54830. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54831. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  54832. }
  54833. function genProps (props) {
  54834. var staticProps = "";
  54835. var dynamicProps = "";
  54836. for (var i = 0; i < props.length; i++) {
  54837. var prop = props[i];
  54838. var value = transformSpecialNewlines(prop.value);
  54839. if (prop.dynamic) {
  54840. dynamicProps += (prop.name) + "," + value + ",";
  54841. } else {
  54842. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  54843. }
  54844. }
  54845. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  54846. if (dynamicProps) {
  54847. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  54848. } else {
  54849. return staticProps
  54850. }
  54851. }
  54852. // #3895, #4268
  54853. function transformSpecialNewlines (text) {
  54854. return text
  54855. .replace(/\u2028/g, '\\u2028')
  54856. .replace(/\u2029/g, '\\u2029')
  54857. }
  54858. /* */
  54859. // these keywords should not appear inside expressions, but operators like
  54860. // typeof, instanceof and in are allowed
  54861. var prohibitedKeywordRE = new RegExp('\\b' + (
  54862. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  54863. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  54864. 'extends,finally,continue,debugger,function,arguments'
  54865. ).split(',').join('\\b|\\b') + '\\b');
  54866. // these unary operators should not be used as property/method names
  54867. var unaryOperatorsRE = new RegExp('\\b' + (
  54868. 'delete,typeof,void'
  54869. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  54870. // strip strings in expressions
  54871. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  54872. // detect problematic expressions in a template
  54873. function detectErrors (ast, warn) {
  54874. if (ast) {
  54875. checkNode(ast, warn);
  54876. }
  54877. }
  54878. function checkNode (node, warn) {
  54879. if (node.type === 1) {
  54880. for (var name in node.attrsMap) {
  54881. if (dirRE.test(name)) {
  54882. var value = node.attrsMap[name];
  54883. if (value) {
  54884. var range = node.rawAttrsMap[name];
  54885. if (name === 'v-for') {
  54886. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  54887. } else if (name === 'v-slot' || name[0] === '#') {
  54888. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  54889. } else if (onRE.test(name)) {
  54890. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  54891. } else {
  54892. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  54893. }
  54894. }
  54895. }
  54896. }
  54897. if (node.children) {
  54898. for (var i = 0; i < node.children.length; i++) {
  54899. checkNode(node.children[i], warn);
  54900. }
  54901. }
  54902. } else if (node.type === 2) {
  54903. checkExpression(node.expression, node.text, warn, node);
  54904. }
  54905. }
  54906. function checkEvent (exp, text, warn, range) {
  54907. var stripped = exp.replace(stripStringRE, '');
  54908. var keywordMatch = stripped.match(unaryOperatorsRE);
  54909. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  54910. warn(
  54911. "avoid using JavaScript unary operator as property name: " +
  54912. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  54913. range
  54914. );
  54915. }
  54916. checkExpression(exp, text, warn, range);
  54917. }
  54918. function checkFor (node, text, warn, range) {
  54919. checkExpression(node.for || '', text, warn, range);
  54920. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  54921. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  54922. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  54923. }
  54924. function checkIdentifier (
  54925. ident,
  54926. type,
  54927. text,
  54928. warn,
  54929. range
  54930. ) {
  54931. if (typeof ident === 'string') {
  54932. try {
  54933. new Function(("var " + ident + "=_"));
  54934. } catch (e) {
  54935. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  54936. }
  54937. }
  54938. }
  54939. function checkExpression (exp, text, warn, range) {
  54940. try {
  54941. new Function(("return " + exp));
  54942. } catch (e) {
  54943. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  54944. if (keywordMatch) {
  54945. warn(
  54946. "avoid using JavaScript keyword as property name: " +
  54947. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  54948. range
  54949. );
  54950. } else {
  54951. warn(
  54952. "invalid expression: " + (e.message) + " in\n\n" +
  54953. " " + exp + "\n\n" +
  54954. " Raw expression: " + (text.trim()) + "\n",
  54955. range
  54956. );
  54957. }
  54958. }
  54959. }
  54960. function checkFunctionParameterExpression (exp, text, warn, range) {
  54961. try {
  54962. new Function(exp, '');
  54963. } catch (e) {
  54964. warn(
  54965. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  54966. " " + exp + "\n\n" +
  54967. " Raw expression: " + (text.trim()) + "\n",
  54968. range
  54969. );
  54970. }
  54971. }
  54972. /* */
  54973. var range = 2;
  54974. function generateCodeFrame (
  54975. source,
  54976. start,
  54977. end
  54978. ) {
  54979. if ( start === void 0 ) start = 0;
  54980. if ( end === void 0 ) end = source.length;
  54981. var lines = source.split(/\r?\n/);
  54982. var count = 0;
  54983. var res = [];
  54984. for (var i = 0; i < lines.length; i++) {
  54985. count += lines[i].length + 1;
  54986. if (count >= start) {
  54987. for (var j = i - range; j <= i + range || end > count; j++) {
  54988. if (j < 0 || j >= lines.length) { continue }
  54989. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  54990. var lineLength = lines[j].length;
  54991. if (j === i) {
  54992. // push underline
  54993. var pad = start - (count - lineLength) + 1;
  54994. var length = end > count ? lineLength - pad : end - start;
  54995. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  54996. } else if (j > i) {
  54997. if (end > count) {
  54998. var length$1 = Math.min(end - count, lineLength);
  54999. res.push(" | " + repeat$1("^", length$1));
  55000. }
  55001. count += lineLength + 1;
  55002. }
  55003. }
  55004. break
  55005. }
  55006. }
  55007. return res.join('\n')
  55008. }
  55009. function repeat$1 (str, n) {
  55010. var result = '';
  55011. if (n > 0) {
  55012. while (true) { // eslint-disable-line
  55013. if (n & 1) { result += str; }
  55014. n >>>= 1;
  55015. if (n <= 0) { break }
  55016. str += str;
  55017. }
  55018. }
  55019. return result
  55020. }
  55021. /* */
  55022. function createFunction (code, errors) {
  55023. try {
  55024. return new Function(code)
  55025. } catch (err) {
  55026. errors.push({ err: err, code: code });
  55027. return noop
  55028. }
  55029. }
  55030. function createCompileToFunctionFn (compile) {
  55031. var cache = Object.create(null);
  55032. return function compileToFunctions (
  55033. template,
  55034. options,
  55035. vm
  55036. ) {
  55037. options = extend({}, options);
  55038. var warn$$1 = options.warn || warn;
  55039. delete options.warn;
  55040. /* istanbul ignore if */
  55041. {
  55042. // detect possible CSP restriction
  55043. try {
  55044. new Function('return 1');
  55045. } catch (e) {
  55046. if (e.toString().match(/unsafe-eval|CSP/)) {
  55047. warn$$1(
  55048. 'It seems you are using the standalone build of Vue.js in an ' +
  55049. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  55050. 'The template compiler cannot work in this environment. Consider ' +
  55051. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  55052. 'templates into render functions.'
  55053. );
  55054. }
  55055. }
  55056. }
  55057. // check cache
  55058. var key = options.delimiters
  55059. ? String(options.delimiters) + template
  55060. : template;
  55061. if (cache[key]) {
  55062. return cache[key]
  55063. }
  55064. // compile
  55065. var compiled = compile(template, options);
  55066. // check compilation errors/tips
  55067. {
  55068. if (compiled.errors && compiled.errors.length) {
  55069. if (options.outputSourceRange) {
  55070. compiled.errors.forEach(function (e) {
  55071. warn$$1(
  55072. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  55073. generateCodeFrame(template, e.start, e.end),
  55074. vm
  55075. );
  55076. });
  55077. } else {
  55078. warn$$1(
  55079. "Error compiling template:\n\n" + template + "\n\n" +
  55080. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  55081. vm
  55082. );
  55083. }
  55084. }
  55085. if (compiled.tips && compiled.tips.length) {
  55086. if (options.outputSourceRange) {
  55087. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  55088. } else {
  55089. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  55090. }
  55091. }
  55092. }
  55093. // turn code into functions
  55094. var res = {};
  55095. var fnGenErrors = [];
  55096. res.render = createFunction(compiled.render, fnGenErrors);
  55097. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  55098. return createFunction(code, fnGenErrors)
  55099. });
  55100. // check function generation errors.
  55101. // this should only happen if there is a bug in the compiler itself.
  55102. // mostly for codegen development use
  55103. /* istanbul ignore if */
  55104. {
  55105. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  55106. warn$$1(
  55107. "Failed to generate render function:\n\n" +
  55108. fnGenErrors.map(function (ref) {
  55109. var err = ref.err;
  55110. var code = ref.code;
  55111. return ((err.toString()) + " in\n\n" + code + "\n");
  55112. }).join('\n'),
  55113. vm
  55114. );
  55115. }
  55116. }
  55117. return (cache[key] = res)
  55118. }
  55119. }
  55120. /* */
  55121. function createCompilerCreator (baseCompile) {
  55122. return function createCompiler (baseOptions) {
  55123. function compile (
  55124. template,
  55125. options
  55126. ) {
  55127. var finalOptions = Object.create(baseOptions);
  55128. var errors = [];
  55129. var tips = [];
  55130. var warn = function (msg, range, tip) {
  55131. (tip ? tips : errors).push(msg);
  55132. };
  55133. if (options) {
  55134. if (options.outputSourceRange) {
  55135. // $flow-disable-line
  55136. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  55137. warn = function (msg, range, tip) {
  55138. var data = { msg: msg };
  55139. if (range) {
  55140. if (range.start != null) {
  55141. data.start = range.start + leadingSpaceLength;
  55142. }
  55143. if (range.end != null) {
  55144. data.end = range.end + leadingSpaceLength;
  55145. }
  55146. }
  55147. (tip ? tips : errors).push(data);
  55148. };
  55149. }
  55150. // merge custom modules
  55151. if (options.modules) {
  55152. finalOptions.modules =
  55153. (baseOptions.modules || []).concat(options.modules);
  55154. }
  55155. // merge custom directives
  55156. if (options.directives) {
  55157. finalOptions.directives = extend(
  55158. Object.create(baseOptions.directives || null),
  55159. options.directives
  55160. );
  55161. }
  55162. // copy other options
  55163. for (var key in options) {
  55164. if (key !== 'modules' && key !== 'directives') {
  55165. finalOptions[key] = options[key];
  55166. }
  55167. }
  55168. }
  55169. finalOptions.warn = warn;
  55170. var compiled = baseCompile(template.trim(), finalOptions);
  55171. {
  55172. detectErrors(compiled.ast, warn);
  55173. }
  55174. compiled.errors = errors;
  55175. compiled.tips = tips;
  55176. return compiled
  55177. }
  55178. return {
  55179. compile: compile,
  55180. compileToFunctions: createCompileToFunctionFn(compile)
  55181. }
  55182. }
  55183. }
  55184. /* */
  55185. // `createCompilerCreator` allows creating compilers that use alternative
  55186. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  55187. // Here we just export a default compiler using the default parts.
  55188. var createCompiler = createCompilerCreator(function baseCompile (
  55189. template,
  55190. options
  55191. ) {
  55192. var ast = parse(template.trim(), options);
  55193. if (options.optimize !== false) {
  55194. optimize(ast, options);
  55195. }
  55196. var code = generate(ast, options);
  55197. return {
  55198. ast: ast,
  55199. render: code.render,
  55200. staticRenderFns: code.staticRenderFns
  55201. }
  55202. });
  55203. /* */
  55204. var ref$1 = createCompiler(baseOptions);
  55205. var compile = ref$1.compile;
  55206. var compileToFunctions = ref$1.compileToFunctions;
  55207. /* */
  55208. // check whether current browser encodes a char inside attribute values
  55209. var div;
  55210. function getShouldDecode (href) {
  55211. div = div || document.createElement('div');
  55212. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  55213. return div.innerHTML.indexOf('&#10;') > 0
  55214. }
  55215. // #3663: IE encodes newlines inside attribute values while other browsers don't
  55216. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  55217. // #6828: chrome encodes content in a[href]
  55218. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  55219. /* */
  55220. var idToTemplate = cached(function (id) {
  55221. var el = query(id);
  55222. return el && el.innerHTML
  55223. });
  55224. var mount = Vue.prototype.$mount;
  55225. Vue.prototype.$mount = function (
  55226. el,
  55227. hydrating
  55228. ) {
  55229. el = el && query(el);
  55230. /* istanbul ignore if */
  55231. if (el === document.body || el === document.documentElement) {
  55232. warn(
  55233. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  55234. );
  55235. return this
  55236. }
  55237. var options = this.$options;
  55238. // resolve template/el and convert to render function
  55239. if (!options.render) {
  55240. var template = options.template;
  55241. if (template) {
  55242. if (typeof template === 'string') {
  55243. if (template.charAt(0) === '#') {
  55244. template = idToTemplate(template);
  55245. /* istanbul ignore if */
  55246. if (!template) {
  55247. warn(
  55248. ("Template element not found or is empty: " + (options.template)),
  55249. this
  55250. );
  55251. }
  55252. }
  55253. } else if (template.nodeType) {
  55254. template = template.innerHTML;
  55255. } else {
  55256. {
  55257. warn('invalid template option:' + template, this);
  55258. }
  55259. return this
  55260. }
  55261. } else if (el) {
  55262. template = getOuterHTML(el);
  55263. }
  55264. if (template) {
  55265. /* istanbul ignore if */
  55266. if (config.performance && mark) {
  55267. mark('compile');
  55268. }
  55269. var ref = compileToFunctions(template, {
  55270. outputSourceRange: "development" !== 'production',
  55271. shouldDecodeNewlines: shouldDecodeNewlines,
  55272. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  55273. delimiters: options.delimiters,
  55274. comments: options.comments
  55275. }, this);
  55276. var render = ref.render;
  55277. var staticRenderFns = ref.staticRenderFns;
  55278. options.render = render;
  55279. options.staticRenderFns = staticRenderFns;
  55280. /* istanbul ignore if */
  55281. if (config.performance && mark) {
  55282. mark('compile end');
  55283. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  55284. }
  55285. }
  55286. }
  55287. return mount.call(this, el, hydrating)
  55288. };
  55289. /**
  55290. * Get outerHTML of elements, taking care
  55291. * of SVG elements in IE as well.
  55292. */
  55293. function getOuterHTML (el) {
  55294. if (el.outerHTML) {
  55295. return el.outerHTML
  55296. } else {
  55297. var container = document.createElement('div');
  55298. container.appendChild(el.cloneNode(true));
  55299. return container.innerHTML
  55300. }
  55301. }
  55302. Vue.compile = compileToFunctions;
  55303. module.exports = Vue;
  55304. /* 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))
  55305. /***/ }),
  55306. /***/ "./node_modules/vue/dist/vue.common.js":
  55307. /*!*********************************************!*\
  55308. !*** ./node_modules/vue/dist/vue.common.js ***!
  55309. \*********************************************/
  55310. /*! no static exports found */
  55311. /***/ (function(module, exports, __webpack_require__) {
  55312. if (false) {} else {
  55313. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  55314. }
  55315. /***/ }),
  55316. /***/ "./node_modules/webpack/buildin/global.js":
  55317. /*!***********************************!*\
  55318. !*** (webpack)/buildin/global.js ***!
  55319. \***********************************/
  55320. /*! no static exports found */
  55321. /***/ (function(module, exports) {
  55322. var g;
  55323. // This works in non-strict mode
  55324. g = (function() {
  55325. return this;
  55326. })();
  55327. try {
  55328. // This works if eval is allowed (see CSP)
  55329. g = g || new Function("return this")();
  55330. } catch (e) {
  55331. // This works if the window reference is available
  55332. if (typeof window === "object") g = window;
  55333. }
  55334. // g can still be undefined, but nothing to do about it...
  55335. // We return undefined, instead of nothing here, so it's
  55336. // easier to handle this case. if(!global) { ...}
  55337. module.exports = g;
  55338. /***/ }),
  55339. /***/ "./node_modules/webpack/buildin/module.js":
  55340. /*!***********************************!*\
  55341. !*** (webpack)/buildin/module.js ***!
  55342. \***********************************/
  55343. /*! no static exports found */
  55344. /***/ (function(module, exports) {
  55345. module.exports = function(module) {
  55346. if (!module.webpackPolyfill) {
  55347. module.deprecate = function() {};
  55348. module.paths = [];
  55349. // module.parent = undefined by default
  55350. if (!module.children) module.children = [];
  55351. Object.defineProperty(module, "loaded", {
  55352. enumerable: true,
  55353. get: function() {
  55354. return module.l;
  55355. }
  55356. });
  55357. Object.defineProperty(module, "id", {
  55358. enumerable: true,
  55359. get: function() {
  55360. return module.i;
  55361. }
  55362. });
  55363. module.webpackPolyfill = 1;
  55364. }
  55365. return module;
  55366. };
  55367. /***/ }),
  55368. /***/ "./resources/js/app.js":
  55369. /*!*****************************!*\
  55370. !*** ./resources/js/app.js ***!
  55371. \*****************************/
  55372. /*! no static exports found */
  55373. /***/ (function(module, exports, __webpack_require__) {
  55374. /**
  55375. * First we will load all of this project's JavaScript dependencies which
  55376. * includes Vue and other libraries. It is a great starting point when
  55377. * building robust, powerful web applications using Vue and Laravel.
  55378. */
  55379. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  55380. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  55381. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  55382. window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  55383. /**
  55384. * The following block of code may be used to automatically register your
  55385. * Vue components. It will recursively scan this directory for the Vue
  55386. * components and automatically register them with their "basename".
  55387. *
  55388. * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
  55389. */
  55390. // const files = require.context('./', true, /\.vue$/i)
  55391. // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
  55392. Vue.component('example-component', __webpack_require__(/*! ./components/ExampleComponent.vue */ "./resources/js/components/ExampleComponent.vue")["default"]);
  55393. Vue.component('woinfo', __webpack_require__(/*! ./components/woinfo.vue */ "./resources/js/components/woinfo.vue")["default"]);
  55394. Vue.component('assetinfo', __webpack_require__(/*! ./components/assetinfo.vue */ "./resources/js/components/assetinfo.vue")["default"]);
  55395. Vue.component('credential', __webpack_require__(/*! ./components/credential.vue */ "./resources/js/components/credential.vue")["default"]);
  55396. Vue.component('notes', __webpack_require__(/*! ./components/notes.vue */ "./resources/js/components/notes.vue")["default"]);
  55397. Vue.component('modal', __webpack_require__(/*! ./components/modal.vue */ "./resources/js/components/modal.vue")["default"]);
  55398. Vue.component('woinfo-edit-modal', __webpack_require__(/*! ./components/woinfo-edit-modal.vue */ "./resources/js/components/woinfo-edit-modal.vue")["default"]);
  55399. Vue.component('errorlist', __webpack_require__(/*! ./components/errorlist.vue */ "./resources/js/components/errorlist.vue")["default"]);
  55400. Vue.component('credential-form-modal', __webpack_require__(/*! ./components/credential-form-modal.vue */ "./resources/js/components/credential-form-modal.vue")["default"]);
  55401. Vue.component('autocomplete-custom-dropdown', __webpack_require__(/*! ./components/autocomplete-custom-dropdown.vue */ "./resources/js/components/autocomplete-custom-dropdown.vue")["default"]);
  55402. Vue.component('credential-list', __webpack_require__(/*! ./components/credential-list.vue */ "./resources/js/components/credential-list.vue")["default"]);
  55403. /**
  55404. * Next, we will create a fresh Vue application instance and attach it to
  55405. * the page. Then, you may begin adding components to this application
  55406. * or customize the JavaScript scaffolding to fit your unique needs.
  55407. */
  55408. var app = new Vue({
  55409. el: '#app'
  55410. });
  55411. $(function () {
  55412. $('[data-toggle="tooltip"]').tooltip();
  55413. });
  55414. var clipboard = new Clipboard('.btn-clip');
  55415. clipboard.on('success', function (e) {
  55416. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  55417. position: "right",
  55418. className: 'success'
  55419. });
  55420. e.clearSelection();
  55421. });
  55422. /***/ }),
  55423. /***/ "./resources/js/bootstrap.js":
  55424. /*!***********************************!*\
  55425. !*** ./resources/js/bootstrap.js ***!
  55426. \***********************************/
  55427. /*! no exports provided */
  55428. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55429. "use strict";
  55430. __webpack_require__.r(__webpack_exports__);
  55431. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  55432. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  55433. /**
  55434. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  55435. * for JavaScript based Bootstrap features such as modals and tabs. This
  55436. * code may be modified to fit the specific needs of your application.
  55437. */
  55438. try {
  55439. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  55440. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  55441. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  55442. } catch (e) {}
  55443. /**
  55444. * We'll load the axios HTTP library which allows us to easily issue requests
  55445. * to our Laravel back-end. This library automatically handles sending the
  55446. * CSRF token as a header based on the value of the "XSRF" token cookie.
  55447. */
  55448. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  55449. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  55450. /**
  55451. * Echo exposes an expressive API for subscribing to channels and listening
  55452. * for events that are broadcast by Laravel. Echo and event broadcasting
  55453. * allows your team to easily build robust real-time web applications.
  55454. */
  55455. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  55456. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  55457. broadcaster: 'pusher',
  55458. key: "upccrt",
  55459. authEndpoint: '/broadcasting/auth',
  55460. wsHost: window.location.hostname,
  55461. wsPort: 6001,
  55462. disableStats: true
  55463. });
  55464. /***/ }),
  55465. /***/ "./resources/js/components/ExampleComponent.vue":
  55466. /*!******************************************************!*\
  55467. !*** ./resources/js/components/ExampleComponent.vue ***!
  55468. \******************************************************/
  55469. /*! exports provided: default */
  55470. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55471. "use strict";
  55472. __webpack_require__.r(__webpack_exports__);
  55473. /* harmony import */ var _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ExampleComponent.vue?vue&type=template&id=299e239e& */ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&");
  55474. /* harmony import */ var _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ExampleComponent.vue?vue&type=script&lang=js& */ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&");
  55475. /* 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");
  55476. /* normalize component */
  55477. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55478. _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55479. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55480. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55481. false,
  55482. null,
  55483. null,
  55484. null
  55485. )
  55486. /* hot reload */
  55487. if (false) { var api; }
  55488. component.options.__file = "resources/js/components/ExampleComponent.vue"
  55489. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55490. /***/ }),
  55491. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  55492. /*!*******************************************************************************!*\
  55493. !*** ./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  55494. \*******************************************************************************/
  55495. /*! exports provided: default */
  55496. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55497. "use strict";
  55498. __webpack_require__.r(__webpack_exports__);
  55499. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./ExampleComponent.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&");
  55500. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55501. /***/ }),
  55502. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  55503. /*!*************************************************************************************!*\
  55504. !*** ./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  55505. \*************************************************************************************/
  55506. /*! exports provided: render, staticRenderFns */
  55507. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55508. "use strict";
  55509. __webpack_require__.r(__webpack_exports__);
  55510. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./ExampleComponent.vue?vue&type=template&id=299e239e& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&");
  55511. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55512. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55513. /***/ }),
  55514. /***/ "./resources/js/components/assetinfo.vue":
  55515. /*!***********************************************!*\
  55516. !*** ./resources/js/components/assetinfo.vue ***!
  55517. \***********************************************/
  55518. /*! exports provided: default */
  55519. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55520. "use strict";
  55521. __webpack_require__.r(__webpack_exports__);
  55522. /* harmony import */ var _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./assetinfo.vue?vue&type=template&id=4fe1d2e3& */ "./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&");
  55523. /* 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&");
  55524. /* 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");
  55525. /* normalize component */
  55526. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55527. _assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55528. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["render"],
  55529. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55530. false,
  55531. null,
  55532. null,
  55533. null
  55534. )
  55535. /* hot reload */
  55536. if (false) { var api; }
  55537. component.options.__file = "resources/js/components/assetinfo.vue"
  55538. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55539. /***/ }),
  55540. /***/ "./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  55541. /*!************************************************************************!*\
  55542. !*** ./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  55543. \************************************************************************/
  55544. /*! exports provided: default */
  55545. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55546. "use strict";
  55547. __webpack_require__.r(__webpack_exports__);
  55548. /* 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&");
  55549. /* 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"]);
  55550. /***/ }),
  55551. /***/ "./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&":
  55552. /*!******************************************************************************!*\
  55553. !*** ./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3& ***!
  55554. \******************************************************************************/
  55555. /*! exports provided: render, staticRenderFns */
  55556. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55557. "use strict";
  55558. __webpack_require__.r(__webpack_exports__);
  55559. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./assetinfo.vue?vue&type=template&id=4fe1d2e3& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&");
  55560. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55561. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55562. /***/ }),
  55563. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue":
  55564. /*!******************************************************************!*\
  55565. !*** ./resources/js/components/autocomplete-custom-dropdown.vue ***!
  55566. \******************************************************************/
  55567. /*! exports provided: default */
  55568. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55569. "use strict";
  55570. __webpack_require__.r(__webpack_exports__);
  55571. /* harmony import */ var _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a& */ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a&");
  55572. /* harmony import */ var _autocomplete_custom_dropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./autocomplete-custom-dropdown.vue?vue&type=script&lang=js& */ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&");
  55573. /* 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");
  55574. /* normalize component */
  55575. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55576. _autocomplete_custom_dropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55577. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["render"],
  55578. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55579. false,
  55580. null,
  55581. null,
  55582. null
  55583. )
  55584. /* hot reload */
  55585. if (false) { var api; }
  55586. component.options.__file = "resources/js/components/autocomplete-custom-dropdown.vue"
  55587. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55588. /***/ }),
  55589. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&":
  55590. /*!*******************************************************************************************!*\
  55591. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js& ***!
  55592. \*******************************************************************************************/
  55593. /*! exports provided: default */
  55594. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55595. "use strict";
  55596. __webpack_require__.r(__webpack_exports__);
  55597. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_autocomplete_custom_dropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./autocomplete-custom-dropdown.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&");
  55598. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_autocomplete_custom_dropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55599. /***/ }),
  55600. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a&":
  55601. /*!*************************************************************************************************!*\
  55602. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a& ***!
  55603. \*************************************************************************************************/
  55604. /*! exports provided: render, staticRenderFns */
  55605. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55606. "use strict";
  55607. __webpack_require__.r(__webpack_exports__);
  55608. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a&");
  55609. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55610. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55611. /***/ }),
  55612. /***/ "./resources/js/components/credential-form-modal.vue":
  55613. /*!***********************************************************!*\
  55614. !*** ./resources/js/components/credential-form-modal.vue ***!
  55615. \***********************************************************/
  55616. /*! exports provided: default */
  55617. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55618. "use strict";
  55619. __webpack_require__.r(__webpack_exports__);
  55620. /* harmony import */ var _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./credential-form-modal.vue?vue&type=template&id=5ba19d42& */ "./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42&");
  55621. /* harmony import */ var _credential_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./credential-form-modal.vue?vue&type=script&lang=js& */ "./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&");
  55622. /* 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");
  55623. /* normalize component */
  55624. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55625. _credential_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55626. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["render"],
  55627. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55628. false,
  55629. null,
  55630. null,
  55631. null
  55632. )
  55633. /* hot reload */
  55634. if (false) { var api; }
  55635. component.options.__file = "resources/js/components/credential-form-modal.vue"
  55636. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55637. /***/ }),
  55638. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&":
  55639. /*!************************************************************************************!*\
  55640. !*** ./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js& ***!
  55641. \************************************************************************************/
  55642. /*! exports provided: default */
  55643. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55644. "use strict";
  55645. __webpack_require__.r(__webpack_exports__);
  55646. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./credential-form-modal.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&");
  55647. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55648. /***/ }),
  55649. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42&":
  55650. /*!******************************************************************************************!*\
  55651. !*** ./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42& ***!
  55652. \******************************************************************************************/
  55653. /*! exports provided: render, staticRenderFns */
  55654. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55655. "use strict";
  55656. __webpack_require__.r(__webpack_exports__);
  55657. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./credential-form-modal.vue?vue&type=template&id=5ba19d42& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42&");
  55658. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55659. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55660. /***/ }),
  55661. /***/ "./resources/js/components/credential-list.vue":
  55662. /*!*****************************************************!*\
  55663. !*** ./resources/js/components/credential-list.vue ***!
  55664. \*****************************************************/
  55665. /*! exports provided: default */
  55666. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55667. "use strict";
  55668. __webpack_require__.r(__webpack_exports__);
  55669. /* harmony import */ var _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./credential-list.vue?vue&type=template&id=06d8fa4e& */ "./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&");
  55670. /* harmony import */ var _credential_list_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./credential-list.vue?vue&type=script&lang=js& */ "./resources/js/components/credential-list.vue?vue&type=script&lang=js&");
  55671. /* 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");
  55672. /* normalize component */
  55673. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55674. _credential_list_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55675. _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55676. _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55677. false,
  55678. null,
  55679. null,
  55680. null
  55681. )
  55682. /* hot reload */
  55683. if (false) { var api; }
  55684. component.options.__file = "resources/js/components/credential-list.vue"
  55685. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55686. /***/ }),
  55687. /***/ "./resources/js/components/credential-list.vue?vue&type=script&lang=js&":
  55688. /*!******************************************************************************!*\
  55689. !*** ./resources/js/components/credential-list.vue?vue&type=script&lang=js& ***!
  55690. \******************************************************************************/
  55691. /*! exports provided: default */
  55692. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55693. "use strict";
  55694. __webpack_require__.r(__webpack_exports__);
  55695. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_list_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./credential-list.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-list.vue?vue&type=script&lang=js&");
  55696. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_list_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55697. /***/ }),
  55698. /***/ "./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&":
  55699. /*!************************************************************************************!*\
  55700. !*** ./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e& ***!
  55701. \************************************************************************************/
  55702. /*! exports provided: render, staticRenderFns */
  55703. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55704. "use strict";
  55705. __webpack_require__.r(__webpack_exports__);
  55706. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./credential-list.vue?vue&type=template&id=06d8fa4e& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&");
  55707. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55708. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55709. /***/ }),
  55710. /***/ "./resources/js/components/credential.vue":
  55711. /*!************************************************!*\
  55712. !*** ./resources/js/components/credential.vue ***!
  55713. \************************************************/
  55714. /*! exports provided: default */
  55715. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55716. "use strict";
  55717. __webpack_require__.r(__webpack_exports__);
  55718. /* harmony import */ var _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./credential.vue?vue&type=template&id=0f5cc562& */ "./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&");
  55719. /* harmony import */ var _credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./credential.vue?vue&type=script&lang=js& */ "./resources/js/components/credential.vue?vue&type=script&lang=js&");
  55720. /* 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");
  55721. /* normalize component */
  55722. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55723. _credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55724. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["render"],
  55725. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55726. false,
  55727. null,
  55728. null,
  55729. null
  55730. )
  55731. /* hot reload */
  55732. if (false) { var api; }
  55733. component.options.__file = "resources/js/components/credential.vue"
  55734. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55735. /***/ }),
  55736. /***/ "./resources/js/components/credential.vue?vue&type=script&lang=js&":
  55737. /*!*************************************************************************!*\
  55738. !*** ./resources/js/components/credential.vue?vue&type=script&lang=js& ***!
  55739. \*************************************************************************/
  55740. /*! exports provided: default */
  55741. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55742. "use strict";
  55743. __webpack_require__.r(__webpack_exports__);
  55744. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./credential.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=script&lang=js&");
  55745. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55746. /***/ }),
  55747. /***/ "./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&":
  55748. /*!*******************************************************************************!*\
  55749. !*** ./resources/js/components/credential.vue?vue&type=template&id=0f5cc562& ***!
  55750. \*******************************************************************************/
  55751. /*! exports provided: render, staticRenderFns */
  55752. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55753. "use strict";
  55754. __webpack_require__.r(__webpack_exports__);
  55755. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./credential.vue?vue&type=template&id=0f5cc562& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&");
  55756. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55757. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55758. /***/ }),
  55759. /***/ "./resources/js/components/errorlist.vue":
  55760. /*!***********************************************!*\
  55761. !*** ./resources/js/components/errorlist.vue ***!
  55762. \***********************************************/
  55763. /*! exports provided: default */
  55764. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55765. "use strict";
  55766. __webpack_require__.r(__webpack_exports__);
  55767. /* harmony import */ var _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./errorlist.vue?vue&type=template&id=1546f5eb& */ "./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb&");
  55768. /* harmony import */ var _errorlist_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./errorlist.vue?vue&type=script&lang=js& */ "./resources/js/components/errorlist.vue?vue&type=script&lang=js&");
  55769. /* 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");
  55770. /* normalize component */
  55771. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55772. _errorlist_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55773. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["render"],
  55774. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55775. false,
  55776. null,
  55777. null,
  55778. null
  55779. )
  55780. /* hot reload */
  55781. if (false) { var api; }
  55782. component.options.__file = "resources/js/components/errorlist.vue"
  55783. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55784. /***/ }),
  55785. /***/ "./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  55786. /*!************************************************************************!*\
  55787. !*** ./resources/js/components/errorlist.vue?vue&type=script&lang=js& ***!
  55788. \************************************************************************/
  55789. /*! exports provided: default */
  55790. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55791. "use strict";
  55792. __webpack_require__.r(__webpack_exports__);
  55793. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_errorlist_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./errorlist.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/errorlist.vue?vue&type=script&lang=js&");
  55794. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_errorlist_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55795. /***/ }),
  55796. /***/ "./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb&":
  55797. /*!******************************************************************************!*\
  55798. !*** ./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb& ***!
  55799. \******************************************************************************/
  55800. /*! exports provided: render, staticRenderFns */
  55801. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55802. "use strict";
  55803. __webpack_require__.r(__webpack_exports__);
  55804. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./errorlist.vue?vue&type=template&id=1546f5eb& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb&");
  55805. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55806. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55807. /***/ }),
  55808. /***/ "./resources/js/components/modal.vue":
  55809. /*!*******************************************!*\
  55810. !*** ./resources/js/components/modal.vue ***!
  55811. \*******************************************/
  55812. /*! exports provided: default */
  55813. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55814. "use strict";
  55815. __webpack_require__.r(__webpack_exports__);
  55816. /* harmony import */ var _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./modal.vue?vue&type=template&id=478d961c& */ "./resources/js/components/modal.vue?vue&type=template&id=478d961c&");
  55817. /* 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");
  55818. var script = {}
  55819. /* normalize component */
  55820. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  55821. script,
  55822. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["render"],
  55823. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55824. false,
  55825. null,
  55826. null,
  55827. null
  55828. )
  55829. /* hot reload */
  55830. if (false) { var api; }
  55831. component.options.__file = "resources/js/components/modal.vue"
  55832. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55833. /***/ }),
  55834. /***/ "./resources/js/components/modal.vue?vue&type=template&id=478d961c&":
  55835. /*!**************************************************************************!*\
  55836. !*** ./resources/js/components/modal.vue?vue&type=template&id=478d961c& ***!
  55837. \**************************************************************************/
  55838. /*! exports provided: render, staticRenderFns */
  55839. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55840. "use strict";
  55841. __webpack_require__.r(__webpack_exports__);
  55842. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./modal.vue?vue&type=template&id=478d961c& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/modal.vue?vue&type=template&id=478d961c&");
  55843. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55844. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55845. /***/ }),
  55846. /***/ "./resources/js/components/notes.vue":
  55847. /*!*******************************************!*\
  55848. !*** ./resources/js/components/notes.vue ***!
  55849. \*******************************************/
  55850. /*! exports provided: default */
  55851. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55852. "use strict";
  55853. __webpack_require__.r(__webpack_exports__);
  55854. /* harmony import */ var _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./notes.vue?vue&type=template&id=73d141f4& */ "./resources/js/components/notes.vue?vue&type=template&id=73d141f4&");
  55855. /* harmony import */ var _notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./notes.vue?vue&type=script&lang=js& */ "./resources/js/components/notes.vue?vue&type=script&lang=js&");
  55856. /* 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");
  55857. /* normalize component */
  55858. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55859. _notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55860. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["render"],
  55861. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55862. false,
  55863. null,
  55864. null,
  55865. null
  55866. )
  55867. /* hot reload */
  55868. if (false) { var api; }
  55869. component.options.__file = "resources/js/components/notes.vue"
  55870. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55871. /***/ }),
  55872. /***/ "./resources/js/components/notes.vue?vue&type=script&lang=js&":
  55873. /*!********************************************************************!*\
  55874. !*** ./resources/js/components/notes.vue?vue&type=script&lang=js& ***!
  55875. \********************************************************************/
  55876. /*! exports provided: default */
  55877. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55878. "use strict";
  55879. __webpack_require__.r(__webpack_exports__);
  55880. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./notes.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=script&lang=js&");
  55881. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55882. /***/ }),
  55883. /***/ "./resources/js/components/notes.vue?vue&type=template&id=73d141f4&":
  55884. /*!**************************************************************************!*\
  55885. !*** ./resources/js/components/notes.vue?vue&type=template&id=73d141f4& ***!
  55886. \**************************************************************************/
  55887. /*! exports provided: render, staticRenderFns */
  55888. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55889. "use strict";
  55890. __webpack_require__.r(__webpack_exports__);
  55891. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./notes.vue?vue&type=template&id=73d141f4& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=template&id=73d141f4&");
  55892. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55893. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55894. /***/ }),
  55895. /***/ "./resources/js/components/woinfo-edit-modal.vue":
  55896. /*!*******************************************************!*\
  55897. !*** ./resources/js/components/woinfo-edit-modal.vue ***!
  55898. \*******************************************************/
  55899. /*! exports provided: default */
  55900. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55901. "use strict";
  55902. __webpack_require__.r(__webpack_exports__);
  55903. /* harmony import */ var _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./woinfo-edit-modal.vue?vue&type=template&id=ad3662d4& */ "./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4&");
  55904. /* harmony import */ var _woinfo_edit_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./woinfo-edit-modal.vue?vue&type=script&lang=js& */ "./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js&");
  55905. /* 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");
  55906. /* normalize component */
  55907. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55908. _woinfo_edit_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55909. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["render"],
  55910. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55911. false,
  55912. null,
  55913. null,
  55914. null
  55915. )
  55916. /* hot reload */
  55917. if (false) { var api; }
  55918. component.options.__file = "resources/js/components/woinfo-edit-modal.vue"
  55919. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55920. /***/ }),
  55921. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js&":
  55922. /*!********************************************************************************!*\
  55923. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js& ***!
  55924. \********************************************************************************/
  55925. /*! exports provided: default */
  55926. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55927. "use strict";
  55928. __webpack_require__.r(__webpack_exports__);
  55929. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_edit_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./woinfo-edit-modal.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js&");
  55930. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_edit_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55931. /***/ }),
  55932. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4&":
  55933. /*!**************************************************************************************!*\
  55934. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4& ***!
  55935. \**************************************************************************************/
  55936. /*! exports provided: render, staticRenderFns */
  55937. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55938. "use strict";
  55939. __webpack_require__.r(__webpack_exports__);
  55940. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./woinfo-edit-modal.vue?vue&type=template&id=ad3662d4& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4&");
  55941. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55942. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55943. /***/ }),
  55944. /***/ "./resources/js/components/woinfo.vue":
  55945. /*!********************************************!*\
  55946. !*** ./resources/js/components/woinfo.vue ***!
  55947. \********************************************/
  55948. /*! exports provided: default */
  55949. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55950. "use strict";
  55951. __webpack_require__.r(__webpack_exports__);
  55952. /* harmony import */ var _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./woinfo.vue?vue&type=template&id=33ce32de& */ "./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&");
  55953. /* harmony import */ var _woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./woinfo.vue?vue&type=script&lang=js& */ "./resources/js/components/woinfo.vue?vue&type=script&lang=js&");
  55954. /* 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");
  55955. /* normalize component */
  55956. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55957. _woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55958. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["render"],
  55959. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55960. false,
  55961. null,
  55962. null,
  55963. null
  55964. )
  55965. /* hot reload */
  55966. if (false) { var api; }
  55967. component.options.__file = "resources/js/components/woinfo.vue"
  55968. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55969. /***/ }),
  55970. /***/ "./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  55971. /*!*********************************************************************!*\
  55972. !*** ./resources/js/components/woinfo.vue?vue&type=script&lang=js& ***!
  55973. \*********************************************************************/
  55974. /*! exports provided: default */
  55975. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55976. "use strict";
  55977. __webpack_require__.r(__webpack_exports__);
  55978. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./woinfo.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=script&lang=js&");
  55979. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55980. /***/ }),
  55981. /***/ "./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&":
  55982. /*!***************************************************************************!*\
  55983. !*** ./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de& ***!
  55984. \***************************************************************************/
  55985. /*! exports provided: render, staticRenderFns */
  55986. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55987. "use strict";
  55988. __webpack_require__.r(__webpack_exports__);
  55989. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./woinfo.vue?vue&type=template&id=33ce32de& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&");
  55990. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55991. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55992. /***/ }),
  55993. /***/ "./resources/js/mixins/dateMixin.js":
  55994. /*!******************************************!*\
  55995. !*** ./resources/js/mixins/dateMixin.js ***!
  55996. \******************************************/
  55997. /*! exports provided: default */
  55998. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55999. "use strict";
  56000. __webpack_require__.r(__webpack_exports__);
  56001. /* harmony default export */ __webpack_exports__["default"] = ({
  56002. methods: {
  56003. treatAsUTC: function treatAsUTC(date) {
  56004. var result = new Date(date);
  56005. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  56006. return result;
  56007. },
  56008. daysSinceToday: function daysSinceToday(date) {
  56009. var currentDate = new Date();
  56010. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  56011. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  56012. },
  56013. getHRDate: function getHRDate(dateString) {
  56014. var date = new Date(dateString);
  56015. return date.toLocaleString('default', {
  56016. month: 'short',
  56017. day: 'numeric',
  56018. year: 'numeric',
  56019. hour: 'numeric',
  56020. minute: 'numeric'
  56021. });
  56022. },
  56023. isZero: function isZero(dateString) {
  56024. return dateString === '0000-00-00 00:00:00';
  56025. }
  56026. }
  56027. });
  56028. /***/ }),
  56029. /***/ "./resources/js/notify.min.js":
  56030. /*!************************************!*\
  56031. !*** ./resources/js/notify.min.js ***!
  56032. \************************************/
  56033. /*! no static exports found */
  56034. /***/ (function(module, exports, __webpack_require__) {
  56035. 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); }
  56036. (function (e) {
  56037. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  56038. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  56039. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  56040. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  56041. })(function (e) {
  56042. function A(t, n, i) {
  56043. typeof i == "string" && (i = {
  56044. className: i
  56045. }), 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);
  56046. }
  56047. var t = [].indexOf || function (e) {
  56048. for (var t = 0, n = this.length; t < n; t++) {
  56049. if (t in this && this[t] === e) return t;
  56050. }
  56051. return -1;
  56052. },
  56053. n = "notify",
  56054. r = n + "js",
  56055. i = n + "!blank",
  56056. s = {
  56057. t: "top",
  56058. m: "middle",
  56059. b: "bottom",
  56060. l: "left",
  56061. c: "center",
  56062. r: "right"
  56063. },
  56064. o = ["l", "c", "r"],
  56065. u = ["t", "m", "b"],
  56066. a = ["t", "b", "l", "r"],
  56067. f = {
  56068. t: "b",
  56069. m: null,
  56070. b: "t",
  56071. l: "r",
  56072. c: null,
  56073. r: "l"
  56074. },
  56075. l = function l(t) {
  56076. var n;
  56077. return n = [], e.each(t.split(/\W+/), function (e, t) {
  56078. var r;
  56079. r = t.toLowerCase().charAt(0);
  56080. if (s[r]) return n.push(r);
  56081. }), n;
  56082. },
  56083. c = {},
  56084. h = {
  56085. name: "core",
  56086. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  56087. 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}"
  56088. },
  56089. p = {
  56090. "border-radius": ["-webkit-", "-moz-"]
  56091. },
  56092. d = function d(e) {
  56093. return c[e];
  56094. },
  56095. v = function v(e) {
  56096. if (!e) throw "Missing Style name";
  56097. c[e] && delete c[e];
  56098. },
  56099. m = function m(t, i) {
  56100. if (!t) throw "Missing Style name";
  56101. if (!i) throw "Missing Style definition";
  56102. if (!i.html) throw "Missing Style HTML";
  56103. var s = c[t];
  56104. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  56105. var o = "";
  56106. i.classes && e.each(i.classes, function (t, n) {
  56107. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  56108. return p[t] && e.each(p[t], function (e, r) {
  56109. return o += " " + r + t + ": " + n + ";\n";
  56110. }), o += " " + t + ": " + n + ";\n";
  56111. }), o += "}\n";
  56112. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  56113. var u = {},
  56114. a = e(i.html);
  56115. y("html", a, u), y("text", a, u), i.fields = u;
  56116. },
  56117. g = function g(t) {
  56118. var n, r, i;
  56119. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  56120. try {
  56121. r.html(t);
  56122. } catch (s) {
  56123. r[0].styleSheet.cssText = t;
  56124. }
  56125. return r;
  56126. },
  56127. y = function y(t, n, r) {
  56128. var s;
  56129. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  56130. var n;
  56131. n = e(this).attr(s), n || (n = i), r[n] = t;
  56132. });
  56133. },
  56134. b = function b(e, t) {
  56135. return e.is(t) ? e : e.find(t);
  56136. },
  56137. w = {
  56138. clickToHide: !0,
  56139. autoHide: !0,
  56140. autoHideDelay: 5e3,
  56141. arrowShow: !0,
  56142. arrowSize: 5,
  56143. breakNewLines: !0,
  56144. elementPosition: "bottom",
  56145. globalPosition: "top right",
  56146. style: "bootstrap",
  56147. className: "error",
  56148. showAnimation: "slideDown",
  56149. showDuration: 400,
  56150. hideAnimation: "slideUp",
  56151. hideDuration: 200,
  56152. gap: 5
  56153. },
  56154. E = function E(t, n) {
  56155. var r;
  56156. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  56157. },
  56158. S = function S(t) {
  56159. return e.extend(w, t);
  56160. },
  56161. x = function x(t) {
  56162. return e("<" + t + "></" + t + ">");
  56163. },
  56164. T = {},
  56165. N = function N(t) {
  56166. var n;
  56167. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  56168. return e(r).attr("name") === t.attr("name");
  56169. }), t = n.first()), t;
  56170. },
  56171. C = function C(e, t, n) {
  56172. var r, i;
  56173. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  56174. if (isNaN(n)) return;
  56175. 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;
  56176. },
  56177. k = function k(e, t, n) {
  56178. if (e === "l" || e === "t") return 0;
  56179. if (e === "c" || e === "m") return n / 2 - t / 2;
  56180. if (e === "r" || e === "b") return n - t;
  56181. throw "Invalid alignment";
  56182. },
  56183. L = function L(e) {
  56184. return L.e = L.e || x("div"), L.e.text(e).html();
  56185. };
  56186. A.prototype.loadHTML = function () {
  56187. var t;
  56188. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  56189. }, A.prototype.show = function (e, t) {
  56190. var n, r, i, s, o;
  56191. r = function (n) {
  56192. return function () {
  56193. !e && !n.elem && n.destroy();
  56194. if (t) return t();
  56195. };
  56196. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  56197. 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 {
  56198. if (!!o || !!e) return r();
  56199. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  56200. }
  56201. return n.push(r), i[s].apply(i, n);
  56202. }, A.prototype.setGlobalPosition = function () {
  56203. var t = this.getPosition(),
  56204. n = t[0],
  56205. i = t[1],
  56206. o = s[n],
  56207. u = s[i],
  56208. a = n + "|" + i,
  56209. f = T[a];
  56210. if (!f || !document.body.contains(f[0])) {
  56211. f = T[a] = x("div");
  56212. var l = {};
  56213. 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);
  56214. }
  56215. return f.prepend(this.wrapper);
  56216. }, A.prototype.setElementPosition = function () {
  56217. 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;
  56218. 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"];
  56219. for (w = 0, S = B.length; w < S; w++) {
  56220. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  56221. }
  56222. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  56223. if (!this.options.arrowShow) this.arrow.hide();else {
  56224. 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";
  56225. for (E = 0, x = a.length; E < x; E++) {
  56226. D = a[E], P = s[D];
  56227. if (D === L) continue;
  56228. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  56229. }
  56230. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  56231. }
  56232. 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);
  56233. if (r) return this.arrow.removeAttr("style").css(r);
  56234. }, A.prototype.getPosition = function () {
  56235. var e, n, r, i, s, f, c, h;
  56236. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  56237. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  56238. 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";
  56239. return e.length === 2 && (e[2] = e[1]), e;
  56240. }, A.prototype.getStyle = function (e) {
  56241. var t;
  56242. e || (e = this.options.style), e || (e = "default"), t = c[e];
  56243. if (!t) throw "Missing style: " + e;
  56244. return t;
  56245. }, A.prototype.updateClasses = function () {
  56246. var t, n;
  56247. 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) {
  56248. return r + "-" + n.name + "-" + e;
  56249. }).join(" "), this.userContainer.attr("class", t);
  56250. }, A.prototype.run = function (t, n) {
  56251. var r, s, o, u, a;
  56252. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  56253. if (this.container && !t) {
  56254. this.show(!1);
  56255. return;
  56256. }
  56257. if (!this.container && !t) return;
  56258. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  56259. for (o in s) {
  56260. r = s[o], u = this.userFields[o];
  56261. if (!u) continue;
  56262. 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);
  56263. }
  56264. 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));
  56265. }, A.prototype.destroy = function () {
  56266. this.wrapper.data(r, null), this.wrapper.remove();
  56267. }, e[n] = function (t, r, i) {
  56268. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  56269. }, e.fn[n] = function (t, n) {
  56270. return e(this).each(function () {
  56271. var i = N(e(this)).data(r);
  56272. i && i.destroy();
  56273. var s = new A(e(this), t, n);
  56274. }), this;
  56275. }, e.extend(e[n], {
  56276. defaults: S,
  56277. addStyle: m,
  56278. removeStyle: v,
  56279. pluginOptions: w,
  56280. getStyle: d,
  56281. insertCSS: g
  56282. }), m("bootstrap", {
  56283. html: "<div>\n<span data-notify-text></span>\n</div>",
  56284. classes: {
  56285. base: {
  56286. "font-weight": "bold",
  56287. padding: "8px 15px 8px 14px",
  56288. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  56289. "background-color": "#fcf8e3",
  56290. border: "1px solid #fbeed5",
  56291. "border-radius": "4px",
  56292. "white-space": "nowrap",
  56293. "padding-left": "25px",
  56294. "background-repeat": "no-repeat",
  56295. "background-position": "3px 7px"
  56296. },
  56297. error: {
  56298. color: "#B94A48",
  56299. "background-color": "#F2DEDE",
  56300. "border-color": "#EED3D7",
  56301. "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=)"
  56302. },
  56303. success: {
  56304. color: "#468847",
  56305. "background-color": "#DFF0D8",
  56306. "border-color": "#D6E9C6",
  56307. "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==)"
  56308. },
  56309. info: {
  56310. color: "#3A87AD",
  56311. "background-color": "#D9EDF7",
  56312. "border-color": "#BCE8F1",
  56313. "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=)"
  56314. },
  56315. warn: {
  56316. color: "#C09853",
  56317. "background-color": "#FCF8E3",
  56318. "border-color": "#FBEED5",
  56319. "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)"
  56320. }
  56321. }
  56322. }), e(function () {
  56323. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  56324. e(this).trigger("notify-hide");
  56325. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  56326. var n = e(this).data(r);
  56327. n && n.show(!1);
  56328. });
  56329. });
  56330. });
  56331. /***/ }),
  56332. /***/ "./resources/sass/app.scss":
  56333. /*!*********************************!*\
  56334. !*** ./resources/sass/app.scss ***!
  56335. \*********************************/
  56336. /*! no static exports found */
  56337. /***/ (function(module, exports) {
  56338. // removed by extract-text-webpack-plugin
  56339. /***/ }),
  56340. /***/ 0:
  56341. /*!*************************************************************!*\
  56342. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  56343. \*************************************************************/
  56344. /*! no static exports found */
  56345. /***/ (function(module, exports, __webpack_require__) {
  56346. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  56347. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  56348. /***/ })
  56349. /******/ });