app.js 1.8 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786
  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('asset.' + this.data.pcid).listen('AssetUpdated', function (e) {
  1678. _this.data = 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. methods: {
  1993. deleteCred: function deleteCred(index) {
  1994. this.credentials.splice(index, 1);
  1995. }
  1996. },
  1997. mounted: function mounted() {
  1998. var _this = this;
  1999. if (this.pcid) {
  2000. Echo.channel('credlist.pcid.' + this.pcid).listen('CredentialDeleted', function (e) {
  2001. var deletedCred = e.credential;
  2002. var index = _this.credentials.findIndex(function (credential) {
  2003. return credential.credid === deletedCred['credid'];
  2004. });
  2005. console.log(index);
  2006. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2007. _this.deleteCred(index);
  2008. }).listen('CredentialAdded', function (e) {
  2009. _this.credentials.unshift(e.credential);
  2010. });
  2011. }
  2012. if (this.groupid) {
  2013. Echo.channel('credlist.groupid.' + this.groupid).listen('CredentialDeleted', function (e) {
  2014. var deletedCred = e.credential;
  2015. var index = _this.credentials.findIndex(function (credential) {
  2016. return credential.groupid === deletedCred['groupid'];
  2017. });
  2018. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2019. _this.deleteCred(index);
  2020. }).listen('CredentialAdded', function (e) {
  2021. _this.credentials.unshift(e.credential);
  2022. });
  2023. }
  2024. }
  2025. });
  2026. /***/ }),
  2027. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=script&lang=js&":
  2028. /*!*********************************************************************************************************************************************************************!*\
  2029. !*** ./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& ***!
  2030. \*********************************************************************************************************************************************************************/
  2031. /*! exports provided: default */
  2032. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2033. "use strict";
  2034. __webpack_require__.r(__webpack_exports__);
  2035. //
  2036. //
  2037. //
  2038. //
  2039. //
  2040. //
  2041. //
  2042. //
  2043. //
  2044. //
  2045. //
  2046. //
  2047. //
  2048. //
  2049. //
  2050. //
  2051. //
  2052. //
  2053. //
  2054. //
  2055. //
  2056. //
  2057. //
  2058. //
  2059. //
  2060. //
  2061. //
  2062. //
  2063. //
  2064. //
  2065. //
  2066. //
  2067. //
  2068. //
  2069. //
  2070. //
  2071. //
  2072. //
  2073. //
  2074. //
  2075. //
  2076. //
  2077. //
  2078. /* harmony default export */ __webpack_exports__["default"] = ({
  2079. props: ['credential', 'descriptions'],
  2080. data: function data() {
  2081. return {
  2082. data: this.credential,
  2083. creddescList: this.descriptions
  2084. };
  2085. },
  2086. mounted: function mounted() {
  2087. var _this = this;
  2088. Echo.channel('credential.' + this.data.credid).listen('CredentialUpdated', function (e) {
  2089. _this.data = e.credential;
  2090. });
  2091. },
  2092. methods: {
  2093. deleteCredential: function deleteCredential() {
  2094. var _this2 = this;
  2095. axios["delete"]('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  2096. $('#credential' + _this2.data.credid + 'deleteModal').modal('hide');
  2097. })["catch"](function (error) {
  2098. console.error(error);
  2099. });
  2100. }
  2101. }
  2102. });
  2103. /***/ }),
  2104. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  2105. /*!********************************************************************************************************************************************************************!*\
  2106. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/errorlist.vue?vue&type=script&lang=js& ***!
  2107. \********************************************************************************************************************************************************************/
  2108. /*! exports provided: default */
  2109. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2110. "use strict";
  2111. __webpack_require__.r(__webpack_exports__);
  2112. //
  2113. //
  2114. //
  2115. //
  2116. //
  2117. /* harmony default export */ __webpack_exports__["default"] = ({
  2118. props: ['errors'],
  2119. data: function data() {
  2120. return {
  2121. errorList: this.errors
  2122. };
  2123. },
  2124. watch: {
  2125. errors: function errors(newErrors) {
  2126. this.errorList = newErrors;
  2127. }
  2128. }
  2129. });
  2130. /***/ }),
  2131. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=script&lang=js&":
  2132. /*!****************************************************************************************************************************************************************!*\
  2133. !*** ./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& ***!
  2134. \****************************************************************************************************************************************************************/
  2135. /*! exports provided: default */
  2136. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2137. "use strict";
  2138. __webpack_require__.r(__webpack_exports__);
  2139. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2140. //
  2141. //
  2142. //
  2143. //
  2144. //
  2145. //
  2146. //
  2147. //
  2148. //
  2149. //
  2150. //
  2151. //
  2152. //
  2153. //
  2154. //
  2155. //
  2156. //
  2157. //
  2158. //
  2159. //
  2160. //
  2161. //
  2162. //
  2163. //
  2164. //
  2165. //
  2166. //
  2167. //
  2168. //
  2169. //
  2170. //
  2171. //
  2172. //
  2173. //
  2174. //
  2175. //
  2176. //
  2177. //
  2178. //
  2179. /* harmony default export */ __webpack_exports__["default"] = ({
  2180. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2181. props: ['initialnotes', 'authusername'],
  2182. data: function data() {
  2183. return {
  2184. notes: Object.values(this.initialnotes)
  2185. };
  2186. },
  2187. methods: {
  2188. userChanged: function userChanged(index) {
  2189. if (index === 0) {
  2190. return false;
  2191. } else {
  2192. return this.notes[index].noteuser !== this.notes[index - 1].noteuser;
  2193. }
  2194. }
  2195. }
  2196. });
  2197. /***/ }),
  2198. /***/ "./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&":
  2199. /*!****************************************************************************************************************************************************************************!*\
  2200. !*** ./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& ***!
  2201. \****************************************************************************************************************************************************************************/
  2202. /*! exports provided: default */
  2203. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2204. "use strict";
  2205. __webpack_require__.r(__webpack_exports__);
  2206. //
  2207. //
  2208. //
  2209. //
  2210. //
  2211. //
  2212. //
  2213. //
  2214. //
  2215. //
  2216. //
  2217. //
  2218. //
  2219. //
  2220. //
  2221. //
  2222. //
  2223. //
  2224. //
  2225. //
  2226. //
  2227. //
  2228. //
  2229. //
  2230. //
  2231. //
  2232. //
  2233. //
  2234. //
  2235. //
  2236. //
  2237. //
  2238. //
  2239. /* harmony default export */ __webpack_exports__["default"] = ({
  2240. props: ['populateWith', 'storeList', 'modalId'],
  2241. data: function data() {
  2242. return {
  2243. // Copies object from prop, so it doesn't mutate the object
  2244. // from the parent component. Parent component will be updated via
  2245. // Websocket if updateWorkOrder is successful.
  2246. data: JSON.parse(JSON.stringify(this.populateWith)),
  2247. id: this.modalId,
  2248. store: {},
  2249. errors: []
  2250. };
  2251. },
  2252. mounted: function mounted() {
  2253. this.store = {
  2254. 'id': this.data.storeid,
  2255. 'name': this.storeList[this.data.storeid]
  2256. };
  2257. },
  2258. methods: {
  2259. updateWorkOrder: function updateWorkOrder() {
  2260. var _this = this;
  2261. this.data.storeid = this.store.id;
  2262. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {
  2263. $('#workordereditModal').modal('hide');
  2264. })["catch"](function (error) {
  2265. _this.errors = JSON.parse(error.response.request.response).errors;
  2266. });
  2267. }
  2268. }
  2269. });
  2270. /***/ }),
  2271. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  2272. /*!*****************************************************************************************************************************************************************!*\
  2273. !*** ./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& ***!
  2274. \*****************************************************************************************************************************************************************/
  2275. /*! exports provided: default */
  2276. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2277. "use strict";
  2278. __webpack_require__.r(__webpack_exports__);
  2279. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2280. //
  2281. //
  2282. //
  2283. //
  2284. //
  2285. //
  2286. //
  2287. //
  2288. //
  2289. //
  2290. //
  2291. //
  2292. //
  2293. //
  2294. //
  2295. //
  2296. //
  2297. //
  2298. //
  2299. //
  2300. /* harmony default export */ __webpack_exports__["default"] = ({
  2301. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2302. props: ['workOrder', 'stores'],
  2303. data: function data() {
  2304. return {
  2305. data: JSON.parse(this.workOrder)
  2306. };
  2307. },
  2308. computed: {
  2309. storeList: function storeList() {
  2310. var list = {};
  2311. JSON.parse(this.stores).map(function (val) {
  2312. list[val.storeid] = val.storesname;
  2313. });
  2314. return list;
  2315. }
  2316. },
  2317. mounted: function mounted() {
  2318. var _this = this;
  2319. Echo.channel('work-order.' + this.data.woid).listen('WorkOrderUpdated', function (e) {
  2320. _this.data = e.data;
  2321. });
  2322. }
  2323. });
  2324. /***/ }),
  2325. /***/ "./node_modules/base64-js/index.js":
  2326. /*!*****************************************!*\
  2327. !*** ./node_modules/base64-js/index.js ***!
  2328. \*****************************************/
  2329. /*! no static exports found */
  2330. /***/ (function(module, exports, __webpack_require__) {
  2331. "use strict";
  2332. exports.byteLength = byteLength
  2333. exports.toByteArray = toByteArray
  2334. exports.fromByteArray = fromByteArray
  2335. var lookup = []
  2336. var revLookup = []
  2337. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  2338. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  2339. for (var i = 0, len = code.length; i < len; ++i) {
  2340. lookup[i] = code[i]
  2341. revLookup[code.charCodeAt(i)] = i
  2342. }
  2343. // Support decoding URL-safe base64 strings, as Node.js does.
  2344. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  2345. revLookup['-'.charCodeAt(0)] = 62
  2346. revLookup['_'.charCodeAt(0)] = 63
  2347. function getLens (b64) {
  2348. var len = b64.length
  2349. if (len % 4 > 0) {
  2350. throw new Error('Invalid string. Length must be a multiple of 4')
  2351. }
  2352. // Trim off extra bytes after placeholder bytes are found
  2353. // See: https://github.com/beatgammit/base64-js/issues/42
  2354. var validLen = b64.indexOf('=')
  2355. if (validLen === -1) validLen = len
  2356. var placeHoldersLen = validLen === len
  2357. ? 0
  2358. : 4 - (validLen % 4)
  2359. return [validLen, placeHoldersLen]
  2360. }
  2361. // base64 is 4/3 + up to two characters of the original data
  2362. function byteLength (b64) {
  2363. var lens = getLens(b64)
  2364. var validLen = lens[0]
  2365. var placeHoldersLen = lens[1]
  2366. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2367. }
  2368. function _byteLength (b64, validLen, placeHoldersLen) {
  2369. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2370. }
  2371. function toByteArray (b64) {
  2372. var tmp
  2373. var lens = getLens(b64)
  2374. var validLen = lens[0]
  2375. var placeHoldersLen = lens[1]
  2376. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  2377. var curByte = 0
  2378. // if there are placeholders, only get up to the last complete 4 chars
  2379. var len = placeHoldersLen > 0
  2380. ? validLen - 4
  2381. : validLen
  2382. var i
  2383. for (i = 0; i < len; i += 4) {
  2384. tmp =
  2385. (revLookup[b64.charCodeAt(i)] << 18) |
  2386. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  2387. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  2388. revLookup[b64.charCodeAt(i + 3)]
  2389. arr[curByte++] = (tmp >> 16) & 0xFF
  2390. arr[curByte++] = (tmp >> 8) & 0xFF
  2391. arr[curByte++] = tmp & 0xFF
  2392. }
  2393. if (placeHoldersLen === 2) {
  2394. tmp =
  2395. (revLookup[b64.charCodeAt(i)] << 2) |
  2396. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  2397. arr[curByte++] = tmp & 0xFF
  2398. }
  2399. if (placeHoldersLen === 1) {
  2400. tmp =
  2401. (revLookup[b64.charCodeAt(i)] << 10) |
  2402. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  2403. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  2404. arr[curByte++] = (tmp >> 8) & 0xFF
  2405. arr[curByte++] = tmp & 0xFF
  2406. }
  2407. return arr
  2408. }
  2409. function tripletToBase64 (num) {
  2410. return lookup[num >> 18 & 0x3F] +
  2411. lookup[num >> 12 & 0x3F] +
  2412. lookup[num >> 6 & 0x3F] +
  2413. lookup[num & 0x3F]
  2414. }
  2415. function encodeChunk (uint8, start, end) {
  2416. var tmp
  2417. var output = []
  2418. for (var i = start; i < end; i += 3) {
  2419. tmp =
  2420. ((uint8[i] << 16) & 0xFF0000) +
  2421. ((uint8[i + 1] << 8) & 0xFF00) +
  2422. (uint8[i + 2] & 0xFF)
  2423. output.push(tripletToBase64(tmp))
  2424. }
  2425. return output.join('')
  2426. }
  2427. function fromByteArray (uint8) {
  2428. var tmp
  2429. var len = uint8.length
  2430. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  2431. var parts = []
  2432. var maxChunkLength = 16383 // must be multiple of 3
  2433. // go through the array every three bytes, we'll deal with trailing stuff later
  2434. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  2435. parts.push(encodeChunk(
  2436. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  2437. ))
  2438. }
  2439. // pad the end with zeros, but make sure to not forget the extra bytes
  2440. if (extraBytes === 1) {
  2441. tmp = uint8[len - 1]
  2442. parts.push(
  2443. lookup[tmp >> 2] +
  2444. lookup[(tmp << 4) & 0x3F] +
  2445. '=='
  2446. )
  2447. } else if (extraBytes === 2) {
  2448. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  2449. parts.push(
  2450. lookup[tmp >> 10] +
  2451. lookup[(tmp >> 4) & 0x3F] +
  2452. lookup[(tmp << 2) & 0x3F] +
  2453. '='
  2454. )
  2455. }
  2456. return parts.join('')
  2457. }
  2458. /***/ }),
  2459. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  2460. /*!*****************************************************!*\
  2461. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  2462. \*****************************************************/
  2463. /*! no static exports found */
  2464. /***/ (function(module, exports, __webpack_require__) {
  2465. /*!
  2466. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  2467. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  2468. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2469. */
  2470. (function (global, factory) {
  2471. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  2472. undefined;
  2473. }(this, (function (exports, $, Popper) { 'use strict';
  2474. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  2475. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  2476. function _defineProperties(target, props) {
  2477. for (var i = 0; i < props.length; i++) {
  2478. var descriptor = props[i];
  2479. descriptor.enumerable = descriptor.enumerable || false;
  2480. descriptor.configurable = true;
  2481. if ("value" in descriptor) descriptor.writable = true;
  2482. Object.defineProperty(target, descriptor.key, descriptor);
  2483. }
  2484. }
  2485. function _createClass(Constructor, protoProps, staticProps) {
  2486. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2487. if (staticProps) _defineProperties(Constructor, staticProps);
  2488. return Constructor;
  2489. }
  2490. function _defineProperty(obj, key, value) {
  2491. if (key in obj) {
  2492. Object.defineProperty(obj, key, {
  2493. value: value,
  2494. enumerable: true,
  2495. configurable: true,
  2496. writable: true
  2497. });
  2498. } else {
  2499. obj[key] = value;
  2500. }
  2501. return obj;
  2502. }
  2503. function ownKeys(object, enumerableOnly) {
  2504. var keys = Object.keys(object);
  2505. if (Object.getOwnPropertySymbols) {
  2506. var symbols = Object.getOwnPropertySymbols(object);
  2507. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2508. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2509. });
  2510. keys.push.apply(keys, symbols);
  2511. }
  2512. return keys;
  2513. }
  2514. function _objectSpread2(target) {
  2515. for (var i = 1; i < arguments.length; i++) {
  2516. var source = arguments[i] != null ? arguments[i] : {};
  2517. if (i % 2) {
  2518. ownKeys(Object(source), true).forEach(function (key) {
  2519. _defineProperty(target, key, source[key]);
  2520. });
  2521. } else if (Object.getOwnPropertyDescriptors) {
  2522. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2523. } else {
  2524. ownKeys(Object(source)).forEach(function (key) {
  2525. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2526. });
  2527. }
  2528. }
  2529. return target;
  2530. }
  2531. function _inheritsLoose(subClass, superClass) {
  2532. subClass.prototype = Object.create(superClass.prototype);
  2533. subClass.prototype.constructor = subClass;
  2534. subClass.__proto__ = superClass;
  2535. }
  2536. /**
  2537. * --------------------------------------------------------------------------
  2538. * Bootstrap (v4.4.1): util.js
  2539. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2540. * --------------------------------------------------------------------------
  2541. */
  2542. /**
  2543. * ------------------------------------------------------------------------
  2544. * Private TransitionEnd Helpers
  2545. * ------------------------------------------------------------------------
  2546. */
  2547. var TRANSITION_END = 'transitionend';
  2548. var MAX_UID = 1000000;
  2549. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  2550. function toType(obj) {
  2551. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  2552. }
  2553. function getSpecialTransitionEndEvent() {
  2554. return {
  2555. bindType: TRANSITION_END,
  2556. delegateType: TRANSITION_END,
  2557. handle: function handle(event) {
  2558. if ($(event.target).is(this)) {
  2559. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  2560. }
  2561. return undefined; // eslint-disable-line no-undefined
  2562. }
  2563. };
  2564. }
  2565. function transitionEndEmulator(duration) {
  2566. var _this = this;
  2567. var called = false;
  2568. $(this).one(Util.TRANSITION_END, function () {
  2569. called = true;
  2570. });
  2571. setTimeout(function () {
  2572. if (!called) {
  2573. Util.triggerTransitionEnd(_this);
  2574. }
  2575. }, duration);
  2576. return this;
  2577. }
  2578. function setTransitionEndSupport() {
  2579. $.fn.emulateTransitionEnd = transitionEndEmulator;
  2580. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  2581. }
  2582. /**
  2583. * --------------------------------------------------------------------------
  2584. * Public Util Api
  2585. * --------------------------------------------------------------------------
  2586. */
  2587. var Util = {
  2588. TRANSITION_END: 'bsTransitionEnd',
  2589. getUID: function getUID(prefix) {
  2590. do {
  2591. // eslint-disable-next-line no-bitwise
  2592. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  2593. } while (document.getElementById(prefix));
  2594. return prefix;
  2595. },
  2596. getSelectorFromElement: function getSelectorFromElement(element) {
  2597. var selector = element.getAttribute('data-target');
  2598. if (!selector || selector === '#') {
  2599. var hrefAttr = element.getAttribute('href');
  2600. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2601. }
  2602. try {
  2603. return document.querySelector(selector) ? selector : null;
  2604. } catch (err) {
  2605. return null;
  2606. }
  2607. },
  2608. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2609. if (!element) {
  2610. return 0;
  2611. } // Get transition-duration of the element
  2612. var transitionDuration = $(element).css('transition-duration');
  2613. var transitionDelay = $(element).css('transition-delay');
  2614. var floatTransitionDuration = parseFloat(transitionDuration);
  2615. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2616. if (!floatTransitionDuration && !floatTransitionDelay) {
  2617. return 0;
  2618. } // If multiple durations are defined, take the first
  2619. transitionDuration = transitionDuration.split(',')[0];
  2620. transitionDelay = transitionDelay.split(',')[0];
  2621. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2622. },
  2623. reflow: function reflow(element) {
  2624. return element.offsetHeight;
  2625. },
  2626. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2627. $(element).trigger(TRANSITION_END);
  2628. },
  2629. // TODO: Remove in v5
  2630. supportsTransitionEnd: function supportsTransitionEnd() {
  2631. return Boolean(TRANSITION_END);
  2632. },
  2633. isElement: function isElement(obj) {
  2634. return (obj[0] || obj).nodeType;
  2635. },
  2636. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2637. for (var property in configTypes) {
  2638. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2639. var expectedTypes = configTypes[property];
  2640. var value = config[property];
  2641. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2642. if (!new RegExp(expectedTypes).test(valueType)) {
  2643. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2644. }
  2645. }
  2646. }
  2647. },
  2648. findShadowRoot: function findShadowRoot(element) {
  2649. if (!document.documentElement.attachShadow) {
  2650. return null;
  2651. } // Can find the shadow root otherwise it'll return the document
  2652. if (typeof element.getRootNode === 'function') {
  2653. var root = element.getRootNode();
  2654. return root instanceof ShadowRoot ? root : null;
  2655. }
  2656. if (element instanceof ShadowRoot) {
  2657. return element;
  2658. } // when we don't find a shadow root
  2659. if (!element.parentNode) {
  2660. return null;
  2661. }
  2662. return Util.findShadowRoot(element.parentNode);
  2663. },
  2664. jQueryDetection: function jQueryDetection() {
  2665. if (typeof $ === 'undefined') {
  2666. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2667. }
  2668. var version = $.fn.jquery.split(' ')[0].split('.');
  2669. var minMajor = 1;
  2670. var ltMajor = 2;
  2671. var minMinor = 9;
  2672. var minPatch = 1;
  2673. var maxMajor = 4;
  2674. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2675. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2676. }
  2677. }
  2678. };
  2679. Util.jQueryDetection();
  2680. setTransitionEndSupport();
  2681. /**
  2682. * ------------------------------------------------------------------------
  2683. * Constants
  2684. * ------------------------------------------------------------------------
  2685. */
  2686. var NAME = 'alert';
  2687. var VERSION = '4.4.1';
  2688. var DATA_KEY = 'bs.alert';
  2689. var EVENT_KEY = "." + DATA_KEY;
  2690. var DATA_API_KEY = '.data-api';
  2691. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2692. var Selector = {
  2693. DISMISS: '[data-dismiss="alert"]'
  2694. };
  2695. var Event = {
  2696. CLOSE: "close" + EVENT_KEY,
  2697. CLOSED: "closed" + EVENT_KEY,
  2698. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  2699. };
  2700. var ClassName = {
  2701. ALERT: 'alert',
  2702. FADE: 'fade',
  2703. SHOW: 'show'
  2704. };
  2705. /**
  2706. * ------------------------------------------------------------------------
  2707. * Class Definition
  2708. * ------------------------------------------------------------------------
  2709. */
  2710. var Alert =
  2711. /*#__PURE__*/
  2712. function () {
  2713. function Alert(element) {
  2714. this._element = element;
  2715. } // Getters
  2716. var _proto = Alert.prototype;
  2717. // Public
  2718. _proto.close = function close(element) {
  2719. var rootElement = this._element;
  2720. if (element) {
  2721. rootElement = this._getRootElement(element);
  2722. }
  2723. var customEvent = this._triggerCloseEvent(rootElement);
  2724. if (customEvent.isDefaultPrevented()) {
  2725. return;
  2726. }
  2727. this._removeElement(rootElement);
  2728. };
  2729. _proto.dispose = function dispose() {
  2730. $.removeData(this._element, DATA_KEY);
  2731. this._element = null;
  2732. } // Private
  2733. ;
  2734. _proto._getRootElement = function _getRootElement(element) {
  2735. var selector = Util.getSelectorFromElement(element);
  2736. var parent = false;
  2737. if (selector) {
  2738. parent = document.querySelector(selector);
  2739. }
  2740. if (!parent) {
  2741. parent = $(element).closest("." + ClassName.ALERT)[0];
  2742. }
  2743. return parent;
  2744. };
  2745. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2746. var closeEvent = $.Event(Event.CLOSE);
  2747. $(element).trigger(closeEvent);
  2748. return closeEvent;
  2749. };
  2750. _proto._removeElement = function _removeElement(element) {
  2751. var _this = this;
  2752. $(element).removeClass(ClassName.SHOW);
  2753. if (!$(element).hasClass(ClassName.FADE)) {
  2754. this._destroyElement(element);
  2755. return;
  2756. }
  2757. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2758. $(element).one(Util.TRANSITION_END, function (event) {
  2759. return _this._destroyElement(element, event);
  2760. }).emulateTransitionEnd(transitionDuration);
  2761. };
  2762. _proto._destroyElement = function _destroyElement(element) {
  2763. $(element).detach().trigger(Event.CLOSED).remove();
  2764. } // Static
  2765. ;
  2766. Alert._jQueryInterface = function _jQueryInterface(config) {
  2767. return this.each(function () {
  2768. var $element = $(this);
  2769. var data = $element.data(DATA_KEY);
  2770. if (!data) {
  2771. data = new Alert(this);
  2772. $element.data(DATA_KEY, data);
  2773. }
  2774. if (config === 'close') {
  2775. data[config](this);
  2776. }
  2777. });
  2778. };
  2779. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2780. return function (event) {
  2781. if (event) {
  2782. event.preventDefault();
  2783. }
  2784. alertInstance.close(this);
  2785. };
  2786. };
  2787. _createClass(Alert, null, [{
  2788. key: "VERSION",
  2789. get: function get() {
  2790. return VERSION;
  2791. }
  2792. }]);
  2793. return Alert;
  2794. }();
  2795. /**
  2796. * ------------------------------------------------------------------------
  2797. * Data Api implementation
  2798. * ------------------------------------------------------------------------
  2799. */
  2800. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  2801. /**
  2802. * ------------------------------------------------------------------------
  2803. * jQuery
  2804. * ------------------------------------------------------------------------
  2805. */
  2806. $.fn[NAME] = Alert._jQueryInterface;
  2807. $.fn[NAME].Constructor = Alert;
  2808. $.fn[NAME].noConflict = function () {
  2809. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2810. return Alert._jQueryInterface;
  2811. };
  2812. /**
  2813. * ------------------------------------------------------------------------
  2814. * Constants
  2815. * ------------------------------------------------------------------------
  2816. */
  2817. var NAME$1 = 'button';
  2818. var VERSION$1 = '4.4.1';
  2819. var DATA_KEY$1 = 'bs.button';
  2820. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2821. var DATA_API_KEY$1 = '.data-api';
  2822. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2823. var ClassName$1 = {
  2824. ACTIVE: 'active',
  2825. BUTTON: 'btn',
  2826. FOCUS: 'focus'
  2827. };
  2828. var Selector$1 = {
  2829. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  2830. DATA_TOGGLES: '[data-toggle="buttons"]',
  2831. DATA_TOGGLE: '[data-toggle="button"]',
  2832. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  2833. INPUT: 'input:not([type="hidden"])',
  2834. ACTIVE: '.active',
  2835. BUTTON: '.btn'
  2836. };
  2837. var Event$1 = {
  2838. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  2839. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  2840. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  2841. };
  2842. /**
  2843. * ------------------------------------------------------------------------
  2844. * Class Definition
  2845. * ------------------------------------------------------------------------
  2846. */
  2847. var Button =
  2848. /*#__PURE__*/
  2849. function () {
  2850. function Button(element) {
  2851. this._element = element;
  2852. } // Getters
  2853. var _proto = Button.prototype;
  2854. // Public
  2855. _proto.toggle = function toggle() {
  2856. var triggerChangeEvent = true;
  2857. var addAriaPressed = true;
  2858. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2859. if (rootElement) {
  2860. var input = this._element.querySelector(Selector$1.INPUT);
  2861. if (input) {
  2862. if (input.type === 'radio') {
  2863. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2864. triggerChangeEvent = false;
  2865. } else {
  2866. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  2867. if (activeElement) {
  2868. $(activeElement).removeClass(ClassName$1.ACTIVE);
  2869. }
  2870. }
  2871. } else if (input.type === 'checkbox') {
  2872. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  2873. triggerChangeEvent = false;
  2874. }
  2875. } else {
  2876. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  2877. triggerChangeEvent = false;
  2878. }
  2879. if (triggerChangeEvent) {
  2880. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  2881. $(input).trigger('change');
  2882. }
  2883. input.focus();
  2884. addAriaPressed = false;
  2885. }
  2886. }
  2887. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  2888. if (addAriaPressed) {
  2889. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  2890. }
  2891. if (triggerChangeEvent) {
  2892. $(this._element).toggleClass(ClassName$1.ACTIVE);
  2893. }
  2894. }
  2895. };
  2896. _proto.dispose = function dispose() {
  2897. $.removeData(this._element, DATA_KEY$1);
  2898. this._element = null;
  2899. } // Static
  2900. ;
  2901. Button._jQueryInterface = function _jQueryInterface(config) {
  2902. return this.each(function () {
  2903. var data = $(this).data(DATA_KEY$1);
  2904. if (!data) {
  2905. data = new Button(this);
  2906. $(this).data(DATA_KEY$1, data);
  2907. }
  2908. if (config === 'toggle') {
  2909. data[config]();
  2910. }
  2911. });
  2912. };
  2913. _createClass(Button, null, [{
  2914. key: "VERSION",
  2915. get: function get() {
  2916. return VERSION$1;
  2917. }
  2918. }]);
  2919. return Button;
  2920. }();
  2921. /**
  2922. * ------------------------------------------------------------------------
  2923. * Data Api implementation
  2924. * ------------------------------------------------------------------------
  2925. */
  2926. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2927. var button = event.target;
  2928. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  2929. button = $(button).closest(Selector$1.BUTTON)[0];
  2930. }
  2931. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  2932. event.preventDefault(); // work around Firefox bug #1540995
  2933. } else {
  2934. var inputBtn = button.querySelector(Selector$1.INPUT);
  2935. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  2936. event.preventDefault(); // work around Firefox bug #1540995
  2937. return;
  2938. }
  2939. Button._jQueryInterface.call($(button), 'toggle');
  2940. }
  2941. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2942. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  2943. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  2944. });
  2945. $(window).on(Event$1.LOAD_DATA_API, function () {
  2946. // ensure correct active class is set to match the controls' actual values/states
  2947. // find all checkboxes/readio buttons inside data-toggle groups
  2948. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  2949. for (var i = 0, len = buttons.length; i < len; i++) {
  2950. var button = buttons[i];
  2951. var input = button.querySelector(Selector$1.INPUT);
  2952. if (input.checked || input.hasAttribute('checked')) {
  2953. button.classList.add(ClassName$1.ACTIVE);
  2954. } else {
  2955. button.classList.remove(ClassName$1.ACTIVE);
  2956. }
  2957. } // find all button toggles
  2958. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  2959. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  2960. var _button = buttons[_i];
  2961. if (_button.getAttribute('aria-pressed') === 'true') {
  2962. _button.classList.add(ClassName$1.ACTIVE);
  2963. } else {
  2964. _button.classList.remove(ClassName$1.ACTIVE);
  2965. }
  2966. }
  2967. });
  2968. /**
  2969. * ------------------------------------------------------------------------
  2970. * jQuery
  2971. * ------------------------------------------------------------------------
  2972. */
  2973. $.fn[NAME$1] = Button._jQueryInterface;
  2974. $.fn[NAME$1].Constructor = Button;
  2975. $.fn[NAME$1].noConflict = function () {
  2976. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  2977. return Button._jQueryInterface;
  2978. };
  2979. /**
  2980. * ------------------------------------------------------------------------
  2981. * Constants
  2982. * ------------------------------------------------------------------------
  2983. */
  2984. var NAME$2 = 'carousel';
  2985. var VERSION$2 = '4.4.1';
  2986. var DATA_KEY$2 = 'bs.carousel';
  2987. var EVENT_KEY$2 = "." + DATA_KEY$2;
  2988. var DATA_API_KEY$2 = '.data-api';
  2989. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  2990. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  2991. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  2992. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  2993. var SWIPE_THRESHOLD = 40;
  2994. var Default = {
  2995. interval: 5000,
  2996. keyboard: true,
  2997. slide: false,
  2998. pause: 'hover',
  2999. wrap: true,
  3000. touch: true
  3001. };
  3002. var DefaultType = {
  3003. interval: '(number|boolean)',
  3004. keyboard: 'boolean',
  3005. slide: '(boolean|string)',
  3006. pause: '(string|boolean)',
  3007. wrap: 'boolean',
  3008. touch: 'boolean'
  3009. };
  3010. var Direction = {
  3011. NEXT: 'next',
  3012. PREV: 'prev',
  3013. LEFT: 'left',
  3014. RIGHT: 'right'
  3015. };
  3016. var Event$2 = {
  3017. SLIDE: "slide" + EVENT_KEY$2,
  3018. SLID: "slid" + EVENT_KEY$2,
  3019. KEYDOWN: "keydown" + EVENT_KEY$2,
  3020. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  3021. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  3022. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  3023. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  3024. TOUCHEND: "touchend" + EVENT_KEY$2,
  3025. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  3026. POINTERUP: "pointerup" + EVENT_KEY$2,
  3027. DRAG_START: "dragstart" + EVENT_KEY$2,
  3028. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  3029. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  3030. };
  3031. var ClassName$2 = {
  3032. CAROUSEL: 'carousel',
  3033. ACTIVE: 'active',
  3034. SLIDE: 'slide',
  3035. RIGHT: 'carousel-item-right',
  3036. LEFT: 'carousel-item-left',
  3037. NEXT: 'carousel-item-next',
  3038. PREV: 'carousel-item-prev',
  3039. ITEM: 'carousel-item',
  3040. POINTER_EVENT: 'pointer-event'
  3041. };
  3042. var Selector$2 = {
  3043. ACTIVE: '.active',
  3044. ACTIVE_ITEM: '.active.carousel-item',
  3045. ITEM: '.carousel-item',
  3046. ITEM_IMG: '.carousel-item img',
  3047. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  3048. INDICATORS: '.carousel-indicators',
  3049. DATA_SLIDE: '[data-slide], [data-slide-to]',
  3050. DATA_RIDE: '[data-ride="carousel"]'
  3051. };
  3052. var PointerType = {
  3053. TOUCH: 'touch',
  3054. PEN: 'pen'
  3055. };
  3056. /**
  3057. * ------------------------------------------------------------------------
  3058. * Class Definition
  3059. * ------------------------------------------------------------------------
  3060. */
  3061. var Carousel =
  3062. /*#__PURE__*/
  3063. function () {
  3064. function Carousel(element, config) {
  3065. this._items = null;
  3066. this._interval = null;
  3067. this._activeElement = null;
  3068. this._isPaused = false;
  3069. this._isSliding = false;
  3070. this.touchTimeout = null;
  3071. this.touchStartX = 0;
  3072. this.touchDeltaX = 0;
  3073. this._config = this._getConfig(config);
  3074. this._element = element;
  3075. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  3076. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  3077. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  3078. this._addEventListeners();
  3079. } // Getters
  3080. var _proto = Carousel.prototype;
  3081. // Public
  3082. _proto.next = function next() {
  3083. if (!this._isSliding) {
  3084. this._slide(Direction.NEXT);
  3085. }
  3086. };
  3087. _proto.nextWhenVisible = function nextWhenVisible() {
  3088. // Don't call next when the page isn't visible
  3089. // or the carousel or its parent isn't visible
  3090. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  3091. this.next();
  3092. }
  3093. };
  3094. _proto.prev = function prev() {
  3095. if (!this._isSliding) {
  3096. this._slide(Direction.PREV);
  3097. }
  3098. };
  3099. _proto.pause = function pause(event) {
  3100. if (!event) {
  3101. this._isPaused = true;
  3102. }
  3103. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  3104. Util.triggerTransitionEnd(this._element);
  3105. this.cycle(true);
  3106. }
  3107. clearInterval(this._interval);
  3108. this._interval = null;
  3109. };
  3110. _proto.cycle = function cycle(event) {
  3111. if (!event) {
  3112. this._isPaused = false;
  3113. }
  3114. if (this._interval) {
  3115. clearInterval(this._interval);
  3116. this._interval = null;
  3117. }
  3118. if (this._config.interval && !this._isPaused) {
  3119. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  3120. }
  3121. };
  3122. _proto.to = function to(index) {
  3123. var _this = this;
  3124. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3125. var activeIndex = this._getItemIndex(this._activeElement);
  3126. if (index > this._items.length - 1 || index < 0) {
  3127. return;
  3128. }
  3129. if (this._isSliding) {
  3130. $(this._element).one(Event$2.SLID, function () {
  3131. return _this.to(index);
  3132. });
  3133. return;
  3134. }
  3135. if (activeIndex === index) {
  3136. this.pause();
  3137. this.cycle();
  3138. return;
  3139. }
  3140. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  3141. this._slide(direction, this._items[index]);
  3142. };
  3143. _proto.dispose = function dispose() {
  3144. $(this._element).off(EVENT_KEY$2);
  3145. $.removeData(this._element, DATA_KEY$2);
  3146. this._items = null;
  3147. this._config = null;
  3148. this._element = null;
  3149. this._interval = null;
  3150. this._isPaused = null;
  3151. this._isSliding = null;
  3152. this._activeElement = null;
  3153. this._indicatorsElement = null;
  3154. } // Private
  3155. ;
  3156. _proto._getConfig = function _getConfig(config) {
  3157. config = _objectSpread2({}, Default, {}, config);
  3158. Util.typeCheckConfig(NAME$2, config, DefaultType);
  3159. return config;
  3160. };
  3161. _proto._handleSwipe = function _handleSwipe() {
  3162. var absDeltax = Math.abs(this.touchDeltaX);
  3163. if (absDeltax <= SWIPE_THRESHOLD) {
  3164. return;
  3165. }
  3166. var direction = absDeltax / this.touchDeltaX;
  3167. this.touchDeltaX = 0; // swipe left
  3168. if (direction > 0) {
  3169. this.prev();
  3170. } // swipe right
  3171. if (direction < 0) {
  3172. this.next();
  3173. }
  3174. };
  3175. _proto._addEventListeners = function _addEventListeners() {
  3176. var _this2 = this;
  3177. if (this._config.keyboard) {
  3178. $(this._element).on(Event$2.KEYDOWN, function (event) {
  3179. return _this2._keydown(event);
  3180. });
  3181. }
  3182. if (this._config.pause === 'hover') {
  3183. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  3184. return _this2.pause(event);
  3185. }).on(Event$2.MOUSELEAVE, function (event) {
  3186. return _this2.cycle(event);
  3187. });
  3188. }
  3189. if (this._config.touch) {
  3190. this._addTouchEventListeners();
  3191. }
  3192. };
  3193. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  3194. var _this3 = this;
  3195. if (!this._touchSupported) {
  3196. return;
  3197. }
  3198. var start = function start(event) {
  3199. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3200. _this3.touchStartX = event.originalEvent.clientX;
  3201. } else if (!_this3._pointerEvent) {
  3202. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  3203. }
  3204. };
  3205. var move = function move(event) {
  3206. // ensure swiping with one touch and not pinching
  3207. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  3208. _this3.touchDeltaX = 0;
  3209. } else {
  3210. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  3211. }
  3212. };
  3213. var end = function end(event) {
  3214. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3215. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  3216. }
  3217. _this3._handleSwipe();
  3218. if (_this3._config.pause === 'hover') {
  3219. // If it's a touch-enabled device, mouseenter/leave are fired as
  3220. // part of the mouse compatibility events on first tap - the carousel
  3221. // would stop cycling until user tapped out of it;
  3222. // here, we listen for touchend, explicitly pause the carousel
  3223. // (as if it's the second time we tap on it, mouseenter compat event
  3224. // is NOT fired) and after a timeout (to allow for mouse compatibility
  3225. // events to fire) we explicitly restart cycling
  3226. _this3.pause();
  3227. if (_this3.touchTimeout) {
  3228. clearTimeout(_this3.touchTimeout);
  3229. }
  3230. _this3.touchTimeout = setTimeout(function (event) {
  3231. return _this3.cycle(event);
  3232. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  3233. }
  3234. };
  3235. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  3236. return e.preventDefault();
  3237. });
  3238. if (this._pointerEvent) {
  3239. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  3240. return start(event);
  3241. });
  3242. $(this._element).on(Event$2.POINTERUP, function (event) {
  3243. return end(event);
  3244. });
  3245. this._element.classList.add(ClassName$2.POINTER_EVENT);
  3246. } else {
  3247. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  3248. return start(event);
  3249. });
  3250. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  3251. return move(event);
  3252. });
  3253. $(this._element).on(Event$2.TOUCHEND, function (event) {
  3254. return end(event);
  3255. });
  3256. }
  3257. };
  3258. _proto._keydown = function _keydown(event) {
  3259. if (/input|textarea/i.test(event.target.tagName)) {
  3260. return;
  3261. }
  3262. switch (event.which) {
  3263. case ARROW_LEFT_KEYCODE:
  3264. event.preventDefault();
  3265. this.prev();
  3266. break;
  3267. case ARROW_RIGHT_KEYCODE:
  3268. event.preventDefault();
  3269. this.next();
  3270. break;
  3271. }
  3272. };
  3273. _proto._getItemIndex = function _getItemIndex(element) {
  3274. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  3275. return this._items.indexOf(element);
  3276. };
  3277. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  3278. var isNextDirection = direction === Direction.NEXT;
  3279. var isPrevDirection = direction === Direction.PREV;
  3280. var activeIndex = this._getItemIndex(activeElement);
  3281. var lastItemIndex = this._items.length - 1;
  3282. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  3283. if (isGoingToWrap && !this._config.wrap) {
  3284. return activeElement;
  3285. }
  3286. var delta = direction === Direction.PREV ? -1 : 1;
  3287. var itemIndex = (activeIndex + delta) % this._items.length;
  3288. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  3289. };
  3290. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  3291. var targetIndex = this._getItemIndex(relatedTarget);
  3292. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  3293. var slideEvent = $.Event(Event$2.SLIDE, {
  3294. relatedTarget: relatedTarget,
  3295. direction: eventDirectionName,
  3296. from: fromIndex,
  3297. to: targetIndex
  3298. });
  3299. $(this._element).trigger(slideEvent);
  3300. return slideEvent;
  3301. };
  3302. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  3303. if (this._indicatorsElement) {
  3304. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  3305. $(indicators).removeClass(ClassName$2.ACTIVE);
  3306. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  3307. if (nextIndicator) {
  3308. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  3309. }
  3310. }
  3311. };
  3312. _proto._slide = function _slide(direction, element) {
  3313. var _this4 = this;
  3314. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3315. var activeElementIndex = this._getItemIndex(activeElement);
  3316. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  3317. var nextElementIndex = this._getItemIndex(nextElement);
  3318. var isCycling = Boolean(this._interval);
  3319. var directionalClassName;
  3320. var orderClassName;
  3321. var eventDirectionName;
  3322. if (direction === Direction.NEXT) {
  3323. directionalClassName = ClassName$2.LEFT;
  3324. orderClassName = ClassName$2.NEXT;
  3325. eventDirectionName = Direction.LEFT;
  3326. } else {
  3327. directionalClassName = ClassName$2.RIGHT;
  3328. orderClassName = ClassName$2.PREV;
  3329. eventDirectionName = Direction.RIGHT;
  3330. }
  3331. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  3332. this._isSliding = false;
  3333. return;
  3334. }
  3335. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  3336. if (slideEvent.isDefaultPrevented()) {
  3337. return;
  3338. }
  3339. if (!activeElement || !nextElement) {
  3340. // Some weirdness is happening, so we bail
  3341. return;
  3342. }
  3343. this._isSliding = true;
  3344. if (isCycling) {
  3345. this.pause();
  3346. }
  3347. this._setActiveIndicatorElement(nextElement);
  3348. var slidEvent = $.Event(Event$2.SLID, {
  3349. relatedTarget: nextElement,
  3350. direction: eventDirectionName,
  3351. from: activeElementIndex,
  3352. to: nextElementIndex
  3353. });
  3354. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  3355. $(nextElement).addClass(orderClassName);
  3356. Util.reflow(nextElement);
  3357. $(activeElement).addClass(directionalClassName);
  3358. $(nextElement).addClass(directionalClassName);
  3359. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  3360. if (nextElementInterval) {
  3361. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  3362. this._config.interval = nextElementInterval;
  3363. } else {
  3364. this._config.interval = this._config.defaultInterval || this._config.interval;
  3365. }
  3366. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  3367. $(activeElement).one(Util.TRANSITION_END, function () {
  3368. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  3369. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  3370. _this4._isSliding = false;
  3371. setTimeout(function () {
  3372. return $(_this4._element).trigger(slidEvent);
  3373. }, 0);
  3374. }).emulateTransitionEnd(transitionDuration);
  3375. } else {
  3376. $(activeElement).removeClass(ClassName$2.ACTIVE);
  3377. $(nextElement).addClass(ClassName$2.ACTIVE);
  3378. this._isSliding = false;
  3379. $(this._element).trigger(slidEvent);
  3380. }
  3381. if (isCycling) {
  3382. this.cycle();
  3383. }
  3384. } // Static
  3385. ;
  3386. Carousel._jQueryInterface = function _jQueryInterface(config) {
  3387. return this.each(function () {
  3388. var data = $(this).data(DATA_KEY$2);
  3389. var _config = _objectSpread2({}, Default, {}, $(this).data());
  3390. if (typeof config === 'object') {
  3391. _config = _objectSpread2({}, _config, {}, config);
  3392. }
  3393. var action = typeof config === 'string' ? config : _config.slide;
  3394. if (!data) {
  3395. data = new Carousel(this, _config);
  3396. $(this).data(DATA_KEY$2, data);
  3397. }
  3398. if (typeof config === 'number') {
  3399. data.to(config);
  3400. } else if (typeof action === 'string') {
  3401. if (typeof data[action] === 'undefined') {
  3402. throw new TypeError("No method named \"" + action + "\"");
  3403. }
  3404. data[action]();
  3405. } else if (_config.interval && _config.ride) {
  3406. data.pause();
  3407. data.cycle();
  3408. }
  3409. });
  3410. };
  3411. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  3412. var selector = Util.getSelectorFromElement(this);
  3413. if (!selector) {
  3414. return;
  3415. }
  3416. var target = $(selector)[0];
  3417. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  3418. return;
  3419. }
  3420. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  3421. var slideIndex = this.getAttribute('data-slide-to');
  3422. if (slideIndex) {
  3423. config.interval = false;
  3424. }
  3425. Carousel._jQueryInterface.call($(target), config);
  3426. if (slideIndex) {
  3427. $(target).data(DATA_KEY$2).to(slideIndex);
  3428. }
  3429. event.preventDefault();
  3430. };
  3431. _createClass(Carousel, null, [{
  3432. key: "VERSION",
  3433. get: function get() {
  3434. return VERSION$2;
  3435. }
  3436. }, {
  3437. key: "Default",
  3438. get: function get() {
  3439. return Default;
  3440. }
  3441. }]);
  3442. return Carousel;
  3443. }();
  3444. /**
  3445. * ------------------------------------------------------------------------
  3446. * Data Api implementation
  3447. * ------------------------------------------------------------------------
  3448. */
  3449. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  3450. $(window).on(Event$2.LOAD_DATA_API, function () {
  3451. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  3452. for (var i = 0, len = carousels.length; i < len; i++) {
  3453. var $carousel = $(carousels[i]);
  3454. Carousel._jQueryInterface.call($carousel, $carousel.data());
  3455. }
  3456. });
  3457. /**
  3458. * ------------------------------------------------------------------------
  3459. * jQuery
  3460. * ------------------------------------------------------------------------
  3461. */
  3462. $.fn[NAME$2] = Carousel._jQueryInterface;
  3463. $.fn[NAME$2].Constructor = Carousel;
  3464. $.fn[NAME$2].noConflict = function () {
  3465. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  3466. return Carousel._jQueryInterface;
  3467. };
  3468. /**
  3469. * ------------------------------------------------------------------------
  3470. * Constants
  3471. * ------------------------------------------------------------------------
  3472. */
  3473. var NAME$3 = 'collapse';
  3474. var VERSION$3 = '4.4.1';
  3475. var DATA_KEY$3 = 'bs.collapse';
  3476. var EVENT_KEY$3 = "." + DATA_KEY$3;
  3477. var DATA_API_KEY$3 = '.data-api';
  3478. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  3479. var Default$1 = {
  3480. toggle: true,
  3481. parent: ''
  3482. };
  3483. var DefaultType$1 = {
  3484. toggle: 'boolean',
  3485. parent: '(string|element)'
  3486. };
  3487. var Event$3 = {
  3488. SHOW: "show" + EVENT_KEY$3,
  3489. SHOWN: "shown" + EVENT_KEY$3,
  3490. HIDE: "hide" + EVENT_KEY$3,
  3491. HIDDEN: "hidden" + EVENT_KEY$3,
  3492. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  3493. };
  3494. var ClassName$3 = {
  3495. SHOW: 'show',
  3496. COLLAPSE: 'collapse',
  3497. COLLAPSING: 'collapsing',
  3498. COLLAPSED: 'collapsed'
  3499. };
  3500. var Dimension = {
  3501. WIDTH: 'width',
  3502. HEIGHT: 'height'
  3503. };
  3504. var Selector$3 = {
  3505. ACTIVES: '.show, .collapsing',
  3506. DATA_TOGGLE: '[data-toggle="collapse"]'
  3507. };
  3508. /**
  3509. * ------------------------------------------------------------------------
  3510. * Class Definition
  3511. * ------------------------------------------------------------------------
  3512. */
  3513. var Collapse =
  3514. /*#__PURE__*/
  3515. function () {
  3516. function Collapse(element, config) {
  3517. this._isTransitioning = false;
  3518. this._element = element;
  3519. this._config = this._getConfig(config);
  3520. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  3521. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  3522. for (var i = 0, len = toggleList.length; i < len; i++) {
  3523. var elem = toggleList[i];
  3524. var selector = Util.getSelectorFromElement(elem);
  3525. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3526. return foundElem === element;
  3527. });
  3528. if (selector !== null && filterElement.length > 0) {
  3529. this._selector = selector;
  3530. this._triggerArray.push(elem);
  3531. }
  3532. }
  3533. this._parent = this._config.parent ? this._getParent() : null;
  3534. if (!this._config.parent) {
  3535. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3536. }
  3537. if (this._config.toggle) {
  3538. this.toggle();
  3539. }
  3540. } // Getters
  3541. var _proto = Collapse.prototype;
  3542. // Public
  3543. _proto.toggle = function toggle() {
  3544. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  3545. this.hide();
  3546. } else {
  3547. this.show();
  3548. }
  3549. };
  3550. _proto.show = function show() {
  3551. var _this = this;
  3552. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  3553. return;
  3554. }
  3555. var actives;
  3556. var activesData;
  3557. if (this._parent) {
  3558. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  3559. if (typeof _this._config.parent === 'string') {
  3560. return elem.getAttribute('data-parent') === _this._config.parent;
  3561. }
  3562. return elem.classList.contains(ClassName$3.COLLAPSE);
  3563. });
  3564. if (actives.length === 0) {
  3565. actives = null;
  3566. }
  3567. }
  3568. if (actives) {
  3569. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  3570. if (activesData && activesData._isTransitioning) {
  3571. return;
  3572. }
  3573. }
  3574. var startEvent = $.Event(Event$3.SHOW);
  3575. $(this._element).trigger(startEvent);
  3576. if (startEvent.isDefaultPrevented()) {
  3577. return;
  3578. }
  3579. if (actives) {
  3580. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  3581. if (!activesData) {
  3582. $(actives).data(DATA_KEY$3, null);
  3583. }
  3584. }
  3585. var dimension = this._getDimension();
  3586. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  3587. this._element.style[dimension] = 0;
  3588. if (this._triggerArray.length) {
  3589. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  3590. }
  3591. this.setTransitioning(true);
  3592. var complete = function complete() {
  3593. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  3594. _this._element.style[dimension] = '';
  3595. _this.setTransitioning(false);
  3596. $(_this._element).trigger(Event$3.SHOWN);
  3597. };
  3598. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3599. var scrollSize = "scroll" + capitalizedDimension;
  3600. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3601. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3602. this._element.style[dimension] = this._element[scrollSize] + "px";
  3603. };
  3604. _proto.hide = function hide() {
  3605. var _this2 = this;
  3606. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  3607. return;
  3608. }
  3609. var startEvent = $.Event(Event$3.HIDE);
  3610. $(this._element).trigger(startEvent);
  3611. if (startEvent.isDefaultPrevented()) {
  3612. return;
  3613. }
  3614. var dimension = this._getDimension();
  3615. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3616. Util.reflow(this._element);
  3617. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  3618. var triggerArrayLength = this._triggerArray.length;
  3619. if (triggerArrayLength > 0) {
  3620. for (var i = 0; i < triggerArrayLength; i++) {
  3621. var trigger = this._triggerArray[i];
  3622. var selector = Util.getSelectorFromElement(trigger);
  3623. if (selector !== null) {
  3624. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3625. if (!$elem.hasClass(ClassName$3.SHOW)) {
  3626. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  3627. }
  3628. }
  3629. }
  3630. }
  3631. this.setTransitioning(true);
  3632. var complete = function complete() {
  3633. _this2.setTransitioning(false);
  3634. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  3635. };
  3636. this._element.style[dimension] = '';
  3637. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3638. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3639. };
  3640. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3641. this._isTransitioning = isTransitioning;
  3642. };
  3643. _proto.dispose = function dispose() {
  3644. $.removeData(this._element, DATA_KEY$3);
  3645. this._config = null;
  3646. this._parent = null;
  3647. this._element = null;
  3648. this._triggerArray = null;
  3649. this._isTransitioning = null;
  3650. } // Private
  3651. ;
  3652. _proto._getConfig = function _getConfig(config) {
  3653. config = _objectSpread2({}, Default$1, {}, config);
  3654. config.toggle = Boolean(config.toggle); // Coerce string values
  3655. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3656. return config;
  3657. };
  3658. _proto._getDimension = function _getDimension() {
  3659. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  3660. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  3661. };
  3662. _proto._getParent = function _getParent() {
  3663. var _this3 = this;
  3664. var parent;
  3665. if (Util.isElement(this._config.parent)) {
  3666. parent = this._config.parent; // It's a jQuery object
  3667. if (typeof this._config.parent.jquery !== 'undefined') {
  3668. parent = this._config.parent[0];
  3669. }
  3670. } else {
  3671. parent = document.querySelector(this._config.parent);
  3672. }
  3673. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3674. var children = [].slice.call(parent.querySelectorAll(selector));
  3675. $(children).each(function (i, element) {
  3676. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3677. });
  3678. return parent;
  3679. };
  3680. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3681. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  3682. if (triggerArray.length) {
  3683. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3684. }
  3685. } // Static
  3686. ;
  3687. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3688. var selector = Util.getSelectorFromElement(element);
  3689. return selector ? document.querySelector(selector) : null;
  3690. };
  3691. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3692. return this.each(function () {
  3693. var $this = $(this);
  3694. var data = $this.data(DATA_KEY$3);
  3695. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  3696. if (!data && _config.toggle && /show|hide/.test(config)) {
  3697. _config.toggle = false;
  3698. }
  3699. if (!data) {
  3700. data = new Collapse(this, _config);
  3701. $this.data(DATA_KEY$3, data);
  3702. }
  3703. if (typeof config === 'string') {
  3704. if (typeof data[config] === 'undefined') {
  3705. throw new TypeError("No method named \"" + config + "\"");
  3706. }
  3707. data[config]();
  3708. }
  3709. });
  3710. };
  3711. _createClass(Collapse, null, [{
  3712. key: "VERSION",
  3713. get: function get() {
  3714. return VERSION$3;
  3715. }
  3716. }, {
  3717. key: "Default",
  3718. get: function get() {
  3719. return Default$1;
  3720. }
  3721. }]);
  3722. return Collapse;
  3723. }();
  3724. /**
  3725. * ------------------------------------------------------------------------
  3726. * Data Api implementation
  3727. * ------------------------------------------------------------------------
  3728. */
  3729. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  3730. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3731. if (event.currentTarget.tagName === 'A') {
  3732. event.preventDefault();
  3733. }
  3734. var $trigger = $(this);
  3735. var selector = Util.getSelectorFromElement(this);
  3736. var selectors = [].slice.call(document.querySelectorAll(selector));
  3737. $(selectors).each(function () {
  3738. var $target = $(this);
  3739. var data = $target.data(DATA_KEY$3);
  3740. var config = data ? 'toggle' : $trigger.data();
  3741. Collapse._jQueryInterface.call($target, config);
  3742. });
  3743. });
  3744. /**
  3745. * ------------------------------------------------------------------------
  3746. * jQuery
  3747. * ------------------------------------------------------------------------
  3748. */
  3749. $.fn[NAME$3] = Collapse._jQueryInterface;
  3750. $.fn[NAME$3].Constructor = Collapse;
  3751. $.fn[NAME$3].noConflict = function () {
  3752. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3753. return Collapse._jQueryInterface;
  3754. };
  3755. /**
  3756. * ------------------------------------------------------------------------
  3757. * Constants
  3758. * ------------------------------------------------------------------------
  3759. */
  3760. var NAME$4 = 'dropdown';
  3761. var VERSION$4 = '4.4.1';
  3762. var DATA_KEY$4 = 'bs.dropdown';
  3763. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3764. var DATA_API_KEY$4 = '.data-api';
  3765. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3766. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3767. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3768. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3769. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3770. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3771. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3772. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3773. var Event$4 = {
  3774. HIDE: "hide" + EVENT_KEY$4,
  3775. HIDDEN: "hidden" + EVENT_KEY$4,
  3776. SHOW: "show" + EVENT_KEY$4,
  3777. SHOWN: "shown" + EVENT_KEY$4,
  3778. CLICK: "click" + EVENT_KEY$4,
  3779. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3780. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3781. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3782. };
  3783. var ClassName$4 = {
  3784. DISABLED: 'disabled',
  3785. SHOW: 'show',
  3786. DROPUP: 'dropup',
  3787. DROPRIGHT: 'dropright',
  3788. DROPLEFT: 'dropleft',
  3789. MENURIGHT: 'dropdown-menu-right',
  3790. MENULEFT: 'dropdown-menu-left',
  3791. POSITION_STATIC: 'position-static'
  3792. };
  3793. var Selector$4 = {
  3794. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3795. FORM_CHILD: '.dropdown form',
  3796. MENU: '.dropdown-menu',
  3797. NAVBAR_NAV: '.navbar-nav',
  3798. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3799. };
  3800. var AttachmentMap = {
  3801. TOP: 'top-start',
  3802. TOPEND: 'top-end',
  3803. BOTTOM: 'bottom-start',
  3804. BOTTOMEND: 'bottom-end',
  3805. RIGHT: 'right-start',
  3806. RIGHTEND: 'right-end',
  3807. LEFT: 'left-start',
  3808. LEFTEND: 'left-end'
  3809. };
  3810. var Default$2 = {
  3811. offset: 0,
  3812. flip: true,
  3813. boundary: 'scrollParent',
  3814. reference: 'toggle',
  3815. display: 'dynamic',
  3816. popperConfig: null
  3817. };
  3818. var DefaultType$2 = {
  3819. offset: '(number|string|function)',
  3820. flip: 'boolean',
  3821. boundary: '(string|element)',
  3822. reference: '(string|element)',
  3823. display: 'string',
  3824. popperConfig: '(null|object)'
  3825. };
  3826. /**
  3827. * ------------------------------------------------------------------------
  3828. * Class Definition
  3829. * ------------------------------------------------------------------------
  3830. */
  3831. var Dropdown =
  3832. /*#__PURE__*/
  3833. function () {
  3834. function Dropdown(element, config) {
  3835. this._element = element;
  3836. this._popper = null;
  3837. this._config = this._getConfig(config);
  3838. this._menu = this._getMenuElement();
  3839. this._inNavbar = this._detectNavbar();
  3840. this._addEventListeners();
  3841. } // Getters
  3842. var _proto = Dropdown.prototype;
  3843. // Public
  3844. _proto.toggle = function toggle() {
  3845. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3846. return;
  3847. }
  3848. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3849. Dropdown._clearMenus();
  3850. if (isActive) {
  3851. return;
  3852. }
  3853. this.show(true);
  3854. };
  3855. _proto.show = function show(usePopper) {
  3856. if (usePopper === void 0) {
  3857. usePopper = false;
  3858. }
  3859. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3860. return;
  3861. }
  3862. var relatedTarget = {
  3863. relatedTarget: this._element
  3864. };
  3865. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3866. var parent = Dropdown._getParentFromElement(this._element);
  3867. $(parent).trigger(showEvent);
  3868. if (showEvent.isDefaultPrevented()) {
  3869. return;
  3870. } // Disable totally Popper.js for Dropdown in Navbar
  3871. if (!this._inNavbar && usePopper) {
  3872. /**
  3873. * Check for Popper dependency
  3874. * Popper - https://popper.js.org
  3875. */
  3876. if (typeof Popper === 'undefined') {
  3877. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3878. }
  3879. var referenceElement = this._element;
  3880. if (this._config.reference === 'parent') {
  3881. referenceElement = parent;
  3882. } else if (Util.isElement(this._config.reference)) {
  3883. referenceElement = this._config.reference; // Check if it's jQuery element
  3884. if (typeof this._config.reference.jquery !== 'undefined') {
  3885. referenceElement = this._config.reference[0];
  3886. }
  3887. } // If boundary is not `scrollParent`, then set position to `static`
  3888. // to allow the menu to "escape" the scroll parent's boundaries
  3889. // https://github.com/twbs/bootstrap/issues/24251
  3890. if (this._config.boundary !== 'scrollParent') {
  3891. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3892. }
  3893. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3894. } // If this is a touch-enabled device we add extra
  3895. // empty mouseover listeners to the body's immediate children;
  3896. // only needed because of broken event delegation on iOS
  3897. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3898. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  3899. $(document.body).children().on('mouseover', null, $.noop);
  3900. }
  3901. this._element.focus();
  3902. this._element.setAttribute('aria-expanded', true);
  3903. $(this._menu).toggleClass(ClassName$4.SHOW);
  3904. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3905. };
  3906. _proto.hide = function hide() {
  3907. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  3908. return;
  3909. }
  3910. var relatedTarget = {
  3911. relatedTarget: this._element
  3912. };
  3913. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3914. var parent = Dropdown._getParentFromElement(this._element);
  3915. $(parent).trigger(hideEvent);
  3916. if (hideEvent.isDefaultPrevented()) {
  3917. return;
  3918. }
  3919. if (this._popper) {
  3920. this._popper.destroy();
  3921. }
  3922. $(this._menu).toggleClass(ClassName$4.SHOW);
  3923. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3924. };
  3925. _proto.dispose = function dispose() {
  3926. $.removeData(this._element, DATA_KEY$4);
  3927. $(this._element).off(EVENT_KEY$4);
  3928. this._element = null;
  3929. this._menu = null;
  3930. if (this._popper !== null) {
  3931. this._popper.destroy();
  3932. this._popper = null;
  3933. }
  3934. };
  3935. _proto.update = function update() {
  3936. this._inNavbar = this._detectNavbar();
  3937. if (this._popper !== null) {
  3938. this._popper.scheduleUpdate();
  3939. }
  3940. } // Private
  3941. ;
  3942. _proto._addEventListeners = function _addEventListeners() {
  3943. var _this = this;
  3944. $(this._element).on(Event$4.CLICK, function (event) {
  3945. event.preventDefault();
  3946. event.stopPropagation();
  3947. _this.toggle();
  3948. });
  3949. };
  3950. _proto._getConfig = function _getConfig(config) {
  3951. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  3952. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3953. return config;
  3954. };
  3955. _proto._getMenuElement = function _getMenuElement() {
  3956. if (!this._menu) {
  3957. var parent = Dropdown._getParentFromElement(this._element);
  3958. if (parent) {
  3959. this._menu = parent.querySelector(Selector$4.MENU);
  3960. }
  3961. }
  3962. return this._menu;
  3963. };
  3964. _proto._getPlacement = function _getPlacement() {
  3965. var $parentDropdown = $(this._element.parentNode);
  3966. var placement = AttachmentMap.BOTTOM; // Handle dropup
  3967. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  3968. placement = AttachmentMap.TOP;
  3969. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3970. placement = AttachmentMap.TOPEND;
  3971. }
  3972. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  3973. placement = AttachmentMap.RIGHT;
  3974. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  3975. placement = AttachmentMap.LEFT;
  3976. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3977. placement = AttachmentMap.BOTTOMEND;
  3978. }
  3979. return placement;
  3980. };
  3981. _proto._detectNavbar = function _detectNavbar() {
  3982. return $(this._element).closest('.navbar').length > 0;
  3983. };
  3984. _proto._getOffset = function _getOffset() {
  3985. var _this2 = this;
  3986. var offset = {};
  3987. if (typeof this._config.offset === 'function') {
  3988. offset.fn = function (data) {
  3989. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  3990. return data;
  3991. };
  3992. } else {
  3993. offset.offset = this._config.offset;
  3994. }
  3995. return offset;
  3996. };
  3997. _proto._getPopperConfig = function _getPopperConfig() {
  3998. var popperConfig = {
  3999. placement: this._getPlacement(),
  4000. modifiers: {
  4001. offset: this._getOffset(),
  4002. flip: {
  4003. enabled: this._config.flip
  4004. },
  4005. preventOverflow: {
  4006. boundariesElement: this._config.boundary
  4007. }
  4008. }
  4009. }; // Disable Popper.js if we have a static display
  4010. if (this._config.display === 'static') {
  4011. popperConfig.modifiers.applyStyle = {
  4012. enabled: false
  4013. };
  4014. }
  4015. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  4016. } // Static
  4017. ;
  4018. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  4019. return this.each(function () {
  4020. var data = $(this).data(DATA_KEY$4);
  4021. var _config = typeof config === 'object' ? config : null;
  4022. if (!data) {
  4023. data = new Dropdown(this, _config);
  4024. $(this).data(DATA_KEY$4, data);
  4025. }
  4026. if (typeof config === 'string') {
  4027. if (typeof data[config] === 'undefined') {
  4028. throw new TypeError("No method named \"" + config + "\"");
  4029. }
  4030. data[config]();
  4031. }
  4032. });
  4033. };
  4034. Dropdown._clearMenus = function _clearMenus(event) {
  4035. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  4036. return;
  4037. }
  4038. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  4039. for (var i = 0, len = toggles.length; i < len; i++) {
  4040. var parent = Dropdown._getParentFromElement(toggles[i]);
  4041. var context = $(toggles[i]).data(DATA_KEY$4);
  4042. var relatedTarget = {
  4043. relatedTarget: toggles[i]
  4044. };
  4045. if (event && event.type === 'click') {
  4046. relatedTarget.clickEvent = event;
  4047. }
  4048. if (!context) {
  4049. continue;
  4050. }
  4051. var dropdownMenu = context._menu;
  4052. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  4053. continue;
  4054. }
  4055. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  4056. continue;
  4057. }
  4058. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4059. $(parent).trigger(hideEvent);
  4060. if (hideEvent.isDefaultPrevented()) {
  4061. continue;
  4062. } // If this is a touch-enabled device we remove the extra
  4063. // empty mouseover listeners we added for iOS support
  4064. if ('ontouchstart' in document.documentElement) {
  4065. $(document.body).children().off('mouseover', null, $.noop);
  4066. }
  4067. toggles[i].setAttribute('aria-expanded', 'false');
  4068. if (context._popper) {
  4069. context._popper.destroy();
  4070. }
  4071. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  4072. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4073. }
  4074. };
  4075. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  4076. var parent;
  4077. var selector = Util.getSelectorFromElement(element);
  4078. if (selector) {
  4079. parent = document.querySelector(selector);
  4080. }
  4081. return parent || element.parentNode;
  4082. } // eslint-disable-next-line complexity
  4083. ;
  4084. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  4085. // If not input/textarea:
  4086. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  4087. // If input/textarea:
  4088. // - If space key => not a dropdown command
  4089. // - If key is other than escape
  4090. // - If key is not up or down => not a dropdown command
  4091. // - If trigger inside the menu => not a dropdown command
  4092. 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)) {
  4093. return;
  4094. }
  4095. event.preventDefault();
  4096. event.stopPropagation();
  4097. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  4098. return;
  4099. }
  4100. var parent = Dropdown._getParentFromElement(this);
  4101. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  4102. if (!isActive && event.which === ESCAPE_KEYCODE) {
  4103. return;
  4104. }
  4105. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  4106. if (event.which === ESCAPE_KEYCODE) {
  4107. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  4108. $(toggle).trigger('focus');
  4109. }
  4110. $(this).trigger('click');
  4111. return;
  4112. }
  4113. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  4114. return $(item).is(':visible');
  4115. });
  4116. if (items.length === 0) {
  4117. return;
  4118. }
  4119. var index = items.indexOf(event.target);
  4120. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  4121. // Up
  4122. index--;
  4123. }
  4124. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  4125. // Down
  4126. index++;
  4127. }
  4128. if (index < 0) {
  4129. index = 0;
  4130. }
  4131. items[index].focus();
  4132. };
  4133. _createClass(Dropdown, null, [{
  4134. key: "VERSION",
  4135. get: function get() {
  4136. return VERSION$4;
  4137. }
  4138. }, {
  4139. key: "Default",
  4140. get: function get() {
  4141. return Default$2;
  4142. }
  4143. }, {
  4144. key: "DefaultType",
  4145. get: function get() {
  4146. return DefaultType$2;
  4147. }
  4148. }]);
  4149. return Dropdown;
  4150. }();
  4151. /**
  4152. * ------------------------------------------------------------------------
  4153. * Data Api implementation
  4154. * ------------------------------------------------------------------------
  4155. */
  4156. $(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) {
  4157. event.preventDefault();
  4158. event.stopPropagation();
  4159. Dropdown._jQueryInterface.call($(this), 'toggle');
  4160. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  4161. e.stopPropagation();
  4162. });
  4163. /**
  4164. * ------------------------------------------------------------------------
  4165. * jQuery
  4166. * ------------------------------------------------------------------------
  4167. */
  4168. $.fn[NAME$4] = Dropdown._jQueryInterface;
  4169. $.fn[NAME$4].Constructor = Dropdown;
  4170. $.fn[NAME$4].noConflict = function () {
  4171. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  4172. return Dropdown._jQueryInterface;
  4173. };
  4174. /**
  4175. * ------------------------------------------------------------------------
  4176. * Constants
  4177. * ------------------------------------------------------------------------
  4178. */
  4179. var NAME$5 = 'modal';
  4180. var VERSION$5 = '4.4.1';
  4181. var DATA_KEY$5 = 'bs.modal';
  4182. var EVENT_KEY$5 = "." + DATA_KEY$5;
  4183. var DATA_API_KEY$5 = '.data-api';
  4184. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  4185. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  4186. var Default$3 = {
  4187. backdrop: true,
  4188. keyboard: true,
  4189. focus: true,
  4190. show: true
  4191. };
  4192. var DefaultType$3 = {
  4193. backdrop: '(boolean|string)',
  4194. keyboard: 'boolean',
  4195. focus: 'boolean',
  4196. show: 'boolean'
  4197. };
  4198. var Event$5 = {
  4199. HIDE: "hide" + EVENT_KEY$5,
  4200. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  4201. HIDDEN: "hidden" + EVENT_KEY$5,
  4202. SHOW: "show" + EVENT_KEY$5,
  4203. SHOWN: "shown" + EVENT_KEY$5,
  4204. FOCUSIN: "focusin" + EVENT_KEY$5,
  4205. RESIZE: "resize" + EVENT_KEY$5,
  4206. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  4207. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  4208. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  4209. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  4210. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  4211. };
  4212. var ClassName$5 = {
  4213. SCROLLABLE: 'modal-dialog-scrollable',
  4214. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  4215. BACKDROP: 'modal-backdrop',
  4216. OPEN: 'modal-open',
  4217. FADE: 'fade',
  4218. SHOW: 'show',
  4219. STATIC: 'modal-static'
  4220. };
  4221. var Selector$5 = {
  4222. DIALOG: '.modal-dialog',
  4223. MODAL_BODY: '.modal-body',
  4224. DATA_TOGGLE: '[data-toggle="modal"]',
  4225. DATA_DISMISS: '[data-dismiss="modal"]',
  4226. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  4227. STICKY_CONTENT: '.sticky-top'
  4228. };
  4229. /**
  4230. * ------------------------------------------------------------------------
  4231. * Class Definition
  4232. * ------------------------------------------------------------------------
  4233. */
  4234. var Modal =
  4235. /*#__PURE__*/
  4236. function () {
  4237. function Modal(element, config) {
  4238. this._config = this._getConfig(config);
  4239. this._element = element;
  4240. this._dialog = element.querySelector(Selector$5.DIALOG);
  4241. this._backdrop = null;
  4242. this._isShown = false;
  4243. this._isBodyOverflowing = false;
  4244. this._ignoreBackdropClick = false;
  4245. this._isTransitioning = false;
  4246. this._scrollbarWidth = 0;
  4247. } // Getters
  4248. var _proto = Modal.prototype;
  4249. // Public
  4250. _proto.toggle = function toggle(relatedTarget) {
  4251. return this._isShown ? this.hide() : this.show(relatedTarget);
  4252. };
  4253. _proto.show = function show(relatedTarget) {
  4254. var _this = this;
  4255. if (this._isShown || this._isTransitioning) {
  4256. return;
  4257. }
  4258. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4259. this._isTransitioning = true;
  4260. }
  4261. var showEvent = $.Event(Event$5.SHOW, {
  4262. relatedTarget: relatedTarget
  4263. });
  4264. $(this._element).trigger(showEvent);
  4265. if (this._isShown || showEvent.isDefaultPrevented()) {
  4266. return;
  4267. }
  4268. this._isShown = true;
  4269. this._checkScrollbar();
  4270. this._setScrollbar();
  4271. this._adjustDialog();
  4272. this._setEscapeEvent();
  4273. this._setResizeEvent();
  4274. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  4275. return _this.hide(event);
  4276. });
  4277. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  4278. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  4279. if ($(event.target).is(_this._element)) {
  4280. _this._ignoreBackdropClick = true;
  4281. }
  4282. });
  4283. });
  4284. this._showBackdrop(function () {
  4285. return _this._showElement(relatedTarget);
  4286. });
  4287. };
  4288. _proto.hide = function hide(event) {
  4289. var _this2 = this;
  4290. if (event) {
  4291. event.preventDefault();
  4292. }
  4293. if (!this._isShown || this._isTransitioning) {
  4294. return;
  4295. }
  4296. var hideEvent = $.Event(Event$5.HIDE);
  4297. $(this._element).trigger(hideEvent);
  4298. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  4299. return;
  4300. }
  4301. this._isShown = false;
  4302. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4303. if (transition) {
  4304. this._isTransitioning = true;
  4305. }
  4306. this._setEscapeEvent();
  4307. this._setResizeEvent();
  4308. $(document).off(Event$5.FOCUSIN);
  4309. $(this._element).removeClass(ClassName$5.SHOW);
  4310. $(this._element).off(Event$5.CLICK_DISMISS);
  4311. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  4312. if (transition) {
  4313. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4314. $(this._element).one(Util.TRANSITION_END, function (event) {
  4315. return _this2._hideModal(event);
  4316. }).emulateTransitionEnd(transitionDuration);
  4317. } else {
  4318. this._hideModal();
  4319. }
  4320. };
  4321. _proto.dispose = function dispose() {
  4322. [window, this._element, this._dialog].forEach(function (htmlElement) {
  4323. return $(htmlElement).off(EVENT_KEY$5);
  4324. });
  4325. /**
  4326. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  4327. * Do not move `document` in `htmlElements` array
  4328. * It will remove `Event.CLICK_DATA_API` event that should remain
  4329. */
  4330. $(document).off(Event$5.FOCUSIN);
  4331. $.removeData(this._element, DATA_KEY$5);
  4332. this._config = null;
  4333. this._element = null;
  4334. this._dialog = null;
  4335. this._backdrop = null;
  4336. this._isShown = null;
  4337. this._isBodyOverflowing = null;
  4338. this._ignoreBackdropClick = null;
  4339. this._isTransitioning = null;
  4340. this._scrollbarWidth = null;
  4341. };
  4342. _proto.handleUpdate = function handleUpdate() {
  4343. this._adjustDialog();
  4344. } // Private
  4345. ;
  4346. _proto._getConfig = function _getConfig(config) {
  4347. config = _objectSpread2({}, Default$3, {}, config);
  4348. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  4349. return config;
  4350. };
  4351. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  4352. var _this3 = this;
  4353. if (this._config.backdrop === 'static') {
  4354. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  4355. $(this._element).trigger(hideEventPrevented);
  4356. if (hideEventPrevented.defaultPrevented) {
  4357. return;
  4358. }
  4359. this._element.classList.add(ClassName$5.STATIC);
  4360. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  4361. $(this._element).one(Util.TRANSITION_END, function () {
  4362. _this3._element.classList.remove(ClassName$5.STATIC);
  4363. }).emulateTransitionEnd(modalTransitionDuration);
  4364. this._element.focus();
  4365. } else {
  4366. this.hide();
  4367. }
  4368. };
  4369. _proto._showElement = function _showElement(relatedTarget) {
  4370. var _this4 = this;
  4371. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4372. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  4373. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  4374. // Don't move modal's DOM position
  4375. document.body.appendChild(this._element);
  4376. }
  4377. this._element.style.display = 'block';
  4378. this._element.removeAttribute('aria-hidden');
  4379. this._element.setAttribute('aria-modal', true);
  4380. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  4381. modalBody.scrollTop = 0;
  4382. } else {
  4383. this._element.scrollTop = 0;
  4384. }
  4385. if (transition) {
  4386. Util.reflow(this._element);
  4387. }
  4388. $(this._element).addClass(ClassName$5.SHOW);
  4389. if (this._config.focus) {
  4390. this._enforceFocus();
  4391. }
  4392. var shownEvent = $.Event(Event$5.SHOWN, {
  4393. relatedTarget: relatedTarget
  4394. });
  4395. var transitionComplete = function transitionComplete() {
  4396. if (_this4._config.focus) {
  4397. _this4._element.focus();
  4398. }
  4399. _this4._isTransitioning = false;
  4400. $(_this4._element).trigger(shownEvent);
  4401. };
  4402. if (transition) {
  4403. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  4404. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  4405. } else {
  4406. transitionComplete();
  4407. }
  4408. };
  4409. _proto._enforceFocus = function _enforceFocus() {
  4410. var _this5 = this;
  4411. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  4412. .on(Event$5.FOCUSIN, function (event) {
  4413. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  4414. _this5._element.focus();
  4415. }
  4416. });
  4417. };
  4418. _proto._setEscapeEvent = function _setEscapeEvent() {
  4419. var _this6 = this;
  4420. if (this._isShown && this._config.keyboard) {
  4421. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  4422. if (event.which === ESCAPE_KEYCODE$1) {
  4423. _this6._triggerBackdropTransition();
  4424. }
  4425. });
  4426. } else if (!this._isShown) {
  4427. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  4428. }
  4429. };
  4430. _proto._setResizeEvent = function _setResizeEvent() {
  4431. var _this7 = this;
  4432. if (this._isShown) {
  4433. $(window).on(Event$5.RESIZE, function (event) {
  4434. return _this7.handleUpdate(event);
  4435. });
  4436. } else {
  4437. $(window).off(Event$5.RESIZE);
  4438. }
  4439. };
  4440. _proto._hideModal = function _hideModal() {
  4441. var _this8 = this;
  4442. this._element.style.display = 'none';
  4443. this._element.setAttribute('aria-hidden', true);
  4444. this._element.removeAttribute('aria-modal');
  4445. this._isTransitioning = false;
  4446. this._showBackdrop(function () {
  4447. $(document.body).removeClass(ClassName$5.OPEN);
  4448. _this8._resetAdjustments();
  4449. _this8._resetScrollbar();
  4450. $(_this8._element).trigger(Event$5.HIDDEN);
  4451. });
  4452. };
  4453. _proto._removeBackdrop = function _removeBackdrop() {
  4454. if (this._backdrop) {
  4455. $(this._backdrop).remove();
  4456. this._backdrop = null;
  4457. }
  4458. };
  4459. _proto._showBackdrop = function _showBackdrop(callback) {
  4460. var _this9 = this;
  4461. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4462. if (this._isShown && this._config.backdrop) {
  4463. this._backdrop = document.createElement('div');
  4464. this._backdrop.className = ClassName$5.BACKDROP;
  4465. if (animate) {
  4466. this._backdrop.classList.add(animate);
  4467. }
  4468. $(this._backdrop).appendTo(document.body);
  4469. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4470. if (_this9._ignoreBackdropClick) {
  4471. _this9._ignoreBackdropClick = false;
  4472. return;
  4473. }
  4474. if (event.target !== event.currentTarget) {
  4475. return;
  4476. }
  4477. _this9._triggerBackdropTransition();
  4478. });
  4479. if (animate) {
  4480. Util.reflow(this._backdrop);
  4481. }
  4482. $(this._backdrop).addClass(ClassName$5.SHOW);
  4483. if (!callback) {
  4484. return;
  4485. }
  4486. if (!animate) {
  4487. callback();
  4488. return;
  4489. }
  4490. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4491. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4492. } else if (!this._isShown && this._backdrop) {
  4493. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4494. var callbackRemove = function callbackRemove() {
  4495. _this9._removeBackdrop();
  4496. if (callback) {
  4497. callback();
  4498. }
  4499. };
  4500. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4501. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4502. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4503. } else {
  4504. callbackRemove();
  4505. }
  4506. } else if (callback) {
  4507. callback();
  4508. }
  4509. } // ----------------------------------------------------------------------
  4510. // the following methods are used to handle overflowing modals
  4511. // todo (fat): these should probably be refactored out of modal.js
  4512. // ----------------------------------------------------------------------
  4513. ;
  4514. _proto._adjustDialog = function _adjustDialog() {
  4515. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4516. if (!this._isBodyOverflowing && isModalOverflowing) {
  4517. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4518. }
  4519. if (this._isBodyOverflowing && !isModalOverflowing) {
  4520. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4521. }
  4522. };
  4523. _proto._resetAdjustments = function _resetAdjustments() {
  4524. this._element.style.paddingLeft = '';
  4525. this._element.style.paddingRight = '';
  4526. };
  4527. _proto._checkScrollbar = function _checkScrollbar() {
  4528. var rect = document.body.getBoundingClientRect();
  4529. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4530. this._scrollbarWidth = this._getScrollbarWidth();
  4531. };
  4532. _proto._setScrollbar = function _setScrollbar() {
  4533. var _this10 = this;
  4534. if (this._isBodyOverflowing) {
  4535. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4536. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4537. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4538. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4539. $(fixedContent).each(function (index, element) {
  4540. var actualPadding = element.style.paddingRight;
  4541. var calculatedPadding = $(element).css('padding-right');
  4542. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4543. }); // Adjust sticky content margin
  4544. $(stickyContent).each(function (index, element) {
  4545. var actualMargin = element.style.marginRight;
  4546. var calculatedMargin = $(element).css('margin-right');
  4547. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4548. }); // Adjust body padding
  4549. var actualPadding = document.body.style.paddingRight;
  4550. var calculatedPadding = $(document.body).css('padding-right');
  4551. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4552. }
  4553. $(document.body).addClass(ClassName$5.OPEN);
  4554. };
  4555. _proto._resetScrollbar = function _resetScrollbar() {
  4556. // Restore fixed content padding
  4557. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4558. $(fixedContent).each(function (index, element) {
  4559. var padding = $(element).data('padding-right');
  4560. $(element).removeData('padding-right');
  4561. element.style.paddingRight = padding ? padding : '';
  4562. }); // Restore sticky content
  4563. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4564. $(elements).each(function (index, element) {
  4565. var margin = $(element).data('margin-right');
  4566. if (typeof margin !== 'undefined') {
  4567. $(element).css('margin-right', margin).removeData('margin-right');
  4568. }
  4569. }); // Restore body padding
  4570. var padding = $(document.body).data('padding-right');
  4571. $(document.body).removeData('padding-right');
  4572. document.body.style.paddingRight = padding ? padding : '';
  4573. };
  4574. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4575. // thx d.walsh
  4576. var scrollDiv = document.createElement('div');
  4577. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4578. document.body.appendChild(scrollDiv);
  4579. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4580. document.body.removeChild(scrollDiv);
  4581. return scrollbarWidth;
  4582. } // Static
  4583. ;
  4584. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4585. return this.each(function () {
  4586. var data = $(this).data(DATA_KEY$5);
  4587. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  4588. if (!data) {
  4589. data = new Modal(this, _config);
  4590. $(this).data(DATA_KEY$5, data);
  4591. }
  4592. if (typeof config === 'string') {
  4593. if (typeof data[config] === 'undefined') {
  4594. throw new TypeError("No method named \"" + config + "\"");
  4595. }
  4596. data[config](relatedTarget);
  4597. } else if (_config.show) {
  4598. data.show(relatedTarget);
  4599. }
  4600. });
  4601. };
  4602. _createClass(Modal, null, [{
  4603. key: "VERSION",
  4604. get: function get() {
  4605. return VERSION$5;
  4606. }
  4607. }, {
  4608. key: "Default",
  4609. get: function get() {
  4610. return Default$3;
  4611. }
  4612. }]);
  4613. return Modal;
  4614. }();
  4615. /**
  4616. * ------------------------------------------------------------------------
  4617. * Data Api implementation
  4618. * ------------------------------------------------------------------------
  4619. */
  4620. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4621. var _this11 = this;
  4622. var target;
  4623. var selector = Util.getSelectorFromElement(this);
  4624. if (selector) {
  4625. target = document.querySelector(selector);
  4626. }
  4627. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  4628. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4629. event.preventDefault();
  4630. }
  4631. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4632. if (showEvent.isDefaultPrevented()) {
  4633. // Only register focus restorer if modal will actually get shown
  4634. return;
  4635. }
  4636. $target.one(Event$5.HIDDEN, function () {
  4637. if ($(_this11).is(':visible')) {
  4638. _this11.focus();
  4639. }
  4640. });
  4641. });
  4642. Modal._jQueryInterface.call($(target), config, this);
  4643. });
  4644. /**
  4645. * ------------------------------------------------------------------------
  4646. * jQuery
  4647. * ------------------------------------------------------------------------
  4648. */
  4649. $.fn[NAME$5] = Modal._jQueryInterface;
  4650. $.fn[NAME$5].Constructor = Modal;
  4651. $.fn[NAME$5].noConflict = function () {
  4652. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4653. return Modal._jQueryInterface;
  4654. };
  4655. /**
  4656. * --------------------------------------------------------------------------
  4657. * Bootstrap (v4.4.1): tools/sanitizer.js
  4658. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4659. * --------------------------------------------------------------------------
  4660. */
  4661. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4662. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4663. var DefaultWhitelist = {
  4664. // Global attributes allowed on any supplied element below.
  4665. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4666. a: ['target', 'href', 'title', 'rel'],
  4667. area: [],
  4668. b: [],
  4669. br: [],
  4670. col: [],
  4671. code: [],
  4672. div: [],
  4673. em: [],
  4674. hr: [],
  4675. h1: [],
  4676. h2: [],
  4677. h3: [],
  4678. h4: [],
  4679. h5: [],
  4680. h6: [],
  4681. i: [],
  4682. img: ['src', 'alt', 'title', 'width', 'height'],
  4683. li: [],
  4684. ol: [],
  4685. p: [],
  4686. pre: [],
  4687. s: [],
  4688. small: [],
  4689. span: [],
  4690. sub: [],
  4691. sup: [],
  4692. strong: [],
  4693. u: [],
  4694. ul: []
  4695. };
  4696. /**
  4697. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4698. *
  4699. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4700. */
  4701. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4702. /**
  4703. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4704. *
  4705. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4706. */
  4707. 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;
  4708. function allowedAttribute(attr, allowedAttributeList) {
  4709. var attrName = attr.nodeName.toLowerCase();
  4710. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4711. if (uriAttrs.indexOf(attrName) !== -1) {
  4712. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4713. }
  4714. return true;
  4715. }
  4716. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4717. return attrRegex instanceof RegExp;
  4718. }); // Check if a regular expression validates the attribute.
  4719. for (var i = 0, l = regExp.length; i < l; i++) {
  4720. if (attrName.match(regExp[i])) {
  4721. return true;
  4722. }
  4723. }
  4724. return false;
  4725. }
  4726. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4727. if (unsafeHtml.length === 0) {
  4728. return unsafeHtml;
  4729. }
  4730. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4731. return sanitizeFn(unsafeHtml);
  4732. }
  4733. var domParser = new window.DOMParser();
  4734. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4735. var whitelistKeys = Object.keys(whiteList);
  4736. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4737. var _loop = function _loop(i, len) {
  4738. var el = elements[i];
  4739. var elName = el.nodeName.toLowerCase();
  4740. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4741. el.parentNode.removeChild(el);
  4742. return "continue";
  4743. }
  4744. var attributeList = [].slice.call(el.attributes);
  4745. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4746. attributeList.forEach(function (attr) {
  4747. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4748. el.removeAttribute(attr.nodeName);
  4749. }
  4750. });
  4751. };
  4752. for (var i = 0, len = elements.length; i < len; i++) {
  4753. var _ret = _loop(i);
  4754. if (_ret === "continue") continue;
  4755. }
  4756. return createdDocument.body.innerHTML;
  4757. }
  4758. /**
  4759. * ------------------------------------------------------------------------
  4760. * Constants
  4761. * ------------------------------------------------------------------------
  4762. */
  4763. var NAME$6 = 'tooltip';
  4764. var VERSION$6 = '4.4.1';
  4765. var DATA_KEY$6 = 'bs.tooltip';
  4766. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4767. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4768. var CLASS_PREFIX = 'bs-tooltip';
  4769. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4770. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4771. var DefaultType$4 = {
  4772. animation: 'boolean',
  4773. template: 'string',
  4774. title: '(string|element|function)',
  4775. trigger: 'string',
  4776. delay: '(number|object)',
  4777. html: 'boolean',
  4778. selector: '(string|boolean)',
  4779. placement: '(string|function)',
  4780. offset: '(number|string|function)',
  4781. container: '(string|element|boolean)',
  4782. fallbackPlacement: '(string|array)',
  4783. boundary: '(string|element)',
  4784. sanitize: 'boolean',
  4785. sanitizeFn: '(null|function)',
  4786. whiteList: 'object',
  4787. popperConfig: '(null|object)'
  4788. };
  4789. var AttachmentMap$1 = {
  4790. AUTO: 'auto',
  4791. TOP: 'top',
  4792. RIGHT: 'right',
  4793. BOTTOM: 'bottom',
  4794. LEFT: 'left'
  4795. };
  4796. var Default$4 = {
  4797. animation: true,
  4798. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4799. trigger: 'hover focus',
  4800. title: '',
  4801. delay: 0,
  4802. html: false,
  4803. selector: false,
  4804. placement: 'top',
  4805. offset: 0,
  4806. container: false,
  4807. fallbackPlacement: 'flip',
  4808. boundary: 'scrollParent',
  4809. sanitize: true,
  4810. sanitizeFn: null,
  4811. whiteList: DefaultWhitelist,
  4812. popperConfig: null
  4813. };
  4814. var HoverState = {
  4815. SHOW: 'show',
  4816. OUT: 'out'
  4817. };
  4818. var Event$6 = {
  4819. HIDE: "hide" + EVENT_KEY$6,
  4820. HIDDEN: "hidden" + EVENT_KEY$6,
  4821. SHOW: "show" + EVENT_KEY$6,
  4822. SHOWN: "shown" + EVENT_KEY$6,
  4823. INSERTED: "inserted" + EVENT_KEY$6,
  4824. CLICK: "click" + EVENT_KEY$6,
  4825. FOCUSIN: "focusin" + EVENT_KEY$6,
  4826. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4827. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4828. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4829. };
  4830. var ClassName$6 = {
  4831. FADE: 'fade',
  4832. SHOW: 'show'
  4833. };
  4834. var Selector$6 = {
  4835. TOOLTIP: '.tooltip',
  4836. TOOLTIP_INNER: '.tooltip-inner',
  4837. ARROW: '.arrow'
  4838. };
  4839. var Trigger = {
  4840. HOVER: 'hover',
  4841. FOCUS: 'focus',
  4842. CLICK: 'click',
  4843. MANUAL: 'manual'
  4844. };
  4845. /**
  4846. * ------------------------------------------------------------------------
  4847. * Class Definition
  4848. * ------------------------------------------------------------------------
  4849. */
  4850. var Tooltip =
  4851. /*#__PURE__*/
  4852. function () {
  4853. function Tooltip(element, config) {
  4854. if (typeof Popper === 'undefined') {
  4855. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4856. } // private
  4857. this._isEnabled = true;
  4858. this._timeout = 0;
  4859. this._hoverState = '';
  4860. this._activeTrigger = {};
  4861. this._popper = null; // Protected
  4862. this.element = element;
  4863. this.config = this._getConfig(config);
  4864. this.tip = null;
  4865. this._setListeners();
  4866. } // Getters
  4867. var _proto = Tooltip.prototype;
  4868. // Public
  4869. _proto.enable = function enable() {
  4870. this._isEnabled = true;
  4871. };
  4872. _proto.disable = function disable() {
  4873. this._isEnabled = false;
  4874. };
  4875. _proto.toggleEnabled = function toggleEnabled() {
  4876. this._isEnabled = !this._isEnabled;
  4877. };
  4878. _proto.toggle = function toggle(event) {
  4879. if (!this._isEnabled) {
  4880. return;
  4881. }
  4882. if (event) {
  4883. var dataKey = this.constructor.DATA_KEY;
  4884. var context = $(event.currentTarget).data(dataKey);
  4885. if (!context) {
  4886. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4887. $(event.currentTarget).data(dataKey, context);
  4888. }
  4889. context._activeTrigger.click = !context._activeTrigger.click;
  4890. if (context._isWithActiveTrigger()) {
  4891. context._enter(null, context);
  4892. } else {
  4893. context._leave(null, context);
  4894. }
  4895. } else {
  4896. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  4897. this._leave(null, this);
  4898. return;
  4899. }
  4900. this._enter(null, this);
  4901. }
  4902. };
  4903. _proto.dispose = function dispose() {
  4904. clearTimeout(this._timeout);
  4905. $.removeData(this.element, this.constructor.DATA_KEY);
  4906. $(this.element).off(this.constructor.EVENT_KEY);
  4907. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  4908. if (this.tip) {
  4909. $(this.tip).remove();
  4910. }
  4911. this._isEnabled = null;
  4912. this._timeout = null;
  4913. this._hoverState = null;
  4914. this._activeTrigger = null;
  4915. if (this._popper) {
  4916. this._popper.destroy();
  4917. }
  4918. this._popper = null;
  4919. this.element = null;
  4920. this.config = null;
  4921. this.tip = null;
  4922. };
  4923. _proto.show = function show() {
  4924. var _this = this;
  4925. if ($(this.element).css('display') === 'none') {
  4926. throw new Error('Please use show on visible elements');
  4927. }
  4928. var showEvent = $.Event(this.constructor.Event.SHOW);
  4929. if (this.isWithContent() && this._isEnabled) {
  4930. $(this.element).trigger(showEvent);
  4931. var shadowRoot = Util.findShadowRoot(this.element);
  4932. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  4933. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  4934. return;
  4935. }
  4936. var tip = this.getTipElement();
  4937. var tipId = Util.getUID(this.constructor.NAME);
  4938. tip.setAttribute('id', tipId);
  4939. this.element.setAttribute('aria-describedby', tipId);
  4940. this.setContent();
  4941. if (this.config.animation) {
  4942. $(tip).addClass(ClassName$6.FADE);
  4943. }
  4944. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  4945. var attachment = this._getAttachment(placement);
  4946. this.addAttachmentClass(attachment);
  4947. var container = this._getContainer();
  4948. $(tip).data(this.constructor.DATA_KEY, this);
  4949. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  4950. $(tip).appendTo(container);
  4951. }
  4952. $(this.element).trigger(this.constructor.Event.INSERTED);
  4953. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  4954. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  4955. // empty mouseover listeners to the body's immediate children;
  4956. // only needed because of broken event delegation on iOS
  4957. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4958. if ('ontouchstart' in document.documentElement) {
  4959. $(document.body).children().on('mouseover', null, $.noop);
  4960. }
  4961. var complete = function complete() {
  4962. if (_this.config.animation) {
  4963. _this._fixTransition();
  4964. }
  4965. var prevHoverState = _this._hoverState;
  4966. _this._hoverState = null;
  4967. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  4968. if (prevHoverState === HoverState.OUT) {
  4969. _this._leave(null, _this);
  4970. }
  4971. };
  4972. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4973. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  4974. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4975. } else {
  4976. complete();
  4977. }
  4978. }
  4979. };
  4980. _proto.hide = function hide(callback) {
  4981. var _this2 = this;
  4982. var tip = this.getTipElement();
  4983. var hideEvent = $.Event(this.constructor.Event.HIDE);
  4984. var complete = function complete() {
  4985. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  4986. tip.parentNode.removeChild(tip);
  4987. }
  4988. _this2._cleanTipClass();
  4989. _this2.element.removeAttribute('aria-describedby');
  4990. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  4991. if (_this2._popper !== null) {
  4992. _this2._popper.destroy();
  4993. }
  4994. if (callback) {
  4995. callback();
  4996. }
  4997. };
  4998. $(this.element).trigger(hideEvent);
  4999. if (hideEvent.isDefaultPrevented()) {
  5000. return;
  5001. }
  5002. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  5003. // empty mouseover listeners we added for iOS support
  5004. if ('ontouchstart' in document.documentElement) {
  5005. $(document.body).children().off('mouseover', null, $.noop);
  5006. }
  5007. this._activeTrigger[Trigger.CLICK] = false;
  5008. this._activeTrigger[Trigger.FOCUS] = false;
  5009. this._activeTrigger[Trigger.HOVER] = false;
  5010. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5011. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  5012. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5013. } else {
  5014. complete();
  5015. }
  5016. this._hoverState = '';
  5017. };
  5018. _proto.update = function update() {
  5019. if (this._popper !== null) {
  5020. this._popper.scheduleUpdate();
  5021. }
  5022. } // Protected
  5023. ;
  5024. _proto.isWithContent = function isWithContent() {
  5025. return Boolean(this.getTitle());
  5026. };
  5027. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5028. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  5029. };
  5030. _proto.getTipElement = function getTipElement() {
  5031. this.tip = this.tip || $(this.config.template)[0];
  5032. return this.tip;
  5033. };
  5034. _proto.setContent = function setContent() {
  5035. var tip = this.getTipElement();
  5036. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  5037. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  5038. };
  5039. _proto.setElementContent = function setElementContent($element, content) {
  5040. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  5041. // Content is a DOM node or a jQuery
  5042. if (this.config.html) {
  5043. if (!$(content).parent().is($element)) {
  5044. $element.empty().append(content);
  5045. }
  5046. } else {
  5047. $element.text($(content).text());
  5048. }
  5049. return;
  5050. }
  5051. if (this.config.html) {
  5052. if (this.config.sanitize) {
  5053. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  5054. }
  5055. $element.html(content);
  5056. } else {
  5057. $element.text(content);
  5058. }
  5059. };
  5060. _proto.getTitle = function getTitle() {
  5061. var title = this.element.getAttribute('data-original-title');
  5062. if (!title) {
  5063. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  5064. }
  5065. return title;
  5066. } // Private
  5067. ;
  5068. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  5069. var _this3 = this;
  5070. var defaultBsConfig = {
  5071. placement: attachment,
  5072. modifiers: {
  5073. offset: this._getOffset(),
  5074. flip: {
  5075. behavior: this.config.fallbackPlacement
  5076. },
  5077. arrow: {
  5078. element: Selector$6.ARROW
  5079. },
  5080. preventOverflow: {
  5081. boundariesElement: this.config.boundary
  5082. }
  5083. },
  5084. onCreate: function onCreate(data) {
  5085. if (data.originalPlacement !== data.placement) {
  5086. _this3._handlePopperPlacementChange(data);
  5087. }
  5088. },
  5089. onUpdate: function onUpdate(data) {
  5090. return _this3._handlePopperPlacementChange(data);
  5091. }
  5092. };
  5093. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  5094. };
  5095. _proto._getOffset = function _getOffset() {
  5096. var _this4 = this;
  5097. var offset = {};
  5098. if (typeof this.config.offset === 'function') {
  5099. offset.fn = function (data) {
  5100. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  5101. return data;
  5102. };
  5103. } else {
  5104. offset.offset = this.config.offset;
  5105. }
  5106. return offset;
  5107. };
  5108. _proto._getContainer = function _getContainer() {
  5109. if (this.config.container === false) {
  5110. return document.body;
  5111. }
  5112. if (Util.isElement(this.config.container)) {
  5113. return $(this.config.container);
  5114. }
  5115. return $(document).find(this.config.container);
  5116. };
  5117. _proto._getAttachment = function _getAttachment(placement) {
  5118. return AttachmentMap$1[placement.toUpperCase()];
  5119. };
  5120. _proto._setListeners = function _setListeners() {
  5121. var _this5 = this;
  5122. var triggers = this.config.trigger.split(' ');
  5123. triggers.forEach(function (trigger) {
  5124. if (trigger === 'click') {
  5125. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  5126. return _this5.toggle(event);
  5127. });
  5128. } else if (trigger !== Trigger.MANUAL) {
  5129. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  5130. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  5131. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  5132. return _this5._enter(event);
  5133. }).on(eventOut, _this5.config.selector, function (event) {
  5134. return _this5._leave(event);
  5135. });
  5136. }
  5137. });
  5138. this._hideModalHandler = function () {
  5139. if (_this5.element) {
  5140. _this5.hide();
  5141. }
  5142. };
  5143. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  5144. if (this.config.selector) {
  5145. this.config = _objectSpread2({}, this.config, {
  5146. trigger: 'manual',
  5147. selector: ''
  5148. });
  5149. } else {
  5150. this._fixTitle();
  5151. }
  5152. };
  5153. _proto._fixTitle = function _fixTitle() {
  5154. var titleType = typeof this.element.getAttribute('data-original-title');
  5155. if (this.element.getAttribute('title') || titleType !== 'string') {
  5156. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  5157. this.element.setAttribute('title', '');
  5158. }
  5159. };
  5160. _proto._enter = function _enter(event, context) {
  5161. var dataKey = this.constructor.DATA_KEY;
  5162. context = context || $(event.currentTarget).data(dataKey);
  5163. if (!context) {
  5164. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5165. $(event.currentTarget).data(dataKey, context);
  5166. }
  5167. if (event) {
  5168. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  5169. }
  5170. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  5171. context._hoverState = HoverState.SHOW;
  5172. return;
  5173. }
  5174. clearTimeout(context._timeout);
  5175. context._hoverState = HoverState.SHOW;
  5176. if (!context.config.delay || !context.config.delay.show) {
  5177. context.show();
  5178. return;
  5179. }
  5180. context._timeout = setTimeout(function () {
  5181. if (context._hoverState === HoverState.SHOW) {
  5182. context.show();
  5183. }
  5184. }, context.config.delay.show);
  5185. };
  5186. _proto._leave = function _leave(event, context) {
  5187. var dataKey = this.constructor.DATA_KEY;
  5188. context = context || $(event.currentTarget).data(dataKey);
  5189. if (!context) {
  5190. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5191. $(event.currentTarget).data(dataKey, context);
  5192. }
  5193. if (event) {
  5194. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  5195. }
  5196. if (context._isWithActiveTrigger()) {
  5197. return;
  5198. }
  5199. clearTimeout(context._timeout);
  5200. context._hoverState = HoverState.OUT;
  5201. if (!context.config.delay || !context.config.delay.hide) {
  5202. context.hide();
  5203. return;
  5204. }
  5205. context._timeout = setTimeout(function () {
  5206. if (context._hoverState === HoverState.OUT) {
  5207. context.hide();
  5208. }
  5209. }, context.config.delay.hide);
  5210. };
  5211. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  5212. for (var trigger in this._activeTrigger) {
  5213. if (this._activeTrigger[trigger]) {
  5214. return true;
  5215. }
  5216. }
  5217. return false;
  5218. };
  5219. _proto._getConfig = function _getConfig(config) {
  5220. var dataAttributes = $(this.element).data();
  5221. Object.keys(dataAttributes).forEach(function (dataAttr) {
  5222. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  5223. delete dataAttributes[dataAttr];
  5224. }
  5225. });
  5226. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  5227. if (typeof config.delay === 'number') {
  5228. config.delay = {
  5229. show: config.delay,
  5230. hide: config.delay
  5231. };
  5232. }
  5233. if (typeof config.title === 'number') {
  5234. config.title = config.title.toString();
  5235. }
  5236. if (typeof config.content === 'number') {
  5237. config.content = config.content.toString();
  5238. }
  5239. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  5240. if (config.sanitize) {
  5241. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  5242. }
  5243. return config;
  5244. };
  5245. _proto._getDelegateConfig = function _getDelegateConfig() {
  5246. var config = {};
  5247. if (this.config) {
  5248. for (var key in this.config) {
  5249. if (this.constructor.Default[key] !== this.config[key]) {
  5250. config[key] = this.config[key];
  5251. }
  5252. }
  5253. }
  5254. return config;
  5255. };
  5256. _proto._cleanTipClass = function _cleanTipClass() {
  5257. var $tip = $(this.getTipElement());
  5258. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  5259. if (tabClass !== null && tabClass.length) {
  5260. $tip.removeClass(tabClass.join(''));
  5261. }
  5262. };
  5263. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  5264. var popperInstance = popperData.instance;
  5265. this.tip = popperInstance.popper;
  5266. this._cleanTipClass();
  5267. this.addAttachmentClass(this._getAttachment(popperData.placement));
  5268. };
  5269. _proto._fixTransition = function _fixTransition() {
  5270. var tip = this.getTipElement();
  5271. var initConfigAnimation = this.config.animation;
  5272. if (tip.getAttribute('x-placement') !== null) {
  5273. return;
  5274. }
  5275. $(tip).removeClass(ClassName$6.FADE);
  5276. this.config.animation = false;
  5277. this.hide();
  5278. this.show();
  5279. this.config.animation = initConfigAnimation;
  5280. } // Static
  5281. ;
  5282. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  5283. return this.each(function () {
  5284. var data = $(this).data(DATA_KEY$6);
  5285. var _config = typeof config === 'object' && config;
  5286. if (!data && /dispose|hide/.test(config)) {
  5287. return;
  5288. }
  5289. if (!data) {
  5290. data = new Tooltip(this, _config);
  5291. $(this).data(DATA_KEY$6, data);
  5292. }
  5293. if (typeof config === 'string') {
  5294. if (typeof data[config] === 'undefined') {
  5295. throw new TypeError("No method named \"" + config + "\"");
  5296. }
  5297. data[config]();
  5298. }
  5299. });
  5300. };
  5301. _createClass(Tooltip, null, [{
  5302. key: "VERSION",
  5303. get: function get() {
  5304. return VERSION$6;
  5305. }
  5306. }, {
  5307. key: "Default",
  5308. get: function get() {
  5309. return Default$4;
  5310. }
  5311. }, {
  5312. key: "NAME",
  5313. get: function get() {
  5314. return NAME$6;
  5315. }
  5316. }, {
  5317. key: "DATA_KEY",
  5318. get: function get() {
  5319. return DATA_KEY$6;
  5320. }
  5321. }, {
  5322. key: "Event",
  5323. get: function get() {
  5324. return Event$6;
  5325. }
  5326. }, {
  5327. key: "EVENT_KEY",
  5328. get: function get() {
  5329. return EVENT_KEY$6;
  5330. }
  5331. }, {
  5332. key: "DefaultType",
  5333. get: function get() {
  5334. return DefaultType$4;
  5335. }
  5336. }]);
  5337. return Tooltip;
  5338. }();
  5339. /**
  5340. * ------------------------------------------------------------------------
  5341. * jQuery
  5342. * ------------------------------------------------------------------------
  5343. */
  5344. $.fn[NAME$6] = Tooltip._jQueryInterface;
  5345. $.fn[NAME$6].Constructor = Tooltip;
  5346. $.fn[NAME$6].noConflict = function () {
  5347. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  5348. return Tooltip._jQueryInterface;
  5349. };
  5350. /**
  5351. * ------------------------------------------------------------------------
  5352. * Constants
  5353. * ------------------------------------------------------------------------
  5354. */
  5355. var NAME$7 = 'popover';
  5356. var VERSION$7 = '4.4.1';
  5357. var DATA_KEY$7 = 'bs.popover';
  5358. var EVENT_KEY$7 = "." + DATA_KEY$7;
  5359. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  5360. var CLASS_PREFIX$1 = 'bs-popover';
  5361. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  5362. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  5363. placement: 'right',
  5364. trigger: 'click',
  5365. content: '',
  5366. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  5367. });
  5368. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  5369. content: '(string|element|function)'
  5370. });
  5371. var ClassName$7 = {
  5372. FADE: 'fade',
  5373. SHOW: 'show'
  5374. };
  5375. var Selector$7 = {
  5376. TITLE: '.popover-header',
  5377. CONTENT: '.popover-body'
  5378. };
  5379. var Event$7 = {
  5380. HIDE: "hide" + EVENT_KEY$7,
  5381. HIDDEN: "hidden" + EVENT_KEY$7,
  5382. SHOW: "show" + EVENT_KEY$7,
  5383. SHOWN: "shown" + EVENT_KEY$7,
  5384. INSERTED: "inserted" + EVENT_KEY$7,
  5385. CLICK: "click" + EVENT_KEY$7,
  5386. FOCUSIN: "focusin" + EVENT_KEY$7,
  5387. FOCUSOUT: "focusout" + EVENT_KEY$7,
  5388. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  5389. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  5390. };
  5391. /**
  5392. * ------------------------------------------------------------------------
  5393. * Class Definition
  5394. * ------------------------------------------------------------------------
  5395. */
  5396. var Popover =
  5397. /*#__PURE__*/
  5398. function (_Tooltip) {
  5399. _inheritsLoose(Popover, _Tooltip);
  5400. function Popover() {
  5401. return _Tooltip.apply(this, arguments) || this;
  5402. }
  5403. var _proto = Popover.prototype;
  5404. // Overrides
  5405. _proto.isWithContent = function isWithContent() {
  5406. return this.getTitle() || this._getContent();
  5407. };
  5408. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5409. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  5410. };
  5411. _proto.getTipElement = function getTipElement() {
  5412. this.tip = this.tip || $(this.config.template)[0];
  5413. return this.tip;
  5414. };
  5415. _proto.setContent = function setContent() {
  5416. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  5417. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  5418. var content = this._getContent();
  5419. if (typeof content === 'function') {
  5420. content = content.call(this.element);
  5421. }
  5422. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  5423. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  5424. } // Private
  5425. ;
  5426. _proto._getContent = function _getContent() {
  5427. return this.element.getAttribute('data-content') || this.config.content;
  5428. };
  5429. _proto._cleanTipClass = function _cleanTipClass() {
  5430. var $tip = $(this.getTipElement());
  5431. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  5432. if (tabClass !== null && tabClass.length > 0) {
  5433. $tip.removeClass(tabClass.join(''));
  5434. }
  5435. } // Static
  5436. ;
  5437. Popover._jQueryInterface = function _jQueryInterface(config) {
  5438. return this.each(function () {
  5439. var data = $(this).data(DATA_KEY$7);
  5440. var _config = typeof config === 'object' ? config : null;
  5441. if (!data && /dispose|hide/.test(config)) {
  5442. return;
  5443. }
  5444. if (!data) {
  5445. data = new Popover(this, _config);
  5446. $(this).data(DATA_KEY$7, data);
  5447. }
  5448. if (typeof config === 'string') {
  5449. if (typeof data[config] === 'undefined') {
  5450. throw new TypeError("No method named \"" + config + "\"");
  5451. }
  5452. data[config]();
  5453. }
  5454. });
  5455. };
  5456. _createClass(Popover, null, [{
  5457. key: "VERSION",
  5458. // Getters
  5459. get: function get() {
  5460. return VERSION$7;
  5461. }
  5462. }, {
  5463. key: "Default",
  5464. get: function get() {
  5465. return Default$5;
  5466. }
  5467. }, {
  5468. key: "NAME",
  5469. get: function get() {
  5470. return NAME$7;
  5471. }
  5472. }, {
  5473. key: "DATA_KEY",
  5474. get: function get() {
  5475. return DATA_KEY$7;
  5476. }
  5477. }, {
  5478. key: "Event",
  5479. get: function get() {
  5480. return Event$7;
  5481. }
  5482. }, {
  5483. key: "EVENT_KEY",
  5484. get: function get() {
  5485. return EVENT_KEY$7;
  5486. }
  5487. }, {
  5488. key: "DefaultType",
  5489. get: function get() {
  5490. return DefaultType$5;
  5491. }
  5492. }]);
  5493. return Popover;
  5494. }(Tooltip);
  5495. /**
  5496. * ------------------------------------------------------------------------
  5497. * jQuery
  5498. * ------------------------------------------------------------------------
  5499. */
  5500. $.fn[NAME$7] = Popover._jQueryInterface;
  5501. $.fn[NAME$7].Constructor = Popover;
  5502. $.fn[NAME$7].noConflict = function () {
  5503. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5504. return Popover._jQueryInterface;
  5505. };
  5506. /**
  5507. * ------------------------------------------------------------------------
  5508. * Constants
  5509. * ------------------------------------------------------------------------
  5510. */
  5511. var NAME$8 = 'scrollspy';
  5512. var VERSION$8 = '4.4.1';
  5513. var DATA_KEY$8 = 'bs.scrollspy';
  5514. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5515. var DATA_API_KEY$6 = '.data-api';
  5516. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5517. var Default$6 = {
  5518. offset: 10,
  5519. method: 'auto',
  5520. target: ''
  5521. };
  5522. var DefaultType$6 = {
  5523. offset: 'number',
  5524. method: 'string',
  5525. target: '(string|element)'
  5526. };
  5527. var Event$8 = {
  5528. ACTIVATE: "activate" + EVENT_KEY$8,
  5529. SCROLL: "scroll" + EVENT_KEY$8,
  5530. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5531. };
  5532. var ClassName$8 = {
  5533. DROPDOWN_ITEM: 'dropdown-item',
  5534. DROPDOWN_MENU: 'dropdown-menu',
  5535. ACTIVE: 'active'
  5536. };
  5537. var Selector$8 = {
  5538. DATA_SPY: '[data-spy="scroll"]',
  5539. ACTIVE: '.active',
  5540. NAV_LIST_GROUP: '.nav, .list-group',
  5541. NAV_LINKS: '.nav-link',
  5542. NAV_ITEMS: '.nav-item',
  5543. LIST_ITEMS: '.list-group-item',
  5544. DROPDOWN: '.dropdown',
  5545. DROPDOWN_ITEMS: '.dropdown-item',
  5546. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5547. };
  5548. var OffsetMethod = {
  5549. OFFSET: 'offset',
  5550. POSITION: 'position'
  5551. };
  5552. /**
  5553. * ------------------------------------------------------------------------
  5554. * Class Definition
  5555. * ------------------------------------------------------------------------
  5556. */
  5557. var ScrollSpy =
  5558. /*#__PURE__*/
  5559. function () {
  5560. function ScrollSpy(element, config) {
  5561. var _this = this;
  5562. this._element = element;
  5563. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5564. this._config = this._getConfig(config);
  5565. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5566. this._offsets = [];
  5567. this._targets = [];
  5568. this._activeTarget = null;
  5569. this._scrollHeight = 0;
  5570. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5571. return _this._process(event);
  5572. });
  5573. this.refresh();
  5574. this._process();
  5575. } // Getters
  5576. var _proto = ScrollSpy.prototype;
  5577. // Public
  5578. _proto.refresh = function refresh() {
  5579. var _this2 = this;
  5580. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5581. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5582. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5583. this._offsets = [];
  5584. this._targets = [];
  5585. this._scrollHeight = this._getScrollHeight();
  5586. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5587. targets.map(function (element) {
  5588. var target;
  5589. var targetSelector = Util.getSelectorFromElement(element);
  5590. if (targetSelector) {
  5591. target = document.querySelector(targetSelector);
  5592. }
  5593. if (target) {
  5594. var targetBCR = target.getBoundingClientRect();
  5595. if (targetBCR.width || targetBCR.height) {
  5596. // TODO (fat): remove sketch reliance on jQuery position/offset
  5597. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5598. }
  5599. }
  5600. return null;
  5601. }).filter(function (item) {
  5602. return item;
  5603. }).sort(function (a, b) {
  5604. return a[0] - b[0];
  5605. }).forEach(function (item) {
  5606. _this2._offsets.push(item[0]);
  5607. _this2._targets.push(item[1]);
  5608. });
  5609. };
  5610. _proto.dispose = function dispose() {
  5611. $.removeData(this._element, DATA_KEY$8);
  5612. $(this._scrollElement).off(EVENT_KEY$8);
  5613. this._element = null;
  5614. this._scrollElement = null;
  5615. this._config = null;
  5616. this._selector = null;
  5617. this._offsets = null;
  5618. this._targets = null;
  5619. this._activeTarget = null;
  5620. this._scrollHeight = null;
  5621. } // Private
  5622. ;
  5623. _proto._getConfig = function _getConfig(config) {
  5624. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  5625. if (typeof config.target !== 'string') {
  5626. var id = $(config.target).attr('id');
  5627. if (!id) {
  5628. id = Util.getUID(NAME$8);
  5629. $(config.target).attr('id', id);
  5630. }
  5631. config.target = "#" + id;
  5632. }
  5633. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5634. return config;
  5635. };
  5636. _proto._getScrollTop = function _getScrollTop() {
  5637. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5638. };
  5639. _proto._getScrollHeight = function _getScrollHeight() {
  5640. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5641. };
  5642. _proto._getOffsetHeight = function _getOffsetHeight() {
  5643. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5644. };
  5645. _proto._process = function _process() {
  5646. var scrollTop = this._getScrollTop() + this._config.offset;
  5647. var scrollHeight = this._getScrollHeight();
  5648. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5649. if (this._scrollHeight !== scrollHeight) {
  5650. this.refresh();
  5651. }
  5652. if (scrollTop >= maxScroll) {
  5653. var target = this._targets[this._targets.length - 1];
  5654. if (this._activeTarget !== target) {
  5655. this._activate(target);
  5656. }
  5657. return;
  5658. }
  5659. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5660. this._activeTarget = null;
  5661. this._clear();
  5662. return;
  5663. }
  5664. var offsetLength = this._offsets.length;
  5665. for (var i = offsetLength; i--;) {
  5666. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5667. if (isActiveTarget) {
  5668. this._activate(this._targets[i]);
  5669. }
  5670. }
  5671. };
  5672. _proto._activate = function _activate(target) {
  5673. this._activeTarget = target;
  5674. this._clear();
  5675. var queries = this._selector.split(',').map(function (selector) {
  5676. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5677. });
  5678. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5679. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5680. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5681. $link.addClass(ClassName$8.ACTIVE);
  5682. } else {
  5683. // Set triggered link as active
  5684. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5685. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5686. $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
  5687. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5688. }
  5689. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5690. relatedTarget: target
  5691. });
  5692. };
  5693. _proto._clear = function _clear() {
  5694. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5695. return node.classList.contains(ClassName$8.ACTIVE);
  5696. }).forEach(function (node) {
  5697. return node.classList.remove(ClassName$8.ACTIVE);
  5698. });
  5699. } // Static
  5700. ;
  5701. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5702. return this.each(function () {
  5703. var data = $(this).data(DATA_KEY$8);
  5704. var _config = typeof config === 'object' && config;
  5705. if (!data) {
  5706. data = new ScrollSpy(this, _config);
  5707. $(this).data(DATA_KEY$8, data);
  5708. }
  5709. if (typeof config === 'string') {
  5710. if (typeof data[config] === 'undefined') {
  5711. throw new TypeError("No method named \"" + config + "\"");
  5712. }
  5713. data[config]();
  5714. }
  5715. });
  5716. };
  5717. _createClass(ScrollSpy, null, [{
  5718. key: "VERSION",
  5719. get: function get() {
  5720. return VERSION$8;
  5721. }
  5722. }, {
  5723. key: "Default",
  5724. get: function get() {
  5725. return Default$6;
  5726. }
  5727. }]);
  5728. return ScrollSpy;
  5729. }();
  5730. /**
  5731. * ------------------------------------------------------------------------
  5732. * Data Api implementation
  5733. * ------------------------------------------------------------------------
  5734. */
  5735. $(window).on(Event$8.LOAD_DATA_API, function () {
  5736. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5737. var scrollSpysLength = scrollSpys.length;
  5738. for (var i = scrollSpysLength; i--;) {
  5739. var $spy = $(scrollSpys[i]);
  5740. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5741. }
  5742. });
  5743. /**
  5744. * ------------------------------------------------------------------------
  5745. * jQuery
  5746. * ------------------------------------------------------------------------
  5747. */
  5748. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5749. $.fn[NAME$8].Constructor = ScrollSpy;
  5750. $.fn[NAME$8].noConflict = function () {
  5751. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5752. return ScrollSpy._jQueryInterface;
  5753. };
  5754. /**
  5755. * ------------------------------------------------------------------------
  5756. * Constants
  5757. * ------------------------------------------------------------------------
  5758. */
  5759. var NAME$9 = 'tab';
  5760. var VERSION$9 = '4.4.1';
  5761. var DATA_KEY$9 = 'bs.tab';
  5762. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5763. var DATA_API_KEY$7 = '.data-api';
  5764. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5765. var Event$9 = {
  5766. HIDE: "hide" + EVENT_KEY$9,
  5767. HIDDEN: "hidden" + EVENT_KEY$9,
  5768. SHOW: "show" + EVENT_KEY$9,
  5769. SHOWN: "shown" + EVENT_KEY$9,
  5770. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5771. };
  5772. var ClassName$9 = {
  5773. DROPDOWN_MENU: 'dropdown-menu',
  5774. ACTIVE: 'active',
  5775. DISABLED: 'disabled',
  5776. FADE: 'fade',
  5777. SHOW: 'show'
  5778. };
  5779. var Selector$9 = {
  5780. DROPDOWN: '.dropdown',
  5781. NAV_LIST_GROUP: '.nav, .list-group',
  5782. ACTIVE: '.active',
  5783. ACTIVE_UL: '> li > .active',
  5784. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5785. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5786. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5787. };
  5788. /**
  5789. * ------------------------------------------------------------------------
  5790. * Class Definition
  5791. * ------------------------------------------------------------------------
  5792. */
  5793. var Tab =
  5794. /*#__PURE__*/
  5795. function () {
  5796. function Tab(element) {
  5797. this._element = element;
  5798. } // Getters
  5799. var _proto = Tab.prototype;
  5800. // Public
  5801. _proto.show = function show() {
  5802. var _this = this;
  5803. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5804. return;
  5805. }
  5806. var target;
  5807. var previous;
  5808. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5809. var selector = Util.getSelectorFromElement(this._element);
  5810. if (listElement) {
  5811. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5812. previous = $.makeArray($(listElement).find(itemSelector));
  5813. previous = previous[previous.length - 1];
  5814. }
  5815. var hideEvent = $.Event(Event$9.HIDE, {
  5816. relatedTarget: this._element
  5817. });
  5818. var showEvent = $.Event(Event$9.SHOW, {
  5819. relatedTarget: previous
  5820. });
  5821. if (previous) {
  5822. $(previous).trigger(hideEvent);
  5823. }
  5824. $(this._element).trigger(showEvent);
  5825. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5826. return;
  5827. }
  5828. if (selector) {
  5829. target = document.querySelector(selector);
  5830. }
  5831. this._activate(this._element, listElement);
  5832. var complete = function complete() {
  5833. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5834. relatedTarget: _this._element
  5835. });
  5836. var shownEvent = $.Event(Event$9.SHOWN, {
  5837. relatedTarget: previous
  5838. });
  5839. $(previous).trigger(hiddenEvent);
  5840. $(_this._element).trigger(shownEvent);
  5841. };
  5842. if (target) {
  5843. this._activate(target, target.parentNode, complete);
  5844. } else {
  5845. complete();
  5846. }
  5847. };
  5848. _proto.dispose = function dispose() {
  5849. $.removeData(this._element, DATA_KEY$9);
  5850. this._element = null;
  5851. } // Private
  5852. ;
  5853. _proto._activate = function _activate(element, container, callback) {
  5854. var _this2 = this;
  5855. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5856. var active = activeElements[0];
  5857. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5858. var complete = function complete() {
  5859. return _this2._transitionComplete(element, active, callback);
  5860. };
  5861. if (active && isTransitioning) {
  5862. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5863. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5864. } else {
  5865. complete();
  5866. }
  5867. };
  5868. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5869. if (active) {
  5870. $(active).removeClass(ClassName$9.ACTIVE);
  5871. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5872. if (dropdownChild) {
  5873. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5874. }
  5875. if (active.getAttribute('role') === 'tab') {
  5876. active.setAttribute('aria-selected', false);
  5877. }
  5878. }
  5879. $(element).addClass(ClassName$9.ACTIVE);
  5880. if (element.getAttribute('role') === 'tab') {
  5881. element.setAttribute('aria-selected', true);
  5882. }
  5883. Util.reflow(element);
  5884. if (element.classList.contains(ClassName$9.FADE)) {
  5885. element.classList.add(ClassName$9.SHOW);
  5886. }
  5887. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5888. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5889. if (dropdownElement) {
  5890. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5891. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5892. }
  5893. element.setAttribute('aria-expanded', true);
  5894. }
  5895. if (callback) {
  5896. callback();
  5897. }
  5898. } // Static
  5899. ;
  5900. Tab._jQueryInterface = function _jQueryInterface(config) {
  5901. return this.each(function () {
  5902. var $this = $(this);
  5903. var data = $this.data(DATA_KEY$9);
  5904. if (!data) {
  5905. data = new Tab(this);
  5906. $this.data(DATA_KEY$9, data);
  5907. }
  5908. if (typeof config === 'string') {
  5909. if (typeof data[config] === 'undefined') {
  5910. throw new TypeError("No method named \"" + config + "\"");
  5911. }
  5912. data[config]();
  5913. }
  5914. });
  5915. };
  5916. _createClass(Tab, null, [{
  5917. key: "VERSION",
  5918. get: function get() {
  5919. return VERSION$9;
  5920. }
  5921. }]);
  5922. return Tab;
  5923. }();
  5924. /**
  5925. * ------------------------------------------------------------------------
  5926. * Data Api implementation
  5927. * ------------------------------------------------------------------------
  5928. */
  5929. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  5930. event.preventDefault();
  5931. Tab._jQueryInterface.call($(this), 'show');
  5932. });
  5933. /**
  5934. * ------------------------------------------------------------------------
  5935. * jQuery
  5936. * ------------------------------------------------------------------------
  5937. */
  5938. $.fn[NAME$9] = Tab._jQueryInterface;
  5939. $.fn[NAME$9].Constructor = Tab;
  5940. $.fn[NAME$9].noConflict = function () {
  5941. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  5942. return Tab._jQueryInterface;
  5943. };
  5944. /**
  5945. * ------------------------------------------------------------------------
  5946. * Constants
  5947. * ------------------------------------------------------------------------
  5948. */
  5949. var NAME$a = 'toast';
  5950. var VERSION$a = '4.4.1';
  5951. var DATA_KEY$a = 'bs.toast';
  5952. var EVENT_KEY$a = "." + DATA_KEY$a;
  5953. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  5954. var Event$a = {
  5955. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  5956. HIDE: "hide" + EVENT_KEY$a,
  5957. HIDDEN: "hidden" + EVENT_KEY$a,
  5958. SHOW: "show" + EVENT_KEY$a,
  5959. SHOWN: "shown" + EVENT_KEY$a
  5960. };
  5961. var ClassName$a = {
  5962. FADE: 'fade',
  5963. HIDE: 'hide',
  5964. SHOW: 'show',
  5965. SHOWING: 'showing'
  5966. };
  5967. var DefaultType$7 = {
  5968. animation: 'boolean',
  5969. autohide: 'boolean',
  5970. delay: 'number'
  5971. };
  5972. var Default$7 = {
  5973. animation: true,
  5974. autohide: true,
  5975. delay: 500
  5976. };
  5977. var Selector$a = {
  5978. DATA_DISMISS: '[data-dismiss="toast"]'
  5979. };
  5980. /**
  5981. * ------------------------------------------------------------------------
  5982. * Class Definition
  5983. * ------------------------------------------------------------------------
  5984. */
  5985. var Toast =
  5986. /*#__PURE__*/
  5987. function () {
  5988. function Toast(element, config) {
  5989. this._element = element;
  5990. this._config = this._getConfig(config);
  5991. this._timeout = null;
  5992. this._setListeners();
  5993. } // Getters
  5994. var _proto = Toast.prototype;
  5995. // Public
  5996. _proto.show = function show() {
  5997. var _this = this;
  5998. var showEvent = $.Event(Event$a.SHOW);
  5999. $(this._element).trigger(showEvent);
  6000. if (showEvent.isDefaultPrevented()) {
  6001. return;
  6002. }
  6003. if (this._config.animation) {
  6004. this._element.classList.add(ClassName$a.FADE);
  6005. }
  6006. var complete = function complete() {
  6007. _this._element.classList.remove(ClassName$a.SHOWING);
  6008. _this._element.classList.add(ClassName$a.SHOW);
  6009. $(_this._element).trigger(Event$a.SHOWN);
  6010. if (_this._config.autohide) {
  6011. _this._timeout = setTimeout(function () {
  6012. _this.hide();
  6013. }, _this._config.delay);
  6014. }
  6015. };
  6016. this._element.classList.remove(ClassName$a.HIDE);
  6017. Util.reflow(this._element);
  6018. this._element.classList.add(ClassName$a.SHOWING);
  6019. if (this._config.animation) {
  6020. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6021. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6022. } else {
  6023. complete();
  6024. }
  6025. };
  6026. _proto.hide = function hide() {
  6027. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  6028. return;
  6029. }
  6030. var hideEvent = $.Event(Event$a.HIDE);
  6031. $(this._element).trigger(hideEvent);
  6032. if (hideEvent.isDefaultPrevented()) {
  6033. return;
  6034. }
  6035. this._close();
  6036. };
  6037. _proto.dispose = function dispose() {
  6038. clearTimeout(this._timeout);
  6039. this._timeout = null;
  6040. if (this._element.classList.contains(ClassName$a.SHOW)) {
  6041. this._element.classList.remove(ClassName$a.SHOW);
  6042. }
  6043. $(this._element).off(Event$a.CLICK_DISMISS);
  6044. $.removeData(this._element, DATA_KEY$a);
  6045. this._element = null;
  6046. this._config = null;
  6047. } // Private
  6048. ;
  6049. _proto._getConfig = function _getConfig(config) {
  6050. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  6051. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  6052. return config;
  6053. };
  6054. _proto._setListeners = function _setListeners() {
  6055. var _this2 = this;
  6056. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  6057. return _this2.hide();
  6058. });
  6059. };
  6060. _proto._close = function _close() {
  6061. var _this3 = this;
  6062. var complete = function complete() {
  6063. _this3._element.classList.add(ClassName$a.HIDE);
  6064. $(_this3._element).trigger(Event$a.HIDDEN);
  6065. };
  6066. this._element.classList.remove(ClassName$a.SHOW);
  6067. if (this._config.animation) {
  6068. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6069. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6070. } else {
  6071. complete();
  6072. }
  6073. } // Static
  6074. ;
  6075. Toast._jQueryInterface = function _jQueryInterface(config) {
  6076. return this.each(function () {
  6077. var $element = $(this);
  6078. var data = $element.data(DATA_KEY$a);
  6079. var _config = typeof config === 'object' && config;
  6080. if (!data) {
  6081. data = new Toast(this, _config);
  6082. $element.data(DATA_KEY$a, data);
  6083. }
  6084. if (typeof config === 'string') {
  6085. if (typeof data[config] === 'undefined') {
  6086. throw new TypeError("No method named \"" + config + "\"");
  6087. }
  6088. data[config](this);
  6089. }
  6090. });
  6091. };
  6092. _createClass(Toast, null, [{
  6093. key: "VERSION",
  6094. get: function get() {
  6095. return VERSION$a;
  6096. }
  6097. }, {
  6098. key: "DefaultType",
  6099. get: function get() {
  6100. return DefaultType$7;
  6101. }
  6102. }, {
  6103. key: "Default",
  6104. get: function get() {
  6105. return Default$7;
  6106. }
  6107. }]);
  6108. return Toast;
  6109. }();
  6110. /**
  6111. * ------------------------------------------------------------------------
  6112. * jQuery
  6113. * ------------------------------------------------------------------------
  6114. */
  6115. $.fn[NAME$a] = Toast._jQueryInterface;
  6116. $.fn[NAME$a].Constructor = Toast;
  6117. $.fn[NAME$a].noConflict = function () {
  6118. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  6119. return Toast._jQueryInterface;
  6120. };
  6121. exports.Alert = Alert;
  6122. exports.Button = Button;
  6123. exports.Carousel = Carousel;
  6124. exports.Collapse = Collapse;
  6125. exports.Dropdown = Dropdown;
  6126. exports.Modal = Modal;
  6127. exports.Popover = Popover;
  6128. exports.Scrollspy = ScrollSpy;
  6129. exports.Tab = Tab;
  6130. exports.Toast = Toast;
  6131. exports.Tooltip = Tooltip;
  6132. exports.Util = Util;
  6133. Object.defineProperty(exports, '__esModule', { value: true });
  6134. })));
  6135. //# sourceMappingURL=bootstrap.js.map
  6136. /***/ }),
  6137. /***/ "./node_modules/buffer/index.js":
  6138. /*!**************************************!*\
  6139. !*** ./node_modules/buffer/index.js ***!
  6140. \**************************************/
  6141. /*! no static exports found */
  6142. /***/ (function(module, exports, __webpack_require__) {
  6143. "use strict";
  6144. /* WEBPACK VAR INJECTION */(function(global) {/*!
  6145. * The buffer module from node.js, for the browser.
  6146. *
  6147. * @author Feross Aboukhadijeh <http://feross.org>
  6148. * @license MIT
  6149. */
  6150. /* eslint-disable no-proto */
  6151. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  6152. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  6153. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  6154. exports.Buffer = Buffer
  6155. exports.SlowBuffer = SlowBuffer
  6156. exports.INSPECT_MAX_BYTES = 50
  6157. /**
  6158. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  6159. * === true Use Uint8Array implementation (fastest)
  6160. * === false Use Object implementation (most compatible, even IE6)
  6161. *
  6162. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  6163. * Opera 11.6+, iOS 4.2+.
  6164. *
  6165. * Due to various browser bugs, sometimes the Object implementation will be used even
  6166. * when the browser supports typed arrays.
  6167. *
  6168. * Note:
  6169. *
  6170. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  6171. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  6172. *
  6173. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  6174. *
  6175. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  6176. * incorrect length in some situations.
  6177. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  6178. * get the Object implementation, which is slower but behaves correctly.
  6179. */
  6180. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  6181. ? global.TYPED_ARRAY_SUPPORT
  6182. : typedArraySupport()
  6183. /*
  6184. * Export kMaxLength after typed array support is determined.
  6185. */
  6186. exports.kMaxLength = kMaxLength()
  6187. function typedArraySupport () {
  6188. try {
  6189. var arr = new Uint8Array(1)
  6190. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  6191. return arr.foo() === 42 && // typed array instances can be augmented
  6192. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  6193. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  6194. } catch (e) {
  6195. return false
  6196. }
  6197. }
  6198. function kMaxLength () {
  6199. return Buffer.TYPED_ARRAY_SUPPORT
  6200. ? 0x7fffffff
  6201. : 0x3fffffff
  6202. }
  6203. function createBuffer (that, length) {
  6204. if (kMaxLength() < length) {
  6205. throw new RangeError('Invalid typed array length')
  6206. }
  6207. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6208. // Return an augmented `Uint8Array` instance, for best performance
  6209. that = new Uint8Array(length)
  6210. that.__proto__ = Buffer.prototype
  6211. } else {
  6212. // Fallback: Return an object instance of the Buffer class
  6213. if (that === null) {
  6214. that = new Buffer(length)
  6215. }
  6216. that.length = length
  6217. }
  6218. return that
  6219. }
  6220. /**
  6221. * The Buffer constructor returns instances of `Uint8Array` that have their
  6222. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  6223. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  6224. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  6225. * returns a single octet.
  6226. *
  6227. * The `Uint8Array` prototype remains unmodified.
  6228. */
  6229. function Buffer (arg, encodingOrOffset, length) {
  6230. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  6231. return new Buffer(arg, encodingOrOffset, length)
  6232. }
  6233. // Common case.
  6234. if (typeof arg === 'number') {
  6235. if (typeof encodingOrOffset === 'string') {
  6236. throw new Error(
  6237. 'If encoding is specified then the first argument must be a string'
  6238. )
  6239. }
  6240. return allocUnsafe(this, arg)
  6241. }
  6242. return from(this, arg, encodingOrOffset, length)
  6243. }
  6244. Buffer.poolSize = 8192 // not used by this implementation
  6245. // TODO: Legacy, not needed anymore. Remove in next major version.
  6246. Buffer._augment = function (arr) {
  6247. arr.__proto__ = Buffer.prototype
  6248. return arr
  6249. }
  6250. function from (that, value, encodingOrOffset, length) {
  6251. if (typeof value === 'number') {
  6252. throw new TypeError('"value" argument must not be a number')
  6253. }
  6254. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  6255. return fromArrayBuffer(that, value, encodingOrOffset, length)
  6256. }
  6257. if (typeof value === 'string') {
  6258. return fromString(that, value, encodingOrOffset)
  6259. }
  6260. return fromObject(that, value)
  6261. }
  6262. /**
  6263. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  6264. * if value is a number.
  6265. * Buffer.from(str[, encoding])
  6266. * Buffer.from(array)
  6267. * Buffer.from(buffer)
  6268. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  6269. **/
  6270. Buffer.from = function (value, encodingOrOffset, length) {
  6271. return from(null, value, encodingOrOffset, length)
  6272. }
  6273. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6274. Buffer.prototype.__proto__ = Uint8Array.prototype
  6275. Buffer.__proto__ = Uint8Array
  6276. if (typeof Symbol !== 'undefined' && Symbol.species &&
  6277. Buffer[Symbol.species] === Buffer) {
  6278. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  6279. Object.defineProperty(Buffer, Symbol.species, {
  6280. value: null,
  6281. configurable: true
  6282. })
  6283. }
  6284. }
  6285. function assertSize (size) {
  6286. if (typeof size !== 'number') {
  6287. throw new TypeError('"size" argument must be a number')
  6288. } else if (size < 0) {
  6289. throw new RangeError('"size" argument must not be negative')
  6290. }
  6291. }
  6292. function alloc (that, size, fill, encoding) {
  6293. assertSize(size)
  6294. if (size <= 0) {
  6295. return createBuffer(that, size)
  6296. }
  6297. if (fill !== undefined) {
  6298. // Only pay attention to encoding if it's a string. This
  6299. // prevents accidentally sending in a number that would
  6300. // be interpretted as a start offset.
  6301. return typeof encoding === 'string'
  6302. ? createBuffer(that, size).fill(fill, encoding)
  6303. : createBuffer(that, size).fill(fill)
  6304. }
  6305. return createBuffer(that, size)
  6306. }
  6307. /**
  6308. * Creates a new filled Buffer instance.
  6309. * alloc(size[, fill[, encoding]])
  6310. **/
  6311. Buffer.alloc = function (size, fill, encoding) {
  6312. return alloc(null, size, fill, encoding)
  6313. }
  6314. function allocUnsafe (that, size) {
  6315. assertSize(size)
  6316. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  6317. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  6318. for (var i = 0; i < size; ++i) {
  6319. that[i] = 0
  6320. }
  6321. }
  6322. return that
  6323. }
  6324. /**
  6325. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  6326. * */
  6327. Buffer.allocUnsafe = function (size) {
  6328. return allocUnsafe(null, size)
  6329. }
  6330. /**
  6331. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  6332. */
  6333. Buffer.allocUnsafeSlow = function (size) {
  6334. return allocUnsafe(null, size)
  6335. }
  6336. function fromString (that, string, encoding) {
  6337. if (typeof encoding !== 'string' || encoding === '') {
  6338. encoding = 'utf8'
  6339. }
  6340. if (!Buffer.isEncoding(encoding)) {
  6341. throw new TypeError('"encoding" must be a valid string encoding')
  6342. }
  6343. var length = byteLength(string, encoding) | 0
  6344. that = createBuffer(that, length)
  6345. var actual = that.write(string, encoding)
  6346. if (actual !== length) {
  6347. // Writing a hex string, for example, that contains invalid characters will
  6348. // cause everything after the first invalid character to be ignored. (e.g.
  6349. // 'abxxcd' will be treated as 'ab')
  6350. that = that.slice(0, actual)
  6351. }
  6352. return that
  6353. }
  6354. function fromArrayLike (that, array) {
  6355. var length = array.length < 0 ? 0 : checked(array.length) | 0
  6356. that = createBuffer(that, length)
  6357. for (var i = 0; i < length; i += 1) {
  6358. that[i] = array[i] & 255
  6359. }
  6360. return that
  6361. }
  6362. function fromArrayBuffer (that, array, byteOffset, length) {
  6363. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  6364. if (byteOffset < 0 || array.byteLength < byteOffset) {
  6365. throw new RangeError('\'offset\' is out of bounds')
  6366. }
  6367. if (array.byteLength < byteOffset + (length || 0)) {
  6368. throw new RangeError('\'length\' is out of bounds')
  6369. }
  6370. if (byteOffset === undefined && length === undefined) {
  6371. array = new Uint8Array(array)
  6372. } else if (length === undefined) {
  6373. array = new Uint8Array(array, byteOffset)
  6374. } else {
  6375. array = new Uint8Array(array, byteOffset, length)
  6376. }
  6377. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6378. // Return an augmented `Uint8Array` instance, for best performance
  6379. that = array
  6380. that.__proto__ = Buffer.prototype
  6381. } else {
  6382. // Fallback: Return an object instance of the Buffer class
  6383. that = fromArrayLike(that, array)
  6384. }
  6385. return that
  6386. }
  6387. function fromObject (that, obj) {
  6388. if (Buffer.isBuffer(obj)) {
  6389. var len = checked(obj.length) | 0
  6390. that = createBuffer(that, len)
  6391. if (that.length === 0) {
  6392. return that
  6393. }
  6394. obj.copy(that, 0, 0, len)
  6395. return that
  6396. }
  6397. if (obj) {
  6398. if ((typeof ArrayBuffer !== 'undefined' &&
  6399. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  6400. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  6401. return createBuffer(that, 0)
  6402. }
  6403. return fromArrayLike(that, obj)
  6404. }
  6405. if (obj.type === 'Buffer' && isArray(obj.data)) {
  6406. return fromArrayLike(that, obj.data)
  6407. }
  6408. }
  6409. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  6410. }
  6411. function checked (length) {
  6412. // Note: cannot use `length < kMaxLength()` here because that fails when
  6413. // length is NaN (which is otherwise coerced to zero.)
  6414. if (length >= kMaxLength()) {
  6415. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  6416. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  6417. }
  6418. return length | 0
  6419. }
  6420. function SlowBuffer (length) {
  6421. if (+length != length) { // eslint-disable-line eqeqeq
  6422. length = 0
  6423. }
  6424. return Buffer.alloc(+length)
  6425. }
  6426. Buffer.isBuffer = function isBuffer (b) {
  6427. return !!(b != null && b._isBuffer)
  6428. }
  6429. Buffer.compare = function compare (a, b) {
  6430. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  6431. throw new TypeError('Arguments must be Buffers')
  6432. }
  6433. if (a === b) return 0
  6434. var x = a.length
  6435. var y = b.length
  6436. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  6437. if (a[i] !== b[i]) {
  6438. x = a[i]
  6439. y = b[i]
  6440. break
  6441. }
  6442. }
  6443. if (x < y) return -1
  6444. if (y < x) return 1
  6445. return 0
  6446. }
  6447. Buffer.isEncoding = function isEncoding (encoding) {
  6448. switch (String(encoding).toLowerCase()) {
  6449. case 'hex':
  6450. case 'utf8':
  6451. case 'utf-8':
  6452. case 'ascii':
  6453. case 'latin1':
  6454. case 'binary':
  6455. case 'base64':
  6456. case 'ucs2':
  6457. case 'ucs-2':
  6458. case 'utf16le':
  6459. case 'utf-16le':
  6460. return true
  6461. default:
  6462. return false
  6463. }
  6464. }
  6465. Buffer.concat = function concat (list, length) {
  6466. if (!isArray(list)) {
  6467. throw new TypeError('"list" argument must be an Array of Buffers')
  6468. }
  6469. if (list.length === 0) {
  6470. return Buffer.alloc(0)
  6471. }
  6472. var i
  6473. if (length === undefined) {
  6474. length = 0
  6475. for (i = 0; i < list.length; ++i) {
  6476. length += list[i].length
  6477. }
  6478. }
  6479. var buffer = Buffer.allocUnsafe(length)
  6480. var pos = 0
  6481. for (i = 0; i < list.length; ++i) {
  6482. var buf = list[i]
  6483. if (!Buffer.isBuffer(buf)) {
  6484. throw new TypeError('"list" argument must be an Array of Buffers')
  6485. }
  6486. buf.copy(buffer, pos)
  6487. pos += buf.length
  6488. }
  6489. return buffer
  6490. }
  6491. function byteLength (string, encoding) {
  6492. if (Buffer.isBuffer(string)) {
  6493. return string.length
  6494. }
  6495. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  6496. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  6497. return string.byteLength
  6498. }
  6499. if (typeof string !== 'string') {
  6500. string = '' + string
  6501. }
  6502. var len = string.length
  6503. if (len === 0) return 0
  6504. // Use a for loop to avoid recursion
  6505. var loweredCase = false
  6506. for (;;) {
  6507. switch (encoding) {
  6508. case 'ascii':
  6509. case 'latin1':
  6510. case 'binary':
  6511. return len
  6512. case 'utf8':
  6513. case 'utf-8':
  6514. case undefined:
  6515. return utf8ToBytes(string).length
  6516. case 'ucs2':
  6517. case 'ucs-2':
  6518. case 'utf16le':
  6519. case 'utf-16le':
  6520. return len * 2
  6521. case 'hex':
  6522. return len >>> 1
  6523. case 'base64':
  6524. return base64ToBytes(string).length
  6525. default:
  6526. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  6527. encoding = ('' + encoding).toLowerCase()
  6528. loweredCase = true
  6529. }
  6530. }
  6531. }
  6532. Buffer.byteLength = byteLength
  6533. function slowToString (encoding, start, end) {
  6534. var loweredCase = false
  6535. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  6536. // property of a typed array.
  6537. // This behaves neither like String nor Uint8Array in that we set start/end
  6538. // to their upper/lower bounds if the value passed is out of range.
  6539. // undefined is handled specially as per ECMA-262 6th Edition,
  6540. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  6541. if (start === undefined || start < 0) {
  6542. start = 0
  6543. }
  6544. // Return early if start > this.length. Done here to prevent potential uint32
  6545. // coercion fail below.
  6546. if (start > this.length) {
  6547. return ''
  6548. }
  6549. if (end === undefined || end > this.length) {
  6550. end = this.length
  6551. }
  6552. if (end <= 0) {
  6553. return ''
  6554. }
  6555. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  6556. end >>>= 0
  6557. start >>>= 0
  6558. if (end <= start) {
  6559. return ''
  6560. }
  6561. if (!encoding) encoding = 'utf8'
  6562. while (true) {
  6563. switch (encoding) {
  6564. case 'hex':
  6565. return hexSlice(this, start, end)
  6566. case 'utf8':
  6567. case 'utf-8':
  6568. return utf8Slice(this, start, end)
  6569. case 'ascii':
  6570. return asciiSlice(this, start, end)
  6571. case 'latin1':
  6572. case 'binary':
  6573. return latin1Slice(this, start, end)
  6574. case 'base64':
  6575. return base64Slice(this, start, end)
  6576. case 'ucs2':
  6577. case 'ucs-2':
  6578. case 'utf16le':
  6579. case 'utf-16le':
  6580. return utf16leSlice(this, start, end)
  6581. default:
  6582. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6583. encoding = (encoding + '').toLowerCase()
  6584. loweredCase = true
  6585. }
  6586. }
  6587. }
  6588. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  6589. // Buffer instances.
  6590. Buffer.prototype._isBuffer = true
  6591. function swap (b, n, m) {
  6592. var i = b[n]
  6593. b[n] = b[m]
  6594. b[m] = i
  6595. }
  6596. Buffer.prototype.swap16 = function swap16 () {
  6597. var len = this.length
  6598. if (len % 2 !== 0) {
  6599. throw new RangeError('Buffer size must be a multiple of 16-bits')
  6600. }
  6601. for (var i = 0; i < len; i += 2) {
  6602. swap(this, i, i + 1)
  6603. }
  6604. return this
  6605. }
  6606. Buffer.prototype.swap32 = function swap32 () {
  6607. var len = this.length
  6608. if (len % 4 !== 0) {
  6609. throw new RangeError('Buffer size must be a multiple of 32-bits')
  6610. }
  6611. for (var i = 0; i < len; i += 4) {
  6612. swap(this, i, i + 3)
  6613. swap(this, i + 1, i + 2)
  6614. }
  6615. return this
  6616. }
  6617. Buffer.prototype.swap64 = function swap64 () {
  6618. var len = this.length
  6619. if (len % 8 !== 0) {
  6620. throw new RangeError('Buffer size must be a multiple of 64-bits')
  6621. }
  6622. for (var i = 0; i < len; i += 8) {
  6623. swap(this, i, i + 7)
  6624. swap(this, i + 1, i + 6)
  6625. swap(this, i + 2, i + 5)
  6626. swap(this, i + 3, i + 4)
  6627. }
  6628. return this
  6629. }
  6630. Buffer.prototype.toString = function toString () {
  6631. var length = this.length | 0
  6632. if (length === 0) return ''
  6633. if (arguments.length === 0) return utf8Slice(this, 0, length)
  6634. return slowToString.apply(this, arguments)
  6635. }
  6636. Buffer.prototype.equals = function equals (b) {
  6637. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  6638. if (this === b) return true
  6639. return Buffer.compare(this, b) === 0
  6640. }
  6641. Buffer.prototype.inspect = function inspect () {
  6642. var str = ''
  6643. var max = exports.INSPECT_MAX_BYTES
  6644. if (this.length > 0) {
  6645. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  6646. if (this.length > max) str += ' ... '
  6647. }
  6648. return '<Buffer ' + str + '>'
  6649. }
  6650. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  6651. if (!Buffer.isBuffer(target)) {
  6652. throw new TypeError('Argument must be a Buffer')
  6653. }
  6654. if (start === undefined) {
  6655. start = 0
  6656. }
  6657. if (end === undefined) {
  6658. end = target ? target.length : 0
  6659. }
  6660. if (thisStart === undefined) {
  6661. thisStart = 0
  6662. }
  6663. if (thisEnd === undefined) {
  6664. thisEnd = this.length
  6665. }
  6666. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  6667. throw new RangeError('out of range index')
  6668. }
  6669. if (thisStart >= thisEnd && start >= end) {
  6670. return 0
  6671. }
  6672. if (thisStart >= thisEnd) {
  6673. return -1
  6674. }
  6675. if (start >= end) {
  6676. return 1
  6677. }
  6678. start >>>= 0
  6679. end >>>= 0
  6680. thisStart >>>= 0
  6681. thisEnd >>>= 0
  6682. if (this === target) return 0
  6683. var x = thisEnd - thisStart
  6684. var y = end - start
  6685. var len = Math.min(x, y)
  6686. var thisCopy = this.slice(thisStart, thisEnd)
  6687. var targetCopy = target.slice(start, end)
  6688. for (var i = 0; i < len; ++i) {
  6689. if (thisCopy[i] !== targetCopy[i]) {
  6690. x = thisCopy[i]
  6691. y = targetCopy[i]
  6692. break
  6693. }
  6694. }
  6695. if (x < y) return -1
  6696. if (y < x) return 1
  6697. return 0
  6698. }
  6699. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  6700. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  6701. //
  6702. // Arguments:
  6703. // - buffer - a Buffer to search
  6704. // - val - a string, Buffer, or number
  6705. // - byteOffset - an index into `buffer`; will be clamped to an int32
  6706. // - encoding - an optional encoding, relevant is val is a string
  6707. // - dir - true for indexOf, false for lastIndexOf
  6708. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  6709. // Empty buffer means no match
  6710. if (buffer.length === 0) return -1
  6711. // Normalize byteOffset
  6712. if (typeof byteOffset === 'string') {
  6713. encoding = byteOffset
  6714. byteOffset = 0
  6715. } else if (byteOffset > 0x7fffffff) {
  6716. byteOffset = 0x7fffffff
  6717. } else if (byteOffset < -0x80000000) {
  6718. byteOffset = -0x80000000
  6719. }
  6720. byteOffset = +byteOffset // Coerce to Number.
  6721. if (isNaN(byteOffset)) {
  6722. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  6723. byteOffset = dir ? 0 : (buffer.length - 1)
  6724. }
  6725. // Normalize byteOffset: negative offsets start from the end of the buffer
  6726. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  6727. if (byteOffset >= buffer.length) {
  6728. if (dir) return -1
  6729. else byteOffset = buffer.length - 1
  6730. } else if (byteOffset < 0) {
  6731. if (dir) byteOffset = 0
  6732. else return -1
  6733. }
  6734. // Normalize val
  6735. if (typeof val === 'string') {
  6736. val = Buffer.from(val, encoding)
  6737. }
  6738. // Finally, search either indexOf (if dir is true) or lastIndexOf
  6739. if (Buffer.isBuffer(val)) {
  6740. // Special case: looking for empty string/buffer always fails
  6741. if (val.length === 0) {
  6742. return -1
  6743. }
  6744. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  6745. } else if (typeof val === 'number') {
  6746. val = val & 0xFF // Search for a byte value [0-255]
  6747. if (Buffer.TYPED_ARRAY_SUPPORT &&
  6748. typeof Uint8Array.prototype.indexOf === 'function') {
  6749. if (dir) {
  6750. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  6751. } else {
  6752. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  6753. }
  6754. }
  6755. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  6756. }
  6757. throw new TypeError('val must be string, number or Buffer')
  6758. }
  6759. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  6760. var indexSize = 1
  6761. var arrLength = arr.length
  6762. var valLength = val.length
  6763. if (encoding !== undefined) {
  6764. encoding = String(encoding).toLowerCase()
  6765. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  6766. encoding === 'utf16le' || encoding === 'utf-16le') {
  6767. if (arr.length < 2 || val.length < 2) {
  6768. return -1
  6769. }
  6770. indexSize = 2
  6771. arrLength /= 2
  6772. valLength /= 2
  6773. byteOffset /= 2
  6774. }
  6775. }
  6776. function read (buf, i) {
  6777. if (indexSize === 1) {
  6778. return buf[i]
  6779. } else {
  6780. return buf.readUInt16BE(i * indexSize)
  6781. }
  6782. }
  6783. var i
  6784. if (dir) {
  6785. var foundIndex = -1
  6786. for (i = byteOffset; i < arrLength; i++) {
  6787. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  6788. if (foundIndex === -1) foundIndex = i
  6789. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  6790. } else {
  6791. if (foundIndex !== -1) i -= i - foundIndex
  6792. foundIndex = -1
  6793. }
  6794. }
  6795. } else {
  6796. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  6797. for (i = byteOffset; i >= 0; i--) {
  6798. var found = true
  6799. for (var j = 0; j < valLength; j++) {
  6800. if (read(arr, i + j) !== read(val, j)) {
  6801. found = false
  6802. break
  6803. }
  6804. }
  6805. if (found) return i
  6806. }
  6807. }
  6808. return -1
  6809. }
  6810. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  6811. return this.indexOf(val, byteOffset, encoding) !== -1
  6812. }
  6813. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  6814. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  6815. }
  6816. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  6817. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  6818. }
  6819. function hexWrite (buf, string, offset, length) {
  6820. offset = Number(offset) || 0
  6821. var remaining = buf.length - offset
  6822. if (!length) {
  6823. length = remaining
  6824. } else {
  6825. length = Number(length)
  6826. if (length > remaining) {
  6827. length = remaining
  6828. }
  6829. }
  6830. // must be an even number of digits
  6831. var strLen = string.length
  6832. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  6833. if (length > strLen / 2) {
  6834. length = strLen / 2
  6835. }
  6836. for (var i = 0; i < length; ++i) {
  6837. var parsed = parseInt(string.substr(i * 2, 2), 16)
  6838. if (isNaN(parsed)) return i
  6839. buf[offset + i] = parsed
  6840. }
  6841. return i
  6842. }
  6843. function utf8Write (buf, string, offset, length) {
  6844. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  6845. }
  6846. function asciiWrite (buf, string, offset, length) {
  6847. return blitBuffer(asciiToBytes(string), buf, offset, length)
  6848. }
  6849. function latin1Write (buf, string, offset, length) {
  6850. return asciiWrite(buf, string, offset, length)
  6851. }
  6852. function base64Write (buf, string, offset, length) {
  6853. return blitBuffer(base64ToBytes(string), buf, offset, length)
  6854. }
  6855. function ucs2Write (buf, string, offset, length) {
  6856. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  6857. }
  6858. Buffer.prototype.write = function write (string, offset, length, encoding) {
  6859. // Buffer#write(string)
  6860. if (offset === undefined) {
  6861. encoding = 'utf8'
  6862. length = this.length
  6863. offset = 0
  6864. // Buffer#write(string, encoding)
  6865. } else if (length === undefined && typeof offset === 'string') {
  6866. encoding = offset
  6867. length = this.length
  6868. offset = 0
  6869. // Buffer#write(string, offset[, length][, encoding])
  6870. } else if (isFinite(offset)) {
  6871. offset = offset | 0
  6872. if (isFinite(length)) {
  6873. length = length | 0
  6874. if (encoding === undefined) encoding = 'utf8'
  6875. } else {
  6876. encoding = length
  6877. length = undefined
  6878. }
  6879. // legacy write(string, encoding, offset, length) - remove in v0.13
  6880. } else {
  6881. throw new Error(
  6882. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  6883. )
  6884. }
  6885. var remaining = this.length - offset
  6886. if (length === undefined || length > remaining) length = remaining
  6887. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  6888. throw new RangeError('Attempt to write outside buffer bounds')
  6889. }
  6890. if (!encoding) encoding = 'utf8'
  6891. var loweredCase = false
  6892. for (;;) {
  6893. switch (encoding) {
  6894. case 'hex':
  6895. return hexWrite(this, string, offset, length)
  6896. case 'utf8':
  6897. case 'utf-8':
  6898. return utf8Write(this, string, offset, length)
  6899. case 'ascii':
  6900. return asciiWrite(this, string, offset, length)
  6901. case 'latin1':
  6902. case 'binary':
  6903. return latin1Write(this, string, offset, length)
  6904. case 'base64':
  6905. // Warning: maxLength not taken into account in base64Write
  6906. return base64Write(this, string, offset, length)
  6907. case 'ucs2':
  6908. case 'ucs-2':
  6909. case 'utf16le':
  6910. case 'utf-16le':
  6911. return ucs2Write(this, string, offset, length)
  6912. default:
  6913. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6914. encoding = ('' + encoding).toLowerCase()
  6915. loweredCase = true
  6916. }
  6917. }
  6918. }
  6919. Buffer.prototype.toJSON = function toJSON () {
  6920. return {
  6921. type: 'Buffer',
  6922. data: Array.prototype.slice.call(this._arr || this, 0)
  6923. }
  6924. }
  6925. function base64Slice (buf, start, end) {
  6926. if (start === 0 && end === buf.length) {
  6927. return base64.fromByteArray(buf)
  6928. } else {
  6929. return base64.fromByteArray(buf.slice(start, end))
  6930. }
  6931. }
  6932. function utf8Slice (buf, start, end) {
  6933. end = Math.min(buf.length, end)
  6934. var res = []
  6935. var i = start
  6936. while (i < end) {
  6937. var firstByte = buf[i]
  6938. var codePoint = null
  6939. var bytesPerSequence = (firstByte > 0xEF) ? 4
  6940. : (firstByte > 0xDF) ? 3
  6941. : (firstByte > 0xBF) ? 2
  6942. : 1
  6943. if (i + bytesPerSequence <= end) {
  6944. var secondByte, thirdByte, fourthByte, tempCodePoint
  6945. switch (bytesPerSequence) {
  6946. case 1:
  6947. if (firstByte < 0x80) {
  6948. codePoint = firstByte
  6949. }
  6950. break
  6951. case 2:
  6952. secondByte = buf[i + 1]
  6953. if ((secondByte & 0xC0) === 0x80) {
  6954. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  6955. if (tempCodePoint > 0x7F) {
  6956. codePoint = tempCodePoint
  6957. }
  6958. }
  6959. break
  6960. case 3:
  6961. secondByte = buf[i + 1]
  6962. thirdByte = buf[i + 2]
  6963. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  6964. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  6965. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  6966. codePoint = tempCodePoint
  6967. }
  6968. }
  6969. break
  6970. case 4:
  6971. secondByte = buf[i + 1]
  6972. thirdByte = buf[i + 2]
  6973. fourthByte = buf[i + 3]
  6974. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  6975. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  6976. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  6977. codePoint = tempCodePoint
  6978. }
  6979. }
  6980. }
  6981. }
  6982. if (codePoint === null) {
  6983. // we did not generate a valid codePoint so insert a
  6984. // replacement char (U+FFFD) and advance only 1 byte
  6985. codePoint = 0xFFFD
  6986. bytesPerSequence = 1
  6987. } else if (codePoint > 0xFFFF) {
  6988. // encode to utf16 (surrogate pair dance)
  6989. codePoint -= 0x10000
  6990. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  6991. codePoint = 0xDC00 | codePoint & 0x3FF
  6992. }
  6993. res.push(codePoint)
  6994. i += bytesPerSequence
  6995. }
  6996. return decodeCodePointsArray(res)
  6997. }
  6998. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  6999. // the lowest limit is Chrome, with 0x10000 args.
  7000. // We go 1 magnitude less, for safety
  7001. var MAX_ARGUMENTS_LENGTH = 0x1000
  7002. function decodeCodePointsArray (codePoints) {
  7003. var len = codePoints.length
  7004. if (len <= MAX_ARGUMENTS_LENGTH) {
  7005. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  7006. }
  7007. // Decode in chunks to avoid "call stack size exceeded".
  7008. var res = ''
  7009. var i = 0
  7010. while (i < len) {
  7011. res += String.fromCharCode.apply(
  7012. String,
  7013. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  7014. )
  7015. }
  7016. return res
  7017. }
  7018. function asciiSlice (buf, start, end) {
  7019. var ret = ''
  7020. end = Math.min(buf.length, end)
  7021. for (var i = start; i < end; ++i) {
  7022. ret += String.fromCharCode(buf[i] & 0x7F)
  7023. }
  7024. return ret
  7025. }
  7026. function latin1Slice (buf, start, end) {
  7027. var ret = ''
  7028. end = Math.min(buf.length, end)
  7029. for (var i = start; i < end; ++i) {
  7030. ret += String.fromCharCode(buf[i])
  7031. }
  7032. return ret
  7033. }
  7034. function hexSlice (buf, start, end) {
  7035. var len = buf.length
  7036. if (!start || start < 0) start = 0
  7037. if (!end || end < 0 || end > len) end = len
  7038. var out = ''
  7039. for (var i = start; i < end; ++i) {
  7040. out += toHex(buf[i])
  7041. }
  7042. return out
  7043. }
  7044. function utf16leSlice (buf, start, end) {
  7045. var bytes = buf.slice(start, end)
  7046. var res = ''
  7047. for (var i = 0; i < bytes.length; i += 2) {
  7048. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  7049. }
  7050. return res
  7051. }
  7052. Buffer.prototype.slice = function slice (start, end) {
  7053. var len = this.length
  7054. start = ~~start
  7055. end = end === undefined ? len : ~~end
  7056. if (start < 0) {
  7057. start += len
  7058. if (start < 0) start = 0
  7059. } else if (start > len) {
  7060. start = len
  7061. }
  7062. if (end < 0) {
  7063. end += len
  7064. if (end < 0) end = 0
  7065. } else if (end > len) {
  7066. end = len
  7067. }
  7068. if (end < start) end = start
  7069. var newBuf
  7070. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7071. newBuf = this.subarray(start, end)
  7072. newBuf.__proto__ = Buffer.prototype
  7073. } else {
  7074. var sliceLen = end - start
  7075. newBuf = new Buffer(sliceLen, undefined)
  7076. for (var i = 0; i < sliceLen; ++i) {
  7077. newBuf[i] = this[i + start]
  7078. }
  7079. }
  7080. return newBuf
  7081. }
  7082. /*
  7083. * Need to make sure that buffer isn't trying to write out of bounds.
  7084. */
  7085. function checkOffset (offset, ext, length) {
  7086. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  7087. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  7088. }
  7089. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  7090. offset = offset | 0
  7091. byteLength = byteLength | 0
  7092. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7093. var val = this[offset]
  7094. var mul = 1
  7095. var i = 0
  7096. while (++i < byteLength && (mul *= 0x100)) {
  7097. val += this[offset + i] * mul
  7098. }
  7099. return val
  7100. }
  7101. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  7102. offset = offset | 0
  7103. byteLength = byteLength | 0
  7104. if (!noAssert) {
  7105. checkOffset(offset, byteLength, this.length)
  7106. }
  7107. var val = this[offset + --byteLength]
  7108. var mul = 1
  7109. while (byteLength > 0 && (mul *= 0x100)) {
  7110. val += this[offset + --byteLength] * mul
  7111. }
  7112. return val
  7113. }
  7114. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  7115. if (!noAssert) checkOffset(offset, 1, this.length)
  7116. return this[offset]
  7117. }
  7118. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  7119. if (!noAssert) checkOffset(offset, 2, this.length)
  7120. return this[offset] | (this[offset + 1] << 8)
  7121. }
  7122. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  7123. if (!noAssert) checkOffset(offset, 2, this.length)
  7124. return (this[offset] << 8) | this[offset + 1]
  7125. }
  7126. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  7127. if (!noAssert) checkOffset(offset, 4, this.length)
  7128. return ((this[offset]) |
  7129. (this[offset + 1] << 8) |
  7130. (this[offset + 2] << 16)) +
  7131. (this[offset + 3] * 0x1000000)
  7132. }
  7133. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  7134. if (!noAssert) checkOffset(offset, 4, this.length)
  7135. return (this[offset] * 0x1000000) +
  7136. ((this[offset + 1] << 16) |
  7137. (this[offset + 2] << 8) |
  7138. this[offset + 3])
  7139. }
  7140. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  7141. offset = offset | 0
  7142. byteLength = byteLength | 0
  7143. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7144. var val = this[offset]
  7145. var mul = 1
  7146. var i = 0
  7147. while (++i < byteLength && (mul *= 0x100)) {
  7148. val += this[offset + i] * mul
  7149. }
  7150. mul *= 0x80
  7151. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7152. return val
  7153. }
  7154. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  7155. offset = offset | 0
  7156. byteLength = byteLength | 0
  7157. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7158. var i = byteLength
  7159. var mul = 1
  7160. var val = this[offset + --i]
  7161. while (i > 0 && (mul *= 0x100)) {
  7162. val += this[offset + --i] * mul
  7163. }
  7164. mul *= 0x80
  7165. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7166. return val
  7167. }
  7168. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  7169. if (!noAssert) checkOffset(offset, 1, this.length)
  7170. if (!(this[offset] & 0x80)) return (this[offset])
  7171. return ((0xff - this[offset] + 1) * -1)
  7172. }
  7173. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  7174. if (!noAssert) checkOffset(offset, 2, this.length)
  7175. var val = this[offset] | (this[offset + 1] << 8)
  7176. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7177. }
  7178. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  7179. if (!noAssert) checkOffset(offset, 2, this.length)
  7180. var val = this[offset + 1] | (this[offset] << 8)
  7181. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7182. }
  7183. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  7184. if (!noAssert) checkOffset(offset, 4, this.length)
  7185. return (this[offset]) |
  7186. (this[offset + 1] << 8) |
  7187. (this[offset + 2] << 16) |
  7188. (this[offset + 3] << 24)
  7189. }
  7190. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  7191. if (!noAssert) checkOffset(offset, 4, this.length)
  7192. return (this[offset] << 24) |
  7193. (this[offset + 1] << 16) |
  7194. (this[offset + 2] << 8) |
  7195. (this[offset + 3])
  7196. }
  7197. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  7198. if (!noAssert) checkOffset(offset, 4, this.length)
  7199. return ieee754.read(this, offset, true, 23, 4)
  7200. }
  7201. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  7202. if (!noAssert) checkOffset(offset, 4, this.length)
  7203. return ieee754.read(this, offset, false, 23, 4)
  7204. }
  7205. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  7206. if (!noAssert) checkOffset(offset, 8, this.length)
  7207. return ieee754.read(this, offset, true, 52, 8)
  7208. }
  7209. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  7210. if (!noAssert) checkOffset(offset, 8, this.length)
  7211. return ieee754.read(this, offset, false, 52, 8)
  7212. }
  7213. function checkInt (buf, value, offset, ext, max, min) {
  7214. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  7215. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  7216. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7217. }
  7218. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  7219. value = +value
  7220. offset = offset | 0
  7221. byteLength = byteLength | 0
  7222. if (!noAssert) {
  7223. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7224. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7225. }
  7226. var mul = 1
  7227. var i = 0
  7228. this[offset] = value & 0xFF
  7229. while (++i < byteLength && (mul *= 0x100)) {
  7230. this[offset + i] = (value / mul) & 0xFF
  7231. }
  7232. return offset + byteLength
  7233. }
  7234. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  7235. value = +value
  7236. offset = offset | 0
  7237. byteLength = byteLength | 0
  7238. if (!noAssert) {
  7239. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7240. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7241. }
  7242. var i = byteLength - 1
  7243. var mul = 1
  7244. this[offset + i] = value & 0xFF
  7245. while (--i >= 0 && (mul *= 0x100)) {
  7246. this[offset + i] = (value / mul) & 0xFF
  7247. }
  7248. return offset + byteLength
  7249. }
  7250. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  7251. value = +value
  7252. offset = offset | 0
  7253. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  7254. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7255. this[offset] = (value & 0xff)
  7256. return offset + 1
  7257. }
  7258. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  7259. if (value < 0) value = 0xffff + value + 1
  7260. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  7261. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  7262. (littleEndian ? i : 1 - i) * 8
  7263. }
  7264. }
  7265. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  7266. value = +value
  7267. offset = offset | 0
  7268. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7269. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7270. this[offset] = (value & 0xff)
  7271. this[offset + 1] = (value >>> 8)
  7272. } else {
  7273. objectWriteUInt16(this, value, offset, true)
  7274. }
  7275. return offset + 2
  7276. }
  7277. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  7278. value = +value
  7279. offset = offset | 0
  7280. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7281. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7282. this[offset] = (value >>> 8)
  7283. this[offset + 1] = (value & 0xff)
  7284. } else {
  7285. objectWriteUInt16(this, value, offset, false)
  7286. }
  7287. return offset + 2
  7288. }
  7289. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  7290. if (value < 0) value = 0xffffffff + value + 1
  7291. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  7292. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  7293. }
  7294. }
  7295. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  7296. value = +value
  7297. offset = offset | 0
  7298. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7299. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7300. this[offset + 3] = (value >>> 24)
  7301. this[offset + 2] = (value >>> 16)
  7302. this[offset + 1] = (value >>> 8)
  7303. this[offset] = (value & 0xff)
  7304. } else {
  7305. objectWriteUInt32(this, value, offset, true)
  7306. }
  7307. return offset + 4
  7308. }
  7309. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  7310. value = +value
  7311. offset = offset | 0
  7312. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7313. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7314. this[offset] = (value >>> 24)
  7315. this[offset + 1] = (value >>> 16)
  7316. this[offset + 2] = (value >>> 8)
  7317. this[offset + 3] = (value & 0xff)
  7318. } else {
  7319. objectWriteUInt32(this, value, offset, false)
  7320. }
  7321. return offset + 4
  7322. }
  7323. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  7324. value = +value
  7325. offset = offset | 0
  7326. if (!noAssert) {
  7327. var limit = Math.pow(2, 8 * byteLength - 1)
  7328. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7329. }
  7330. var i = 0
  7331. var mul = 1
  7332. var sub = 0
  7333. this[offset] = value & 0xFF
  7334. while (++i < byteLength && (mul *= 0x100)) {
  7335. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  7336. sub = 1
  7337. }
  7338. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7339. }
  7340. return offset + byteLength
  7341. }
  7342. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  7343. value = +value
  7344. offset = offset | 0
  7345. if (!noAssert) {
  7346. var limit = Math.pow(2, 8 * byteLength - 1)
  7347. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7348. }
  7349. var i = byteLength - 1
  7350. var mul = 1
  7351. var sub = 0
  7352. this[offset + i] = value & 0xFF
  7353. while (--i >= 0 && (mul *= 0x100)) {
  7354. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  7355. sub = 1
  7356. }
  7357. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7358. }
  7359. return offset + byteLength
  7360. }
  7361. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  7362. value = +value
  7363. offset = offset | 0
  7364. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  7365. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7366. if (value < 0) value = 0xff + value + 1
  7367. this[offset] = (value & 0xff)
  7368. return offset + 1
  7369. }
  7370. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  7371. value = +value
  7372. offset = offset | 0
  7373. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7374. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7375. this[offset] = (value & 0xff)
  7376. this[offset + 1] = (value >>> 8)
  7377. } else {
  7378. objectWriteUInt16(this, value, offset, true)
  7379. }
  7380. return offset + 2
  7381. }
  7382. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  7383. value = +value
  7384. offset = offset | 0
  7385. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7386. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7387. this[offset] = (value >>> 8)
  7388. this[offset + 1] = (value & 0xff)
  7389. } else {
  7390. objectWriteUInt16(this, value, offset, false)
  7391. }
  7392. return offset + 2
  7393. }
  7394. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  7395. value = +value
  7396. offset = offset | 0
  7397. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7398. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7399. this[offset] = (value & 0xff)
  7400. this[offset + 1] = (value >>> 8)
  7401. this[offset + 2] = (value >>> 16)
  7402. this[offset + 3] = (value >>> 24)
  7403. } else {
  7404. objectWriteUInt32(this, value, offset, true)
  7405. }
  7406. return offset + 4
  7407. }
  7408. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  7409. value = +value
  7410. offset = offset | 0
  7411. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7412. if (value < 0) value = 0xffffffff + value + 1
  7413. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7414. this[offset] = (value >>> 24)
  7415. this[offset + 1] = (value >>> 16)
  7416. this[offset + 2] = (value >>> 8)
  7417. this[offset + 3] = (value & 0xff)
  7418. } else {
  7419. objectWriteUInt32(this, value, offset, false)
  7420. }
  7421. return offset + 4
  7422. }
  7423. function checkIEEE754 (buf, value, offset, ext, max, min) {
  7424. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7425. if (offset < 0) throw new RangeError('Index out of range')
  7426. }
  7427. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  7428. if (!noAssert) {
  7429. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  7430. }
  7431. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  7432. return offset + 4
  7433. }
  7434. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  7435. return writeFloat(this, value, offset, true, noAssert)
  7436. }
  7437. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  7438. return writeFloat(this, value, offset, false, noAssert)
  7439. }
  7440. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  7441. if (!noAssert) {
  7442. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  7443. }
  7444. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  7445. return offset + 8
  7446. }
  7447. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  7448. return writeDouble(this, value, offset, true, noAssert)
  7449. }
  7450. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  7451. return writeDouble(this, value, offset, false, noAssert)
  7452. }
  7453. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  7454. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  7455. if (!start) start = 0
  7456. if (!end && end !== 0) end = this.length
  7457. if (targetStart >= target.length) targetStart = target.length
  7458. if (!targetStart) targetStart = 0
  7459. if (end > 0 && end < start) end = start
  7460. // Copy 0 bytes; we're done
  7461. if (end === start) return 0
  7462. if (target.length === 0 || this.length === 0) return 0
  7463. // Fatal error conditions
  7464. if (targetStart < 0) {
  7465. throw new RangeError('targetStart out of bounds')
  7466. }
  7467. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  7468. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  7469. // Are we oob?
  7470. if (end > this.length) end = this.length
  7471. if (target.length - targetStart < end - start) {
  7472. end = target.length - targetStart + start
  7473. }
  7474. var len = end - start
  7475. var i
  7476. if (this === target && start < targetStart && targetStart < end) {
  7477. // descending copy from end
  7478. for (i = len - 1; i >= 0; --i) {
  7479. target[i + targetStart] = this[i + start]
  7480. }
  7481. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  7482. // ascending copy from start
  7483. for (i = 0; i < len; ++i) {
  7484. target[i + targetStart] = this[i + start]
  7485. }
  7486. } else {
  7487. Uint8Array.prototype.set.call(
  7488. target,
  7489. this.subarray(start, start + len),
  7490. targetStart
  7491. )
  7492. }
  7493. return len
  7494. }
  7495. // Usage:
  7496. // buffer.fill(number[, offset[, end]])
  7497. // buffer.fill(buffer[, offset[, end]])
  7498. // buffer.fill(string[, offset[, end]][, encoding])
  7499. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  7500. // Handle string cases:
  7501. if (typeof val === 'string') {
  7502. if (typeof start === 'string') {
  7503. encoding = start
  7504. start = 0
  7505. end = this.length
  7506. } else if (typeof end === 'string') {
  7507. encoding = end
  7508. end = this.length
  7509. }
  7510. if (val.length === 1) {
  7511. var code = val.charCodeAt(0)
  7512. if (code < 256) {
  7513. val = code
  7514. }
  7515. }
  7516. if (encoding !== undefined && typeof encoding !== 'string') {
  7517. throw new TypeError('encoding must be a string')
  7518. }
  7519. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  7520. throw new TypeError('Unknown encoding: ' + encoding)
  7521. }
  7522. } else if (typeof val === 'number') {
  7523. val = val & 255
  7524. }
  7525. // Invalid ranges are not set to a default, so can range check early.
  7526. if (start < 0 || this.length < start || this.length < end) {
  7527. throw new RangeError('Out of range index')
  7528. }
  7529. if (end <= start) {
  7530. return this
  7531. }
  7532. start = start >>> 0
  7533. end = end === undefined ? this.length : end >>> 0
  7534. if (!val) val = 0
  7535. var i
  7536. if (typeof val === 'number') {
  7537. for (i = start; i < end; ++i) {
  7538. this[i] = val
  7539. }
  7540. } else {
  7541. var bytes = Buffer.isBuffer(val)
  7542. ? val
  7543. : utf8ToBytes(new Buffer(val, encoding).toString())
  7544. var len = bytes.length
  7545. for (i = 0; i < end - start; ++i) {
  7546. this[i + start] = bytes[i % len]
  7547. }
  7548. }
  7549. return this
  7550. }
  7551. // HELPER FUNCTIONS
  7552. // ================
  7553. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  7554. function base64clean (str) {
  7555. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  7556. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  7557. // Node converts strings with length < 2 to ''
  7558. if (str.length < 2) return ''
  7559. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  7560. while (str.length % 4 !== 0) {
  7561. str = str + '='
  7562. }
  7563. return str
  7564. }
  7565. function stringtrim (str) {
  7566. if (str.trim) return str.trim()
  7567. return str.replace(/^\s+|\s+$/g, '')
  7568. }
  7569. function toHex (n) {
  7570. if (n < 16) return '0' + n.toString(16)
  7571. return n.toString(16)
  7572. }
  7573. function utf8ToBytes (string, units) {
  7574. units = units || Infinity
  7575. var codePoint
  7576. var length = string.length
  7577. var leadSurrogate = null
  7578. var bytes = []
  7579. for (var i = 0; i < length; ++i) {
  7580. codePoint = string.charCodeAt(i)
  7581. // is surrogate component
  7582. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  7583. // last char was a lead
  7584. if (!leadSurrogate) {
  7585. // no lead yet
  7586. if (codePoint > 0xDBFF) {
  7587. // unexpected trail
  7588. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7589. continue
  7590. } else if (i + 1 === length) {
  7591. // unpaired lead
  7592. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7593. continue
  7594. }
  7595. // valid lead
  7596. leadSurrogate = codePoint
  7597. continue
  7598. }
  7599. // 2 leads in a row
  7600. if (codePoint < 0xDC00) {
  7601. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7602. leadSurrogate = codePoint
  7603. continue
  7604. }
  7605. // valid surrogate pair
  7606. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  7607. } else if (leadSurrogate) {
  7608. // valid bmp char, but last char was a lead
  7609. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7610. }
  7611. leadSurrogate = null
  7612. // encode utf8
  7613. if (codePoint < 0x80) {
  7614. if ((units -= 1) < 0) break
  7615. bytes.push(codePoint)
  7616. } else if (codePoint < 0x800) {
  7617. if ((units -= 2) < 0) break
  7618. bytes.push(
  7619. codePoint >> 0x6 | 0xC0,
  7620. codePoint & 0x3F | 0x80
  7621. )
  7622. } else if (codePoint < 0x10000) {
  7623. if ((units -= 3) < 0) break
  7624. bytes.push(
  7625. codePoint >> 0xC | 0xE0,
  7626. codePoint >> 0x6 & 0x3F | 0x80,
  7627. codePoint & 0x3F | 0x80
  7628. )
  7629. } else if (codePoint < 0x110000) {
  7630. if ((units -= 4) < 0) break
  7631. bytes.push(
  7632. codePoint >> 0x12 | 0xF0,
  7633. codePoint >> 0xC & 0x3F | 0x80,
  7634. codePoint >> 0x6 & 0x3F | 0x80,
  7635. codePoint & 0x3F | 0x80
  7636. )
  7637. } else {
  7638. throw new Error('Invalid code point')
  7639. }
  7640. }
  7641. return bytes
  7642. }
  7643. function asciiToBytes (str) {
  7644. var byteArray = []
  7645. for (var i = 0; i < str.length; ++i) {
  7646. // Node's code seems to be doing this and not & 0x7F..
  7647. byteArray.push(str.charCodeAt(i) & 0xFF)
  7648. }
  7649. return byteArray
  7650. }
  7651. function utf16leToBytes (str, units) {
  7652. var c, hi, lo
  7653. var byteArray = []
  7654. for (var i = 0; i < str.length; ++i) {
  7655. if ((units -= 2) < 0) break
  7656. c = str.charCodeAt(i)
  7657. hi = c >> 8
  7658. lo = c % 256
  7659. byteArray.push(lo)
  7660. byteArray.push(hi)
  7661. }
  7662. return byteArray
  7663. }
  7664. function base64ToBytes (str) {
  7665. return base64.toByteArray(base64clean(str))
  7666. }
  7667. function blitBuffer (src, dst, offset, length) {
  7668. for (var i = 0; i < length; ++i) {
  7669. if ((i + offset >= dst.length) || (i >= src.length)) break
  7670. dst[i + offset] = src[i]
  7671. }
  7672. return i
  7673. }
  7674. function isnan (val) {
  7675. return val !== val // eslint-disable-line no-self-compare
  7676. }
  7677. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  7678. /***/ }),
  7679. /***/ "./node_modules/clipboard/dist/clipboard.js":
  7680. /*!**************************************************!*\
  7681. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  7682. \**************************************************/
  7683. /*! no static exports found */
  7684. /***/ (function(module, exports, __webpack_require__) {
  7685. /*!
  7686. * clipboard.js v2.0.4
  7687. * https://zenorocha.github.io/clipboard.js
  7688. *
  7689. * Licensed MIT © Zeno Rocha
  7690. */
  7691. (function webpackUniversalModuleDefinition(root, factory) {
  7692. if(true)
  7693. module.exports = factory();
  7694. else {}
  7695. })(this, function() {
  7696. return /******/ (function(modules) { // webpackBootstrap
  7697. /******/ // The module cache
  7698. /******/ var installedModules = {};
  7699. /******/
  7700. /******/ // The require function
  7701. /******/ function __webpack_require__(moduleId) {
  7702. /******/
  7703. /******/ // Check if module is in cache
  7704. /******/ if(installedModules[moduleId]) {
  7705. /******/ return installedModules[moduleId].exports;
  7706. /******/ }
  7707. /******/ // Create a new module (and put it into the cache)
  7708. /******/ var module = installedModules[moduleId] = {
  7709. /******/ i: moduleId,
  7710. /******/ l: false,
  7711. /******/ exports: {}
  7712. /******/ };
  7713. /******/
  7714. /******/ // Execute the module function
  7715. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7716. /******/
  7717. /******/ // Flag the module as loaded
  7718. /******/ module.l = true;
  7719. /******/
  7720. /******/ // Return the exports of the module
  7721. /******/ return module.exports;
  7722. /******/ }
  7723. /******/
  7724. /******/
  7725. /******/ // expose the modules object (__webpack_modules__)
  7726. /******/ __webpack_require__.m = modules;
  7727. /******/
  7728. /******/ // expose the module cache
  7729. /******/ __webpack_require__.c = installedModules;
  7730. /******/
  7731. /******/ // define getter function for harmony exports
  7732. /******/ __webpack_require__.d = function(exports, name, getter) {
  7733. /******/ if(!__webpack_require__.o(exports, name)) {
  7734. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  7735. /******/ }
  7736. /******/ };
  7737. /******/
  7738. /******/ // define __esModule on exports
  7739. /******/ __webpack_require__.r = function(exports) {
  7740. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  7741. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  7742. /******/ }
  7743. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  7744. /******/ };
  7745. /******/
  7746. /******/ // create a fake namespace object
  7747. /******/ // mode & 1: value is a module id, require it
  7748. /******/ // mode & 2: merge all properties of value into the ns
  7749. /******/ // mode & 4: return value when already ns object
  7750. /******/ // mode & 8|1: behave like require
  7751. /******/ __webpack_require__.t = function(value, mode) {
  7752. /******/ if(mode & 1) value = __webpack_require__(value);
  7753. /******/ if(mode & 8) return value;
  7754. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  7755. /******/ var ns = Object.create(null);
  7756. /******/ __webpack_require__.r(ns);
  7757. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  7758. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  7759. /******/ return ns;
  7760. /******/ };
  7761. /******/
  7762. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7763. /******/ __webpack_require__.n = function(module) {
  7764. /******/ var getter = module && module.__esModule ?
  7765. /******/ function getDefault() { return module['default']; } :
  7766. /******/ function getModuleExports() { return module; };
  7767. /******/ __webpack_require__.d(getter, 'a', getter);
  7768. /******/ return getter;
  7769. /******/ };
  7770. /******/
  7771. /******/ // Object.prototype.hasOwnProperty.call
  7772. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  7773. /******/
  7774. /******/ // __webpack_public_path__
  7775. /******/ __webpack_require__.p = "";
  7776. /******/
  7777. /******/
  7778. /******/ // Load entry module and return exports
  7779. /******/ return __webpack_require__(__webpack_require__.s = 0);
  7780. /******/ })
  7781. /************************************************************************/
  7782. /******/ ([
  7783. /* 0 */
  7784. /***/ (function(module, exports, __webpack_require__) {
  7785. "use strict";
  7786. 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; };
  7787. 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; }; }();
  7788. var _clipboardAction = __webpack_require__(1);
  7789. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  7790. var _tinyEmitter = __webpack_require__(3);
  7791. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  7792. var _goodListener = __webpack_require__(4);
  7793. var _goodListener2 = _interopRequireDefault(_goodListener);
  7794. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7795. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7796. 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; }
  7797. 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; }
  7798. /**
  7799. * Base class which takes one or more elements, adds event listeners to them,
  7800. * and instantiates a new `ClipboardAction` on each click.
  7801. */
  7802. var Clipboard = function (_Emitter) {
  7803. _inherits(Clipboard, _Emitter);
  7804. /**
  7805. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7806. * @param {Object} options
  7807. */
  7808. function Clipboard(trigger, options) {
  7809. _classCallCheck(this, Clipboard);
  7810. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  7811. _this.resolveOptions(options);
  7812. _this.listenClick(trigger);
  7813. return _this;
  7814. }
  7815. /**
  7816. * Defines if attributes would be resolved using internal setter functions
  7817. * or custom functions that were passed in the constructor.
  7818. * @param {Object} options
  7819. */
  7820. _createClass(Clipboard, [{
  7821. key: 'resolveOptions',
  7822. value: function resolveOptions() {
  7823. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7824. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  7825. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  7826. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  7827. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  7828. }
  7829. /**
  7830. * Adds a click event listener to the passed trigger.
  7831. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7832. */
  7833. }, {
  7834. key: 'listenClick',
  7835. value: function listenClick(trigger) {
  7836. var _this2 = this;
  7837. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  7838. return _this2.onClick(e);
  7839. });
  7840. }
  7841. /**
  7842. * Defines a new `ClipboardAction` on each click event.
  7843. * @param {Event} e
  7844. */
  7845. }, {
  7846. key: 'onClick',
  7847. value: function onClick(e) {
  7848. var trigger = e.delegateTarget || e.currentTarget;
  7849. if (this.clipboardAction) {
  7850. this.clipboardAction = null;
  7851. }
  7852. this.clipboardAction = new _clipboardAction2.default({
  7853. action: this.action(trigger),
  7854. target: this.target(trigger),
  7855. text: this.text(trigger),
  7856. container: this.container,
  7857. trigger: trigger,
  7858. emitter: this
  7859. });
  7860. }
  7861. /**
  7862. * Default `action` lookup function.
  7863. * @param {Element} trigger
  7864. */
  7865. }, {
  7866. key: 'defaultAction',
  7867. value: function defaultAction(trigger) {
  7868. return getAttributeValue('action', trigger);
  7869. }
  7870. /**
  7871. * Default `target` lookup function.
  7872. * @param {Element} trigger
  7873. */
  7874. }, {
  7875. key: 'defaultTarget',
  7876. value: function defaultTarget(trigger) {
  7877. var selector = getAttributeValue('target', trigger);
  7878. if (selector) {
  7879. return document.querySelector(selector);
  7880. }
  7881. }
  7882. /**
  7883. * Returns the support of the given action, or all actions if no action is
  7884. * given.
  7885. * @param {String} [action]
  7886. */
  7887. }, {
  7888. key: 'defaultText',
  7889. /**
  7890. * Default `text` lookup function.
  7891. * @param {Element} trigger
  7892. */
  7893. value: function defaultText(trigger) {
  7894. return getAttributeValue('text', trigger);
  7895. }
  7896. /**
  7897. * Destroy lifecycle.
  7898. */
  7899. }, {
  7900. key: 'destroy',
  7901. value: function destroy() {
  7902. this.listener.destroy();
  7903. if (this.clipboardAction) {
  7904. this.clipboardAction.destroy();
  7905. this.clipboardAction = null;
  7906. }
  7907. }
  7908. }], [{
  7909. key: 'isSupported',
  7910. value: function isSupported() {
  7911. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  7912. var actions = typeof action === 'string' ? [action] : action;
  7913. var support = !!document.queryCommandSupported;
  7914. actions.forEach(function (action) {
  7915. support = support && !!document.queryCommandSupported(action);
  7916. });
  7917. return support;
  7918. }
  7919. }]);
  7920. return Clipboard;
  7921. }(_tinyEmitter2.default);
  7922. /**
  7923. * Helper function to retrieve attribute value.
  7924. * @param {String} suffix
  7925. * @param {Element} element
  7926. */
  7927. function getAttributeValue(suffix, element) {
  7928. var attribute = 'data-clipboard-' + suffix;
  7929. if (!element.hasAttribute(attribute)) {
  7930. return;
  7931. }
  7932. return element.getAttribute(attribute);
  7933. }
  7934. module.exports = Clipboard;
  7935. /***/ }),
  7936. /* 1 */
  7937. /***/ (function(module, exports, __webpack_require__) {
  7938. "use strict";
  7939. 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; };
  7940. 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; }; }();
  7941. var _select = __webpack_require__(2);
  7942. var _select2 = _interopRequireDefault(_select);
  7943. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7944. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7945. /**
  7946. * Inner class which performs selection from either `text` or `target`
  7947. * properties and then executes copy or cut operations.
  7948. */
  7949. var ClipboardAction = function () {
  7950. /**
  7951. * @param {Object} options
  7952. */
  7953. function ClipboardAction(options) {
  7954. _classCallCheck(this, ClipboardAction);
  7955. this.resolveOptions(options);
  7956. this.initSelection();
  7957. }
  7958. /**
  7959. * Defines base properties passed from constructor.
  7960. * @param {Object} options
  7961. */
  7962. _createClass(ClipboardAction, [{
  7963. key: 'resolveOptions',
  7964. value: function resolveOptions() {
  7965. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7966. this.action = options.action;
  7967. this.container = options.container;
  7968. this.emitter = options.emitter;
  7969. this.target = options.target;
  7970. this.text = options.text;
  7971. this.trigger = options.trigger;
  7972. this.selectedText = '';
  7973. }
  7974. /**
  7975. * Decides which selection strategy is going to be applied based
  7976. * on the existence of `text` and `target` properties.
  7977. */
  7978. }, {
  7979. key: 'initSelection',
  7980. value: function initSelection() {
  7981. if (this.text) {
  7982. this.selectFake();
  7983. } else if (this.target) {
  7984. this.selectTarget();
  7985. }
  7986. }
  7987. /**
  7988. * Creates a fake textarea element, sets its value from `text` property,
  7989. * and makes a selection on it.
  7990. */
  7991. }, {
  7992. key: 'selectFake',
  7993. value: function selectFake() {
  7994. var _this = this;
  7995. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  7996. this.removeFake();
  7997. this.fakeHandlerCallback = function () {
  7998. return _this.removeFake();
  7999. };
  8000. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  8001. this.fakeElem = document.createElement('textarea');
  8002. // Prevent zooming on iOS
  8003. this.fakeElem.style.fontSize = '12pt';
  8004. // Reset box model
  8005. this.fakeElem.style.border = '0';
  8006. this.fakeElem.style.padding = '0';
  8007. this.fakeElem.style.margin = '0';
  8008. // Move element out of screen horizontally
  8009. this.fakeElem.style.position = 'absolute';
  8010. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  8011. // Move element to the same position vertically
  8012. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  8013. this.fakeElem.style.top = yPosition + 'px';
  8014. this.fakeElem.setAttribute('readonly', '');
  8015. this.fakeElem.value = this.text;
  8016. this.container.appendChild(this.fakeElem);
  8017. this.selectedText = (0, _select2.default)(this.fakeElem);
  8018. this.copyText();
  8019. }
  8020. /**
  8021. * Only removes the fake element after another click event, that way
  8022. * a user can hit `Ctrl+C` to copy because selection still exists.
  8023. */
  8024. }, {
  8025. key: 'removeFake',
  8026. value: function removeFake() {
  8027. if (this.fakeHandler) {
  8028. this.container.removeEventListener('click', this.fakeHandlerCallback);
  8029. this.fakeHandler = null;
  8030. this.fakeHandlerCallback = null;
  8031. }
  8032. if (this.fakeElem) {
  8033. this.container.removeChild(this.fakeElem);
  8034. this.fakeElem = null;
  8035. }
  8036. }
  8037. /**
  8038. * Selects the content from element passed on `target` property.
  8039. */
  8040. }, {
  8041. key: 'selectTarget',
  8042. value: function selectTarget() {
  8043. this.selectedText = (0, _select2.default)(this.target);
  8044. this.copyText();
  8045. }
  8046. /**
  8047. * Executes the copy operation based on the current selection.
  8048. */
  8049. }, {
  8050. key: 'copyText',
  8051. value: function copyText() {
  8052. var succeeded = void 0;
  8053. try {
  8054. succeeded = document.execCommand(this.action);
  8055. } catch (err) {
  8056. succeeded = false;
  8057. }
  8058. this.handleResult(succeeded);
  8059. }
  8060. /**
  8061. * Fires an event based on the copy operation result.
  8062. * @param {Boolean} succeeded
  8063. */
  8064. }, {
  8065. key: 'handleResult',
  8066. value: function handleResult(succeeded) {
  8067. this.emitter.emit(succeeded ? 'success' : 'error', {
  8068. action: this.action,
  8069. text: this.selectedText,
  8070. trigger: this.trigger,
  8071. clearSelection: this.clearSelection.bind(this)
  8072. });
  8073. }
  8074. /**
  8075. * Moves focus away from `target` and back to the trigger, removes current selection.
  8076. */
  8077. }, {
  8078. key: 'clearSelection',
  8079. value: function clearSelection() {
  8080. if (this.trigger) {
  8081. this.trigger.focus();
  8082. }
  8083. window.getSelection().removeAllRanges();
  8084. }
  8085. /**
  8086. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  8087. * @param {String} action
  8088. */
  8089. }, {
  8090. key: 'destroy',
  8091. /**
  8092. * Destroy lifecycle.
  8093. */
  8094. value: function destroy() {
  8095. this.removeFake();
  8096. }
  8097. }, {
  8098. key: 'action',
  8099. set: function set() {
  8100. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  8101. this._action = action;
  8102. if (this._action !== 'copy' && this._action !== 'cut') {
  8103. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  8104. }
  8105. }
  8106. /**
  8107. * Gets the `action` property.
  8108. * @return {String}
  8109. */
  8110. ,
  8111. get: function get() {
  8112. return this._action;
  8113. }
  8114. /**
  8115. * Sets the `target` property using an element
  8116. * that will be have its content copied.
  8117. * @param {Element} target
  8118. */
  8119. }, {
  8120. key: 'target',
  8121. set: function set(target) {
  8122. if (target !== undefined) {
  8123. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  8124. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  8125. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  8126. }
  8127. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  8128. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  8129. }
  8130. this._target = target;
  8131. } else {
  8132. throw new Error('Invalid "target" value, use a valid Element');
  8133. }
  8134. }
  8135. }
  8136. /**
  8137. * Gets the `target` property.
  8138. * @return {String|HTMLElement}
  8139. */
  8140. ,
  8141. get: function get() {
  8142. return this._target;
  8143. }
  8144. }]);
  8145. return ClipboardAction;
  8146. }();
  8147. module.exports = ClipboardAction;
  8148. /***/ }),
  8149. /* 2 */
  8150. /***/ (function(module, exports) {
  8151. function select(element) {
  8152. var selectedText;
  8153. if (element.nodeName === 'SELECT') {
  8154. element.focus();
  8155. selectedText = element.value;
  8156. }
  8157. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  8158. var isReadOnly = element.hasAttribute('readonly');
  8159. if (!isReadOnly) {
  8160. element.setAttribute('readonly', '');
  8161. }
  8162. element.select();
  8163. element.setSelectionRange(0, element.value.length);
  8164. if (!isReadOnly) {
  8165. element.removeAttribute('readonly');
  8166. }
  8167. selectedText = element.value;
  8168. }
  8169. else {
  8170. if (element.hasAttribute('contenteditable')) {
  8171. element.focus();
  8172. }
  8173. var selection = window.getSelection();
  8174. var range = document.createRange();
  8175. range.selectNodeContents(element);
  8176. selection.removeAllRanges();
  8177. selection.addRange(range);
  8178. selectedText = selection.toString();
  8179. }
  8180. return selectedText;
  8181. }
  8182. module.exports = select;
  8183. /***/ }),
  8184. /* 3 */
  8185. /***/ (function(module, exports) {
  8186. function E () {
  8187. // Keep this empty so it's easier to inherit from
  8188. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  8189. }
  8190. E.prototype = {
  8191. on: function (name, callback, ctx) {
  8192. var e = this.e || (this.e = {});
  8193. (e[name] || (e[name] = [])).push({
  8194. fn: callback,
  8195. ctx: ctx
  8196. });
  8197. return this;
  8198. },
  8199. once: function (name, callback, ctx) {
  8200. var self = this;
  8201. function listener () {
  8202. self.off(name, listener);
  8203. callback.apply(ctx, arguments);
  8204. };
  8205. listener._ = callback
  8206. return this.on(name, listener, ctx);
  8207. },
  8208. emit: function (name) {
  8209. var data = [].slice.call(arguments, 1);
  8210. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  8211. var i = 0;
  8212. var len = evtArr.length;
  8213. for (i; i < len; i++) {
  8214. evtArr[i].fn.apply(evtArr[i].ctx, data);
  8215. }
  8216. return this;
  8217. },
  8218. off: function (name, callback) {
  8219. var e = this.e || (this.e = {});
  8220. var evts = e[name];
  8221. var liveEvents = [];
  8222. if (evts && callback) {
  8223. for (var i = 0, len = evts.length; i < len; i++) {
  8224. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  8225. liveEvents.push(evts[i]);
  8226. }
  8227. }
  8228. // Remove event from queue to prevent memory leak
  8229. // Suggested by https://github.com/lazd
  8230. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  8231. (liveEvents.length)
  8232. ? e[name] = liveEvents
  8233. : delete e[name];
  8234. return this;
  8235. }
  8236. };
  8237. module.exports = E;
  8238. /***/ }),
  8239. /* 4 */
  8240. /***/ (function(module, exports, __webpack_require__) {
  8241. var is = __webpack_require__(5);
  8242. var delegate = __webpack_require__(6);
  8243. /**
  8244. * Validates all params and calls the right
  8245. * listener function based on its target type.
  8246. *
  8247. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  8248. * @param {String} type
  8249. * @param {Function} callback
  8250. * @return {Object}
  8251. */
  8252. function listen(target, type, callback) {
  8253. if (!target && !type && !callback) {
  8254. throw new Error('Missing required arguments');
  8255. }
  8256. if (!is.string(type)) {
  8257. throw new TypeError('Second argument must be a String');
  8258. }
  8259. if (!is.fn(callback)) {
  8260. throw new TypeError('Third argument must be a Function');
  8261. }
  8262. if (is.node(target)) {
  8263. return listenNode(target, type, callback);
  8264. }
  8265. else if (is.nodeList(target)) {
  8266. return listenNodeList(target, type, callback);
  8267. }
  8268. else if (is.string(target)) {
  8269. return listenSelector(target, type, callback);
  8270. }
  8271. else {
  8272. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  8273. }
  8274. }
  8275. /**
  8276. * Adds an event listener to a HTML element
  8277. * and returns a remove listener function.
  8278. *
  8279. * @param {HTMLElement} node
  8280. * @param {String} type
  8281. * @param {Function} callback
  8282. * @return {Object}
  8283. */
  8284. function listenNode(node, type, callback) {
  8285. node.addEventListener(type, callback);
  8286. return {
  8287. destroy: function() {
  8288. node.removeEventListener(type, callback);
  8289. }
  8290. }
  8291. }
  8292. /**
  8293. * Add an event listener to a list of HTML elements
  8294. * and returns a remove listener function.
  8295. *
  8296. * @param {NodeList|HTMLCollection} nodeList
  8297. * @param {String} type
  8298. * @param {Function} callback
  8299. * @return {Object}
  8300. */
  8301. function listenNodeList(nodeList, type, callback) {
  8302. Array.prototype.forEach.call(nodeList, function(node) {
  8303. node.addEventListener(type, callback);
  8304. });
  8305. return {
  8306. destroy: function() {
  8307. Array.prototype.forEach.call(nodeList, function(node) {
  8308. node.removeEventListener(type, callback);
  8309. });
  8310. }
  8311. }
  8312. }
  8313. /**
  8314. * Add an event listener to a selector
  8315. * and returns a remove listener function.
  8316. *
  8317. * @param {String} selector
  8318. * @param {String} type
  8319. * @param {Function} callback
  8320. * @return {Object}
  8321. */
  8322. function listenSelector(selector, type, callback) {
  8323. return delegate(document.body, selector, type, callback);
  8324. }
  8325. module.exports = listen;
  8326. /***/ }),
  8327. /* 5 */
  8328. /***/ (function(module, exports) {
  8329. /**
  8330. * Check if argument is a HTML element.
  8331. *
  8332. * @param {Object} value
  8333. * @return {Boolean}
  8334. */
  8335. exports.node = function(value) {
  8336. return value !== undefined
  8337. && value instanceof HTMLElement
  8338. && value.nodeType === 1;
  8339. };
  8340. /**
  8341. * Check if argument is a list of HTML elements.
  8342. *
  8343. * @param {Object} value
  8344. * @return {Boolean}
  8345. */
  8346. exports.nodeList = function(value) {
  8347. var type = Object.prototype.toString.call(value);
  8348. return value !== undefined
  8349. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  8350. && ('length' in value)
  8351. && (value.length === 0 || exports.node(value[0]));
  8352. };
  8353. /**
  8354. * Check if argument is a string.
  8355. *
  8356. * @param {Object} value
  8357. * @return {Boolean}
  8358. */
  8359. exports.string = function(value) {
  8360. return typeof value === 'string'
  8361. || value instanceof String;
  8362. };
  8363. /**
  8364. * Check if argument is a function.
  8365. *
  8366. * @param {Object} value
  8367. * @return {Boolean}
  8368. */
  8369. exports.fn = function(value) {
  8370. var type = Object.prototype.toString.call(value);
  8371. return type === '[object Function]';
  8372. };
  8373. /***/ }),
  8374. /* 6 */
  8375. /***/ (function(module, exports, __webpack_require__) {
  8376. var closest = __webpack_require__(7);
  8377. /**
  8378. * Delegates event to a selector.
  8379. *
  8380. * @param {Element} element
  8381. * @param {String} selector
  8382. * @param {String} type
  8383. * @param {Function} callback
  8384. * @param {Boolean} useCapture
  8385. * @return {Object}
  8386. */
  8387. function _delegate(element, selector, type, callback, useCapture) {
  8388. var listenerFn = listener.apply(this, arguments);
  8389. element.addEventListener(type, listenerFn, useCapture);
  8390. return {
  8391. destroy: function() {
  8392. element.removeEventListener(type, listenerFn, useCapture);
  8393. }
  8394. }
  8395. }
  8396. /**
  8397. * Delegates event to a selector.
  8398. *
  8399. * @param {Element|String|Array} [elements]
  8400. * @param {String} selector
  8401. * @param {String} type
  8402. * @param {Function} callback
  8403. * @param {Boolean} useCapture
  8404. * @return {Object}
  8405. */
  8406. function delegate(elements, selector, type, callback, useCapture) {
  8407. // Handle the regular Element usage
  8408. if (typeof elements.addEventListener === 'function') {
  8409. return _delegate.apply(null, arguments);
  8410. }
  8411. // Handle Element-less usage, it defaults to global delegation
  8412. if (typeof type === 'function') {
  8413. // Use `document` as the first parameter, then apply arguments
  8414. // This is a short way to .unshift `arguments` without running into deoptimizations
  8415. return _delegate.bind(null, document).apply(null, arguments);
  8416. }
  8417. // Handle Selector-based usage
  8418. if (typeof elements === 'string') {
  8419. elements = document.querySelectorAll(elements);
  8420. }
  8421. // Handle Array-like based usage
  8422. return Array.prototype.map.call(elements, function (element) {
  8423. return _delegate(element, selector, type, callback, useCapture);
  8424. });
  8425. }
  8426. /**
  8427. * Finds closest match and invokes callback.
  8428. *
  8429. * @param {Element} element
  8430. * @param {String} selector
  8431. * @param {String} type
  8432. * @param {Function} callback
  8433. * @return {Function}
  8434. */
  8435. function listener(element, selector, type, callback) {
  8436. return function(e) {
  8437. e.delegateTarget = closest(e.target, selector);
  8438. if (e.delegateTarget) {
  8439. callback.call(element, e);
  8440. }
  8441. }
  8442. }
  8443. module.exports = delegate;
  8444. /***/ }),
  8445. /* 7 */
  8446. /***/ (function(module, exports) {
  8447. var DOCUMENT_NODE_TYPE = 9;
  8448. /**
  8449. * A polyfill for Element.matches()
  8450. */
  8451. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  8452. var proto = Element.prototype;
  8453. proto.matches = proto.matchesSelector ||
  8454. proto.mozMatchesSelector ||
  8455. proto.msMatchesSelector ||
  8456. proto.oMatchesSelector ||
  8457. proto.webkitMatchesSelector;
  8458. }
  8459. /**
  8460. * Finds the closest parent that matches a selector.
  8461. *
  8462. * @param {Element} element
  8463. * @param {String} selector
  8464. * @return {Function}
  8465. */
  8466. function closest (element, selector) {
  8467. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  8468. if (typeof element.matches === 'function' &&
  8469. element.matches(selector)) {
  8470. return element;
  8471. }
  8472. element = element.parentNode;
  8473. }
  8474. }
  8475. module.exports = closest;
  8476. /***/ })
  8477. /******/ ]);
  8478. });
  8479. /***/ }),
  8480. /***/ "./node_modules/ieee754/index.js":
  8481. /*!***************************************!*\
  8482. !*** ./node_modules/ieee754/index.js ***!
  8483. \***************************************/
  8484. /*! no static exports found */
  8485. /***/ (function(module, exports) {
  8486. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  8487. var e, m
  8488. var eLen = (nBytes * 8) - mLen - 1
  8489. var eMax = (1 << eLen) - 1
  8490. var eBias = eMax >> 1
  8491. var nBits = -7
  8492. var i = isLE ? (nBytes - 1) : 0
  8493. var d = isLE ? -1 : 1
  8494. var s = buffer[offset + i]
  8495. i += d
  8496. e = s & ((1 << (-nBits)) - 1)
  8497. s >>= (-nBits)
  8498. nBits += eLen
  8499. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8500. m = e & ((1 << (-nBits)) - 1)
  8501. e >>= (-nBits)
  8502. nBits += mLen
  8503. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8504. if (e === 0) {
  8505. e = 1 - eBias
  8506. } else if (e === eMax) {
  8507. return m ? NaN : ((s ? -1 : 1) * Infinity)
  8508. } else {
  8509. m = m + Math.pow(2, mLen)
  8510. e = e - eBias
  8511. }
  8512. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  8513. }
  8514. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  8515. var e, m, c
  8516. var eLen = (nBytes * 8) - mLen - 1
  8517. var eMax = (1 << eLen) - 1
  8518. var eBias = eMax >> 1
  8519. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  8520. var i = isLE ? 0 : (nBytes - 1)
  8521. var d = isLE ? 1 : -1
  8522. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  8523. value = Math.abs(value)
  8524. if (isNaN(value) || value === Infinity) {
  8525. m = isNaN(value) ? 1 : 0
  8526. e = eMax
  8527. } else {
  8528. e = Math.floor(Math.log(value) / Math.LN2)
  8529. if (value * (c = Math.pow(2, -e)) < 1) {
  8530. e--
  8531. c *= 2
  8532. }
  8533. if (e + eBias >= 1) {
  8534. value += rt / c
  8535. } else {
  8536. value += rt * Math.pow(2, 1 - eBias)
  8537. }
  8538. if (value * c >= 2) {
  8539. e++
  8540. c /= 2
  8541. }
  8542. if (e + eBias >= eMax) {
  8543. m = 0
  8544. e = eMax
  8545. } else if (e + eBias >= 1) {
  8546. m = ((value * c) - 1) * Math.pow(2, mLen)
  8547. e = e + eBias
  8548. } else {
  8549. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  8550. e = 0
  8551. }
  8552. }
  8553. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  8554. e = (e << mLen) | m
  8555. eLen += mLen
  8556. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  8557. buffer[offset + i - d] |= s * 128
  8558. }
  8559. /***/ }),
  8560. /***/ "./node_modules/isarray/index.js":
  8561. /*!***************************************!*\
  8562. !*** ./node_modules/isarray/index.js ***!
  8563. \***************************************/
  8564. /*! no static exports found */
  8565. /***/ (function(module, exports) {
  8566. var toString = {}.toString;
  8567. module.exports = Array.isArray || function (arr) {
  8568. return toString.call(arr) == '[object Array]';
  8569. };
  8570. /***/ }),
  8571. /***/ "./node_modules/jquery/dist/jquery.js":
  8572. /*!********************************************!*\
  8573. !*** ./node_modules/jquery/dist/jquery.js ***!
  8574. \********************************************/
  8575. /*! no static exports found */
  8576. /***/ (function(module, exports, __webpack_require__) {
  8577. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  8578. * jQuery JavaScript Library v3.4.1
  8579. * https://jquery.com/
  8580. *
  8581. * Includes Sizzle.js
  8582. * https://sizzlejs.com/
  8583. *
  8584. * Copyright JS Foundation and other contributors
  8585. * Released under the MIT license
  8586. * https://jquery.org/license
  8587. *
  8588. * Date: 2019-05-01T21:04Z
  8589. */
  8590. ( function( global, factory ) {
  8591. "use strict";
  8592. if ( true && typeof module.exports === "object" ) {
  8593. // For CommonJS and CommonJS-like environments where a proper `window`
  8594. // is present, execute the factory and get jQuery.
  8595. // For environments that do not have a `window` with a `document`
  8596. // (such as Node.js), expose a factory as module.exports.
  8597. // This accentuates the need for the creation of a real `window`.
  8598. // e.g. var jQuery = require("jquery")(window);
  8599. // See ticket #14549 for more info.
  8600. module.exports = global.document ?
  8601. factory( global, true ) :
  8602. function( w ) {
  8603. if ( !w.document ) {
  8604. throw new Error( "jQuery requires a window with a document" );
  8605. }
  8606. return factory( w );
  8607. };
  8608. } else {
  8609. factory( global );
  8610. }
  8611. // Pass this if window is not defined yet
  8612. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  8613. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  8614. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  8615. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  8616. // enough that all such attempts are guarded in a try block.
  8617. "use strict";
  8618. var arr = [];
  8619. var document = window.document;
  8620. var getProto = Object.getPrototypeOf;
  8621. var slice = arr.slice;
  8622. var concat = arr.concat;
  8623. var push = arr.push;
  8624. var indexOf = arr.indexOf;
  8625. var class2type = {};
  8626. var toString = class2type.toString;
  8627. var hasOwn = class2type.hasOwnProperty;
  8628. var fnToString = hasOwn.toString;
  8629. var ObjectFunctionString = fnToString.call( Object );
  8630. var support = {};
  8631. var isFunction = function isFunction( obj ) {
  8632. // Support: Chrome <=57, Firefox <=52
  8633. // In some browsers, typeof returns "function" for HTML <object> elements
  8634. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  8635. // We don't want to classify *any* DOM node as a function.
  8636. return typeof obj === "function" && typeof obj.nodeType !== "number";
  8637. };
  8638. var isWindow = function isWindow( obj ) {
  8639. return obj != null && obj === obj.window;
  8640. };
  8641. var preservedScriptAttributes = {
  8642. type: true,
  8643. src: true,
  8644. nonce: true,
  8645. noModule: true
  8646. };
  8647. function DOMEval( code, node, doc ) {
  8648. doc = doc || document;
  8649. var i, val,
  8650. script = doc.createElement( "script" );
  8651. script.text = code;
  8652. if ( node ) {
  8653. for ( i in preservedScriptAttributes ) {
  8654. // Support: Firefox 64+, Edge 18+
  8655. // Some browsers don't support the "nonce" property on scripts.
  8656. // On the other hand, just using `getAttribute` is not enough as
  8657. // the `nonce` attribute is reset to an empty string whenever it
  8658. // becomes browsing-context connected.
  8659. // See https://github.com/whatwg/html/issues/2369
  8660. // See https://html.spec.whatwg.org/#nonce-attributes
  8661. // The `node.getAttribute` check was added for the sake of
  8662. // `jQuery.globalEval` so that it can fake a nonce-containing node
  8663. // via an object.
  8664. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  8665. if ( val ) {
  8666. script.setAttribute( i, val );
  8667. }
  8668. }
  8669. }
  8670. doc.head.appendChild( script ).parentNode.removeChild( script );
  8671. }
  8672. function toType( obj ) {
  8673. if ( obj == null ) {
  8674. return obj + "";
  8675. }
  8676. // Support: Android <=2.3 only (functionish RegExp)
  8677. return typeof obj === "object" || typeof obj === "function" ?
  8678. class2type[ toString.call( obj ) ] || "object" :
  8679. typeof obj;
  8680. }
  8681. /* global Symbol */
  8682. // Defining this global in .eslintrc.json would create a danger of using the global
  8683. // unguarded in another place, it seems safer to define global only for this module
  8684. var
  8685. version = "3.4.1",
  8686. // Define a local copy of jQuery
  8687. jQuery = function( selector, context ) {
  8688. // The jQuery object is actually just the init constructor 'enhanced'
  8689. // Need init if jQuery is called (just allow error to be thrown if not included)
  8690. return new jQuery.fn.init( selector, context );
  8691. },
  8692. // Support: Android <=4.0 only
  8693. // Make sure we trim BOM and NBSP
  8694. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  8695. jQuery.fn = jQuery.prototype = {
  8696. // The current version of jQuery being used
  8697. jquery: version,
  8698. constructor: jQuery,
  8699. // The default length of a jQuery object is 0
  8700. length: 0,
  8701. toArray: function() {
  8702. return slice.call( this );
  8703. },
  8704. // Get the Nth element in the matched element set OR
  8705. // Get the whole matched element set as a clean array
  8706. get: function( num ) {
  8707. // Return all the elements in a clean array
  8708. if ( num == null ) {
  8709. return slice.call( this );
  8710. }
  8711. // Return just the one element from the set
  8712. return num < 0 ? this[ num + this.length ] : this[ num ];
  8713. },
  8714. // Take an array of elements and push it onto the stack
  8715. // (returning the new matched element set)
  8716. pushStack: function( elems ) {
  8717. // Build a new jQuery matched element set
  8718. var ret = jQuery.merge( this.constructor(), elems );
  8719. // Add the old object onto the stack (as a reference)
  8720. ret.prevObject = this;
  8721. // Return the newly-formed element set
  8722. return ret;
  8723. },
  8724. // Execute a callback for every element in the matched set.
  8725. each: function( callback ) {
  8726. return jQuery.each( this, callback );
  8727. },
  8728. map: function( callback ) {
  8729. return this.pushStack( jQuery.map( this, function( elem, i ) {
  8730. return callback.call( elem, i, elem );
  8731. } ) );
  8732. },
  8733. slice: function() {
  8734. return this.pushStack( slice.apply( this, arguments ) );
  8735. },
  8736. first: function() {
  8737. return this.eq( 0 );
  8738. },
  8739. last: function() {
  8740. return this.eq( -1 );
  8741. },
  8742. eq: function( i ) {
  8743. var len = this.length,
  8744. j = +i + ( i < 0 ? len : 0 );
  8745. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  8746. },
  8747. end: function() {
  8748. return this.prevObject || this.constructor();
  8749. },
  8750. // For internal use only.
  8751. // Behaves like an Array's method, not like a jQuery method.
  8752. push: push,
  8753. sort: arr.sort,
  8754. splice: arr.splice
  8755. };
  8756. jQuery.extend = jQuery.fn.extend = function() {
  8757. var options, name, src, copy, copyIsArray, clone,
  8758. target = arguments[ 0 ] || {},
  8759. i = 1,
  8760. length = arguments.length,
  8761. deep = false;
  8762. // Handle a deep copy situation
  8763. if ( typeof target === "boolean" ) {
  8764. deep = target;
  8765. // Skip the boolean and the target
  8766. target = arguments[ i ] || {};
  8767. i++;
  8768. }
  8769. // Handle case when target is a string or something (possible in deep copy)
  8770. if ( typeof target !== "object" && !isFunction( target ) ) {
  8771. target = {};
  8772. }
  8773. // Extend jQuery itself if only one argument is passed
  8774. if ( i === length ) {
  8775. target = this;
  8776. i--;
  8777. }
  8778. for ( ; i < length; i++ ) {
  8779. // Only deal with non-null/undefined values
  8780. if ( ( options = arguments[ i ] ) != null ) {
  8781. // Extend the base object
  8782. for ( name in options ) {
  8783. copy = options[ name ];
  8784. // Prevent Object.prototype pollution
  8785. // Prevent never-ending loop
  8786. if ( name === "__proto__" || target === copy ) {
  8787. continue;
  8788. }
  8789. // Recurse if we're merging plain objects or arrays
  8790. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  8791. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  8792. src = target[ name ];
  8793. // Ensure proper type for the source value
  8794. if ( copyIsArray && !Array.isArray( src ) ) {
  8795. clone = [];
  8796. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  8797. clone = {};
  8798. } else {
  8799. clone = src;
  8800. }
  8801. copyIsArray = false;
  8802. // Never move original objects, clone them
  8803. target[ name ] = jQuery.extend( deep, clone, copy );
  8804. // Don't bring in undefined values
  8805. } else if ( copy !== undefined ) {
  8806. target[ name ] = copy;
  8807. }
  8808. }
  8809. }
  8810. }
  8811. // Return the modified object
  8812. return target;
  8813. };
  8814. jQuery.extend( {
  8815. // Unique for each copy of jQuery on the page
  8816. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  8817. // Assume jQuery is ready without the ready module
  8818. isReady: true,
  8819. error: function( msg ) {
  8820. throw new Error( msg );
  8821. },
  8822. noop: function() {},
  8823. isPlainObject: function( obj ) {
  8824. var proto, Ctor;
  8825. // Detect obvious negatives
  8826. // Use toString instead of jQuery.type to catch host objects
  8827. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  8828. return false;
  8829. }
  8830. proto = getProto( obj );
  8831. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  8832. if ( !proto ) {
  8833. return true;
  8834. }
  8835. // Objects with prototype are plain iff they were constructed by a global Object function
  8836. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  8837. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  8838. },
  8839. isEmptyObject: function( obj ) {
  8840. var name;
  8841. for ( name in obj ) {
  8842. return false;
  8843. }
  8844. return true;
  8845. },
  8846. // Evaluates a script in a global context
  8847. globalEval: function( code, options ) {
  8848. DOMEval( code, { nonce: options && options.nonce } );
  8849. },
  8850. each: function( obj, callback ) {
  8851. var length, i = 0;
  8852. if ( isArrayLike( obj ) ) {
  8853. length = obj.length;
  8854. for ( ; i < length; i++ ) {
  8855. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8856. break;
  8857. }
  8858. }
  8859. } else {
  8860. for ( i in obj ) {
  8861. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8862. break;
  8863. }
  8864. }
  8865. }
  8866. return obj;
  8867. },
  8868. // Support: Android <=4.0 only
  8869. trim: function( text ) {
  8870. return text == null ?
  8871. "" :
  8872. ( text + "" ).replace( rtrim, "" );
  8873. },
  8874. // results is for internal usage only
  8875. makeArray: function( arr, results ) {
  8876. var ret = results || [];
  8877. if ( arr != null ) {
  8878. if ( isArrayLike( Object( arr ) ) ) {
  8879. jQuery.merge( ret,
  8880. typeof arr === "string" ?
  8881. [ arr ] : arr
  8882. );
  8883. } else {
  8884. push.call( ret, arr );
  8885. }
  8886. }
  8887. return ret;
  8888. },
  8889. inArray: function( elem, arr, i ) {
  8890. return arr == null ? -1 : indexOf.call( arr, elem, i );
  8891. },
  8892. // Support: Android <=4.0 only, PhantomJS 1 only
  8893. // push.apply(_, arraylike) throws on ancient WebKit
  8894. merge: function( first, second ) {
  8895. var len = +second.length,
  8896. j = 0,
  8897. i = first.length;
  8898. for ( ; j < len; j++ ) {
  8899. first[ i++ ] = second[ j ];
  8900. }
  8901. first.length = i;
  8902. return first;
  8903. },
  8904. grep: function( elems, callback, invert ) {
  8905. var callbackInverse,
  8906. matches = [],
  8907. i = 0,
  8908. length = elems.length,
  8909. callbackExpect = !invert;
  8910. // Go through the array, only saving the items
  8911. // that pass the validator function
  8912. for ( ; i < length; i++ ) {
  8913. callbackInverse = !callback( elems[ i ], i );
  8914. if ( callbackInverse !== callbackExpect ) {
  8915. matches.push( elems[ i ] );
  8916. }
  8917. }
  8918. return matches;
  8919. },
  8920. // arg is for internal usage only
  8921. map: function( elems, callback, arg ) {
  8922. var length, value,
  8923. i = 0,
  8924. ret = [];
  8925. // Go through the array, translating each of the items to their new values
  8926. if ( isArrayLike( elems ) ) {
  8927. length = elems.length;
  8928. for ( ; i < length; i++ ) {
  8929. value = callback( elems[ i ], i, arg );
  8930. if ( value != null ) {
  8931. ret.push( value );
  8932. }
  8933. }
  8934. // Go through every key on the object,
  8935. } else {
  8936. for ( i in elems ) {
  8937. value = callback( elems[ i ], i, arg );
  8938. if ( value != null ) {
  8939. ret.push( value );
  8940. }
  8941. }
  8942. }
  8943. // Flatten any nested arrays
  8944. return concat.apply( [], ret );
  8945. },
  8946. // A global GUID counter for objects
  8947. guid: 1,
  8948. // jQuery.support is not used in Core but other projects attach their
  8949. // properties to it so it needs to exist.
  8950. support: support
  8951. } );
  8952. if ( typeof Symbol === "function" ) {
  8953. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  8954. }
  8955. // Populate the class2type map
  8956. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  8957. function( i, name ) {
  8958. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  8959. } );
  8960. function isArrayLike( obj ) {
  8961. // Support: real iOS 8.2 only (not reproducible in simulator)
  8962. // `in` check used to prevent JIT error (gh-2145)
  8963. // hasOwn isn't used here due to false negatives
  8964. // regarding Nodelist length in IE
  8965. var length = !!obj && "length" in obj && obj.length,
  8966. type = toType( obj );
  8967. if ( isFunction( obj ) || isWindow( obj ) ) {
  8968. return false;
  8969. }
  8970. return type === "array" || length === 0 ||
  8971. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  8972. }
  8973. var Sizzle =
  8974. /*!
  8975. * Sizzle CSS Selector Engine v2.3.4
  8976. * https://sizzlejs.com/
  8977. *
  8978. * Copyright JS Foundation and other contributors
  8979. * Released under the MIT license
  8980. * https://js.foundation/
  8981. *
  8982. * Date: 2019-04-08
  8983. */
  8984. (function( window ) {
  8985. var i,
  8986. support,
  8987. Expr,
  8988. getText,
  8989. isXML,
  8990. tokenize,
  8991. compile,
  8992. select,
  8993. outermostContext,
  8994. sortInput,
  8995. hasDuplicate,
  8996. // Local document vars
  8997. setDocument,
  8998. document,
  8999. docElem,
  9000. documentIsHTML,
  9001. rbuggyQSA,
  9002. rbuggyMatches,
  9003. matches,
  9004. contains,
  9005. // Instance-specific data
  9006. expando = "sizzle" + 1 * new Date(),
  9007. preferredDoc = window.document,
  9008. dirruns = 0,
  9009. done = 0,
  9010. classCache = createCache(),
  9011. tokenCache = createCache(),
  9012. compilerCache = createCache(),
  9013. nonnativeSelectorCache = createCache(),
  9014. sortOrder = function( a, b ) {
  9015. if ( a === b ) {
  9016. hasDuplicate = true;
  9017. }
  9018. return 0;
  9019. },
  9020. // Instance methods
  9021. hasOwn = ({}).hasOwnProperty,
  9022. arr = [],
  9023. pop = arr.pop,
  9024. push_native = arr.push,
  9025. push = arr.push,
  9026. slice = arr.slice,
  9027. // Use a stripped-down indexOf as it's faster than native
  9028. // https://jsperf.com/thor-indexof-vs-for/5
  9029. indexOf = function( list, elem ) {
  9030. var i = 0,
  9031. len = list.length;
  9032. for ( ; i < len; i++ ) {
  9033. if ( list[i] === elem ) {
  9034. return i;
  9035. }
  9036. }
  9037. return -1;
  9038. },
  9039. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  9040. // Regular expressions
  9041. // http://www.w3.org/TR/css3-selectors/#whitespace
  9042. whitespace = "[\\x20\\t\\r\\n\\f]",
  9043. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  9044. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  9045. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  9046. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  9047. // Operator (capture 2)
  9048. "*([*^$|!~]?=)" + whitespace +
  9049. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  9050. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  9051. "*\\]",
  9052. pseudos = ":(" + identifier + ")(?:\\((" +
  9053. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  9054. // 1. quoted (capture 3; capture 4 or capture 5)
  9055. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  9056. // 2. simple (capture 6)
  9057. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  9058. // 3. anything else (capture 2)
  9059. ".*" +
  9060. ")\\)|)",
  9061. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  9062. rwhitespace = new RegExp( whitespace + "+", "g" ),
  9063. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  9064. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  9065. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  9066. rdescend = new RegExp( whitespace + "|>" ),
  9067. rpseudo = new RegExp( pseudos ),
  9068. ridentifier = new RegExp( "^" + identifier + "$" ),
  9069. matchExpr = {
  9070. "ID": new RegExp( "^#(" + identifier + ")" ),
  9071. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  9072. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  9073. "ATTR": new RegExp( "^" + attributes ),
  9074. "PSEUDO": new RegExp( "^" + pseudos ),
  9075. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  9076. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  9077. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  9078. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  9079. // For use in libraries implementing .is()
  9080. // We use this for POS matching in `select`
  9081. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  9082. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  9083. },
  9084. rhtml = /HTML$/i,
  9085. rinputs = /^(?:input|select|textarea|button)$/i,
  9086. rheader = /^h\d$/i,
  9087. rnative = /^[^{]+\{\s*\[native \w/,
  9088. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  9089. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  9090. rsibling = /[+~]/,
  9091. // CSS escapes
  9092. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  9093. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  9094. funescape = function( _, escaped, escapedWhitespace ) {
  9095. var high = "0x" + escaped - 0x10000;
  9096. // NaN means non-codepoint
  9097. // Support: Firefox<24
  9098. // Workaround erroneous numeric interpretation of +"0x"
  9099. return high !== high || escapedWhitespace ?
  9100. escaped :
  9101. high < 0 ?
  9102. // BMP codepoint
  9103. String.fromCharCode( high + 0x10000 ) :
  9104. // Supplemental Plane codepoint (surrogate pair)
  9105. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  9106. },
  9107. // CSS string/identifier serialization
  9108. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  9109. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  9110. fcssescape = function( ch, asCodePoint ) {
  9111. if ( asCodePoint ) {
  9112. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  9113. if ( ch === "\0" ) {
  9114. return "\uFFFD";
  9115. }
  9116. // Control characters and (dependent upon position) numbers get escaped as code points
  9117. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  9118. }
  9119. // Other potentially-special ASCII characters get backslash-escaped
  9120. return "\\" + ch;
  9121. },
  9122. // Used for iframes
  9123. // See setDocument()
  9124. // Removing the function wrapper causes a "Permission Denied"
  9125. // error in IE
  9126. unloadHandler = function() {
  9127. setDocument();
  9128. },
  9129. inDisabledFieldset = addCombinator(
  9130. function( elem ) {
  9131. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  9132. },
  9133. { dir: "parentNode", next: "legend" }
  9134. );
  9135. // Optimize for push.apply( _, NodeList )
  9136. try {
  9137. push.apply(
  9138. (arr = slice.call( preferredDoc.childNodes )),
  9139. preferredDoc.childNodes
  9140. );
  9141. // Support: Android<4.0
  9142. // Detect silently failing push.apply
  9143. arr[ preferredDoc.childNodes.length ].nodeType;
  9144. } catch ( e ) {
  9145. push = { apply: arr.length ?
  9146. // Leverage slice if possible
  9147. function( target, els ) {
  9148. push_native.apply( target, slice.call(els) );
  9149. } :
  9150. // Support: IE<9
  9151. // Otherwise append directly
  9152. function( target, els ) {
  9153. var j = target.length,
  9154. i = 0;
  9155. // Can't trust NodeList.length
  9156. while ( (target[j++] = els[i++]) ) {}
  9157. target.length = j - 1;
  9158. }
  9159. };
  9160. }
  9161. function Sizzle( selector, context, results, seed ) {
  9162. var m, i, elem, nid, match, groups, newSelector,
  9163. newContext = context && context.ownerDocument,
  9164. // nodeType defaults to 9, since context defaults to document
  9165. nodeType = context ? context.nodeType : 9;
  9166. results = results || [];
  9167. // Return early from calls with invalid selector or context
  9168. if ( typeof selector !== "string" || !selector ||
  9169. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  9170. return results;
  9171. }
  9172. // Try to shortcut find operations (as opposed to filters) in HTML documents
  9173. if ( !seed ) {
  9174. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  9175. setDocument( context );
  9176. }
  9177. context = context || document;
  9178. if ( documentIsHTML ) {
  9179. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  9180. // (excepting DocumentFragment context, where the methods don't exist)
  9181. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  9182. // ID selector
  9183. if ( (m = match[1]) ) {
  9184. // Document context
  9185. if ( nodeType === 9 ) {
  9186. if ( (elem = context.getElementById( m )) ) {
  9187. // Support: IE, Opera, Webkit
  9188. // TODO: identify versions
  9189. // getElementById can match elements by name instead of ID
  9190. if ( elem.id === m ) {
  9191. results.push( elem );
  9192. return results;
  9193. }
  9194. } else {
  9195. return results;
  9196. }
  9197. // Element context
  9198. } else {
  9199. // Support: IE, Opera, Webkit
  9200. // TODO: identify versions
  9201. // getElementById can match elements by name instead of ID
  9202. if ( newContext && (elem = newContext.getElementById( m )) &&
  9203. contains( context, elem ) &&
  9204. elem.id === m ) {
  9205. results.push( elem );
  9206. return results;
  9207. }
  9208. }
  9209. // Type selector
  9210. } else if ( match[2] ) {
  9211. push.apply( results, context.getElementsByTagName( selector ) );
  9212. return results;
  9213. // Class selector
  9214. } else if ( (m = match[3]) && support.getElementsByClassName &&
  9215. context.getElementsByClassName ) {
  9216. push.apply( results, context.getElementsByClassName( m ) );
  9217. return results;
  9218. }
  9219. }
  9220. // Take advantage of querySelectorAll
  9221. if ( support.qsa &&
  9222. !nonnativeSelectorCache[ selector + " " ] &&
  9223. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  9224. // Support: IE 8 only
  9225. // Exclude object elements
  9226. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  9227. newSelector = selector;
  9228. newContext = context;
  9229. // qSA considers elements outside a scoping root when evaluating child or
  9230. // descendant combinators, which is not what we want.
  9231. // In such cases, we work around the behavior by prefixing every selector in the
  9232. // list with an ID selector referencing the scope context.
  9233. // Thanks to Andrew Dupont for this technique.
  9234. if ( nodeType === 1 && rdescend.test( selector ) ) {
  9235. // Capture the context ID, setting it first if necessary
  9236. if ( (nid = context.getAttribute( "id" )) ) {
  9237. nid = nid.replace( rcssescape, fcssescape );
  9238. } else {
  9239. context.setAttribute( "id", (nid = expando) );
  9240. }
  9241. // Prefix every selector in the list
  9242. groups = tokenize( selector );
  9243. i = groups.length;
  9244. while ( i-- ) {
  9245. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  9246. }
  9247. newSelector = groups.join( "," );
  9248. // Expand context for sibling selectors
  9249. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  9250. context;
  9251. }
  9252. try {
  9253. push.apply( results,
  9254. newContext.querySelectorAll( newSelector )
  9255. );
  9256. return results;
  9257. } catch ( qsaError ) {
  9258. nonnativeSelectorCache( selector, true );
  9259. } finally {
  9260. if ( nid === expando ) {
  9261. context.removeAttribute( "id" );
  9262. }
  9263. }
  9264. }
  9265. }
  9266. }
  9267. // All others
  9268. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  9269. }
  9270. /**
  9271. * Create key-value caches of limited size
  9272. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  9273. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  9274. * deleting the oldest entry
  9275. */
  9276. function createCache() {
  9277. var keys = [];
  9278. function cache( key, value ) {
  9279. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  9280. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  9281. // Only keep the most recent entries
  9282. delete cache[ keys.shift() ];
  9283. }
  9284. return (cache[ key + " " ] = value);
  9285. }
  9286. return cache;
  9287. }
  9288. /**
  9289. * Mark a function for special use by Sizzle
  9290. * @param {Function} fn The function to mark
  9291. */
  9292. function markFunction( fn ) {
  9293. fn[ expando ] = true;
  9294. return fn;
  9295. }
  9296. /**
  9297. * Support testing using an element
  9298. * @param {Function} fn Passed the created element and returns a boolean result
  9299. */
  9300. function assert( fn ) {
  9301. var el = document.createElement("fieldset");
  9302. try {
  9303. return !!fn( el );
  9304. } catch (e) {
  9305. return false;
  9306. } finally {
  9307. // Remove from its parent by default
  9308. if ( el.parentNode ) {
  9309. el.parentNode.removeChild( el );
  9310. }
  9311. // release memory in IE
  9312. el = null;
  9313. }
  9314. }
  9315. /**
  9316. * Adds the same handler for all of the specified attrs
  9317. * @param {String} attrs Pipe-separated list of attributes
  9318. * @param {Function} handler The method that will be applied
  9319. */
  9320. function addHandle( attrs, handler ) {
  9321. var arr = attrs.split("|"),
  9322. i = arr.length;
  9323. while ( i-- ) {
  9324. Expr.attrHandle[ arr[i] ] = handler;
  9325. }
  9326. }
  9327. /**
  9328. * Checks document order of two siblings
  9329. * @param {Element} a
  9330. * @param {Element} b
  9331. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  9332. */
  9333. function siblingCheck( a, b ) {
  9334. var cur = b && a,
  9335. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  9336. a.sourceIndex - b.sourceIndex;
  9337. // Use IE sourceIndex if available on both nodes
  9338. if ( diff ) {
  9339. return diff;
  9340. }
  9341. // Check if b follows a
  9342. if ( cur ) {
  9343. while ( (cur = cur.nextSibling) ) {
  9344. if ( cur === b ) {
  9345. return -1;
  9346. }
  9347. }
  9348. }
  9349. return a ? 1 : -1;
  9350. }
  9351. /**
  9352. * Returns a function to use in pseudos for input types
  9353. * @param {String} type
  9354. */
  9355. function createInputPseudo( type ) {
  9356. return function( elem ) {
  9357. var name = elem.nodeName.toLowerCase();
  9358. return name === "input" && elem.type === type;
  9359. };
  9360. }
  9361. /**
  9362. * Returns a function to use in pseudos for buttons
  9363. * @param {String} type
  9364. */
  9365. function createButtonPseudo( type ) {
  9366. return function( elem ) {
  9367. var name = elem.nodeName.toLowerCase();
  9368. return (name === "input" || name === "button") && elem.type === type;
  9369. };
  9370. }
  9371. /**
  9372. * Returns a function to use in pseudos for :enabled/:disabled
  9373. * @param {Boolean} disabled true for :disabled; false for :enabled
  9374. */
  9375. function createDisabledPseudo( disabled ) {
  9376. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  9377. return function( elem ) {
  9378. // Only certain elements can match :enabled or :disabled
  9379. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  9380. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  9381. if ( "form" in elem ) {
  9382. // Check for inherited disabledness on relevant non-disabled elements:
  9383. // * listed form-associated elements in a disabled fieldset
  9384. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  9385. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  9386. // * option elements in a disabled optgroup
  9387. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  9388. // All such elements have a "form" property.
  9389. if ( elem.parentNode && elem.disabled === false ) {
  9390. // Option elements defer to a parent optgroup if present
  9391. if ( "label" in elem ) {
  9392. if ( "label" in elem.parentNode ) {
  9393. return elem.parentNode.disabled === disabled;
  9394. } else {
  9395. return elem.disabled === disabled;
  9396. }
  9397. }
  9398. // Support: IE 6 - 11
  9399. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  9400. return elem.isDisabled === disabled ||
  9401. // Where there is no isDisabled, check manually
  9402. /* jshint -W018 */
  9403. elem.isDisabled !== !disabled &&
  9404. inDisabledFieldset( elem ) === disabled;
  9405. }
  9406. return elem.disabled === disabled;
  9407. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  9408. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  9409. // even exist on them, let alone have a boolean value.
  9410. } else if ( "label" in elem ) {
  9411. return elem.disabled === disabled;
  9412. }
  9413. // Remaining elements are neither :enabled nor :disabled
  9414. return false;
  9415. };
  9416. }
  9417. /**
  9418. * Returns a function to use in pseudos for positionals
  9419. * @param {Function} fn
  9420. */
  9421. function createPositionalPseudo( fn ) {
  9422. return markFunction(function( argument ) {
  9423. argument = +argument;
  9424. return markFunction(function( seed, matches ) {
  9425. var j,
  9426. matchIndexes = fn( [], seed.length, argument ),
  9427. i = matchIndexes.length;
  9428. // Match elements found at the specified indexes
  9429. while ( i-- ) {
  9430. if ( seed[ (j = matchIndexes[i]) ] ) {
  9431. seed[j] = !(matches[j] = seed[j]);
  9432. }
  9433. }
  9434. });
  9435. });
  9436. }
  9437. /**
  9438. * Checks a node for validity as a Sizzle context
  9439. * @param {Element|Object=} context
  9440. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  9441. */
  9442. function testContext( context ) {
  9443. return context && typeof context.getElementsByTagName !== "undefined" && context;
  9444. }
  9445. // Expose support vars for convenience
  9446. support = Sizzle.support = {};
  9447. /**
  9448. * Detects XML nodes
  9449. * @param {Element|Object} elem An element or a document
  9450. * @returns {Boolean} True iff elem is a non-HTML XML node
  9451. */
  9452. isXML = Sizzle.isXML = function( elem ) {
  9453. var namespace = elem.namespaceURI,
  9454. docElem = (elem.ownerDocument || elem).documentElement;
  9455. // Support: IE <=8
  9456. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  9457. // https://bugs.jquery.com/ticket/4833
  9458. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  9459. };
  9460. /**
  9461. * Sets document-related variables once based on the current document
  9462. * @param {Element|Object} [doc] An element or document object to use to set the document
  9463. * @returns {Object} Returns the current document
  9464. */
  9465. setDocument = Sizzle.setDocument = function( node ) {
  9466. var hasCompare, subWindow,
  9467. doc = node ? node.ownerDocument || node : preferredDoc;
  9468. // Return early if doc is invalid or already selected
  9469. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  9470. return document;
  9471. }
  9472. // Update global variables
  9473. document = doc;
  9474. docElem = document.documentElement;
  9475. documentIsHTML = !isXML( document );
  9476. // Support: IE 9-11, Edge
  9477. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  9478. if ( preferredDoc !== document &&
  9479. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  9480. // Support: IE 11, Edge
  9481. if ( subWindow.addEventListener ) {
  9482. subWindow.addEventListener( "unload", unloadHandler, false );
  9483. // Support: IE 9 - 10 only
  9484. } else if ( subWindow.attachEvent ) {
  9485. subWindow.attachEvent( "onunload", unloadHandler );
  9486. }
  9487. }
  9488. /* Attributes
  9489. ---------------------------------------------------------------------- */
  9490. // Support: IE<8
  9491. // Verify that getAttribute really returns attributes and not properties
  9492. // (excepting IE8 booleans)
  9493. support.attributes = assert(function( el ) {
  9494. el.className = "i";
  9495. return !el.getAttribute("className");
  9496. });
  9497. /* getElement(s)By*
  9498. ---------------------------------------------------------------------- */
  9499. // Check if getElementsByTagName("*") returns only elements
  9500. support.getElementsByTagName = assert(function( el ) {
  9501. el.appendChild( document.createComment("") );
  9502. return !el.getElementsByTagName("*").length;
  9503. });
  9504. // Support: IE<9
  9505. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  9506. // Support: IE<10
  9507. // Check if getElementById returns elements by name
  9508. // The broken getElementById methods don't pick up programmatically-set names,
  9509. // so use a roundabout getElementsByName test
  9510. support.getById = assert(function( el ) {
  9511. docElem.appendChild( el ).id = expando;
  9512. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  9513. });
  9514. // ID filter and find
  9515. if ( support.getById ) {
  9516. Expr.filter["ID"] = function( id ) {
  9517. var attrId = id.replace( runescape, funescape );
  9518. return function( elem ) {
  9519. return elem.getAttribute("id") === attrId;
  9520. };
  9521. };
  9522. Expr.find["ID"] = function( id, context ) {
  9523. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9524. var elem = context.getElementById( id );
  9525. return elem ? [ elem ] : [];
  9526. }
  9527. };
  9528. } else {
  9529. Expr.filter["ID"] = function( id ) {
  9530. var attrId = id.replace( runescape, funescape );
  9531. return function( elem ) {
  9532. var node = typeof elem.getAttributeNode !== "undefined" &&
  9533. elem.getAttributeNode("id");
  9534. return node && node.value === attrId;
  9535. };
  9536. };
  9537. // Support: IE 6 - 7 only
  9538. // getElementById is not reliable as a find shortcut
  9539. Expr.find["ID"] = function( id, context ) {
  9540. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9541. var node, i, elems,
  9542. elem = context.getElementById( id );
  9543. if ( elem ) {
  9544. // Verify the id attribute
  9545. node = elem.getAttributeNode("id");
  9546. if ( node && node.value === id ) {
  9547. return [ elem ];
  9548. }
  9549. // Fall back on getElementsByName
  9550. elems = context.getElementsByName( id );
  9551. i = 0;
  9552. while ( (elem = elems[i++]) ) {
  9553. node = elem.getAttributeNode("id");
  9554. if ( node && node.value === id ) {
  9555. return [ elem ];
  9556. }
  9557. }
  9558. }
  9559. return [];
  9560. }
  9561. };
  9562. }
  9563. // Tag
  9564. Expr.find["TAG"] = support.getElementsByTagName ?
  9565. function( tag, context ) {
  9566. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9567. return context.getElementsByTagName( tag );
  9568. // DocumentFragment nodes don't have gEBTN
  9569. } else if ( support.qsa ) {
  9570. return context.querySelectorAll( tag );
  9571. }
  9572. } :
  9573. function( tag, context ) {
  9574. var elem,
  9575. tmp = [],
  9576. i = 0,
  9577. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  9578. results = context.getElementsByTagName( tag );
  9579. // Filter out possible comments
  9580. if ( tag === "*" ) {
  9581. while ( (elem = results[i++]) ) {
  9582. if ( elem.nodeType === 1 ) {
  9583. tmp.push( elem );
  9584. }
  9585. }
  9586. return tmp;
  9587. }
  9588. return results;
  9589. };
  9590. // Class
  9591. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  9592. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  9593. return context.getElementsByClassName( className );
  9594. }
  9595. };
  9596. /* QSA/matchesSelector
  9597. ---------------------------------------------------------------------- */
  9598. // QSA and matchesSelector support
  9599. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  9600. rbuggyMatches = [];
  9601. // qSa(:focus) reports false when true (Chrome 21)
  9602. // We allow this because of a bug in IE8/9 that throws an error
  9603. // whenever `document.activeElement` is accessed on an iframe
  9604. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  9605. // See https://bugs.jquery.com/ticket/13378
  9606. rbuggyQSA = [];
  9607. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  9608. // Build QSA regex
  9609. // Regex strategy adopted from Diego Perini
  9610. assert(function( el ) {
  9611. // Select is set to empty string on purpose
  9612. // This is to test IE's treatment of not explicitly
  9613. // setting a boolean content attribute,
  9614. // since its presence should be enough
  9615. // https://bugs.jquery.com/ticket/12359
  9616. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  9617. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  9618. "<option selected=''></option></select>";
  9619. // Support: IE8, Opera 11-12.16
  9620. // Nothing should be selected when empty strings follow ^= or $= or *=
  9621. // The test attribute must be unknown in Opera but "safe" for WinRT
  9622. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  9623. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  9624. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  9625. }
  9626. // Support: IE8
  9627. // Boolean attributes and "value" are not treated correctly
  9628. if ( !el.querySelectorAll("[selected]").length ) {
  9629. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  9630. }
  9631. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  9632. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  9633. rbuggyQSA.push("~=");
  9634. }
  9635. // Webkit/Opera - :checked should return selected option elements
  9636. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9637. // IE8 throws error here and will not see later tests
  9638. if ( !el.querySelectorAll(":checked").length ) {
  9639. rbuggyQSA.push(":checked");
  9640. }
  9641. // Support: Safari 8+, iOS 8+
  9642. // https://bugs.webkit.org/show_bug.cgi?id=136851
  9643. // In-page `selector#id sibling-combinator selector` fails
  9644. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  9645. rbuggyQSA.push(".#.+[+~]");
  9646. }
  9647. });
  9648. assert(function( el ) {
  9649. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  9650. "<select disabled='disabled'><option/></select>";
  9651. // Support: Windows 8 Native Apps
  9652. // The type and name attributes are restricted during .innerHTML assignment
  9653. var input = document.createElement("input");
  9654. input.setAttribute( "type", "hidden" );
  9655. el.appendChild( input ).setAttribute( "name", "D" );
  9656. // Support: IE8
  9657. // Enforce case-sensitivity of name attribute
  9658. if ( el.querySelectorAll("[name=d]").length ) {
  9659. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  9660. }
  9661. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  9662. // IE8 throws error here and will not see later tests
  9663. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  9664. rbuggyQSA.push( ":enabled", ":disabled" );
  9665. }
  9666. // Support: IE9-11+
  9667. // IE's :disabled selector does not pick up the children of disabled fieldsets
  9668. docElem.appendChild( el ).disabled = true;
  9669. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  9670. rbuggyQSA.push( ":enabled", ":disabled" );
  9671. }
  9672. // Opera 10-11 does not throw on post-comma invalid pseudos
  9673. el.querySelectorAll("*,:x");
  9674. rbuggyQSA.push(",.*:");
  9675. });
  9676. }
  9677. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  9678. docElem.webkitMatchesSelector ||
  9679. docElem.mozMatchesSelector ||
  9680. docElem.oMatchesSelector ||
  9681. docElem.msMatchesSelector) )) ) {
  9682. assert(function( el ) {
  9683. // Check to see if it's possible to do matchesSelector
  9684. // on a disconnected node (IE 9)
  9685. support.disconnectedMatch = matches.call( el, "*" );
  9686. // This should fail with an exception
  9687. // Gecko does not error, returns false instead
  9688. matches.call( el, "[s!='']:x" );
  9689. rbuggyMatches.push( "!=", pseudos );
  9690. });
  9691. }
  9692. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  9693. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  9694. /* Contains
  9695. ---------------------------------------------------------------------- */
  9696. hasCompare = rnative.test( docElem.compareDocumentPosition );
  9697. // Element contains another
  9698. // Purposefully self-exclusive
  9699. // As in, an element does not contain itself
  9700. contains = hasCompare || rnative.test( docElem.contains ) ?
  9701. function( a, b ) {
  9702. var adown = a.nodeType === 9 ? a.documentElement : a,
  9703. bup = b && b.parentNode;
  9704. return a === bup || !!( bup && bup.nodeType === 1 && (
  9705. adown.contains ?
  9706. adown.contains( bup ) :
  9707. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  9708. ));
  9709. } :
  9710. function( a, b ) {
  9711. if ( b ) {
  9712. while ( (b = b.parentNode) ) {
  9713. if ( b === a ) {
  9714. return true;
  9715. }
  9716. }
  9717. }
  9718. return false;
  9719. };
  9720. /* Sorting
  9721. ---------------------------------------------------------------------- */
  9722. // Document order sorting
  9723. sortOrder = hasCompare ?
  9724. function( a, b ) {
  9725. // Flag for duplicate removal
  9726. if ( a === b ) {
  9727. hasDuplicate = true;
  9728. return 0;
  9729. }
  9730. // Sort on method existence if only one input has compareDocumentPosition
  9731. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  9732. if ( compare ) {
  9733. return compare;
  9734. }
  9735. // Calculate position if both inputs belong to the same document
  9736. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  9737. a.compareDocumentPosition( b ) :
  9738. // Otherwise we know they are disconnected
  9739. 1;
  9740. // Disconnected nodes
  9741. if ( compare & 1 ||
  9742. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  9743. // Choose the first element that is related to our preferred document
  9744. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  9745. return -1;
  9746. }
  9747. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  9748. return 1;
  9749. }
  9750. // Maintain original order
  9751. return sortInput ?
  9752. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9753. 0;
  9754. }
  9755. return compare & 4 ? -1 : 1;
  9756. } :
  9757. function( a, b ) {
  9758. // Exit early if the nodes are identical
  9759. if ( a === b ) {
  9760. hasDuplicate = true;
  9761. return 0;
  9762. }
  9763. var cur,
  9764. i = 0,
  9765. aup = a.parentNode,
  9766. bup = b.parentNode,
  9767. ap = [ a ],
  9768. bp = [ b ];
  9769. // Parentless nodes are either documents or disconnected
  9770. if ( !aup || !bup ) {
  9771. return a === document ? -1 :
  9772. b === document ? 1 :
  9773. aup ? -1 :
  9774. bup ? 1 :
  9775. sortInput ?
  9776. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9777. 0;
  9778. // If the nodes are siblings, we can do a quick check
  9779. } else if ( aup === bup ) {
  9780. return siblingCheck( a, b );
  9781. }
  9782. // Otherwise we need full lists of their ancestors for comparison
  9783. cur = a;
  9784. while ( (cur = cur.parentNode) ) {
  9785. ap.unshift( cur );
  9786. }
  9787. cur = b;
  9788. while ( (cur = cur.parentNode) ) {
  9789. bp.unshift( cur );
  9790. }
  9791. // Walk down the tree looking for a discrepancy
  9792. while ( ap[i] === bp[i] ) {
  9793. i++;
  9794. }
  9795. return i ?
  9796. // Do a sibling check if the nodes have a common ancestor
  9797. siblingCheck( ap[i], bp[i] ) :
  9798. // Otherwise nodes in our document sort first
  9799. ap[i] === preferredDoc ? -1 :
  9800. bp[i] === preferredDoc ? 1 :
  9801. 0;
  9802. };
  9803. return document;
  9804. };
  9805. Sizzle.matches = function( expr, elements ) {
  9806. return Sizzle( expr, null, null, elements );
  9807. };
  9808. Sizzle.matchesSelector = function( elem, expr ) {
  9809. // Set document vars if needed
  9810. if ( ( elem.ownerDocument || elem ) !== document ) {
  9811. setDocument( elem );
  9812. }
  9813. if ( support.matchesSelector && documentIsHTML &&
  9814. !nonnativeSelectorCache[ expr + " " ] &&
  9815. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  9816. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  9817. try {
  9818. var ret = matches.call( elem, expr );
  9819. // IE 9's matchesSelector returns false on disconnected nodes
  9820. if ( ret || support.disconnectedMatch ||
  9821. // As well, disconnected nodes are said to be in a document
  9822. // fragment in IE 9
  9823. elem.document && elem.document.nodeType !== 11 ) {
  9824. return ret;
  9825. }
  9826. } catch (e) {
  9827. nonnativeSelectorCache( expr, true );
  9828. }
  9829. }
  9830. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  9831. };
  9832. Sizzle.contains = function( context, elem ) {
  9833. // Set document vars if needed
  9834. if ( ( context.ownerDocument || context ) !== document ) {
  9835. setDocument( context );
  9836. }
  9837. return contains( context, elem );
  9838. };
  9839. Sizzle.attr = function( elem, name ) {
  9840. // Set document vars if needed
  9841. if ( ( elem.ownerDocument || elem ) !== document ) {
  9842. setDocument( elem );
  9843. }
  9844. var fn = Expr.attrHandle[ name.toLowerCase() ],
  9845. // Don't get fooled by Object.prototype properties (jQuery #13807)
  9846. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  9847. fn( elem, name, !documentIsHTML ) :
  9848. undefined;
  9849. return val !== undefined ?
  9850. val :
  9851. support.attributes || !documentIsHTML ?
  9852. elem.getAttribute( name ) :
  9853. (val = elem.getAttributeNode(name)) && val.specified ?
  9854. val.value :
  9855. null;
  9856. };
  9857. Sizzle.escape = function( sel ) {
  9858. return (sel + "").replace( rcssescape, fcssescape );
  9859. };
  9860. Sizzle.error = function( msg ) {
  9861. throw new Error( "Syntax error, unrecognized expression: " + msg );
  9862. };
  9863. /**
  9864. * Document sorting and removing duplicates
  9865. * @param {ArrayLike} results
  9866. */
  9867. Sizzle.uniqueSort = function( results ) {
  9868. var elem,
  9869. duplicates = [],
  9870. j = 0,
  9871. i = 0;
  9872. // Unless we *know* we can detect duplicates, assume their presence
  9873. hasDuplicate = !support.detectDuplicates;
  9874. sortInput = !support.sortStable && results.slice( 0 );
  9875. results.sort( sortOrder );
  9876. if ( hasDuplicate ) {
  9877. while ( (elem = results[i++]) ) {
  9878. if ( elem === results[ i ] ) {
  9879. j = duplicates.push( i );
  9880. }
  9881. }
  9882. while ( j-- ) {
  9883. results.splice( duplicates[ j ], 1 );
  9884. }
  9885. }
  9886. // Clear input after sorting to release objects
  9887. // See https://github.com/jquery/sizzle/pull/225
  9888. sortInput = null;
  9889. return results;
  9890. };
  9891. /**
  9892. * Utility function for retrieving the text value of an array of DOM nodes
  9893. * @param {Array|Element} elem
  9894. */
  9895. getText = Sizzle.getText = function( elem ) {
  9896. var node,
  9897. ret = "",
  9898. i = 0,
  9899. nodeType = elem.nodeType;
  9900. if ( !nodeType ) {
  9901. // If no nodeType, this is expected to be an array
  9902. while ( (node = elem[i++]) ) {
  9903. // Do not traverse comment nodes
  9904. ret += getText( node );
  9905. }
  9906. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  9907. // Use textContent for elements
  9908. // innerText usage removed for consistency of new lines (jQuery #11153)
  9909. if ( typeof elem.textContent === "string" ) {
  9910. return elem.textContent;
  9911. } else {
  9912. // Traverse its children
  9913. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9914. ret += getText( elem );
  9915. }
  9916. }
  9917. } else if ( nodeType === 3 || nodeType === 4 ) {
  9918. return elem.nodeValue;
  9919. }
  9920. // Do not include comment or processing instruction nodes
  9921. return ret;
  9922. };
  9923. Expr = Sizzle.selectors = {
  9924. // Can be adjusted by the user
  9925. cacheLength: 50,
  9926. createPseudo: markFunction,
  9927. match: matchExpr,
  9928. attrHandle: {},
  9929. find: {},
  9930. relative: {
  9931. ">": { dir: "parentNode", first: true },
  9932. " ": { dir: "parentNode" },
  9933. "+": { dir: "previousSibling", first: true },
  9934. "~": { dir: "previousSibling" }
  9935. },
  9936. preFilter: {
  9937. "ATTR": function( match ) {
  9938. match[1] = match[1].replace( runescape, funescape );
  9939. // Move the given value to match[3] whether quoted or unquoted
  9940. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  9941. if ( match[2] === "~=" ) {
  9942. match[3] = " " + match[3] + " ";
  9943. }
  9944. return match.slice( 0, 4 );
  9945. },
  9946. "CHILD": function( match ) {
  9947. /* matches from matchExpr["CHILD"]
  9948. 1 type (only|nth|...)
  9949. 2 what (child|of-type)
  9950. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  9951. 4 xn-component of xn+y argument ([+-]?\d*n|)
  9952. 5 sign of xn-component
  9953. 6 x of xn-component
  9954. 7 sign of y-component
  9955. 8 y of y-component
  9956. */
  9957. match[1] = match[1].toLowerCase();
  9958. if ( match[1].slice( 0, 3 ) === "nth" ) {
  9959. // nth-* requires argument
  9960. if ( !match[3] ) {
  9961. Sizzle.error( match[0] );
  9962. }
  9963. // numeric x and y parameters for Expr.filter.CHILD
  9964. // remember that false/true cast respectively to 0/1
  9965. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  9966. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  9967. // other types prohibit arguments
  9968. } else if ( match[3] ) {
  9969. Sizzle.error( match[0] );
  9970. }
  9971. return match;
  9972. },
  9973. "PSEUDO": function( match ) {
  9974. var excess,
  9975. unquoted = !match[6] && match[2];
  9976. if ( matchExpr["CHILD"].test( match[0] ) ) {
  9977. return null;
  9978. }
  9979. // Accept quoted arguments as-is
  9980. if ( match[3] ) {
  9981. match[2] = match[4] || match[5] || "";
  9982. // Strip excess characters from unquoted arguments
  9983. } else if ( unquoted && rpseudo.test( unquoted ) &&
  9984. // Get excess from tokenize (recursively)
  9985. (excess = tokenize( unquoted, true )) &&
  9986. // advance to the next closing parenthesis
  9987. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  9988. // excess is a negative index
  9989. match[0] = match[0].slice( 0, excess );
  9990. match[2] = unquoted.slice( 0, excess );
  9991. }
  9992. // Return only captures needed by the pseudo filter method (type and argument)
  9993. return match.slice( 0, 3 );
  9994. }
  9995. },
  9996. filter: {
  9997. "TAG": function( nodeNameSelector ) {
  9998. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  9999. return nodeNameSelector === "*" ?
  10000. function() { return true; } :
  10001. function( elem ) {
  10002. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  10003. };
  10004. },
  10005. "CLASS": function( className ) {
  10006. var pattern = classCache[ className + " " ];
  10007. return pattern ||
  10008. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  10009. classCache( className, function( elem ) {
  10010. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  10011. });
  10012. },
  10013. "ATTR": function( name, operator, check ) {
  10014. return function( elem ) {
  10015. var result = Sizzle.attr( elem, name );
  10016. if ( result == null ) {
  10017. return operator === "!=";
  10018. }
  10019. if ( !operator ) {
  10020. return true;
  10021. }
  10022. result += "";
  10023. return operator === "=" ? result === check :
  10024. operator === "!=" ? result !== check :
  10025. operator === "^=" ? check && result.indexOf( check ) === 0 :
  10026. operator === "*=" ? check && result.indexOf( check ) > -1 :
  10027. operator === "$=" ? check && result.slice( -check.length ) === check :
  10028. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  10029. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  10030. false;
  10031. };
  10032. },
  10033. "CHILD": function( type, what, argument, first, last ) {
  10034. var simple = type.slice( 0, 3 ) !== "nth",
  10035. forward = type.slice( -4 ) !== "last",
  10036. ofType = what === "of-type";
  10037. return first === 1 && last === 0 ?
  10038. // Shortcut for :nth-*(n)
  10039. function( elem ) {
  10040. return !!elem.parentNode;
  10041. } :
  10042. function( elem, context, xml ) {
  10043. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  10044. dir = simple !== forward ? "nextSibling" : "previousSibling",
  10045. parent = elem.parentNode,
  10046. name = ofType && elem.nodeName.toLowerCase(),
  10047. useCache = !xml && !ofType,
  10048. diff = false;
  10049. if ( parent ) {
  10050. // :(first|last|only)-(child|of-type)
  10051. if ( simple ) {
  10052. while ( dir ) {
  10053. node = elem;
  10054. while ( (node = node[ dir ]) ) {
  10055. if ( ofType ?
  10056. node.nodeName.toLowerCase() === name :
  10057. node.nodeType === 1 ) {
  10058. return false;
  10059. }
  10060. }
  10061. // Reverse direction for :only-* (if we haven't yet done so)
  10062. start = dir = type === "only" && !start && "nextSibling";
  10063. }
  10064. return true;
  10065. }
  10066. start = [ forward ? parent.firstChild : parent.lastChild ];
  10067. // non-xml :nth-child(...) stores cache data on `parent`
  10068. if ( forward && useCache ) {
  10069. // Seek `elem` from a previously-cached index
  10070. // ...in a gzip-friendly way
  10071. node = parent;
  10072. outerCache = node[ expando ] || (node[ expando ] = {});
  10073. // Support: IE <9 only
  10074. // Defend against cloned attroperties (jQuery gh-1709)
  10075. uniqueCache = outerCache[ node.uniqueID ] ||
  10076. (outerCache[ node.uniqueID ] = {});
  10077. cache = uniqueCache[ type ] || [];
  10078. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10079. diff = nodeIndex && cache[ 2 ];
  10080. node = nodeIndex && parent.childNodes[ nodeIndex ];
  10081. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10082. // Fallback to seeking `elem` from the start
  10083. (diff = nodeIndex = 0) || start.pop()) ) {
  10084. // When found, cache indexes on `parent` and break
  10085. if ( node.nodeType === 1 && ++diff && node === elem ) {
  10086. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  10087. break;
  10088. }
  10089. }
  10090. } else {
  10091. // Use previously-cached element index if available
  10092. if ( useCache ) {
  10093. // ...in a gzip-friendly way
  10094. node = elem;
  10095. outerCache = node[ expando ] || (node[ expando ] = {});
  10096. // Support: IE <9 only
  10097. // Defend against cloned attroperties (jQuery gh-1709)
  10098. uniqueCache = outerCache[ node.uniqueID ] ||
  10099. (outerCache[ node.uniqueID ] = {});
  10100. cache = uniqueCache[ type ] || [];
  10101. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10102. diff = nodeIndex;
  10103. }
  10104. // xml :nth-child(...)
  10105. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  10106. if ( diff === false ) {
  10107. // Use the same loop as above to seek `elem` from the start
  10108. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10109. (diff = nodeIndex = 0) || start.pop()) ) {
  10110. if ( ( ofType ?
  10111. node.nodeName.toLowerCase() === name :
  10112. node.nodeType === 1 ) &&
  10113. ++diff ) {
  10114. // Cache the index of each encountered element
  10115. if ( useCache ) {
  10116. outerCache = node[ expando ] || (node[ expando ] = {});
  10117. // Support: IE <9 only
  10118. // Defend against cloned attroperties (jQuery gh-1709)
  10119. uniqueCache = outerCache[ node.uniqueID ] ||
  10120. (outerCache[ node.uniqueID ] = {});
  10121. uniqueCache[ type ] = [ dirruns, diff ];
  10122. }
  10123. if ( node === elem ) {
  10124. break;
  10125. }
  10126. }
  10127. }
  10128. }
  10129. }
  10130. // Incorporate the offset, then check against cycle size
  10131. diff -= last;
  10132. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  10133. }
  10134. };
  10135. },
  10136. "PSEUDO": function( pseudo, argument ) {
  10137. // pseudo-class names are case-insensitive
  10138. // http://www.w3.org/TR/selectors/#pseudo-classes
  10139. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  10140. // Remember that setFilters inherits from pseudos
  10141. var args,
  10142. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  10143. Sizzle.error( "unsupported pseudo: " + pseudo );
  10144. // The user may use createPseudo to indicate that
  10145. // arguments are needed to create the filter function
  10146. // just as Sizzle does
  10147. if ( fn[ expando ] ) {
  10148. return fn( argument );
  10149. }
  10150. // But maintain support for old signatures
  10151. if ( fn.length > 1 ) {
  10152. args = [ pseudo, pseudo, "", argument ];
  10153. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  10154. markFunction(function( seed, matches ) {
  10155. var idx,
  10156. matched = fn( seed, argument ),
  10157. i = matched.length;
  10158. while ( i-- ) {
  10159. idx = indexOf( seed, matched[i] );
  10160. seed[ idx ] = !( matches[ idx ] = matched[i] );
  10161. }
  10162. }) :
  10163. function( elem ) {
  10164. return fn( elem, 0, args );
  10165. };
  10166. }
  10167. return fn;
  10168. }
  10169. },
  10170. pseudos: {
  10171. // Potentially complex pseudos
  10172. "not": markFunction(function( selector ) {
  10173. // Trim the selector passed to compile
  10174. // to avoid treating leading and trailing
  10175. // spaces as combinators
  10176. var input = [],
  10177. results = [],
  10178. matcher = compile( selector.replace( rtrim, "$1" ) );
  10179. return matcher[ expando ] ?
  10180. markFunction(function( seed, matches, context, xml ) {
  10181. var elem,
  10182. unmatched = matcher( seed, null, xml, [] ),
  10183. i = seed.length;
  10184. // Match elements unmatched by `matcher`
  10185. while ( i-- ) {
  10186. if ( (elem = unmatched[i]) ) {
  10187. seed[i] = !(matches[i] = elem);
  10188. }
  10189. }
  10190. }) :
  10191. function( elem, context, xml ) {
  10192. input[0] = elem;
  10193. matcher( input, null, xml, results );
  10194. // Don't keep the element (issue #299)
  10195. input[0] = null;
  10196. return !results.pop();
  10197. };
  10198. }),
  10199. "has": markFunction(function( selector ) {
  10200. return function( elem ) {
  10201. return Sizzle( selector, elem ).length > 0;
  10202. };
  10203. }),
  10204. "contains": markFunction(function( text ) {
  10205. text = text.replace( runescape, funescape );
  10206. return function( elem ) {
  10207. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  10208. };
  10209. }),
  10210. // "Whether an element is represented by a :lang() selector
  10211. // is based solely on the element's language value
  10212. // being equal to the identifier C,
  10213. // or beginning with the identifier C immediately followed by "-".
  10214. // The matching of C against the element's language value is performed case-insensitively.
  10215. // The identifier C does not have to be a valid language name."
  10216. // http://www.w3.org/TR/selectors/#lang-pseudo
  10217. "lang": markFunction( function( lang ) {
  10218. // lang value must be a valid identifier
  10219. if ( !ridentifier.test(lang || "") ) {
  10220. Sizzle.error( "unsupported lang: " + lang );
  10221. }
  10222. lang = lang.replace( runescape, funescape ).toLowerCase();
  10223. return function( elem ) {
  10224. var elemLang;
  10225. do {
  10226. if ( (elemLang = documentIsHTML ?
  10227. elem.lang :
  10228. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  10229. elemLang = elemLang.toLowerCase();
  10230. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  10231. }
  10232. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  10233. return false;
  10234. };
  10235. }),
  10236. // Miscellaneous
  10237. "target": function( elem ) {
  10238. var hash = window.location && window.location.hash;
  10239. return hash && hash.slice( 1 ) === elem.id;
  10240. },
  10241. "root": function( elem ) {
  10242. return elem === docElem;
  10243. },
  10244. "focus": function( elem ) {
  10245. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  10246. },
  10247. // Boolean properties
  10248. "enabled": createDisabledPseudo( false ),
  10249. "disabled": createDisabledPseudo( true ),
  10250. "checked": function( elem ) {
  10251. // In CSS3, :checked should return both checked and selected elements
  10252. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  10253. var nodeName = elem.nodeName.toLowerCase();
  10254. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  10255. },
  10256. "selected": function( elem ) {
  10257. // Accessing this property makes selected-by-default
  10258. // options in Safari work properly
  10259. if ( elem.parentNode ) {
  10260. elem.parentNode.selectedIndex;
  10261. }
  10262. return elem.selected === true;
  10263. },
  10264. // Contents
  10265. "empty": function( elem ) {
  10266. // http://www.w3.org/TR/selectors/#empty-pseudo
  10267. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  10268. // but not by others (comment: 8; processing instruction: 7; etc.)
  10269. // nodeType < 6 works because attributes (2) do not appear as children
  10270. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10271. if ( elem.nodeType < 6 ) {
  10272. return false;
  10273. }
  10274. }
  10275. return true;
  10276. },
  10277. "parent": function( elem ) {
  10278. return !Expr.pseudos["empty"]( elem );
  10279. },
  10280. // Element/input types
  10281. "header": function( elem ) {
  10282. return rheader.test( elem.nodeName );
  10283. },
  10284. "input": function( elem ) {
  10285. return rinputs.test( elem.nodeName );
  10286. },
  10287. "button": function( elem ) {
  10288. var name = elem.nodeName.toLowerCase();
  10289. return name === "input" && elem.type === "button" || name === "button";
  10290. },
  10291. "text": function( elem ) {
  10292. var attr;
  10293. return elem.nodeName.toLowerCase() === "input" &&
  10294. elem.type === "text" &&
  10295. // Support: IE<8
  10296. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  10297. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  10298. },
  10299. // Position-in-collection
  10300. "first": createPositionalPseudo(function() {
  10301. return [ 0 ];
  10302. }),
  10303. "last": createPositionalPseudo(function( matchIndexes, length ) {
  10304. return [ length - 1 ];
  10305. }),
  10306. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10307. return [ argument < 0 ? argument + length : argument ];
  10308. }),
  10309. "even": createPositionalPseudo(function( matchIndexes, length ) {
  10310. var i = 0;
  10311. for ( ; i < length; i += 2 ) {
  10312. matchIndexes.push( i );
  10313. }
  10314. return matchIndexes;
  10315. }),
  10316. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  10317. var i = 1;
  10318. for ( ; i < length; i += 2 ) {
  10319. matchIndexes.push( i );
  10320. }
  10321. return matchIndexes;
  10322. }),
  10323. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10324. var i = argument < 0 ?
  10325. argument + length :
  10326. argument > length ?
  10327. length :
  10328. argument;
  10329. for ( ; --i >= 0; ) {
  10330. matchIndexes.push( i );
  10331. }
  10332. return matchIndexes;
  10333. }),
  10334. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10335. var i = argument < 0 ? argument + length : argument;
  10336. for ( ; ++i < length; ) {
  10337. matchIndexes.push( i );
  10338. }
  10339. return matchIndexes;
  10340. })
  10341. }
  10342. };
  10343. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  10344. // Add button/input type pseudos
  10345. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  10346. Expr.pseudos[ i ] = createInputPseudo( i );
  10347. }
  10348. for ( i in { submit: true, reset: true } ) {
  10349. Expr.pseudos[ i ] = createButtonPseudo( i );
  10350. }
  10351. // Easy API for creating new setFilters
  10352. function setFilters() {}
  10353. setFilters.prototype = Expr.filters = Expr.pseudos;
  10354. Expr.setFilters = new setFilters();
  10355. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  10356. var matched, match, tokens, type,
  10357. soFar, groups, preFilters,
  10358. cached = tokenCache[ selector + " " ];
  10359. if ( cached ) {
  10360. return parseOnly ? 0 : cached.slice( 0 );
  10361. }
  10362. soFar = selector;
  10363. groups = [];
  10364. preFilters = Expr.preFilter;
  10365. while ( soFar ) {
  10366. // Comma and first run
  10367. if ( !matched || (match = rcomma.exec( soFar )) ) {
  10368. if ( match ) {
  10369. // Don't consume trailing commas as valid
  10370. soFar = soFar.slice( match[0].length ) || soFar;
  10371. }
  10372. groups.push( (tokens = []) );
  10373. }
  10374. matched = false;
  10375. // Combinators
  10376. if ( (match = rcombinators.exec( soFar )) ) {
  10377. matched = match.shift();
  10378. tokens.push({
  10379. value: matched,
  10380. // Cast descendant combinators to space
  10381. type: match[0].replace( rtrim, " " )
  10382. });
  10383. soFar = soFar.slice( matched.length );
  10384. }
  10385. // Filters
  10386. for ( type in Expr.filter ) {
  10387. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  10388. (match = preFilters[ type ]( match ))) ) {
  10389. matched = match.shift();
  10390. tokens.push({
  10391. value: matched,
  10392. type: type,
  10393. matches: match
  10394. });
  10395. soFar = soFar.slice( matched.length );
  10396. }
  10397. }
  10398. if ( !matched ) {
  10399. break;
  10400. }
  10401. }
  10402. // Return the length of the invalid excess
  10403. // if we're just parsing
  10404. // Otherwise, throw an error or return tokens
  10405. return parseOnly ?
  10406. soFar.length :
  10407. soFar ?
  10408. Sizzle.error( selector ) :
  10409. // Cache the tokens
  10410. tokenCache( selector, groups ).slice( 0 );
  10411. };
  10412. function toSelector( tokens ) {
  10413. var i = 0,
  10414. len = tokens.length,
  10415. selector = "";
  10416. for ( ; i < len; i++ ) {
  10417. selector += tokens[i].value;
  10418. }
  10419. return selector;
  10420. }
  10421. function addCombinator( matcher, combinator, base ) {
  10422. var dir = combinator.dir,
  10423. skip = combinator.next,
  10424. key = skip || dir,
  10425. checkNonElements = base && key === "parentNode",
  10426. doneName = done++;
  10427. return combinator.first ?
  10428. // Check against closest ancestor/preceding element
  10429. function( elem, context, xml ) {
  10430. while ( (elem = elem[ dir ]) ) {
  10431. if ( elem.nodeType === 1 || checkNonElements ) {
  10432. return matcher( elem, context, xml );
  10433. }
  10434. }
  10435. return false;
  10436. } :
  10437. // Check against all ancestor/preceding elements
  10438. function( elem, context, xml ) {
  10439. var oldCache, uniqueCache, outerCache,
  10440. newCache = [ dirruns, doneName ];
  10441. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  10442. if ( xml ) {
  10443. while ( (elem = elem[ dir ]) ) {
  10444. if ( elem.nodeType === 1 || checkNonElements ) {
  10445. if ( matcher( elem, context, xml ) ) {
  10446. return true;
  10447. }
  10448. }
  10449. }
  10450. } else {
  10451. while ( (elem = elem[ dir ]) ) {
  10452. if ( elem.nodeType === 1 || checkNonElements ) {
  10453. outerCache = elem[ expando ] || (elem[ expando ] = {});
  10454. // Support: IE <9 only
  10455. // Defend against cloned attroperties (jQuery gh-1709)
  10456. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  10457. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  10458. elem = elem[ dir ] || elem;
  10459. } else if ( (oldCache = uniqueCache[ key ]) &&
  10460. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  10461. // Assign to newCache so results back-propagate to previous elements
  10462. return (newCache[ 2 ] = oldCache[ 2 ]);
  10463. } else {
  10464. // Reuse newcache so results back-propagate to previous elements
  10465. uniqueCache[ key ] = newCache;
  10466. // A match means we're done; a fail means we have to keep checking
  10467. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  10468. return true;
  10469. }
  10470. }
  10471. }
  10472. }
  10473. }
  10474. return false;
  10475. };
  10476. }
  10477. function elementMatcher( matchers ) {
  10478. return matchers.length > 1 ?
  10479. function( elem, context, xml ) {
  10480. var i = matchers.length;
  10481. while ( i-- ) {
  10482. if ( !matchers[i]( elem, context, xml ) ) {
  10483. return false;
  10484. }
  10485. }
  10486. return true;
  10487. } :
  10488. matchers[0];
  10489. }
  10490. function multipleContexts( selector, contexts, results ) {
  10491. var i = 0,
  10492. len = contexts.length;
  10493. for ( ; i < len; i++ ) {
  10494. Sizzle( selector, contexts[i], results );
  10495. }
  10496. return results;
  10497. }
  10498. function condense( unmatched, map, filter, context, xml ) {
  10499. var elem,
  10500. newUnmatched = [],
  10501. i = 0,
  10502. len = unmatched.length,
  10503. mapped = map != null;
  10504. for ( ; i < len; i++ ) {
  10505. if ( (elem = unmatched[i]) ) {
  10506. if ( !filter || filter( elem, context, xml ) ) {
  10507. newUnmatched.push( elem );
  10508. if ( mapped ) {
  10509. map.push( i );
  10510. }
  10511. }
  10512. }
  10513. }
  10514. return newUnmatched;
  10515. }
  10516. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  10517. if ( postFilter && !postFilter[ expando ] ) {
  10518. postFilter = setMatcher( postFilter );
  10519. }
  10520. if ( postFinder && !postFinder[ expando ] ) {
  10521. postFinder = setMatcher( postFinder, postSelector );
  10522. }
  10523. return markFunction(function( seed, results, context, xml ) {
  10524. var temp, i, elem,
  10525. preMap = [],
  10526. postMap = [],
  10527. preexisting = results.length,
  10528. // Get initial elements from seed or context
  10529. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  10530. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  10531. matcherIn = preFilter && ( seed || !selector ) ?
  10532. condense( elems, preMap, preFilter, context, xml ) :
  10533. elems,
  10534. matcherOut = matcher ?
  10535. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  10536. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  10537. // ...intermediate processing is necessary
  10538. [] :
  10539. // ...otherwise use results directly
  10540. results :
  10541. matcherIn;
  10542. // Find primary matches
  10543. if ( matcher ) {
  10544. matcher( matcherIn, matcherOut, context, xml );
  10545. }
  10546. // Apply postFilter
  10547. if ( postFilter ) {
  10548. temp = condense( matcherOut, postMap );
  10549. postFilter( temp, [], context, xml );
  10550. // Un-match failing elements by moving them back to matcherIn
  10551. i = temp.length;
  10552. while ( i-- ) {
  10553. if ( (elem = temp[i]) ) {
  10554. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  10555. }
  10556. }
  10557. }
  10558. if ( seed ) {
  10559. if ( postFinder || preFilter ) {
  10560. if ( postFinder ) {
  10561. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  10562. temp = [];
  10563. i = matcherOut.length;
  10564. while ( i-- ) {
  10565. if ( (elem = matcherOut[i]) ) {
  10566. // Restore matcherIn since elem is not yet a final match
  10567. temp.push( (matcherIn[i] = elem) );
  10568. }
  10569. }
  10570. postFinder( null, (matcherOut = []), temp, xml );
  10571. }
  10572. // Move matched elements from seed to results to keep them synchronized
  10573. i = matcherOut.length;
  10574. while ( i-- ) {
  10575. if ( (elem = matcherOut[i]) &&
  10576. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  10577. seed[temp] = !(results[temp] = elem);
  10578. }
  10579. }
  10580. }
  10581. // Add elements to results, through postFinder if defined
  10582. } else {
  10583. matcherOut = condense(
  10584. matcherOut === results ?
  10585. matcherOut.splice( preexisting, matcherOut.length ) :
  10586. matcherOut
  10587. );
  10588. if ( postFinder ) {
  10589. postFinder( null, results, matcherOut, xml );
  10590. } else {
  10591. push.apply( results, matcherOut );
  10592. }
  10593. }
  10594. });
  10595. }
  10596. function matcherFromTokens( tokens ) {
  10597. var checkContext, matcher, j,
  10598. len = tokens.length,
  10599. leadingRelative = Expr.relative[ tokens[0].type ],
  10600. implicitRelative = leadingRelative || Expr.relative[" "],
  10601. i = leadingRelative ? 1 : 0,
  10602. // The foundational matcher ensures that elements are reachable from top-level context(s)
  10603. matchContext = addCombinator( function( elem ) {
  10604. return elem === checkContext;
  10605. }, implicitRelative, true ),
  10606. matchAnyContext = addCombinator( function( elem ) {
  10607. return indexOf( checkContext, elem ) > -1;
  10608. }, implicitRelative, true ),
  10609. matchers = [ function( elem, context, xml ) {
  10610. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  10611. (checkContext = context).nodeType ?
  10612. matchContext( elem, context, xml ) :
  10613. matchAnyContext( elem, context, xml ) );
  10614. // Avoid hanging onto element (issue #299)
  10615. checkContext = null;
  10616. return ret;
  10617. } ];
  10618. for ( ; i < len; i++ ) {
  10619. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  10620. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  10621. } else {
  10622. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  10623. // Return special upon seeing a positional matcher
  10624. if ( matcher[ expando ] ) {
  10625. // Find the next relative operator (if any) for proper handling
  10626. j = ++i;
  10627. for ( ; j < len; j++ ) {
  10628. if ( Expr.relative[ tokens[j].type ] ) {
  10629. break;
  10630. }
  10631. }
  10632. return setMatcher(
  10633. i > 1 && elementMatcher( matchers ),
  10634. i > 1 && toSelector(
  10635. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  10636. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  10637. ).replace( rtrim, "$1" ),
  10638. matcher,
  10639. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  10640. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  10641. j < len && toSelector( tokens )
  10642. );
  10643. }
  10644. matchers.push( matcher );
  10645. }
  10646. }
  10647. return elementMatcher( matchers );
  10648. }
  10649. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  10650. var bySet = setMatchers.length > 0,
  10651. byElement = elementMatchers.length > 0,
  10652. superMatcher = function( seed, context, xml, results, outermost ) {
  10653. var elem, j, matcher,
  10654. matchedCount = 0,
  10655. i = "0",
  10656. unmatched = seed && [],
  10657. setMatched = [],
  10658. contextBackup = outermostContext,
  10659. // We must always have either seed elements or outermost context
  10660. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  10661. // Use integer dirruns iff this is the outermost matcher
  10662. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  10663. len = elems.length;
  10664. if ( outermost ) {
  10665. outermostContext = context === document || context || outermost;
  10666. }
  10667. // Add elements passing elementMatchers directly to results
  10668. // Support: IE<9, Safari
  10669. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  10670. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  10671. if ( byElement && elem ) {
  10672. j = 0;
  10673. if ( !context && elem.ownerDocument !== document ) {
  10674. setDocument( elem );
  10675. xml = !documentIsHTML;
  10676. }
  10677. while ( (matcher = elementMatchers[j++]) ) {
  10678. if ( matcher( elem, context || document, xml) ) {
  10679. results.push( elem );
  10680. break;
  10681. }
  10682. }
  10683. if ( outermost ) {
  10684. dirruns = dirrunsUnique;
  10685. }
  10686. }
  10687. // Track unmatched elements for set filters
  10688. if ( bySet ) {
  10689. // They will have gone through all possible matchers
  10690. if ( (elem = !matcher && elem) ) {
  10691. matchedCount--;
  10692. }
  10693. // Lengthen the array for every element, matched or not
  10694. if ( seed ) {
  10695. unmatched.push( elem );
  10696. }
  10697. }
  10698. }
  10699. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  10700. // makes the latter nonnegative.
  10701. matchedCount += i;
  10702. // Apply set filters to unmatched elements
  10703. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  10704. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  10705. // no element matchers and no seed.
  10706. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  10707. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  10708. // numerically zero.
  10709. if ( bySet && i !== matchedCount ) {
  10710. j = 0;
  10711. while ( (matcher = setMatchers[j++]) ) {
  10712. matcher( unmatched, setMatched, context, xml );
  10713. }
  10714. if ( seed ) {
  10715. // Reintegrate element matches to eliminate the need for sorting
  10716. if ( matchedCount > 0 ) {
  10717. while ( i-- ) {
  10718. if ( !(unmatched[i] || setMatched[i]) ) {
  10719. setMatched[i] = pop.call( results );
  10720. }
  10721. }
  10722. }
  10723. // Discard index placeholder values to get only actual matches
  10724. setMatched = condense( setMatched );
  10725. }
  10726. // Add matches to results
  10727. push.apply( results, setMatched );
  10728. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  10729. if ( outermost && !seed && setMatched.length > 0 &&
  10730. ( matchedCount + setMatchers.length ) > 1 ) {
  10731. Sizzle.uniqueSort( results );
  10732. }
  10733. }
  10734. // Override manipulation of globals by nested matchers
  10735. if ( outermost ) {
  10736. dirruns = dirrunsUnique;
  10737. outermostContext = contextBackup;
  10738. }
  10739. return unmatched;
  10740. };
  10741. return bySet ?
  10742. markFunction( superMatcher ) :
  10743. superMatcher;
  10744. }
  10745. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  10746. var i,
  10747. setMatchers = [],
  10748. elementMatchers = [],
  10749. cached = compilerCache[ selector + " " ];
  10750. if ( !cached ) {
  10751. // Generate a function of recursive functions that can be used to check each element
  10752. if ( !match ) {
  10753. match = tokenize( selector );
  10754. }
  10755. i = match.length;
  10756. while ( i-- ) {
  10757. cached = matcherFromTokens( match[i] );
  10758. if ( cached[ expando ] ) {
  10759. setMatchers.push( cached );
  10760. } else {
  10761. elementMatchers.push( cached );
  10762. }
  10763. }
  10764. // Cache the compiled function
  10765. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  10766. // Save selector and tokenization
  10767. cached.selector = selector;
  10768. }
  10769. return cached;
  10770. };
  10771. /**
  10772. * A low-level selection function that works with Sizzle's compiled
  10773. * selector functions
  10774. * @param {String|Function} selector A selector or a pre-compiled
  10775. * selector function built with Sizzle.compile
  10776. * @param {Element} context
  10777. * @param {Array} [results]
  10778. * @param {Array} [seed] A set of elements to match against
  10779. */
  10780. select = Sizzle.select = function( selector, context, results, seed ) {
  10781. var i, tokens, token, type, find,
  10782. compiled = typeof selector === "function" && selector,
  10783. match = !seed && tokenize( (selector = compiled.selector || selector) );
  10784. results = results || [];
  10785. // Try to minimize operations if there is only one selector in the list and no seed
  10786. // (the latter of which guarantees us context)
  10787. if ( match.length === 1 ) {
  10788. // Reduce context if the leading compound selector is an ID
  10789. tokens = match[0] = match[0].slice( 0 );
  10790. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  10791. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  10792. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  10793. if ( !context ) {
  10794. return results;
  10795. // Precompiled matchers will still verify ancestry, so step up a level
  10796. } else if ( compiled ) {
  10797. context = context.parentNode;
  10798. }
  10799. selector = selector.slice( tokens.shift().value.length );
  10800. }
  10801. // Fetch a seed set for right-to-left matching
  10802. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  10803. while ( i-- ) {
  10804. token = tokens[i];
  10805. // Abort if we hit a combinator
  10806. if ( Expr.relative[ (type = token.type) ] ) {
  10807. break;
  10808. }
  10809. if ( (find = Expr.find[ type ]) ) {
  10810. // Search, expanding context for leading sibling combinators
  10811. if ( (seed = find(
  10812. token.matches[0].replace( runescape, funescape ),
  10813. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  10814. )) ) {
  10815. // If seed is empty or no tokens remain, we can return early
  10816. tokens.splice( i, 1 );
  10817. selector = seed.length && toSelector( tokens );
  10818. if ( !selector ) {
  10819. push.apply( results, seed );
  10820. return results;
  10821. }
  10822. break;
  10823. }
  10824. }
  10825. }
  10826. }
  10827. // Compile and execute a filtering function if one is not provided
  10828. // Provide `match` to avoid retokenization if we modified the selector above
  10829. ( compiled || compile( selector, match ) )(
  10830. seed,
  10831. context,
  10832. !documentIsHTML,
  10833. results,
  10834. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  10835. );
  10836. return results;
  10837. };
  10838. // One-time assignments
  10839. // Sort stability
  10840. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  10841. // Support: Chrome 14-35+
  10842. // Always assume duplicates if they aren't passed to the comparison function
  10843. support.detectDuplicates = !!hasDuplicate;
  10844. // Initialize against the default document
  10845. setDocument();
  10846. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  10847. // Detached nodes confoundingly follow *each other*
  10848. support.sortDetached = assert(function( el ) {
  10849. // Should return 1, but returns 4 (following)
  10850. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  10851. });
  10852. // Support: IE<8
  10853. // Prevent attribute/property "interpolation"
  10854. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  10855. if ( !assert(function( el ) {
  10856. el.innerHTML = "<a href='#'></a>";
  10857. return el.firstChild.getAttribute("href") === "#" ;
  10858. }) ) {
  10859. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  10860. if ( !isXML ) {
  10861. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  10862. }
  10863. });
  10864. }
  10865. // Support: IE<9
  10866. // Use defaultValue in place of getAttribute("value")
  10867. if ( !support.attributes || !assert(function( el ) {
  10868. el.innerHTML = "<input/>";
  10869. el.firstChild.setAttribute( "value", "" );
  10870. return el.firstChild.getAttribute( "value" ) === "";
  10871. }) ) {
  10872. addHandle( "value", function( elem, name, isXML ) {
  10873. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  10874. return elem.defaultValue;
  10875. }
  10876. });
  10877. }
  10878. // Support: IE<9
  10879. // Use getAttributeNode to fetch booleans when getAttribute lies
  10880. if ( !assert(function( el ) {
  10881. return el.getAttribute("disabled") == null;
  10882. }) ) {
  10883. addHandle( booleans, function( elem, name, isXML ) {
  10884. var val;
  10885. if ( !isXML ) {
  10886. return elem[ name ] === true ? name.toLowerCase() :
  10887. (val = elem.getAttributeNode( name )) && val.specified ?
  10888. val.value :
  10889. null;
  10890. }
  10891. });
  10892. }
  10893. return Sizzle;
  10894. })( window );
  10895. jQuery.find = Sizzle;
  10896. jQuery.expr = Sizzle.selectors;
  10897. // Deprecated
  10898. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  10899. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  10900. jQuery.text = Sizzle.getText;
  10901. jQuery.isXMLDoc = Sizzle.isXML;
  10902. jQuery.contains = Sizzle.contains;
  10903. jQuery.escapeSelector = Sizzle.escape;
  10904. var dir = function( elem, dir, until ) {
  10905. var matched = [],
  10906. truncate = until !== undefined;
  10907. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  10908. if ( elem.nodeType === 1 ) {
  10909. if ( truncate && jQuery( elem ).is( until ) ) {
  10910. break;
  10911. }
  10912. matched.push( elem );
  10913. }
  10914. }
  10915. return matched;
  10916. };
  10917. var siblings = function( n, elem ) {
  10918. var matched = [];
  10919. for ( ; n; n = n.nextSibling ) {
  10920. if ( n.nodeType === 1 && n !== elem ) {
  10921. matched.push( n );
  10922. }
  10923. }
  10924. return matched;
  10925. };
  10926. var rneedsContext = jQuery.expr.match.needsContext;
  10927. function nodeName( elem, name ) {
  10928. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  10929. };
  10930. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  10931. // Implement the identical functionality for filter and not
  10932. function winnow( elements, qualifier, not ) {
  10933. if ( isFunction( qualifier ) ) {
  10934. return jQuery.grep( elements, function( elem, i ) {
  10935. return !!qualifier.call( elem, i, elem ) !== not;
  10936. } );
  10937. }
  10938. // Single element
  10939. if ( qualifier.nodeType ) {
  10940. return jQuery.grep( elements, function( elem ) {
  10941. return ( elem === qualifier ) !== not;
  10942. } );
  10943. }
  10944. // Arraylike of elements (jQuery, arguments, Array)
  10945. if ( typeof qualifier !== "string" ) {
  10946. return jQuery.grep( elements, function( elem ) {
  10947. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  10948. } );
  10949. }
  10950. // Filtered directly for both simple and complex selectors
  10951. return jQuery.filter( qualifier, elements, not );
  10952. }
  10953. jQuery.filter = function( expr, elems, not ) {
  10954. var elem = elems[ 0 ];
  10955. if ( not ) {
  10956. expr = ":not(" + expr + ")";
  10957. }
  10958. if ( elems.length === 1 && elem.nodeType === 1 ) {
  10959. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  10960. }
  10961. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  10962. return elem.nodeType === 1;
  10963. } ) );
  10964. };
  10965. jQuery.fn.extend( {
  10966. find: function( selector ) {
  10967. var i, ret,
  10968. len = this.length,
  10969. self = this;
  10970. if ( typeof selector !== "string" ) {
  10971. return this.pushStack( jQuery( selector ).filter( function() {
  10972. for ( i = 0; i < len; i++ ) {
  10973. if ( jQuery.contains( self[ i ], this ) ) {
  10974. return true;
  10975. }
  10976. }
  10977. } ) );
  10978. }
  10979. ret = this.pushStack( [] );
  10980. for ( i = 0; i < len; i++ ) {
  10981. jQuery.find( selector, self[ i ], ret );
  10982. }
  10983. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  10984. },
  10985. filter: function( selector ) {
  10986. return this.pushStack( winnow( this, selector || [], false ) );
  10987. },
  10988. not: function( selector ) {
  10989. return this.pushStack( winnow( this, selector || [], true ) );
  10990. },
  10991. is: function( selector ) {
  10992. return !!winnow(
  10993. this,
  10994. // If this is a positional/relative selector, check membership in the returned set
  10995. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  10996. typeof selector === "string" && rneedsContext.test( selector ) ?
  10997. jQuery( selector ) :
  10998. selector || [],
  10999. false
  11000. ).length;
  11001. }
  11002. } );
  11003. // Initialize a jQuery object
  11004. // A central reference to the root jQuery(document)
  11005. var rootjQuery,
  11006. // A simple way to check for HTML strings
  11007. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  11008. // Strict HTML recognition (#11290: must start with <)
  11009. // Shortcut simple #id case for speed
  11010. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  11011. init = jQuery.fn.init = function( selector, context, root ) {
  11012. var match, elem;
  11013. // HANDLE: $(""), $(null), $(undefined), $(false)
  11014. if ( !selector ) {
  11015. return this;
  11016. }
  11017. // Method init() accepts an alternate rootjQuery
  11018. // so migrate can support jQuery.sub (gh-2101)
  11019. root = root || rootjQuery;
  11020. // Handle HTML strings
  11021. if ( typeof selector === "string" ) {
  11022. if ( selector[ 0 ] === "<" &&
  11023. selector[ selector.length - 1 ] === ">" &&
  11024. selector.length >= 3 ) {
  11025. // Assume that strings that start and end with <> are HTML and skip the regex check
  11026. match = [ null, selector, null ];
  11027. } else {
  11028. match = rquickExpr.exec( selector );
  11029. }
  11030. // Match html or make sure no context is specified for #id
  11031. if ( match && ( match[ 1 ] || !context ) ) {
  11032. // HANDLE: $(html) -> $(array)
  11033. if ( match[ 1 ] ) {
  11034. context = context instanceof jQuery ? context[ 0 ] : context;
  11035. // Option to run scripts is true for back-compat
  11036. // Intentionally let the error be thrown if parseHTML is not present
  11037. jQuery.merge( this, jQuery.parseHTML(
  11038. match[ 1 ],
  11039. context && context.nodeType ? context.ownerDocument || context : document,
  11040. true
  11041. ) );
  11042. // HANDLE: $(html, props)
  11043. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  11044. for ( match in context ) {
  11045. // Properties of context are called as methods if possible
  11046. if ( isFunction( this[ match ] ) ) {
  11047. this[ match ]( context[ match ] );
  11048. // ...and otherwise set as attributes
  11049. } else {
  11050. this.attr( match, context[ match ] );
  11051. }
  11052. }
  11053. }
  11054. return this;
  11055. // HANDLE: $(#id)
  11056. } else {
  11057. elem = document.getElementById( match[ 2 ] );
  11058. if ( elem ) {
  11059. // Inject the element directly into the jQuery object
  11060. this[ 0 ] = elem;
  11061. this.length = 1;
  11062. }
  11063. return this;
  11064. }
  11065. // HANDLE: $(expr, $(...))
  11066. } else if ( !context || context.jquery ) {
  11067. return ( context || root ).find( selector );
  11068. // HANDLE: $(expr, context)
  11069. // (which is just equivalent to: $(context).find(expr)
  11070. } else {
  11071. return this.constructor( context ).find( selector );
  11072. }
  11073. // HANDLE: $(DOMElement)
  11074. } else if ( selector.nodeType ) {
  11075. this[ 0 ] = selector;
  11076. this.length = 1;
  11077. return this;
  11078. // HANDLE: $(function)
  11079. // Shortcut for document ready
  11080. } else if ( isFunction( selector ) ) {
  11081. return root.ready !== undefined ?
  11082. root.ready( selector ) :
  11083. // Execute immediately if ready is not present
  11084. selector( jQuery );
  11085. }
  11086. return jQuery.makeArray( selector, this );
  11087. };
  11088. // Give the init function the jQuery prototype for later instantiation
  11089. init.prototype = jQuery.fn;
  11090. // Initialize central reference
  11091. rootjQuery = jQuery( document );
  11092. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  11093. // Methods guaranteed to produce a unique set when starting from a unique set
  11094. guaranteedUnique = {
  11095. children: true,
  11096. contents: true,
  11097. next: true,
  11098. prev: true
  11099. };
  11100. jQuery.fn.extend( {
  11101. has: function( target ) {
  11102. var targets = jQuery( target, this ),
  11103. l = targets.length;
  11104. return this.filter( function() {
  11105. var i = 0;
  11106. for ( ; i < l; i++ ) {
  11107. if ( jQuery.contains( this, targets[ i ] ) ) {
  11108. return true;
  11109. }
  11110. }
  11111. } );
  11112. },
  11113. closest: function( selectors, context ) {
  11114. var cur,
  11115. i = 0,
  11116. l = this.length,
  11117. matched = [],
  11118. targets = typeof selectors !== "string" && jQuery( selectors );
  11119. // Positional selectors never match, since there's no _selection_ context
  11120. if ( !rneedsContext.test( selectors ) ) {
  11121. for ( ; i < l; i++ ) {
  11122. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  11123. // Always skip document fragments
  11124. if ( cur.nodeType < 11 && ( targets ?
  11125. targets.index( cur ) > -1 :
  11126. // Don't pass non-elements to Sizzle
  11127. cur.nodeType === 1 &&
  11128. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  11129. matched.push( cur );
  11130. break;
  11131. }
  11132. }
  11133. }
  11134. }
  11135. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  11136. },
  11137. // Determine the position of an element within the set
  11138. index: function( elem ) {
  11139. // No argument, return index in parent
  11140. if ( !elem ) {
  11141. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  11142. }
  11143. // Index in selector
  11144. if ( typeof elem === "string" ) {
  11145. return indexOf.call( jQuery( elem ), this[ 0 ] );
  11146. }
  11147. // Locate the position of the desired element
  11148. return indexOf.call( this,
  11149. // If it receives a jQuery object, the first element is used
  11150. elem.jquery ? elem[ 0 ] : elem
  11151. );
  11152. },
  11153. add: function( selector, context ) {
  11154. return this.pushStack(
  11155. jQuery.uniqueSort(
  11156. jQuery.merge( this.get(), jQuery( selector, context ) )
  11157. )
  11158. );
  11159. },
  11160. addBack: function( selector ) {
  11161. return this.add( selector == null ?
  11162. this.prevObject : this.prevObject.filter( selector )
  11163. );
  11164. }
  11165. } );
  11166. function sibling( cur, dir ) {
  11167. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  11168. return cur;
  11169. }
  11170. jQuery.each( {
  11171. parent: function( elem ) {
  11172. var parent = elem.parentNode;
  11173. return parent && parent.nodeType !== 11 ? parent : null;
  11174. },
  11175. parents: function( elem ) {
  11176. return dir( elem, "parentNode" );
  11177. },
  11178. parentsUntil: function( elem, i, until ) {
  11179. return dir( elem, "parentNode", until );
  11180. },
  11181. next: function( elem ) {
  11182. return sibling( elem, "nextSibling" );
  11183. },
  11184. prev: function( elem ) {
  11185. return sibling( elem, "previousSibling" );
  11186. },
  11187. nextAll: function( elem ) {
  11188. return dir( elem, "nextSibling" );
  11189. },
  11190. prevAll: function( elem ) {
  11191. return dir( elem, "previousSibling" );
  11192. },
  11193. nextUntil: function( elem, i, until ) {
  11194. return dir( elem, "nextSibling", until );
  11195. },
  11196. prevUntil: function( elem, i, until ) {
  11197. return dir( elem, "previousSibling", until );
  11198. },
  11199. siblings: function( elem ) {
  11200. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  11201. },
  11202. children: function( elem ) {
  11203. return siblings( elem.firstChild );
  11204. },
  11205. contents: function( elem ) {
  11206. if ( typeof elem.contentDocument !== "undefined" ) {
  11207. return elem.contentDocument;
  11208. }
  11209. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  11210. // Treat the template element as a regular one in browsers that
  11211. // don't support it.
  11212. if ( nodeName( elem, "template" ) ) {
  11213. elem = elem.content || elem;
  11214. }
  11215. return jQuery.merge( [], elem.childNodes );
  11216. }
  11217. }, function( name, fn ) {
  11218. jQuery.fn[ name ] = function( until, selector ) {
  11219. var matched = jQuery.map( this, fn, until );
  11220. if ( name.slice( -5 ) !== "Until" ) {
  11221. selector = until;
  11222. }
  11223. if ( selector && typeof selector === "string" ) {
  11224. matched = jQuery.filter( selector, matched );
  11225. }
  11226. if ( this.length > 1 ) {
  11227. // Remove duplicates
  11228. if ( !guaranteedUnique[ name ] ) {
  11229. jQuery.uniqueSort( matched );
  11230. }
  11231. // Reverse order for parents* and prev-derivatives
  11232. if ( rparentsprev.test( name ) ) {
  11233. matched.reverse();
  11234. }
  11235. }
  11236. return this.pushStack( matched );
  11237. };
  11238. } );
  11239. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  11240. // Convert String-formatted options into Object-formatted ones
  11241. function createOptions( options ) {
  11242. var object = {};
  11243. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  11244. object[ flag ] = true;
  11245. } );
  11246. return object;
  11247. }
  11248. /*
  11249. * Create a callback list using the following parameters:
  11250. *
  11251. * options: an optional list of space-separated options that will change how
  11252. * the callback list behaves or a more traditional option object
  11253. *
  11254. * By default a callback list will act like an event callback list and can be
  11255. * "fired" multiple times.
  11256. *
  11257. * Possible options:
  11258. *
  11259. * once: will ensure the callback list can only be fired once (like a Deferred)
  11260. *
  11261. * memory: will keep track of previous values and will call any callback added
  11262. * after the list has been fired right away with the latest "memorized"
  11263. * values (like a Deferred)
  11264. *
  11265. * unique: will ensure a callback can only be added once (no duplicate in the list)
  11266. *
  11267. * stopOnFalse: interrupt callings when a callback returns false
  11268. *
  11269. */
  11270. jQuery.Callbacks = function( options ) {
  11271. // Convert options from String-formatted to Object-formatted if needed
  11272. // (we check in cache first)
  11273. options = typeof options === "string" ?
  11274. createOptions( options ) :
  11275. jQuery.extend( {}, options );
  11276. var // Flag to know if list is currently firing
  11277. firing,
  11278. // Last fire value for non-forgettable lists
  11279. memory,
  11280. // Flag to know if list was already fired
  11281. fired,
  11282. // Flag to prevent firing
  11283. locked,
  11284. // Actual callback list
  11285. list = [],
  11286. // Queue of execution data for repeatable lists
  11287. queue = [],
  11288. // Index of currently firing callback (modified by add/remove as needed)
  11289. firingIndex = -1,
  11290. // Fire callbacks
  11291. fire = function() {
  11292. // Enforce single-firing
  11293. locked = locked || options.once;
  11294. // Execute callbacks for all pending executions,
  11295. // respecting firingIndex overrides and runtime changes
  11296. fired = firing = true;
  11297. for ( ; queue.length; firingIndex = -1 ) {
  11298. memory = queue.shift();
  11299. while ( ++firingIndex < list.length ) {
  11300. // Run callback and check for early termination
  11301. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  11302. options.stopOnFalse ) {
  11303. // Jump to end and forget the data so .add doesn't re-fire
  11304. firingIndex = list.length;
  11305. memory = false;
  11306. }
  11307. }
  11308. }
  11309. // Forget the data if we're done with it
  11310. if ( !options.memory ) {
  11311. memory = false;
  11312. }
  11313. firing = false;
  11314. // Clean up if we're done firing for good
  11315. if ( locked ) {
  11316. // Keep an empty list if we have data for future add calls
  11317. if ( memory ) {
  11318. list = [];
  11319. // Otherwise, this object is spent
  11320. } else {
  11321. list = "";
  11322. }
  11323. }
  11324. },
  11325. // Actual Callbacks object
  11326. self = {
  11327. // Add a callback or a collection of callbacks to the list
  11328. add: function() {
  11329. if ( list ) {
  11330. // If we have memory from a past run, we should fire after adding
  11331. if ( memory && !firing ) {
  11332. firingIndex = list.length - 1;
  11333. queue.push( memory );
  11334. }
  11335. ( function add( args ) {
  11336. jQuery.each( args, function( _, arg ) {
  11337. if ( isFunction( arg ) ) {
  11338. if ( !options.unique || !self.has( arg ) ) {
  11339. list.push( arg );
  11340. }
  11341. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  11342. // Inspect recursively
  11343. add( arg );
  11344. }
  11345. } );
  11346. } )( arguments );
  11347. if ( memory && !firing ) {
  11348. fire();
  11349. }
  11350. }
  11351. return this;
  11352. },
  11353. // Remove a callback from the list
  11354. remove: function() {
  11355. jQuery.each( arguments, function( _, arg ) {
  11356. var index;
  11357. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  11358. list.splice( index, 1 );
  11359. // Handle firing indexes
  11360. if ( index <= firingIndex ) {
  11361. firingIndex--;
  11362. }
  11363. }
  11364. } );
  11365. return this;
  11366. },
  11367. // Check if a given callback is in the list.
  11368. // If no argument is given, return whether or not list has callbacks attached.
  11369. has: function( fn ) {
  11370. return fn ?
  11371. jQuery.inArray( fn, list ) > -1 :
  11372. list.length > 0;
  11373. },
  11374. // Remove all callbacks from the list
  11375. empty: function() {
  11376. if ( list ) {
  11377. list = [];
  11378. }
  11379. return this;
  11380. },
  11381. // Disable .fire and .add
  11382. // Abort any current/pending executions
  11383. // Clear all callbacks and values
  11384. disable: function() {
  11385. locked = queue = [];
  11386. list = memory = "";
  11387. return this;
  11388. },
  11389. disabled: function() {
  11390. return !list;
  11391. },
  11392. // Disable .fire
  11393. // Also disable .add unless we have memory (since it would have no effect)
  11394. // Abort any pending executions
  11395. lock: function() {
  11396. locked = queue = [];
  11397. if ( !memory && !firing ) {
  11398. list = memory = "";
  11399. }
  11400. return this;
  11401. },
  11402. locked: function() {
  11403. return !!locked;
  11404. },
  11405. // Call all callbacks with the given context and arguments
  11406. fireWith: function( context, args ) {
  11407. if ( !locked ) {
  11408. args = args || [];
  11409. args = [ context, args.slice ? args.slice() : args ];
  11410. queue.push( args );
  11411. if ( !firing ) {
  11412. fire();
  11413. }
  11414. }
  11415. return this;
  11416. },
  11417. // Call all the callbacks with the given arguments
  11418. fire: function() {
  11419. self.fireWith( this, arguments );
  11420. return this;
  11421. },
  11422. // To know if the callbacks have already been called at least once
  11423. fired: function() {
  11424. return !!fired;
  11425. }
  11426. };
  11427. return self;
  11428. };
  11429. function Identity( v ) {
  11430. return v;
  11431. }
  11432. function Thrower( ex ) {
  11433. throw ex;
  11434. }
  11435. function adoptValue( value, resolve, reject, noValue ) {
  11436. var method;
  11437. try {
  11438. // Check for promise aspect first to privilege synchronous behavior
  11439. if ( value && isFunction( ( method = value.promise ) ) ) {
  11440. method.call( value ).done( resolve ).fail( reject );
  11441. // Other thenables
  11442. } else if ( value && isFunction( ( method = value.then ) ) ) {
  11443. method.call( value, resolve, reject );
  11444. // Other non-thenables
  11445. } else {
  11446. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  11447. // * false: [ value ].slice( 0 ) => resolve( value )
  11448. // * true: [ value ].slice( 1 ) => resolve()
  11449. resolve.apply( undefined, [ value ].slice( noValue ) );
  11450. }
  11451. // For Promises/A+, convert exceptions into rejections
  11452. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  11453. // Deferred#then to conditionally suppress rejection.
  11454. } catch ( value ) {
  11455. // Support: Android 4.0 only
  11456. // Strict mode functions invoked without .call/.apply get global-object context
  11457. reject.apply( undefined, [ value ] );
  11458. }
  11459. }
  11460. jQuery.extend( {
  11461. Deferred: function( func ) {
  11462. var tuples = [
  11463. // action, add listener, callbacks,
  11464. // ... .then handlers, argument index, [final state]
  11465. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  11466. jQuery.Callbacks( "memory" ), 2 ],
  11467. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  11468. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  11469. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  11470. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  11471. ],
  11472. state = "pending",
  11473. promise = {
  11474. state: function() {
  11475. return state;
  11476. },
  11477. always: function() {
  11478. deferred.done( arguments ).fail( arguments );
  11479. return this;
  11480. },
  11481. "catch": function( fn ) {
  11482. return promise.then( null, fn );
  11483. },
  11484. // Keep pipe for back-compat
  11485. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  11486. var fns = arguments;
  11487. return jQuery.Deferred( function( newDefer ) {
  11488. jQuery.each( tuples, function( i, tuple ) {
  11489. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  11490. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  11491. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  11492. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  11493. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  11494. deferred[ tuple[ 1 ] ]( function() {
  11495. var returned = fn && fn.apply( this, arguments );
  11496. if ( returned && isFunction( returned.promise ) ) {
  11497. returned.promise()
  11498. .progress( newDefer.notify )
  11499. .done( newDefer.resolve )
  11500. .fail( newDefer.reject );
  11501. } else {
  11502. newDefer[ tuple[ 0 ] + "With" ](
  11503. this,
  11504. fn ? [ returned ] : arguments
  11505. );
  11506. }
  11507. } );
  11508. } );
  11509. fns = null;
  11510. } ).promise();
  11511. },
  11512. then: function( onFulfilled, onRejected, onProgress ) {
  11513. var maxDepth = 0;
  11514. function resolve( depth, deferred, handler, special ) {
  11515. return function() {
  11516. var that = this,
  11517. args = arguments,
  11518. mightThrow = function() {
  11519. var returned, then;
  11520. // Support: Promises/A+ section 2.3.3.3.3
  11521. // https://promisesaplus.com/#point-59
  11522. // Ignore double-resolution attempts
  11523. if ( depth < maxDepth ) {
  11524. return;
  11525. }
  11526. returned = handler.apply( that, args );
  11527. // Support: Promises/A+ section 2.3.1
  11528. // https://promisesaplus.com/#point-48
  11529. if ( returned === deferred.promise() ) {
  11530. throw new TypeError( "Thenable self-resolution" );
  11531. }
  11532. // Support: Promises/A+ sections 2.3.3.1, 3.5
  11533. // https://promisesaplus.com/#point-54
  11534. // https://promisesaplus.com/#point-75
  11535. // Retrieve `then` only once
  11536. then = returned &&
  11537. // Support: Promises/A+ section 2.3.4
  11538. // https://promisesaplus.com/#point-64
  11539. // Only check objects and functions for thenability
  11540. ( typeof returned === "object" ||
  11541. typeof returned === "function" ) &&
  11542. returned.then;
  11543. // Handle a returned thenable
  11544. if ( isFunction( then ) ) {
  11545. // Special processors (notify) just wait for resolution
  11546. if ( special ) {
  11547. then.call(
  11548. returned,
  11549. resolve( maxDepth, deferred, Identity, special ),
  11550. resolve( maxDepth, deferred, Thrower, special )
  11551. );
  11552. // Normal processors (resolve) also hook into progress
  11553. } else {
  11554. // ...and disregard older resolution values
  11555. maxDepth++;
  11556. then.call(
  11557. returned,
  11558. resolve( maxDepth, deferred, Identity, special ),
  11559. resolve( maxDepth, deferred, Thrower, special ),
  11560. resolve( maxDepth, deferred, Identity,
  11561. deferred.notifyWith )
  11562. );
  11563. }
  11564. // Handle all other returned values
  11565. } else {
  11566. // Only substitute handlers pass on context
  11567. // and multiple values (non-spec behavior)
  11568. if ( handler !== Identity ) {
  11569. that = undefined;
  11570. args = [ returned ];
  11571. }
  11572. // Process the value(s)
  11573. // Default process is resolve
  11574. ( special || deferred.resolveWith )( that, args );
  11575. }
  11576. },
  11577. // Only normal processors (resolve) catch and reject exceptions
  11578. process = special ?
  11579. mightThrow :
  11580. function() {
  11581. try {
  11582. mightThrow();
  11583. } catch ( e ) {
  11584. if ( jQuery.Deferred.exceptionHook ) {
  11585. jQuery.Deferred.exceptionHook( e,
  11586. process.stackTrace );
  11587. }
  11588. // Support: Promises/A+ section 2.3.3.3.4.1
  11589. // https://promisesaplus.com/#point-61
  11590. // Ignore post-resolution exceptions
  11591. if ( depth + 1 >= maxDepth ) {
  11592. // Only substitute handlers pass on context
  11593. // and multiple values (non-spec behavior)
  11594. if ( handler !== Thrower ) {
  11595. that = undefined;
  11596. args = [ e ];
  11597. }
  11598. deferred.rejectWith( that, args );
  11599. }
  11600. }
  11601. };
  11602. // Support: Promises/A+ section 2.3.3.3.1
  11603. // https://promisesaplus.com/#point-57
  11604. // Re-resolve promises immediately to dodge false rejection from
  11605. // subsequent errors
  11606. if ( depth ) {
  11607. process();
  11608. } else {
  11609. // Call an optional hook to record the stack, in case of exception
  11610. // since it's otherwise lost when execution goes async
  11611. if ( jQuery.Deferred.getStackHook ) {
  11612. process.stackTrace = jQuery.Deferred.getStackHook();
  11613. }
  11614. window.setTimeout( process );
  11615. }
  11616. };
  11617. }
  11618. return jQuery.Deferred( function( newDefer ) {
  11619. // progress_handlers.add( ... )
  11620. tuples[ 0 ][ 3 ].add(
  11621. resolve(
  11622. 0,
  11623. newDefer,
  11624. isFunction( onProgress ) ?
  11625. onProgress :
  11626. Identity,
  11627. newDefer.notifyWith
  11628. )
  11629. );
  11630. // fulfilled_handlers.add( ... )
  11631. tuples[ 1 ][ 3 ].add(
  11632. resolve(
  11633. 0,
  11634. newDefer,
  11635. isFunction( onFulfilled ) ?
  11636. onFulfilled :
  11637. Identity
  11638. )
  11639. );
  11640. // rejected_handlers.add( ... )
  11641. tuples[ 2 ][ 3 ].add(
  11642. resolve(
  11643. 0,
  11644. newDefer,
  11645. isFunction( onRejected ) ?
  11646. onRejected :
  11647. Thrower
  11648. )
  11649. );
  11650. } ).promise();
  11651. },
  11652. // Get a promise for this deferred
  11653. // If obj is provided, the promise aspect is added to the object
  11654. promise: function( obj ) {
  11655. return obj != null ? jQuery.extend( obj, promise ) : promise;
  11656. }
  11657. },
  11658. deferred = {};
  11659. // Add list-specific methods
  11660. jQuery.each( tuples, function( i, tuple ) {
  11661. var list = tuple[ 2 ],
  11662. stateString = tuple[ 5 ];
  11663. // promise.progress = list.add
  11664. // promise.done = list.add
  11665. // promise.fail = list.add
  11666. promise[ tuple[ 1 ] ] = list.add;
  11667. // Handle state
  11668. if ( stateString ) {
  11669. list.add(
  11670. function() {
  11671. // state = "resolved" (i.e., fulfilled)
  11672. // state = "rejected"
  11673. state = stateString;
  11674. },
  11675. // rejected_callbacks.disable
  11676. // fulfilled_callbacks.disable
  11677. tuples[ 3 - i ][ 2 ].disable,
  11678. // rejected_handlers.disable
  11679. // fulfilled_handlers.disable
  11680. tuples[ 3 - i ][ 3 ].disable,
  11681. // progress_callbacks.lock
  11682. tuples[ 0 ][ 2 ].lock,
  11683. // progress_handlers.lock
  11684. tuples[ 0 ][ 3 ].lock
  11685. );
  11686. }
  11687. // progress_handlers.fire
  11688. // fulfilled_handlers.fire
  11689. // rejected_handlers.fire
  11690. list.add( tuple[ 3 ].fire );
  11691. // deferred.notify = function() { deferred.notifyWith(...) }
  11692. // deferred.resolve = function() { deferred.resolveWith(...) }
  11693. // deferred.reject = function() { deferred.rejectWith(...) }
  11694. deferred[ tuple[ 0 ] ] = function() {
  11695. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  11696. return this;
  11697. };
  11698. // deferred.notifyWith = list.fireWith
  11699. // deferred.resolveWith = list.fireWith
  11700. // deferred.rejectWith = list.fireWith
  11701. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  11702. } );
  11703. // Make the deferred a promise
  11704. promise.promise( deferred );
  11705. // Call given func if any
  11706. if ( func ) {
  11707. func.call( deferred, deferred );
  11708. }
  11709. // All done!
  11710. return deferred;
  11711. },
  11712. // Deferred helper
  11713. when: function( singleValue ) {
  11714. var
  11715. // count of uncompleted subordinates
  11716. remaining = arguments.length,
  11717. // count of unprocessed arguments
  11718. i = remaining,
  11719. // subordinate fulfillment data
  11720. resolveContexts = Array( i ),
  11721. resolveValues = slice.call( arguments ),
  11722. // the master Deferred
  11723. master = jQuery.Deferred(),
  11724. // subordinate callback factory
  11725. updateFunc = function( i ) {
  11726. return function( value ) {
  11727. resolveContexts[ i ] = this;
  11728. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  11729. if ( !( --remaining ) ) {
  11730. master.resolveWith( resolveContexts, resolveValues );
  11731. }
  11732. };
  11733. };
  11734. // Single- and empty arguments are adopted like Promise.resolve
  11735. if ( remaining <= 1 ) {
  11736. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  11737. !remaining );
  11738. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  11739. if ( master.state() === "pending" ||
  11740. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  11741. return master.then();
  11742. }
  11743. }
  11744. // Multiple arguments are aggregated like Promise.all array elements
  11745. while ( i-- ) {
  11746. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  11747. }
  11748. return master.promise();
  11749. }
  11750. } );
  11751. // These usually indicate a programmer mistake during development,
  11752. // warn about them ASAP rather than swallowing them by default.
  11753. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  11754. jQuery.Deferred.exceptionHook = function( error, stack ) {
  11755. // Support: IE 8 - 9 only
  11756. // Console exists when dev tools are open, which can happen at any time
  11757. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  11758. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  11759. }
  11760. };
  11761. jQuery.readyException = function( error ) {
  11762. window.setTimeout( function() {
  11763. throw error;
  11764. } );
  11765. };
  11766. // The deferred used on DOM ready
  11767. var readyList = jQuery.Deferred();
  11768. jQuery.fn.ready = function( fn ) {
  11769. readyList
  11770. .then( fn )
  11771. // Wrap jQuery.readyException in a function so that the lookup
  11772. // happens at the time of error handling instead of callback
  11773. // registration.
  11774. .catch( function( error ) {
  11775. jQuery.readyException( error );
  11776. } );
  11777. return this;
  11778. };
  11779. jQuery.extend( {
  11780. // Is the DOM ready to be used? Set to true once it occurs.
  11781. isReady: false,
  11782. // A counter to track how many items to wait for before
  11783. // the ready event fires. See #6781
  11784. readyWait: 1,
  11785. // Handle when the DOM is ready
  11786. ready: function( wait ) {
  11787. // Abort if there are pending holds or we're already ready
  11788. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  11789. return;
  11790. }
  11791. // Remember that the DOM is ready
  11792. jQuery.isReady = true;
  11793. // If a normal DOM Ready event fired, decrement, and wait if need be
  11794. if ( wait !== true && --jQuery.readyWait > 0 ) {
  11795. return;
  11796. }
  11797. // If there are functions bound, to execute
  11798. readyList.resolveWith( document, [ jQuery ] );
  11799. }
  11800. } );
  11801. jQuery.ready.then = readyList.then;
  11802. // The ready event handler and self cleanup method
  11803. function completed() {
  11804. document.removeEventListener( "DOMContentLoaded", completed );
  11805. window.removeEventListener( "load", completed );
  11806. jQuery.ready();
  11807. }
  11808. // Catch cases where $(document).ready() is called
  11809. // after the browser event has already occurred.
  11810. // Support: IE <=9 - 10 only
  11811. // Older IE sometimes signals "interactive" too soon
  11812. if ( document.readyState === "complete" ||
  11813. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  11814. // Handle it asynchronously to allow scripts the opportunity to delay ready
  11815. window.setTimeout( jQuery.ready );
  11816. } else {
  11817. // Use the handy event callback
  11818. document.addEventListener( "DOMContentLoaded", completed );
  11819. // A fallback to window.onload, that will always work
  11820. window.addEventListener( "load", completed );
  11821. }
  11822. // Multifunctional method to get and set values of a collection
  11823. // The value/s can optionally be executed if it's a function
  11824. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  11825. var i = 0,
  11826. len = elems.length,
  11827. bulk = key == null;
  11828. // Sets many values
  11829. if ( toType( key ) === "object" ) {
  11830. chainable = true;
  11831. for ( i in key ) {
  11832. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  11833. }
  11834. // Sets one value
  11835. } else if ( value !== undefined ) {
  11836. chainable = true;
  11837. if ( !isFunction( value ) ) {
  11838. raw = true;
  11839. }
  11840. if ( bulk ) {
  11841. // Bulk operations run against the entire set
  11842. if ( raw ) {
  11843. fn.call( elems, value );
  11844. fn = null;
  11845. // ...except when executing function values
  11846. } else {
  11847. bulk = fn;
  11848. fn = function( elem, key, value ) {
  11849. return bulk.call( jQuery( elem ), value );
  11850. };
  11851. }
  11852. }
  11853. if ( fn ) {
  11854. for ( ; i < len; i++ ) {
  11855. fn(
  11856. elems[ i ], key, raw ?
  11857. value :
  11858. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  11859. );
  11860. }
  11861. }
  11862. }
  11863. if ( chainable ) {
  11864. return elems;
  11865. }
  11866. // Gets
  11867. if ( bulk ) {
  11868. return fn.call( elems );
  11869. }
  11870. return len ? fn( elems[ 0 ], key ) : emptyGet;
  11871. };
  11872. // Matches dashed string for camelizing
  11873. var rmsPrefix = /^-ms-/,
  11874. rdashAlpha = /-([a-z])/g;
  11875. // Used by camelCase as callback to replace()
  11876. function fcamelCase( all, letter ) {
  11877. return letter.toUpperCase();
  11878. }
  11879. // Convert dashed to camelCase; used by the css and data modules
  11880. // Support: IE <=9 - 11, Edge 12 - 15
  11881. // Microsoft forgot to hump their vendor prefix (#9572)
  11882. function camelCase( string ) {
  11883. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  11884. }
  11885. var acceptData = function( owner ) {
  11886. // Accepts only:
  11887. // - Node
  11888. // - Node.ELEMENT_NODE
  11889. // - Node.DOCUMENT_NODE
  11890. // - Object
  11891. // - Any
  11892. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  11893. };
  11894. function Data() {
  11895. this.expando = jQuery.expando + Data.uid++;
  11896. }
  11897. Data.uid = 1;
  11898. Data.prototype = {
  11899. cache: function( owner ) {
  11900. // Check if the owner object already has a cache
  11901. var value = owner[ this.expando ];
  11902. // If not, create one
  11903. if ( !value ) {
  11904. value = {};
  11905. // We can accept data for non-element nodes in modern browsers,
  11906. // but we should not, see #8335.
  11907. // Always return an empty object.
  11908. if ( acceptData( owner ) ) {
  11909. // If it is a node unlikely to be stringify-ed or looped over
  11910. // use plain assignment
  11911. if ( owner.nodeType ) {
  11912. owner[ this.expando ] = value;
  11913. // Otherwise secure it in a non-enumerable property
  11914. // configurable must be true to allow the property to be
  11915. // deleted when data is removed
  11916. } else {
  11917. Object.defineProperty( owner, this.expando, {
  11918. value: value,
  11919. configurable: true
  11920. } );
  11921. }
  11922. }
  11923. }
  11924. return value;
  11925. },
  11926. set: function( owner, data, value ) {
  11927. var prop,
  11928. cache = this.cache( owner );
  11929. // Handle: [ owner, key, value ] args
  11930. // Always use camelCase key (gh-2257)
  11931. if ( typeof data === "string" ) {
  11932. cache[ camelCase( data ) ] = value;
  11933. // Handle: [ owner, { properties } ] args
  11934. } else {
  11935. // Copy the properties one-by-one to the cache object
  11936. for ( prop in data ) {
  11937. cache[ camelCase( prop ) ] = data[ prop ];
  11938. }
  11939. }
  11940. return cache;
  11941. },
  11942. get: function( owner, key ) {
  11943. return key === undefined ?
  11944. this.cache( owner ) :
  11945. // Always use camelCase key (gh-2257)
  11946. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  11947. },
  11948. access: function( owner, key, value ) {
  11949. // In cases where either:
  11950. //
  11951. // 1. No key was specified
  11952. // 2. A string key was specified, but no value provided
  11953. //
  11954. // Take the "read" path and allow the get method to determine
  11955. // which value to return, respectively either:
  11956. //
  11957. // 1. The entire cache object
  11958. // 2. The data stored at the key
  11959. //
  11960. if ( key === undefined ||
  11961. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  11962. return this.get( owner, key );
  11963. }
  11964. // When the key is not a string, or both a key and value
  11965. // are specified, set or extend (existing objects) with either:
  11966. //
  11967. // 1. An object of properties
  11968. // 2. A key and value
  11969. //
  11970. this.set( owner, key, value );
  11971. // Since the "set" path can have two possible entry points
  11972. // return the expected data based on which path was taken[*]
  11973. return value !== undefined ? value : key;
  11974. },
  11975. remove: function( owner, key ) {
  11976. var i,
  11977. cache = owner[ this.expando ];
  11978. if ( cache === undefined ) {
  11979. return;
  11980. }
  11981. if ( key !== undefined ) {
  11982. // Support array or space separated string of keys
  11983. if ( Array.isArray( key ) ) {
  11984. // If key is an array of keys...
  11985. // We always set camelCase keys, so remove that.
  11986. key = key.map( camelCase );
  11987. } else {
  11988. key = camelCase( key );
  11989. // If a key with the spaces exists, use it.
  11990. // Otherwise, create an array by matching non-whitespace
  11991. key = key in cache ?
  11992. [ key ] :
  11993. ( key.match( rnothtmlwhite ) || [] );
  11994. }
  11995. i = key.length;
  11996. while ( i-- ) {
  11997. delete cache[ key[ i ] ];
  11998. }
  11999. }
  12000. // Remove the expando if there's no more data
  12001. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  12002. // Support: Chrome <=35 - 45
  12003. // Webkit & Blink performance suffers when deleting properties
  12004. // from DOM nodes, so set to undefined instead
  12005. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  12006. if ( owner.nodeType ) {
  12007. owner[ this.expando ] = undefined;
  12008. } else {
  12009. delete owner[ this.expando ];
  12010. }
  12011. }
  12012. },
  12013. hasData: function( owner ) {
  12014. var cache = owner[ this.expando ];
  12015. return cache !== undefined && !jQuery.isEmptyObject( cache );
  12016. }
  12017. };
  12018. var dataPriv = new Data();
  12019. var dataUser = new Data();
  12020. // Implementation Summary
  12021. //
  12022. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  12023. // 2. Improve the module's maintainability by reducing the storage
  12024. // paths to a single mechanism.
  12025. // 3. Use the same single mechanism to support "private" and "user" data.
  12026. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  12027. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  12028. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  12029. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  12030. rmultiDash = /[A-Z]/g;
  12031. function getData( data ) {
  12032. if ( data === "true" ) {
  12033. return true;
  12034. }
  12035. if ( data === "false" ) {
  12036. return false;
  12037. }
  12038. if ( data === "null" ) {
  12039. return null;
  12040. }
  12041. // Only convert to a number if it doesn't change the string
  12042. if ( data === +data + "" ) {
  12043. return +data;
  12044. }
  12045. if ( rbrace.test( data ) ) {
  12046. return JSON.parse( data );
  12047. }
  12048. return data;
  12049. }
  12050. function dataAttr( elem, key, data ) {
  12051. var name;
  12052. // If nothing was found internally, try to fetch any
  12053. // data from the HTML5 data-* attribute
  12054. if ( data === undefined && elem.nodeType === 1 ) {
  12055. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  12056. data = elem.getAttribute( name );
  12057. if ( typeof data === "string" ) {
  12058. try {
  12059. data = getData( data );
  12060. } catch ( e ) {}
  12061. // Make sure we set the data so it isn't changed later
  12062. dataUser.set( elem, key, data );
  12063. } else {
  12064. data = undefined;
  12065. }
  12066. }
  12067. return data;
  12068. }
  12069. jQuery.extend( {
  12070. hasData: function( elem ) {
  12071. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  12072. },
  12073. data: function( elem, name, data ) {
  12074. return dataUser.access( elem, name, data );
  12075. },
  12076. removeData: function( elem, name ) {
  12077. dataUser.remove( elem, name );
  12078. },
  12079. // TODO: Now that all calls to _data and _removeData have been replaced
  12080. // with direct calls to dataPriv methods, these can be deprecated.
  12081. _data: function( elem, name, data ) {
  12082. return dataPriv.access( elem, name, data );
  12083. },
  12084. _removeData: function( elem, name ) {
  12085. dataPriv.remove( elem, name );
  12086. }
  12087. } );
  12088. jQuery.fn.extend( {
  12089. data: function( key, value ) {
  12090. var i, name, data,
  12091. elem = this[ 0 ],
  12092. attrs = elem && elem.attributes;
  12093. // Gets all values
  12094. if ( key === undefined ) {
  12095. if ( this.length ) {
  12096. data = dataUser.get( elem );
  12097. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  12098. i = attrs.length;
  12099. while ( i-- ) {
  12100. // Support: IE 11 only
  12101. // The attrs elements can be null (#14894)
  12102. if ( attrs[ i ] ) {
  12103. name = attrs[ i ].name;
  12104. if ( name.indexOf( "data-" ) === 0 ) {
  12105. name = camelCase( name.slice( 5 ) );
  12106. dataAttr( elem, name, data[ name ] );
  12107. }
  12108. }
  12109. }
  12110. dataPriv.set( elem, "hasDataAttrs", true );
  12111. }
  12112. }
  12113. return data;
  12114. }
  12115. // Sets multiple values
  12116. if ( typeof key === "object" ) {
  12117. return this.each( function() {
  12118. dataUser.set( this, key );
  12119. } );
  12120. }
  12121. return access( this, function( value ) {
  12122. var data;
  12123. // The calling jQuery object (element matches) is not empty
  12124. // (and therefore has an element appears at this[ 0 ]) and the
  12125. // `value` parameter was not undefined. An empty jQuery object
  12126. // will result in `undefined` for elem = this[ 0 ] which will
  12127. // throw an exception if an attempt to read a data cache is made.
  12128. if ( elem && value === undefined ) {
  12129. // Attempt to get data from the cache
  12130. // The key will always be camelCased in Data
  12131. data = dataUser.get( elem, key );
  12132. if ( data !== undefined ) {
  12133. return data;
  12134. }
  12135. // Attempt to "discover" the data in
  12136. // HTML5 custom data-* attrs
  12137. data = dataAttr( elem, key );
  12138. if ( data !== undefined ) {
  12139. return data;
  12140. }
  12141. // We tried really hard, but the data doesn't exist.
  12142. return;
  12143. }
  12144. // Set the data...
  12145. this.each( function() {
  12146. // We always store the camelCased key
  12147. dataUser.set( this, key, value );
  12148. } );
  12149. }, null, value, arguments.length > 1, null, true );
  12150. },
  12151. removeData: function( key ) {
  12152. return this.each( function() {
  12153. dataUser.remove( this, key );
  12154. } );
  12155. }
  12156. } );
  12157. jQuery.extend( {
  12158. queue: function( elem, type, data ) {
  12159. var queue;
  12160. if ( elem ) {
  12161. type = ( type || "fx" ) + "queue";
  12162. queue = dataPriv.get( elem, type );
  12163. // Speed up dequeue by getting out quickly if this is just a lookup
  12164. if ( data ) {
  12165. if ( !queue || Array.isArray( data ) ) {
  12166. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  12167. } else {
  12168. queue.push( data );
  12169. }
  12170. }
  12171. return queue || [];
  12172. }
  12173. },
  12174. dequeue: function( elem, type ) {
  12175. type = type || "fx";
  12176. var queue = jQuery.queue( elem, type ),
  12177. startLength = queue.length,
  12178. fn = queue.shift(),
  12179. hooks = jQuery._queueHooks( elem, type ),
  12180. next = function() {
  12181. jQuery.dequeue( elem, type );
  12182. };
  12183. // If the fx queue is dequeued, always remove the progress sentinel
  12184. if ( fn === "inprogress" ) {
  12185. fn = queue.shift();
  12186. startLength--;
  12187. }
  12188. if ( fn ) {
  12189. // Add a progress sentinel to prevent the fx queue from being
  12190. // automatically dequeued
  12191. if ( type === "fx" ) {
  12192. queue.unshift( "inprogress" );
  12193. }
  12194. // Clear up the last queue stop function
  12195. delete hooks.stop;
  12196. fn.call( elem, next, hooks );
  12197. }
  12198. if ( !startLength && hooks ) {
  12199. hooks.empty.fire();
  12200. }
  12201. },
  12202. // Not public - generate a queueHooks object, or return the current one
  12203. _queueHooks: function( elem, type ) {
  12204. var key = type + "queueHooks";
  12205. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  12206. empty: jQuery.Callbacks( "once memory" ).add( function() {
  12207. dataPriv.remove( elem, [ type + "queue", key ] );
  12208. } )
  12209. } );
  12210. }
  12211. } );
  12212. jQuery.fn.extend( {
  12213. queue: function( type, data ) {
  12214. var setter = 2;
  12215. if ( typeof type !== "string" ) {
  12216. data = type;
  12217. type = "fx";
  12218. setter--;
  12219. }
  12220. if ( arguments.length < setter ) {
  12221. return jQuery.queue( this[ 0 ], type );
  12222. }
  12223. return data === undefined ?
  12224. this :
  12225. this.each( function() {
  12226. var queue = jQuery.queue( this, type, data );
  12227. // Ensure a hooks for this queue
  12228. jQuery._queueHooks( this, type );
  12229. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  12230. jQuery.dequeue( this, type );
  12231. }
  12232. } );
  12233. },
  12234. dequeue: function( type ) {
  12235. return this.each( function() {
  12236. jQuery.dequeue( this, type );
  12237. } );
  12238. },
  12239. clearQueue: function( type ) {
  12240. return this.queue( type || "fx", [] );
  12241. },
  12242. // Get a promise resolved when queues of a certain type
  12243. // are emptied (fx is the type by default)
  12244. promise: function( type, obj ) {
  12245. var tmp,
  12246. count = 1,
  12247. defer = jQuery.Deferred(),
  12248. elements = this,
  12249. i = this.length,
  12250. resolve = function() {
  12251. if ( !( --count ) ) {
  12252. defer.resolveWith( elements, [ elements ] );
  12253. }
  12254. };
  12255. if ( typeof type !== "string" ) {
  12256. obj = type;
  12257. type = undefined;
  12258. }
  12259. type = type || "fx";
  12260. while ( i-- ) {
  12261. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  12262. if ( tmp && tmp.empty ) {
  12263. count++;
  12264. tmp.empty.add( resolve );
  12265. }
  12266. }
  12267. resolve();
  12268. return defer.promise( obj );
  12269. }
  12270. } );
  12271. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  12272. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  12273. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  12274. var documentElement = document.documentElement;
  12275. var isAttached = function( elem ) {
  12276. return jQuery.contains( elem.ownerDocument, elem );
  12277. },
  12278. composed = { composed: true };
  12279. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  12280. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  12281. // Support: iOS 10.0-10.2 only
  12282. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  12283. // leading to errors. We need to check for `getRootNode`.
  12284. if ( documentElement.getRootNode ) {
  12285. isAttached = function( elem ) {
  12286. return jQuery.contains( elem.ownerDocument, elem ) ||
  12287. elem.getRootNode( composed ) === elem.ownerDocument;
  12288. };
  12289. }
  12290. var isHiddenWithinTree = function( elem, el ) {
  12291. // isHiddenWithinTree might be called from jQuery#filter function;
  12292. // in that case, element will be second argument
  12293. elem = el || elem;
  12294. // Inline style trumps all
  12295. return elem.style.display === "none" ||
  12296. elem.style.display === "" &&
  12297. // Otherwise, check computed style
  12298. // Support: Firefox <=43 - 45
  12299. // Disconnected elements can have computed display: none, so first confirm that elem is
  12300. // in the document.
  12301. isAttached( elem ) &&
  12302. jQuery.css( elem, "display" ) === "none";
  12303. };
  12304. var swap = function( elem, options, callback, args ) {
  12305. var ret, name,
  12306. old = {};
  12307. // Remember the old values, and insert the new ones
  12308. for ( name in options ) {
  12309. old[ name ] = elem.style[ name ];
  12310. elem.style[ name ] = options[ name ];
  12311. }
  12312. ret = callback.apply( elem, args || [] );
  12313. // Revert the old values
  12314. for ( name in options ) {
  12315. elem.style[ name ] = old[ name ];
  12316. }
  12317. return ret;
  12318. };
  12319. function adjustCSS( elem, prop, valueParts, tween ) {
  12320. var adjusted, scale,
  12321. maxIterations = 20,
  12322. currentValue = tween ?
  12323. function() {
  12324. return tween.cur();
  12325. } :
  12326. function() {
  12327. return jQuery.css( elem, prop, "" );
  12328. },
  12329. initial = currentValue(),
  12330. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  12331. // Starting value computation is required for potential unit mismatches
  12332. initialInUnit = elem.nodeType &&
  12333. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  12334. rcssNum.exec( jQuery.css( elem, prop ) );
  12335. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  12336. // Support: Firefox <=54
  12337. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  12338. initial = initial / 2;
  12339. // Trust units reported by jQuery.css
  12340. unit = unit || initialInUnit[ 3 ];
  12341. // Iteratively approximate from a nonzero starting point
  12342. initialInUnit = +initial || 1;
  12343. while ( maxIterations-- ) {
  12344. // Evaluate and update our best guess (doubling guesses that zero out).
  12345. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  12346. jQuery.style( elem, prop, initialInUnit + unit );
  12347. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  12348. maxIterations = 0;
  12349. }
  12350. initialInUnit = initialInUnit / scale;
  12351. }
  12352. initialInUnit = initialInUnit * 2;
  12353. jQuery.style( elem, prop, initialInUnit + unit );
  12354. // Make sure we update the tween properties later on
  12355. valueParts = valueParts || [];
  12356. }
  12357. if ( valueParts ) {
  12358. initialInUnit = +initialInUnit || +initial || 0;
  12359. // Apply relative offset (+=/-=) if specified
  12360. adjusted = valueParts[ 1 ] ?
  12361. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  12362. +valueParts[ 2 ];
  12363. if ( tween ) {
  12364. tween.unit = unit;
  12365. tween.start = initialInUnit;
  12366. tween.end = adjusted;
  12367. }
  12368. }
  12369. return adjusted;
  12370. }
  12371. var defaultDisplayMap = {};
  12372. function getDefaultDisplay( elem ) {
  12373. var temp,
  12374. doc = elem.ownerDocument,
  12375. nodeName = elem.nodeName,
  12376. display = defaultDisplayMap[ nodeName ];
  12377. if ( display ) {
  12378. return display;
  12379. }
  12380. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  12381. display = jQuery.css( temp, "display" );
  12382. temp.parentNode.removeChild( temp );
  12383. if ( display === "none" ) {
  12384. display = "block";
  12385. }
  12386. defaultDisplayMap[ nodeName ] = display;
  12387. return display;
  12388. }
  12389. function showHide( elements, show ) {
  12390. var display, elem,
  12391. values = [],
  12392. index = 0,
  12393. length = elements.length;
  12394. // Determine new display value for elements that need to change
  12395. for ( ; index < length; index++ ) {
  12396. elem = elements[ index ];
  12397. if ( !elem.style ) {
  12398. continue;
  12399. }
  12400. display = elem.style.display;
  12401. if ( show ) {
  12402. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  12403. // check is required in this first loop unless we have a nonempty display value (either
  12404. // inline or about-to-be-restored)
  12405. if ( display === "none" ) {
  12406. values[ index ] = dataPriv.get( elem, "display" ) || null;
  12407. if ( !values[ index ] ) {
  12408. elem.style.display = "";
  12409. }
  12410. }
  12411. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  12412. values[ index ] = getDefaultDisplay( elem );
  12413. }
  12414. } else {
  12415. if ( display !== "none" ) {
  12416. values[ index ] = "none";
  12417. // Remember what we're overwriting
  12418. dataPriv.set( elem, "display", display );
  12419. }
  12420. }
  12421. }
  12422. // Set the display of the elements in a second loop to avoid constant reflow
  12423. for ( index = 0; index < length; index++ ) {
  12424. if ( values[ index ] != null ) {
  12425. elements[ index ].style.display = values[ index ];
  12426. }
  12427. }
  12428. return elements;
  12429. }
  12430. jQuery.fn.extend( {
  12431. show: function() {
  12432. return showHide( this, true );
  12433. },
  12434. hide: function() {
  12435. return showHide( this );
  12436. },
  12437. toggle: function( state ) {
  12438. if ( typeof state === "boolean" ) {
  12439. return state ? this.show() : this.hide();
  12440. }
  12441. return this.each( function() {
  12442. if ( isHiddenWithinTree( this ) ) {
  12443. jQuery( this ).show();
  12444. } else {
  12445. jQuery( this ).hide();
  12446. }
  12447. } );
  12448. }
  12449. } );
  12450. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  12451. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  12452. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  12453. // We have to close these tags to support XHTML (#13200)
  12454. var wrapMap = {
  12455. // Support: IE <=9 only
  12456. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  12457. // XHTML parsers do not magically insert elements in the
  12458. // same way that tag soup parsers do. So we cannot shorten
  12459. // this by omitting <tbody> or other required elements.
  12460. thead: [ 1, "<table>", "</table>" ],
  12461. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  12462. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  12463. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  12464. _default: [ 0, "", "" ]
  12465. };
  12466. // Support: IE <=9 only
  12467. wrapMap.optgroup = wrapMap.option;
  12468. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  12469. wrapMap.th = wrapMap.td;
  12470. function getAll( context, tag ) {
  12471. // Support: IE <=9 - 11 only
  12472. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  12473. var ret;
  12474. if ( typeof context.getElementsByTagName !== "undefined" ) {
  12475. ret = context.getElementsByTagName( tag || "*" );
  12476. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  12477. ret = context.querySelectorAll( tag || "*" );
  12478. } else {
  12479. ret = [];
  12480. }
  12481. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  12482. return jQuery.merge( [ context ], ret );
  12483. }
  12484. return ret;
  12485. }
  12486. // Mark scripts as having already been evaluated
  12487. function setGlobalEval( elems, refElements ) {
  12488. var i = 0,
  12489. l = elems.length;
  12490. for ( ; i < l; i++ ) {
  12491. dataPriv.set(
  12492. elems[ i ],
  12493. "globalEval",
  12494. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  12495. );
  12496. }
  12497. }
  12498. var rhtml = /<|&#?\w+;/;
  12499. function buildFragment( elems, context, scripts, selection, ignored ) {
  12500. var elem, tmp, tag, wrap, attached, j,
  12501. fragment = context.createDocumentFragment(),
  12502. nodes = [],
  12503. i = 0,
  12504. l = elems.length;
  12505. for ( ; i < l; i++ ) {
  12506. elem = elems[ i ];
  12507. if ( elem || elem === 0 ) {
  12508. // Add nodes directly
  12509. if ( toType( elem ) === "object" ) {
  12510. // Support: Android <=4.0 only, PhantomJS 1 only
  12511. // push.apply(_, arraylike) throws on ancient WebKit
  12512. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  12513. // Convert non-html into a text node
  12514. } else if ( !rhtml.test( elem ) ) {
  12515. nodes.push( context.createTextNode( elem ) );
  12516. // Convert html into DOM nodes
  12517. } else {
  12518. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  12519. // Deserialize a standard representation
  12520. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  12521. wrap = wrapMap[ tag ] || wrapMap._default;
  12522. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  12523. // Descend through wrappers to the right content
  12524. j = wrap[ 0 ];
  12525. while ( j-- ) {
  12526. tmp = tmp.lastChild;
  12527. }
  12528. // Support: Android <=4.0 only, PhantomJS 1 only
  12529. // push.apply(_, arraylike) throws on ancient WebKit
  12530. jQuery.merge( nodes, tmp.childNodes );
  12531. // Remember the top-level container
  12532. tmp = fragment.firstChild;
  12533. // Ensure the created nodes are orphaned (#12392)
  12534. tmp.textContent = "";
  12535. }
  12536. }
  12537. }
  12538. // Remove wrapper from fragment
  12539. fragment.textContent = "";
  12540. i = 0;
  12541. while ( ( elem = nodes[ i++ ] ) ) {
  12542. // Skip elements already in the context collection (trac-4087)
  12543. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  12544. if ( ignored ) {
  12545. ignored.push( elem );
  12546. }
  12547. continue;
  12548. }
  12549. attached = isAttached( elem );
  12550. // Append to fragment
  12551. tmp = getAll( fragment.appendChild( elem ), "script" );
  12552. // Preserve script evaluation history
  12553. if ( attached ) {
  12554. setGlobalEval( tmp );
  12555. }
  12556. // Capture executables
  12557. if ( scripts ) {
  12558. j = 0;
  12559. while ( ( elem = tmp[ j++ ] ) ) {
  12560. if ( rscriptType.test( elem.type || "" ) ) {
  12561. scripts.push( elem );
  12562. }
  12563. }
  12564. }
  12565. }
  12566. return fragment;
  12567. }
  12568. ( function() {
  12569. var fragment = document.createDocumentFragment(),
  12570. div = fragment.appendChild( document.createElement( "div" ) ),
  12571. input = document.createElement( "input" );
  12572. // Support: Android 4.0 - 4.3 only
  12573. // Check state lost if the name is set (#11217)
  12574. // Support: Windows Web Apps (WWA)
  12575. // `name` and `type` must use .setAttribute for WWA (#14901)
  12576. input.setAttribute( "type", "radio" );
  12577. input.setAttribute( "checked", "checked" );
  12578. input.setAttribute( "name", "t" );
  12579. div.appendChild( input );
  12580. // Support: Android <=4.1 only
  12581. // Older WebKit doesn't clone checked state correctly in fragments
  12582. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  12583. // Support: IE <=11 only
  12584. // Make sure textarea (and checkbox) defaultValue is properly cloned
  12585. div.innerHTML = "<textarea>x</textarea>";
  12586. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  12587. } )();
  12588. var
  12589. rkeyEvent = /^key/,
  12590. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  12591. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  12592. function returnTrue() {
  12593. return true;
  12594. }
  12595. function returnFalse() {
  12596. return false;
  12597. }
  12598. // Support: IE <=9 - 11+
  12599. // focus() and blur() are asynchronous, except when they are no-op.
  12600. // So expect focus to be synchronous when the element is already active,
  12601. // and blur to be synchronous when the element is not already active.
  12602. // (focus and blur are always synchronous in other supported browsers,
  12603. // this just defines when we can count on it).
  12604. function expectSync( elem, type ) {
  12605. return ( elem === safeActiveElement() ) === ( type === "focus" );
  12606. }
  12607. // Support: IE <=9 only
  12608. // Accessing document.activeElement can throw unexpectedly
  12609. // https://bugs.jquery.com/ticket/13393
  12610. function safeActiveElement() {
  12611. try {
  12612. return document.activeElement;
  12613. } catch ( err ) { }
  12614. }
  12615. function on( elem, types, selector, data, fn, one ) {
  12616. var origFn, type;
  12617. // Types can be a map of types/handlers
  12618. if ( typeof types === "object" ) {
  12619. // ( types-Object, selector, data )
  12620. if ( typeof selector !== "string" ) {
  12621. // ( types-Object, data )
  12622. data = data || selector;
  12623. selector = undefined;
  12624. }
  12625. for ( type in types ) {
  12626. on( elem, type, selector, data, types[ type ], one );
  12627. }
  12628. return elem;
  12629. }
  12630. if ( data == null && fn == null ) {
  12631. // ( types, fn )
  12632. fn = selector;
  12633. data = selector = undefined;
  12634. } else if ( fn == null ) {
  12635. if ( typeof selector === "string" ) {
  12636. // ( types, selector, fn )
  12637. fn = data;
  12638. data = undefined;
  12639. } else {
  12640. // ( types, data, fn )
  12641. fn = data;
  12642. data = selector;
  12643. selector = undefined;
  12644. }
  12645. }
  12646. if ( fn === false ) {
  12647. fn = returnFalse;
  12648. } else if ( !fn ) {
  12649. return elem;
  12650. }
  12651. if ( one === 1 ) {
  12652. origFn = fn;
  12653. fn = function( event ) {
  12654. // Can use an empty set, since event contains the info
  12655. jQuery().off( event );
  12656. return origFn.apply( this, arguments );
  12657. };
  12658. // Use same guid so caller can remove using origFn
  12659. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  12660. }
  12661. return elem.each( function() {
  12662. jQuery.event.add( this, types, fn, data, selector );
  12663. } );
  12664. }
  12665. /*
  12666. * Helper functions for managing events -- not part of the public interface.
  12667. * Props to Dean Edwards' addEvent library for many of the ideas.
  12668. */
  12669. jQuery.event = {
  12670. global: {},
  12671. add: function( elem, types, handler, data, selector ) {
  12672. var handleObjIn, eventHandle, tmp,
  12673. events, t, handleObj,
  12674. special, handlers, type, namespaces, origType,
  12675. elemData = dataPriv.get( elem );
  12676. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  12677. if ( !elemData ) {
  12678. return;
  12679. }
  12680. // Caller can pass in an object of custom data in lieu of the handler
  12681. if ( handler.handler ) {
  12682. handleObjIn = handler;
  12683. handler = handleObjIn.handler;
  12684. selector = handleObjIn.selector;
  12685. }
  12686. // Ensure that invalid selectors throw exceptions at attach time
  12687. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  12688. if ( selector ) {
  12689. jQuery.find.matchesSelector( documentElement, selector );
  12690. }
  12691. // Make sure that the handler has a unique ID, used to find/remove it later
  12692. if ( !handler.guid ) {
  12693. handler.guid = jQuery.guid++;
  12694. }
  12695. // Init the element's event structure and main handler, if this is the first
  12696. if ( !( events = elemData.events ) ) {
  12697. events = elemData.events = {};
  12698. }
  12699. if ( !( eventHandle = elemData.handle ) ) {
  12700. eventHandle = elemData.handle = function( e ) {
  12701. // Discard the second event of a jQuery.event.trigger() and
  12702. // when an event is called after a page has unloaded
  12703. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  12704. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  12705. };
  12706. }
  12707. // Handle multiple events separated by a space
  12708. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12709. t = types.length;
  12710. while ( t-- ) {
  12711. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12712. type = origType = tmp[ 1 ];
  12713. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12714. // There *must* be a type, no attaching namespace-only handlers
  12715. if ( !type ) {
  12716. continue;
  12717. }
  12718. // If event changes its type, use the special event handlers for the changed type
  12719. special = jQuery.event.special[ type ] || {};
  12720. // If selector defined, determine special event api type, otherwise given type
  12721. type = ( selector ? special.delegateType : special.bindType ) || type;
  12722. // Update special based on newly reset type
  12723. special = jQuery.event.special[ type ] || {};
  12724. // handleObj is passed to all event handlers
  12725. handleObj = jQuery.extend( {
  12726. type: type,
  12727. origType: origType,
  12728. data: data,
  12729. handler: handler,
  12730. guid: handler.guid,
  12731. selector: selector,
  12732. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  12733. namespace: namespaces.join( "." )
  12734. }, handleObjIn );
  12735. // Init the event handler queue if we're the first
  12736. if ( !( handlers = events[ type ] ) ) {
  12737. handlers = events[ type ] = [];
  12738. handlers.delegateCount = 0;
  12739. // Only use addEventListener if the special events handler returns false
  12740. if ( !special.setup ||
  12741. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  12742. if ( elem.addEventListener ) {
  12743. elem.addEventListener( type, eventHandle );
  12744. }
  12745. }
  12746. }
  12747. if ( special.add ) {
  12748. special.add.call( elem, handleObj );
  12749. if ( !handleObj.handler.guid ) {
  12750. handleObj.handler.guid = handler.guid;
  12751. }
  12752. }
  12753. // Add to the element's handler list, delegates in front
  12754. if ( selector ) {
  12755. handlers.splice( handlers.delegateCount++, 0, handleObj );
  12756. } else {
  12757. handlers.push( handleObj );
  12758. }
  12759. // Keep track of which events have ever been used, for event optimization
  12760. jQuery.event.global[ type ] = true;
  12761. }
  12762. },
  12763. // Detach an event or set of events from an element
  12764. remove: function( elem, types, handler, selector, mappedTypes ) {
  12765. var j, origCount, tmp,
  12766. events, t, handleObj,
  12767. special, handlers, type, namespaces, origType,
  12768. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  12769. if ( !elemData || !( events = elemData.events ) ) {
  12770. return;
  12771. }
  12772. // Once for each type.namespace in types; type may be omitted
  12773. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12774. t = types.length;
  12775. while ( t-- ) {
  12776. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12777. type = origType = tmp[ 1 ];
  12778. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12779. // Unbind all events (on this namespace, if provided) for the element
  12780. if ( !type ) {
  12781. for ( type in events ) {
  12782. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  12783. }
  12784. continue;
  12785. }
  12786. special = jQuery.event.special[ type ] || {};
  12787. type = ( selector ? special.delegateType : special.bindType ) || type;
  12788. handlers = events[ type ] || [];
  12789. tmp = tmp[ 2 ] &&
  12790. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  12791. // Remove matching events
  12792. origCount = j = handlers.length;
  12793. while ( j-- ) {
  12794. handleObj = handlers[ j ];
  12795. if ( ( mappedTypes || origType === handleObj.origType ) &&
  12796. ( !handler || handler.guid === handleObj.guid ) &&
  12797. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  12798. ( !selector || selector === handleObj.selector ||
  12799. selector === "**" && handleObj.selector ) ) {
  12800. handlers.splice( j, 1 );
  12801. if ( handleObj.selector ) {
  12802. handlers.delegateCount--;
  12803. }
  12804. if ( special.remove ) {
  12805. special.remove.call( elem, handleObj );
  12806. }
  12807. }
  12808. }
  12809. // Remove generic event handler if we removed something and no more handlers exist
  12810. // (avoids potential for endless recursion during removal of special event handlers)
  12811. if ( origCount && !handlers.length ) {
  12812. if ( !special.teardown ||
  12813. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  12814. jQuery.removeEvent( elem, type, elemData.handle );
  12815. }
  12816. delete events[ type ];
  12817. }
  12818. }
  12819. // Remove data and the expando if it's no longer used
  12820. if ( jQuery.isEmptyObject( events ) ) {
  12821. dataPriv.remove( elem, "handle events" );
  12822. }
  12823. },
  12824. dispatch: function( nativeEvent ) {
  12825. // Make a writable jQuery.Event from the native event object
  12826. var event = jQuery.event.fix( nativeEvent );
  12827. var i, j, ret, matched, handleObj, handlerQueue,
  12828. args = new Array( arguments.length ),
  12829. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  12830. special = jQuery.event.special[ event.type ] || {};
  12831. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  12832. args[ 0 ] = event;
  12833. for ( i = 1; i < arguments.length; i++ ) {
  12834. args[ i ] = arguments[ i ];
  12835. }
  12836. event.delegateTarget = this;
  12837. // Call the preDispatch hook for the mapped type, and let it bail if desired
  12838. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  12839. return;
  12840. }
  12841. // Determine handlers
  12842. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  12843. // Run delegates first; they may want to stop propagation beneath us
  12844. i = 0;
  12845. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  12846. event.currentTarget = matched.elem;
  12847. j = 0;
  12848. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  12849. !event.isImmediatePropagationStopped() ) {
  12850. // If the event is namespaced, then each handler is only invoked if it is
  12851. // specially universal or its namespaces are a superset of the event's.
  12852. if ( !event.rnamespace || handleObj.namespace === false ||
  12853. event.rnamespace.test( handleObj.namespace ) ) {
  12854. event.handleObj = handleObj;
  12855. event.data = handleObj.data;
  12856. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  12857. handleObj.handler ).apply( matched.elem, args );
  12858. if ( ret !== undefined ) {
  12859. if ( ( event.result = ret ) === false ) {
  12860. event.preventDefault();
  12861. event.stopPropagation();
  12862. }
  12863. }
  12864. }
  12865. }
  12866. }
  12867. // Call the postDispatch hook for the mapped type
  12868. if ( special.postDispatch ) {
  12869. special.postDispatch.call( this, event );
  12870. }
  12871. return event.result;
  12872. },
  12873. handlers: function( event, handlers ) {
  12874. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  12875. handlerQueue = [],
  12876. delegateCount = handlers.delegateCount,
  12877. cur = event.target;
  12878. // Find delegate handlers
  12879. if ( delegateCount &&
  12880. // Support: IE <=9
  12881. // Black-hole SVG <use> instance trees (trac-13180)
  12882. cur.nodeType &&
  12883. // Support: Firefox <=42
  12884. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  12885. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  12886. // Support: IE 11 only
  12887. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  12888. !( event.type === "click" && event.button >= 1 ) ) {
  12889. for ( ; cur !== this; cur = cur.parentNode || this ) {
  12890. // Don't check non-elements (#13208)
  12891. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  12892. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  12893. matchedHandlers = [];
  12894. matchedSelectors = {};
  12895. for ( i = 0; i < delegateCount; i++ ) {
  12896. handleObj = handlers[ i ];
  12897. // Don't conflict with Object.prototype properties (#13203)
  12898. sel = handleObj.selector + " ";
  12899. if ( matchedSelectors[ sel ] === undefined ) {
  12900. matchedSelectors[ sel ] = handleObj.needsContext ?
  12901. jQuery( sel, this ).index( cur ) > -1 :
  12902. jQuery.find( sel, this, null, [ cur ] ).length;
  12903. }
  12904. if ( matchedSelectors[ sel ] ) {
  12905. matchedHandlers.push( handleObj );
  12906. }
  12907. }
  12908. if ( matchedHandlers.length ) {
  12909. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  12910. }
  12911. }
  12912. }
  12913. }
  12914. // Add the remaining (directly-bound) handlers
  12915. cur = this;
  12916. if ( delegateCount < handlers.length ) {
  12917. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  12918. }
  12919. return handlerQueue;
  12920. },
  12921. addProp: function( name, hook ) {
  12922. Object.defineProperty( jQuery.Event.prototype, name, {
  12923. enumerable: true,
  12924. configurable: true,
  12925. get: isFunction( hook ) ?
  12926. function() {
  12927. if ( this.originalEvent ) {
  12928. return hook( this.originalEvent );
  12929. }
  12930. } :
  12931. function() {
  12932. if ( this.originalEvent ) {
  12933. return this.originalEvent[ name ];
  12934. }
  12935. },
  12936. set: function( value ) {
  12937. Object.defineProperty( this, name, {
  12938. enumerable: true,
  12939. configurable: true,
  12940. writable: true,
  12941. value: value
  12942. } );
  12943. }
  12944. } );
  12945. },
  12946. fix: function( originalEvent ) {
  12947. return originalEvent[ jQuery.expando ] ?
  12948. originalEvent :
  12949. new jQuery.Event( originalEvent );
  12950. },
  12951. special: {
  12952. load: {
  12953. // Prevent triggered image.load events from bubbling to window.load
  12954. noBubble: true
  12955. },
  12956. click: {
  12957. // Utilize native event to ensure correct state for checkable inputs
  12958. setup: function( data ) {
  12959. // For mutual compressibility with _default, replace `this` access with a local var.
  12960. // `|| data` is dead code meant only to preserve the variable through minification.
  12961. var el = this || data;
  12962. // Claim the first handler
  12963. if ( rcheckableType.test( el.type ) &&
  12964. el.click && nodeName( el, "input" ) ) {
  12965. // dataPriv.set( el, "click", ... )
  12966. leverageNative( el, "click", returnTrue );
  12967. }
  12968. // Return false to allow normal processing in the caller
  12969. return false;
  12970. },
  12971. trigger: function( data ) {
  12972. // For mutual compressibility with _default, replace `this` access with a local var.
  12973. // `|| data` is dead code meant only to preserve the variable through minification.
  12974. var el = this || data;
  12975. // Force setup before triggering a click
  12976. if ( rcheckableType.test( el.type ) &&
  12977. el.click && nodeName( el, "input" ) ) {
  12978. leverageNative( el, "click" );
  12979. }
  12980. // Return non-false to allow normal event-path propagation
  12981. return true;
  12982. },
  12983. // For cross-browser consistency, suppress native .click() on links
  12984. // Also prevent it if we're currently inside a leveraged native-event stack
  12985. _default: function( event ) {
  12986. var target = event.target;
  12987. return rcheckableType.test( target.type ) &&
  12988. target.click && nodeName( target, "input" ) &&
  12989. dataPriv.get( target, "click" ) ||
  12990. nodeName( target, "a" );
  12991. }
  12992. },
  12993. beforeunload: {
  12994. postDispatch: function( event ) {
  12995. // Support: Firefox 20+
  12996. // Firefox doesn't alert if the returnValue field is not set.
  12997. if ( event.result !== undefined && event.originalEvent ) {
  12998. event.originalEvent.returnValue = event.result;
  12999. }
  13000. }
  13001. }
  13002. }
  13003. };
  13004. // Ensure the presence of an event listener that handles manually-triggered
  13005. // synthetic events by interrupting progress until reinvoked in response to
  13006. // *native* events that it fires directly, ensuring that state changes have
  13007. // already occurred before other listeners are invoked.
  13008. function leverageNative( el, type, expectSync ) {
  13009. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  13010. if ( !expectSync ) {
  13011. if ( dataPriv.get( el, type ) === undefined ) {
  13012. jQuery.event.add( el, type, returnTrue );
  13013. }
  13014. return;
  13015. }
  13016. // Register the controller as a special universal handler for all event namespaces
  13017. dataPriv.set( el, type, false );
  13018. jQuery.event.add( el, type, {
  13019. namespace: false,
  13020. handler: function( event ) {
  13021. var notAsync, result,
  13022. saved = dataPriv.get( this, type );
  13023. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  13024. // Interrupt processing of the outer synthetic .trigger()ed event
  13025. // Saved data should be false in such cases, but might be a leftover capture object
  13026. // from an async native handler (gh-4350)
  13027. if ( !saved.length ) {
  13028. // Store arguments for use when handling the inner native event
  13029. // There will always be at least one argument (an event object), so this array
  13030. // will not be confused with a leftover capture object.
  13031. saved = slice.call( arguments );
  13032. dataPriv.set( this, type, saved );
  13033. // Trigger the native event and capture its result
  13034. // Support: IE <=9 - 11+
  13035. // focus() and blur() are asynchronous
  13036. notAsync = expectSync( this, type );
  13037. this[ type ]();
  13038. result = dataPriv.get( this, type );
  13039. if ( saved !== result || notAsync ) {
  13040. dataPriv.set( this, type, false );
  13041. } else {
  13042. result = {};
  13043. }
  13044. if ( saved !== result ) {
  13045. // Cancel the outer synthetic event
  13046. event.stopImmediatePropagation();
  13047. event.preventDefault();
  13048. return result.value;
  13049. }
  13050. // If this is an inner synthetic event for an event with a bubbling surrogate
  13051. // (focus or blur), assume that the surrogate already propagated from triggering the
  13052. // native event and prevent that from happening again here.
  13053. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  13054. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  13055. // less bad than duplication.
  13056. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  13057. event.stopPropagation();
  13058. }
  13059. // If this is a native event triggered above, everything is now in order
  13060. // Fire an inner synthetic event with the original arguments
  13061. } else if ( saved.length ) {
  13062. // ...and capture the result
  13063. dataPriv.set( this, type, {
  13064. value: jQuery.event.trigger(
  13065. // Support: IE <=9 - 11+
  13066. // Extend with the prototype to reset the above stopImmediatePropagation()
  13067. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  13068. saved.slice( 1 ),
  13069. this
  13070. )
  13071. } );
  13072. // Abort handling of the native event
  13073. event.stopImmediatePropagation();
  13074. }
  13075. }
  13076. } );
  13077. }
  13078. jQuery.removeEvent = function( elem, type, handle ) {
  13079. // This "if" is needed for plain objects
  13080. if ( elem.removeEventListener ) {
  13081. elem.removeEventListener( type, handle );
  13082. }
  13083. };
  13084. jQuery.Event = function( src, props ) {
  13085. // Allow instantiation without the 'new' keyword
  13086. if ( !( this instanceof jQuery.Event ) ) {
  13087. return new jQuery.Event( src, props );
  13088. }
  13089. // Event object
  13090. if ( src && src.type ) {
  13091. this.originalEvent = src;
  13092. this.type = src.type;
  13093. // Events bubbling up the document may have been marked as prevented
  13094. // by a handler lower down the tree; reflect the correct value.
  13095. this.isDefaultPrevented = src.defaultPrevented ||
  13096. src.defaultPrevented === undefined &&
  13097. // Support: Android <=2.3 only
  13098. src.returnValue === false ?
  13099. returnTrue :
  13100. returnFalse;
  13101. // Create target properties
  13102. // Support: Safari <=6 - 7 only
  13103. // Target should not be a text node (#504, #13143)
  13104. this.target = ( src.target && src.target.nodeType === 3 ) ?
  13105. src.target.parentNode :
  13106. src.target;
  13107. this.currentTarget = src.currentTarget;
  13108. this.relatedTarget = src.relatedTarget;
  13109. // Event type
  13110. } else {
  13111. this.type = src;
  13112. }
  13113. // Put explicitly provided properties onto the event object
  13114. if ( props ) {
  13115. jQuery.extend( this, props );
  13116. }
  13117. // Create a timestamp if incoming event doesn't have one
  13118. this.timeStamp = src && src.timeStamp || Date.now();
  13119. // Mark it as fixed
  13120. this[ jQuery.expando ] = true;
  13121. };
  13122. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  13123. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  13124. jQuery.Event.prototype = {
  13125. constructor: jQuery.Event,
  13126. isDefaultPrevented: returnFalse,
  13127. isPropagationStopped: returnFalse,
  13128. isImmediatePropagationStopped: returnFalse,
  13129. isSimulated: false,
  13130. preventDefault: function() {
  13131. var e = this.originalEvent;
  13132. this.isDefaultPrevented = returnTrue;
  13133. if ( e && !this.isSimulated ) {
  13134. e.preventDefault();
  13135. }
  13136. },
  13137. stopPropagation: function() {
  13138. var e = this.originalEvent;
  13139. this.isPropagationStopped = returnTrue;
  13140. if ( e && !this.isSimulated ) {
  13141. e.stopPropagation();
  13142. }
  13143. },
  13144. stopImmediatePropagation: function() {
  13145. var e = this.originalEvent;
  13146. this.isImmediatePropagationStopped = returnTrue;
  13147. if ( e && !this.isSimulated ) {
  13148. e.stopImmediatePropagation();
  13149. }
  13150. this.stopPropagation();
  13151. }
  13152. };
  13153. // Includes all common event props including KeyEvent and MouseEvent specific props
  13154. jQuery.each( {
  13155. altKey: true,
  13156. bubbles: true,
  13157. cancelable: true,
  13158. changedTouches: true,
  13159. ctrlKey: true,
  13160. detail: true,
  13161. eventPhase: true,
  13162. metaKey: true,
  13163. pageX: true,
  13164. pageY: true,
  13165. shiftKey: true,
  13166. view: true,
  13167. "char": true,
  13168. code: true,
  13169. charCode: true,
  13170. key: true,
  13171. keyCode: true,
  13172. button: true,
  13173. buttons: true,
  13174. clientX: true,
  13175. clientY: true,
  13176. offsetX: true,
  13177. offsetY: true,
  13178. pointerId: true,
  13179. pointerType: true,
  13180. screenX: true,
  13181. screenY: true,
  13182. targetTouches: true,
  13183. toElement: true,
  13184. touches: true,
  13185. which: function( event ) {
  13186. var button = event.button;
  13187. // Add which for key events
  13188. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  13189. return event.charCode != null ? event.charCode : event.keyCode;
  13190. }
  13191. // Add which for click: 1 === left; 2 === middle; 3 === right
  13192. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  13193. if ( button & 1 ) {
  13194. return 1;
  13195. }
  13196. if ( button & 2 ) {
  13197. return 3;
  13198. }
  13199. if ( button & 4 ) {
  13200. return 2;
  13201. }
  13202. return 0;
  13203. }
  13204. return event.which;
  13205. }
  13206. }, jQuery.event.addProp );
  13207. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  13208. jQuery.event.special[ type ] = {
  13209. // Utilize native event if possible so blur/focus sequence is correct
  13210. setup: function() {
  13211. // Claim the first handler
  13212. // dataPriv.set( this, "focus", ... )
  13213. // dataPriv.set( this, "blur", ... )
  13214. leverageNative( this, type, expectSync );
  13215. // Return false to allow normal processing in the caller
  13216. return false;
  13217. },
  13218. trigger: function() {
  13219. // Force setup before trigger
  13220. leverageNative( this, type );
  13221. // Return non-false to allow normal event-path propagation
  13222. return true;
  13223. },
  13224. delegateType: delegateType
  13225. };
  13226. } );
  13227. // Create mouseenter/leave events using mouseover/out and event-time checks
  13228. // so that event delegation works in jQuery.
  13229. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  13230. //
  13231. // Support: Safari 7 only
  13232. // Safari sends mouseenter too often; see:
  13233. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  13234. // for the description of the bug (it existed in older Chrome versions as well).
  13235. jQuery.each( {
  13236. mouseenter: "mouseover",
  13237. mouseleave: "mouseout",
  13238. pointerenter: "pointerover",
  13239. pointerleave: "pointerout"
  13240. }, function( orig, fix ) {
  13241. jQuery.event.special[ orig ] = {
  13242. delegateType: fix,
  13243. bindType: fix,
  13244. handle: function( event ) {
  13245. var ret,
  13246. target = this,
  13247. related = event.relatedTarget,
  13248. handleObj = event.handleObj;
  13249. // For mouseenter/leave call the handler if related is outside the target.
  13250. // NB: No relatedTarget if the mouse left/entered the browser window
  13251. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  13252. event.type = handleObj.origType;
  13253. ret = handleObj.handler.apply( this, arguments );
  13254. event.type = fix;
  13255. }
  13256. return ret;
  13257. }
  13258. };
  13259. } );
  13260. jQuery.fn.extend( {
  13261. on: function( types, selector, data, fn ) {
  13262. return on( this, types, selector, data, fn );
  13263. },
  13264. one: function( types, selector, data, fn ) {
  13265. return on( this, types, selector, data, fn, 1 );
  13266. },
  13267. off: function( types, selector, fn ) {
  13268. var handleObj, type;
  13269. if ( types && types.preventDefault && types.handleObj ) {
  13270. // ( event ) dispatched jQuery.Event
  13271. handleObj = types.handleObj;
  13272. jQuery( types.delegateTarget ).off(
  13273. handleObj.namespace ?
  13274. handleObj.origType + "." + handleObj.namespace :
  13275. handleObj.origType,
  13276. handleObj.selector,
  13277. handleObj.handler
  13278. );
  13279. return this;
  13280. }
  13281. if ( typeof types === "object" ) {
  13282. // ( types-object [, selector] )
  13283. for ( type in types ) {
  13284. this.off( type, selector, types[ type ] );
  13285. }
  13286. return this;
  13287. }
  13288. if ( selector === false || typeof selector === "function" ) {
  13289. // ( types [, fn] )
  13290. fn = selector;
  13291. selector = undefined;
  13292. }
  13293. if ( fn === false ) {
  13294. fn = returnFalse;
  13295. }
  13296. return this.each( function() {
  13297. jQuery.event.remove( this, types, fn, selector );
  13298. } );
  13299. }
  13300. } );
  13301. var
  13302. /* eslint-disable max-len */
  13303. // See https://github.com/eslint/eslint/issues/3229
  13304. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  13305. /* eslint-enable */
  13306. // Support: IE <=10 - 11, Edge 12 - 13 only
  13307. // In IE/Edge using regex groups here causes severe slowdowns.
  13308. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  13309. rnoInnerhtml = /<script|<style|<link/i,
  13310. // checked="checked" or checked
  13311. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  13312. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  13313. // Prefer a tbody over its parent table for containing new rows
  13314. function manipulationTarget( elem, content ) {
  13315. if ( nodeName( elem, "table" ) &&
  13316. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  13317. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  13318. }
  13319. return elem;
  13320. }
  13321. // Replace/restore the type attribute of script elements for safe DOM manipulation
  13322. function disableScript( elem ) {
  13323. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  13324. return elem;
  13325. }
  13326. function restoreScript( elem ) {
  13327. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  13328. elem.type = elem.type.slice( 5 );
  13329. } else {
  13330. elem.removeAttribute( "type" );
  13331. }
  13332. return elem;
  13333. }
  13334. function cloneCopyEvent( src, dest ) {
  13335. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  13336. if ( dest.nodeType !== 1 ) {
  13337. return;
  13338. }
  13339. // 1. Copy private data: events, handlers, etc.
  13340. if ( dataPriv.hasData( src ) ) {
  13341. pdataOld = dataPriv.access( src );
  13342. pdataCur = dataPriv.set( dest, pdataOld );
  13343. events = pdataOld.events;
  13344. if ( events ) {
  13345. delete pdataCur.handle;
  13346. pdataCur.events = {};
  13347. for ( type in events ) {
  13348. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  13349. jQuery.event.add( dest, type, events[ type ][ i ] );
  13350. }
  13351. }
  13352. }
  13353. }
  13354. // 2. Copy user data
  13355. if ( dataUser.hasData( src ) ) {
  13356. udataOld = dataUser.access( src );
  13357. udataCur = jQuery.extend( {}, udataOld );
  13358. dataUser.set( dest, udataCur );
  13359. }
  13360. }
  13361. // Fix IE bugs, see support tests
  13362. function fixInput( src, dest ) {
  13363. var nodeName = dest.nodeName.toLowerCase();
  13364. // Fails to persist the checked state of a cloned checkbox or radio button.
  13365. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  13366. dest.checked = src.checked;
  13367. // Fails to return the selected option to the default selected state when cloning options
  13368. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  13369. dest.defaultValue = src.defaultValue;
  13370. }
  13371. }
  13372. function domManip( collection, args, callback, ignored ) {
  13373. // Flatten any nested arrays
  13374. args = concat.apply( [], args );
  13375. var fragment, first, scripts, hasScripts, node, doc,
  13376. i = 0,
  13377. l = collection.length,
  13378. iNoClone = l - 1,
  13379. value = args[ 0 ],
  13380. valueIsFunction = isFunction( value );
  13381. // We can't cloneNode fragments that contain checked, in WebKit
  13382. if ( valueIsFunction ||
  13383. ( l > 1 && typeof value === "string" &&
  13384. !support.checkClone && rchecked.test( value ) ) ) {
  13385. return collection.each( function( index ) {
  13386. var self = collection.eq( index );
  13387. if ( valueIsFunction ) {
  13388. args[ 0 ] = value.call( this, index, self.html() );
  13389. }
  13390. domManip( self, args, callback, ignored );
  13391. } );
  13392. }
  13393. if ( l ) {
  13394. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  13395. first = fragment.firstChild;
  13396. if ( fragment.childNodes.length === 1 ) {
  13397. fragment = first;
  13398. }
  13399. // Require either new content or an interest in ignored elements to invoke the callback
  13400. if ( first || ignored ) {
  13401. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  13402. hasScripts = scripts.length;
  13403. // Use the original fragment for the last item
  13404. // instead of the first because it can end up
  13405. // being emptied incorrectly in certain situations (#8070).
  13406. for ( ; i < l; i++ ) {
  13407. node = fragment;
  13408. if ( i !== iNoClone ) {
  13409. node = jQuery.clone( node, true, true );
  13410. // Keep references to cloned scripts for later restoration
  13411. if ( hasScripts ) {
  13412. // Support: Android <=4.0 only, PhantomJS 1 only
  13413. // push.apply(_, arraylike) throws on ancient WebKit
  13414. jQuery.merge( scripts, getAll( node, "script" ) );
  13415. }
  13416. }
  13417. callback.call( collection[ i ], node, i );
  13418. }
  13419. if ( hasScripts ) {
  13420. doc = scripts[ scripts.length - 1 ].ownerDocument;
  13421. // Reenable scripts
  13422. jQuery.map( scripts, restoreScript );
  13423. // Evaluate executable scripts on first document insertion
  13424. for ( i = 0; i < hasScripts; i++ ) {
  13425. node = scripts[ i ];
  13426. if ( rscriptType.test( node.type || "" ) &&
  13427. !dataPriv.access( node, "globalEval" ) &&
  13428. jQuery.contains( doc, node ) ) {
  13429. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  13430. // Optional AJAX dependency, but won't run scripts if not present
  13431. if ( jQuery._evalUrl && !node.noModule ) {
  13432. jQuery._evalUrl( node.src, {
  13433. nonce: node.nonce || node.getAttribute( "nonce" )
  13434. } );
  13435. }
  13436. } else {
  13437. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  13438. }
  13439. }
  13440. }
  13441. }
  13442. }
  13443. }
  13444. return collection;
  13445. }
  13446. function remove( elem, selector, keepData ) {
  13447. var node,
  13448. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  13449. i = 0;
  13450. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  13451. if ( !keepData && node.nodeType === 1 ) {
  13452. jQuery.cleanData( getAll( node ) );
  13453. }
  13454. if ( node.parentNode ) {
  13455. if ( keepData && isAttached( node ) ) {
  13456. setGlobalEval( getAll( node, "script" ) );
  13457. }
  13458. node.parentNode.removeChild( node );
  13459. }
  13460. }
  13461. return elem;
  13462. }
  13463. jQuery.extend( {
  13464. htmlPrefilter: function( html ) {
  13465. return html.replace( rxhtmlTag, "<$1></$2>" );
  13466. },
  13467. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  13468. var i, l, srcElements, destElements,
  13469. clone = elem.cloneNode( true ),
  13470. inPage = isAttached( elem );
  13471. // Fix IE cloning issues
  13472. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  13473. !jQuery.isXMLDoc( elem ) ) {
  13474. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  13475. destElements = getAll( clone );
  13476. srcElements = getAll( elem );
  13477. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13478. fixInput( srcElements[ i ], destElements[ i ] );
  13479. }
  13480. }
  13481. // Copy the events from the original to the clone
  13482. if ( dataAndEvents ) {
  13483. if ( deepDataAndEvents ) {
  13484. srcElements = srcElements || getAll( elem );
  13485. destElements = destElements || getAll( clone );
  13486. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13487. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  13488. }
  13489. } else {
  13490. cloneCopyEvent( elem, clone );
  13491. }
  13492. }
  13493. // Preserve script evaluation history
  13494. destElements = getAll( clone, "script" );
  13495. if ( destElements.length > 0 ) {
  13496. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  13497. }
  13498. // Return the cloned set
  13499. return clone;
  13500. },
  13501. cleanData: function( elems ) {
  13502. var data, elem, type,
  13503. special = jQuery.event.special,
  13504. i = 0;
  13505. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  13506. if ( acceptData( elem ) ) {
  13507. if ( ( data = elem[ dataPriv.expando ] ) ) {
  13508. if ( data.events ) {
  13509. for ( type in data.events ) {
  13510. if ( special[ type ] ) {
  13511. jQuery.event.remove( elem, type );
  13512. // This is a shortcut to avoid jQuery.event.remove's overhead
  13513. } else {
  13514. jQuery.removeEvent( elem, type, data.handle );
  13515. }
  13516. }
  13517. }
  13518. // Support: Chrome <=35 - 45+
  13519. // Assign undefined instead of using delete, see Data#remove
  13520. elem[ dataPriv.expando ] = undefined;
  13521. }
  13522. if ( elem[ dataUser.expando ] ) {
  13523. // Support: Chrome <=35 - 45+
  13524. // Assign undefined instead of using delete, see Data#remove
  13525. elem[ dataUser.expando ] = undefined;
  13526. }
  13527. }
  13528. }
  13529. }
  13530. } );
  13531. jQuery.fn.extend( {
  13532. detach: function( selector ) {
  13533. return remove( this, selector, true );
  13534. },
  13535. remove: function( selector ) {
  13536. return remove( this, selector );
  13537. },
  13538. text: function( value ) {
  13539. return access( this, function( value ) {
  13540. return value === undefined ?
  13541. jQuery.text( this ) :
  13542. this.empty().each( function() {
  13543. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13544. this.textContent = value;
  13545. }
  13546. } );
  13547. }, null, value, arguments.length );
  13548. },
  13549. append: function() {
  13550. return domManip( this, arguments, function( elem ) {
  13551. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13552. var target = manipulationTarget( this, elem );
  13553. target.appendChild( elem );
  13554. }
  13555. } );
  13556. },
  13557. prepend: function() {
  13558. return domManip( this, arguments, function( elem ) {
  13559. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13560. var target = manipulationTarget( this, elem );
  13561. target.insertBefore( elem, target.firstChild );
  13562. }
  13563. } );
  13564. },
  13565. before: function() {
  13566. return domManip( this, arguments, function( elem ) {
  13567. if ( this.parentNode ) {
  13568. this.parentNode.insertBefore( elem, this );
  13569. }
  13570. } );
  13571. },
  13572. after: function() {
  13573. return domManip( this, arguments, function( elem ) {
  13574. if ( this.parentNode ) {
  13575. this.parentNode.insertBefore( elem, this.nextSibling );
  13576. }
  13577. } );
  13578. },
  13579. empty: function() {
  13580. var elem,
  13581. i = 0;
  13582. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  13583. if ( elem.nodeType === 1 ) {
  13584. // Prevent memory leaks
  13585. jQuery.cleanData( getAll( elem, false ) );
  13586. // Remove any remaining nodes
  13587. elem.textContent = "";
  13588. }
  13589. }
  13590. return this;
  13591. },
  13592. clone: function( dataAndEvents, deepDataAndEvents ) {
  13593. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  13594. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  13595. return this.map( function() {
  13596. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  13597. } );
  13598. },
  13599. html: function( value ) {
  13600. return access( this, function( value ) {
  13601. var elem = this[ 0 ] || {},
  13602. i = 0,
  13603. l = this.length;
  13604. if ( value === undefined && elem.nodeType === 1 ) {
  13605. return elem.innerHTML;
  13606. }
  13607. // See if we can take a shortcut and just use innerHTML
  13608. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  13609. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  13610. value = jQuery.htmlPrefilter( value );
  13611. try {
  13612. for ( ; i < l; i++ ) {
  13613. elem = this[ i ] || {};
  13614. // Remove element nodes and prevent memory leaks
  13615. if ( elem.nodeType === 1 ) {
  13616. jQuery.cleanData( getAll( elem, false ) );
  13617. elem.innerHTML = value;
  13618. }
  13619. }
  13620. elem = 0;
  13621. // If using innerHTML throws an exception, use the fallback method
  13622. } catch ( e ) {}
  13623. }
  13624. if ( elem ) {
  13625. this.empty().append( value );
  13626. }
  13627. }, null, value, arguments.length );
  13628. },
  13629. replaceWith: function() {
  13630. var ignored = [];
  13631. // Make the changes, replacing each non-ignored context element with the new content
  13632. return domManip( this, arguments, function( elem ) {
  13633. var parent = this.parentNode;
  13634. if ( jQuery.inArray( this, ignored ) < 0 ) {
  13635. jQuery.cleanData( getAll( this ) );
  13636. if ( parent ) {
  13637. parent.replaceChild( elem, this );
  13638. }
  13639. }
  13640. // Force callback invocation
  13641. }, ignored );
  13642. }
  13643. } );
  13644. jQuery.each( {
  13645. appendTo: "append",
  13646. prependTo: "prepend",
  13647. insertBefore: "before",
  13648. insertAfter: "after",
  13649. replaceAll: "replaceWith"
  13650. }, function( name, original ) {
  13651. jQuery.fn[ name ] = function( selector ) {
  13652. var elems,
  13653. ret = [],
  13654. insert = jQuery( selector ),
  13655. last = insert.length - 1,
  13656. i = 0;
  13657. for ( ; i <= last; i++ ) {
  13658. elems = i === last ? this : this.clone( true );
  13659. jQuery( insert[ i ] )[ original ]( elems );
  13660. // Support: Android <=4.0 only, PhantomJS 1 only
  13661. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  13662. push.apply( ret, elems.get() );
  13663. }
  13664. return this.pushStack( ret );
  13665. };
  13666. } );
  13667. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  13668. var getStyles = function( elem ) {
  13669. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  13670. // IE throws on elements created in popups
  13671. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  13672. var view = elem.ownerDocument.defaultView;
  13673. if ( !view || !view.opener ) {
  13674. view = window;
  13675. }
  13676. return view.getComputedStyle( elem );
  13677. };
  13678. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  13679. ( function() {
  13680. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  13681. // so they're executed at the same time to save the second computation.
  13682. function computeStyleTests() {
  13683. // This is a singleton, we need to execute it only once
  13684. if ( !div ) {
  13685. return;
  13686. }
  13687. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  13688. "margin-top:1px;padding:0;border:0";
  13689. div.style.cssText =
  13690. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  13691. "margin:auto;border:1px;padding:1px;" +
  13692. "width:60%;top:1%";
  13693. documentElement.appendChild( container ).appendChild( div );
  13694. var divStyle = window.getComputedStyle( div );
  13695. pixelPositionVal = divStyle.top !== "1%";
  13696. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  13697. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  13698. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  13699. // Some styles come back with percentage values, even though they shouldn't
  13700. div.style.right = "60%";
  13701. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  13702. // Support: IE 9 - 11 only
  13703. // Detect misreporting of content dimensions for box-sizing:border-box elements
  13704. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  13705. // Support: IE 9 only
  13706. // Detect overflow:scroll screwiness (gh-3699)
  13707. // Support: Chrome <=64
  13708. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  13709. div.style.position = "absolute";
  13710. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  13711. documentElement.removeChild( container );
  13712. // Nullify the div so it wouldn't be stored in the memory and
  13713. // it will also be a sign that checks already performed
  13714. div = null;
  13715. }
  13716. function roundPixelMeasures( measure ) {
  13717. return Math.round( parseFloat( measure ) );
  13718. }
  13719. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  13720. reliableMarginLeftVal,
  13721. container = document.createElement( "div" ),
  13722. div = document.createElement( "div" );
  13723. // Finish early in limited (non-browser) environments
  13724. if ( !div.style ) {
  13725. return;
  13726. }
  13727. // Support: IE <=9 - 11 only
  13728. // Style of cloned element affects source element cloned (#8908)
  13729. div.style.backgroundClip = "content-box";
  13730. div.cloneNode( true ).style.backgroundClip = "";
  13731. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  13732. jQuery.extend( support, {
  13733. boxSizingReliable: function() {
  13734. computeStyleTests();
  13735. return boxSizingReliableVal;
  13736. },
  13737. pixelBoxStyles: function() {
  13738. computeStyleTests();
  13739. return pixelBoxStylesVal;
  13740. },
  13741. pixelPosition: function() {
  13742. computeStyleTests();
  13743. return pixelPositionVal;
  13744. },
  13745. reliableMarginLeft: function() {
  13746. computeStyleTests();
  13747. return reliableMarginLeftVal;
  13748. },
  13749. scrollboxSize: function() {
  13750. computeStyleTests();
  13751. return scrollboxSizeVal;
  13752. }
  13753. } );
  13754. } )();
  13755. function curCSS( elem, name, computed ) {
  13756. var width, minWidth, maxWidth, ret,
  13757. // Support: Firefox 51+
  13758. // Retrieving style before computed somehow
  13759. // fixes an issue with getting wrong values
  13760. // on detached elements
  13761. style = elem.style;
  13762. computed = computed || getStyles( elem );
  13763. // getPropertyValue is needed for:
  13764. // .css('filter') (IE 9 only, #12537)
  13765. // .css('--customProperty) (#3144)
  13766. if ( computed ) {
  13767. ret = computed.getPropertyValue( name ) || computed[ name ];
  13768. if ( ret === "" && !isAttached( elem ) ) {
  13769. ret = jQuery.style( elem, name );
  13770. }
  13771. // A tribute to the "awesome hack by Dean Edwards"
  13772. // Android Browser returns percentage for some values,
  13773. // but width seems to be reliably pixels.
  13774. // This is against the CSSOM draft spec:
  13775. // https://drafts.csswg.org/cssom/#resolved-values
  13776. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  13777. // Remember the original values
  13778. width = style.width;
  13779. minWidth = style.minWidth;
  13780. maxWidth = style.maxWidth;
  13781. // Put in the new values to get a computed value out
  13782. style.minWidth = style.maxWidth = style.width = ret;
  13783. ret = computed.width;
  13784. // Revert the changed values
  13785. style.width = width;
  13786. style.minWidth = minWidth;
  13787. style.maxWidth = maxWidth;
  13788. }
  13789. }
  13790. return ret !== undefined ?
  13791. // Support: IE <=9 - 11 only
  13792. // IE returns zIndex value as an integer.
  13793. ret + "" :
  13794. ret;
  13795. }
  13796. function addGetHookIf( conditionFn, hookFn ) {
  13797. // Define the hook, we'll check on the first run if it's really needed.
  13798. return {
  13799. get: function() {
  13800. if ( conditionFn() ) {
  13801. // Hook not needed (or it's not possible to use it due
  13802. // to missing dependency), remove it.
  13803. delete this.get;
  13804. return;
  13805. }
  13806. // Hook needed; redefine it so that the support test is not executed again.
  13807. return ( this.get = hookFn ).apply( this, arguments );
  13808. }
  13809. };
  13810. }
  13811. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  13812. emptyStyle = document.createElement( "div" ).style,
  13813. vendorProps = {};
  13814. // Return a vendor-prefixed property or undefined
  13815. function vendorPropName( name ) {
  13816. // Check for vendor prefixed names
  13817. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  13818. i = cssPrefixes.length;
  13819. while ( i-- ) {
  13820. name = cssPrefixes[ i ] + capName;
  13821. if ( name in emptyStyle ) {
  13822. return name;
  13823. }
  13824. }
  13825. }
  13826. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  13827. function finalPropName( name ) {
  13828. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  13829. if ( final ) {
  13830. return final;
  13831. }
  13832. if ( name in emptyStyle ) {
  13833. return name;
  13834. }
  13835. return vendorProps[ name ] = vendorPropName( name ) || name;
  13836. }
  13837. var
  13838. // Swappable if display is none or starts with table
  13839. // except "table", "table-cell", or "table-caption"
  13840. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  13841. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  13842. rcustomProp = /^--/,
  13843. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  13844. cssNormalTransform = {
  13845. letterSpacing: "0",
  13846. fontWeight: "400"
  13847. };
  13848. function setPositiveNumber( elem, value, subtract ) {
  13849. // Any relative (+/-) values have already been
  13850. // normalized at this point
  13851. var matches = rcssNum.exec( value );
  13852. return matches ?
  13853. // Guard against undefined "subtract", e.g., when used as in cssHooks
  13854. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  13855. value;
  13856. }
  13857. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  13858. var i = dimension === "width" ? 1 : 0,
  13859. extra = 0,
  13860. delta = 0;
  13861. // Adjustment may not be necessary
  13862. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  13863. return 0;
  13864. }
  13865. for ( ; i < 4; i += 2 ) {
  13866. // Both box models exclude margin
  13867. if ( box === "margin" ) {
  13868. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  13869. }
  13870. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  13871. if ( !isBorderBox ) {
  13872. // Add padding
  13873. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13874. // For "border" or "margin", add border
  13875. if ( box !== "padding" ) {
  13876. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13877. // But still keep track of it otherwise
  13878. } else {
  13879. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13880. }
  13881. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  13882. // "padding" or "margin"
  13883. } else {
  13884. // For "content", subtract padding
  13885. if ( box === "content" ) {
  13886. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13887. }
  13888. // For "content" or "padding", subtract border
  13889. if ( box !== "margin" ) {
  13890. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13891. }
  13892. }
  13893. }
  13894. // Account for positive content-box scroll gutter when requested by providing computedVal
  13895. if ( !isBorderBox && computedVal >= 0 ) {
  13896. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  13897. // Assuming integer scroll gutter, subtract the rest and round down
  13898. delta += Math.max( 0, Math.ceil(
  13899. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13900. computedVal -
  13901. delta -
  13902. extra -
  13903. 0.5
  13904. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  13905. // Use an explicit zero to avoid NaN (gh-3964)
  13906. ) ) || 0;
  13907. }
  13908. return delta;
  13909. }
  13910. function getWidthOrHeight( elem, dimension, extra ) {
  13911. // Start with computed style
  13912. var styles = getStyles( elem ),
  13913. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  13914. // Fake content-box until we know it's needed to know the true value.
  13915. boxSizingNeeded = !support.boxSizingReliable() || extra,
  13916. isBorderBox = boxSizingNeeded &&
  13917. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13918. valueIsBorderBox = isBorderBox,
  13919. val = curCSS( elem, dimension, styles ),
  13920. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  13921. // Support: Firefox <=54
  13922. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  13923. if ( rnumnonpx.test( val ) ) {
  13924. if ( !extra ) {
  13925. return val;
  13926. }
  13927. val = "auto";
  13928. }
  13929. // Fall back to offsetWidth/offsetHeight when value is "auto"
  13930. // This happens for inline elements with no explicit setting (gh-3571)
  13931. // Support: Android <=4.1 - 4.3 only
  13932. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  13933. // Support: IE 9-11 only
  13934. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  13935. // We use getClientRects() to check for hidden/disconnected.
  13936. // In those cases, the computed value can be trusted to be border-box
  13937. if ( ( !support.boxSizingReliable() && isBorderBox ||
  13938. val === "auto" ||
  13939. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  13940. elem.getClientRects().length ) {
  13941. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  13942. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  13943. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  13944. // retrieved value as a content box dimension.
  13945. valueIsBorderBox = offsetProp in elem;
  13946. if ( valueIsBorderBox ) {
  13947. val = elem[ offsetProp ];
  13948. }
  13949. }
  13950. // Normalize "" and auto
  13951. val = parseFloat( val ) || 0;
  13952. // Adjust for the element's box model
  13953. return ( val +
  13954. boxModelAdjustment(
  13955. elem,
  13956. dimension,
  13957. extra || ( isBorderBox ? "border" : "content" ),
  13958. valueIsBorderBox,
  13959. styles,
  13960. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  13961. val
  13962. )
  13963. ) + "px";
  13964. }
  13965. jQuery.extend( {
  13966. // Add in style property hooks for overriding the default
  13967. // behavior of getting and setting a style property
  13968. cssHooks: {
  13969. opacity: {
  13970. get: function( elem, computed ) {
  13971. if ( computed ) {
  13972. // We should always get a number back from opacity
  13973. var ret = curCSS( elem, "opacity" );
  13974. return ret === "" ? "1" : ret;
  13975. }
  13976. }
  13977. }
  13978. },
  13979. // Don't automatically add "px" to these possibly-unitless properties
  13980. cssNumber: {
  13981. "animationIterationCount": true,
  13982. "columnCount": true,
  13983. "fillOpacity": true,
  13984. "flexGrow": true,
  13985. "flexShrink": true,
  13986. "fontWeight": true,
  13987. "gridArea": true,
  13988. "gridColumn": true,
  13989. "gridColumnEnd": true,
  13990. "gridColumnStart": true,
  13991. "gridRow": true,
  13992. "gridRowEnd": true,
  13993. "gridRowStart": true,
  13994. "lineHeight": true,
  13995. "opacity": true,
  13996. "order": true,
  13997. "orphans": true,
  13998. "widows": true,
  13999. "zIndex": true,
  14000. "zoom": true
  14001. },
  14002. // Add in properties whose names you wish to fix before
  14003. // setting or getting the value
  14004. cssProps: {},
  14005. // Get and set the style property on a DOM Node
  14006. style: function( elem, name, value, extra ) {
  14007. // Don't set styles on text and comment nodes
  14008. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  14009. return;
  14010. }
  14011. // Make sure that we're working with the right name
  14012. var ret, type, hooks,
  14013. origName = camelCase( name ),
  14014. isCustomProp = rcustomProp.test( name ),
  14015. style = elem.style;
  14016. // Make sure that we're working with the right name. We don't
  14017. // want to query the value if it is a CSS custom property
  14018. // since they are user-defined.
  14019. if ( !isCustomProp ) {
  14020. name = finalPropName( origName );
  14021. }
  14022. // Gets hook for the prefixed version, then unprefixed version
  14023. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14024. // Check if we're setting a value
  14025. if ( value !== undefined ) {
  14026. type = typeof value;
  14027. // Convert "+=" or "-=" to relative numbers (#7345)
  14028. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  14029. value = adjustCSS( elem, name, ret );
  14030. // Fixes bug #9237
  14031. type = "number";
  14032. }
  14033. // Make sure that null and NaN values aren't set (#7116)
  14034. if ( value == null || value !== value ) {
  14035. return;
  14036. }
  14037. // If a number was passed in, add the unit (except for certain CSS properties)
  14038. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  14039. // "px" to a few hardcoded values.
  14040. if ( type === "number" && !isCustomProp ) {
  14041. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  14042. }
  14043. // background-* props affect original clone's values
  14044. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  14045. style[ name ] = "inherit";
  14046. }
  14047. // If a hook was provided, use that value, otherwise just set the specified value
  14048. if ( !hooks || !( "set" in hooks ) ||
  14049. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  14050. if ( isCustomProp ) {
  14051. style.setProperty( name, value );
  14052. } else {
  14053. style[ name ] = value;
  14054. }
  14055. }
  14056. } else {
  14057. // If a hook was provided get the non-computed value from there
  14058. if ( hooks && "get" in hooks &&
  14059. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  14060. return ret;
  14061. }
  14062. // Otherwise just get the value from the style object
  14063. return style[ name ];
  14064. }
  14065. },
  14066. css: function( elem, name, extra, styles ) {
  14067. var val, num, hooks,
  14068. origName = camelCase( name ),
  14069. isCustomProp = rcustomProp.test( name );
  14070. // Make sure that we're working with the right name. We don't
  14071. // want to modify the value if it is a CSS custom property
  14072. // since they are user-defined.
  14073. if ( !isCustomProp ) {
  14074. name = finalPropName( origName );
  14075. }
  14076. // Try prefixed name followed by the unprefixed name
  14077. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14078. // If a hook was provided get the computed value from there
  14079. if ( hooks && "get" in hooks ) {
  14080. val = hooks.get( elem, true, extra );
  14081. }
  14082. // Otherwise, if a way to get the computed value exists, use that
  14083. if ( val === undefined ) {
  14084. val = curCSS( elem, name, styles );
  14085. }
  14086. // Convert "normal" to computed value
  14087. if ( val === "normal" && name in cssNormalTransform ) {
  14088. val = cssNormalTransform[ name ];
  14089. }
  14090. // Make numeric if forced or a qualifier was provided and val looks numeric
  14091. if ( extra === "" || extra ) {
  14092. num = parseFloat( val );
  14093. return extra === true || isFinite( num ) ? num || 0 : val;
  14094. }
  14095. return val;
  14096. }
  14097. } );
  14098. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  14099. jQuery.cssHooks[ dimension ] = {
  14100. get: function( elem, computed, extra ) {
  14101. if ( computed ) {
  14102. // Certain elements can have dimension info if we invisibly show them
  14103. // but it must have a current display style that would benefit
  14104. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  14105. // Support: Safari 8+
  14106. // Table columns in Safari have non-zero offsetWidth & zero
  14107. // getBoundingClientRect().width unless display is changed.
  14108. // Support: IE <=11 only
  14109. // Running getBoundingClientRect on a disconnected node
  14110. // in IE throws an error.
  14111. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  14112. swap( elem, cssShow, function() {
  14113. return getWidthOrHeight( elem, dimension, extra );
  14114. } ) :
  14115. getWidthOrHeight( elem, dimension, extra );
  14116. }
  14117. },
  14118. set: function( elem, value, extra ) {
  14119. var matches,
  14120. styles = getStyles( elem ),
  14121. // Only read styles.position if the test has a chance to fail
  14122. // to avoid forcing a reflow.
  14123. scrollboxSizeBuggy = !support.scrollboxSize() &&
  14124. styles.position === "absolute",
  14125. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  14126. boxSizingNeeded = scrollboxSizeBuggy || extra,
  14127. isBorderBox = boxSizingNeeded &&
  14128. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14129. subtract = extra ?
  14130. boxModelAdjustment(
  14131. elem,
  14132. dimension,
  14133. extra,
  14134. isBorderBox,
  14135. styles
  14136. ) :
  14137. 0;
  14138. // Account for unreliable border-box dimensions by comparing offset* to computed and
  14139. // faking a content-box to get border and padding (gh-3699)
  14140. if ( isBorderBox && scrollboxSizeBuggy ) {
  14141. subtract -= Math.ceil(
  14142. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14143. parseFloat( styles[ dimension ] ) -
  14144. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  14145. 0.5
  14146. );
  14147. }
  14148. // Convert to pixels if value adjustment is needed
  14149. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  14150. ( matches[ 3 ] || "px" ) !== "px" ) {
  14151. elem.style[ dimension ] = value;
  14152. value = jQuery.css( elem, dimension );
  14153. }
  14154. return setPositiveNumber( elem, value, subtract );
  14155. }
  14156. };
  14157. } );
  14158. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  14159. function( elem, computed ) {
  14160. if ( computed ) {
  14161. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  14162. elem.getBoundingClientRect().left -
  14163. swap( elem, { marginLeft: 0 }, function() {
  14164. return elem.getBoundingClientRect().left;
  14165. } )
  14166. ) + "px";
  14167. }
  14168. }
  14169. );
  14170. // These hooks are used by animate to expand properties
  14171. jQuery.each( {
  14172. margin: "",
  14173. padding: "",
  14174. border: "Width"
  14175. }, function( prefix, suffix ) {
  14176. jQuery.cssHooks[ prefix + suffix ] = {
  14177. expand: function( value ) {
  14178. var i = 0,
  14179. expanded = {},
  14180. // Assumes a single number if not a string
  14181. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  14182. for ( ; i < 4; i++ ) {
  14183. expanded[ prefix + cssExpand[ i ] + suffix ] =
  14184. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  14185. }
  14186. return expanded;
  14187. }
  14188. };
  14189. if ( prefix !== "margin" ) {
  14190. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  14191. }
  14192. } );
  14193. jQuery.fn.extend( {
  14194. css: function( name, value ) {
  14195. return access( this, function( elem, name, value ) {
  14196. var styles, len,
  14197. map = {},
  14198. i = 0;
  14199. if ( Array.isArray( name ) ) {
  14200. styles = getStyles( elem );
  14201. len = name.length;
  14202. for ( ; i < len; i++ ) {
  14203. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  14204. }
  14205. return map;
  14206. }
  14207. return value !== undefined ?
  14208. jQuery.style( elem, name, value ) :
  14209. jQuery.css( elem, name );
  14210. }, name, value, arguments.length > 1 );
  14211. }
  14212. } );
  14213. function Tween( elem, options, prop, end, easing ) {
  14214. return new Tween.prototype.init( elem, options, prop, end, easing );
  14215. }
  14216. jQuery.Tween = Tween;
  14217. Tween.prototype = {
  14218. constructor: Tween,
  14219. init: function( elem, options, prop, end, easing, unit ) {
  14220. this.elem = elem;
  14221. this.prop = prop;
  14222. this.easing = easing || jQuery.easing._default;
  14223. this.options = options;
  14224. this.start = this.now = this.cur();
  14225. this.end = end;
  14226. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  14227. },
  14228. cur: function() {
  14229. var hooks = Tween.propHooks[ this.prop ];
  14230. return hooks && hooks.get ?
  14231. hooks.get( this ) :
  14232. Tween.propHooks._default.get( this );
  14233. },
  14234. run: function( percent ) {
  14235. var eased,
  14236. hooks = Tween.propHooks[ this.prop ];
  14237. if ( this.options.duration ) {
  14238. this.pos = eased = jQuery.easing[ this.easing ](
  14239. percent, this.options.duration * percent, 0, 1, this.options.duration
  14240. );
  14241. } else {
  14242. this.pos = eased = percent;
  14243. }
  14244. this.now = ( this.end - this.start ) * eased + this.start;
  14245. if ( this.options.step ) {
  14246. this.options.step.call( this.elem, this.now, this );
  14247. }
  14248. if ( hooks && hooks.set ) {
  14249. hooks.set( this );
  14250. } else {
  14251. Tween.propHooks._default.set( this );
  14252. }
  14253. return this;
  14254. }
  14255. };
  14256. Tween.prototype.init.prototype = Tween.prototype;
  14257. Tween.propHooks = {
  14258. _default: {
  14259. get: function( tween ) {
  14260. var result;
  14261. // Use a property on the element directly when it is not a DOM element,
  14262. // or when there is no matching style property that exists.
  14263. if ( tween.elem.nodeType !== 1 ||
  14264. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  14265. return tween.elem[ tween.prop ];
  14266. }
  14267. // Passing an empty string as a 3rd parameter to .css will automatically
  14268. // attempt a parseFloat and fallback to a string if the parse fails.
  14269. // Simple values such as "10px" are parsed to Float;
  14270. // complex values such as "rotate(1rad)" are returned as-is.
  14271. result = jQuery.css( tween.elem, tween.prop, "" );
  14272. // Empty strings, null, undefined and "auto" are converted to 0.
  14273. return !result || result === "auto" ? 0 : result;
  14274. },
  14275. set: function( tween ) {
  14276. // Use step hook for back compat.
  14277. // Use cssHook if its there.
  14278. // Use .style if available and use plain properties where available.
  14279. if ( jQuery.fx.step[ tween.prop ] ) {
  14280. jQuery.fx.step[ tween.prop ]( tween );
  14281. } else if ( tween.elem.nodeType === 1 && (
  14282. jQuery.cssHooks[ tween.prop ] ||
  14283. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  14284. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  14285. } else {
  14286. tween.elem[ tween.prop ] = tween.now;
  14287. }
  14288. }
  14289. }
  14290. };
  14291. // Support: IE <=9 only
  14292. // Panic based approach to setting things on disconnected nodes
  14293. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  14294. set: function( tween ) {
  14295. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  14296. tween.elem[ tween.prop ] = tween.now;
  14297. }
  14298. }
  14299. };
  14300. jQuery.easing = {
  14301. linear: function( p ) {
  14302. return p;
  14303. },
  14304. swing: function( p ) {
  14305. return 0.5 - Math.cos( p * Math.PI ) / 2;
  14306. },
  14307. _default: "swing"
  14308. };
  14309. jQuery.fx = Tween.prototype.init;
  14310. // Back compat <1.8 extension point
  14311. jQuery.fx.step = {};
  14312. var
  14313. fxNow, inProgress,
  14314. rfxtypes = /^(?:toggle|show|hide)$/,
  14315. rrun = /queueHooks$/;
  14316. function schedule() {
  14317. if ( inProgress ) {
  14318. if ( document.hidden === false && window.requestAnimationFrame ) {
  14319. window.requestAnimationFrame( schedule );
  14320. } else {
  14321. window.setTimeout( schedule, jQuery.fx.interval );
  14322. }
  14323. jQuery.fx.tick();
  14324. }
  14325. }
  14326. // Animations created synchronously will run synchronously
  14327. function createFxNow() {
  14328. window.setTimeout( function() {
  14329. fxNow = undefined;
  14330. } );
  14331. return ( fxNow = Date.now() );
  14332. }
  14333. // Generate parameters to create a standard animation
  14334. function genFx( type, includeWidth ) {
  14335. var which,
  14336. i = 0,
  14337. attrs = { height: type };
  14338. // If we include width, step value is 1 to do all cssExpand values,
  14339. // otherwise step value is 2 to skip over Left and Right
  14340. includeWidth = includeWidth ? 1 : 0;
  14341. for ( ; i < 4; i += 2 - includeWidth ) {
  14342. which = cssExpand[ i ];
  14343. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  14344. }
  14345. if ( includeWidth ) {
  14346. attrs.opacity = attrs.width = type;
  14347. }
  14348. return attrs;
  14349. }
  14350. function createTween( value, prop, animation ) {
  14351. var tween,
  14352. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  14353. index = 0,
  14354. length = collection.length;
  14355. for ( ; index < length; index++ ) {
  14356. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  14357. // We're done with this property
  14358. return tween;
  14359. }
  14360. }
  14361. }
  14362. function defaultPrefilter( elem, props, opts ) {
  14363. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  14364. isBox = "width" in props || "height" in props,
  14365. anim = this,
  14366. orig = {},
  14367. style = elem.style,
  14368. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  14369. dataShow = dataPriv.get( elem, "fxshow" );
  14370. // Queue-skipping animations hijack the fx hooks
  14371. if ( !opts.queue ) {
  14372. hooks = jQuery._queueHooks( elem, "fx" );
  14373. if ( hooks.unqueued == null ) {
  14374. hooks.unqueued = 0;
  14375. oldfire = hooks.empty.fire;
  14376. hooks.empty.fire = function() {
  14377. if ( !hooks.unqueued ) {
  14378. oldfire();
  14379. }
  14380. };
  14381. }
  14382. hooks.unqueued++;
  14383. anim.always( function() {
  14384. // Ensure the complete handler is called before this completes
  14385. anim.always( function() {
  14386. hooks.unqueued--;
  14387. if ( !jQuery.queue( elem, "fx" ).length ) {
  14388. hooks.empty.fire();
  14389. }
  14390. } );
  14391. } );
  14392. }
  14393. // Detect show/hide animations
  14394. for ( prop in props ) {
  14395. value = props[ prop ];
  14396. if ( rfxtypes.test( value ) ) {
  14397. delete props[ prop ];
  14398. toggle = toggle || value === "toggle";
  14399. if ( value === ( hidden ? "hide" : "show" ) ) {
  14400. // Pretend to be hidden if this is a "show" and
  14401. // there is still data from a stopped show/hide
  14402. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  14403. hidden = true;
  14404. // Ignore all other no-op show/hide data
  14405. } else {
  14406. continue;
  14407. }
  14408. }
  14409. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  14410. }
  14411. }
  14412. // Bail out if this is a no-op like .hide().hide()
  14413. propTween = !jQuery.isEmptyObject( props );
  14414. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  14415. return;
  14416. }
  14417. // Restrict "overflow" and "display" styles during box animations
  14418. if ( isBox && elem.nodeType === 1 ) {
  14419. // Support: IE <=9 - 11, Edge 12 - 15
  14420. // Record all 3 overflow attributes because IE does not infer the shorthand
  14421. // from identically-valued overflowX and overflowY and Edge just mirrors
  14422. // the overflowX value there.
  14423. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  14424. // Identify a display type, preferring old show/hide data over the CSS cascade
  14425. restoreDisplay = dataShow && dataShow.display;
  14426. if ( restoreDisplay == null ) {
  14427. restoreDisplay = dataPriv.get( elem, "display" );
  14428. }
  14429. display = jQuery.css( elem, "display" );
  14430. if ( display === "none" ) {
  14431. if ( restoreDisplay ) {
  14432. display = restoreDisplay;
  14433. } else {
  14434. // Get nonempty value(s) by temporarily forcing visibility
  14435. showHide( [ elem ], true );
  14436. restoreDisplay = elem.style.display || restoreDisplay;
  14437. display = jQuery.css( elem, "display" );
  14438. showHide( [ elem ] );
  14439. }
  14440. }
  14441. // Animate inline elements as inline-block
  14442. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  14443. if ( jQuery.css( elem, "float" ) === "none" ) {
  14444. // Restore the original display value at the end of pure show/hide animations
  14445. if ( !propTween ) {
  14446. anim.done( function() {
  14447. style.display = restoreDisplay;
  14448. } );
  14449. if ( restoreDisplay == null ) {
  14450. display = style.display;
  14451. restoreDisplay = display === "none" ? "" : display;
  14452. }
  14453. }
  14454. style.display = "inline-block";
  14455. }
  14456. }
  14457. }
  14458. if ( opts.overflow ) {
  14459. style.overflow = "hidden";
  14460. anim.always( function() {
  14461. style.overflow = opts.overflow[ 0 ];
  14462. style.overflowX = opts.overflow[ 1 ];
  14463. style.overflowY = opts.overflow[ 2 ];
  14464. } );
  14465. }
  14466. // Implement show/hide animations
  14467. propTween = false;
  14468. for ( prop in orig ) {
  14469. // General show/hide setup for this element animation
  14470. if ( !propTween ) {
  14471. if ( dataShow ) {
  14472. if ( "hidden" in dataShow ) {
  14473. hidden = dataShow.hidden;
  14474. }
  14475. } else {
  14476. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  14477. }
  14478. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  14479. if ( toggle ) {
  14480. dataShow.hidden = !hidden;
  14481. }
  14482. // Show elements before animating them
  14483. if ( hidden ) {
  14484. showHide( [ elem ], true );
  14485. }
  14486. /* eslint-disable no-loop-func */
  14487. anim.done( function() {
  14488. /* eslint-enable no-loop-func */
  14489. // The final step of a "hide" animation is actually hiding the element
  14490. if ( !hidden ) {
  14491. showHide( [ elem ] );
  14492. }
  14493. dataPriv.remove( elem, "fxshow" );
  14494. for ( prop in orig ) {
  14495. jQuery.style( elem, prop, orig[ prop ] );
  14496. }
  14497. } );
  14498. }
  14499. // Per-property setup
  14500. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  14501. if ( !( prop in dataShow ) ) {
  14502. dataShow[ prop ] = propTween.start;
  14503. if ( hidden ) {
  14504. propTween.end = propTween.start;
  14505. propTween.start = 0;
  14506. }
  14507. }
  14508. }
  14509. }
  14510. function propFilter( props, specialEasing ) {
  14511. var index, name, easing, value, hooks;
  14512. // camelCase, specialEasing and expand cssHook pass
  14513. for ( index in props ) {
  14514. name = camelCase( index );
  14515. easing = specialEasing[ name ];
  14516. value = props[ index ];
  14517. if ( Array.isArray( value ) ) {
  14518. easing = value[ 1 ];
  14519. value = props[ index ] = value[ 0 ];
  14520. }
  14521. if ( index !== name ) {
  14522. props[ name ] = value;
  14523. delete props[ index ];
  14524. }
  14525. hooks = jQuery.cssHooks[ name ];
  14526. if ( hooks && "expand" in hooks ) {
  14527. value = hooks.expand( value );
  14528. delete props[ name ];
  14529. // Not quite $.extend, this won't overwrite existing keys.
  14530. // Reusing 'index' because we have the correct "name"
  14531. for ( index in value ) {
  14532. if ( !( index in props ) ) {
  14533. props[ index ] = value[ index ];
  14534. specialEasing[ index ] = easing;
  14535. }
  14536. }
  14537. } else {
  14538. specialEasing[ name ] = easing;
  14539. }
  14540. }
  14541. }
  14542. function Animation( elem, properties, options ) {
  14543. var result,
  14544. stopped,
  14545. index = 0,
  14546. length = Animation.prefilters.length,
  14547. deferred = jQuery.Deferred().always( function() {
  14548. // Don't match elem in the :animated selector
  14549. delete tick.elem;
  14550. } ),
  14551. tick = function() {
  14552. if ( stopped ) {
  14553. return false;
  14554. }
  14555. var currentTime = fxNow || createFxNow(),
  14556. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  14557. // Support: Android 2.3 only
  14558. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  14559. temp = remaining / animation.duration || 0,
  14560. percent = 1 - temp,
  14561. index = 0,
  14562. length = animation.tweens.length;
  14563. for ( ; index < length; index++ ) {
  14564. animation.tweens[ index ].run( percent );
  14565. }
  14566. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  14567. // If there's more to do, yield
  14568. if ( percent < 1 && length ) {
  14569. return remaining;
  14570. }
  14571. // If this was an empty animation, synthesize a final progress notification
  14572. if ( !length ) {
  14573. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14574. }
  14575. // Resolve the animation and report its conclusion
  14576. deferred.resolveWith( elem, [ animation ] );
  14577. return false;
  14578. },
  14579. animation = deferred.promise( {
  14580. elem: elem,
  14581. props: jQuery.extend( {}, properties ),
  14582. opts: jQuery.extend( true, {
  14583. specialEasing: {},
  14584. easing: jQuery.easing._default
  14585. }, options ),
  14586. originalProperties: properties,
  14587. originalOptions: options,
  14588. startTime: fxNow || createFxNow(),
  14589. duration: options.duration,
  14590. tweens: [],
  14591. createTween: function( prop, end ) {
  14592. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  14593. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  14594. animation.tweens.push( tween );
  14595. return tween;
  14596. },
  14597. stop: function( gotoEnd ) {
  14598. var index = 0,
  14599. // If we are going to the end, we want to run all the tweens
  14600. // otherwise we skip this part
  14601. length = gotoEnd ? animation.tweens.length : 0;
  14602. if ( stopped ) {
  14603. return this;
  14604. }
  14605. stopped = true;
  14606. for ( ; index < length; index++ ) {
  14607. animation.tweens[ index ].run( 1 );
  14608. }
  14609. // Resolve when we played the last frame; otherwise, reject
  14610. if ( gotoEnd ) {
  14611. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14612. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  14613. } else {
  14614. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  14615. }
  14616. return this;
  14617. }
  14618. } ),
  14619. props = animation.props;
  14620. propFilter( props, animation.opts.specialEasing );
  14621. for ( ; index < length; index++ ) {
  14622. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  14623. if ( result ) {
  14624. if ( isFunction( result.stop ) ) {
  14625. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  14626. result.stop.bind( result );
  14627. }
  14628. return result;
  14629. }
  14630. }
  14631. jQuery.map( props, createTween, animation );
  14632. if ( isFunction( animation.opts.start ) ) {
  14633. animation.opts.start.call( elem, animation );
  14634. }
  14635. // Attach callbacks from options
  14636. animation
  14637. .progress( animation.opts.progress )
  14638. .done( animation.opts.done, animation.opts.complete )
  14639. .fail( animation.opts.fail )
  14640. .always( animation.opts.always );
  14641. jQuery.fx.timer(
  14642. jQuery.extend( tick, {
  14643. elem: elem,
  14644. anim: animation,
  14645. queue: animation.opts.queue
  14646. } )
  14647. );
  14648. return animation;
  14649. }
  14650. jQuery.Animation = jQuery.extend( Animation, {
  14651. tweeners: {
  14652. "*": [ function( prop, value ) {
  14653. var tween = this.createTween( prop, value );
  14654. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  14655. return tween;
  14656. } ]
  14657. },
  14658. tweener: function( props, callback ) {
  14659. if ( isFunction( props ) ) {
  14660. callback = props;
  14661. props = [ "*" ];
  14662. } else {
  14663. props = props.match( rnothtmlwhite );
  14664. }
  14665. var prop,
  14666. index = 0,
  14667. length = props.length;
  14668. for ( ; index < length; index++ ) {
  14669. prop = props[ index ];
  14670. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  14671. Animation.tweeners[ prop ].unshift( callback );
  14672. }
  14673. },
  14674. prefilters: [ defaultPrefilter ],
  14675. prefilter: function( callback, prepend ) {
  14676. if ( prepend ) {
  14677. Animation.prefilters.unshift( callback );
  14678. } else {
  14679. Animation.prefilters.push( callback );
  14680. }
  14681. }
  14682. } );
  14683. jQuery.speed = function( speed, easing, fn ) {
  14684. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  14685. complete: fn || !fn && easing ||
  14686. isFunction( speed ) && speed,
  14687. duration: speed,
  14688. easing: fn && easing || easing && !isFunction( easing ) && easing
  14689. };
  14690. // Go to the end state if fx are off
  14691. if ( jQuery.fx.off ) {
  14692. opt.duration = 0;
  14693. } else {
  14694. if ( typeof opt.duration !== "number" ) {
  14695. if ( opt.duration in jQuery.fx.speeds ) {
  14696. opt.duration = jQuery.fx.speeds[ opt.duration ];
  14697. } else {
  14698. opt.duration = jQuery.fx.speeds._default;
  14699. }
  14700. }
  14701. }
  14702. // Normalize opt.queue - true/undefined/null -> "fx"
  14703. if ( opt.queue == null || opt.queue === true ) {
  14704. opt.queue = "fx";
  14705. }
  14706. // Queueing
  14707. opt.old = opt.complete;
  14708. opt.complete = function() {
  14709. if ( isFunction( opt.old ) ) {
  14710. opt.old.call( this );
  14711. }
  14712. if ( opt.queue ) {
  14713. jQuery.dequeue( this, opt.queue );
  14714. }
  14715. };
  14716. return opt;
  14717. };
  14718. jQuery.fn.extend( {
  14719. fadeTo: function( speed, to, easing, callback ) {
  14720. // Show any hidden elements after setting opacity to 0
  14721. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  14722. // Animate to the value specified
  14723. .end().animate( { opacity: to }, speed, easing, callback );
  14724. },
  14725. animate: function( prop, speed, easing, callback ) {
  14726. var empty = jQuery.isEmptyObject( prop ),
  14727. optall = jQuery.speed( speed, easing, callback ),
  14728. doAnimation = function() {
  14729. // Operate on a copy of prop so per-property easing won't be lost
  14730. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  14731. // Empty animations, or finishing resolves immediately
  14732. if ( empty || dataPriv.get( this, "finish" ) ) {
  14733. anim.stop( true );
  14734. }
  14735. };
  14736. doAnimation.finish = doAnimation;
  14737. return empty || optall.queue === false ?
  14738. this.each( doAnimation ) :
  14739. this.queue( optall.queue, doAnimation );
  14740. },
  14741. stop: function( type, clearQueue, gotoEnd ) {
  14742. var stopQueue = function( hooks ) {
  14743. var stop = hooks.stop;
  14744. delete hooks.stop;
  14745. stop( gotoEnd );
  14746. };
  14747. if ( typeof type !== "string" ) {
  14748. gotoEnd = clearQueue;
  14749. clearQueue = type;
  14750. type = undefined;
  14751. }
  14752. if ( clearQueue && type !== false ) {
  14753. this.queue( type || "fx", [] );
  14754. }
  14755. return this.each( function() {
  14756. var dequeue = true,
  14757. index = type != null && type + "queueHooks",
  14758. timers = jQuery.timers,
  14759. data = dataPriv.get( this );
  14760. if ( index ) {
  14761. if ( data[ index ] && data[ index ].stop ) {
  14762. stopQueue( data[ index ] );
  14763. }
  14764. } else {
  14765. for ( index in data ) {
  14766. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  14767. stopQueue( data[ index ] );
  14768. }
  14769. }
  14770. }
  14771. for ( index = timers.length; index--; ) {
  14772. if ( timers[ index ].elem === this &&
  14773. ( type == null || timers[ index ].queue === type ) ) {
  14774. timers[ index ].anim.stop( gotoEnd );
  14775. dequeue = false;
  14776. timers.splice( index, 1 );
  14777. }
  14778. }
  14779. // Start the next in the queue if the last step wasn't forced.
  14780. // Timers currently will call their complete callbacks, which
  14781. // will dequeue but only if they were gotoEnd.
  14782. if ( dequeue || !gotoEnd ) {
  14783. jQuery.dequeue( this, type );
  14784. }
  14785. } );
  14786. },
  14787. finish: function( type ) {
  14788. if ( type !== false ) {
  14789. type = type || "fx";
  14790. }
  14791. return this.each( function() {
  14792. var index,
  14793. data = dataPriv.get( this ),
  14794. queue = data[ type + "queue" ],
  14795. hooks = data[ type + "queueHooks" ],
  14796. timers = jQuery.timers,
  14797. length = queue ? queue.length : 0;
  14798. // Enable finishing flag on private data
  14799. data.finish = true;
  14800. // Empty the queue first
  14801. jQuery.queue( this, type, [] );
  14802. if ( hooks && hooks.stop ) {
  14803. hooks.stop.call( this, true );
  14804. }
  14805. // Look for any active animations, and finish them
  14806. for ( index = timers.length; index--; ) {
  14807. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  14808. timers[ index ].anim.stop( true );
  14809. timers.splice( index, 1 );
  14810. }
  14811. }
  14812. // Look for any animations in the old queue and finish them
  14813. for ( index = 0; index < length; index++ ) {
  14814. if ( queue[ index ] && queue[ index ].finish ) {
  14815. queue[ index ].finish.call( this );
  14816. }
  14817. }
  14818. // Turn off finishing flag
  14819. delete data.finish;
  14820. } );
  14821. }
  14822. } );
  14823. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  14824. var cssFn = jQuery.fn[ name ];
  14825. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14826. return speed == null || typeof speed === "boolean" ?
  14827. cssFn.apply( this, arguments ) :
  14828. this.animate( genFx( name, true ), speed, easing, callback );
  14829. };
  14830. } );
  14831. // Generate shortcuts for custom animations
  14832. jQuery.each( {
  14833. slideDown: genFx( "show" ),
  14834. slideUp: genFx( "hide" ),
  14835. slideToggle: genFx( "toggle" ),
  14836. fadeIn: { opacity: "show" },
  14837. fadeOut: { opacity: "hide" },
  14838. fadeToggle: { opacity: "toggle" }
  14839. }, function( name, props ) {
  14840. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14841. return this.animate( props, speed, easing, callback );
  14842. };
  14843. } );
  14844. jQuery.timers = [];
  14845. jQuery.fx.tick = function() {
  14846. var timer,
  14847. i = 0,
  14848. timers = jQuery.timers;
  14849. fxNow = Date.now();
  14850. for ( ; i < timers.length; i++ ) {
  14851. timer = timers[ i ];
  14852. // Run the timer and safely remove it when done (allowing for external removal)
  14853. if ( !timer() && timers[ i ] === timer ) {
  14854. timers.splice( i--, 1 );
  14855. }
  14856. }
  14857. if ( !timers.length ) {
  14858. jQuery.fx.stop();
  14859. }
  14860. fxNow = undefined;
  14861. };
  14862. jQuery.fx.timer = function( timer ) {
  14863. jQuery.timers.push( timer );
  14864. jQuery.fx.start();
  14865. };
  14866. jQuery.fx.interval = 13;
  14867. jQuery.fx.start = function() {
  14868. if ( inProgress ) {
  14869. return;
  14870. }
  14871. inProgress = true;
  14872. schedule();
  14873. };
  14874. jQuery.fx.stop = function() {
  14875. inProgress = null;
  14876. };
  14877. jQuery.fx.speeds = {
  14878. slow: 600,
  14879. fast: 200,
  14880. // Default speed
  14881. _default: 400
  14882. };
  14883. // Based off of the plugin by Clint Helfers, with permission.
  14884. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  14885. jQuery.fn.delay = function( time, type ) {
  14886. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  14887. type = type || "fx";
  14888. return this.queue( type, function( next, hooks ) {
  14889. var timeout = window.setTimeout( next, time );
  14890. hooks.stop = function() {
  14891. window.clearTimeout( timeout );
  14892. };
  14893. } );
  14894. };
  14895. ( function() {
  14896. var input = document.createElement( "input" ),
  14897. select = document.createElement( "select" ),
  14898. opt = select.appendChild( document.createElement( "option" ) );
  14899. input.type = "checkbox";
  14900. // Support: Android <=4.3 only
  14901. // Default value for a checkbox should be "on"
  14902. support.checkOn = input.value !== "";
  14903. // Support: IE <=11 only
  14904. // Must access selectedIndex to make default options select
  14905. support.optSelected = opt.selected;
  14906. // Support: IE <=11 only
  14907. // An input loses its value after becoming a radio
  14908. input = document.createElement( "input" );
  14909. input.value = "t";
  14910. input.type = "radio";
  14911. support.radioValue = input.value === "t";
  14912. } )();
  14913. var boolHook,
  14914. attrHandle = jQuery.expr.attrHandle;
  14915. jQuery.fn.extend( {
  14916. attr: function( name, value ) {
  14917. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  14918. },
  14919. removeAttr: function( name ) {
  14920. return this.each( function() {
  14921. jQuery.removeAttr( this, name );
  14922. } );
  14923. }
  14924. } );
  14925. jQuery.extend( {
  14926. attr: function( elem, name, value ) {
  14927. var ret, hooks,
  14928. nType = elem.nodeType;
  14929. // Don't get/set attributes on text, comment and attribute nodes
  14930. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14931. return;
  14932. }
  14933. // Fallback to prop when attributes are not supported
  14934. if ( typeof elem.getAttribute === "undefined" ) {
  14935. return jQuery.prop( elem, name, value );
  14936. }
  14937. // Attribute hooks are determined by the lowercase version
  14938. // Grab necessary hook if one is defined
  14939. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14940. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  14941. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  14942. }
  14943. if ( value !== undefined ) {
  14944. if ( value === null ) {
  14945. jQuery.removeAttr( elem, name );
  14946. return;
  14947. }
  14948. if ( hooks && "set" in hooks &&
  14949. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14950. return ret;
  14951. }
  14952. elem.setAttribute( name, value + "" );
  14953. return value;
  14954. }
  14955. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  14956. return ret;
  14957. }
  14958. ret = jQuery.find.attr( elem, name );
  14959. // Non-existent attributes return null, we normalize to undefined
  14960. return ret == null ? undefined : ret;
  14961. },
  14962. attrHooks: {
  14963. type: {
  14964. set: function( elem, value ) {
  14965. if ( !support.radioValue && value === "radio" &&
  14966. nodeName( elem, "input" ) ) {
  14967. var val = elem.value;
  14968. elem.setAttribute( "type", value );
  14969. if ( val ) {
  14970. elem.value = val;
  14971. }
  14972. return value;
  14973. }
  14974. }
  14975. }
  14976. },
  14977. removeAttr: function( elem, value ) {
  14978. var name,
  14979. i = 0,
  14980. // Attribute names can contain non-HTML whitespace characters
  14981. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  14982. attrNames = value && value.match( rnothtmlwhite );
  14983. if ( attrNames && elem.nodeType === 1 ) {
  14984. while ( ( name = attrNames[ i++ ] ) ) {
  14985. elem.removeAttribute( name );
  14986. }
  14987. }
  14988. }
  14989. } );
  14990. // Hooks for boolean attributes
  14991. boolHook = {
  14992. set: function( elem, value, name ) {
  14993. if ( value === false ) {
  14994. // Remove boolean attributes when set to false
  14995. jQuery.removeAttr( elem, name );
  14996. } else {
  14997. elem.setAttribute( name, name );
  14998. }
  14999. return name;
  15000. }
  15001. };
  15002. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  15003. var getter = attrHandle[ name ] || jQuery.find.attr;
  15004. attrHandle[ name ] = function( elem, name, isXML ) {
  15005. var ret, handle,
  15006. lowercaseName = name.toLowerCase();
  15007. if ( !isXML ) {
  15008. // Avoid an infinite loop by temporarily removing this function from the getter
  15009. handle = attrHandle[ lowercaseName ];
  15010. attrHandle[ lowercaseName ] = ret;
  15011. ret = getter( elem, name, isXML ) != null ?
  15012. lowercaseName :
  15013. null;
  15014. attrHandle[ lowercaseName ] = handle;
  15015. }
  15016. return ret;
  15017. };
  15018. } );
  15019. var rfocusable = /^(?:input|select|textarea|button)$/i,
  15020. rclickable = /^(?:a|area)$/i;
  15021. jQuery.fn.extend( {
  15022. prop: function( name, value ) {
  15023. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  15024. },
  15025. removeProp: function( name ) {
  15026. return this.each( function() {
  15027. delete this[ jQuery.propFix[ name ] || name ];
  15028. } );
  15029. }
  15030. } );
  15031. jQuery.extend( {
  15032. prop: function( elem, name, value ) {
  15033. var ret, hooks,
  15034. nType = elem.nodeType;
  15035. // Don't get/set properties on text, comment and attribute nodes
  15036. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15037. return;
  15038. }
  15039. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15040. // Fix name and attach hooks
  15041. name = jQuery.propFix[ name ] || name;
  15042. hooks = jQuery.propHooks[ name ];
  15043. }
  15044. if ( value !== undefined ) {
  15045. if ( hooks && "set" in hooks &&
  15046. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15047. return ret;
  15048. }
  15049. return ( elem[ name ] = value );
  15050. }
  15051. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15052. return ret;
  15053. }
  15054. return elem[ name ];
  15055. },
  15056. propHooks: {
  15057. tabIndex: {
  15058. get: function( elem ) {
  15059. // Support: IE <=9 - 11 only
  15060. // elem.tabIndex doesn't always return the
  15061. // correct value when it hasn't been explicitly set
  15062. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  15063. // Use proper attribute retrieval(#12072)
  15064. var tabindex = jQuery.find.attr( elem, "tabindex" );
  15065. if ( tabindex ) {
  15066. return parseInt( tabindex, 10 );
  15067. }
  15068. if (
  15069. rfocusable.test( elem.nodeName ) ||
  15070. rclickable.test( elem.nodeName ) &&
  15071. elem.href
  15072. ) {
  15073. return 0;
  15074. }
  15075. return -1;
  15076. }
  15077. }
  15078. },
  15079. propFix: {
  15080. "for": "htmlFor",
  15081. "class": "className"
  15082. }
  15083. } );
  15084. // Support: IE <=11 only
  15085. // Accessing the selectedIndex property
  15086. // forces the browser to respect setting selected
  15087. // on the option
  15088. // The getter ensures a default option is selected
  15089. // when in an optgroup
  15090. // eslint rule "no-unused-expressions" is disabled for this code
  15091. // since it considers such accessions noop
  15092. if ( !support.optSelected ) {
  15093. jQuery.propHooks.selected = {
  15094. get: function( elem ) {
  15095. /* eslint no-unused-expressions: "off" */
  15096. var parent = elem.parentNode;
  15097. if ( parent && parent.parentNode ) {
  15098. parent.parentNode.selectedIndex;
  15099. }
  15100. return null;
  15101. },
  15102. set: function( elem ) {
  15103. /* eslint no-unused-expressions: "off" */
  15104. var parent = elem.parentNode;
  15105. if ( parent ) {
  15106. parent.selectedIndex;
  15107. if ( parent.parentNode ) {
  15108. parent.parentNode.selectedIndex;
  15109. }
  15110. }
  15111. }
  15112. };
  15113. }
  15114. jQuery.each( [
  15115. "tabIndex",
  15116. "readOnly",
  15117. "maxLength",
  15118. "cellSpacing",
  15119. "cellPadding",
  15120. "rowSpan",
  15121. "colSpan",
  15122. "useMap",
  15123. "frameBorder",
  15124. "contentEditable"
  15125. ], function() {
  15126. jQuery.propFix[ this.toLowerCase() ] = this;
  15127. } );
  15128. // Strip and collapse whitespace according to HTML spec
  15129. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  15130. function stripAndCollapse( value ) {
  15131. var tokens = value.match( rnothtmlwhite ) || [];
  15132. return tokens.join( " " );
  15133. }
  15134. function getClass( elem ) {
  15135. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  15136. }
  15137. function classesToArray( value ) {
  15138. if ( Array.isArray( value ) ) {
  15139. return value;
  15140. }
  15141. if ( typeof value === "string" ) {
  15142. return value.match( rnothtmlwhite ) || [];
  15143. }
  15144. return [];
  15145. }
  15146. jQuery.fn.extend( {
  15147. addClass: function( value ) {
  15148. var classes, elem, cur, curValue, clazz, j, finalValue,
  15149. i = 0;
  15150. if ( isFunction( value ) ) {
  15151. return this.each( function( j ) {
  15152. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  15153. } );
  15154. }
  15155. classes = classesToArray( value );
  15156. if ( classes.length ) {
  15157. while ( ( elem = this[ i++ ] ) ) {
  15158. curValue = getClass( elem );
  15159. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15160. if ( cur ) {
  15161. j = 0;
  15162. while ( ( clazz = classes[ j++ ] ) ) {
  15163. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  15164. cur += clazz + " ";
  15165. }
  15166. }
  15167. // Only assign if different to avoid unneeded rendering.
  15168. finalValue = stripAndCollapse( cur );
  15169. if ( curValue !== finalValue ) {
  15170. elem.setAttribute( "class", finalValue );
  15171. }
  15172. }
  15173. }
  15174. }
  15175. return this;
  15176. },
  15177. removeClass: function( value ) {
  15178. var classes, elem, cur, curValue, clazz, j, finalValue,
  15179. i = 0;
  15180. if ( isFunction( value ) ) {
  15181. return this.each( function( j ) {
  15182. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  15183. } );
  15184. }
  15185. if ( !arguments.length ) {
  15186. return this.attr( "class", "" );
  15187. }
  15188. classes = classesToArray( value );
  15189. if ( classes.length ) {
  15190. while ( ( elem = this[ i++ ] ) ) {
  15191. curValue = getClass( elem );
  15192. // This expression is here for better compressibility (see addClass)
  15193. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15194. if ( cur ) {
  15195. j = 0;
  15196. while ( ( clazz = classes[ j++ ] ) ) {
  15197. // Remove *all* instances
  15198. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  15199. cur = cur.replace( " " + clazz + " ", " " );
  15200. }
  15201. }
  15202. // Only assign if different to avoid unneeded rendering.
  15203. finalValue = stripAndCollapse( cur );
  15204. if ( curValue !== finalValue ) {
  15205. elem.setAttribute( "class", finalValue );
  15206. }
  15207. }
  15208. }
  15209. }
  15210. return this;
  15211. },
  15212. toggleClass: function( value, stateVal ) {
  15213. var type = typeof value,
  15214. isValidValue = type === "string" || Array.isArray( value );
  15215. if ( typeof stateVal === "boolean" && isValidValue ) {
  15216. return stateVal ? this.addClass( value ) : this.removeClass( value );
  15217. }
  15218. if ( isFunction( value ) ) {
  15219. return this.each( function( i ) {
  15220. jQuery( this ).toggleClass(
  15221. value.call( this, i, getClass( this ), stateVal ),
  15222. stateVal
  15223. );
  15224. } );
  15225. }
  15226. return this.each( function() {
  15227. var className, i, self, classNames;
  15228. if ( isValidValue ) {
  15229. // Toggle individual class names
  15230. i = 0;
  15231. self = jQuery( this );
  15232. classNames = classesToArray( value );
  15233. while ( ( className = classNames[ i++ ] ) ) {
  15234. // Check each className given, space separated list
  15235. if ( self.hasClass( className ) ) {
  15236. self.removeClass( className );
  15237. } else {
  15238. self.addClass( className );
  15239. }
  15240. }
  15241. // Toggle whole class name
  15242. } else if ( value === undefined || type === "boolean" ) {
  15243. className = getClass( this );
  15244. if ( className ) {
  15245. // Store className if set
  15246. dataPriv.set( this, "__className__", className );
  15247. }
  15248. // If the element has a class name or if we're passed `false`,
  15249. // then remove the whole classname (if there was one, the above saved it).
  15250. // Otherwise bring back whatever was previously saved (if anything),
  15251. // falling back to the empty string if nothing was stored.
  15252. if ( this.setAttribute ) {
  15253. this.setAttribute( "class",
  15254. className || value === false ?
  15255. "" :
  15256. dataPriv.get( this, "__className__" ) || ""
  15257. );
  15258. }
  15259. }
  15260. } );
  15261. },
  15262. hasClass: function( selector ) {
  15263. var className, elem,
  15264. i = 0;
  15265. className = " " + selector + " ";
  15266. while ( ( elem = this[ i++ ] ) ) {
  15267. if ( elem.nodeType === 1 &&
  15268. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  15269. return true;
  15270. }
  15271. }
  15272. return false;
  15273. }
  15274. } );
  15275. var rreturn = /\r/g;
  15276. jQuery.fn.extend( {
  15277. val: function( value ) {
  15278. var hooks, ret, valueIsFunction,
  15279. elem = this[ 0 ];
  15280. if ( !arguments.length ) {
  15281. if ( elem ) {
  15282. hooks = jQuery.valHooks[ elem.type ] ||
  15283. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  15284. if ( hooks &&
  15285. "get" in hooks &&
  15286. ( ret = hooks.get( elem, "value" ) ) !== undefined
  15287. ) {
  15288. return ret;
  15289. }
  15290. ret = elem.value;
  15291. // Handle most common string cases
  15292. if ( typeof ret === "string" ) {
  15293. return ret.replace( rreturn, "" );
  15294. }
  15295. // Handle cases where value is null/undef or number
  15296. return ret == null ? "" : ret;
  15297. }
  15298. return;
  15299. }
  15300. valueIsFunction = isFunction( value );
  15301. return this.each( function( i ) {
  15302. var val;
  15303. if ( this.nodeType !== 1 ) {
  15304. return;
  15305. }
  15306. if ( valueIsFunction ) {
  15307. val = value.call( this, i, jQuery( this ).val() );
  15308. } else {
  15309. val = value;
  15310. }
  15311. // Treat null/undefined as ""; convert numbers to string
  15312. if ( val == null ) {
  15313. val = "";
  15314. } else if ( typeof val === "number" ) {
  15315. val += "";
  15316. } else if ( Array.isArray( val ) ) {
  15317. val = jQuery.map( val, function( value ) {
  15318. return value == null ? "" : value + "";
  15319. } );
  15320. }
  15321. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  15322. // If set returns undefined, fall back to normal setting
  15323. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  15324. this.value = val;
  15325. }
  15326. } );
  15327. }
  15328. } );
  15329. jQuery.extend( {
  15330. valHooks: {
  15331. option: {
  15332. get: function( elem ) {
  15333. var val = jQuery.find.attr( elem, "value" );
  15334. return val != null ?
  15335. val :
  15336. // Support: IE <=10 - 11 only
  15337. // option.text throws exceptions (#14686, #14858)
  15338. // Strip and collapse whitespace
  15339. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  15340. stripAndCollapse( jQuery.text( elem ) );
  15341. }
  15342. },
  15343. select: {
  15344. get: function( elem ) {
  15345. var value, option, i,
  15346. options = elem.options,
  15347. index = elem.selectedIndex,
  15348. one = elem.type === "select-one",
  15349. values = one ? null : [],
  15350. max = one ? index + 1 : options.length;
  15351. if ( index < 0 ) {
  15352. i = max;
  15353. } else {
  15354. i = one ? index : 0;
  15355. }
  15356. // Loop through all the selected options
  15357. for ( ; i < max; i++ ) {
  15358. option = options[ i ];
  15359. // Support: IE <=9 only
  15360. // IE8-9 doesn't update selected after form reset (#2551)
  15361. if ( ( option.selected || i === index ) &&
  15362. // Don't return options that are disabled or in a disabled optgroup
  15363. !option.disabled &&
  15364. ( !option.parentNode.disabled ||
  15365. !nodeName( option.parentNode, "optgroup" ) ) ) {
  15366. // Get the specific value for the option
  15367. value = jQuery( option ).val();
  15368. // We don't need an array for one selects
  15369. if ( one ) {
  15370. return value;
  15371. }
  15372. // Multi-Selects return an array
  15373. values.push( value );
  15374. }
  15375. }
  15376. return values;
  15377. },
  15378. set: function( elem, value ) {
  15379. var optionSet, option,
  15380. options = elem.options,
  15381. values = jQuery.makeArray( value ),
  15382. i = options.length;
  15383. while ( i-- ) {
  15384. option = options[ i ];
  15385. /* eslint-disable no-cond-assign */
  15386. if ( option.selected =
  15387. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  15388. ) {
  15389. optionSet = true;
  15390. }
  15391. /* eslint-enable no-cond-assign */
  15392. }
  15393. // Force browsers to behave consistently when non-matching value is set
  15394. if ( !optionSet ) {
  15395. elem.selectedIndex = -1;
  15396. }
  15397. return values;
  15398. }
  15399. }
  15400. }
  15401. } );
  15402. // Radios and checkboxes getter/setter
  15403. jQuery.each( [ "radio", "checkbox" ], function() {
  15404. jQuery.valHooks[ this ] = {
  15405. set: function( elem, value ) {
  15406. if ( Array.isArray( value ) ) {
  15407. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  15408. }
  15409. }
  15410. };
  15411. if ( !support.checkOn ) {
  15412. jQuery.valHooks[ this ].get = function( elem ) {
  15413. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  15414. };
  15415. }
  15416. } );
  15417. // Return jQuery for attributes-only inclusion
  15418. support.focusin = "onfocusin" in window;
  15419. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  15420. stopPropagationCallback = function( e ) {
  15421. e.stopPropagation();
  15422. };
  15423. jQuery.extend( jQuery.event, {
  15424. trigger: function( event, data, elem, onlyHandlers ) {
  15425. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  15426. eventPath = [ elem || document ],
  15427. type = hasOwn.call( event, "type" ) ? event.type : event,
  15428. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  15429. cur = lastElement = tmp = elem = elem || document;
  15430. // Don't do events on text and comment nodes
  15431. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  15432. return;
  15433. }
  15434. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  15435. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  15436. return;
  15437. }
  15438. if ( type.indexOf( "." ) > -1 ) {
  15439. // Namespaced trigger; create a regexp to match event type in handle()
  15440. namespaces = type.split( "." );
  15441. type = namespaces.shift();
  15442. namespaces.sort();
  15443. }
  15444. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  15445. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  15446. event = event[ jQuery.expando ] ?
  15447. event :
  15448. new jQuery.Event( type, typeof event === "object" && event );
  15449. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  15450. event.isTrigger = onlyHandlers ? 2 : 3;
  15451. event.namespace = namespaces.join( "." );
  15452. event.rnamespace = event.namespace ?
  15453. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  15454. null;
  15455. // Clean up the event in case it is being reused
  15456. event.result = undefined;
  15457. if ( !event.target ) {
  15458. event.target = elem;
  15459. }
  15460. // Clone any incoming data and prepend the event, creating the handler arg list
  15461. data = data == null ?
  15462. [ event ] :
  15463. jQuery.makeArray( data, [ event ] );
  15464. // Allow special events to draw outside the lines
  15465. special = jQuery.event.special[ type ] || {};
  15466. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  15467. return;
  15468. }
  15469. // Determine event propagation path in advance, per W3C events spec (#9951)
  15470. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  15471. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  15472. bubbleType = special.delegateType || type;
  15473. if ( !rfocusMorph.test( bubbleType + type ) ) {
  15474. cur = cur.parentNode;
  15475. }
  15476. for ( ; cur; cur = cur.parentNode ) {
  15477. eventPath.push( cur );
  15478. tmp = cur;
  15479. }
  15480. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  15481. if ( tmp === ( elem.ownerDocument || document ) ) {
  15482. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  15483. }
  15484. }
  15485. // Fire handlers on the event path
  15486. i = 0;
  15487. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  15488. lastElement = cur;
  15489. event.type = i > 1 ?
  15490. bubbleType :
  15491. special.bindType || type;
  15492. // jQuery handler
  15493. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  15494. dataPriv.get( cur, "handle" );
  15495. if ( handle ) {
  15496. handle.apply( cur, data );
  15497. }
  15498. // Native handler
  15499. handle = ontype && cur[ ontype ];
  15500. if ( handle && handle.apply && acceptData( cur ) ) {
  15501. event.result = handle.apply( cur, data );
  15502. if ( event.result === false ) {
  15503. event.preventDefault();
  15504. }
  15505. }
  15506. }
  15507. event.type = type;
  15508. // If nobody prevented the default action, do it now
  15509. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  15510. if ( ( !special._default ||
  15511. special._default.apply( eventPath.pop(), data ) === false ) &&
  15512. acceptData( elem ) ) {
  15513. // Call a native DOM method on the target with the same name as the event.
  15514. // Don't do default actions on window, that's where global variables be (#6170)
  15515. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  15516. // Don't re-trigger an onFOO event when we call its FOO() method
  15517. tmp = elem[ ontype ];
  15518. if ( tmp ) {
  15519. elem[ ontype ] = null;
  15520. }
  15521. // Prevent re-triggering of the same event, since we already bubbled it above
  15522. jQuery.event.triggered = type;
  15523. if ( event.isPropagationStopped() ) {
  15524. lastElement.addEventListener( type, stopPropagationCallback );
  15525. }
  15526. elem[ type ]();
  15527. if ( event.isPropagationStopped() ) {
  15528. lastElement.removeEventListener( type, stopPropagationCallback );
  15529. }
  15530. jQuery.event.triggered = undefined;
  15531. if ( tmp ) {
  15532. elem[ ontype ] = tmp;
  15533. }
  15534. }
  15535. }
  15536. }
  15537. return event.result;
  15538. },
  15539. // Piggyback on a donor event to simulate a different one
  15540. // Used only for `focus(in | out)` events
  15541. simulate: function( type, elem, event ) {
  15542. var e = jQuery.extend(
  15543. new jQuery.Event(),
  15544. event,
  15545. {
  15546. type: type,
  15547. isSimulated: true
  15548. }
  15549. );
  15550. jQuery.event.trigger( e, null, elem );
  15551. }
  15552. } );
  15553. jQuery.fn.extend( {
  15554. trigger: function( type, data ) {
  15555. return this.each( function() {
  15556. jQuery.event.trigger( type, data, this );
  15557. } );
  15558. },
  15559. triggerHandler: function( type, data ) {
  15560. var elem = this[ 0 ];
  15561. if ( elem ) {
  15562. return jQuery.event.trigger( type, data, elem, true );
  15563. }
  15564. }
  15565. } );
  15566. // Support: Firefox <=44
  15567. // Firefox doesn't have focus(in | out) events
  15568. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  15569. //
  15570. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  15571. // focus(in | out) events fire after focus & blur events,
  15572. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  15573. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  15574. if ( !support.focusin ) {
  15575. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  15576. // Attach a single capturing handler on the document while someone wants focusin/focusout
  15577. var handler = function( event ) {
  15578. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  15579. };
  15580. jQuery.event.special[ fix ] = {
  15581. setup: function() {
  15582. var doc = this.ownerDocument || this,
  15583. attaches = dataPriv.access( doc, fix );
  15584. if ( !attaches ) {
  15585. doc.addEventListener( orig, handler, true );
  15586. }
  15587. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  15588. },
  15589. teardown: function() {
  15590. var doc = this.ownerDocument || this,
  15591. attaches = dataPriv.access( doc, fix ) - 1;
  15592. if ( !attaches ) {
  15593. doc.removeEventListener( orig, handler, true );
  15594. dataPriv.remove( doc, fix );
  15595. } else {
  15596. dataPriv.access( doc, fix, attaches );
  15597. }
  15598. }
  15599. };
  15600. } );
  15601. }
  15602. var location = window.location;
  15603. var nonce = Date.now();
  15604. var rquery = ( /\?/ );
  15605. // Cross-browser xml parsing
  15606. jQuery.parseXML = function( data ) {
  15607. var xml;
  15608. if ( !data || typeof data !== "string" ) {
  15609. return null;
  15610. }
  15611. // Support: IE 9 - 11 only
  15612. // IE throws on parseFromString with invalid input.
  15613. try {
  15614. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  15615. } catch ( e ) {
  15616. xml = undefined;
  15617. }
  15618. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  15619. jQuery.error( "Invalid XML: " + data );
  15620. }
  15621. return xml;
  15622. };
  15623. var
  15624. rbracket = /\[\]$/,
  15625. rCRLF = /\r?\n/g,
  15626. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  15627. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  15628. function buildParams( prefix, obj, traditional, add ) {
  15629. var name;
  15630. if ( Array.isArray( obj ) ) {
  15631. // Serialize array item.
  15632. jQuery.each( obj, function( i, v ) {
  15633. if ( traditional || rbracket.test( prefix ) ) {
  15634. // Treat each array item as a scalar.
  15635. add( prefix, v );
  15636. } else {
  15637. // Item is non-scalar (array or object), encode its numeric index.
  15638. buildParams(
  15639. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  15640. v,
  15641. traditional,
  15642. add
  15643. );
  15644. }
  15645. } );
  15646. } else if ( !traditional && toType( obj ) === "object" ) {
  15647. // Serialize object item.
  15648. for ( name in obj ) {
  15649. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  15650. }
  15651. } else {
  15652. // Serialize scalar item.
  15653. add( prefix, obj );
  15654. }
  15655. }
  15656. // Serialize an array of form elements or a set of
  15657. // key/values into a query string
  15658. jQuery.param = function( a, traditional ) {
  15659. var prefix,
  15660. s = [],
  15661. add = function( key, valueOrFunction ) {
  15662. // If value is a function, invoke it and use its return value
  15663. var value = isFunction( valueOrFunction ) ?
  15664. valueOrFunction() :
  15665. valueOrFunction;
  15666. s[ s.length ] = encodeURIComponent( key ) + "=" +
  15667. encodeURIComponent( value == null ? "" : value );
  15668. };
  15669. if ( a == null ) {
  15670. return "";
  15671. }
  15672. // If an array was passed in, assume that it is an array of form elements.
  15673. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  15674. // Serialize the form elements
  15675. jQuery.each( a, function() {
  15676. add( this.name, this.value );
  15677. } );
  15678. } else {
  15679. // If traditional, encode the "old" way (the way 1.3.2 or older
  15680. // did it), otherwise encode params recursively.
  15681. for ( prefix in a ) {
  15682. buildParams( prefix, a[ prefix ], traditional, add );
  15683. }
  15684. }
  15685. // Return the resulting serialization
  15686. return s.join( "&" );
  15687. };
  15688. jQuery.fn.extend( {
  15689. serialize: function() {
  15690. return jQuery.param( this.serializeArray() );
  15691. },
  15692. serializeArray: function() {
  15693. return this.map( function() {
  15694. // Can add propHook for "elements" to filter or add form elements
  15695. var elements = jQuery.prop( this, "elements" );
  15696. return elements ? jQuery.makeArray( elements ) : this;
  15697. } )
  15698. .filter( function() {
  15699. var type = this.type;
  15700. // Use .is( ":disabled" ) so that fieldset[disabled] works
  15701. return this.name && !jQuery( this ).is( ":disabled" ) &&
  15702. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  15703. ( this.checked || !rcheckableType.test( type ) );
  15704. } )
  15705. .map( function( i, elem ) {
  15706. var val = jQuery( this ).val();
  15707. if ( val == null ) {
  15708. return null;
  15709. }
  15710. if ( Array.isArray( val ) ) {
  15711. return jQuery.map( val, function( val ) {
  15712. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15713. } );
  15714. }
  15715. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15716. } ).get();
  15717. }
  15718. } );
  15719. var
  15720. r20 = /%20/g,
  15721. rhash = /#.*$/,
  15722. rantiCache = /([?&])_=[^&]*/,
  15723. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  15724. // #7653, #8125, #8152: local protocol detection
  15725. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  15726. rnoContent = /^(?:GET|HEAD)$/,
  15727. rprotocol = /^\/\//,
  15728. /* Prefilters
  15729. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  15730. * 2) These are called:
  15731. * - BEFORE asking for a transport
  15732. * - AFTER param serialization (s.data is a string if s.processData is true)
  15733. * 3) key is the dataType
  15734. * 4) the catchall symbol "*" can be used
  15735. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  15736. */
  15737. prefilters = {},
  15738. /* Transports bindings
  15739. * 1) key is the dataType
  15740. * 2) the catchall symbol "*" can be used
  15741. * 3) selection will start with transport dataType and THEN go to "*" if needed
  15742. */
  15743. transports = {},
  15744. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  15745. allTypes = "*/".concat( "*" ),
  15746. // Anchor tag for parsing the document origin
  15747. originAnchor = document.createElement( "a" );
  15748. originAnchor.href = location.href;
  15749. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  15750. function addToPrefiltersOrTransports( structure ) {
  15751. // dataTypeExpression is optional and defaults to "*"
  15752. return function( dataTypeExpression, func ) {
  15753. if ( typeof dataTypeExpression !== "string" ) {
  15754. func = dataTypeExpression;
  15755. dataTypeExpression = "*";
  15756. }
  15757. var dataType,
  15758. i = 0,
  15759. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  15760. if ( isFunction( func ) ) {
  15761. // For each dataType in the dataTypeExpression
  15762. while ( ( dataType = dataTypes[ i++ ] ) ) {
  15763. // Prepend if requested
  15764. if ( dataType[ 0 ] === "+" ) {
  15765. dataType = dataType.slice( 1 ) || "*";
  15766. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  15767. // Otherwise append
  15768. } else {
  15769. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  15770. }
  15771. }
  15772. }
  15773. };
  15774. }
  15775. // Base inspection function for prefilters and transports
  15776. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  15777. var inspected = {},
  15778. seekingTransport = ( structure === transports );
  15779. function inspect( dataType ) {
  15780. var selected;
  15781. inspected[ dataType ] = true;
  15782. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  15783. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  15784. if ( typeof dataTypeOrTransport === "string" &&
  15785. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  15786. options.dataTypes.unshift( dataTypeOrTransport );
  15787. inspect( dataTypeOrTransport );
  15788. return false;
  15789. } else if ( seekingTransport ) {
  15790. return !( selected = dataTypeOrTransport );
  15791. }
  15792. } );
  15793. return selected;
  15794. }
  15795. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  15796. }
  15797. // A special extend for ajax options
  15798. // that takes "flat" options (not to be deep extended)
  15799. // Fixes #9887
  15800. function ajaxExtend( target, src ) {
  15801. var key, deep,
  15802. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  15803. for ( key in src ) {
  15804. if ( src[ key ] !== undefined ) {
  15805. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  15806. }
  15807. }
  15808. if ( deep ) {
  15809. jQuery.extend( true, target, deep );
  15810. }
  15811. return target;
  15812. }
  15813. /* Handles responses to an ajax request:
  15814. * - finds the right dataType (mediates between content-type and expected dataType)
  15815. * - returns the corresponding response
  15816. */
  15817. function ajaxHandleResponses( s, jqXHR, responses ) {
  15818. var ct, type, finalDataType, firstDataType,
  15819. contents = s.contents,
  15820. dataTypes = s.dataTypes;
  15821. // Remove auto dataType and get content-type in the process
  15822. while ( dataTypes[ 0 ] === "*" ) {
  15823. dataTypes.shift();
  15824. if ( ct === undefined ) {
  15825. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  15826. }
  15827. }
  15828. // Check if we're dealing with a known content-type
  15829. if ( ct ) {
  15830. for ( type in contents ) {
  15831. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  15832. dataTypes.unshift( type );
  15833. break;
  15834. }
  15835. }
  15836. }
  15837. // Check to see if we have a response for the expected dataType
  15838. if ( dataTypes[ 0 ] in responses ) {
  15839. finalDataType = dataTypes[ 0 ];
  15840. } else {
  15841. // Try convertible dataTypes
  15842. for ( type in responses ) {
  15843. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  15844. finalDataType = type;
  15845. break;
  15846. }
  15847. if ( !firstDataType ) {
  15848. firstDataType = type;
  15849. }
  15850. }
  15851. // Or just use first one
  15852. finalDataType = finalDataType || firstDataType;
  15853. }
  15854. // If we found a dataType
  15855. // We add the dataType to the list if needed
  15856. // and return the corresponding response
  15857. if ( finalDataType ) {
  15858. if ( finalDataType !== dataTypes[ 0 ] ) {
  15859. dataTypes.unshift( finalDataType );
  15860. }
  15861. return responses[ finalDataType ];
  15862. }
  15863. }
  15864. /* Chain conversions given the request and the original response
  15865. * Also sets the responseXXX fields on the jqXHR instance
  15866. */
  15867. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  15868. var conv2, current, conv, tmp, prev,
  15869. converters = {},
  15870. // Work with a copy of dataTypes in case we need to modify it for conversion
  15871. dataTypes = s.dataTypes.slice();
  15872. // Create converters map with lowercased keys
  15873. if ( dataTypes[ 1 ] ) {
  15874. for ( conv in s.converters ) {
  15875. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  15876. }
  15877. }
  15878. current = dataTypes.shift();
  15879. // Convert to each sequential dataType
  15880. while ( current ) {
  15881. if ( s.responseFields[ current ] ) {
  15882. jqXHR[ s.responseFields[ current ] ] = response;
  15883. }
  15884. // Apply the dataFilter if provided
  15885. if ( !prev && isSuccess && s.dataFilter ) {
  15886. response = s.dataFilter( response, s.dataType );
  15887. }
  15888. prev = current;
  15889. current = dataTypes.shift();
  15890. if ( current ) {
  15891. // There's only work to do if current dataType is non-auto
  15892. if ( current === "*" ) {
  15893. current = prev;
  15894. // Convert response if prev dataType is non-auto and differs from current
  15895. } else if ( prev !== "*" && prev !== current ) {
  15896. // Seek a direct converter
  15897. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  15898. // If none found, seek a pair
  15899. if ( !conv ) {
  15900. for ( conv2 in converters ) {
  15901. // If conv2 outputs current
  15902. tmp = conv2.split( " " );
  15903. if ( tmp[ 1 ] === current ) {
  15904. // If prev can be converted to accepted input
  15905. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  15906. converters[ "* " + tmp[ 0 ] ];
  15907. if ( conv ) {
  15908. // Condense equivalence converters
  15909. if ( conv === true ) {
  15910. conv = converters[ conv2 ];
  15911. // Otherwise, insert the intermediate dataType
  15912. } else if ( converters[ conv2 ] !== true ) {
  15913. current = tmp[ 0 ];
  15914. dataTypes.unshift( tmp[ 1 ] );
  15915. }
  15916. break;
  15917. }
  15918. }
  15919. }
  15920. }
  15921. // Apply converter (if not an equivalence)
  15922. if ( conv !== true ) {
  15923. // Unless errors are allowed to bubble, catch and return them
  15924. if ( conv && s.throws ) {
  15925. response = conv( response );
  15926. } else {
  15927. try {
  15928. response = conv( response );
  15929. } catch ( e ) {
  15930. return {
  15931. state: "parsererror",
  15932. error: conv ? e : "No conversion from " + prev + " to " + current
  15933. };
  15934. }
  15935. }
  15936. }
  15937. }
  15938. }
  15939. }
  15940. return { state: "success", data: response };
  15941. }
  15942. jQuery.extend( {
  15943. // Counter for holding the number of active queries
  15944. active: 0,
  15945. // Last-Modified header cache for next request
  15946. lastModified: {},
  15947. etag: {},
  15948. ajaxSettings: {
  15949. url: location.href,
  15950. type: "GET",
  15951. isLocal: rlocalProtocol.test( location.protocol ),
  15952. global: true,
  15953. processData: true,
  15954. async: true,
  15955. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  15956. /*
  15957. timeout: 0,
  15958. data: null,
  15959. dataType: null,
  15960. username: null,
  15961. password: null,
  15962. cache: null,
  15963. throws: false,
  15964. traditional: false,
  15965. headers: {},
  15966. */
  15967. accepts: {
  15968. "*": allTypes,
  15969. text: "text/plain",
  15970. html: "text/html",
  15971. xml: "application/xml, text/xml",
  15972. json: "application/json, text/javascript"
  15973. },
  15974. contents: {
  15975. xml: /\bxml\b/,
  15976. html: /\bhtml/,
  15977. json: /\bjson\b/
  15978. },
  15979. responseFields: {
  15980. xml: "responseXML",
  15981. text: "responseText",
  15982. json: "responseJSON"
  15983. },
  15984. // Data converters
  15985. // Keys separate source (or catchall "*") and destination types with a single space
  15986. converters: {
  15987. // Convert anything to text
  15988. "* text": String,
  15989. // Text to html (true = no transformation)
  15990. "text html": true,
  15991. // Evaluate text as a json expression
  15992. "text json": JSON.parse,
  15993. // Parse text as xml
  15994. "text xml": jQuery.parseXML
  15995. },
  15996. // For options that shouldn't be deep extended:
  15997. // you can add your own custom options here if
  15998. // and when you create one that shouldn't be
  15999. // deep extended (see ajaxExtend)
  16000. flatOptions: {
  16001. url: true,
  16002. context: true
  16003. }
  16004. },
  16005. // Creates a full fledged settings object into target
  16006. // with both ajaxSettings and settings fields.
  16007. // If target is omitted, writes into ajaxSettings.
  16008. ajaxSetup: function( target, settings ) {
  16009. return settings ?
  16010. // Building a settings object
  16011. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  16012. // Extending ajaxSettings
  16013. ajaxExtend( jQuery.ajaxSettings, target );
  16014. },
  16015. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  16016. ajaxTransport: addToPrefiltersOrTransports( transports ),
  16017. // Main method
  16018. ajax: function( url, options ) {
  16019. // If url is an object, simulate pre-1.5 signature
  16020. if ( typeof url === "object" ) {
  16021. options = url;
  16022. url = undefined;
  16023. }
  16024. // Force options to be an object
  16025. options = options || {};
  16026. var transport,
  16027. // URL without anti-cache param
  16028. cacheURL,
  16029. // Response headers
  16030. responseHeadersString,
  16031. responseHeaders,
  16032. // timeout handle
  16033. timeoutTimer,
  16034. // Url cleanup var
  16035. urlAnchor,
  16036. // Request state (becomes false upon send and true upon completion)
  16037. completed,
  16038. // To know if global events are to be dispatched
  16039. fireGlobals,
  16040. // Loop variable
  16041. i,
  16042. // uncached part of the url
  16043. uncached,
  16044. // Create the final options object
  16045. s = jQuery.ajaxSetup( {}, options ),
  16046. // Callbacks context
  16047. callbackContext = s.context || s,
  16048. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  16049. globalEventContext = s.context &&
  16050. ( callbackContext.nodeType || callbackContext.jquery ) ?
  16051. jQuery( callbackContext ) :
  16052. jQuery.event,
  16053. // Deferreds
  16054. deferred = jQuery.Deferred(),
  16055. completeDeferred = jQuery.Callbacks( "once memory" ),
  16056. // Status-dependent callbacks
  16057. statusCode = s.statusCode || {},
  16058. // Headers (they are sent all at once)
  16059. requestHeaders = {},
  16060. requestHeadersNames = {},
  16061. // Default abort message
  16062. strAbort = "canceled",
  16063. // Fake xhr
  16064. jqXHR = {
  16065. readyState: 0,
  16066. // Builds headers hashtable if needed
  16067. getResponseHeader: function( key ) {
  16068. var match;
  16069. if ( completed ) {
  16070. if ( !responseHeaders ) {
  16071. responseHeaders = {};
  16072. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  16073. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  16074. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  16075. .concat( match[ 2 ] );
  16076. }
  16077. }
  16078. match = responseHeaders[ key.toLowerCase() + " " ];
  16079. }
  16080. return match == null ? null : match.join( ", " );
  16081. },
  16082. // Raw string
  16083. getAllResponseHeaders: function() {
  16084. return completed ? responseHeadersString : null;
  16085. },
  16086. // Caches the header
  16087. setRequestHeader: function( name, value ) {
  16088. if ( completed == null ) {
  16089. name = requestHeadersNames[ name.toLowerCase() ] =
  16090. requestHeadersNames[ name.toLowerCase() ] || name;
  16091. requestHeaders[ name ] = value;
  16092. }
  16093. return this;
  16094. },
  16095. // Overrides response content-type header
  16096. overrideMimeType: function( type ) {
  16097. if ( completed == null ) {
  16098. s.mimeType = type;
  16099. }
  16100. return this;
  16101. },
  16102. // Status-dependent callbacks
  16103. statusCode: function( map ) {
  16104. var code;
  16105. if ( map ) {
  16106. if ( completed ) {
  16107. // Execute the appropriate callbacks
  16108. jqXHR.always( map[ jqXHR.status ] );
  16109. } else {
  16110. // Lazy-add the new callbacks in a way that preserves old ones
  16111. for ( code in map ) {
  16112. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  16113. }
  16114. }
  16115. }
  16116. return this;
  16117. },
  16118. // Cancel the request
  16119. abort: function( statusText ) {
  16120. var finalText = statusText || strAbort;
  16121. if ( transport ) {
  16122. transport.abort( finalText );
  16123. }
  16124. done( 0, finalText );
  16125. return this;
  16126. }
  16127. };
  16128. // Attach deferreds
  16129. deferred.promise( jqXHR );
  16130. // Add protocol if not provided (prefilters might expect it)
  16131. // Handle falsy url in the settings object (#10093: consistency with old signature)
  16132. // We also use the url parameter if available
  16133. s.url = ( ( url || s.url || location.href ) + "" )
  16134. .replace( rprotocol, location.protocol + "//" );
  16135. // Alias method option to type as per ticket #12004
  16136. s.type = options.method || options.type || s.method || s.type;
  16137. // Extract dataTypes list
  16138. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  16139. // A cross-domain request is in order when the origin doesn't match the current origin.
  16140. if ( s.crossDomain == null ) {
  16141. urlAnchor = document.createElement( "a" );
  16142. // Support: IE <=8 - 11, Edge 12 - 15
  16143. // IE throws exception on accessing the href property if url is malformed,
  16144. // e.g. http://example.com:80x/
  16145. try {
  16146. urlAnchor.href = s.url;
  16147. // Support: IE <=8 - 11 only
  16148. // Anchor's host property isn't correctly set when s.url is relative
  16149. urlAnchor.href = urlAnchor.href;
  16150. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  16151. urlAnchor.protocol + "//" + urlAnchor.host;
  16152. } catch ( e ) {
  16153. // If there is an error parsing the URL, assume it is crossDomain,
  16154. // it can be rejected by the transport if it is invalid
  16155. s.crossDomain = true;
  16156. }
  16157. }
  16158. // Convert data if not already a string
  16159. if ( s.data && s.processData && typeof s.data !== "string" ) {
  16160. s.data = jQuery.param( s.data, s.traditional );
  16161. }
  16162. // Apply prefilters
  16163. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  16164. // If request was aborted inside a prefilter, stop there
  16165. if ( completed ) {
  16166. return jqXHR;
  16167. }
  16168. // We can fire global events as of now if asked to
  16169. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  16170. fireGlobals = jQuery.event && s.global;
  16171. // Watch for a new set of requests
  16172. if ( fireGlobals && jQuery.active++ === 0 ) {
  16173. jQuery.event.trigger( "ajaxStart" );
  16174. }
  16175. // Uppercase the type
  16176. s.type = s.type.toUpperCase();
  16177. // Determine if request has content
  16178. s.hasContent = !rnoContent.test( s.type );
  16179. // Save the URL in case we're toying with the If-Modified-Since
  16180. // and/or If-None-Match header later on
  16181. // Remove hash to simplify url manipulation
  16182. cacheURL = s.url.replace( rhash, "" );
  16183. // More options handling for requests with no content
  16184. if ( !s.hasContent ) {
  16185. // Remember the hash so we can put it back
  16186. uncached = s.url.slice( cacheURL.length );
  16187. // If data is available and should be processed, append data to url
  16188. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  16189. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  16190. // #9682: remove data so that it's not used in an eventual retry
  16191. delete s.data;
  16192. }
  16193. // Add or update anti-cache param if needed
  16194. if ( s.cache === false ) {
  16195. cacheURL = cacheURL.replace( rantiCache, "$1" );
  16196. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  16197. }
  16198. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  16199. s.url = cacheURL + uncached;
  16200. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  16201. } else if ( s.data && s.processData &&
  16202. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  16203. s.data = s.data.replace( r20, "+" );
  16204. }
  16205. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16206. if ( s.ifModified ) {
  16207. if ( jQuery.lastModified[ cacheURL ] ) {
  16208. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  16209. }
  16210. if ( jQuery.etag[ cacheURL ] ) {
  16211. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  16212. }
  16213. }
  16214. // Set the correct header, if data is being sent
  16215. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  16216. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  16217. }
  16218. // Set the Accepts header for the server, depending on the dataType
  16219. jqXHR.setRequestHeader(
  16220. "Accept",
  16221. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  16222. s.accepts[ s.dataTypes[ 0 ] ] +
  16223. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  16224. s.accepts[ "*" ]
  16225. );
  16226. // Check for headers option
  16227. for ( i in s.headers ) {
  16228. jqXHR.setRequestHeader( i, s.headers[ i ] );
  16229. }
  16230. // Allow custom headers/mimetypes and early abort
  16231. if ( s.beforeSend &&
  16232. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  16233. // Abort if not done already and return
  16234. return jqXHR.abort();
  16235. }
  16236. // Aborting is no longer a cancellation
  16237. strAbort = "abort";
  16238. // Install callbacks on deferreds
  16239. completeDeferred.add( s.complete );
  16240. jqXHR.done( s.success );
  16241. jqXHR.fail( s.error );
  16242. // Get transport
  16243. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  16244. // If no transport, we auto-abort
  16245. if ( !transport ) {
  16246. done( -1, "No Transport" );
  16247. } else {
  16248. jqXHR.readyState = 1;
  16249. // Send global event
  16250. if ( fireGlobals ) {
  16251. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  16252. }
  16253. // If request was aborted inside ajaxSend, stop there
  16254. if ( completed ) {
  16255. return jqXHR;
  16256. }
  16257. // Timeout
  16258. if ( s.async && s.timeout > 0 ) {
  16259. timeoutTimer = window.setTimeout( function() {
  16260. jqXHR.abort( "timeout" );
  16261. }, s.timeout );
  16262. }
  16263. try {
  16264. completed = false;
  16265. transport.send( requestHeaders, done );
  16266. } catch ( e ) {
  16267. // Rethrow post-completion exceptions
  16268. if ( completed ) {
  16269. throw e;
  16270. }
  16271. // Propagate others as results
  16272. done( -1, e );
  16273. }
  16274. }
  16275. // Callback for when everything is done
  16276. function done( status, nativeStatusText, responses, headers ) {
  16277. var isSuccess, success, error, response, modified,
  16278. statusText = nativeStatusText;
  16279. // Ignore repeat invocations
  16280. if ( completed ) {
  16281. return;
  16282. }
  16283. completed = true;
  16284. // Clear timeout if it exists
  16285. if ( timeoutTimer ) {
  16286. window.clearTimeout( timeoutTimer );
  16287. }
  16288. // Dereference transport for early garbage collection
  16289. // (no matter how long the jqXHR object will be used)
  16290. transport = undefined;
  16291. // Cache response headers
  16292. responseHeadersString = headers || "";
  16293. // Set readyState
  16294. jqXHR.readyState = status > 0 ? 4 : 0;
  16295. // Determine if successful
  16296. isSuccess = status >= 200 && status < 300 || status === 304;
  16297. // Get response data
  16298. if ( responses ) {
  16299. response = ajaxHandleResponses( s, jqXHR, responses );
  16300. }
  16301. // Convert no matter what (that way responseXXX fields are always set)
  16302. response = ajaxConvert( s, response, jqXHR, isSuccess );
  16303. // If successful, handle type chaining
  16304. if ( isSuccess ) {
  16305. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16306. if ( s.ifModified ) {
  16307. modified = jqXHR.getResponseHeader( "Last-Modified" );
  16308. if ( modified ) {
  16309. jQuery.lastModified[ cacheURL ] = modified;
  16310. }
  16311. modified = jqXHR.getResponseHeader( "etag" );
  16312. if ( modified ) {
  16313. jQuery.etag[ cacheURL ] = modified;
  16314. }
  16315. }
  16316. // if no content
  16317. if ( status === 204 || s.type === "HEAD" ) {
  16318. statusText = "nocontent";
  16319. // if not modified
  16320. } else if ( status === 304 ) {
  16321. statusText = "notmodified";
  16322. // If we have data, let's convert it
  16323. } else {
  16324. statusText = response.state;
  16325. success = response.data;
  16326. error = response.error;
  16327. isSuccess = !error;
  16328. }
  16329. } else {
  16330. // Extract error from statusText and normalize for non-aborts
  16331. error = statusText;
  16332. if ( status || !statusText ) {
  16333. statusText = "error";
  16334. if ( status < 0 ) {
  16335. status = 0;
  16336. }
  16337. }
  16338. }
  16339. // Set data for the fake xhr object
  16340. jqXHR.status = status;
  16341. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  16342. // Success/Error
  16343. if ( isSuccess ) {
  16344. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  16345. } else {
  16346. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  16347. }
  16348. // Status-dependent callbacks
  16349. jqXHR.statusCode( statusCode );
  16350. statusCode = undefined;
  16351. if ( fireGlobals ) {
  16352. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  16353. [ jqXHR, s, isSuccess ? success : error ] );
  16354. }
  16355. // Complete
  16356. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  16357. if ( fireGlobals ) {
  16358. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  16359. // Handle the global AJAX counter
  16360. if ( !( --jQuery.active ) ) {
  16361. jQuery.event.trigger( "ajaxStop" );
  16362. }
  16363. }
  16364. }
  16365. return jqXHR;
  16366. },
  16367. getJSON: function( url, data, callback ) {
  16368. return jQuery.get( url, data, callback, "json" );
  16369. },
  16370. getScript: function( url, callback ) {
  16371. return jQuery.get( url, undefined, callback, "script" );
  16372. }
  16373. } );
  16374. jQuery.each( [ "get", "post" ], function( i, method ) {
  16375. jQuery[ method ] = function( url, data, callback, type ) {
  16376. // Shift arguments if data argument was omitted
  16377. if ( isFunction( data ) ) {
  16378. type = type || callback;
  16379. callback = data;
  16380. data = undefined;
  16381. }
  16382. // The url can be an options object (which then must have .url)
  16383. return jQuery.ajax( jQuery.extend( {
  16384. url: url,
  16385. type: method,
  16386. dataType: type,
  16387. data: data,
  16388. success: callback
  16389. }, jQuery.isPlainObject( url ) && url ) );
  16390. };
  16391. } );
  16392. jQuery._evalUrl = function( url, options ) {
  16393. return jQuery.ajax( {
  16394. url: url,
  16395. // Make this explicit, since user can override this through ajaxSetup (#11264)
  16396. type: "GET",
  16397. dataType: "script",
  16398. cache: true,
  16399. async: false,
  16400. global: false,
  16401. // Only evaluate the response if it is successful (gh-4126)
  16402. // dataFilter is not invoked for failure responses, so using it instead
  16403. // of the default converter is kludgy but it works.
  16404. converters: {
  16405. "text script": function() {}
  16406. },
  16407. dataFilter: function( response ) {
  16408. jQuery.globalEval( response, options );
  16409. }
  16410. } );
  16411. };
  16412. jQuery.fn.extend( {
  16413. wrapAll: function( html ) {
  16414. var wrap;
  16415. if ( this[ 0 ] ) {
  16416. if ( isFunction( html ) ) {
  16417. html = html.call( this[ 0 ] );
  16418. }
  16419. // The elements to wrap the target around
  16420. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  16421. if ( this[ 0 ].parentNode ) {
  16422. wrap.insertBefore( this[ 0 ] );
  16423. }
  16424. wrap.map( function() {
  16425. var elem = this;
  16426. while ( elem.firstElementChild ) {
  16427. elem = elem.firstElementChild;
  16428. }
  16429. return elem;
  16430. } ).append( this );
  16431. }
  16432. return this;
  16433. },
  16434. wrapInner: function( html ) {
  16435. if ( isFunction( html ) ) {
  16436. return this.each( function( i ) {
  16437. jQuery( this ).wrapInner( html.call( this, i ) );
  16438. } );
  16439. }
  16440. return this.each( function() {
  16441. var self = jQuery( this ),
  16442. contents = self.contents();
  16443. if ( contents.length ) {
  16444. contents.wrapAll( html );
  16445. } else {
  16446. self.append( html );
  16447. }
  16448. } );
  16449. },
  16450. wrap: function( html ) {
  16451. var htmlIsFunction = isFunction( html );
  16452. return this.each( function( i ) {
  16453. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  16454. } );
  16455. },
  16456. unwrap: function( selector ) {
  16457. this.parent( selector ).not( "body" ).each( function() {
  16458. jQuery( this ).replaceWith( this.childNodes );
  16459. } );
  16460. return this;
  16461. }
  16462. } );
  16463. jQuery.expr.pseudos.hidden = function( elem ) {
  16464. return !jQuery.expr.pseudos.visible( elem );
  16465. };
  16466. jQuery.expr.pseudos.visible = function( elem ) {
  16467. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  16468. };
  16469. jQuery.ajaxSettings.xhr = function() {
  16470. try {
  16471. return new window.XMLHttpRequest();
  16472. } catch ( e ) {}
  16473. };
  16474. var xhrSuccessStatus = {
  16475. // File protocol always yields status code 0, assume 200
  16476. 0: 200,
  16477. // Support: IE <=9 only
  16478. // #1450: sometimes IE returns 1223 when it should be 204
  16479. 1223: 204
  16480. },
  16481. xhrSupported = jQuery.ajaxSettings.xhr();
  16482. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  16483. support.ajax = xhrSupported = !!xhrSupported;
  16484. jQuery.ajaxTransport( function( options ) {
  16485. var callback, errorCallback;
  16486. // Cross domain only allowed if supported through XMLHttpRequest
  16487. if ( support.cors || xhrSupported && !options.crossDomain ) {
  16488. return {
  16489. send: function( headers, complete ) {
  16490. var i,
  16491. xhr = options.xhr();
  16492. xhr.open(
  16493. options.type,
  16494. options.url,
  16495. options.async,
  16496. options.username,
  16497. options.password
  16498. );
  16499. // Apply custom fields if provided
  16500. if ( options.xhrFields ) {
  16501. for ( i in options.xhrFields ) {
  16502. xhr[ i ] = options.xhrFields[ i ];
  16503. }
  16504. }
  16505. // Override mime type if needed
  16506. if ( options.mimeType && xhr.overrideMimeType ) {
  16507. xhr.overrideMimeType( options.mimeType );
  16508. }
  16509. // X-Requested-With header
  16510. // For cross-domain requests, seeing as conditions for a preflight are
  16511. // akin to a jigsaw puzzle, we simply never set it to be sure.
  16512. // (it can always be set on a per-request basis or even using ajaxSetup)
  16513. // For same-domain requests, won't change header if already provided.
  16514. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  16515. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  16516. }
  16517. // Set headers
  16518. for ( i in headers ) {
  16519. xhr.setRequestHeader( i, headers[ i ] );
  16520. }
  16521. // Callback
  16522. callback = function( type ) {
  16523. return function() {
  16524. if ( callback ) {
  16525. callback = errorCallback = xhr.onload =
  16526. xhr.onerror = xhr.onabort = xhr.ontimeout =
  16527. xhr.onreadystatechange = null;
  16528. if ( type === "abort" ) {
  16529. xhr.abort();
  16530. } else if ( type === "error" ) {
  16531. // Support: IE <=9 only
  16532. // On a manual native abort, IE9 throws
  16533. // errors on any property access that is not readyState
  16534. if ( typeof xhr.status !== "number" ) {
  16535. complete( 0, "error" );
  16536. } else {
  16537. complete(
  16538. // File: protocol always yields status 0; see #8605, #14207
  16539. xhr.status,
  16540. xhr.statusText
  16541. );
  16542. }
  16543. } else {
  16544. complete(
  16545. xhrSuccessStatus[ xhr.status ] || xhr.status,
  16546. xhr.statusText,
  16547. // Support: IE <=9 only
  16548. // IE9 has no XHR2 but throws on binary (trac-11426)
  16549. // For XHR2 non-text, let the caller handle it (gh-2498)
  16550. ( xhr.responseType || "text" ) !== "text" ||
  16551. typeof xhr.responseText !== "string" ?
  16552. { binary: xhr.response } :
  16553. { text: xhr.responseText },
  16554. xhr.getAllResponseHeaders()
  16555. );
  16556. }
  16557. }
  16558. };
  16559. };
  16560. // Listen to events
  16561. xhr.onload = callback();
  16562. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  16563. // Support: IE 9 only
  16564. // Use onreadystatechange to replace onabort
  16565. // to handle uncaught aborts
  16566. if ( xhr.onabort !== undefined ) {
  16567. xhr.onabort = errorCallback;
  16568. } else {
  16569. xhr.onreadystatechange = function() {
  16570. // Check readyState before timeout as it changes
  16571. if ( xhr.readyState === 4 ) {
  16572. // Allow onerror to be called first,
  16573. // but that will not handle a native abort
  16574. // Also, save errorCallback to a variable
  16575. // as xhr.onerror cannot be accessed
  16576. window.setTimeout( function() {
  16577. if ( callback ) {
  16578. errorCallback();
  16579. }
  16580. } );
  16581. }
  16582. };
  16583. }
  16584. // Create the abort callback
  16585. callback = callback( "abort" );
  16586. try {
  16587. // Do send the request (this may raise an exception)
  16588. xhr.send( options.hasContent && options.data || null );
  16589. } catch ( e ) {
  16590. // #14683: Only rethrow if this hasn't been notified as an error yet
  16591. if ( callback ) {
  16592. throw e;
  16593. }
  16594. }
  16595. },
  16596. abort: function() {
  16597. if ( callback ) {
  16598. callback();
  16599. }
  16600. }
  16601. };
  16602. }
  16603. } );
  16604. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  16605. jQuery.ajaxPrefilter( function( s ) {
  16606. if ( s.crossDomain ) {
  16607. s.contents.script = false;
  16608. }
  16609. } );
  16610. // Install script dataType
  16611. jQuery.ajaxSetup( {
  16612. accepts: {
  16613. script: "text/javascript, application/javascript, " +
  16614. "application/ecmascript, application/x-ecmascript"
  16615. },
  16616. contents: {
  16617. script: /\b(?:java|ecma)script\b/
  16618. },
  16619. converters: {
  16620. "text script": function( text ) {
  16621. jQuery.globalEval( text );
  16622. return text;
  16623. }
  16624. }
  16625. } );
  16626. // Handle cache's special case and crossDomain
  16627. jQuery.ajaxPrefilter( "script", function( s ) {
  16628. if ( s.cache === undefined ) {
  16629. s.cache = false;
  16630. }
  16631. if ( s.crossDomain ) {
  16632. s.type = "GET";
  16633. }
  16634. } );
  16635. // Bind script tag hack transport
  16636. jQuery.ajaxTransport( "script", function( s ) {
  16637. // This transport only deals with cross domain or forced-by-attrs requests
  16638. if ( s.crossDomain || s.scriptAttrs ) {
  16639. var script, callback;
  16640. return {
  16641. send: function( _, complete ) {
  16642. script = jQuery( "<script>" )
  16643. .attr( s.scriptAttrs || {} )
  16644. .prop( { charset: s.scriptCharset, src: s.url } )
  16645. .on( "load error", callback = function( evt ) {
  16646. script.remove();
  16647. callback = null;
  16648. if ( evt ) {
  16649. complete( evt.type === "error" ? 404 : 200, evt.type );
  16650. }
  16651. } );
  16652. // Use native DOM manipulation to avoid our domManip AJAX trickery
  16653. document.head.appendChild( script[ 0 ] );
  16654. },
  16655. abort: function() {
  16656. if ( callback ) {
  16657. callback();
  16658. }
  16659. }
  16660. };
  16661. }
  16662. } );
  16663. var oldCallbacks = [],
  16664. rjsonp = /(=)\?(?=&|$)|\?\?/;
  16665. // Default jsonp settings
  16666. jQuery.ajaxSetup( {
  16667. jsonp: "callback",
  16668. jsonpCallback: function() {
  16669. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  16670. this[ callback ] = true;
  16671. return callback;
  16672. }
  16673. } );
  16674. // Detect, normalize options and install callbacks for jsonp requests
  16675. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  16676. var callbackName, overwritten, responseContainer,
  16677. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  16678. "url" :
  16679. typeof s.data === "string" &&
  16680. ( s.contentType || "" )
  16681. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  16682. rjsonp.test( s.data ) && "data"
  16683. );
  16684. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  16685. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  16686. // Get callback name, remembering preexisting value associated with it
  16687. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  16688. s.jsonpCallback() :
  16689. s.jsonpCallback;
  16690. // Insert callback into url or form data
  16691. if ( jsonProp ) {
  16692. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  16693. } else if ( s.jsonp !== false ) {
  16694. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  16695. }
  16696. // Use data converter to retrieve json after script execution
  16697. s.converters[ "script json" ] = function() {
  16698. if ( !responseContainer ) {
  16699. jQuery.error( callbackName + " was not called" );
  16700. }
  16701. return responseContainer[ 0 ];
  16702. };
  16703. // Force json dataType
  16704. s.dataTypes[ 0 ] = "json";
  16705. // Install callback
  16706. overwritten = window[ callbackName ];
  16707. window[ callbackName ] = function() {
  16708. responseContainer = arguments;
  16709. };
  16710. // Clean-up function (fires after converters)
  16711. jqXHR.always( function() {
  16712. // If previous value didn't exist - remove it
  16713. if ( overwritten === undefined ) {
  16714. jQuery( window ).removeProp( callbackName );
  16715. // Otherwise restore preexisting value
  16716. } else {
  16717. window[ callbackName ] = overwritten;
  16718. }
  16719. // Save back as free
  16720. if ( s[ callbackName ] ) {
  16721. // Make sure that re-using the options doesn't screw things around
  16722. s.jsonpCallback = originalSettings.jsonpCallback;
  16723. // Save the callback name for future use
  16724. oldCallbacks.push( callbackName );
  16725. }
  16726. // Call if it was a function and we have a response
  16727. if ( responseContainer && isFunction( overwritten ) ) {
  16728. overwritten( responseContainer[ 0 ] );
  16729. }
  16730. responseContainer = overwritten = undefined;
  16731. } );
  16732. // Delegate to script
  16733. return "script";
  16734. }
  16735. } );
  16736. // Support: Safari 8 only
  16737. // In Safari 8 documents created via document.implementation.createHTMLDocument
  16738. // collapse sibling forms: the second one becomes a child of the first one.
  16739. // Because of that, this security measure has to be disabled in Safari 8.
  16740. // https://bugs.webkit.org/show_bug.cgi?id=137337
  16741. support.createHTMLDocument = ( function() {
  16742. var body = document.implementation.createHTMLDocument( "" ).body;
  16743. body.innerHTML = "<form></form><form></form>";
  16744. return body.childNodes.length === 2;
  16745. } )();
  16746. // Argument "data" should be string of html
  16747. // context (optional): If specified, the fragment will be created in this context,
  16748. // defaults to document
  16749. // keepScripts (optional): If true, will include scripts passed in the html string
  16750. jQuery.parseHTML = function( data, context, keepScripts ) {
  16751. if ( typeof data !== "string" ) {
  16752. return [];
  16753. }
  16754. if ( typeof context === "boolean" ) {
  16755. keepScripts = context;
  16756. context = false;
  16757. }
  16758. var base, parsed, scripts;
  16759. if ( !context ) {
  16760. // Stop scripts or inline event handlers from being executed immediately
  16761. // by using document.implementation
  16762. if ( support.createHTMLDocument ) {
  16763. context = document.implementation.createHTMLDocument( "" );
  16764. // Set the base href for the created document
  16765. // so any parsed elements with URLs
  16766. // are based on the document's URL (gh-2965)
  16767. base = context.createElement( "base" );
  16768. base.href = document.location.href;
  16769. context.head.appendChild( base );
  16770. } else {
  16771. context = document;
  16772. }
  16773. }
  16774. parsed = rsingleTag.exec( data );
  16775. scripts = !keepScripts && [];
  16776. // Single tag
  16777. if ( parsed ) {
  16778. return [ context.createElement( parsed[ 1 ] ) ];
  16779. }
  16780. parsed = buildFragment( [ data ], context, scripts );
  16781. if ( scripts && scripts.length ) {
  16782. jQuery( scripts ).remove();
  16783. }
  16784. return jQuery.merge( [], parsed.childNodes );
  16785. };
  16786. /**
  16787. * Load a url into a page
  16788. */
  16789. jQuery.fn.load = function( url, params, callback ) {
  16790. var selector, type, response,
  16791. self = this,
  16792. off = url.indexOf( " " );
  16793. if ( off > -1 ) {
  16794. selector = stripAndCollapse( url.slice( off ) );
  16795. url = url.slice( 0, off );
  16796. }
  16797. // If it's a function
  16798. if ( isFunction( params ) ) {
  16799. // We assume that it's the callback
  16800. callback = params;
  16801. params = undefined;
  16802. // Otherwise, build a param string
  16803. } else if ( params && typeof params === "object" ) {
  16804. type = "POST";
  16805. }
  16806. // If we have elements to modify, make the request
  16807. if ( self.length > 0 ) {
  16808. jQuery.ajax( {
  16809. url: url,
  16810. // If "type" variable is undefined, then "GET" method will be used.
  16811. // Make value of this field explicit since
  16812. // user can override it through ajaxSetup method
  16813. type: type || "GET",
  16814. dataType: "html",
  16815. data: params
  16816. } ).done( function( responseText ) {
  16817. // Save response for use in complete callback
  16818. response = arguments;
  16819. self.html( selector ?
  16820. // If a selector was specified, locate the right elements in a dummy div
  16821. // Exclude scripts to avoid IE 'Permission Denied' errors
  16822. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  16823. // Otherwise use the full result
  16824. responseText );
  16825. // If the request succeeds, this function gets "data", "status", "jqXHR"
  16826. // but they are ignored because response was set above.
  16827. // If it fails, this function gets "jqXHR", "status", "error"
  16828. } ).always( callback && function( jqXHR, status ) {
  16829. self.each( function() {
  16830. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  16831. } );
  16832. } );
  16833. }
  16834. return this;
  16835. };
  16836. // Attach a bunch of functions for handling common AJAX events
  16837. jQuery.each( [
  16838. "ajaxStart",
  16839. "ajaxStop",
  16840. "ajaxComplete",
  16841. "ajaxError",
  16842. "ajaxSuccess",
  16843. "ajaxSend"
  16844. ], function( i, type ) {
  16845. jQuery.fn[ type ] = function( fn ) {
  16846. return this.on( type, fn );
  16847. };
  16848. } );
  16849. jQuery.expr.pseudos.animated = function( elem ) {
  16850. return jQuery.grep( jQuery.timers, function( fn ) {
  16851. return elem === fn.elem;
  16852. } ).length;
  16853. };
  16854. jQuery.offset = {
  16855. setOffset: function( elem, options, i ) {
  16856. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  16857. position = jQuery.css( elem, "position" ),
  16858. curElem = jQuery( elem ),
  16859. props = {};
  16860. // Set position first, in-case top/left are set even on static elem
  16861. if ( position === "static" ) {
  16862. elem.style.position = "relative";
  16863. }
  16864. curOffset = curElem.offset();
  16865. curCSSTop = jQuery.css( elem, "top" );
  16866. curCSSLeft = jQuery.css( elem, "left" );
  16867. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  16868. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  16869. // Need to be able to calculate position if either
  16870. // top or left is auto and position is either absolute or fixed
  16871. if ( calculatePosition ) {
  16872. curPosition = curElem.position();
  16873. curTop = curPosition.top;
  16874. curLeft = curPosition.left;
  16875. } else {
  16876. curTop = parseFloat( curCSSTop ) || 0;
  16877. curLeft = parseFloat( curCSSLeft ) || 0;
  16878. }
  16879. if ( isFunction( options ) ) {
  16880. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  16881. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  16882. }
  16883. if ( options.top != null ) {
  16884. props.top = ( options.top - curOffset.top ) + curTop;
  16885. }
  16886. if ( options.left != null ) {
  16887. props.left = ( options.left - curOffset.left ) + curLeft;
  16888. }
  16889. if ( "using" in options ) {
  16890. options.using.call( elem, props );
  16891. } else {
  16892. curElem.css( props );
  16893. }
  16894. }
  16895. };
  16896. jQuery.fn.extend( {
  16897. // offset() relates an element's border box to the document origin
  16898. offset: function( options ) {
  16899. // Preserve chaining for setter
  16900. if ( arguments.length ) {
  16901. return options === undefined ?
  16902. this :
  16903. this.each( function( i ) {
  16904. jQuery.offset.setOffset( this, options, i );
  16905. } );
  16906. }
  16907. var rect, win,
  16908. elem = this[ 0 ];
  16909. if ( !elem ) {
  16910. return;
  16911. }
  16912. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  16913. // Support: IE <=11 only
  16914. // Running getBoundingClientRect on a
  16915. // disconnected node in IE throws an error
  16916. if ( !elem.getClientRects().length ) {
  16917. return { top: 0, left: 0 };
  16918. }
  16919. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  16920. rect = elem.getBoundingClientRect();
  16921. win = elem.ownerDocument.defaultView;
  16922. return {
  16923. top: rect.top + win.pageYOffset,
  16924. left: rect.left + win.pageXOffset
  16925. };
  16926. },
  16927. // position() relates an element's margin box to its offset parent's padding box
  16928. // This corresponds to the behavior of CSS absolute positioning
  16929. position: function() {
  16930. if ( !this[ 0 ] ) {
  16931. return;
  16932. }
  16933. var offsetParent, offset, doc,
  16934. elem = this[ 0 ],
  16935. parentOffset = { top: 0, left: 0 };
  16936. // position:fixed elements are offset from the viewport, which itself always has zero offset
  16937. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  16938. // Assume position:fixed implies availability of getBoundingClientRect
  16939. offset = elem.getBoundingClientRect();
  16940. } else {
  16941. offset = this.offset();
  16942. // Account for the *real* offset parent, which can be the document or its root element
  16943. // when a statically positioned element is identified
  16944. doc = elem.ownerDocument;
  16945. offsetParent = elem.offsetParent || doc.documentElement;
  16946. while ( offsetParent &&
  16947. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  16948. jQuery.css( offsetParent, "position" ) === "static" ) {
  16949. offsetParent = offsetParent.parentNode;
  16950. }
  16951. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  16952. // Incorporate borders into its offset, since they are outside its content origin
  16953. parentOffset = jQuery( offsetParent ).offset();
  16954. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  16955. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  16956. }
  16957. }
  16958. // Subtract parent offsets and element margins
  16959. return {
  16960. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  16961. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  16962. };
  16963. },
  16964. // This method will return documentElement in the following cases:
  16965. // 1) For the element inside the iframe without offsetParent, this method will return
  16966. // documentElement of the parent window
  16967. // 2) For the hidden or detached element
  16968. // 3) For body or html element, i.e. in case of the html node - it will return itself
  16969. //
  16970. // but those exceptions were never presented as a real life use-cases
  16971. // and might be considered as more preferable results.
  16972. //
  16973. // This logic, however, is not guaranteed and can change at any point in the future
  16974. offsetParent: function() {
  16975. return this.map( function() {
  16976. var offsetParent = this.offsetParent;
  16977. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  16978. offsetParent = offsetParent.offsetParent;
  16979. }
  16980. return offsetParent || documentElement;
  16981. } );
  16982. }
  16983. } );
  16984. // Create scrollLeft and scrollTop methods
  16985. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  16986. var top = "pageYOffset" === prop;
  16987. jQuery.fn[ method ] = function( val ) {
  16988. return access( this, function( elem, method, val ) {
  16989. // Coalesce documents and windows
  16990. var win;
  16991. if ( isWindow( elem ) ) {
  16992. win = elem;
  16993. } else if ( elem.nodeType === 9 ) {
  16994. win = elem.defaultView;
  16995. }
  16996. if ( val === undefined ) {
  16997. return win ? win[ prop ] : elem[ method ];
  16998. }
  16999. if ( win ) {
  17000. win.scrollTo(
  17001. !top ? val : win.pageXOffset,
  17002. top ? val : win.pageYOffset
  17003. );
  17004. } else {
  17005. elem[ method ] = val;
  17006. }
  17007. }, method, val, arguments.length );
  17008. };
  17009. } );
  17010. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  17011. // Add the top/left cssHooks using jQuery.fn.position
  17012. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  17013. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  17014. // getComputedStyle returns percent when specified for top/left/bottom/right;
  17015. // rather than make the css module depend on the offset module, just check for it here
  17016. jQuery.each( [ "top", "left" ], function( i, prop ) {
  17017. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  17018. function( elem, computed ) {
  17019. if ( computed ) {
  17020. computed = curCSS( elem, prop );
  17021. // If curCSS returns percentage, fallback to offset
  17022. return rnumnonpx.test( computed ) ?
  17023. jQuery( elem ).position()[ prop ] + "px" :
  17024. computed;
  17025. }
  17026. }
  17027. );
  17028. } );
  17029. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  17030. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  17031. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  17032. function( defaultExtra, funcName ) {
  17033. // Margin is only for outerHeight, outerWidth
  17034. jQuery.fn[ funcName ] = function( margin, value ) {
  17035. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  17036. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  17037. return access( this, function( elem, type, value ) {
  17038. var doc;
  17039. if ( isWindow( elem ) ) {
  17040. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  17041. return funcName.indexOf( "outer" ) === 0 ?
  17042. elem[ "inner" + name ] :
  17043. elem.document.documentElement[ "client" + name ];
  17044. }
  17045. // Get document width or height
  17046. if ( elem.nodeType === 9 ) {
  17047. doc = elem.documentElement;
  17048. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  17049. // whichever is greatest
  17050. return Math.max(
  17051. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  17052. elem.body[ "offset" + name ], doc[ "offset" + name ],
  17053. doc[ "client" + name ]
  17054. );
  17055. }
  17056. return value === undefined ?
  17057. // Get width or height on the element, requesting but not forcing parseFloat
  17058. jQuery.css( elem, type, extra ) :
  17059. // Set width or height on the element
  17060. jQuery.style( elem, type, value, extra );
  17061. }, type, chainable ? margin : undefined, chainable );
  17062. };
  17063. } );
  17064. } );
  17065. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  17066. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  17067. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  17068. function( i, name ) {
  17069. // Handle event binding
  17070. jQuery.fn[ name ] = function( data, fn ) {
  17071. return arguments.length > 0 ?
  17072. this.on( name, null, data, fn ) :
  17073. this.trigger( name );
  17074. };
  17075. } );
  17076. jQuery.fn.extend( {
  17077. hover: function( fnOver, fnOut ) {
  17078. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  17079. }
  17080. } );
  17081. jQuery.fn.extend( {
  17082. bind: function( types, data, fn ) {
  17083. return this.on( types, null, data, fn );
  17084. },
  17085. unbind: function( types, fn ) {
  17086. return this.off( types, null, fn );
  17087. },
  17088. delegate: function( selector, types, data, fn ) {
  17089. return this.on( types, selector, data, fn );
  17090. },
  17091. undelegate: function( selector, types, fn ) {
  17092. // ( namespace ) or ( selector, types [, fn] )
  17093. return arguments.length === 1 ?
  17094. this.off( selector, "**" ) :
  17095. this.off( types, selector || "**", fn );
  17096. }
  17097. } );
  17098. // Bind a function to a context, optionally partially applying any
  17099. // arguments.
  17100. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  17101. // However, it is not slated for removal any time soon
  17102. jQuery.proxy = function( fn, context ) {
  17103. var tmp, args, proxy;
  17104. if ( typeof context === "string" ) {
  17105. tmp = fn[ context ];
  17106. context = fn;
  17107. fn = tmp;
  17108. }
  17109. // Quick check to determine if target is callable, in the spec
  17110. // this throws a TypeError, but we will just return undefined.
  17111. if ( !isFunction( fn ) ) {
  17112. return undefined;
  17113. }
  17114. // Simulated bind
  17115. args = slice.call( arguments, 2 );
  17116. proxy = function() {
  17117. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  17118. };
  17119. // Set the guid of unique handler to the same of original handler, so it can be removed
  17120. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  17121. return proxy;
  17122. };
  17123. jQuery.holdReady = function( hold ) {
  17124. if ( hold ) {
  17125. jQuery.readyWait++;
  17126. } else {
  17127. jQuery.ready( true );
  17128. }
  17129. };
  17130. jQuery.isArray = Array.isArray;
  17131. jQuery.parseJSON = JSON.parse;
  17132. jQuery.nodeName = nodeName;
  17133. jQuery.isFunction = isFunction;
  17134. jQuery.isWindow = isWindow;
  17135. jQuery.camelCase = camelCase;
  17136. jQuery.type = toType;
  17137. jQuery.now = Date.now;
  17138. jQuery.isNumeric = function( obj ) {
  17139. // As of jQuery 3.0, isNumeric is limited to
  17140. // strings and numbers (primitives or objects)
  17141. // that can be coerced to finite numbers (gh-2662)
  17142. var type = jQuery.type( obj );
  17143. return ( type === "number" || type === "string" ) &&
  17144. // parseFloat NaNs numeric-cast false positives ("")
  17145. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  17146. // subtraction forces infinities to NaN
  17147. !isNaN( obj - parseFloat( obj ) );
  17148. };
  17149. // Register as a named AMD module, since jQuery can be concatenated with other
  17150. // files that may use define, but not via a proper concatenation script that
  17151. // understands anonymous AMD modules. A named AMD is safest and most robust
  17152. // way to register. Lowercase jquery is used because AMD module names are
  17153. // derived from file names, and jQuery is normally delivered in a lowercase
  17154. // file name. Do this after creating the global so that if an AMD module wants
  17155. // to call noConflict to hide this version of jQuery, it will work.
  17156. // Note that for maximum portability, libraries that are not jQuery should
  17157. // declare themselves as anonymous modules, and avoid setting a global if an
  17158. // AMD loader is present. jQuery is a special case. For more information, see
  17159. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  17160. if ( true ) {
  17161. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  17162. return jQuery;
  17163. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  17164. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17165. }
  17166. var
  17167. // Map over jQuery in case of overwrite
  17168. _jQuery = window.jQuery,
  17169. // Map over the $ in case of overwrite
  17170. _$ = window.$;
  17171. jQuery.noConflict = function( deep ) {
  17172. if ( window.$ === jQuery ) {
  17173. window.$ = _$;
  17174. }
  17175. if ( deep && window.jQuery === jQuery ) {
  17176. window.jQuery = _jQuery;
  17177. }
  17178. return jQuery;
  17179. };
  17180. // Expose jQuery and $ identifiers, even in AMD
  17181. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  17182. // and CommonJS for browser emulators (#13566)
  17183. if ( !noGlobal ) {
  17184. window.jQuery = window.$ = jQuery;
  17185. }
  17186. return jQuery;
  17187. } );
  17188. /***/ }),
  17189. /***/ "./node_modules/laravel-echo/dist/echo.js":
  17190. /*!************************************************!*\
  17191. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  17192. \************************************************/
  17193. /*! exports provided: default */
  17194. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  17195. "use strict";
  17196. __webpack_require__.r(__webpack_exports__);
  17197. var classCallCheck = function (instance, Constructor) {
  17198. if (!(instance instanceof Constructor)) {
  17199. throw new TypeError("Cannot call a class as a function");
  17200. }
  17201. };
  17202. var createClass = function () {
  17203. function defineProperties(target, props) {
  17204. for (var i = 0; i < props.length; i++) {
  17205. var descriptor = props[i];
  17206. descriptor.enumerable = descriptor.enumerable || false;
  17207. descriptor.configurable = true;
  17208. if ("value" in descriptor) descriptor.writable = true;
  17209. Object.defineProperty(target, descriptor.key, descriptor);
  17210. }
  17211. }
  17212. return function (Constructor, protoProps, staticProps) {
  17213. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  17214. if (staticProps) defineProperties(Constructor, staticProps);
  17215. return Constructor;
  17216. };
  17217. }();
  17218. var _extends = Object.assign || function (target) {
  17219. for (var i = 1; i < arguments.length; i++) {
  17220. var source = arguments[i];
  17221. for (var key in source) {
  17222. if (Object.prototype.hasOwnProperty.call(source, key)) {
  17223. target[key] = source[key];
  17224. }
  17225. }
  17226. }
  17227. return target;
  17228. };
  17229. var inherits = function (subClass, superClass) {
  17230. if (typeof superClass !== "function" && superClass !== null) {
  17231. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  17232. }
  17233. subClass.prototype = Object.create(superClass && superClass.prototype, {
  17234. constructor: {
  17235. value: subClass,
  17236. enumerable: false,
  17237. writable: true,
  17238. configurable: true
  17239. }
  17240. });
  17241. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  17242. };
  17243. var possibleConstructorReturn = function (self, call) {
  17244. if (!self) {
  17245. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  17246. }
  17247. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  17248. };
  17249. var Connector = function () {
  17250. /**
  17251. * Create a new class instance.
  17252. */
  17253. function Connector(options) {
  17254. classCallCheck(this, Connector);
  17255. /**
  17256. * Default connector options.
  17257. */
  17258. this._defaultOptions = {
  17259. auth: {
  17260. headers: {}
  17261. },
  17262. authEndpoint: '/broadcasting/auth',
  17263. broadcaster: 'pusher',
  17264. csrfToken: null,
  17265. host: null,
  17266. key: null,
  17267. namespace: 'App.Events'
  17268. };
  17269. this.setOptions(options);
  17270. this.connect();
  17271. }
  17272. /**
  17273. * Merge the custom options with the defaults.
  17274. */
  17275. createClass(Connector, [{
  17276. key: 'setOptions',
  17277. value: function setOptions(options) {
  17278. this.options = _extends(this._defaultOptions, options);
  17279. if (this.csrfToken()) {
  17280. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  17281. }
  17282. return options;
  17283. }
  17284. /**
  17285. * Extract the CSRF token from the page.
  17286. */
  17287. }, {
  17288. key: 'csrfToken',
  17289. value: function csrfToken() {
  17290. var selector = void 0;
  17291. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  17292. return window['Laravel'].csrfToken;
  17293. } else if (this.options.csrfToken) {
  17294. return this.options.csrfToken;
  17295. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  17296. return selector.getAttribute('content');
  17297. }
  17298. return null;
  17299. }
  17300. }]);
  17301. return Connector;
  17302. }();
  17303. /**
  17304. * This class represents a basic channel.
  17305. */
  17306. var Channel = function () {
  17307. function Channel() {
  17308. classCallCheck(this, Channel);
  17309. }
  17310. createClass(Channel, [{
  17311. key: 'listenForWhisper',
  17312. /**
  17313. * Listen for a whisper event on the channel instance.
  17314. */
  17315. value: function listenForWhisper(event, callback) {
  17316. return this.listen('.client-' + event, callback);
  17317. }
  17318. /**
  17319. * Listen for an event on the channel instance.
  17320. */
  17321. }, {
  17322. key: 'notification',
  17323. value: function notification(callback) {
  17324. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  17325. }
  17326. /**
  17327. * Stop listening for a whispser event on the channel instance.
  17328. */
  17329. }, {
  17330. key: 'stopListeningForWhisper',
  17331. value: function stopListeningForWhisper(event) {
  17332. return this.stopListening('.client-' + event);
  17333. }
  17334. }]);
  17335. return Channel;
  17336. }();
  17337. /**
  17338. * Event name formatter
  17339. */
  17340. var EventFormatter = function () {
  17341. /**
  17342. * Create a new class instance.
  17343. */
  17344. function EventFormatter(namespace) {
  17345. classCallCheck(this, EventFormatter);
  17346. this.setNamespace(namespace);
  17347. }
  17348. /**
  17349. * Format the given event name.
  17350. */
  17351. createClass(EventFormatter, [{
  17352. key: 'format',
  17353. value: function format(event) {
  17354. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  17355. return event.substr(1);
  17356. } else if (this.namespace) {
  17357. event = this.namespace + '.' + event;
  17358. }
  17359. return event.replace(/\./g, '\\');
  17360. }
  17361. /**
  17362. * Set the event namespace.
  17363. */
  17364. }, {
  17365. key: 'setNamespace',
  17366. value: function setNamespace(value) {
  17367. this.namespace = value;
  17368. }
  17369. }]);
  17370. return EventFormatter;
  17371. }();
  17372. /**
  17373. * This class represents a Pusher channel.
  17374. */
  17375. var PusherChannel = function (_Channel) {
  17376. inherits(PusherChannel, _Channel);
  17377. /**
  17378. * Create a new class instance.
  17379. */
  17380. function PusherChannel(pusher, name, options) {
  17381. classCallCheck(this, PusherChannel);
  17382. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  17383. _this.name = name;
  17384. _this.pusher = pusher;
  17385. _this.options = options;
  17386. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17387. _this.subscribe();
  17388. return _this;
  17389. }
  17390. /**
  17391. * Subscribe to a Pusher channel.
  17392. */
  17393. createClass(PusherChannel, [{
  17394. key: 'subscribe',
  17395. value: function subscribe() {
  17396. this.subscription = this.pusher.subscribe(this.name);
  17397. }
  17398. /**
  17399. * Unsubscribe from a Pusher channel.
  17400. */
  17401. }, {
  17402. key: 'unsubscribe',
  17403. value: function unsubscribe() {
  17404. this.pusher.unsubscribe(this.name);
  17405. }
  17406. /**
  17407. * Listen for an event on the channel instance.
  17408. */
  17409. }, {
  17410. key: 'listen',
  17411. value: function listen(event, callback) {
  17412. this.on(this.eventFormatter.format(event), callback);
  17413. return this;
  17414. }
  17415. /**
  17416. * Stop listening for an event on the channel instance.
  17417. */
  17418. }, {
  17419. key: 'stopListening',
  17420. value: function stopListening(event) {
  17421. this.subscription.unbind(this.eventFormatter.format(event));
  17422. return this;
  17423. }
  17424. /**
  17425. * Bind a channel to an event.
  17426. */
  17427. }, {
  17428. key: 'on',
  17429. value: function on(event, callback) {
  17430. this.subscription.bind(event, callback);
  17431. return this;
  17432. }
  17433. }]);
  17434. return PusherChannel;
  17435. }(Channel);
  17436. /**
  17437. * This class represents a Pusher private channel.
  17438. */
  17439. var PusherPrivateChannel = function (_PusherChannel) {
  17440. inherits(PusherPrivateChannel, _PusherChannel);
  17441. function PusherPrivateChannel() {
  17442. classCallCheck(this, PusherPrivateChannel);
  17443. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  17444. }
  17445. createClass(PusherPrivateChannel, [{
  17446. key: 'whisper',
  17447. /**
  17448. * Trigger client event on the channel.
  17449. */
  17450. value: function whisper(eventName, data) {
  17451. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17452. return this;
  17453. }
  17454. }]);
  17455. return PusherPrivateChannel;
  17456. }(PusherChannel);
  17457. /**
  17458. * This class represents a Pusher presence channel.
  17459. */
  17460. var PusherPresenceChannel = function (_PusherChannel) {
  17461. inherits(PusherPresenceChannel, _PusherChannel);
  17462. function PusherPresenceChannel() {
  17463. classCallCheck(this, PusherPresenceChannel);
  17464. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  17465. }
  17466. createClass(PusherPresenceChannel, [{
  17467. key: 'here',
  17468. /**
  17469. * Register a callback to be called anytime the member list changes.
  17470. */
  17471. value: function here(callback) {
  17472. this.on('pusher:subscription_succeeded', function (data) {
  17473. callback(Object.keys(data.members).map(function (k) {
  17474. return data.members[k];
  17475. }));
  17476. });
  17477. return this;
  17478. }
  17479. /**
  17480. * Listen for someone joining the channel.
  17481. */
  17482. }, {
  17483. key: 'joining',
  17484. value: function joining(callback) {
  17485. this.on('pusher:member_added', function (member) {
  17486. callback(member.info);
  17487. });
  17488. return this;
  17489. }
  17490. /**
  17491. * Listen for someone leaving the channel.
  17492. */
  17493. }, {
  17494. key: 'leaving',
  17495. value: function leaving(callback) {
  17496. this.on('pusher:member_removed', function (member) {
  17497. callback(member.info);
  17498. });
  17499. return this;
  17500. }
  17501. /**
  17502. * Trigger client event on the channel.
  17503. */
  17504. }, {
  17505. key: 'whisper',
  17506. value: function whisper(eventName, data) {
  17507. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17508. return this;
  17509. }
  17510. }]);
  17511. return PusherPresenceChannel;
  17512. }(PusherChannel);
  17513. /**
  17514. * This class represents a Socket.io channel.
  17515. */
  17516. var SocketIoChannel = function (_Channel) {
  17517. inherits(SocketIoChannel, _Channel);
  17518. /**
  17519. * Create a new class instance.
  17520. */
  17521. function SocketIoChannel(socket, name, options) {
  17522. classCallCheck(this, SocketIoChannel);
  17523. /**
  17524. * The event callbacks applied to the channel.
  17525. */
  17526. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  17527. _this.events = {};
  17528. _this.name = name;
  17529. _this.socket = socket;
  17530. _this.options = options;
  17531. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17532. _this.subscribe();
  17533. _this.configureReconnector();
  17534. return _this;
  17535. }
  17536. /**
  17537. * Subscribe to a Socket.io channel.
  17538. */
  17539. createClass(SocketIoChannel, [{
  17540. key: 'subscribe',
  17541. value: function subscribe() {
  17542. this.socket.emit('subscribe', {
  17543. channel: this.name,
  17544. auth: this.options.auth || {}
  17545. });
  17546. }
  17547. /**
  17548. * Unsubscribe from channel and ubind event callbacks.
  17549. */
  17550. }, {
  17551. key: 'unsubscribe',
  17552. value: function unsubscribe() {
  17553. this.unbind();
  17554. this.socket.emit('unsubscribe', {
  17555. channel: this.name,
  17556. auth: this.options.auth || {}
  17557. });
  17558. }
  17559. /**
  17560. * Listen for an event on the channel instance.
  17561. */
  17562. }, {
  17563. key: 'listen',
  17564. value: function listen(event, callback) {
  17565. this.on(this.eventFormatter.format(event), callback);
  17566. return this;
  17567. }
  17568. /**
  17569. * Stop listening for an event on the channel instance.
  17570. */
  17571. }, {
  17572. key: 'stopListening',
  17573. value: function stopListening(event) {
  17574. var name = this.eventFormatter.format(event);
  17575. this.socket.removeListener(name);
  17576. delete this.events[name];
  17577. return this;
  17578. }
  17579. /**
  17580. * Bind the channel's socket to an event and store the callback.
  17581. */
  17582. }, {
  17583. key: 'on',
  17584. value: function on(event, callback) {
  17585. var _this2 = this;
  17586. var listener = function listener(channel, data) {
  17587. if (_this2.name == channel) {
  17588. callback(data);
  17589. }
  17590. };
  17591. this.socket.on(event, listener);
  17592. this.bind(event, listener);
  17593. }
  17594. /**
  17595. * Attach a 'reconnect' listener and bind the event.
  17596. */
  17597. }, {
  17598. key: 'configureReconnector',
  17599. value: function configureReconnector() {
  17600. var _this3 = this;
  17601. var listener = function listener() {
  17602. _this3.subscribe();
  17603. };
  17604. this.socket.on('reconnect', listener);
  17605. this.bind('reconnect', listener);
  17606. }
  17607. /**
  17608. * Bind the channel's socket to an event and store the callback.
  17609. */
  17610. }, {
  17611. key: 'bind',
  17612. value: function bind(event, callback) {
  17613. this.events[event] = this.events[event] || [];
  17614. this.events[event].push(callback);
  17615. }
  17616. /**
  17617. * Unbind the channel's socket from all stored event callbacks.
  17618. */
  17619. }, {
  17620. key: 'unbind',
  17621. value: function unbind() {
  17622. var _this4 = this;
  17623. Object.keys(this.events).forEach(function (event) {
  17624. _this4.events[event].forEach(function (callback) {
  17625. _this4.socket.removeListener(event, callback);
  17626. });
  17627. delete _this4.events[event];
  17628. });
  17629. }
  17630. }]);
  17631. return SocketIoChannel;
  17632. }(Channel);
  17633. /**
  17634. * This class represents a Socket.io presence channel.
  17635. */
  17636. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  17637. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  17638. function SocketIoPrivateChannel() {
  17639. classCallCheck(this, SocketIoPrivateChannel);
  17640. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  17641. }
  17642. createClass(SocketIoPrivateChannel, [{
  17643. key: 'whisper',
  17644. /**
  17645. * Trigger client event on the channel.
  17646. */
  17647. value: function whisper(eventName, data) {
  17648. this.socket.emit('client event', {
  17649. channel: this.name,
  17650. event: 'client-' + eventName,
  17651. data: data
  17652. });
  17653. return this;
  17654. }
  17655. }]);
  17656. return SocketIoPrivateChannel;
  17657. }(SocketIoChannel);
  17658. /**
  17659. * This class represents a Socket.io presence channel.
  17660. */
  17661. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  17662. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  17663. function SocketIoPresenceChannel() {
  17664. classCallCheck(this, SocketIoPresenceChannel);
  17665. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  17666. }
  17667. createClass(SocketIoPresenceChannel, [{
  17668. key: 'here',
  17669. /**
  17670. * Register a callback to be called anytime the member list changes.
  17671. */
  17672. value: function here(callback) {
  17673. this.on('presence:subscribed', function (members) {
  17674. callback(members.map(function (m) {
  17675. return m.user_info;
  17676. }));
  17677. });
  17678. return this;
  17679. }
  17680. /**
  17681. * Listen for someone joining the channel.
  17682. */
  17683. }, {
  17684. key: 'joining',
  17685. value: function joining(callback) {
  17686. this.on('presence:joining', function (member) {
  17687. return callback(member.user_info);
  17688. });
  17689. return this;
  17690. }
  17691. /**
  17692. * Listen for someone leaving the channel.
  17693. */
  17694. }, {
  17695. key: 'leaving',
  17696. value: function leaving(callback) {
  17697. this.on('presence:leaving', function (member) {
  17698. return callback(member.user_info);
  17699. });
  17700. return this;
  17701. }
  17702. }]);
  17703. return SocketIoPresenceChannel;
  17704. }(SocketIoPrivateChannel);
  17705. /**
  17706. * This class represents a null channel.
  17707. */
  17708. var NullChannel = function (_Channel) {
  17709. inherits(NullChannel, _Channel);
  17710. function NullChannel() {
  17711. classCallCheck(this, NullChannel);
  17712. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  17713. }
  17714. createClass(NullChannel, [{
  17715. key: 'subscribe',
  17716. /**
  17717. * Subscribe to a channel.
  17718. */
  17719. value: function subscribe() {}
  17720. //
  17721. /**
  17722. * Unsubscribe from a channel.
  17723. */
  17724. }, {
  17725. key: 'unsubscribe',
  17726. value: function unsubscribe() {}
  17727. //
  17728. /**
  17729. * Listen for an event on the channel instance.
  17730. */
  17731. }, {
  17732. key: 'listen',
  17733. value: function listen(event, callback) {
  17734. return this;
  17735. }
  17736. /**
  17737. * Stop listening for an event on the channel instance.
  17738. */
  17739. }, {
  17740. key: 'stopListening',
  17741. value: function stopListening(event) {
  17742. return this;
  17743. }
  17744. /**
  17745. * Bind a channel to an event.
  17746. */
  17747. }, {
  17748. key: 'on',
  17749. value: function on(event, callback) {
  17750. return this;
  17751. }
  17752. }]);
  17753. return NullChannel;
  17754. }(Channel);
  17755. /**
  17756. * This class represents a null private channel.
  17757. */
  17758. var NullPrivateChannel = function (_NullChannel) {
  17759. inherits(NullPrivateChannel, _NullChannel);
  17760. function NullPrivateChannel() {
  17761. classCallCheck(this, NullPrivateChannel);
  17762. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  17763. }
  17764. createClass(NullPrivateChannel, [{
  17765. key: 'whisper',
  17766. /**
  17767. * Trigger client event on the channel.
  17768. */
  17769. value: function whisper(eventName, data) {
  17770. return this;
  17771. }
  17772. }]);
  17773. return NullPrivateChannel;
  17774. }(NullChannel);
  17775. /**
  17776. * This class represents a null presence channel.
  17777. */
  17778. var NullPresenceChannel = function (_NullChannel) {
  17779. inherits(NullPresenceChannel, _NullChannel);
  17780. function NullPresenceChannel() {
  17781. classCallCheck(this, NullPresenceChannel);
  17782. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  17783. }
  17784. createClass(NullPresenceChannel, [{
  17785. key: 'here',
  17786. /**
  17787. * Register a callback to be called anytime the member list changes.
  17788. */
  17789. value: function here(callback) {
  17790. return this;
  17791. }
  17792. /**
  17793. * Listen for someone joining the channel.
  17794. */
  17795. }, {
  17796. key: 'joining',
  17797. value: function joining(callback) {
  17798. return this;
  17799. }
  17800. /**
  17801. * Listen for someone leaving the channel.
  17802. */
  17803. }, {
  17804. key: 'leaving',
  17805. value: function leaving(callback) {
  17806. return this;
  17807. }
  17808. /**
  17809. * Trigger client event on the channel.
  17810. */
  17811. }, {
  17812. key: 'whisper',
  17813. value: function whisper(eventName, data) {
  17814. return this;
  17815. }
  17816. }]);
  17817. return NullPresenceChannel;
  17818. }(NullChannel);
  17819. /**
  17820. * This class creates a connector to Pusher.
  17821. */
  17822. var PusherConnector = function (_Connector) {
  17823. inherits(PusherConnector, _Connector);
  17824. function PusherConnector() {
  17825. classCallCheck(this, PusherConnector);
  17826. /**
  17827. * All of the subscribed channel names.
  17828. */
  17829. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  17830. _this.channels = {};
  17831. return _this;
  17832. }
  17833. /**
  17834. * Create a fresh Pusher connection.
  17835. */
  17836. createClass(PusherConnector, [{
  17837. key: 'connect',
  17838. value: function connect() {
  17839. if (typeof this.options.client !== 'undefined') {
  17840. this.pusher = this.options.client;
  17841. } else {
  17842. this.pusher = new Pusher(this.options.key, this.options);
  17843. }
  17844. }
  17845. /**
  17846. * Listen for an event on a channel instance.
  17847. */
  17848. }, {
  17849. key: 'listen',
  17850. value: function listen(name, event, callback) {
  17851. return this.channel(name).listen(event, callback);
  17852. }
  17853. /**
  17854. * Get a channel instance by name.
  17855. */
  17856. }, {
  17857. key: 'channel',
  17858. value: function channel(name) {
  17859. if (!this.channels[name]) {
  17860. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  17861. }
  17862. return this.channels[name];
  17863. }
  17864. /**
  17865. * Get a private channel instance by name.
  17866. */
  17867. }, {
  17868. key: 'privateChannel',
  17869. value: function privateChannel(name) {
  17870. if (!this.channels['private-' + name]) {
  17871. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  17872. }
  17873. return this.channels['private-' + name];
  17874. }
  17875. /**
  17876. * Get a presence channel instance by name.
  17877. */
  17878. }, {
  17879. key: 'presenceChannel',
  17880. value: function presenceChannel(name) {
  17881. if (!this.channels['presence-' + name]) {
  17882. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  17883. }
  17884. return this.channels['presence-' + name];
  17885. }
  17886. /**
  17887. * Leave the given channel, as well as its private and presence variants.
  17888. */
  17889. }, {
  17890. key: 'leave',
  17891. value: function leave(name) {
  17892. var _this2 = this;
  17893. var channels = [name, 'private-' + name, 'presence-' + name];
  17894. channels.forEach(function (name, index) {
  17895. _this2.leaveChannel(name);
  17896. });
  17897. }
  17898. /**
  17899. * Leave the given channel.
  17900. */
  17901. }, {
  17902. key: 'leaveChannel',
  17903. value: function leaveChannel(name) {
  17904. if (this.channels[name]) {
  17905. this.channels[name].unsubscribe();
  17906. delete this.channels[name];
  17907. }
  17908. }
  17909. /**
  17910. * Get the socket ID for the connection.
  17911. */
  17912. }, {
  17913. key: 'socketId',
  17914. value: function socketId() {
  17915. return this.pusher.connection.socket_id;
  17916. }
  17917. /**
  17918. * Disconnect Pusher connection.
  17919. */
  17920. }, {
  17921. key: 'disconnect',
  17922. value: function disconnect() {
  17923. this.pusher.disconnect();
  17924. }
  17925. }]);
  17926. return PusherConnector;
  17927. }(Connector);
  17928. /**
  17929. * This class creates a connnector to a Socket.io server.
  17930. */
  17931. var SocketIoConnector = function (_Connector) {
  17932. inherits(SocketIoConnector, _Connector);
  17933. function SocketIoConnector() {
  17934. classCallCheck(this, SocketIoConnector);
  17935. /**
  17936. * All of the subscribed channel names.
  17937. */
  17938. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  17939. _this.channels = {};
  17940. return _this;
  17941. }
  17942. /**
  17943. * Create a fresh Socket.io connection.
  17944. */
  17945. createClass(SocketIoConnector, [{
  17946. key: 'connect',
  17947. value: function connect() {
  17948. var io = this.getSocketIO();
  17949. this.socket = io(this.options.host, this.options);
  17950. return this.socket;
  17951. }
  17952. /**
  17953. * Get socket.io module from global scope or options.
  17954. */
  17955. }, {
  17956. key: 'getSocketIO',
  17957. value: function getSocketIO() {
  17958. if (typeof this.options.client !== 'undefined') {
  17959. return this.options.client;
  17960. }
  17961. if (typeof io !== 'undefined') {
  17962. return io;
  17963. }
  17964. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  17965. }
  17966. /**
  17967. * Listen for an event on a channel instance.
  17968. */
  17969. }, {
  17970. key: 'listen',
  17971. value: function listen(name, event, callback) {
  17972. return this.channel(name).listen(event, callback);
  17973. }
  17974. /**
  17975. * Get a channel instance by name.
  17976. */
  17977. }, {
  17978. key: 'channel',
  17979. value: function channel(name) {
  17980. if (!this.channels[name]) {
  17981. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  17982. }
  17983. return this.channels[name];
  17984. }
  17985. /**
  17986. * Get a private channel instance by name.
  17987. */
  17988. }, {
  17989. key: 'privateChannel',
  17990. value: function privateChannel(name) {
  17991. if (!this.channels['private-' + name]) {
  17992. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  17993. }
  17994. return this.channels['private-' + name];
  17995. }
  17996. /**
  17997. * Get a presence channel instance by name.
  17998. */
  17999. }, {
  18000. key: 'presenceChannel',
  18001. value: function presenceChannel(name) {
  18002. if (!this.channels['presence-' + name]) {
  18003. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  18004. }
  18005. return this.channels['presence-' + name];
  18006. }
  18007. /**
  18008. * Leave the given channel, as well as its private and presence variants.
  18009. */
  18010. }, {
  18011. key: 'leave',
  18012. value: function leave(name) {
  18013. var _this2 = this;
  18014. var channels = [name, 'private-' + name, 'presence-' + name];
  18015. channels.forEach(function (name) {
  18016. _this2.leaveChannel(name);
  18017. });
  18018. }
  18019. /**
  18020. * Leave the given channel.
  18021. */
  18022. }, {
  18023. key: 'leaveChannel',
  18024. value: function leaveChannel(name) {
  18025. if (this.channels[name]) {
  18026. this.channels[name].unsubscribe();
  18027. delete this.channels[name];
  18028. }
  18029. }
  18030. /**
  18031. * Get the socket ID for the connection.
  18032. */
  18033. }, {
  18034. key: 'socketId',
  18035. value: function socketId() {
  18036. return this.socket.id;
  18037. }
  18038. /**
  18039. * Disconnect Socketio connection.
  18040. */
  18041. }, {
  18042. key: 'disconnect',
  18043. value: function disconnect() {
  18044. this.socket.disconnect();
  18045. }
  18046. }]);
  18047. return SocketIoConnector;
  18048. }(Connector);
  18049. /**
  18050. * This class creates a null connector.
  18051. */
  18052. var NullConnector = function (_Connector) {
  18053. inherits(NullConnector, _Connector);
  18054. function NullConnector() {
  18055. classCallCheck(this, NullConnector);
  18056. /**
  18057. * All of the subscribed channel names.
  18058. */
  18059. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  18060. _this.channels = {};
  18061. return _this;
  18062. }
  18063. /**
  18064. * Create a fresh connection.
  18065. */
  18066. createClass(NullConnector, [{
  18067. key: 'connect',
  18068. value: function connect() {}
  18069. //
  18070. /**
  18071. * Listen for an event on a channel instance.
  18072. */
  18073. }, {
  18074. key: 'listen',
  18075. value: function listen(name, event, callback) {
  18076. return new NullChannel();
  18077. }
  18078. /**
  18079. * Get a channel instance by name.
  18080. */
  18081. }, {
  18082. key: 'channel',
  18083. value: function channel(name) {
  18084. return new NullChannel();
  18085. }
  18086. /**
  18087. * Get a private channel instance by name.
  18088. */
  18089. }, {
  18090. key: 'privateChannel',
  18091. value: function privateChannel(name) {
  18092. return new NullPrivateChannel();
  18093. }
  18094. /**
  18095. * Get a presence channel instance by name.
  18096. */
  18097. }, {
  18098. key: 'presenceChannel',
  18099. value: function presenceChannel(name) {
  18100. return new NullPresenceChannel();
  18101. }
  18102. /**
  18103. * Leave the given channel, as well as its private and presence variants.
  18104. */
  18105. }, {
  18106. key: 'leave',
  18107. value: function leave(name) {}
  18108. //
  18109. /**
  18110. * Leave the given channel.
  18111. */
  18112. }, {
  18113. key: 'leaveChannel',
  18114. value: function leaveChannel(name) {}
  18115. //
  18116. /**
  18117. * Get the socket ID for the connection.
  18118. */
  18119. }, {
  18120. key: 'socketId',
  18121. value: function socketId() {
  18122. return 'fake-socket-id';
  18123. }
  18124. /**
  18125. * Disconnect the connection.
  18126. */
  18127. }, {
  18128. key: 'disconnect',
  18129. value: function disconnect() {
  18130. //
  18131. }
  18132. }]);
  18133. return NullConnector;
  18134. }(Connector);
  18135. /**
  18136. * This class is the primary API for interacting with broadcasting.
  18137. */
  18138. var Echo = function () {
  18139. /**
  18140. * Create a new class instance.
  18141. */
  18142. function Echo(options) {
  18143. classCallCheck(this, Echo);
  18144. this.options = options;
  18145. this.connect();
  18146. if (!this.options.withoutInterceptors) {
  18147. this.registerInterceptors();
  18148. }
  18149. }
  18150. /**
  18151. * Get a channel instance by name.
  18152. */
  18153. createClass(Echo, [{
  18154. key: 'channel',
  18155. value: function channel(_channel) {
  18156. return this.connector.channel(_channel);
  18157. }
  18158. /**
  18159. * Create a new connection.
  18160. */
  18161. }, {
  18162. key: 'connect',
  18163. value: function connect() {
  18164. if (this.options.broadcaster == 'pusher') {
  18165. this.connector = new PusherConnector(this.options);
  18166. } else if (this.options.broadcaster == 'socket.io') {
  18167. this.connector = new SocketIoConnector(this.options);
  18168. } else if (this.options.broadcaster == 'null') {
  18169. this.connector = new NullConnector(this.options);
  18170. } else if (typeof this.options.broadcaster == 'function') {
  18171. this.connector = new this.options.broadcaster(this.options);
  18172. }
  18173. }
  18174. /**
  18175. * Disconnect from the Echo server.
  18176. */
  18177. }, {
  18178. key: 'disconnect',
  18179. value: function disconnect() {
  18180. this.connector.disconnect();
  18181. }
  18182. /**
  18183. * Get a presence channel instance by name.
  18184. */
  18185. }, {
  18186. key: 'join',
  18187. value: function join(channel) {
  18188. return this.connector.presenceChannel(channel);
  18189. }
  18190. /**
  18191. * Leave the given channel, as well as its private and presence variants.
  18192. */
  18193. }, {
  18194. key: 'leave',
  18195. value: function leave(channel) {
  18196. this.connector.leave(channel);
  18197. }
  18198. /**
  18199. * Leave the given channel.
  18200. */
  18201. }, {
  18202. key: 'leaveChannel',
  18203. value: function leaveChannel(channel) {
  18204. this.connector.leaveChannel(channel);
  18205. }
  18206. /**
  18207. * Listen for an event on a channel instance.
  18208. */
  18209. }, {
  18210. key: 'listen',
  18211. value: function listen(channel, event, callback) {
  18212. return this.connector.listen(channel, event, callback);
  18213. }
  18214. /**
  18215. * Get a private channel instance by name.
  18216. */
  18217. }, {
  18218. key: 'private',
  18219. value: function _private(channel) {
  18220. return this.connector.privateChannel(channel);
  18221. }
  18222. /**
  18223. * Get the Socket ID for the connection.
  18224. */
  18225. }, {
  18226. key: 'socketId',
  18227. value: function socketId() {
  18228. return this.connector.socketId();
  18229. }
  18230. /**
  18231. * Register 3rd party request interceptiors. These are used to automatically
  18232. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  18233. */
  18234. }, {
  18235. key: 'registerInterceptors',
  18236. value: function registerInterceptors() {
  18237. if (typeof Vue === 'function' && Vue.http) {
  18238. this.registerVueRequestInterceptor();
  18239. }
  18240. if (typeof axios === 'function') {
  18241. this.registerAxiosRequestInterceptor();
  18242. }
  18243. if (typeof jQuery === 'function') {
  18244. this.registerjQueryAjaxSetup();
  18245. }
  18246. }
  18247. /**
  18248. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  18249. */
  18250. }, {
  18251. key: 'registerVueRequestInterceptor',
  18252. value: function registerVueRequestInterceptor() {
  18253. var _this = this;
  18254. Vue.http.interceptors.push(function (request, next) {
  18255. if (_this.socketId()) {
  18256. request.headers.set('X-Socket-ID', _this.socketId());
  18257. }
  18258. next();
  18259. });
  18260. }
  18261. /**
  18262. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  18263. */
  18264. }, {
  18265. key: 'registerAxiosRequestInterceptor',
  18266. value: function registerAxiosRequestInterceptor() {
  18267. var _this2 = this;
  18268. axios.interceptors.request.use(function (config) {
  18269. if (_this2.socketId()) {
  18270. config.headers['X-Socket-Id'] = _this2.socketId();
  18271. }
  18272. return config;
  18273. });
  18274. }
  18275. /**
  18276. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  18277. */
  18278. }, {
  18279. key: 'registerjQueryAjaxSetup',
  18280. value: function registerjQueryAjaxSetup() {
  18281. var _this3 = this;
  18282. if (typeof jQuery.ajax != 'undefined') {
  18283. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  18284. if (_this3.socketId()) {
  18285. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  18286. }
  18287. });
  18288. }
  18289. }
  18290. }]);
  18291. return Echo;
  18292. }();
  18293. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  18294. /***/ }),
  18295. /***/ "./node_modules/lodash/lodash.js":
  18296. /*!***************************************!*\
  18297. !*** ./node_modules/lodash/lodash.js ***!
  18298. \***************************************/
  18299. /*! no static exports found */
  18300. /***/ (function(module, exports, __webpack_require__) {
  18301. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  18302. * @license
  18303. * Lodash <https://lodash.com/>
  18304. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  18305. * Released under MIT license <https://lodash.com/license>
  18306. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  18307. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  18308. */
  18309. ;(function() {
  18310. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  18311. var undefined;
  18312. /** Used as the semantic version number. */
  18313. var VERSION = '4.17.15';
  18314. /** Used as the size to enable large array optimizations. */
  18315. var LARGE_ARRAY_SIZE = 200;
  18316. /** Error message constants. */
  18317. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  18318. FUNC_ERROR_TEXT = 'Expected a function';
  18319. /** Used to stand-in for `undefined` hash values. */
  18320. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  18321. /** Used as the maximum memoize cache size. */
  18322. var MAX_MEMOIZE_SIZE = 500;
  18323. /** Used as the internal argument placeholder. */
  18324. var PLACEHOLDER = '__lodash_placeholder__';
  18325. /** Used to compose bitmasks for cloning. */
  18326. var CLONE_DEEP_FLAG = 1,
  18327. CLONE_FLAT_FLAG = 2,
  18328. CLONE_SYMBOLS_FLAG = 4;
  18329. /** Used to compose bitmasks for value comparisons. */
  18330. var COMPARE_PARTIAL_FLAG = 1,
  18331. COMPARE_UNORDERED_FLAG = 2;
  18332. /** Used to compose bitmasks for function metadata. */
  18333. var WRAP_BIND_FLAG = 1,
  18334. WRAP_BIND_KEY_FLAG = 2,
  18335. WRAP_CURRY_BOUND_FLAG = 4,
  18336. WRAP_CURRY_FLAG = 8,
  18337. WRAP_CURRY_RIGHT_FLAG = 16,
  18338. WRAP_PARTIAL_FLAG = 32,
  18339. WRAP_PARTIAL_RIGHT_FLAG = 64,
  18340. WRAP_ARY_FLAG = 128,
  18341. WRAP_REARG_FLAG = 256,
  18342. WRAP_FLIP_FLAG = 512;
  18343. /** Used as default options for `_.truncate`. */
  18344. var DEFAULT_TRUNC_LENGTH = 30,
  18345. DEFAULT_TRUNC_OMISSION = '...';
  18346. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  18347. var HOT_COUNT = 800,
  18348. HOT_SPAN = 16;
  18349. /** Used to indicate the type of lazy iteratees. */
  18350. var LAZY_FILTER_FLAG = 1,
  18351. LAZY_MAP_FLAG = 2,
  18352. LAZY_WHILE_FLAG = 3;
  18353. /** Used as references for various `Number` constants. */
  18354. var INFINITY = 1 / 0,
  18355. MAX_SAFE_INTEGER = 9007199254740991,
  18356. MAX_INTEGER = 1.7976931348623157e+308,
  18357. NAN = 0 / 0;
  18358. /** Used as references for the maximum length and index of an array. */
  18359. var MAX_ARRAY_LENGTH = 4294967295,
  18360. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  18361. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  18362. /** Used to associate wrap methods with their bit flags. */
  18363. var wrapFlags = [
  18364. ['ary', WRAP_ARY_FLAG],
  18365. ['bind', WRAP_BIND_FLAG],
  18366. ['bindKey', WRAP_BIND_KEY_FLAG],
  18367. ['curry', WRAP_CURRY_FLAG],
  18368. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  18369. ['flip', WRAP_FLIP_FLAG],
  18370. ['partial', WRAP_PARTIAL_FLAG],
  18371. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  18372. ['rearg', WRAP_REARG_FLAG]
  18373. ];
  18374. /** `Object#toString` result references. */
  18375. var argsTag = '[object Arguments]',
  18376. arrayTag = '[object Array]',
  18377. asyncTag = '[object AsyncFunction]',
  18378. boolTag = '[object Boolean]',
  18379. dateTag = '[object Date]',
  18380. domExcTag = '[object DOMException]',
  18381. errorTag = '[object Error]',
  18382. funcTag = '[object Function]',
  18383. genTag = '[object GeneratorFunction]',
  18384. mapTag = '[object Map]',
  18385. numberTag = '[object Number]',
  18386. nullTag = '[object Null]',
  18387. objectTag = '[object Object]',
  18388. promiseTag = '[object Promise]',
  18389. proxyTag = '[object Proxy]',
  18390. regexpTag = '[object RegExp]',
  18391. setTag = '[object Set]',
  18392. stringTag = '[object String]',
  18393. symbolTag = '[object Symbol]',
  18394. undefinedTag = '[object Undefined]',
  18395. weakMapTag = '[object WeakMap]',
  18396. weakSetTag = '[object WeakSet]';
  18397. var arrayBufferTag = '[object ArrayBuffer]',
  18398. dataViewTag = '[object DataView]',
  18399. float32Tag = '[object Float32Array]',
  18400. float64Tag = '[object Float64Array]',
  18401. int8Tag = '[object Int8Array]',
  18402. int16Tag = '[object Int16Array]',
  18403. int32Tag = '[object Int32Array]',
  18404. uint8Tag = '[object Uint8Array]',
  18405. uint8ClampedTag = '[object Uint8ClampedArray]',
  18406. uint16Tag = '[object Uint16Array]',
  18407. uint32Tag = '[object Uint32Array]';
  18408. /** Used to match empty string literals in compiled template source. */
  18409. var reEmptyStringLeading = /\b__p \+= '';/g,
  18410. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  18411. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  18412. /** Used to match HTML entities and HTML characters. */
  18413. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  18414. reUnescapedHtml = /[&<>"']/g,
  18415. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  18416. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  18417. /** Used to match template delimiters. */
  18418. var reEscape = /<%-([\s\S]+?)%>/g,
  18419. reEvaluate = /<%([\s\S]+?)%>/g,
  18420. reInterpolate = /<%=([\s\S]+?)%>/g;
  18421. /** Used to match property names within property paths. */
  18422. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  18423. reIsPlainProp = /^\w*$/,
  18424. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  18425. /**
  18426. * Used to match `RegExp`
  18427. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  18428. */
  18429. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  18430. reHasRegExpChar = RegExp(reRegExpChar.source);
  18431. /** Used to match leading and trailing whitespace. */
  18432. var reTrim = /^\s+|\s+$/g,
  18433. reTrimStart = /^\s+/,
  18434. reTrimEnd = /\s+$/;
  18435. /** Used to match wrap detail comments. */
  18436. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  18437. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  18438. reSplitDetails = /,? & /;
  18439. /** Used to match words composed of alphanumeric characters. */
  18440. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  18441. /** Used to match backslashes in property paths. */
  18442. var reEscapeChar = /\\(\\)?/g;
  18443. /**
  18444. * Used to match
  18445. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  18446. */
  18447. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  18448. /** Used to match `RegExp` flags from their coerced string values. */
  18449. var reFlags = /\w*$/;
  18450. /** Used to detect bad signed hexadecimal string values. */
  18451. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  18452. /** Used to detect binary string values. */
  18453. var reIsBinary = /^0b[01]+$/i;
  18454. /** Used to detect host constructors (Safari). */
  18455. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  18456. /** Used to detect octal string values. */
  18457. var reIsOctal = /^0o[0-7]+$/i;
  18458. /** Used to detect unsigned integer values. */
  18459. var reIsUint = /^(?:0|[1-9]\d*)$/;
  18460. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  18461. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  18462. /** Used to ensure capturing order of template delimiters. */
  18463. var reNoMatch = /($^)/;
  18464. /** Used to match unescaped characters in compiled string literals. */
  18465. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  18466. /** Used to compose unicode character classes. */
  18467. var rsAstralRange = '\\ud800-\\udfff',
  18468. rsComboMarksRange = '\\u0300-\\u036f',
  18469. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  18470. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  18471. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  18472. rsDingbatRange = '\\u2700-\\u27bf',
  18473. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  18474. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  18475. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  18476. rsPunctuationRange = '\\u2000-\\u206f',
  18477. 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',
  18478. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  18479. rsVarRange = '\\ufe0e\\ufe0f',
  18480. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  18481. /** Used to compose unicode capture groups. */
  18482. var rsApos = "['\u2019]",
  18483. rsAstral = '[' + rsAstralRange + ']',
  18484. rsBreak = '[' + rsBreakRange + ']',
  18485. rsCombo = '[' + rsComboRange + ']',
  18486. rsDigits = '\\d+',
  18487. rsDingbat = '[' + rsDingbatRange + ']',
  18488. rsLower = '[' + rsLowerRange + ']',
  18489. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  18490. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  18491. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  18492. rsNonAstral = '[^' + rsAstralRange + ']',
  18493. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  18494. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  18495. rsUpper = '[' + rsUpperRange + ']',
  18496. rsZWJ = '\\u200d';
  18497. /** Used to compose unicode regexes. */
  18498. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  18499. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  18500. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  18501. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  18502. reOptMod = rsModifier + '?',
  18503. rsOptVar = '[' + rsVarRange + ']?',
  18504. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  18505. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  18506. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  18507. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  18508. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  18509. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  18510. /** Used to match apostrophes. */
  18511. var reApos = RegExp(rsApos, 'g');
  18512. /**
  18513. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  18514. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  18515. */
  18516. var reComboMark = RegExp(rsCombo, 'g');
  18517. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  18518. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  18519. /** Used to match complex or compound words. */
  18520. var reUnicodeWord = RegExp([
  18521. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  18522. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  18523. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  18524. rsUpper + '+' + rsOptContrUpper,
  18525. rsOrdUpper,
  18526. rsOrdLower,
  18527. rsDigits,
  18528. rsEmoji
  18529. ].join('|'), 'g');
  18530. /** 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/). */
  18531. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  18532. /** Used to detect strings that need a more robust regexp to match words. */
  18533. 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 ]/;
  18534. /** Used to assign default `context` object properties. */
  18535. var contextProps = [
  18536. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  18537. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  18538. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  18539. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  18540. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  18541. ];
  18542. /** Used to make template sourceURLs easier to identify. */
  18543. var templateCounter = -1;
  18544. /** Used to identify `toStringTag` values of typed arrays. */
  18545. var typedArrayTags = {};
  18546. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  18547. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  18548. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  18549. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  18550. typedArrayTags[uint32Tag] = true;
  18551. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  18552. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  18553. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  18554. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  18555. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  18556. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  18557. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  18558. typedArrayTags[weakMapTag] = false;
  18559. /** Used to identify `toStringTag` values supported by `_.clone`. */
  18560. var cloneableTags = {};
  18561. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  18562. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  18563. cloneableTags[boolTag] = cloneableTags[dateTag] =
  18564. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  18565. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  18566. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  18567. cloneableTags[numberTag] = cloneableTags[objectTag] =
  18568. cloneableTags[regexpTag] = cloneableTags[setTag] =
  18569. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  18570. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  18571. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  18572. cloneableTags[errorTag] = cloneableTags[funcTag] =
  18573. cloneableTags[weakMapTag] = false;
  18574. /** Used to map Latin Unicode letters to basic Latin letters. */
  18575. var deburredLetters = {
  18576. // Latin-1 Supplement block.
  18577. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  18578. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  18579. '\xc7': 'C', '\xe7': 'c',
  18580. '\xd0': 'D', '\xf0': 'd',
  18581. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  18582. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  18583. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  18584. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  18585. '\xd1': 'N', '\xf1': 'n',
  18586. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  18587. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  18588. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  18589. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  18590. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  18591. '\xc6': 'Ae', '\xe6': 'ae',
  18592. '\xde': 'Th', '\xfe': 'th',
  18593. '\xdf': 'ss',
  18594. // Latin Extended-A block.
  18595. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  18596. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  18597. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  18598. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  18599. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  18600. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  18601. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  18602. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  18603. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  18604. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  18605. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  18606. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  18607. '\u0134': 'J', '\u0135': 'j',
  18608. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  18609. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  18610. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  18611. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  18612. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  18613. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  18614. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  18615. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  18616. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  18617. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  18618. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  18619. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  18620. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  18621. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  18622. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  18623. '\u0174': 'W', '\u0175': 'w',
  18624. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  18625. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  18626. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  18627. '\u0132': 'IJ', '\u0133': 'ij',
  18628. '\u0152': 'Oe', '\u0153': 'oe',
  18629. '\u0149': "'n", '\u017f': 's'
  18630. };
  18631. /** Used to map characters to HTML entities. */
  18632. var htmlEscapes = {
  18633. '&': '&amp;',
  18634. '<': '&lt;',
  18635. '>': '&gt;',
  18636. '"': '&quot;',
  18637. "'": '&#39;'
  18638. };
  18639. /** Used to map HTML entities to characters. */
  18640. var htmlUnescapes = {
  18641. '&amp;': '&',
  18642. '&lt;': '<',
  18643. '&gt;': '>',
  18644. '&quot;': '"',
  18645. '&#39;': "'"
  18646. };
  18647. /** Used to escape characters for inclusion in compiled string literals. */
  18648. var stringEscapes = {
  18649. '\\': '\\',
  18650. "'": "'",
  18651. '\n': 'n',
  18652. '\r': 'r',
  18653. '\u2028': 'u2028',
  18654. '\u2029': 'u2029'
  18655. };
  18656. /** Built-in method references without a dependency on `root`. */
  18657. var freeParseFloat = parseFloat,
  18658. freeParseInt = parseInt;
  18659. /** Detect free variable `global` from Node.js. */
  18660. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  18661. /** Detect free variable `self`. */
  18662. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  18663. /** Used as a reference to the global object. */
  18664. var root = freeGlobal || freeSelf || Function('return this')();
  18665. /** Detect free variable `exports`. */
  18666. var freeExports = true && exports && !exports.nodeType && exports;
  18667. /** Detect free variable `module`. */
  18668. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  18669. /** Detect the popular CommonJS extension `module.exports`. */
  18670. var moduleExports = freeModule && freeModule.exports === freeExports;
  18671. /** Detect free variable `process` from Node.js. */
  18672. var freeProcess = moduleExports && freeGlobal.process;
  18673. /** Used to access faster Node.js helpers. */
  18674. var nodeUtil = (function() {
  18675. try {
  18676. // Use `util.types` for Node.js 10+.
  18677. var types = freeModule && freeModule.require && freeModule.require('util').types;
  18678. if (types) {
  18679. return types;
  18680. }
  18681. // Legacy `process.binding('util')` for Node.js < 10.
  18682. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  18683. } catch (e) {}
  18684. }());
  18685. /* Node.js helper references. */
  18686. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  18687. nodeIsDate = nodeUtil && nodeUtil.isDate,
  18688. nodeIsMap = nodeUtil && nodeUtil.isMap,
  18689. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  18690. nodeIsSet = nodeUtil && nodeUtil.isSet,
  18691. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  18692. /*--------------------------------------------------------------------------*/
  18693. /**
  18694. * A faster alternative to `Function#apply`, this function invokes `func`
  18695. * with the `this` binding of `thisArg` and the arguments of `args`.
  18696. *
  18697. * @private
  18698. * @param {Function} func The function to invoke.
  18699. * @param {*} thisArg The `this` binding of `func`.
  18700. * @param {Array} args The arguments to invoke `func` with.
  18701. * @returns {*} Returns the result of `func`.
  18702. */
  18703. function apply(func, thisArg, args) {
  18704. switch (args.length) {
  18705. case 0: return func.call(thisArg);
  18706. case 1: return func.call(thisArg, args[0]);
  18707. case 2: return func.call(thisArg, args[0], args[1]);
  18708. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  18709. }
  18710. return func.apply(thisArg, args);
  18711. }
  18712. /**
  18713. * A specialized version of `baseAggregator` for arrays.
  18714. *
  18715. * @private
  18716. * @param {Array} [array] The array to iterate over.
  18717. * @param {Function} setter The function to set `accumulator` values.
  18718. * @param {Function} iteratee The iteratee to transform keys.
  18719. * @param {Object} accumulator The initial aggregated object.
  18720. * @returns {Function} Returns `accumulator`.
  18721. */
  18722. function arrayAggregator(array, setter, iteratee, accumulator) {
  18723. var index = -1,
  18724. length = array == null ? 0 : array.length;
  18725. while (++index < length) {
  18726. var value = array[index];
  18727. setter(accumulator, value, iteratee(value), array);
  18728. }
  18729. return accumulator;
  18730. }
  18731. /**
  18732. * A specialized version of `_.forEach` for arrays without support for
  18733. * iteratee shorthands.
  18734. *
  18735. * @private
  18736. * @param {Array} [array] The array to iterate over.
  18737. * @param {Function} iteratee The function invoked per iteration.
  18738. * @returns {Array} Returns `array`.
  18739. */
  18740. function arrayEach(array, iteratee) {
  18741. var index = -1,
  18742. length = array == null ? 0 : array.length;
  18743. while (++index < length) {
  18744. if (iteratee(array[index], index, array) === false) {
  18745. break;
  18746. }
  18747. }
  18748. return array;
  18749. }
  18750. /**
  18751. * A specialized version of `_.forEachRight` for arrays without support for
  18752. * iteratee shorthands.
  18753. *
  18754. * @private
  18755. * @param {Array} [array] The array to iterate over.
  18756. * @param {Function} iteratee The function invoked per iteration.
  18757. * @returns {Array} Returns `array`.
  18758. */
  18759. function arrayEachRight(array, iteratee) {
  18760. var length = array == null ? 0 : array.length;
  18761. while (length--) {
  18762. if (iteratee(array[length], length, array) === false) {
  18763. break;
  18764. }
  18765. }
  18766. return array;
  18767. }
  18768. /**
  18769. * A specialized version of `_.every` for arrays without support for
  18770. * iteratee shorthands.
  18771. *
  18772. * @private
  18773. * @param {Array} [array] The array to iterate over.
  18774. * @param {Function} predicate The function invoked per iteration.
  18775. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  18776. * else `false`.
  18777. */
  18778. function arrayEvery(array, predicate) {
  18779. var index = -1,
  18780. length = array == null ? 0 : array.length;
  18781. while (++index < length) {
  18782. if (!predicate(array[index], index, array)) {
  18783. return false;
  18784. }
  18785. }
  18786. return true;
  18787. }
  18788. /**
  18789. * A specialized version of `_.filter` for arrays without support for
  18790. * iteratee shorthands.
  18791. *
  18792. * @private
  18793. * @param {Array} [array] The array to iterate over.
  18794. * @param {Function} predicate The function invoked per iteration.
  18795. * @returns {Array} Returns the new filtered array.
  18796. */
  18797. function arrayFilter(array, predicate) {
  18798. var index = -1,
  18799. length = array == null ? 0 : array.length,
  18800. resIndex = 0,
  18801. result = [];
  18802. while (++index < length) {
  18803. var value = array[index];
  18804. if (predicate(value, index, array)) {
  18805. result[resIndex++] = value;
  18806. }
  18807. }
  18808. return result;
  18809. }
  18810. /**
  18811. * A specialized version of `_.includes` for arrays without support for
  18812. * specifying an index to search from.
  18813. *
  18814. * @private
  18815. * @param {Array} [array] The array to inspect.
  18816. * @param {*} target The value to search for.
  18817. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18818. */
  18819. function arrayIncludes(array, value) {
  18820. var length = array == null ? 0 : array.length;
  18821. return !!length && baseIndexOf(array, value, 0) > -1;
  18822. }
  18823. /**
  18824. * This function is like `arrayIncludes` except that it accepts a comparator.
  18825. *
  18826. * @private
  18827. * @param {Array} [array] The array to inspect.
  18828. * @param {*} target The value to search for.
  18829. * @param {Function} comparator The comparator invoked per element.
  18830. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18831. */
  18832. function arrayIncludesWith(array, value, comparator) {
  18833. var index = -1,
  18834. length = array == null ? 0 : array.length;
  18835. while (++index < length) {
  18836. if (comparator(value, array[index])) {
  18837. return true;
  18838. }
  18839. }
  18840. return false;
  18841. }
  18842. /**
  18843. * A specialized version of `_.map` for arrays without support for iteratee
  18844. * shorthands.
  18845. *
  18846. * @private
  18847. * @param {Array} [array] The array to iterate over.
  18848. * @param {Function} iteratee The function invoked per iteration.
  18849. * @returns {Array} Returns the new mapped array.
  18850. */
  18851. function arrayMap(array, iteratee) {
  18852. var index = -1,
  18853. length = array == null ? 0 : array.length,
  18854. result = Array(length);
  18855. while (++index < length) {
  18856. result[index] = iteratee(array[index], index, array);
  18857. }
  18858. return result;
  18859. }
  18860. /**
  18861. * Appends the elements of `values` to `array`.
  18862. *
  18863. * @private
  18864. * @param {Array} array The array to modify.
  18865. * @param {Array} values The values to append.
  18866. * @returns {Array} Returns `array`.
  18867. */
  18868. function arrayPush(array, values) {
  18869. var index = -1,
  18870. length = values.length,
  18871. offset = array.length;
  18872. while (++index < length) {
  18873. array[offset + index] = values[index];
  18874. }
  18875. return array;
  18876. }
  18877. /**
  18878. * A specialized version of `_.reduce` for arrays without support for
  18879. * iteratee shorthands.
  18880. *
  18881. * @private
  18882. * @param {Array} [array] The array to iterate over.
  18883. * @param {Function} iteratee The function invoked per iteration.
  18884. * @param {*} [accumulator] The initial value.
  18885. * @param {boolean} [initAccum] Specify using the first element of `array` as
  18886. * the initial value.
  18887. * @returns {*} Returns the accumulated value.
  18888. */
  18889. function arrayReduce(array, iteratee, accumulator, initAccum) {
  18890. var index = -1,
  18891. length = array == null ? 0 : array.length;
  18892. if (initAccum && length) {
  18893. accumulator = array[++index];
  18894. }
  18895. while (++index < length) {
  18896. accumulator = iteratee(accumulator, array[index], index, array);
  18897. }
  18898. return accumulator;
  18899. }
  18900. /**
  18901. * A specialized version of `_.reduceRight` for arrays without support for
  18902. * iteratee shorthands.
  18903. *
  18904. * @private
  18905. * @param {Array} [array] The array to iterate over.
  18906. * @param {Function} iteratee The function invoked per iteration.
  18907. * @param {*} [accumulator] The initial value.
  18908. * @param {boolean} [initAccum] Specify using the last element of `array` as
  18909. * the initial value.
  18910. * @returns {*} Returns the accumulated value.
  18911. */
  18912. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  18913. var length = array == null ? 0 : array.length;
  18914. if (initAccum && length) {
  18915. accumulator = array[--length];
  18916. }
  18917. while (length--) {
  18918. accumulator = iteratee(accumulator, array[length], length, array);
  18919. }
  18920. return accumulator;
  18921. }
  18922. /**
  18923. * A specialized version of `_.some` for arrays without support for iteratee
  18924. * shorthands.
  18925. *
  18926. * @private
  18927. * @param {Array} [array] The array to iterate over.
  18928. * @param {Function} predicate The function invoked per iteration.
  18929. * @returns {boolean} Returns `true` if any element passes the predicate check,
  18930. * else `false`.
  18931. */
  18932. function arraySome(array, predicate) {
  18933. var index = -1,
  18934. length = array == null ? 0 : array.length;
  18935. while (++index < length) {
  18936. if (predicate(array[index], index, array)) {
  18937. return true;
  18938. }
  18939. }
  18940. return false;
  18941. }
  18942. /**
  18943. * Gets the size of an ASCII `string`.
  18944. *
  18945. * @private
  18946. * @param {string} string The string inspect.
  18947. * @returns {number} Returns the string size.
  18948. */
  18949. var asciiSize = baseProperty('length');
  18950. /**
  18951. * Converts an ASCII `string` to an array.
  18952. *
  18953. * @private
  18954. * @param {string} string The string to convert.
  18955. * @returns {Array} Returns the converted array.
  18956. */
  18957. function asciiToArray(string) {
  18958. return string.split('');
  18959. }
  18960. /**
  18961. * Splits an ASCII `string` into an array of its words.
  18962. *
  18963. * @private
  18964. * @param {string} The string to inspect.
  18965. * @returns {Array} Returns the words of `string`.
  18966. */
  18967. function asciiWords(string) {
  18968. return string.match(reAsciiWord) || [];
  18969. }
  18970. /**
  18971. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  18972. * without support for iteratee shorthands, which iterates over `collection`
  18973. * using `eachFunc`.
  18974. *
  18975. * @private
  18976. * @param {Array|Object} collection The collection to inspect.
  18977. * @param {Function} predicate The function invoked per iteration.
  18978. * @param {Function} eachFunc The function to iterate over `collection`.
  18979. * @returns {*} Returns the found element or its key, else `undefined`.
  18980. */
  18981. function baseFindKey(collection, predicate, eachFunc) {
  18982. var result;
  18983. eachFunc(collection, function(value, key, collection) {
  18984. if (predicate(value, key, collection)) {
  18985. result = key;
  18986. return false;
  18987. }
  18988. });
  18989. return result;
  18990. }
  18991. /**
  18992. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  18993. * support for iteratee shorthands.
  18994. *
  18995. * @private
  18996. * @param {Array} array The array to inspect.
  18997. * @param {Function} predicate The function invoked per iteration.
  18998. * @param {number} fromIndex The index to search from.
  18999. * @param {boolean} [fromRight] Specify iterating from right to left.
  19000. * @returns {number} Returns the index of the matched value, else `-1`.
  19001. */
  19002. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  19003. var length = array.length,
  19004. index = fromIndex + (fromRight ? 1 : -1);
  19005. while ((fromRight ? index-- : ++index < length)) {
  19006. if (predicate(array[index], index, array)) {
  19007. return index;
  19008. }
  19009. }
  19010. return -1;
  19011. }
  19012. /**
  19013. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  19014. *
  19015. * @private
  19016. * @param {Array} array The array to inspect.
  19017. * @param {*} value The value to search for.
  19018. * @param {number} fromIndex The index to search from.
  19019. * @returns {number} Returns the index of the matched value, else `-1`.
  19020. */
  19021. function baseIndexOf(array, value, fromIndex) {
  19022. return value === value
  19023. ? strictIndexOf(array, value, fromIndex)
  19024. : baseFindIndex(array, baseIsNaN, fromIndex);
  19025. }
  19026. /**
  19027. * This function is like `baseIndexOf` except that it accepts a comparator.
  19028. *
  19029. * @private
  19030. * @param {Array} array The array to inspect.
  19031. * @param {*} value The value to search for.
  19032. * @param {number} fromIndex The index to search from.
  19033. * @param {Function} comparator The comparator invoked per element.
  19034. * @returns {number} Returns the index of the matched value, else `-1`.
  19035. */
  19036. function baseIndexOfWith(array, value, fromIndex, comparator) {
  19037. var index = fromIndex - 1,
  19038. length = array.length;
  19039. while (++index < length) {
  19040. if (comparator(array[index], value)) {
  19041. return index;
  19042. }
  19043. }
  19044. return -1;
  19045. }
  19046. /**
  19047. * The base implementation of `_.isNaN` without support for number objects.
  19048. *
  19049. * @private
  19050. * @param {*} value The value to check.
  19051. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  19052. */
  19053. function baseIsNaN(value) {
  19054. return value !== value;
  19055. }
  19056. /**
  19057. * The base implementation of `_.mean` and `_.meanBy` without support for
  19058. * iteratee shorthands.
  19059. *
  19060. * @private
  19061. * @param {Array} array The array to iterate over.
  19062. * @param {Function} iteratee The function invoked per iteration.
  19063. * @returns {number} Returns the mean.
  19064. */
  19065. function baseMean(array, iteratee) {
  19066. var length = array == null ? 0 : array.length;
  19067. return length ? (baseSum(array, iteratee) / length) : NAN;
  19068. }
  19069. /**
  19070. * The base implementation of `_.property` without support for deep paths.
  19071. *
  19072. * @private
  19073. * @param {string} key The key of the property to get.
  19074. * @returns {Function} Returns the new accessor function.
  19075. */
  19076. function baseProperty(key) {
  19077. return function(object) {
  19078. return object == null ? undefined : object[key];
  19079. };
  19080. }
  19081. /**
  19082. * The base implementation of `_.propertyOf` without support for deep paths.
  19083. *
  19084. * @private
  19085. * @param {Object} object The object to query.
  19086. * @returns {Function} Returns the new accessor function.
  19087. */
  19088. function basePropertyOf(object) {
  19089. return function(key) {
  19090. return object == null ? undefined : object[key];
  19091. };
  19092. }
  19093. /**
  19094. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  19095. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  19096. *
  19097. * @private
  19098. * @param {Array|Object} collection The collection to iterate over.
  19099. * @param {Function} iteratee The function invoked per iteration.
  19100. * @param {*} accumulator The initial value.
  19101. * @param {boolean} initAccum Specify using the first or last element of
  19102. * `collection` as the initial value.
  19103. * @param {Function} eachFunc The function to iterate over `collection`.
  19104. * @returns {*} Returns the accumulated value.
  19105. */
  19106. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  19107. eachFunc(collection, function(value, index, collection) {
  19108. accumulator = initAccum
  19109. ? (initAccum = false, value)
  19110. : iteratee(accumulator, value, index, collection);
  19111. });
  19112. return accumulator;
  19113. }
  19114. /**
  19115. * The base implementation of `_.sortBy` which uses `comparer` to define the
  19116. * sort order of `array` and replaces criteria objects with their corresponding
  19117. * values.
  19118. *
  19119. * @private
  19120. * @param {Array} array The array to sort.
  19121. * @param {Function} comparer The function to define sort order.
  19122. * @returns {Array} Returns `array`.
  19123. */
  19124. function baseSortBy(array, comparer) {
  19125. var length = array.length;
  19126. array.sort(comparer);
  19127. while (length--) {
  19128. array[length] = array[length].value;
  19129. }
  19130. return array;
  19131. }
  19132. /**
  19133. * The base implementation of `_.sum` and `_.sumBy` without support for
  19134. * iteratee shorthands.
  19135. *
  19136. * @private
  19137. * @param {Array} array The array to iterate over.
  19138. * @param {Function} iteratee The function invoked per iteration.
  19139. * @returns {number} Returns the sum.
  19140. */
  19141. function baseSum(array, iteratee) {
  19142. var result,
  19143. index = -1,
  19144. length = array.length;
  19145. while (++index < length) {
  19146. var current = iteratee(array[index]);
  19147. if (current !== undefined) {
  19148. result = result === undefined ? current : (result + current);
  19149. }
  19150. }
  19151. return result;
  19152. }
  19153. /**
  19154. * The base implementation of `_.times` without support for iteratee shorthands
  19155. * or max array length checks.
  19156. *
  19157. * @private
  19158. * @param {number} n The number of times to invoke `iteratee`.
  19159. * @param {Function} iteratee The function invoked per iteration.
  19160. * @returns {Array} Returns the array of results.
  19161. */
  19162. function baseTimes(n, iteratee) {
  19163. var index = -1,
  19164. result = Array(n);
  19165. while (++index < n) {
  19166. result[index] = iteratee(index);
  19167. }
  19168. return result;
  19169. }
  19170. /**
  19171. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  19172. * of key-value pairs for `object` corresponding to the property names of `props`.
  19173. *
  19174. * @private
  19175. * @param {Object} object The object to query.
  19176. * @param {Array} props The property names to get values for.
  19177. * @returns {Object} Returns the key-value pairs.
  19178. */
  19179. function baseToPairs(object, props) {
  19180. return arrayMap(props, function(key) {
  19181. return [key, object[key]];
  19182. });
  19183. }
  19184. /**
  19185. * The base implementation of `_.unary` without support for storing metadata.
  19186. *
  19187. * @private
  19188. * @param {Function} func The function to cap arguments for.
  19189. * @returns {Function} Returns the new capped function.
  19190. */
  19191. function baseUnary(func) {
  19192. return function(value) {
  19193. return func(value);
  19194. };
  19195. }
  19196. /**
  19197. * The base implementation of `_.values` and `_.valuesIn` which creates an
  19198. * array of `object` property values corresponding to the property names
  19199. * of `props`.
  19200. *
  19201. * @private
  19202. * @param {Object} object The object to query.
  19203. * @param {Array} props The property names to get values for.
  19204. * @returns {Object} Returns the array of property values.
  19205. */
  19206. function baseValues(object, props) {
  19207. return arrayMap(props, function(key) {
  19208. return object[key];
  19209. });
  19210. }
  19211. /**
  19212. * Checks if a `cache` value for `key` exists.
  19213. *
  19214. * @private
  19215. * @param {Object} cache The cache to query.
  19216. * @param {string} key The key of the entry to check.
  19217. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19218. */
  19219. function cacheHas(cache, key) {
  19220. return cache.has(key);
  19221. }
  19222. /**
  19223. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  19224. * that is not found in the character symbols.
  19225. *
  19226. * @private
  19227. * @param {Array} strSymbols The string symbols to inspect.
  19228. * @param {Array} chrSymbols The character symbols to find.
  19229. * @returns {number} Returns the index of the first unmatched string symbol.
  19230. */
  19231. function charsStartIndex(strSymbols, chrSymbols) {
  19232. var index = -1,
  19233. length = strSymbols.length;
  19234. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19235. return index;
  19236. }
  19237. /**
  19238. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  19239. * that is not found in the character symbols.
  19240. *
  19241. * @private
  19242. * @param {Array} strSymbols The string symbols to inspect.
  19243. * @param {Array} chrSymbols The character symbols to find.
  19244. * @returns {number} Returns the index of the last unmatched string symbol.
  19245. */
  19246. function charsEndIndex(strSymbols, chrSymbols) {
  19247. var index = strSymbols.length;
  19248. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19249. return index;
  19250. }
  19251. /**
  19252. * Gets the number of `placeholder` occurrences in `array`.
  19253. *
  19254. * @private
  19255. * @param {Array} array The array to inspect.
  19256. * @param {*} placeholder The placeholder to search for.
  19257. * @returns {number} Returns the placeholder count.
  19258. */
  19259. function countHolders(array, placeholder) {
  19260. var length = array.length,
  19261. result = 0;
  19262. while (length--) {
  19263. if (array[length] === placeholder) {
  19264. ++result;
  19265. }
  19266. }
  19267. return result;
  19268. }
  19269. /**
  19270. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  19271. * letters to basic Latin letters.
  19272. *
  19273. * @private
  19274. * @param {string} letter The matched letter to deburr.
  19275. * @returns {string} Returns the deburred letter.
  19276. */
  19277. var deburrLetter = basePropertyOf(deburredLetters);
  19278. /**
  19279. * Used by `_.escape` to convert characters to HTML entities.
  19280. *
  19281. * @private
  19282. * @param {string} chr The matched character to escape.
  19283. * @returns {string} Returns the escaped character.
  19284. */
  19285. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  19286. /**
  19287. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  19288. *
  19289. * @private
  19290. * @param {string} chr The matched character to escape.
  19291. * @returns {string} Returns the escaped character.
  19292. */
  19293. function escapeStringChar(chr) {
  19294. return '\\' + stringEscapes[chr];
  19295. }
  19296. /**
  19297. * Gets the value at `key` of `object`.
  19298. *
  19299. * @private
  19300. * @param {Object} [object] The object to query.
  19301. * @param {string} key The key of the property to get.
  19302. * @returns {*} Returns the property value.
  19303. */
  19304. function getValue(object, key) {
  19305. return object == null ? undefined : object[key];
  19306. }
  19307. /**
  19308. * Checks if `string` contains Unicode symbols.
  19309. *
  19310. * @private
  19311. * @param {string} string The string to inspect.
  19312. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  19313. */
  19314. function hasUnicode(string) {
  19315. return reHasUnicode.test(string);
  19316. }
  19317. /**
  19318. * Checks if `string` contains a word composed of Unicode symbols.
  19319. *
  19320. * @private
  19321. * @param {string} string The string to inspect.
  19322. * @returns {boolean} Returns `true` if a word is found, else `false`.
  19323. */
  19324. function hasUnicodeWord(string) {
  19325. return reHasUnicodeWord.test(string);
  19326. }
  19327. /**
  19328. * Converts `iterator` to an array.
  19329. *
  19330. * @private
  19331. * @param {Object} iterator The iterator to convert.
  19332. * @returns {Array} Returns the converted array.
  19333. */
  19334. function iteratorToArray(iterator) {
  19335. var data,
  19336. result = [];
  19337. while (!(data = iterator.next()).done) {
  19338. result.push(data.value);
  19339. }
  19340. return result;
  19341. }
  19342. /**
  19343. * Converts `map` to its key-value pairs.
  19344. *
  19345. * @private
  19346. * @param {Object} map The map to convert.
  19347. * @returns {Array} Returns the key-value pairs.
  19348. */
  19349. function mapToArray(map) {
  19350. var index = -1,
  19351. result = Array(map.size);
  19352. map.forEach(function(value, key) {
  19353. result[++index] = [key, value];
  19354. });
  19355. return result;
  19356. }
  19357. /**
  19358. * Creates a unary function that invokes `func` with its argument transformed.
  19359. *
  19360. * @private
  19361. * @param {Function} func The function to wrap.
  19362. * @param {Function} transform The argument transform.
  19363. * @returns {Function} Returns the new function.
  19364. */
  19365. function overArg(func, transform) {
  19366. return function(arg) {
  19367. return func(transform(arg));
  19368. };
  19369. }
  19370. /**
  19371. * Replaces all `placeholder` elements in `array` with an internal placeholder
  19372. * and returns an array of their indexes.
  19373. *
  19374. * @private
  19375. * @param {Array} array The array to modify.
  19376. * @param {*} placeholder The placeholder to replace.
  19377. * @returns {Array} Returns the new array of placeholder indexes.
  19378. */
  19379. function replaceHolders(array, placeholder) {
  19380. var index = -1,
  19381. length = array.length,
  19382. resIndex = 0,
  19383. result = [];
  19384. while (++index < length) {
  19385. var value = array[index];
  19386. if (value === placeholder || value === PLACEHOLDER) {
  19387. array[index] = PLACEHOLDER;
  19388. result[resIndex++] = index;
  19389. }
  19390. }
  19391. return result;
  19392. }
  19393. /**
  19394. * Converts `set` to an array of its values.
  19395. *
  19396. * @private
  19397. * @param {Object} set The set to convert.
  19398. * @returns {Array} Returns the values.
  19399. */
  19400. function setToArray(set) {
  19401. var index = -1,
  19402. result = Array(set.size);
  19403. set.forEach(function(value) {
  19404. result[++index] = value;
  19405. });
  19406. return result;
  19407. }
  19408. /**
  19409. * Converts `set` to its value-value pairs.
  19410. *
  19411. * @private
  19412. * @param {Object} set The set to convert.
  19413. * @returns {Array} Returns the value-value pairs.
  19414. */
  19415. function setToPairs(set) {
  19416. var index = -1,
  19417. result = Array(set.size);
  19418. set.forEach(function(value) {
  19419. result[++index] = [value, value];
  19420. });
  19421. return result;
  19422. }
  19423. /**
  19424. * A specialized version of `_.indexOf` which performs strict equality
  19425. * comparisons of values, i.e. `===`.
  19426. *
  19427. * @private
  19428. * @param {Array} array The array to inspect.
  19429. * @param {*} value The value to search for.
  19430. * @param {number} fromIndex The index to search from.
  19431. * @returns {number} Returns the index of the matched value, else `-1`.
  19432. */
  19433. function strictIndexOf(array, value, fromIndex) {
  19434. var index = fromIndex - 1,
  19435. length = array.length;
  19436. while (++index < length) {
  19437. if (array[index] === value) {
  19438. return index;
  19439. }
  19440. }
  19441. return -1;
  19442. }
  19443. /**
  19444. * A specialized version of `_.lastIndexOf` which performs strict equality
  19445. * comparisons of values, i.e. `===`.
  19446. *
  19447. * @private
  19448. * @param {Array} array The array to inspect.
  19449. * @param {*} value The value to search for.
  19450. * @param {number} fromIndex The index to search from.
  19451. * @returns {number} Returns the index of the matched value, else `-1`.
  19452. */
  19453. function strictLastIndexOf(array, value, fromIndex) {
  19454. var index = fromIndex + 1;
  19455. while (index--) {
  19456. if (array[index] === value) {
  19457. return index;
  19458. }
  19459. }
  19460. return index;
  19461. }
  19462. /**
  19463. * Gets the number of symbols in `string`.
  19464. *
  19465. * @private
  19466. * @param {string} string The string to inspect.
  19467. * @returns {number} Returns the string size.
  19468. */
  19469. function stringSize(string) {
  19470. return hasUnicode(string)
  19471. ? unicodeSize(string)
  19472. : asciiSize(string);
  19473. }
  19474. /**
  19475. * Converts `string` to an array.
  19476. *
  19477. * @private
  19478. * @param {string} string The string to convert.
  19479. * @returns {Array} Returns the converted array.
  19480. */
  19481. function stringToArray(string) {
  19482. return hasUnicode(string)
  19483. ? unicodeToArray(string)
  19484. : asciiToArray(string);
  19485. }
  19486. /**
  19487. * Used by `_.unescape` to convert HTML entities to characters.
  19488. *
  19489. * @private
  19490. * @param {string} chr The matched character to unescape.
  19491. * @returns {string} Returns the unescaped character.
  19492. */
  19493. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  19494. /**
  19495. * Gets the size of a Unicode `string`.
  19496. *
  19497. * @private
  19498. * @param {string} string The string inspect.
  19499. * @returns {number} Returns the string size.
  19500. */
  19501. function unicodeSize(string) {
  19502. var result = reUnicode.lastIndex = 0;
  19503. while (reUnicode.test(string)) {
  19504. ++result;
  19505. }
  19506. return result;
  19507. }
  19508. /**
  19509. * Converts a Unicode `string` to an array.
  19510. *
  19511. * @private
  19512. * @param {string} string The string to convert.
  19513. * @returns {Array} Returns the converted array.
  19514. */
  19515. function unicodeToArray(string) {
  19516. return string.match(reUnicode) || [];
  19517. }
  19518. /**
  19519. * Splits a Unicode `string` into an array of its words.
  19520. *
  19521. * @private
  19522. * @param {string} The string to inspect.
  19523. * @returns {Array} Returns the words of `string`.
  19524. */
  19525. function unicodeWords(string) {
  19526. return string.match(reUnicodeWord) || [];
  19527. }
  19528. /*--------------------------------------------------------------------------*/
  19529. /**
  19530. * Create a new pristine `lodash` function using the `context` object.
  19531. *
  19532. * @static
  19533. * @memberOf _
  19534. * @since 1.1.0
  19535. * @category Util
  19536. * @param {Object} [context=root] The context object.
  19537. * @returns {Function} Returns a new `lodash` function.
  19538. * @example
  19539. *
  19540. * _.mixin({ 'foo': _.constant('foo') });
  19541. *
  19542. * var lodash = _.runInContext();
  19543. * lodash.mixin({ 'bar': lodash.constant('bar') });
  19544. *
  19545. * _.isFunction(_.foo);
  19546. * // => true
  19547. * _.isFunction(_.bar);
  19548. * // => false
  19549. *
  19550. * lodash.isFunction(lodash.foo);
  19551. * // => false
  19552. * lodash.isFunction(lodash.bar);
  19553. * // => true
  19554. *
  19555. * // Create a suped-up `defer` in Node.js.
  19556. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  19557. */
  19558. var runInContext = (function runInContext(context) {
  19559. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  19560. /** Built-in constructor references. */
  19561. var Array = context.Array,
  19562. Date = context.Date,
  19563. Error = context.Error,
  19564. Function = context.Function,
  19565. Math = context.Math,
  19566. Object = context.Object,
  19567. RegExp = context.RegExp,
  19568. String = context.String,
  19569. TypeError = context.TypeError;
  19570. /** Used for built-in method references. */
  19571. var arrayProto = Array.prototype,
  19572. funcProto = Function.prototype,
  19573. objectProto = Object.prototype;
  19574. /** Used to detect overreaching core-js shims. */
  19575. var coreJsData = context['__core-js_shared__'];
  19576. /** Used to resolve the decompiled source of functions. */
  19577. var funcToString = funcProto.toString;
  19578. /** Used to check objects for own properties. */
  19579. var hasOwnProperty = objectProto.hasOwnProperty;
  19580. /** Used to generate unique IDs. */
  19581. var idCounter = 0;
  19582. /** Used to detect methods masquerading as native. */
  19583. var maskSrcKey = (function() {
  19584. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  19585. return uid ? ('Symbol(src)_1.' + uid) : '';
  19586. }());
  19587. /**
  19588. * Used to resolve the
  19589. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  19590. * of values.
  19591. */
  19592. var nativeObjectToString = objectProto.toString;
  19593. /** Used to infer the `Object` constructor. */
  19594. var objectCtorString = funcToString.call(Object);
  19595. /** Used to restore the original `_` reference in `_.noConflict`. */
  19596. var oldDash = root._;
  19597. /** Used to detect if a method is native. */
  19598. var reIsNative = RegExp('^' +
  19599. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  19600. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  19601. );
  19602. /** Built-in value references. */
  19603. var Buffer = moduleExports ? context.Buffer : undefined,
  19604. Symbol = context.Symbol,
  19605. Uint8Array = context.Uint8Array,
  19606. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  19607. getPrototype = overArg(Object.getPrototypeOf, Object),
  19608. objectCreate = Object.create,
  19609. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  19610. splice = arrayProto.splice,
  19611. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  19612. symIterator = Symbol ? Symbol.iterator : undefined,
  19613. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  19614. var defineProperty = (function() {
  19615. try {
  19616. var func = getNative(Object, 'defineProperty');
  19617. func({}, '', {});
  19618. return func;
  19619. } catch (e) {}
  19620. }());
  19621. /** Mocked built-ins. */
  19622. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  19623. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  19624. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  19625. /* Built-in method references for those with the same name as other `lodash` methods. */
  19626. var nativeCeil = Math.ceil,
  19627. nativeFloor = Math.floor,
  19628. nativeGetSymbols = Object.getOwnPropertySymbols,
  19629. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  19630. nativeIsFinite = context.isFinite,
  19631. nativeJoin = arrayProto.join,
  19632. nativeKeys = overArg(Object.keys, Object),
  19633. nativeMax = Math.max,
  19634. nativeMin = Math.min,
  19635. nativeNow = Date.now,
  19636. nativeParseInt = context.parseInt,
  19637. nativeRandom = Math.random,
  19638. nativeReverse = arrayProto.reverse;
  19639. /* Built-in method references that are verified to be native. */
  19640. var DataView = getNative(context, 'DataView'),
  19641. Map = getNative(context, 'Map'),
  19642. Promise = getNative(context, 'Promise'),
  19643. Set = getNative(context, 'Set'),
  19644. WeakMap = getNative(context, 'WeakMap'),
  19645. nativeCreate = getNative(Object, 'create');
  19646. /** Used to store function metadata. */
  19647. var metaMap = WeakMap && new WeakMap;
  19648. /** Used to lookup unminified function names. */
  19649. var realNames = {};
  19650. /** Used to detect maps, sets, and weakmaps. */
  19651. var dataViewCtorString = toSource(DataView),
  19652. mapCtorString = toSource(Map),
  19653. promiseCtorString = toSource(Promise),
  19654. setCtorString = toSource(Set),
  19655. weakMapCtorString = toSource(WeakMap);
  19656. /** Used to convert symbols to primitives and strings. */
  19657. var symbolProto = Symbol ? Symbol.prototype : undefined,
  19658. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  19659. symbolToString = symbolProto ? symbolProto.toString : undefined;
  19660. /*------------------------------------------------------------------------*/
  19661. /**
  19662. * Creates a `lodash` object which wraps `value` to enable implicit method
  19663. * chain sequences. Methods that operate on and return arrays, collections,
  19664. * and functions can be chained together. Methods that retrieve a single value
  19665. * or may return a primitive value will automatically end the chain sequence
  19666. * and return the unwrapped value. Otherwise, the value must be unwrapped
  19667. * with `_#value`.
  19668. *
  19669. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  19670. * enabled using `_.chain`.
  19671. *
  19672. * The execution of chained methods is lazy, that is, it's deferred until
  19673. * `_#value` is implicitly or explicitly called.
  19674. *
  19675. * Lazy evaluation allows several methods to support shortcut fusion.
  19676. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  19677. * the creation of intermediate arrays and can greatly reduce the number of
  19678. * iteratee executions. Sections of a chain sequence qualify for shortcut
  19679. * fusion if the section is applied to an array and iteratees accept only
  19680. * one argument. The heuristic for whether a section qualifies for shortcut
  19681. * fusion is subject to change.
  19682. *
  19683. * Chaining is supported in custom builds as long as the `_#value` method is
  19684. * directly or indirectly included in the build.
  19685. *
  19686. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  19687. *
  19688. * The wrapper `Array` methods are:
  19689. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  19690. *
  19691. * The wrapper `String` methods are:
  19692. * `replace` and `split`
  19693. *
  19694. * The wrapper methods that support shortcut fusion are:
  19695. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  19696. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  19697. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  19698. *
  19699. * The chainable wrapper methods are:
  19700. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  19701. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  19702. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  19703. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  19704. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  19705. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  19706. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  19707. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  19708. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  19709. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  19710. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  19711. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  19712. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  19713. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  19714. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  19715. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  19716. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  19717. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  19718. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  19719. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  19720. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  19721. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  19722. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  19723. * `zipObject`, `zipObjectDeep`, and `zipWith`
  19724. *
  19725. * The wrapper methods that are **not** chainable by default are:
  19726. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  19727. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  19728. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  19729. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  19730. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  19731. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  19732. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  19733. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  19734. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  19735. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  19736. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  19737. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  19738. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  19739. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  19740. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  19741. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  19742. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  19743. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  19744. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  19745. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  19746. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  19747. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  19748. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  19749. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  19750. * `upperFirst`, `value`, and `words`
  19751. *
  19752. * @name _
  19753. * @constructor
  19754. * @category Seq
  19755. * @param {*} value The value to wrap in a `lodash` instance.
  19756. * @returns {Object} Returns the new `lodash` wrapper instance.
  19757. * @example
  19758. *
  19759. * function square(n) {
  19760. * return n * n;
  19761. * }
  19762. *
  19763. * var wrapped = _([1, 2, 3]);
  19764. *
  19765. * // Returns an unwrapped value.
  19766. * wrapped.reduce(_.add);
  19767. * // => 6
  19768. *
  19769. * // Returns a wrapped value.
  19770. * var squares = wrapped.map(square);
  19771. *
  19772. * _.isArray(squares);
  19773. * // => false
  19774. *
  19775. * _.isArray(squares.value());
  19776. * // => true
  19777. */
  19778. function lodash(value) {
  19779. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  19780. if (value instanceof LodashWrapper) {
  19781. return value;
  19782. }
  19783. if (hasOwnProperty.call(value, '__wrapped__')) {
  19784. return wrapperClone(value);
  19785. }
  19786. }
  19787. return new LodashWrapper(value);
  19788. }
  19789. /**
  19790. * The base implementation of `_.create` without support for assigning
  19791. * properties to the created object.
  19792. *
  19793. * @private
  19794. * @param {Object} proto The object to inherit from.
  19795. * @returns {Object} Returns the new object.
  19796. */
  19797. var baseCreate = (function() {
  19798. function object() {}
  19799. return function(proto) {
  19800. if (!isObject(proto)) {
  19801. return {};
  19802. }
  19803. if (objectCreate) {
  19804. return objectCreate(proto);
  19805. }
  19806. object.prototype = proto;
  19807. var result = new object;
  19808. object.prototype = undefined;
  19809. return result;
  19810. };
  19811. }());
  19812. /**
  19813. * The function whose prototype chain sequence wrappers inherit from.
  19814. *
  19815. * @private
  19816. */
  19817. function baseLodash() {
  19818. // No operation performed.
  19819. }
  19820. /**
  19821. * The base constructor for creating `lodash` wrapper objects.
  19822. *
  19823. * @private
  19824. * @param {*} value The value to wrap.
  19825. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  19826. */
  19827. function LodashWrapper(value, chainAll) {
  19828. this.__wrapped__ = value;
  19829. this.__actions__ = [];
  19830. this.__chain__ = !!chainAll;
  19831. this.__index__ = 0;
  19832. this.__values__ = undefined;
  19833. }
  19834. /**
  19835. * By default, the template delimiters used by lodash are like those in
  19836. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  19837. * following template settings to use alternative delimiters.
  19838. *
  19839. * @static
  19840. * @memberOf _
  19841. * @type {Object}
  19842. */
  19843. lodash.templateSettings = {
  19844. /**
  19845. * Used to detect `data` property values to be HTML-escaped.
  19846. *
  19847. * @memberOf _.templateSettings
  19848. * @type {RegExp}
  19849. */
  19850. 'escape': reEscape,
  19851. /**
  19852. * Used to detect code to be evaluated.
  19853. *
  19854. * @memberOf _.templateSettings
  19855. * @type {RegExp}
  19856. */
  19857. 'evaluate': reEvaluate,
  19858. /**
  19859. * Used to detect `data` property values to inject.
  19860. *
  19861. * @memberOf _.templateSettings
  19862. * @type {RegExp}
  19863. */
  19864. 'interpolate': reInterpolate,
  19865. /**
  19866. * Used to reference the data object in the template text.
  19867. *
  19868. * @memberOf _.templateSettings
  19869. * @type {string}
  19870. */
  19871. 'variable': '',
  19872. /**
  19873. * Used to import variables into the compiled template.
  19874. *
  19875. * @memberOf _.templateSettings
  19876. * @type {Object}
  19877. */
  19878. 'imports': {
  19879. /**
  19880. * A reference to the `lodash` function.
  19881. *
  19882. * @memberOf _.templateSettings.imports
  19883. * @type {Function}
  19884. */
  19885. '_': lodash
  19886. }
  19887. };
  19888. // Ensure wrappers are instances of `baseLodash`.
  19889. lodash.prototype = baseLodash.prototype;
  19890. lodash.prototype.constructor = lodash;
  19891. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  19892. LodashWrapper.prototype.constructor = LodashWrapper;
  19893. /*------------------------------------------------------------------------*/
  19894. /**
  19895. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  19896. *
  19897. * @private
  19898. * @constructor
  19899. * @param {*} value The value to wrap.
  19900. */
  19901. function LazyWrapper(value) {
  19902. this.__wrapped__ = value;
  19903. this.__actions__ = [];
  19904. this.__dir__ = 1;
  19905. this.__filtered__ = false;
  19906. this.__iteratees__ = [];
  19907. this.__takeCount__ = MAX_ARRAY_LENGTH;
  19908. this.__views__ = [];
  19909. }
  19910. /**
  19911. * Creates a clone of the lazy wrapper object.
  19912. *
  19913. * @private
  19914. * @name clone
  19915. * @memberOf LazyWrapper
  19916. * @returns {Object} Returns the cloned `LazyWrapper` object.
  19917. */
  19918. function lazyClone() {
  19919. var result = new LazyWrapper(this.__wrapped__);
  19920. result.__actions__ = copyArray(this.__actions__);
  19921. result.__dir__ = this.__dir__;
  19922. result.__filtered__ = this.__filtered__;
  19923. result.__iteratees__ = copyArray(this.__iteratees__);
  19924. result.__takeCount__ = this.__takeCount__;
  19925. result.__views__ = copyArray(this.__views__);
  19926. return result;
  19927. }
  19928. /**
  19929. * Reverses the direction of lazy iteration.
  19930. *
  19931. * @private
  19932. * @name reverse
  19933. * @memberOf LazyWrapper
  19934. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  19935. */
  19936. function lazyReverse() {
  19937. if (this.__filtered__) {
  19938. var result = new LazyWrapper(this);
  19939. result.__dir__ = -1;
  19940. result.__filtered__ = true;
  19941. } else {
  19942. result = this.clone();
  19943. result.__dir__ *= -1;
  19944. }
  19945. return result;
  19946. }
  19947. /**
  19948. * Extracts the unwrapped value from its lazy wrapper.
  19949. *
  19950. * @private
  19951. * @name value
  19952. * @memberOf LazyWrapper
  19953. * @returns {*} Returns the unwrapped value.
  19954. */
  19955. function lazyValue() {
  19956. var array = this.__wrapped__.value(),
  19957. dir = this.__dir__,
  19958. isArr = isArray(array),
  19959. isRight = dir < 0,
  19960. arrLength = isArr ? array.length : 0,
  19961. view = getView(0, arrLength, this.__views__),
  19962. start = view.start,
  19963. end = view.end,
  19964. length = end - start,
  19965. index = isRight ? end : (start - 1),
  19966. iteratees = this.__iteratees__,
  19967. iterLength = iteratees.length,
  19968. resIndex = 0,
  19969. takeCount = nativeMin(length, this.__takeCount__);
  19970. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  19971. return baseWrapperValue(array, this.__actions__);
  19972. }
  19973. var result = [];
  19974. outer:
  19975. while (length-- && resIndex < takeCount) {
  19976. index += dir;
  19977. var iterIndex = -1,
  19978. value = array[index];
  19979. while (++iterIndex < iterLength) {
  19980. var data = iteratees[iterIndex],
  19981. iteratee = data.iteratee,
  19982. type = data.type,
  19983. computed = iteratee(value);
  19984. if (type == LAZY_MAP_FLAG) {
  19985. value = computed;
  19986. } else if (!computed) {
  19987. if (type == LAZY_FILTER_FLAG) {
  19988. continue outer;
  19989. } else {
  19990. break outer;
  19991. }
  19992. }
  19993. }
  19994. result[resIndex++] = value;
  19995. }
  19996. return result;
  19997. }
  19998. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  19999. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  20000. LazyWrapper.prototype.constructor = LazyWrapper;
  20001. /*------------------------------------------------------------------------*/
  20002. /**
  20003. * Creates a hash object.
  20004. *
  20005. * @private
  20006. * @constructor
  20007. * @param {Array} [entries] The key-value pairs to cache.
  20008. */
  20009. function Hash(entries) {
  20010. var index = -1,
  20011. length = entries == null ? 0 : entries.length;
  20012. this.clear();
  20013. while (++index < length) {
  20014. var entry = entries[index];
  20015. this.set(entry[0], entry[1]);
  20016. }
  20017. }
  20018. /**
  20019. * Removes all key-value entries from the hash.
  20020. *
  20021. * @private
  20022. * @name clear
  20023. * @memberOf Hash
  20024. */
  20025. function hashClear() {
  20026. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  20027. this.size = 0;
  20028. }
  20029. /**
  20030. * Removes `key` and its value from the hash.
  20031. *
  20032. * @private
  20033. * @name delete
  20034. * @memberOf Hash
  20035. * @param {Object} hash The hash to modify.
  20036. * @param {string} key The key of the value to remove.
  20037. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20038. */
  20039. function hashDelete(key) {
  20040. var result = this.has(key) && delete this.__data__[key];
  20041. this.size -= result ? 1 : 0;
  20042. return result;
  20043. }
  20044. /**
  20045. * Gets the hash value for `key`.
  20046. *
  20047. * @private
  20048. * @name get
  20049. * @memberOf Hash
  20050. * @param {string} key The key of the value to get.
  20051. * @returns {*} Returns the entry value.
  20052. */
  20053. function hashGet(key) {
  20054. var data = this.__data__;
  20055. if (nativeCreate) {
  20056. var result = data[key];
  20057. return result === HASH_UNDEFINED ? undefined : result;
  20058. }
  20059. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  20060. }
  20061. /**
  20062. * Checks if a hash value for `key` exists.
  20063. *
  20064. * @private
  20065. * @name has
  20066. * @memberOf Hash
  20067. * @param {string} key The key of the entry to check.
  20068. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20069. */
  20070. function hashHas(key) {
  20071. var data = this.__data__;
  20072. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  20073. }
  20074. /**
  20075. * Sets the hash `key` to `value`.
  20076. *
  20077. * @private
  20078. * @name set
  20079. * @memberOf Hash
  20080. * @param {string} key The key of the value to set.
  20081. * @param {*} value The value to set.
  20082. * @returns {Object} Returns the hash instance.
  20083. */
  20084. function hashSet(key, value) {
  20085. var data = this.__data__;
  20086. this.size += this.has(key) ? 0 : 1;
  20087. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  20088. return this;
  20089. }
  20090. // Add methods to `Hash`.
  20091. Hash.prototype.clear = hashClear;
  20092. Hash.prototype['delete'] = hashDelete;
  20093. Hash.prototype.get = hashGet;
  20094. Hash.prototype.has = hashHas;
  20095. Hash.prototype.set = hashSet;
  20096. /*------------------------------------------------------------------------*/
  20097. /**
  20098. * Creates an list cache object.
  20099. *
  20100. * @private
  20101. * @constructor
  20102. * @param {Array} [entries] The key-value pairs to cache.
  20103. */
  20104. function ListCache(entries) {
  20105. var index = -1,
  20106. length = entries == null ? 0 : entries.length;
  20107. this.clear();
  20108. while (++index < length) {
  20109. var entry = entries[index];
  20110. this.set(entry[0], entry[1]);
  20111. }
  20112. }
  20113. /**
  20114. * Removes all key-value entries from the list cache.
  20115. *
  20116. * @private
  20117. * @name clear
  20118. * @memberOf ListCache
  20119. */
  20120. function listCacheClear() {
  20121. this.__data__ = [];
  20122. this.size = 0;
  20123. }
  20124. /**
  20125. * Removes `key` and its value from the list cache.
  20126. *
  20127. * @private
  20128. * @name delete
  20129. * @memberOf ListCache
  20130. * @param {string} key The key of the value to remove.
  20131. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20132. */
  20133. function listCacheDelete(key) {
  20134. var data = this.__data__,
  20135. index = assocIndexOf(data, key);
  20136. if (index < 0) {
  20137. return false;
  20138. }
  20139. var lastIndex = data.length - 1;
  20140. if (index == lastIndex) {
  20141. data.pop();
  20142. } else {
  20143. splice.call(data, index, 1);
  20144. }
  20145. --this.size;
  20146. return true;
  20147. }
  20148. /**
  20149. * Gets the list cache value for `key`.
  20150. *
  20151. * @private
  20152. * @name get
  20153. * @memberOf ListCache
  20154. * @param {string} key The key of the value to get.
  20155. * @returns {*} Returns the entry value.
  20156. */
  20157. function listCacheGet(key) {
  20158. var data = this.__data__,
  20159. index = assocIndexOf(data, key);
  20160. return index < 0 ? undefined : data[index][1];
  20161. }
  20162. /**
  20163. * Checks if a list cache value for `key` exists.
  20164. *
  20165. * @private
  20166. * @name has
  20167. * @memberOf ListCache
  20168. * @param {string} key The key of the entry to check.
  20169. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20170. */
  20171. function listCacheHas(key) {
  20172. return assocIndexOf(this.__data__, key) > -1;
  20173. }
  20174. /**
  20175. * Sets the list cache `key` to `value`.
  20176. *
  20177. * @private
  20178. * @name set
  20179. * @memberOf ListCache
  20180. * @param {string} key The key of the value to set.
  20181. * @param {*} value The value to set.
  20182. * @returns {Object} Returns the list cache instance.
  20183. */
  20184. function listCacheSet(key, value) {
  20185. var data = this.__data__,
  20186. index = assocIndexOf(data, key);
  20187. if (index < 0) {
  20188. ++this.size;
  20189. data.push([key, value]);
  20190. } else {
  20191. data[index][1] = value;
  20192. }
  20193. return this;
  20194. }
  20195. // Add methods to `ListCache`.
  20196. ListCache.prototype.clear = listCacheClear;
  20197. ListCache.prototype['delete'] = listCacheDelete;
  20198. ListCache.prototype.get = listCacheGet;
  20199. ListCache.prototype.has = listCacheHas;
  20200. ListCache.prototype.set = listCacheSet;
  20201. /*------------------------------------------------------------------------*/
  20202. /**
  20203. * Creates a map cache object to store key-value pairs.
  20204. *
  20205. * @private
  20206. * @constructor
  20207. * @param {Array} [entries] The key-value pairs to cache.
  20208. */
  20209. function MapCache(entries) {
  20210. var index = -1,
  20211. length = entries == null ? 0 : entries.length;
  20212. this.clear();
  20213. while (++index < length) {
  20214. var entry = entries[index];
  20215. this.set(entry[0], entry[1]);
  20216. }
  20217. }
  20218. /**
  20219. * Removes all key-value entries from the map.
  20220. *
  20221. * @private
  20222. * @name clear
  20223. * @memberOf MapCache
  20224. */
  20225. function mapCacheClear() {
  20226. this.size = 0;
  20227. this.__data__ = {
  20228. 'hash': new Hash,
  20229. 'map': new (Map || ListCache),
  20230. 'string': new Hash
  20231. };
  20232. }
  20233. /**
  20234. * Removes `key` and its value from the map.
  20235. *
  20236. * @private
  20237. * @name delete
  20238. * @memberOf MapCache
  20239. * @param {string} key The key of the value to remove.
  20240. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20241. */
  20242. function mapCacheDelete(key) {
  20243. var result = getMapData(this, key)['delete'](key);
  20244. this.size -= result ? 1 : 0;
  20245. return result;
  20246. }
  20247. /**
  20248. * Gets the map value for `key`.
  20249. *
  20250. * @private
  20251. * @name get
  20252. * @memberOf MapCache
  20253. * @param {string} key The key of the value to get.
  20254. * @returns {*} Returns the entry value.
  20255. */
  20256. function mapCacheGet(key) {
  20257. return getMapData(this, key).get(key);
  20258. }
  20259. /**
  20260. * Checks if a map value for `key` exists.
  20261. *
  20262. * @private
  20263. * @name has
  20264. * @memberOf MapCache
  20265. * @param {string} key The key of the entry to check.
  20266. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20267. */
  20268. function mapCacheHas(key) {
  20269. return getMapData(this, key).has(key);
  20270. }
  20271. /**
  20272. * Sets the map `key` to `value`.
  20273. *
  20274. * @private
  20275. * @name set
  20276. * @memberOf MapCache
  20277. * @param {string} key The key of the value to set.
  20278. * @param {*} value The value to set.
  20279. * @returns {Object} Returns the map cache instance.
  20280. */
  20281. function mapCacheSet(key, value) {
  20282. var data = getMapData(this, key),
  20283. size = data.size;
  20284. data.set(key, value);
  20285. this.size += data.size == size ? 0 : 1;
  20286. return this;
  20287. }
  20288. // Add methods to `MapCache`.
  20289. MapCache.prototype.clear = mapCacheClear;
  20290. MapCache.prototype['delete'] = mapCacheDelete;
  20291. MapCache.prototype.get = mapCacheGet;
  20292. MapCache.prototype.has = mapCacheHas;
  20293. MapCache.prototype.set = mapCacheSet;
  20294. /*------------------------------------------------------------------------*/
  20295. /**
  20296. *
  20297. * Creates an array cache object to store unique values.
  20298. *
  20299. * @private
  20300. * @constructor
  20301. * @param {Array} [values] The values to cache.
  20302. */
  20303. function SetCache(values) {
  20304. var index = -1,
  20305. length = values == null ? 0 : values.length;
  20306. this.__data__ = new MapCache;
  20307. while (++index < length) {
  20308. this.add(values[index]);
  20309. }
  20310. }
  20311. /**
  20312. * Adds `value` to the array cache.
  20313. *
  20314. * @private
  20315. * @name add
  20316. * @memberOf SetCache
  20317. * @alias push
  20318. * @param {*} value The value to cache.
  20319. * @returns {Object} Returns the cache instance.
  20320. */
  20321. function setCacheAdd(value) {
  20322. this.__data__.set(value, HASH_UNDEFINED);
  20323. return this;
  20324. }
  20325. /**
  20326. * Checks if `value` is in the array cache.
  20327. *
  20328. * @private
  20329. * @name has
  20330. * @memberOf SetCache
  20331. * @param {*} value The value to search for.
  20332. * @returns {number} Returns `true` if `value` is found, else `false`.
  20333. */
  20334. function setCacheHas(value) {
  20335. return this.__data__.has(value);
  20336. }
  20337. // Add methods to `SetCache`.
  20338. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  20339. SetCache.prototype.has = setCacheHas;
  20340. /*------------------------------------------------------------------------*/
  20341. /**
  20342. * Creates a stack cache object to store key-value pairs.
  20343. *
  20344. * @private
  20345. * @constructor
  20346. * @param {Array} [entries] The key-value pairs to cache.
  20347. */
  20348. function Stack(entries) {
  20349. var data = this.__data__ = new ListCache(entries);
  20350. this.size = data.size;
  20351. }
  20352. /**
  20353. * Removes all key-value entries from the stack.
  20354. *
  20355. * @private
  20356. * @name clear
  20357. * @memberOf Stack
  20358. */
  20359. function stackClear() {
  20360. this.__data__ = new ListCache;
  20361. this.size = 0;
  20362. }
  20363. /**
  20364. * Removes `key` and its value from the stack.
  20365. *
  20366. * @private
  20367. * @name delete
  20368. * @memberOf Stack
  20369. * @param {string} key The key of the value to remove.
  20370. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20371. */
  20372. function stackDelete(key) {
  20373. var data = this.__data__,
  20374. result = data['delete'](key);
  20375. this.size = data.size;
  20376. return result;
  20377. }
  20378. /**
  20379. * Gets the stack value for `key`.
  20380. *
  20381. * @private
  20382. * @name get
  20383. * @memberOf Stack
  20384. * @param {string} key The key of the value to get.
  20385. * @returns {*} Returns the entry value.
  20386. */
  20387. function stackGet(key) {
  20388. return this.__data__.get(key);
  20389. }
  20390. /**
  20391. * Checks if a stack value for `key` exists.
  20392. *
  20393. * @private
  20394. * @name has
  20395. * @memberOf Stack
  20396. * @param {string} key The key of the entry to check.
  20397. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20398. */
  20399. function stackHas(key) {
  20400. return this.__data__.has(key);
  20401. }
  20402. /**
  20403. * Sets the stack `key` to `value`.
  20404. *
  20405. * @private
  20406. * @name set
  20407. * @memberOf Stack
  20408. * @param {string} key The key of the value to set.
  20409. * @param {*} value The value to set.
  20410. * @returns {Object} Returns the stack cache instance.
  20411. */
  20412. function stackSet(key, value) {
  20413. var data = this.__data__;
  20414. if (data instanceof ListCache) {
  20415. var pairs = data.__data__;
  20416. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  20417. pairs.push([key, value]);
  20418. this.size = ++data.size;
  20419. return this;
  20420. }
  20421. data = this.__data__ = new MapCache(pairs);
  20422. }
  20423. data.set(key, value);
  20424. this.size = data.size;
  20425. return this;
  20426. }
  20427. // Add methods to `Stack`.
  20428. Stack.prototype.clear = stackClear;
  20429. Stack.prototype['delete'] = stackDelete;
  20430. Stack.prototype.get = stackGet;
  20431. Stack.prototype.has = stackHas;
  20432. Stack.prototype.set = stackSet;
  20433. /*------------------------------------------------------------------------*/
  20434. /**
  20435. * Creates an array of the enumerable property names of the array-like `value`.
  20436. *
  20437. * @private
  20438. * @param {*} value The value to query.
  20439. * @param {boolean} inherited Specify returning inherited property names.
  20440. * @returns {Array} Returns the array of property names.
  20441. */
  20442. function arrayLikeKeys(value, inherited) {
  20443. var isArr = isArray(value),
  20444. isArg = !isArr && isArguments(value),
  20445. isBuff = !isArr && !isArg && isBuffer(value),
  20446. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  20447. skipIndexes = isArr || isArg || isBuff || isType,
  20448. result = skipIndexes ? baseTimes(value.length, String) : [],
  20449. length = result.length;
  20450. for (var key in value) {
  20451. if ((inherited || hasOwnProperty.call(value, key)) &&
  20452. !(skipIndexes && (
  20453. // Safari 9 has enumerable `arguments.length` in strict mode.
  20454. key == 'length' ||
  20455. // Node.js 0.10 has enumerable non-index properties on buffers.
  20456. (isBuff && (key == 'offset' || key == 'parent')) ||
  20457. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  20458. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  20459. // Skip index properties.
  20460. isIndex(key, length)
  20461. ))) {
  20462. result.push(key);
  20463. }
  20464. }
  20465. return result;
  20466. }
  20467. /**
  20468. * A specialized version of `_.sample` for arrays.
  20469. *
  20470. * @private
  20471. * @param {Array} array The array to sample.
  20472. * @returns {*} Returns the random element.
  20473. */
  20474. function arraySample(array) {
  20475. var length = array.length;
  20476. return length ? array[baseRandom(0, length - 1)] : undefined;
  20477. }
  20478. /**
  20479. * A specialized version of `_.sampleSize` for arrays.
  20480. *
  20481. * @private
  20482. * @param {Array} array The array to sample.
  20483. * @param {number} n The number of elements to sample.
  20484. * @returns {Array} Returns the random elements.
  20485. */
  20486. function arraySampleSize(array, n) {
  20487. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  20488. }
  20489. /**
  20490. * A specialized version of `_.shuffle` for arrays.
  20491. *
  20492. * @private
  20493. * @param {Array} array The array to shuffle.
  20494. * @returns {Array} Returns the new shuffled array.
  20495. */
  20496. function arrayShuffle(array) {
  20497. return shuffleSelf(copyArray(array));
  20498. }
  20499. /**
  20500. * This function is like `assignValue` except that it doesn't assign
  20501. * `undefined` values.
  20502. *
  20503. * @private
  20504. * @param {Object} object The object to modify.
  20505. * @param {string} key The key of the property to assign.
  20506. * @param {*} value The value to assign.
  20507. */
  20508. function assignMergeValue(object, key, value) {
  20509. if ((value !== undefined && !eq(object[key], value)) ||
  20510. (value === undefined && !(key in object))) {
  20511. baseAssignValue(object, key, value);
  20512. }
  20513. }
  20514. /**
  20515. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  20516. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20517. * for equality comparisons.
  20518. *
  20519. * @private
  20520. * @param {Object} object The object to modify.
  20521. * @param {string} key The key of the property to assign.
  20522. * @param {*} value The value to assign.
  20523. */
  20524. function assignValue(object, key, value) {
  20525. var objValue = object[key];
  20526. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  20527. (value === undefined && !(key in object))) {
  20528. baseAssignValue(object, key, value);
  20529. }
  20530. }
  20531. /**
  20532. * Gets the index at which the `key` is found in `array` of key-value pairs.
  20533. *
  20534. * @private
  20535. * @param {Array} array The array to inspect.
  20536. * @param {*} key The key to search for.
  20537. * @returns {number} Returns the index of the matched value, else `-1`.
  20538. */
  20539. function assocIndexOf(array, key) {
  20540. var length = array.length;
  20541. while (length--) {
  20542. if (eq(array[length][0], key)) {
  20543. return length;
  20544. }
  20545. }
  20546. return -1;
  20547. }
  20548. /**
  20549. * Aggregates elements of `collection` on `accumulator` with keys transformed
  20550. * by `iteratee` and values set by `setter`.
  20551. *
  20552. * @private
  20553. * @param {Array|Object} collection The collection to iterate over.
  20554. * @param {Function} setter The function to set `accumulator` values.
  20555. * @param {Function} iteratee The iteratee to transform keys.
  20556. * @param {Object} accumulator The initial aggregated object.
  20557. * @returns {Function} Returns `accumulator`.
  20558. */
  20559. function baseAggregator(collection, setter, iteratee, accumulator) {
  20560. baseEach(collection, function(value, key, collection) {
  20561. setter(accumulator, value, iteratee(value), collection);
  20562. });
  20563. return accumulator;
  20564. }
  20565. /**
  20566. * The base implementation of `_.assign` without support for multiple sources
  20567. * or `customizer` functions.
  20568. *
  20569. * @private
  20570. * @param {Object} object The destination object.
  20571. * @param {Object} source The source object.
  20572. * @returns {Object} Returns `object`.
  20573. */
  20574. function baseAssign(object, source) {
  20575. return object && copyObject(source, keys(source), object);
  20576. }
  20577. /**
  20578. * The base implementation of `_.assignIn` without support for multiple sources
  20579. * or `customizer` functions.
  20580. *
  20581. * @private
  20582. * @param {Object} object The destination object.
  20583. * @param {Object} source The source object.
  20584. * @returns {Object} Returns `object`.
  20585. */
  20586. function baseAssignIn(object, source) {
  20587. return object && copyObject(source, keysIn(source), object);
  20588. }
  20589. /**
  20590. * The base implementation of `assignValue` and `assignMergeValue` without
  20591. * value checks.
  20592. *
  20593. * @private
  20594. * @param {Object} object The object to modify.
  20595. * @param {string} key The key of the property to assign.
  20596. * @param {*} value The value to assign.
  20597. */
  20598. function baseAssignValue(object, key, value) {
  20599. if (key == '__proto__' && defineProperty) {
  20600. defineProperty(object, key, {
  20601. 'configurable': true,
  20602. 'enumerable': true,
  20603. 'value': value,
  20604. 'writable': true
  20605. });
  20606. } else {
  20607. object[key] = value;
  20608. }
  20609. }
  20610. /**
  20611. * The base implementation of `_.at` without support for individual paths.
  20612. *
  20613. * @private
  20614. * @param {Object} object The object to iterate over.
  20615. * @param {string[]} paths The property paths to pick.
  20616. * @returns {Array} Returns the picked elements.
  20617. */
  20618. function baseAt(object, paths) {
  20619. var index = -1,
  20620. length = paths.length,
  20621. result = Array(length),
  20622. skip = object == null;
  20623. while (++index < length) {
  20624. result[index] = skip ? undefined : get(object, paths[index]);
  20625. }
  20626. return result;
  20627. }
  20628. /**
  20629. * The base implementation of `_.clamp` which doesn't coerce arguments.
  20630. *
  20631. * @private
  20632. * @param {number} number The number to clamp.
  20633. * @param {number} [lower] The lower bound.
  20634. * @param {number} upper The upper bound.
  20635. * @returns {number} Returns the clamped number.
  20636. */
  20637. function baseClamp(number, lower, upper) {
  20638. if (number === number) {
  20639. if (upper !== undefined) {
  20640. number = number <= upper ? number : upper;
  20641. }
  20642. if (lower !== undefined) {
  20643. number = number >= lower ? number : lower;
  20644. }
  20645. }
  20646. return number;
  20647. }
  20648. /**
  20649. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  20650. * traversed objects.
  20651. *
  20652. * @private
  20653. * @param {*} value The value to clone.
  20654. * @param {boolean} bitmask The bitmask flags.
  20655. * 1 - Deep clone
  20656. * 2 - Flatten inherited properties
  20657. * 4 - Clone symbols
  20658. * @param {Function} [customizer] The function to customize cloning.
  20659. * @param {string} [key] The key of `value`.
  20660. * @param {Object} [object] The parent object of `value`.
  20661. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  20662. * @returns {*} Returns the cloned value.
  20663. */
  20664. function baseClone(value, bitmask, customizer, key, object, stack) {
  20665. var result,
  20666. isDeep = bitmask & CLONE_DEEP_FLAG,
  20667. isFlat = bitmask & CLONE_FLAT_FLAG,
  20668. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  20669. if (customizer) {
  20670. result = object ? customizer(value, key, object, stack) : customizer(value);
  20671. }
  20672. if (result !== undefined) {
  20673. return result;
  20674. }
  20675. if (!isObject(value)) {
  20676. return value;
  20677. }
  20678. var isArr = isArray(value);
  20679. if (isArr) {
  20680. result = initCloneArray(value);
  20681. if (!isDeep) {
  20682. return copyArray(value, result);
  20683. }
  20684. } else {
  20685. var tag = getTag(value),
  20686. isFunc = tag == funcTag || tag == genTag;
  20687. if (isBuffer(value)) {
  20688. return cloneBuffer(value, isDeep);
  20689. }
  20690. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  20691. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  20692. if (!isDeep) {
  20693. return isFlat
  20694. ? copySymbolsIn(value, baseAssignIn(result, value))
  20695. : copySymbols(value, baseAssign(result, value));
  20696. }
  20697. } else {
  20698. if (!cloneableTags[tag]) {
  20699. return object ? value : {};
  20700. }
  20701. result = initCloneByTag(value, tag, isDeep);
  20702. }
  20703. }
  20704. // Check for circular references and return its corresponding clone.
  20705. stack || (stack = new Stack);
  20706. var stacked = stack.get(value);
  20707. if (stacked) {
  20708. return stacked;
  20709. }
  20710. stack.set(value, result);
  20711. if (isSet(value)) {
  20712. value.forEach(function(subValue) {
  20713. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  20714. });
  20715. } else if (isMap(value)) {
  20716. value.forEach(function(subValue, key) {
  20717. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20718. });
  20719. }
  20720. var keysFunc = isFull
  20721. ? (isFlat ? getAllKeysIn : getAllKeys)
  20722. : (isFlat ? keysIn : keys);
  20723. var props = isArr ? undefined : keysFunc(value);
  20724. arrayEach(props || value, function(subValue, key) {
  20725. if (props) {
  20726. key = subValue;
  20727. subValue = value[key];
  20728. }
  20729. // Recursively populate clone (susceptible to call stack limits).
  20730. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20731. });
  20732. return result;
  20733. }
  20734. /**
  20735. * The base implementation of `_.conforms` which doesn't clone `source`.
  20736. *
  20737. * @private
  20738. * @param {Object} source The object of property predicates to conform to.
  20739. * @returns {Function} Returns the new spec function.
  20740. */
  20741. function baseConforms(source) {
  20742. var props = keys(source);
  20743. return function(object) {
  20744. return baseConformsTo(object, source, props);
  20745. };
  20746. }
  20747. /**
  20748. * The base implementation of `_.conformsTo` which accepts `props` to check.
  20749. *
  20750. * @private
  20751. * @param {Object} object The object to inspect.
  20752. * @param {Object} source The object of property predicates to conform to.
  20753. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  20754. */
  20755. function baseConformsTo(object, source, props) {
  20756. var length = props.length;
  20757. if (object == null) {
  20758. return !length;
  20759. }
  20760. object = Object(object);
  20761. while (length--) {
  20762. var key = props[length],
  20763. predicate = source[key],
  20764. value = object[key];
  20765. if ((value === undefined && !(key in object)) || !predicate(value)) {
  20766. return false;
  20767. }
  20768. }
  20769. return true;
  20770. }
  20771. /**
  20772. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  20773. * to provide to `func`.
  20774. *
  20775. * @private
  20776. * @param {Function} func The function to delay.
  20777. * @param {number} wait The number of milliseconds to delay invocation.
  20778. * @param {Array} args The arguments to provide to `func`.
  20779. * @returns {number|Object} Returns the timer id or timeout object.
  20780. */
  20781. function baseDelay(func, wait, args) {
  20782. if (typeof func != 'function') {
  20783. throw new TypeError(FUNC_ERROR_TEXT);
  20784. }
  20785. return setTimeout(function() { func.apply(undefined, args); }, wait);
  20786. }
  20787. /**
  20788. * The base implementation of methods like `_.difference` without support
  20789. * for excluding multiple arrays or iteratee shorthands.
  20790. *
  20791. * @private
  20792. * @param {Array} array The array to inspect.
  20793. * @param {Array} values The values to exclude.
  20794. * @param {Function} [iteratee] The iteratee invoked per element.
  20795. * @param {Function} [comparator] The comparator invoked per element.
  20796. * @returns {Array} Returns the new array of filtered values.
  20797. */
  20798. function baseDifference(array, values, iteratee, comparator) {
  20799. var index = -1,
  20800. includes = arrayIncludes,
  20801. isCommon = true,
  20802. length = array.length,
  20803. result = [],
  20804. valuesLength = values.length;
  20805. if (!length) {
  20806. return result;
  20807. }
  20808. if (iteratee) {
  20809. values = arrayMap(values, baseUnary(iteratee));
  20810. }
  20811. if (comparator) {
  20812. includes = arrayIncludesWith;
  20813. isCommon = false;
  20814. }
  20815. else if (values.length >= LARGE_ARRAY_SIZE) {
  20816. includes = cacheHas;
  20817. isCommon = false;
  20818. values = new SetCache(values);
  20819. }
  20820. outer:
  20821. while (++index < length) {
  20822. var value = array[index],
  20823. computed = iteratee == null ? value : iteratee(value);
  20824. value = (comparator || value !== 0) ? value : 0;
  20825. if (isCommon && computed === computed) {
  20826. var valuesIndex = valuesLength;
  20827. while (valuesIndex--) {
  20828. if (values[valuesIndex] === computed) {
  20829. continue outer;
  20830. }
  20831. }
  20832. result.push(value);
  20833. }
  20834. else if (!includes(values, computed, comparator)) {
  20835. result.push(value);
  20836. }
  20837. }
  20838. return result;
  20839. }
  20840. /**
  20841. * The base implementation of `_.forEach` without support for iteratee shorthands.
  20842. *
  20843. * @private
  20844. * @param {Array|Object} collection The collection to iterate over.
  20845. * @param {Function} iteratee The function invoked per iteration.
  20846. * @returns {Array|Object} Returns `collection`.
  20847. */
  20848. var baseEach = createBaseEach(baseForOwn);
  20849. /**
  20850. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  20851. *
  20852. * @private
  20853. * @param {Array|Object} collection The collection to iterate over.
  20854. * @param {Function} iteratee The function invoked per iteration.
  20855. * @returns {Array|Object} Returns `collection`.
  20856. */
  20857. var baseEachRight = createBaseEach(baseForOwnRight, true);
  20858. /**
  20859. * The base implementation of `_.every` without support for iteratee shorthands.
  20860. *
  20861. * @private
  20862. * @param {Array|Object} collection The collection to iterate over.
  20863. * @param {Function} predicate The function invoked per iteration.
  20864. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  20865. * else `false`
  20866. */
  20867. function baseEvery(collection, predicate) {
  20868. var result = true;
  20869. baseEach(collection, function(value, index, collection) {
  20870. result = !!predicate(value, index, collection);
  20871. return result;
  20872. });
  20873. return result;
  20874. }
  20875. /**
  20876. * The base implementation of methods like `_.max` and `_.min` which accepts a
  20877. * `comparator` to determine the extremum value.
  20878. *
  20879. * @private
  20880. * @param {Array} array The array to iterate over.
  20881. * @param {Function} iteratee The iteratee invoked per iteration.
  20882. * @param {Function} comparator The comparator used to compare values.
  20883. * @returns {*} Returns the extremum value.
  20884. */
  20885. function baseExtremum(array, iteratee, comparator) {
  20886. var index = -1,
  20887. length = array.length;
  20888. while (++index < length) {
  20889. var value = array[index],
  20890. current = iteratee(value);
  20891. if (current != null && (computed === undefined
  20892. ? (current === current && !isSymbol(current))
  20893. : comparator(current, computed)
  20894. )) {
  20895. var computed = current,
  20896. result = value;
  20897. }
  20898. }
  20899. return result;
  20900. }
  20901. /**
  20902. * The base implementation of `_.fill` without an iteratee call guard.
  20903. *
  20904. * @private
  20905. * @param {Array} array The array to fill.
  20906. * @param {*} value The value to fill `array` with.
  20907. * @param {number} [start=0] The start position.
  20908. * @param {number} [end=array.length] The end position.
  20909. * @returns {Array} Returns `array`.
  20910. */
  20911. function baseFill(array, value, start, end) {
  20912. var length = array.length;
  20913. start = toInteger(start);
  20914. if (start < 0) {
  20915. start = -start > length ? 0 : (length + start);
  20916. }
  20917. end = (end === undefined || end > length) ? length : toInteger(end);
  20918. if (end < 0) {
  20919. end += length;
  20920. }
  20921. end = start > end ? 0 : toLength(end);
  20922. while (start < end) {
  20923. array[start++] = value;
  20924. }
  20925. return array;
  20926. }
  20927. /**
  20928. * The base implementation of `_.filter` without support for iteratee shorthands.
  20929. *
  20930. * @private
  20931. * @param {Array|Object} collection The collection to iterate over.
  20932. * @param {Function} predicate The function invoked per iteration.
  20933. * @returns {Array} Returns the new filtered array.
  20934. */
  20935. function baseFilter(collection, predicate) {
  20936. var result = [];
  20937. baseEach(collection, function(value, index, collection) {
  20938. if (predicate(value, index, collection)) {
  20939. result.push(value);
  20940. }
  20941. });
  20942. return result;
  20943. }
  20944. /**
  20945. * The base implementation of `_.flatten` with support for restricting flattening.
  20946. *
  20947. * @private
  20948. * @param {Array} array The array to flatten.
  20949. * @param {number} depth The maximum recursion depth.
  20950. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  20951. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  20952. * @param {Array} [result=[]] The initial result value.
  20953. * @returns {Array} Returns the new flattened array.
  20954. */
  20955. function baseFlatten(array, depth, predicate, isStrict, result) {
  20956. var index = -1,
  20957. length = array.length;
  20958. predicate || (predicate = isFlattenable);
  20959. result || (result = []);
  20960. while (++index < length) {
  20961. var value = array[index];
  20962. if (depth > 0 && predicate(value)) {
  20963. if (depth > 1) {
  20964. // Recursively flatten arrays (susceptible to call stack limits).
  20965. baseFlatten(value, depth - 1, predicate, isStrict, result);
  20966. } else {
  20967. arrayPush(result, value);
  20968. }
  20969. } else if (!isStrict) {
  20970. result[result.length] = value;
  20971. }
  20972. }
  20973. return result;
  20974. }
  20975. /**
  20976. * The base implementation of `baseForOwn` which iterates over `object`
  20977. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  20978. * Iteratee functions may exit iteration early by explicitly returning `false`.
  20979. *
  20980. * @private
  20981. * @param {Object} object The object to iterate over.
  20982. * @param {Function} iteratee The function invoked per iteration.
  20983. * @param {Function} keysFunc The function to get the keys of `object`.
  20984. * @returns {Object} Returns `object`.
  20985. */
  20986. var baseFor = createBaseFor();
  20987. /**
  20988. * This function is like `baseFor` except that it iterates over properties
  20989. * in the opposite order.
  20990. *
  20991. * @private
  20992. * @param {Object} object The object to iterate over.
  20993. * @param {Function} iteratee The function invoked per iteration.
  20994. * @param {Function} keysFunc The function to get the keys of `object`.
  20995. * @returns {Object} Returns `object`.
  20996. */
  20997. var baseForRight = createBaseFor(true);
  20998. /**
  20999. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  21000. *
  21001. * @private
  21002. * @param {Object} object The object to iterate over.
  21003. * @param {Function} iteratee The function invoked per iteration.
  21004. * @returns {Object} Returns `object`.
  21005. */
  21006. function baseForOwn(object, iteratee) {
  21007. return object && baseFor(object, iteratee, keys);
  21008. }
  21009. /**
  21010. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  21011. *
  21012. * @private
  21013. * @param {Object} object The object to iterate over.
  21014. * @param {Function} iteratee The function invoked per iteration.
  21015. * @returns {Object} Returns `object`.
  21016. */
  21017. function baseForOwnRight(object, iteratee) {
  21018. return object && baseForRight(object, iteratee, keys);
  21019. }
  21020. /**
  21021. * The base implementation of `_.functions` which creates an array of
  21022. * `object` function property names filtered from `props`.
  21023. *
  21024. * @private
  21025. * @param {Object} object The object to inspect.
  21026. * @param {Array} props The property names to filter.
  21027. * @returns {Array} Returns the function names.
  21028. */
  21029. function baseFunctions(object, props) {
  21030. return arrayFilter(props, function(key) {
  21031. return isFunction(object[key]);
  21032. });
  21033. }
  21034. /**
  21035. * The base implementation of `_.get` without support for default values.
  21036. *
  21037. * @private
  21038. * @param {Object} object The object to query.
  21039. * @param {Array|string} path The path of the property to get.
  21040. * @returns {*} Returns the resolved value.
  21041. */
  21042. function baseGet(object, path) {
  21043. path = castPath(path, object);
  21044. var index = 0,
  21045. length = path.length;
  21046. while (object != null && index < length) {
  21047. object = object[toKey(path[index++])];
  21048. }
  21049. return (index && index == length) ? object : undefined;
  21050. }
  21051. /**
  21052. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  21053. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  21054. * symbols of `object`.
  21055. *
  21056. * @private
  21057. * @param {Object} object The object to query.
  21058. * @param {Function} keysFunc The function to get the keys of `object`.
  21059. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  21060. * @returns {Array} Returns the array of property names and symbols.
  21061. */
  21062. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  21063. var result = keysFunc(object);
  21064. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  21065. }
  21066. /**
  21067. * The base implementation of `getTag` without fallbacks for buggy environments.
  21068. *
  21069. * @private
  21070. * @param {*} value The value to query.
  21071. * @returns {string} Returns the `toStringTag`.
  21072. */
  21073. function baseGetTag(value) {
  21074. if (value == null) {
  21075. return value === undefined ? undefinedTag : nullTag;
  21076. }
  21077. return (symToStringTag && symToStringTag in Object(value))
  21078. ? getRawTag(value)
  21079. : objectToString(value);
  21080. }
  21081. /**
  21082. * The base implementation of `_.gt` which doesn't coerce arguments.
  21083. *
  21084. * @private
  21085. * @param {*} value The value to compare.
  21086. * @param {*} other The other value to compare.
  21087. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  21088. * else `false`.
  21089. */
  21090. function baseGt(value, other) {
  21091. return value > other;
  21092. }
  21093. /**
  21094. * The base implementation of `_.has` without support for deep paths.
  21095. *
  21096. * @private
  21097. * @param {Object} [object] The object to query.
  21098. * @param {Array|string} key The key to check.
  21099. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21100. */
  21101. function baseHas(object, key) {
  21102. return object != null && hasOwnProperty.call(object, key);
  21103. }
  21104. /**
  21105. * The base implementation of `_.hasIn` without support for deep paths.
  21106. *
  21107. * @private
  21108. * @param {Object} [object] The object to query.
  21109. * @param {Array|string} key The key to check.
  21110. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21111. */
  21112. function baseHasIn(object, key) {
  21113. return object != null && key in Object(object);
  21114. }
  21115. /**
  21116. * The base implementation of `_.inRange` which doesn't coerce arguments.
  21117. *
  21118. * @private
  21119. * @param {number} number The number to check.
  21120. * @param {number} start The start of the range.
  21121. * @param {number} end The end of the range.
  21122. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  21123. */
  21124. function baseInRange(number, start, end) {
  21125. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  21126. }
  21127. /**
  21128. * The base implementation of methods like `_.intersection`, without support
  21129. * for iteratee shorthands, that accepts an array of arrays to inspect.
  21130. *
  21131. * @private
  21132. * @param {Array} arrays The arrays to inspect.
  21133. * @param {Function} [iteratee] The iteratee invoked per element.
  21134. * @param {Function} [comparator] The comparator invoked per element.
  21135. * @returns {Array} Returns the new array of shared values.
  21136. */
  21137. function baseIntersection(arrays, iteratee, comparator) {
  21138. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  21139. length = arrays[0].length,
  21140. othLength = arrays.length,
  21141. othIndex = othLength,
  21142. caches = Array(othLength),
  21143. maxLength = Infinity,
  21144. result = [];
  21145. while (othIndex--) {
  21146. var array = arrays[othIndex];
  21147. if (othIndex && iteratee) {
  21148. array = arrayMap(array, baseUnary(iteratee));
  21149. }
  21150. maxLength = nativeMin(array.length, maxLength);
  21151. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  21152. ? new SetCache(othIndex && array)
  21153. : undefined;
  21154. }
  21155. array = arrays[0];
  21156. var index = -1,
  21157. seen = caches[0];
  21158. outer:
  21159. while (++index < length && result.length < maxLength) {
  21160. var value = array[index],
  21161. computed = iteratee ? iteratee(value) : value;
  21162. value = (comparator || value !== 0) ? value : 0;
  21163. if (!(seen
  21164. ? cacheHas(seen, computed)
  21165. : includes(result, computed, comparator)
  21166. )) {
  21167. othIndex = othLength;
  21168. while (--othIndex) {
  21169. var cache = caches[othIndex];
  21170. if (!(cache
  21171. ? cacheHas(cache, computed)
  21172. : includes(arrays[othIndex], computed, comparator))
  21173. ) {
  21174. continue outer;
  21175. }
  21176. }
  21177. if (seen) {
  21178. seen.push(computed);
  21179. }
  21180. result.push(value);
  21181. }
  21182. }
  21183. return result;
  21184. }
  21185. /**
  21186. * The base implementation of `_.invert` and `_.invertBy` which inverts
  21187. * `object` with values transformed by `iteratee` and set by `setter`.
  21188. *
  21189. * @private
  21190. * @param {Object} object The object to iterate over.
  21191. * @param {Function} setter The function to set `accumulator` values.
  21192. * @param {Function} iteratee The iteratee to transform values.
  21193. * @param {Object} accumulator The initial inverted object.
  21194. * @returns {Function} Returns `accumulator`.
  21195. */
  21196. function baseInverter(object, setter, iteratee, accumulator) {
  21197. baseForOwn(object, function(value, key, object) {
  21198. setter(accumulator, iteratee(value), key, object);
  21199. });
  21200. return accumulator;
  21201. }
  21202. /**
  21203. * The base implementation of `_.invoke` without support for individual
  21204. * method arguments.
  21205. *
  21206. * @private
  21207. * @param {Object} object The object to query.
  21208. * @param {Array|string} path The path of the method to invoke.
  21209. * @param {Array} args The arguments to invoke the method with.
  21210. * @returns {*} Returns the result of the invoked method.
  21211. */
  21212. function baseInvoke(object, path, args) {
  21213. path = castPath(path, object);
  21214. object = parent(object, path);
  21215. var func = object == null ? object : object[toKey(last(path))];
  21216. return func == null ? undefined : apply(func, object, args);
  21217. }
  21218. /**
  21219. * The base implementation of `_.isArguments`.
  21220. *
  21221. * @private
  21222. * @param {*} value The value to check.
  21223. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  21224. */
  21225. function baseIsArguments(value) {
  21226. return isObjectLike(value) && baseGetTag(value) == argsTag;
  21227. }
  21228. /**
  21229. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  21230. *
  21231. * @private
  21232. * @param {*} value The value to check.
  21233. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  21234. */
  21235. function baseIsArrayBuffer(value) {
  21236. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  21237. }
  21238. /**
  21239. * The base implementation of `_.isDate` without Node.js optimizations.
  21240. *
  21241. * @private
  21242. * @param {*} value The value to check.
  21243. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  21244. */
  21245. function baseIsDate(value) {
  21246. return isObjectLike(value) && baseGetTag(value) == dateTag;
  21247. }
  21248. /**
  21249. * The base implementation of `_.isEqual` which supports partial comparisons
  21250. * and tracks traversed objects.
  21251. *
  21252. * @private
  21253. * @param {*} value The value to compare.
  21254. * @param {*} other The other value to compare.
  21255. * @param {boolean} bitmask The bitmask flags.
  21256. * 1 - Unordered comparison
  21257. * 2 - Partial comparison
  21258. * @param {Function} [customizer] The function to customize comparisons.
  21259. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  21260. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  21261. */
  21262. function baseIsEqual(value, other, bitmask, customizer, stack) {
  21263. if (value === other) {
  21264. return true;
  21265. }
  21266. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  21267. return value !== value && other !== other;
  21268. }
  21269. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  21270. }
  21271. /**
  21272. * A specialized version of `baseIsEqual` for arrays and objects which performs
  21273. * deep comparisons and tracks traversed objects enabling objects with circular
  21274. * references to be compared.
  21275. *
  21276. * @private
  21277. * @param {Object} object The object to compare.
  21278. * @param {Object} other The other object to compare.
  21279. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  21280. * @param {Function} customizer The function to customize comparisons.
  21281. * @param {Function} equalFunc The function to determine equivalents of values.
  21282. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  21283. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  21284. */
  21285. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  21286. var objIsArr = isArray(object),
  21287. othIsArr = isArray(other),
  21288. objTag = objIsArr ? arrayTag : getTag(object),
  21289. othTag = othIsArr ? arrayTag : getTag(other);
  21290. objTag = objTag == argsTag ? objectTag : objTag;
  21291. othTag = othTag == argsTag ? objectTag : othTag;
  21292. var objIsObj = objTag == objectTag,
  21293. othIsObj = othTag == objectTag,
  21294. isSameTag = objTag == othTag;
  21295. if (isSameTag && isBuffer(object)) {
  21296. if (!isBuffer(other)) {
  21297. return false;
  21298. }
  21299. objIsArr = true;
  21300. objIsObj = false;
  21301. }
  21302. if (isSameTag && !objIsObj) {
  21303. stack || (stack = new Stack);
  21304. return (objIsArr || isTypedArray(object))
  21305. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  21306. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  21307. }
  21308. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  21309. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  21310. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  21311. if (objIsWrapped || othIsWrapped) {
  21312. var objUnwrapped = objIsWrapped ? object.value() : object,
  21313. othUnwrapped = othIsWrapped ? other.value() : other;
  21314. stack || (stack = new Stack);
  21315. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  21316. }
  21317. }
  21318. if (!isSameTag) {
  21319. return false;
  21320. }
  21321. stack || (stack = new Stack);
  21322. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  21323. }
  21324. /**
  21325. * The base implementation of `_.isMap` without Node.js optimizations.
  21326. *
  21327. * @private
  21328. * @param {*} value The value to check.
  21329. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  21330. */
  21331. function baseIsMap(value) {
  21332. return isObjectLike(value) && getTag(value) == mapTag;
  21333. }
  21334. /**
  21335. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  21336. *
  21337. * @private
  21338. * @param {Object} object The object to inspect.
  21339. * @param {Object} source The object of property values to match.
  21340. * @param {Array} matchData The property names, values, and compare flags to match.
  21341. * @param {Function} [customizer] The function to customize comparisons.
  21342. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  21343. */
  21344. function baseIsMatch(object, source, matchData, customizer) {
  21345. var index = matchData.length,
  21346. length = index,
  21347. noCustomizer = !customizer;
  21348. if (object == null) {
  21349. return !length;
  21350. }
  21351. object = Object(object);
  21352. while (index--) {
  21353. var data = matchData[index];
  21354. if ((noCustomizer && data[2])
  21355. ? data[1] !== object[data[0]]
  21356. : !(data[0] in object)
  21357. ) {
  21358. return false;
  21359. }
  21360. }
  21361. while (++index < length) {
  21362. data = matchData[index];
  21363. var key = data[0],
  21364. objValue = object[key],
  21365. srcValue = data[1];
  21366. if (noCustomizer && data[2]) {
  21367. if (objValue === undefined && !(key in object)) {
  21368. return false;
  21369. }
  21370. } else {
  21371. var stack = new Stack;
  21372. if (customizer) {
  21373. var result = customizer(objValue, srcValue, key, object, source, stack);
  21374. }
  21375. if (!(result === undefined
  21376. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  21377. : result
  21378. )) {
  21379. return false;
  21380. }
  21381. }
  21382. }
  21383. return true;
  21384. }
  21385. /**
  21386. * The base implementation of `_.isNative` without bad shim checks.
  21387. *
  21388. * @private
  21389. * @param {*} value The value to check.
  21390. * @returns {boolean} Returns `true` if `value` is a native function,
  21391. * else `false`.
  21392. */
  21393. function baseIsNative(value) {
  21394. if (!isObject(value) || isMasked(value)) {
  21395. return false;
  21396. }
  21397. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  21398. return pattern.test(toSource(value));
  21399. }
  21400. /**
  21401. * The base implementation of `_.isRegExp` without Node.js optimizations.
  21402. *
  21403. * @private
  21404. * @param {*} value The value to check.
  21405. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  21406. */
  21407. function baseIsRegExp(value) {
  21408. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  21409. }
  21410. /**
  21411. * The base implementation of `_.isSet` without Node.js optimizations.
  21412. *
  21413. * @private
  21414. * @param {*} value The value to check.
  21415. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  21416. */
  21417. function baseIsSet(value) {
  21418. return isObjectLike(value) && getTag(value) == setTag;
  21419. }
  21420. /**
  21421. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  21422. *
  21423. * @private
  21424. * @param {*} value The value to check.
  21425. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  21426. */
  21427. function baseIsTypedArray(value) {
  21428. return isObjectLike(value) &&
  21429. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  21430. }
  21431. /**
  21432. * The base implementation of `_.iteratee`.
  21433. *
  21434. * @private
  21435. * @param {*} [value=_.identity] The value to convert to an iteratee.
  21436. * @returns {Function} Returns the iteratee.
  21437. */
  21438. function baseIteratee(value) {
  21439. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  21440. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  21441. if (typeof value == 'function') {
  21442. return value;
  21443. }
  21444. if (value == null) {
  21445. return identity;
  21446. }
  21447. if (typeof value == 'object') {
  21448. return isArray(value)
  21449. ? baseMatchesProperty(value[0], value[1])
  21450. : baseMatches(value);
  21451. }
  21452. return property(value);
  21453. }
  21454. /**
  21455. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  21456. *
  21457. * @private
  21458. * @param {Object} object The object to query.
  21459. * @returns {Array} Returns the array of property names.
  21460. */
  21461. function baseKeys(object) {
  21462. if (!isPrototype(object)) {
  21463. return nativeKeys(object);
  21464. }
  21465. var result = [];
  21466. for (var key in Object(object)) {
  21467. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  21468. result.push(key);
  21469. }
  21470. }
  21471. return result;
  21472. }
  21473. /**
  21474. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  21475. *
  21476. * @private
  21477. * @param {Object} object The object to query.
  21478. * @returns {Array} Returns the array of property names.
  21479. */
  21480. function baseKeysIn(object) {
  21481. if (!isObject(object)) {
  21482. return nativeKeysIn(object);
  21483. }
  21484. var isProto = isPrototype(object),
  21485. result = [];
  21486. for (var key in object) {
  21487. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  21488. result.push(key);
  21489. }
  21490. }
  21491. return result;
  21492. }
  21493. /**
  21494. * The base implementation of `_.lt` which doesn't coerce arguments.
  21495. *
  21496. * @private
  21497. * @param {*} value The value to compare.
  21498. * @param {*} other The other value to compare.
  21499. * @returns {boolean} Returns `true` if `value` is less than `other`,
  21500. * else `false`.
  21501. */
  21502. function baseLt(value, other) {
  21503. return value < other;
  21504. }
  21505. /**
  21506. * The base implementation of `_.map` without support for iteratee shorthands.
  21507. *
  21508. * @private
  21509. * @param {Array|Object} collection The collection to iterate over.
  21510. * @param {Function} iteratee The function invoked per iteration.
  21511. * @returns {Array} Returns the new mapped array.
  21512. */
  21513. function baseMap(collection, iteratee) {
  21514. var index = -1,
  21515. result = isArrayLike(collection) ? Array(collection.length) : [];
  21516. baseEach(collection, function(value, key, collection) {
  21517. result[++index] = iteratee(value, key, collection);
  21518. });
  21519. return result;
  21520. }
  21521. /**
  21522. * The base implementation of `_.matches` which doesn't clone `source`.
  21523. *
  21524. * @private
  21525. * @param {Object} source The object of property values to match.
  21526. * @returns {Function} Returns the new spec function.
  21527. */
  21528. function baseMatches(source) {
  21529. var matchData = getMatchData(source);
  21530. if (matchData.length == 1 && matchData[0][2]) {
  21531. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  21532. }
  21533. return function(object) {
  21534. return object === source || baseIsMatch(object, source, matchData);
  21535. };
  21536. }
  21537. /**
  21538. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  21539. *
  21540. * @private
  21541. * @param {string} path The path of the property to get.
  21542. * @param {*} srcValue The value to match.
  21543. * @returns {Function} Returns the new spec function.
  21544. */
  21545. function baseMatchesProperty(path, srcValue) {
  21546. if (isKey(path) && isStrictComparable(srcValue)) {
  21547. return matchesStrictComparable(toKey(path), srcValue);
  21548. }
  21549. return function(object) {
  21550. var objValue = get(object, path);
  21551. return (objValue === undefined && objValue === srcValue)
  21552. ? hasIn(object, path)
  21553. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  21554. };
  21555. }
  21556. /**
  21557. * The base implementation of `_.merge` without support for multiple sources.
  21558. *
  21559. * @private
  21560. * @param {Object} object The destination object.
  21561. * @param {Object} source The source object.
  21562. * @param {number} srcIndex The index of `source`.
  21563. * @param {Function} [customizer] The function to customize merged values.
  21564. * @param {Object} [stack] Tracks traversed source values and their merged
  21565. * counterparts.
  21566. */
  21567. function baseMerge(object, source, srcIndex, customizer, stack) {
  21568. if (object === source) {
  21569. return;
  21570. }
  21571. baseFor(source, function(srcValue, key) {
  21572. stack || (stack = new Stack);
  21573. if (isObject(srcValue)) {
  21574. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  21575. }
  21576. else {
  21577. var newValue = customizer
  21578. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  21579. : undefined;
  21580. if (newValue === undefined) {
  21581. newValue = srcValue;
  21582. }
  21583. assignMergeValue(object, key, newValue);
  21584. }
  21585. }, keysIn);
  21586. }
  21587. /**
  21588. * A specialized version of `baseMerge` for arrays and objects which performs
  21589. * deep merges and tracks traversed objects enabling objects with circular
  21590. * references to be merged.
  21591. *
  21592. * @private
  21593. * @param {Object} object The destination object.
  21594. * @param {Object} source The source object.
  21595. * @param {string} key The key of the value to merge.
  21596. * @param {number} srcIndex The index of `source`.
  21597. * @param {Function} mergeFunc The function to merge values.
  21598. * @param {Function} [customizer] The function to customize assigned values.
  21599. * @param {Object} [stack] Tracks traversed source values and their merged
  21600. * counterparts.
  21601. */
  21602. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  21603. var objValue = safeGet(object, key),
  21604. srcValue = safeGet(source, key),
  21605. stacked = stack.get(srcValue);
  21606. if (stacked) {
  21607. assignMergeValue(object, key, stacked);
  21608. return;
  21609. }
  21610. var newValue = customizer
  21611. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  21612. : undefined;
  21613. var isCommon = newValue === undefined;
  21614. if (isCommon) {
  21615. var isArr = isArray(srcValue),
  21616. isBuff = !isArr && isBuffer(srcValue),
  21617. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  21618. newValue = srcValue;
  21619. if (isArr || isBuff || isTyped) {
  21620. if (isArray(objValue)) {
  21621. newValue = objValue;
  21622. }
  21623. else if (isArrayLikeObject(objValue)) {
  21624. newValue = copyArray(objValue);
  21625. }
  21626. else if (isBuff) {
  21627. isCommon = false;
  21628. newValue = cloneBuffer(srcValue, true);
  21629. }
  21630. else if (isTyped) {
  21631. isCommon = false;
  21632. newValue = cloneTypedArray(srcValue, true);
  21633. }
  21634. else {
  21635. newValue = [];
  21636. }
  21637. }
  21638. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  21639. newValue = objValue;
  21640. if (isArguments(objValue)) {
  21641. newValue = toPlainObject(objValue);
  21642. }
  21643. else if (!isObject(objValue) || isFunction(objValue)) {
  21644. newValue = initCloneObject(srcValue);
  21645. }
  21646. }
  21647. else {
  21648. isCommon = false;
  21649. }
  21650. }
  21651. if (isCommon) {
  21652. // Recursively merge objects and arrays (susceptible to call stack limits).
  21653. stack.set(srcValue, newValue);
  21654. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  21655. stack['delete'](srcValue);
  21656. }
  21657. assignMergeValue(object, key, newValue);
  21658. }
  21659. /**
  21660. * The base implementation of `_.nth` which doesn't coerce arguments.
  21661. *
  21662. * @private
  21663. * @param {Array} array The array to query.
  21664. * @param {number} n The index of the element to return.
  21665. * @returns {*} Returns the nth element of `array`.
  21666. */
  21667. function baseNth(array, n) {
  21668. var length = array.length;
  21669. if (!length) {
  21670. return;
  21671. }
  21672. n += n < 0 ? length : 0;
  21673. return isIndex(n, length) ? array[n] : undefined;
  21674. }
  21675. /**
  21676. * The base implementation of `_.orderBy` without param guards.
  21677. *
  21678. * @private
  21679. * @param {Array|Object} collection The collection to iterate over.
  21680. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  21681. * @param {string[]} orders The sort orders of `iteratees`.
  21682. * @returns {Array} Returns the new sorted array.
  21683. */
  21684. function baseOrderBy(collection, iteratees, orders) {
  21685. var index = -1;
  21686. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  21687. var result = baseMap(collection, function(value, key, collection) {
  21688. var criteria = arrayMap(iteratees, function(iteratee) {
  21689. return iteratee(value);
  21690. });
  21691. return { 'criteria': criteria, 'index': ++index, 'value': value };
  21692. });
  21693. return baseSortBy(result, function(object, other) {
  21694. return compareMultiple(object, other, orders);
  21695. });
  21696. }
  21697. /**
  21698. * The base implementation of `_.pick` without support for individual
  21699. * property identifiers.
  21700. *
  21701. * @private
  21702. * @param {Object} object The source object.
  21703. * @param {string[]} paths The property paths to pick.
  21704. * @returns {Object} Returns the new object.
  21705. */
  21706. function basePick(object, paths) {
  21707. return basePickBy(object, paths, function(value, path) {
  21708. return hasIn(object, path);
  21709. });
  21710. }
  21711. /**
  21712. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  21713. *
  21714. * @private
  21715. * @param {Object} object The source object.
  21716. * @param {string[]} paths The property paths to pick.
  21717. * @param {Function} predicate The function invoked per property.
  21718. * @returns {Object} Returns the new object.
  21719. */
  21720. function basePickBy(object, paths, predicate) {
  21721. var index = -1,
  21722. length = paths.length,
  21723. result = {};
  21724. while (++index < length) {
  21725. var path = paths[index],
  21726. value = baseGet(object, path);
  21727. if (predicate(value, path)) {
  21728. baseSet(result, castPath(path, object), value);
  21729. }
  21730. }
  21731. return result;
  21732. }
  21733. /**
  21734. * A specialized version of `baseProperty` which supports deep paths.
  21735. *
  21736. * @private
  21737. * @param {Array|string} path The path of the property to get.
  21738. * @returns {Function} Returns the new accessor function.
  21739. */
  21740. function basePropertyDeep(path) {
  21741. return function(object) {
  21742. return baseGet(object, path);
  21743. };
  21744. }
  21745. /**
  21746. * The base implementation of `_.pullAllBy` without support for iteratee
  21747. * shorthands.
  21748. *
  21749. * @private
  21750. * @param {Array} array The array to modify.
  21751. * @param {Array} values The values to remove.
  21752. * @param {Function} [iteratee] The iteratee invoked per element.
  21753. * @param {Function} [comparator] The comparator invoked per element.
  21754. * @returns {Array} Returns `array`.
  21755. */
  21756. function basePullAll(array, values, iteratee, comparator) {
  21757. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  21758. index = -1,
  21759. length = values.length,
  21760. seen = array;
  21761. if (array === values) {
  21762. values = copyArray(values);
  21763. }
  21764. if (iteratee) {
  21765. seen = arrayMap(array, baseUnary(iteratee));
  21766. }
  21767. while (++index < length) {
  21768. var fromIndex = 0,
  21769. value = values[index],
  21770. computed = iteratee ? iteratee(value) : value;
  21771. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  21772. if (seen !== array) {
  21773. splice.call(seen, fromIndex, 1);
  21774. }
  21775. splice.call(array, fromIndex, 1);
  21776. }
  21777. }
  21778. return array;
  21779. }
  21780. /**
  21781. * The base implementation of `_.pullAt` without support for individual
  21782. * indexes or capturing the removed elements.
  21783. *
  21784. * @private
  21785. * @param {Array} array The array to modify.
  21786. * @param {number[]} indexes The indexes of elements to remove.
  21787. * @returns {Array} Returns `array`.
  21788. */
  21789. function basePullAt(array, indexes) {
  21790. var length = array ? indexes.length : 0,
  21791. lastIndex = length - 1;
  21792. while (length--) {
  21793. var index = indexes[length];
  21794. if (length == lastIndex || index !== previous) {
  21795. var previous = index;
  21796. if (isIndex(index)) {
  21797. splice.call(array, index, 1);
  21798. } else {
  21799. baseUnset(array, index);
  21800. }
  21801. }
  21802. }
  21803. return array;
  21804. }
  21805. /**
  21806. * The base implementation of `_.random` without support for returning
  21807. * floating-point numbers.
  21808. *
  21809. * @private
  21810. * @param {number} lower The lower bound.
  21811. * @param {number} upper The upper bound.
  21812. * @returns {number} Returns the random number.
  21813. */
  21814. function baseRandom(lower, upper) {
  21815. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  21816. }
  21817. /**
  21818. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  21819. * coerce arguments.
  21820. *
  21821. * @private
  21822. * @param {number} start The start of the range.
  21823. * @param {number} end The end of the range.
  21824. * @param {number} step The value to increment or decrement by.
  21825. * @param {boolean} [fromRight] Specify iterating from right to left.
  21826. * @returns {Array} Returns the range of numbers.
  21827. */
  21828. function baseRange(start, end, step, fromRight) {
  21829. var index = -1,
  21830. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  21831. result = Array(length);
  21832. while (length--) {
  21833. result[fromRight ? length : ++index] = start;
  21834. start += step;
  21835. }
  21836. return result;
  21837. }
  21838. /**
  21839. * The base implementation of `_.repeat` which doesn't coerce arguments.
  21840. *
  21841. * @private
  21842. * @param {string} string The string to repeat.
  21843. * @param {number} n The number of times to repeat the string.
  21844. * @returns {string} Returns the repeated string.
  21845. */
  21846. function baseRepeat(string, n) {
  21847. var result = '';
  21848. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  21849. return result;
  21850. }
  21851. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  21852. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  21853. do {
  21854. if (n % 2) {
  21855. result += string;
  21856. }
  21857. n = nativeFloor(n / 2);
  21858. if (n) {
  21859. string += string;
  21860. }
  21861. } while (n);
  21862. return result;
  21863. }
  21864. /**
  21865. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  21866. *
  21867. * @private
  21868. * @param {Function} func The function to apply a rest parameter to.
  21869. * @param {number} [start=func.length-1] The start position of the rest parameter.
  21870. * @returns {Function} Returns the new function.
  21871. */
  21872. function baseRest(func, start) {
  21873. return setToString(overRest(func, start, identity), func + '');
  21874. }
  21875. /**
  21876. * The base implementation of `_.sample`.
  21877. *
  21878. * @private
  21879. * @param {Array|Object} collection The collection to sample.
  21880. * @returns {*} Returns the random element.
  21881. */
  21882. function baseSample(collection) {
  21883. return arraySample(values(collection));
  21884. }
  21885. /**
  21886. * The base implementation of `_.sampleSize` without param guards.
  21887. *
  21888. * @private
  21889. * @param {Array|Object} collection The collection to sample.
  21890. * @param {number} n The number of elements to sample.
  21891. * @returns {Array} Returns the random elements.
  21892. */
  21893. function baseSampleSize(collection, n) {
  21894. var array = values(collection);
  21895. return shuffleSelf(array, baseClamp(n, 0, array.length));
  21896. }
  21897. /**
  21898. * The base implementation of `_.set`.
  21899. *
  21900. * @private
  21901. * @param {Object} object The object to modify.
  21902. * @param {Array|string} path The path of the property to set.
  21903. * @param {*} value The value to set.
  21904. * @param {Function} [customizer] The function to customize path creation.
  21905. * @returns {Object} Returns `object`.
  21906. */
  21907. function baseSet(object, path, value, customizer) {
  21908. if (!isObject(object)) {
  21909. return object;
  21910. }
  21911. path = castPath(path, object);
  21912. var index = -1,
  21913. length = path.length,
  21914. lastIndex = length - 1,
  21915. nested = object;
  21916. while (nested != null && ++index < length) {
  21917. var key = toKey(path[index]),
  21918. newValue = value;
  21919. if (index != lastIndex) {
  21920. var objValue = nested[key];
  21921. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  21922. if (newValue === undefined) {
  21923. newValue = isObject(objValue)
  21924. ? objValue
  21925. : (isIndex(path[index + 1]) ? [] : {});
  21926. }
  21927. }
  21928. assignValue(nested, key, newValue);
  21929. nested = nested[key];
  21930. }
  21931. return object;
  21932. }
  21933. /**
  21934. * The base implementation of `setData` without support for hot loop shorting.
  21935. *
  21936. * @private
  21937. * @param {Function} func The function to associate metadata with.
  21938. * @param {*} data The metadata.
  21939. * @returns {Function} Returns `func`.
  21940. */
  21941. var baseSetData = !metaMap ? identity : function(func, data) {
  21942. metaMap.set(func, data);
  21943. return func;
  21944. };
  21945. /**
  21946. * The base implementation of `setToString` without support for hot loop shorting.
  21947. *
  21948. * @private
  21949. * @param {Function} func The function to modify.
  21950. * @param {Function} string The `toString` result.
  21951. * @returns {Function} Returns `func`.
  21952. */
  21953. var baseSetToString = !defineProperty ? identity : function(func, string) {
  21954. return defineProperty(func, 'toString', {
  21955. 'configurable': true,
  21956. 'enumerable': false,
  21957. 'value': constant(string),
  21958. 'writable': true
  21959. });
  21960. };
  21961. /**
  21962. * The base implementation of `_.shuffle`.
  21963. *
  21964. * @private
  21965. * @param {Array|Object} collection The collection to shuffle.
  21966. * @returns {Array} Returns the new shuffled array.
  21967. */
  21968. function baseShuffle(collection) {
  21969. return shuffleSelf(values(collection));
  21970. }
  21971. /**
  21972. * The base implementation of `_.slice` without an iteratee call guard.
  21973. *
  21974. * @private
  21975. * @param {Array} array The array to slice.
  21976. * @param {number} [start=0] The start position.
  21977. * @param {number} [end=array.length] The end position.
  21978. * @returns {Array} Returns the slice of `array`.
  21979. */
  21980. function baseSlice(array, start, end) {
  21981. var index = -1,
  21982. length = array.length;
  21983. if (start < 0) {
  21984. start = -start > length ? 0 : (length + start);
  21985. }
  21986. end = end > length ? length : end;
  21987. if (end < 0) {
  21988. end += length;
  21989. }
  21990. length = start > end ? 0 : ((end - start) >>> 0);
  21991. start >>>= 0;
  21992. var result = Array(length);
  21993. while (++index < length) {
  21994. result[index] = array[index + start];
  21995. }
  21996. return result;
  21997. }
  21998. /**
  21999. * The base implementation of `_.some` without support for iteratee shorthands.
  22000. *
  22001. * @private
  22002. * @param {Array|Object} collection The collection to iterate over.
  22003. * @param {Function} predicate The function invoked per iteration.
  22004. * @returns {boolean} Returns `true` if any element passes the predicate check,
  22005. * else `false`.
  22006. */
  22007. function baseSome(collection, predicate) {
  22008. var result;
  22009. baseEach(collection, function(value, index, collection) {
  22010. result = predicate(value, index, collection);
  22011. return !result;
  22012. });
  22013. return !!result;
  22014. }
  22015. /**
  22016. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  22017. * performs a binary search of `array` to determine the index at which `value`
  22018. * should be inserted into `array` in order to maintain its sort order.
  22019. *
  22020. * @private
  22021. * @param {Array} array The sorted array to inspect.
  22022. * @param {*} value The value to evaluate.
  22023. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22024. * @returns {number} Returns the index at which `value` should be inserted
  22025. * into `array`.
  22026. */
  22027. function baseSortedIndex(array, value, retHighest) {
  22028. var low = 0,
  22029. high = array == null ? low : array.length;
  22030. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  22031. while (low < high) {
  22032. var mid = (low + high) >>> 1,
  22033. computed = array[mid];
  22034. if (computed !== null && !isSymbol(computed) &&
  22035. (retHighest ? (computed <= value) : (computed < value))) {
  22036. low = mid + 1;
  22037. } else {
  22038. high = mid;
  22039. }
  22040. }
  22041. return high;
  22042. }
  22043. return baseSortedIndexBy(array, value, identity, retHighest);
  22044. }
  22045. /**
  22046. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  22047. * which invokes `iteratee` for `value` and each element of `array` to compute
  22048. * their sort ranking. The iteratee is invoked with one argument; (value).
  22049. *
  22050. * @private
  22051. * @param {Array} array The sorted array to inspect.
  22052. * @param {*} value The value to evaluate.
  22053. * @param {Function} iteratee The iteratee invoked per element.
  22054. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22055. * @returns {number} Returns the index at which `value` should be inserted
  22056. * into `array`.
  22057. */
  22058. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  22059. value = iteratee(value);
  22060. var low = 0,
  22061. high = array == null ? 0 : array.length,
  22062. valIsNaN = value !== value,
  22063. valIsNull = value === null,
  22064. valIsSymbol = isSymbol(value),
  22065. valIsUndefined = value === undefined;
  22066. while (low < high) {
  22067. var mid = nativeFloor((low + high) / 2),
  22068. computed = iteratee(array[mid]),
  22069. othIsDefined = computed !== undefined,
  22070. othIsNull = computed === null,
  22071. othIsReflexive = computed === computed,
  22072. othIsSymbol = isSymbol(computed);
  22073. if (valIsNaN) {
  22074. var setLow = retHighest || othIsReflexive;
  22075. } else if (valIsUndefined) {
  22076. setLow = othIsReflexive && (retHighest || othIsDefined);
  22077. } else if (valIsNull) {
  22078. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  22079. } else if (valIsSymbol) {
  22080. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  22081. } else if (othIsNull || othIsSymbol) {
  22082. setLow = false;
  22083. } else {
  22084. setLow = retHighest ? (computed <= value) : (computed < value);
  22085. }
  22086. if (setLow) {
  22087. low = mid + 1;
  22088. } else {
  22089. high = mid;
  22090. }
  22091. }
  22092. return nativeMin(high, MAX_ARRAY_INDEX);
  22093. }
  22094. /**
  22095. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  22096. * support for iteratee shorthands.
  22097. *
  22098. * @private
  22099. * @param {Array} array The array to inspect.
  22100. * @param {Function} [iteratee] The iteratee invoked per element.
  22101. * @returns {Array} Returns the new duplicate free array.
  22102. */
  22103. function baseSortedUniq(array, iteratee) {
  22104. var index = -1,
  22105. length = array.length,
  22106. resIndex = 0,
  22107. result = [];
  22108. while (++index < length) {
  22109. var value = array[index],
  22110. computed = iteratee ? iteratee(value) : value;
  22111. if (!index || !eq(computed, seen)) {
  22112. var seen = computed;
  22113. result[resIndex++] = value === 0 ? 0 : value;
  22114. }
  22115. }
  22116. return result;
  22117. }
  22118. /**
  22119. * The base implementation of `_.toNumber` which doesn't ensure correct
  22120. * conversions of binary, hexadecimal, or octal string values.
  22121. *
  22122. * @private
  22123. * @param {*} value The value to process.
  22124. * @returns {number} Returns the number.
  22125. */
  22126. function baseToNumber(value) {
  22127. if (typeof value == 'number') {
  22128. return value;
  22129. }
  22130. if (isSymbol(value)) {
  22131. return NAN;
  22132. }
  22133. return +value;
  22134. }
  22135. /**
  22136. * The base implementation of `_.toString` which doesn't convert nullish
  22137. * values to empty strings.
  22138. *
  22139. * @private
  22140. * @param {*} value The value to process.
  22141. * @returns {string} Returns the string.
  22142. */
  22143. function baseToString(value) {
  22144. // Exit early for strings to avoid a performance hit in some environments.
  22145. if (typeof value == 'string') {
  22146. return value;
  22147. }
  22148. if (isArray(value)) {
  22149. // Recursively convert values (susceptible to call stack limits).
  22150. return arrayMap(value, baseToString) + '';
  22151. }
  22152. if (isSymbol(value)) {
  22153. return symbolToString ? symbolToString.call(value) : '';
  22154. }
  22155. var result = (value + '');
  22156. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  22157. }
  22158. /**
  22159. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  22160. *
  22161. * @private
  22162. * @param {Array} array The array to inspect.
  22163. * @param {Function} [iteratee] The iteratee invoked per element.
  22164. * @param {Function} [comparator] The comparator invoked per element.
  22165. * @returns {Array} Returns the new duplicate free array.
  22166. */
  22167. function baseUniq(array, iteratee, comparator) {
  22168. var index = -1,
  22169. includes = arrayIncludes,
  22170. length = array.length,
  22171. isCommon = true,
  22172. result = [],
  22173. seen = result;
  22174. if (comparator) {
  22175. isCommon = false;
  22176. includes = arrayIncludesWith;
  22177. }
  22178. else if (length >= LARGE_ARRAY_SIZE) {
  22179. var set = iteratee ? null : createSet(array);
  22180. if (set) {
  22181. return setToArray(set);
  22182. }
  22183. isCommon = false;
  22184. includes = cacheHas;
  22185. seen = new SetCache;
  22186. }
  22187. else {
  22188. seen = iteratee ? [] : result;
  22189. }
  22190. outer:
  22191. while (++index < length) {
  22192. var value = array[index],
  22193. computed = iteratee ? iteratee(value) : value;
  22194. value = (comparator || value !== 0) ? value : 0;
  22195. if (isCommon && computed === computed) {
  22196. var seenIndex = seen.length;
  22197. while (seenIndex--) {
  22198. if (seen[seenIndex] === computed) {
  22199. continue outer;
  22200. }
  22201. }
  22202. if (iteratee) {
  22203. seen.push(computed);
  22204. }
  22205. result.push(value);
  22206. }
  22207. else if (!includes(seen, computed, comparator)) {
  22208. if (seen !== result) {
  22209. seen.push(computed);
  22210. }
  22211. result.push(value);
  22212. }
  22213. }
  22214. return result;
  22215. }
  22216. /**
  22217. * The base implementation of `_.unset`.
  22218. *
  22219. * @private
  22220. * @param {Object} object The object to modify.
  22221. * @param {Array|string} path The property path to unset.
  22222. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  22223. */
  22224. function baseUnset(object, path) {
  22225. path = castPath(path, object);
  22226. object = parent(object, path);
  22227. return object == null || delete object[toKey(last(path))];
  22228. }
  22229. /**
  22230. * The base implementation of `_.update`.
  22231. *
  22232. * @private
  22233. * @param {Object} object The object to modify.
  22234. * @param {Array|string} path The path of the property to update.
  22235. * @param {Function} updater The function to produce the updated value.
  22236. * @param {Function} [customizer] The function to customize path creation.
  22237. * @returns {Object} Returns `object`.
  22238. */
  22239. function baseUpdate(object, path, updater, customizer) {
  22240. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  22241. }
  22242. /**
  22243. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  22244. * without support for iteratee shorthands.
  22245. *
  22246. * @private
  22247. * @param {Array} array The array to query.
  22248. * @param {Function} predicate The function invoked per iteration.
  22249. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  22250. * @param {boolean} [fromRight] Specify iterating from right to left.
  22251. * @returns {Array} Returns the slice of `array`.
  22252. */
  22253. function baseWhile(array, predicate, isDrop, fromRight) {
  22254. var length = array.length,
  22255. index = fromRight ? length : -1;
  22256. while ((fromRight ? index-- : ++index < length) &&
  22257. predicate(array[index], index, array)) {}
  22258. return isDrop
  22259. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  22260. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  22261. }
  22262. /**
  22263. * The base implementation of `wrapperValue` which returns the result of
  22264. * performing a sequence of actions on the unwrapped `value`, where each
  22265. * successive action is supplied the return value of the previous.
  22266. *
  22267. * @private
  22268. * @param {*} value The unwrapped value.
  22269. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  22270. * @returns {*} Returns the resolved value.
  22271. */
  22272. function baseWrapperValue(value, actions) {
  22273. var result = value;
  22274. if (result instanceof LazyWrapper) {
  22275. result = result.value();
  22276. }
  22277. return arrayReduce(actions, function(result, action) {
  22278. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  22279. }, result);
  22280. }
  22281. /**
  22282. * The base implementation of methods like `_.xor`, without support for
  22283. * iteratee shorthands, that accepts an array of arrays to inspect.
  22284. *
  22285. * @private
  22286. * @param {Array} arrays The arrays to inspect.
  22287. * @param {Function} [iteratee] The iteratee invoked per element.
  22288. * @param {Function} [comparator] The comparator invoked per element.
  22289. * @returns {Array} Returns the new array of values.
  22290. */
  22291. function baseXor(arrays, iteratee, comparator) {
  22292. var length = arrays.length;
  22293. if (length < 2) {
  22294. return length ? baseUniq(arrays[0]) : [];
  22295. }
  22296. var index = -1,
  22297. result = Array(length);
  22298. while (++index < length) {
  22299. var array = arrays[index],
  22300. othIndex = -1;
  22301. while (++othIndex < length) {
  22302. if (othIndex != index) {
  22303. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  22304. }
  22305. }
  22306. }
  22307. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  22308. }
  22309. /**
  22310. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  22311. *
  22312. * @private
  22313. * @param {Array} props The property identifiers.
  22314. * @param {Array} values The property values.
  22315. * @param {Function} assignFunc The function to assign values.
  22316. * @returns {Object} Returns the new object.
  22317. */
  22318. function baseZipObject(props, values, assignFunc) {
  22319. var index = -1,
  22320. length = props.length,
  22321. valsLength = values.length,
  22322. result = {};
  22323. while (++index < length) {
  22324. var value = index < valsLength ? values[index] : undefined;
  22325. assignFunc(result, props[index], value);
  22326. }
  22327. return result;
  22328. }
  22329. /**
  22330. * Casts `value` to an empty array if it's not an array like object.
  22331. *
  22332. * @private
  22333. * @param {*} value The value to inspect.
  22334. * @returns {Array|Object} Returns the cast array-like object.
  22335. */
  22336. function castArrayLikeObject(value) {
  22337. return isArrayLikeObject(value) ? value : [];
  22338. }
  22339. /**
  22340. * Casts `value` to `identity` if it's not a function.
  22341. *
  22342. * @private
  22343. * @param {*} value The value to inspect.
  22344. * @returns {Function} Returns cast function.
  22345. */
  22346. function castFunction(value) {
  22347. return typeof value == 'function' ? value : identity;
  22348. }
  22349. /**
  22350. * Casts `value` to a path array if it's not one.
  22351. *
  22352. * @private
  22353. * @param {*} value The value to inspect.
  22354. * @param {Object} [object] The object to query keys on.
  22355. * @returns {Array} Returns the cast property path array.
  22356. */
  22357. function castPath(value, object) {
  22358. if (isArray(value)) {
  22359. return value;
  22360. }
  22361. return isKey(value, object) ? [value] : stringToPath(toString(value));
  22362. }
  22363. /**
  22364. * A `baseRest` alias which can be replaced with `identity` by module
  22365. * replacement plugins.
  22366. *
  22367. * @private
  22368. * @type {Function}
  22369. * @param {Function} func The function to apply a rest parameter to.
  22370. * @returns {Function} Returns the new function.
  22371. */
  22372. var castRest = baseRest;
  22373. /**
  22374. * Casts `array` to a slice if it's needed.
  22375. *
  22376. * @private
  22377. * @param {Array} array The array to inspect.
  22378. * @param {number} start The start position.
  22379. * @param {number} [end=array.length] The end position.
  22380. * @returns {Array} Returns the cast slice.
  22381. */
  22382. function castSlice(array, start, end) {
  22383. var length = array.length;
  22384. end = end === undefined ? length : end;
  22385. return (!start && end >= length) ? array : baseSlice(array, start, end);
  22386. }
  22387. /**
  22388. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  22389. *
  22390. * @private
  22391. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  22392. */
  22393. var clearTimeout = ctxClearTimeout || function(id) {
  22394. return root.clearTimeout(id);
  22395. };
  22396. /**
  22397. * Creates a clone of `buffer`.
  22398. *
  22399. * @private
  22400. * @param {Buffer} buffer The buffer to clone.
  22401. * @param {boolean} [isDeep] Specify a deep clone.
  22402. * @returns {Buffer} Returns the cloned buffer.
  22403. */
  22404. function cloneBuffer(buffer, isDeep) {
  22405. if (isDeep) {
  22406. return buffer.slice();
  22407. }
  22408. var length = buffer.length,
  22409. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  22410. buffer.copy(result);
  22411. return result;
  22412. }
  22413. /**
  22414. * Creates a clone of `arrayBuffer`.
  22415. *
  22416. * @private
  22417. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  22418. * @returns {ArrayBuffer} Returns the cloned array buffer.
  22419. */
  22420. function cloneArrayBuffer(arrayBuffer) {
  22421. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  22422. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  22423. return result;
  22424. }
  22425. /**
  22426. * Creates a clone of `dataView`.
  22427. *
  22428. * @private
  22429. * @param {Object} dataView The data view to clone.
  22430. * @param {boolean} [isDeep] Specify a deep clone.
  22431. * @returns {Object} Returns the cloned data view.
  22432. */
  22433. function cloneDataView(dataView, isDeep) {
  22434. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  22435. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  22436. }
  22437. /**
  22438. * Creates a clone of `regexp`.
  22439. *
  22440. * @private
  22441. * @param {Object} regexp The regexp to clone.
  22442. * @returns {Object} Returns the cloned regexp.
  22443. */
  22444. function cloneRegExp(regexp) {
  22445. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  22446. result.lastIndex = regexp.lastIndex;
  22447. return result;
  22448. }
  22449. /**
  22450. * Creates a clone of the `symbol` object.
  22451. *
  22452. * @private
  22453. * @param {Object} symbol The symbol object to clone.
  22454. * @returns {Object} Returns the cloned symbol object.
  22455. */
  22456. function cloneSymbol(symbol) {
  22457. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  22458. }
  22459. /**
  22460. * Creates a clone of `typedArray`.
  22461. *
  22462. * @private
  22463. * @param {Object} typedArray The typed array to clone.
  22464. * @param {boolean} [isDeep] Specify a deep clone.
  22465. * @returns {Object} Returns the cloned typed array.
  22466. */
  22467. function cloneTypedArray(typedArray, isDeep) {
  22468. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  22469. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  22470. }
  22471. /**
  22472. * Compares values to sort them in ascending order.
  22473. *
  22474. * @private
  22475. * @param {*} value The value to compare.
  22476. * @param {*} other The other value to compare.
  22477. * @returns {number} Returns the sort order indicator for `value`.
  22478. */
  22479. function compareAscending(value, other) {
  22480. if (value !== other) {
  22481. var valIsDefined = value !== undefined,
  22482. valIsNull = value === null,
  22483. valIsReflexive = value === value,
  22484. valIsSymbol = isSymbol(value);
  22485. var othIsDefined = other !== undefined,
  22486. othIsNull = other === null,
  22487. othIsReflexive = other === other,
  22488. othIsSymbol = isSymbol(other);
  22489. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  22490. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  22491. (valIsNull && othIsDefined && othIsReflexive) ||
  22492. (!valIsDefined && othIsReflexive) ||
  22493. !valIsReflexive) {
  22494. return 1;
  22495. }
  22496. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  22497. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  22498. (othIsNull && valIsDefined && valIsReflexive) ||
  22499. (!othIsDefined && valIsReflexive) ||
  22500. !othIsReflexive) {
  22501. return -1;
  22502. }
  22503. }
  22504. return 0;
  22505. }
  22506. /**
  22507. * Used by `_.orderBy` to compare multiple properties of a value to another
  22508. * and stable sort them.
  22509. *
  22510. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  22511. * specify an order of "desc" for descending or "asc" for ascending sort order
  22512. * of corresponding values.
  22513. *
  22514. * @private
  22515. * @param {Object} object The object to compare.
  22516. * @param {Object} other The other object to compare.
  22517. * @param {boolean[]|string[]} orders The order to sort by for each property.
  22518. * @returns {number} Returns the sort order indicator for `object`.
  22519. */
  22520. function compareMultiple(object, other, orders) {
  22521. var index = -1,
  22522. objCriteria = object.criteria,
  22523. othCriteria = other.criteria,
  22524. length = objCriteria.length,
  22525. ordersLength = orders.length;
  22526. while (++index < length) {
  22527. var result = compareAscending(objCriteria[index], othCriteria[index]);
  22528. if (result) {
  22529. if (index >= ordersLength) {
  22530. return result;
  22531. }
  22532. var order = orders[index];
  22533. return result * (order == 'desc' ? -1 : 1);
  22534. }
  22535. }
  22536. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  22537. // that causes it, under certain circumstances, to provide the same value for
  22538. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  22539. // for more details.
  22540. //
  22541. // This also ensures a stable sort in V8 and other engines.
  22542. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  22543. return object.index - other.index;
  22544. }
  22545. /**
  22546. * Creates an array that is the composition of partially applied arguments,
  22547. * placeholders, and provided arguments into a single array of arguments.
  22548. *
  22549. * @private
  22550. * @param {Array} args The provided arguments.
  22551. * @param {Array} partials The arguments to prepend to those provided.
  22552. * @param {Array} holders The `partials` placeholder indexes.
  22553. * @params {boolean} [isCurried] Specify composing for a curried function.
  22554. * @returns {Array} Returns the new array of composed arguments.
  22555. */
  22556. function composeArgs(args, partials, holders, isCurried) {
  22557. var argsIndex = -1,
  22558. argsLength = args.length,
  22559. holdersLength = holders.length,
  22560. leftIndex = -1,
  22561. leftLength = partials.length,
  22562. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22563. result = Array(leftLength + rangeLength),
  22564. isUncurried = !isCurried;
  22565. while (++leftIndex < leftLength) {
  22566. result[leftIndex] = partials[leftIndex];
  22567. }
  22568. while (++argsIndex < holdersLength) {
  22569. if (isUncurried || argsIndex < argsLength) {
  22570. result[holders[argsIndex]] = args[argsIndex];
  22571. }
  22572. }
  22573. while (rangeLength--) {
  22574. result[leftIndex++] = args[argsIndex++];
  22575. }
  22576. return result;
  22577. }
  22578. /**
  22579. * This function is like `composeArgs` except that the arguments composition
  22580. * is tailored for `_.partialRight`.
  22581. *
  22582. * @private
  22583. * @param {Array} args The provided arguments.
  22584. * @param {Array} partials The arguments to append to those provided.
  22585. * @param {Array} holders The `partials` placeholder indexes.
  22586. * @params {boolean} [isCurried] Specify composing for a curried function.
  22587. * @returns {Array} Returns the new array of composed arguments.
  22588. */
  22589. function composeArgsRight(args, partials, holders, isCurried) {
  22590. var argsIndex = -1,
  22591. argsLength = args.length,
  22592. holdersIndex = -1,
  22593. holdersLength = holders.length,
  22594. rightIndex = -1,
  22595. rightLength = partials.length,
  22596. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22597. result = Array(rangeLength + rightLength),
  22598. isUncurried = !isCurried;
  22599. while (++argsIndex < rangeLength) {
  22600. result[argsIndex] = args[argsIndex];
  22601. }
  22602. var offset = argsIndex;
  22603. while (++rightIndex < rightLength) {
  22604. result[offset + rightIndex] = partials[rightIndex];
  22605. }
  22606. while (++holdersIndex < holdersLength) {
  22607. if (isUncurried || argsIndex < argsLength) {
  22608. result[offset + holders[holdersIndex]] = args[argsIndex++];
  22609. }
  22610. }
  22611. return result;
  22612. }
  22613. /**
  22614. * Copies the values of `source` to `array`.
  22615. *
  22616. * @private
  22617. * @param {Array} source The array to copy values from.
  22618. * @param {Array} [array=[]] The array to copy values to.
  22619. * @returns {Array} Returns `array`.
  22620. */
  22621. function copyArray(source, array) {
  22622. var index = -1,
  22623. length = source.length;
  22624. array || (array = Array(length));
  22625. while (++index < length) {
  22626. array[index] = source[index];
  22627. }
  22628. return array;
  22629. }
  22630. /**
  22631. * Copies properties of `source` to `object`.
  22632. *
  22633. * @private
  22634. * @param {Object} source The object to copy properties from.
  22635. * @param {Array} props The property identifiers to copy.
  22636. * @param {Object} [object={}] The object to copy properties to.
  22637. * @param {Function} [customizer] The function to customize copied values.
  22638. * @returns {Object} Returns `object`.
  22639. */
  22640. function copyObject(source, props, object, customizer) {
  22641. var isNew = !object;
  22642. object || (object = {});
  22643. var index = -1,
  22644. length = props.length;
  22645. while (++index < length) {
  22646. var key = props[index];
  22647. var newValue = customizer
  22648. ? customizer(object[key], source[key], key, object, source)
  22649. : undefined;
  22650. if (newValue === undefined) {
  22651. newValue = source[key];
  22652. }
  22653. if (isNew) {
  22654. baseAssignValue(object, key, newValue);
  22655. } else {
  22656. assignValue(object, key, newValue);
  22657. }
  22658. }
  22659. return object;
  22660. }
  22661. /**
  22662. * Copies own symbols of `source` to `object`.
  22663. *
  22664. * @private
  22665. * @param {Object} source The object to copy symbols from.
  22666. * @param {Object} [object={}] The object to copy symbols to.
  22667. * @returns {Object} Returns `object`.
  22668. */
  22669. function copySymbols(source, object) {
  22670. return copyObject(source, getSymbols(source), object);
  22671. }
  22672. /**
  22673. * Copies own and inherited symbols of `source` to `object`.
  22674. *
  22675. * @private
  22676. * @param {Object} source The object to copy symbols from.
  22677. * @param {Object} [object={}] The object to copy symbols to.
  22678. * @returns {Object} Returns `object`.
  22679. */
  22680. function copySymbolsIn(source, object) {
  22681. return copyObject(source, getSymbolsIn(source), object);
  22682. }
  22683. /**
  22684. * Creates a function like `_.groupBy`.
  22685. *
  22686. * @private
  22687. * @param {Function} setter The function to set accumulator values.
  22688. * @param {Function} [initializer] The accumulator object initializer.
  22689. * @returns {Function} Returns the new aggregator function.
  22690. */
  22691. function createAggregator(setter, initializer) {
  22692. return function(collection, iteratee) {
  22693. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  22694. accumulator = initializer ? initializer() : {};
  22695. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  22696. };
  22697. }
  22698. /**
  22699. * Creates a function like `_.assign`.
  22700. *
  22701. * @private
  22702. * @param {Function} assigner The function to assign values.
  22703. * @returns {Function} Returns the new assigner function.
  22704. */
  22705. function createAssigner(assigner) {
  22706. return baseRest(function(object, sources) {
  22707. var index = -1,
  22708. length = sources.length,
  22709. customizer = length > 1 ? sources[length - 1] : undefined,
  22710. guard = length > 2 ? sources[2] : undefined;
  22711. customizer = (assigner.length > 3 && typeof customizer == 'function')
  22712. ? (length--, customizer)
  22713. : undefined;
  22714. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  22715. customizer = length < 3 ? undefined : customizer;
  22716. length = 1;
  22717. }
  22718. object = Object(object);
  22719. while (++index < length) {
  22720. var source = sources[index];
  22721. if (source) {
  22722. assigner(object, source, index, customizer);
  22723. }
  22724. }
  22725. return object;
  22726. });
  22727. }
  22728. /**
  22729. * Creates a `baseEach` or `baseEachRight` function.
  22730. *
  22731. * @private
  22732. * @param {Function} eachFunc The function to iterate over a collection.
  22733. * @param {boolean} [fromRight] Specify iterating from right to left.
  22734. * @returns {Function} Returns the new base function.
  22735. */
  22736. function createBaseEach(eachFunc, fromRight) {
  22737. return function(collection, iteratee) {
  22738. if (collection == null) {
  22739. return collection;
  22740. }
  22741. if (!isArrayLike(collection)) {
  22742. return eachFunc(collection, iteratee);
  22743. }
  22744. var length = collection.length,
  22745. index = fromRight ? length : -1,
  22746. iterable = Object(collection);
  22747. while ((fromRight ? index-- : ++index < length)) {
  22748. if (iteratee(iterable[index], index, iterable) === false) {
  22749. break;
  22750. }
  22751. }
  22752. return collection;
  22753. };
  22754. }
  22755. /**
  22756. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  22757. *
  22758. * @private
  22759. * @param {boolean} [fromRight] Specify iterating from right to left.
  22760. * @returns {Function} Returns the new base function.
  22761. */
  22762. function createBaseFor(fromRight) {
  22763. return function(object, iteratee, keysFunc) {
  22764. var index = -1,
  22765. iterable = Object(object),
  22766. props = keysFunc(object),
  22767. length = props.length;
  22768. while (length--) {
  22769. var key = props[fromRight ? length : ++index];
  22770. if (iteratee(iterable[key], key, iterable) === false) {
  22771. break;
  22772. }
  22773. }
  22774. return object;
  22775. };
  22776. }
  22777. /**
  22778. * Creates a function that wraps `func` to invoke it with the optional `this`
  22779. * binding of `thisArg`.
  22780. *
  22781. * @private
  22782. * @param {Function} func The function to wrap.
  22783. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22784. * @param {*} [thisArg] The `this` binding of `func`.
  22785. * @returns {Function} Returns the new wrapped function.
  22786. */
  22787. function createBind(func, bitmask, thisArg) {
  22788. var isBind = bitmask & WRAP_BIND_FLAG,
  22789. Ctor = createCtor(func);
  22790. function wrapper() {
  22791. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22792. return fn.apply(isBind ? thisArg : this, arguments);
  22793. }
  22794. return wrapper;
  22795. }
  22796. /**
  22797. * Creates a function like `_.lowerFirst`.
  22798. *
  22799. * @private
  22800. * @param {string} methodName The name of the `String` case method to use.
  22801. * @returns {Function} Returns the new case function.
  22802. */
  22803. function createCaseFirst(methodName) {
  22804. return function(string) {
  22805. string = toString(string);
  22806. var strSymbols = hasUnicode(string)
  22807. ? stringToArray(string)
  22808. : undefined;
  22809. var chr = strSymbols
  22810. ? strSymbols[0]
  22811. : string.charAt(0);
  22812. var trailing = strSymbols
  22813. ? castSlice(strSymbols, 1).join('')
  22814. : string.slice(1);
  22815. return chr[methodName]() + trailing;
  22816. };
  22817. }
  22818. /**
  22819. * Creates a function like `_.camelCase`.
  22820. *
  22821. * @private
  22822. * @param {Function} callback The function to combine each word.
  22823. * @returns {Function} Returns the new compounder function.
  22824. */
  22825. function createCompounder(callback) {
  22826. return function(string) {
  22827. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  22828. };
  22829. }
  22830. /**
  22831. * Creates a function that produces an instance of `Ctor` regardless of
  22832. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  22833. *
  22834. * @private
  22835. * @param {Function} Ctor The constructor to wrap.
  22836. * @returns {Function} Returns the new wrapped function.
  22837. */
  22838. function createCtor(Ctor) {
  22839. return function() {
  22840. // Use a `switch` statement to work with class constructors. See
  22841. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  22842. // for more details.
  22843. var args = arguments;
  22844. switch (args.length) {
  22845. case 0: return new Ctor;
  22846. case 1: return new Ctor(args[0]);
  22847. case 2: return new Ctor(args[0], args[1]);
  22848. case 3: return new Ctor(args[0], args[1], args[2]);
  22849. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  22850. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  22851. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  22852. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  22853. }
  22854. var thisBinding = baseCreate(Ctor.prototype),
  22855. result = Ctor.apply(thisBinding, args);
  22856. // Mimic the constructor's `return` behavior.
  22857. // See https://es5.github.io/#x13.2.2 for more details.
  22858. return isObject(result) ? result : thisBinding;
  22859. };
  22860. }
  22861. /**
  22862. * Creates a function that wraps `func` to enable currying.
  22863. *
  22864. * @private
  22865. * @param {Function} func The function to wrap.
  22866. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22867. * @param {number} arity The arity of `func`.
  22868. * @returns {Function} Returns the new wrapped function.
  22869. */
  22870. function createCurry(func, bitmask, arity) {
  22871. var Ctor = createCtor(func);
  22872. function wrapper() {
  22873. var length = arguments.length,
  22874. args = Array(length),
  22875. index = length,
  22876. placeholder = getHolder(wrapper);
  22877. while (index--) {
  22878. args[index] = arguments[index];
  22879. }
  22880. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  22881. ? []
  22882. : replaceHolders(args, placeholder);
  22883. length -= holders.length;
  22884. if (length < arity) {
  22885. return createRecurry(
  22886. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  22887. args, holders, undefined, undefined, arity - length);
  22888. }
  22889. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22890. return apply(fn, this, args);
  22891. }
  22892. return wrapper;
  22893. }
  22894. /**
  22895. * Creates a `_.find` or `_.findLast` function.
  22896. *
  22897. * @private
  22898. * @param {Function} findIndexFunc The function to find the collection index.
  22899. * @returns {Function} Returns the new find function.
  22900. */
  22901. function createFind(findIndexFunc) {
  22902. return function(collection, predicate, fromIndex) {
  22903. var iterable = Object(collection);
  22904. if (!isArrayLike(collection)) {
  22905. var iteratee = getIteratee(predicate, 3);
  22906. collection = keys(collection);
  22907. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  22908. }
  22909. var index = findIndexFunc(collection, predicate, fromIndex);
  22910. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  22911. };
  22912. }
  22913. /**
  22914. * Creates a `_.flow` or `_.flowRight` function.
  22915. *
  22916. * @private
  22917. * @param {boolean} [fromRight] Specify iterating from right to left.
  22918. * @returns {Function} Returns the new flow function.
  22919. */
  22920. function createFlow(fromRight) {
  22921. return flatRest(function(funcs) {
  22922. var length = funcs.length,
  22923. index = length,
  22924. prereq = LodashWrapper.prototype.thru;
  22925. if (fromRight) {
  22926. funcs.reverse();
  22927. }
  22928. while (index--) {
  22929. var func = funcs[index];
  22930. if (typeof func != 'function') {
  22931. throw new TypeError(FUNC_ERROR_TEXT);
  22932. }
  22933. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  22934. var wrapper = new LodashWrapper([], true);
  22935. }
  22936. }
  22937. index = wrapper ? index : length;
  22938. while (++index < length) {
  22939. func = funcs[index];
  22940. var funcName = getFuncName(func),
  22941. data = funcName == 'wrapper' ? getData(func) : undefined;
  22942. if (data && isLaziable(data[0]) &&
  22943. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  22944. !data[4].length && data[9] == 1
  22945. ) {
  22946. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  22947. } else {
  22948. wrapper = (func.length == 1 && isLaziable(func))
  22949. ? wrapper[funcName]()
  22950. : wrapper.thru(func);
  22951. }
  22952. }
  22953. return function() {
  22954. var args = arguments,
  22955. value = args[0];
  22956. if (wrapper && args.length == 1 && isArray(value)) {
  22957. return wrapper.plant(value).value();
  22958. }
  22959. var index = 0,
  22960. result = length ? funcs[index].apply(this, args) : value;
  22961. while (++index < length) {
  22962. result = funcs[index].call(this, result);
  22963. }
  22964. return result;
  22965. };
  22966. });
  22967. }
  22968. /**
  22969. * Creates a function that wraps `func` to invoke it with optional `this`
  22970. * binding of `thisArg`, partial application, and currying.
  22971. *
  22972. * @private
  22973. * @param {Function|string} func The function or method name to wrap.
  22974. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22975. * @param {*} [thisArg] The `this` binding of `func`.
  22976. * @param {Array} [partials] The arguments to prepend to those provided to
  22977. * the new function.
  22978. * @param {Array} [holders] The `partials` placeholder indexes.
  22979. * @param {Array} [partialsRight] The arguments to append to those provided
  22980. * to the new function.
  22981. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  22982. * @param {Array} [argPos] The argument positions of the new function.
  22983. * @param {number} [ary] The arity cap of `func`.
  22984. * @param {number} [arity] The arity of `func`.
  22985. * @returns {Function} Returns the new wrapped function.
  22986. */
  22987. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  22988. var isAry = bitmask & WRAP_ARY_FLAG,
  22989. isBind = bitmask & WRAP_BIND_FLAG,
  22990. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  22991. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  22992. isFlip = bitmask & WRAP_FLIP_FLAG,
  22993. Ctor = isBindKey ? undefined : createCtor(func);
  22994. function wrapper() {
  22995. var length = arguments.length,
  22996. args = Array(length),
  22997. index = length;
  22998. while (index--) {
  22999. args[index] = arguments[index];
  23000. }
  23001. if (isCurried) {
  23002. var placeholder = getHolder(wrapper),
  23003. holdersCount = countHolders(args, placeholder);
  23004. }
  23005. if (partials) {
  23006. args = composeArgs(args, partials, holders, isCurried);
  23007. }
  23008. if (partialsRight) {
  23009. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  23010. }
  23011. length -= holdersCount;
  23012. if (isCurried && length < arity) {
  23013. var newHolders = replaceHolders(args, placeholder);
  23014. return createRecurry(
  23015. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  23016. args, newHolders, argPos, ary, arity - length
  23017. );
  23018. }
  23019. var thisBinding = isBind ? thisArg : this,
  23020. fn = isBindKey ? thisBinding[func] : func;
  23021. length = args.length;
  23022. if (argPos) {
  23023. args = reorder(args, argPos);
  23024. } else if (isFlip && length > 1) {
  23025. args.reverse();
  23026. }
  23027. if (isAry && ary < length) {
  23028. args.length = ary;
  23029. }
  23030. if (this && this !== root && this instanceof wrapper) {
  23031. fn = Ctor || createCtor(fn);
  23032. }
  23033. return fn.apply(thisBinding, args);
  23034. }
  23035. return wrapper;
  23036. }
  23037. /**
  23038. * Creates a function like `_.invertBy`.
  23039. *
  23040. * @private
  23041. * @param {Function} setter The function to set accumulator values.
  23042. * @param {Function} toIteratee The function to resolve iteratees.
  23043. * @returns {Function} Returns the new inverter function.
  23044. */
  23045. function createInverter(setter, toIteratee) {
  23046. return function(object, iteratee) {
  23047. return baseInverter(object, setter, toIteratee(iteratee), {});
  23048. };
  23049. }
  23050. /**
  23051. * Creates a function that performs a mathematical operation on two values.
  23052. *
  23053. * @private
  23054. * @param {Function} operator The function to perform the operation.
  23055. * @param {number} [defaultValue] The value used for `undefined` arguments.
  23056. * @returns {Function} Returns the new mathematical operation function.
  23057. */
  23058. function createMathOperation(operator, defaultValue) {
  23059. return function(value, other) {
  23060. var result;
  23061. if (value === undefined && other === undefined) {
  23062. return defaultValue;
  23063. }
  23064. if (value !== undefined) {
  23065. result = value;
  23066. }
  23067. if (other !== undefined) {
  23068. if (result === undefined) {
  23069. return other;
  23070. }
  23071. if (typeof value == 'string' || typeof other == 'string') {
  23072. value = baseToString(value);
  23073. other = baseToString(other);
  23074. } else {
  23075. value = baseToNumber(value);
  23076. other = baseToNumber(other);
  23077. }
  23078. result = operator(value, other);
  23079. }
  23080. return result;
  23081. };
  23082. }
  23083. /**
  23084. * Creates a function like `_.over`.
  23085. *
  23086. * @private
  23087. * @param {Function} arrayFunc The function to iterate over iteratees.
  23088. * @returns {Function} Returns the new over function.
  23089. */
  23090. function createOver(arrayFunc) {
  23091. return flatRest(function(iteratees) {
  23092. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  23093. return baseRest(function(args) {
  23094. var thisArg = this;
  23095. return arrayFunc(iteratees, function(iteratee) {
  23096. return apply(iteratee, thisArg, args);
  23097. });
  23098. });
  23099. });
  23100. }
  23101. /**
  23102. * Creates the padding for `string` based on `length`. The `chars` string
  23103. * is truncated if the number of characters exceeds `length`.
  23104. *
  23105. * @private
  23106. * @param {number} length The padding length.
  23107. * @param {string} [chars=' '] The string used as padding.
  23108. * @returns {string} Returns the padding for `string`.
  23109. */
  23110. function createPadding(length, chars) {
  23111. chars = chars === undefined ? ' ' : baseToString(chars);
  23112. var charsLength = chars.length;
  23113. if (charsLength < 2) {
  23114. return charsLength ? baseRepeat(chars, length) : chars;
  23115. }
  23116. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  23117. return hasUnicode(chars)
  23118. ? castSlice(stringToArray(result), 0, length).join('')
  23119. : result.slice(0, length);
  23120. }
  23121. /**
  23122. * Creates a function that wraps `func` to invoke it with the `this` binding
  23123. * of `thisArg` and `partials` prepended to the arguments it receives.
  23124. *
  23125. * @private
  23126. * @param {Function} func The function to wrap.
  23127. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23128. * @param {*} thisArg The `this` binding of `func`.
  23129. * @param {Array} partials The arguments to prepend to those provided to
  23130. * the new function.
  23131. * @returns {Function} Returns the new wrapped function.
  23132. */
  23133. function createPartial(func, bitmask, thisArg, partials) {
  23134. var isBind = bitmask & WRAP_BIND_FLAG,
  23135. Ctor = createCtor(func);
  23136. function wrapper() {
  23137. var argsIndex = -1,
  23138. argsLength = arguments.length,
  23139. leftIndex = -1,
  23140. leftLength = partials.length,
  23141. args = Array(leftLength + argsLength),
  23142. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23143. while (++leftIndex < leftLength) {
  23144. args[leftIndex] = partials[leftIndex];
  23145. }
  23146. while (argsLength--) {
  23147. args[leftIndex++] = arguments[++argsIndex];
  23148. }
  23149. return apply(fn, isBind ? thisArg : this, args);
  23150. }
  23151. return wrapper;
  23152. }
  23153. /**
  23154. * Creates a `_.range` or `_.rangeRight` function.
  23155. *
  23156. * @private
  23157. * @param {boolean} [fromRight] Specify iterating from right to left.
  23158. * @returns {Function} Returns the new range function.
  23159. */
  23160. function createRange(fromRight) {
  23161. return function(start, end, step) {
  23162. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  23163. end = step = undefined;
  23164. }
  23165. // Ensure the sign of `-0` is preserved.
  23166. start = toFinite(start);
  23167. if (end === undefined) {
  23168. end = start;
  23169. start = 0;
  23170. } else {
  23171. end = toFinite(end);
  23172. }
  23173. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  23174. return baseRange(start, end, step, fromRight);
  23175. };
  23176. }
  23177. /**
  23178. * Creates a function that performs a relational operation on two values.
  23179. *
  23180. * @private
  23181. * @param {Function} operator The function to perform the operation.
  23182. * @returns {Function} Returns the new relational operation function.
  23183. */
  23184. function createRelationalOperation(operator) {
  23185. return function(value, other) {
  23186. if (!(typeof value == 'string' && typeof other == 'string')) {
  23187. value = toNumber(value);
  23188. other = toNumber(other);
  23189. }
  23190. return operator(value, other);
  23191. };
  23192. }
  23193. /**
  23194. * Creates a function that wraps `func` to continue currying.
  23195. *
  23196. * @private
  23197. * @param {Function} func The function to wrap.
  23198. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23199. * @param {Function} wrapFunc The function to create the `func` wrapper.
  23200. * @param {*} placeholder The placeholder value.
  23201. * @param {*} [thisArg] The `this` binding of `func`.
  23202. * @param {Array} [partials] The arguments to prepend to those provided to
  23203. * the new function.
  23204. * @param {Array} [holders] The `partials` placeholder indexes.
  23205. * @param {Array} [argPos] The argument positions of the new function.
  23206. * @param {number} [ary] The arity cap of `func`.
  23207. * @param {number} [arity] The arity of `func`.
  23208. * @returns {Function} Returns the new wrapped function.
  23209. */
  23210. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  23211. var isCurry = bitmask & WRAP_CURRY_FLAG,
  23212. newHolders = isCurry ? holders : undefined,
  23213. newHoldersRight = isCurry ? undefined : holders,
  23214. newPartials = isCurry ? partials : undefined,
  23215. newPartialsRight = isCurry ? undefined : partials;
  23216. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  23217. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  23218. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  23219. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  23220. }
  23221. var newData = [
  23222. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  23223. newHoldersRight, argPos, ary, arity
  23224. ];
  23225. var result = wrapFunc.apply(undefined, newData);
  23226. if (isLaziable(func)) {
  23227. setData(result, newData);
  23228. }
  23229. result.placeholder = placeholder;
  23230. return setWrapToString(result, func, bitmask);
  23231. }
  23232. /**
  23233. * Creates a function like `_.round`.
  23234. *
  23235. * @private
  23236. * @param {string} methodName The name of the `Math` method to use when rounding.
  23237. * @returns {Function} Returns the new round function.
  23238. */
  23239. function createRound(methodName) {
  23240. var func = Math[methodName];
  23241. return function(number, precision) {
  23242. number = toNumber(number);
  23243. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  23244. if (precision && nativeIsFinite(number)) {
  23245. // Shift with exponential notation to avoid floating-point issues.
  23246. // See [MDN](https://mdn.io/round#Examples) for more details.
  23247. var pair = (toString(number) + 'e').split('e'),
  23248. value = func(pair[0] + 'e' + (+pair[1] + precision));
  23249. pair = (toString(value) + 'e').split('e');
  23250. return +(pair[0] + 'e' + (+pair[1] - precision));
  23251. }
  23252. return func(number);
  23253. };
  23254. }
  23255. /**
  23256. * Creates a set object of `values`.
  23257. *
  23258. * @private
  23259. * @param {Array} values The values to add to the set.
  23260. * @returns {Object} Returns the new set.
  23261. */
  23262. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  23263. return new Set(values);
  23264. };
  23265. /**
  23266. * Creates a `_.toPairs` or `_.toPairsIn` function.
  23267. *
  23268. * @private
  23269. * @param {Function} keysFunc The function to get the keys of a given object.
  23270. * @returns {Function} Returns the new pairs function.
  23271. */
  23272. function createToPairs(keysFunc) {
  23273. return function(object) {
  23274. var tag = getTag(object);
  23275. if (tag == mapTag) {
  23276. return mapToArray(object);
  23277. }
  23278. if (tag == setTag) {
  23279. return setToPairs(object);
  23280. }
  23281. return baseToPairs(object, keysFunc(object));
  23282. };
  23283. }
  23284. /**
  23285. * Creates a function that either curries or invokes `func` with optional
  23286. * `this` binding and partially applied arguments.
  23287. *
  23288. * @private
  23289. * @param {Function|string} func The function or method name to wrap.
  23290. * @param {number} bitmask The bitmask flags.
  23291. * 1 - `_.bind`
  23292. * 2 - `_.bindKey`
  23293. * 4 - `_.curry` or `_.curryRight` of a bound function
  23294. * 8 - `_.curry`
  23295. * 16 - `_.curryRight`
  23296. * 32 - `_.partial`
  23297. * 64 - `_.partialRight`
  23298. * 128 - `_.rearg`
  23299. * 256 - `_.ary`
  23300. * 512 - `_.flip`
  23301. * @param {*} [thisArg] The `this` binding of `func`.
  23302. * @param {Array} [partials] The arguments to be partially applied.
  23303. * @param {Array} [holders] The `partials` placeholder indexes.
  23304. * @param {Array} [argPos] The argument positions of the new function.
  23305. * @param {number} [ary] The arity cap of `func`.
  23306. * @param {number} [arity] The arity of `func`.
  23307. * @returns {Function} Returns the new wrapped function.
  23308. */
  23309. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  23310. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  23311. if (!isBindKey && typeof func != 'function') {
  23312. throw new TypeError(FUNC_ERROR_TEXT);
  23313. }
  23314. var length = partials ? partials.length : 0;
  23315. if (!length) {
  23316. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  23317. partials = holders = undefined;
  23318. }
  23319. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  23320. arity = arity === undefined ? arity : toInteger(arity);
  23321. length -= holders ? holders.length : 0;
  23322. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  23323. var partialsRight = partials,
  23324. holdersRight = holders;
  23325. partials = holders = undefined;
  23326. }
  23327. var data = isBindKey ? undefined : getData(func);
  23328. var newData = [
  23329. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  23330. argPos, ary, arity
  23331. ];
  23332. if (data) {
  23333. mergeData(newData, data);
  23334. }
  23335. func = newData[0];
  23336. bitmask = newData[1];
  23337. thisArg = newData[2];
  23338. partials = newData[3];
  23339. holders = newData[4];
  23340. arity = newData[9] = newData[9] === undefined
  23341. ? (isBindKey ? 0 : func.length)
  23342. : nativeMax(newData[9] - length, 0);
  23343. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  23344. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  23345. }
  23346. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  23347. var result = createBind(func, bitmask, thisArg);
  23348. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  23349. result = createCurry(func, bitmask, arity);
  23350. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  23351. result = createPartial(func, bitmask, thisArg, partials);
  23352. } else {
  23353. result = createHybrid.apply(undefined, newData);
  23354. }
  23355. var setter = data ? baseSetData : setData;
  23356. return setWrapToString(setter(result, newData), func, bitmask);
  23357. }
  23358. /**
  23359. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  23360. * of source objects to the destination object for all destination properties
  23361. * that resolve to `undefined`.
  23362. *
  23363. * @private
  23364. * @param {*} objValue The destination value.
  23365. * @param {*} srcValue The source value.
  23366. * @param {string} key The key of the property to assign.
  23367. * @param {Object} object The parent object of `objValue`.
  23368. * @returns {*} Returns the value to assign.
  23369. */
  23370. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  23371. if (objValue === undefined ||
  23372. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  23373. return srcValue;
  23374. }
  23375. return objValue;
  23376. }
  23377. /**
  23378. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  23379. * objects into destination objects that are passed thru.
  23380. *
  23381. * @private
  23382. * @param {*} objValue The destination value.
  23383. * @param {*} srcValue The source value.
  23384. * @param {string} key The key of the property to merge.
  23385. * @param {Object} object The parent object of `objValue`.
  23386. * @param {Object} source The parent object of `srcValue`.
  23387. * @param {Object} [stack] Tracks traversed source values and their merged
  23388. * counterparts.
  23389. * @returns {*} Returns the value to assign.
  23390. */
  23391. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  23392. if (isObject(objValue) && isObject(srcValue)) {
  23393. // Recursively merge objects and arrays (susceptible to call stack limits).
  23394. stack.set(srcValue, objValue);
  23395. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  23396. stack['delete'](srcValue);
  23397. }
  23398. return objValue;
  23399. }
  23400. /**
  23401. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  23402. * objects.
  23403. *
  23404. * @private
  23405. * @param {*} value The value to inspect.
  23406. * @param {string} key The key of the property to inspect.
  23407. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  23408. */
  23409. function customOmitClone(value) {
  23410. return isPlainObject(value) ? undefined : value;
  23411. }
  23412. /**
  23413. * A specialized version of `baseIsEqualDeep` for arrays with support for
  23414. * partial deep comparisons.
  23415. *
  23416. * @private
  23417. * @param {Array} array The array to compare.
  23418. * @param {Array} other The other array to compare.
  23419. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23420. * @param {Function} customizer The function to customize comparisons.
  23421. * @param {Function} equalFunc The function to determine equivalents of values.
  23422. * @param {Object} stack Tracks traversed `array` and `other` objects.
  23423. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  23424. */
  23425. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  23426. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23427. arrLength = array.length,
  23428. othLength = other.length;
  23429. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  23430. return false;
  23431. }
  23432. // Assume cyclic values are equal.
  23433. var stacked = stack.get(array);
  23434. if (stacked && stack.get(other)) {
  23435. return stacked == other;
  23436. }
  23437. var index = -1,
  23438. result = true,
  23439. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  23440. stack.set(array, other);
  23441. stack.set(other, array);
  23442. // Ignore non-index properties.
  23443. while (++index < arrLength) {
  23444. var arrValue = array[index],
  23445. othValue = other[index];
  23446. if (customizer) {
  23447. var compared = isPartial
  23448. ? customizer(othValue, arrValue, index, other, array, stack)
  23449. : customizer(arrValue, othValue, index, array, other, stack);
  23450. }
  23451. if (compared !== undefined) {
  23452. if (compared) {
  23453. continue;
  23454. }
  23455. result = false;
  23456. break;
  23457. }
  23458. // Recursively compare arrays (susceptible to call stack limits).
  23459. if (seen) {
  23460. if (!arraySome(other, function(othValue, othIndex) {
  23461. if (!cacheHas(seen, othIndex) &&
  23462. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  23463. return seen.push(othIndex);
  23464. }
  23465. })) {
  23466. result = false;
  23467. break;
  23468. }
  23469. } else if (!(
  23470. arrValue === othValue ||
  23471. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  23472. )) {
  23473. result = false;
  23474. break;
  23475. }
  23476. }
  23477. stack['delete'](array);
  23478. stack['delete'](other);
  23479. return result;
  23480. }
  23481. /**
  23482. * A specialized version of `baseIsEqualDeep` for comparing objects of
  23483. * the same `toStringTag`.
  23484. *
  23485. * **Note:** This function only supports comparing values with tags of
  23486. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  23487. *
  23488. * @private
  23489. * @param {Object} object The object to compare.
  23490. * @param {Object} other The other object to compare.
  23491. * @param {string} tag The `toStringTag` of the objects to compare.
  23492. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23493. * @param {Function} customizer The function to customize comparisons.
  23494. * @param {Function} equalFunc The function to determine equivalents of values.
  23495. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23496. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23497. */
  23498. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  23499. switch (tag) {
  23500. case dataViewTag:
  23501. if ((object.byteLength != other.byteLength) ||
  23502. (object.byteOffset != other.byteOffset)) {
  23503. return false;
  23504. }
  23505. object = object.buffer;
  23506. other = other.buffer;
  23507. case arrayBufferTag:
  23508. if ((object.byteLength != other.byteLength) ||
  23509. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  23510. return false;
  23511. }
  23512. return true;
  23513. case boolTag:
  23514. case dateTag:
  23515. case numberTag:
  23516. // Coerce booleans to `1` or `0` and dates to milliseconds.
  23517. // Invalid dates are coerced to `NaN`.
  23518. return eq(+object, +other);
  23519. case errorTag:
  23520. return object.name == other.name && object.message == other.message;
  23521. case regexpTag:
  23522. case stringTag:
  23523. // Coerce regexes to strings and treat strings, primitives and objects,
  23524. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  23525. // for more details.
  23526. return object == (other + '');
  23527. case mapTag:
  23528. var convert = mapToArray;
  23529. case setTag:
  23530. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  23531. convert || (convert = setToArray);
  23532. if (object.size != other.size && !isPartial) {
  23533. return false;
  23534. }
  23535. // Assume cyclic values are equal.
  23536. var stacked = stack.get(object);
  23537. if (stacked) {
  23538. return stacked == other;
  23539. }
  23540. bitmask |= COMPARE_UNORDERED_FLAG;
  23541. // Recursively compare objects (susceptible to call stack limits).
  23542. stack.set(object, other);
  23543. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  23544. stack['delete'](object);
  23545. return result;
  23546. case symbolTag:
  23547. if (symbolValueOf) {
  23548. return symbolValueOf.call(object) == symbolValueOf.call(other);
  23549. }
  23550. }
  23551. return false;
  23552. }
  23553. /**
  23554. * A specialized version of `baseIsEqualDeep` for objects with support for
  23555. * partial deep comparisons.
  23556. *
  23557. * @private
  23558. * @param {Object} object The object to compare.
  23559. * @param {Object} other The other object to compare.
  23560. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23561. * @param {Function} customizer The function to customize comparisons.
  23562. * @param {Function} equalFunc The function to determine equivalents of values.
  23563. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23564. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23565. */
  23566. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  23567. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23568. objProps = getAllKeys(object),
  23569. objLength = objProps.length,
  23570. othProps = getAllKeys(other),
  23571. othLength = othProps.length;
  23572. if (objLength != othLength && !isPartial) {
  23573. return false;
  23574. }
  23575. var index = objLength;
  23576. while (index--) {
  23577. var key = objProps[index];
  23578. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  23579. return false;
  23580. }
  23581. }
  23582. // Assume cyclic values are equal.
  23583. var stacked = stack.get(object);
  23584. if (stacked && stack.get(other)) {
  23585. return stacked == other;
  23586. }
  23587. var result = true;
  23588. stack.set(object, other);
  23589. stack.set(other, object);
  23590. var skipCtor = isPartial;
  23591. while (++index < objLength) {
  23592. key = objProps[index];
  23593. var objValue = object[key],
  23594. othValue = other[key];
  23595. if (customizer) {
  23596. var compared = isPartial
  23597. ? customizer(othValue, objValue, key, other, object, stack)
  23598. : customizer(objValue, othValue, key, object, other, stack);
  23599. }
  23600. // Recursively compare objects (susceptible to call stack limits).
  23601. if (!(compared === undefined
  23602. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  23603. : compared
  23604. )) {
  23605. result = false;
  23606. break;
  23607. }
  23608. skipCtor || (skipCtor = key == 'constructor');
  23609. }
  23610. if (result && !skipCtor) {
  23611. var objCtor = object.constructor,
  23612. othCtor = other.constructor;
  23613. // Non `Object` object instances with different constructors are not equal.
  23614. if (objCtor != othCtor &&
  23615. ('constructor' in object && 'constructor' in other) &&
  23616. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  23617. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  23618. result = false;
  23619. }
  23620. }
  23621. stack['delete'](object);
  23622. stack['delete'](other);
  23623. return result;
  23624. }
  23625. /**
  23626. * A specialized version of `baseRest` which flattens the rest array.
  23627. *
  23628. * @private
  23629. * @param {Function} func The function to apply a rest parameter to.
  23630. * @returns {Function} Returns the new function.
  23631. */
  23632. function flatRest(func) {
  23633. return setToString(overRest(func, undefined, flatten), func + '');
  23634. }
  23635. /**
  23636. * Creates an array of own enumerable property names and symbols of `object`.
  23637. *
  23638. * @private
  23639. * @param {Object} object The object to query.
  23640. * @returns {Array} Returns the array of property names and symbols.
  23641. */
  23642. function getAllKeys(object) {
  23643. return baseGetAllKeys(object, keys, getSymbols);
  23644. }
  23645. /**
  23646. * Creates an array of own and inherited enumerable property names and
  23647. * symbols of `object`.
  23648. *
  23649. * @private
  23650. * @param {Object} object The object to query.
  23651. * @returns {Array} Returns the array of property names and symbols.
  23652. */
  23653. function getAllKeysIn(object) {
  23654. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  23655. }
  23656. /**
  23657. * Gets metadata for `func`.
  23658. *
  23659. * @private
  23660. * @param {Function} func The function to query.
  23661. * @returns {*} Returns the metadata for `func`.
  23662. */
  23663. var getData = !metaMap ? noop : function(func) {
  23664. return metaMap.get(func);
  23665. };
  23666. /**
  23667. * Gets the name of `func`.
  23668. *
  23669. * @private
  23670. * @param {Function} func The function to query.
  23671. * @returns {string} Returns the function name.
  23672. */
  23673. function getFuncName(func) {
  23674. var result = (func.name + ''),
  23675. array = realNames[result],
  23676. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  23677. while (length--) {
  23678. var data = array[length],
  23679. otherFunc = data.func;
  23680. if (otherFunc == null || otherFunc == func) {
  23681. return data.name;
  23682. }
  23683. }
  23684. return result;
  23685. }
  23686. /**
  23687. * Gets the argument placeholder value for `func`.
  23688. *
  23689. * @private
  23690. * @param {Function} func The function to inspect.
  23691. * @returns {*} Returns the placeholder value.
  23692. */
  23693. function getHolder(func) {
  23694. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  23695. return object.placeholder;
  23696. }
  23697. /**
  23698. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  23699. * this function returns the custom method, otherwise it returns `baseIteratee`.
  23700. * If arguments are provided, the chosen function is invoked with them and
  23701. * its result is returned.
  23702. *
  23703. * @private
  23704. * @param {*} [value] The value to convert to an iteratee.
  23705. * @param {number} [arity] The arity of the created iteratee.
  23706. * @returns {Function} Returns the chosen function or its result.
  23707. */
  23708. function getIteratee() {
  23709. var result = lodash.iteratee || iteratee;
  23710. result = result === iteratee ? baseIteratee : result;
  23711. return arguments.length ? result(arguments[0], arguments[1]) : result;
  23712. }
  23713. /**
  23714. * Gets the data for `map`.
  23715. *
  23716. * @private
  23717. * @param {Object} map The map to query.
  23718. * @param {string} key The reference key.
  23719. * @returns {*} Returns the map data.
  23720. */
  23721. function getMapData(map, key) {
  23722. var data = map.__data__;
  23723. return isKeyable(key)
  23724. ? data[typeof key == 'string' ? 'string' : 'hash']
  23725. : data.map;
  23726. }
  23727. /**
  23728. * Gets the property names, values, and compare flags of `object`.
  23729. *
  23730. * @private
  23731. * @param {Object} object The object to query.
  23732. * @returns {Array} Returns the match data of `object`.
  23733. */
  23734. function getMatchData(object) {
  23735. var result = keys(object),
  23736. length = result.length;
  23737. while (length--) {
  23738. var key = result[length],
  23739. value = object[key];
  23740. result[length] = [key, value, isStrictComparable(value)];
  23741. }
  23742. return result;
  23743. }
  23744. /**
  23745. * Gets the native function at `key` of `object`.
  23746. *
  23747. * @private
  23748. * @param {Object} object The object to query.
  23749. * @param {string} key The key of the method to get.
  23750. * @returns {*} Returns the function if it's native, else `undefined`.
  23751. */
  23752. function getNative(object, key) {
  23753. var value = getValue(object, key);
  23754. return baseIsNative(value) ? value : undefined;
  23755. }
  23756. /**
  23757. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  23758. *
  23759. * @private
  23760. * @param {*} value The value to query.
  23761. * @returns {string} Returns the raw `toStringTag`.
  23762. */
  23763. function getRawTag(value) {
  23764. var isOwn = hasOwnProperty.call(value, symToStringTag),
  23765. tag = value[symToStringTag];
  23766. try {
  23767. value[symToStringTag] = undefined;
  23768. var unmasked = true;
  23769. } catch (e) {}
  23770. var result = nativeObjectToString.call(value);
  23771. if (unmasked) {
  23772. if (isOwn) {
  23773. value[symToStringTag] = tag;
  23774. } else {
  23775. delete value[symToStringTag];
  23776. }
  23777. }
  23778. return result;
  23779. }
  23780. /**
  23781. * Creates an array of the own enumerable symbols of `object`.
  23782. *
  23783. * @private
  23784. * @param {Object} object The object to query.
  23785. * @returns {Array} Returns the array of symbols.
  23786. */
  23787. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  23788. if (object == null) {
  23789. return [];
  23790. }
  23791. object = Object(object);
  23792. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  23793. return propertyIsEnumerable.call(object, symbol);
  23794. });
  23795. };
  23796. /**
  23797. * Creates an array of the own and inherited enumerable symbols of `object`.
  23798. *
  23799. * @private
  23800. * @param {Object} object The object to query.
  23801. * @returns {Array} Returns the array of symbols.
  23802. */
  23803. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  23804. var result = [];
  23805. while (object) {
  23806. arrayPush(result, getSymbols(object));
  23807. object = getPrototype(object);
  23808. }
  23809. return result;
  23810. };
  23811. /**
  23812. * Gets the `toStringTag` of `value`.
  23813. *
  23814. * @private
  23815. * @param {*} value The value to query.
  23816. * @returns {string} Returns the `toStringTag`.
  23817. */
  23818. var getTag = baseGetTag;
  23819. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  23820. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  23821. (Map && getTag(new Map) != mapTag) ||
  23822. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  23823. (Set && getTag(new Set) != setTag) ||
  23824. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  23825. getTag = function(value) {
  23826. var result = baseGetTag(value),
  23827. Ctor = result == objectTag ? value.constructor : undefined,
  23828. ctorString = Ctor ? toSource(Ctor) : '';
  23829. if (ctorString) {
  23830. switch (ctorString) {
  23831. case dataViewCtorString: return dataViewTag;
  23832. case mapCtorString: return mapTag;
  23833. case promiseCtorString: return promiseTag;
  23834. case setCtorString: return setTag;
  23835. case weakMapCtorString: return weakMapTag;
  23836. }
  23837. }
  23838. return result;
  23839. };
  23840. }
  23841. /**
  23842. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  23843. *
  23844. * @private
  23845. * @param {number} start The start of the view.
  23846. * @param {number} end The end of the view.
  23847. * @param {Array} transforms The transformations to apply to the view.
  23848. * @returns {Object} Returns an object containing the `start` and `end`
  23849. * positions of the view.
  23850. */
  23851. function getView(start, end, transforms) {
  23852. var index = -1,
  23853. length = transforms.length;
  23854. while (++index < length) {
  23855. var data = transforms[index],
  23856. size = data.size;
  23857. switch (data.type) {
  23858. case 'drop': start += size; break;
  23859. case 'dropRight': end -= size; break;
  23860. case 'take': end = nativeMin(end, start + size); break;
  23861. case 'takeRight': start = nativeMax(start, end - size); break;
  23862. }
  23863. }
  23864. return { 'start': start, 'end': end };
  23865. }
  23866. /**
  23867. * Extracts wrapper details from the `source` body comment.
  23868. *
  23869. * @private
  23870. * @param {string} source The source to inspect.
  23871. * @returns {Array} Returns the wrapper details.
  23872. */
  23873. function getWrapDetails(source) {
  23874. var match = source.match(reWrapDetails);
  23875. return match ? match[1].split(reSplitDetails) : [];
  23876. }
  23877. /**
  23878. * Checks if `path` exists on `object`.
  23879. *
  23880. * @private
  23881. * @param {Object} object The object to query.
  23882. * @param {Array|string} path The path to check.
  23883. * @param {Function} hasFunc The function to check properties.
  23884. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  23885. */
  23886. function hasPath(object, path, hasFunc) {
  23887. path = castPath(path, object);
  23888. var index = -1,
  23889. length = path.length,
  23890. result = false;
  23891. while (++index < length) {
  23892. var key = toKey(path[index]);
  23893. if (!(result = object != null && hasFunc(object, key))) {
  23894. break;
  23895. }
  23896. object = object[key];
  23897. }
  23898. if (result || ++index != length) {
  23899. return result;
  23900. }
  23901. length = object == null ? 0 : object.length;
  23902. return !!length && isLength(length) && isIndex(key, length) &&
  23903. (isArray(object) || isArguments(object));
  23904. }
  23905. /**
  23906. * Initializes an array clone.
  23907. *
  23908. * @private
  23909. * @param {Array} array The array to clone.
  23910. * @returns {Array} Returns the initialized clone.
  23911. */
  23912. function initCloneArray(array) {
  23913. var length = array.length,
  23914. result = new array.constructor(length);
  23915. // Add properties assigned by `RegExp#exec`.
  23916. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  23917. result.index = array.index;
  23918. result.input = array.input;
  23919. }
  23920. return result;
  23921. }
  23922. /**
  23923. * Initializes an object clone.
  23924. *
  23925. * @private
  23926. * @param {Object} object The object to clone.
  23927. * @returns {Object} Returns the initialized clone.
  23928. */
  23929. function initCloneObject(object) {
  23930. return (typeof object.constructor == 'function' && !isPrototype(object))
  23931. ? baseCreate(getPrototype(object))
  23932. : {};
  23933. }
  23934. /**
  23935. * Initializes an object clone based on its `toStringTag`.
  23936. *
  23937. * **Note:** This function only supports cloning values with tags of
  23938. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  23939. *
  23940. * @private
  23941. * @param {Object} object The object to clone.
  23942. * @param {string} tag The `toStringTag` of the object to clone.
  23943. * @param {boolean} [isDeep] Specify a deep clone.
  23944. * @returns {Object} Returns the initialized clone.
  23945. */
  23946. function initCloneByTag(object, tag, isDeep) {
  23947. var Ctor = object.constructor;
  23948. switch (tag) {
  23949. case arrayBufferTag:
  23950. return cloneArrayBuffer(object);
  23951. case boolTag:
  23952. case dateTag:
  23953. return new Ctor(+object);
  23954. case dataViewTag:
  23955. return cloneDataView(object, isDeep);
  23956. case float32Tag: case float64Tag:
  23957. case int8Tag: case int16Tag: case int32Tag:
  23958. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  23959. return cloneTypedArray(object, isDeep);
  23960. case mapTag:
  23961. return new Ctor;
  23962. case numberTag:
  23963. case stringTag:
  23964. return new Ctor(object);
  23965. case regexpTag:
  23966. return cloneRegExp(object);
  23967. case setTag:
  23968. return new Ctor;
  23969. case symbolTag:
  23970. return cloneSymbol(object);
  23971. }
  23972. }
  23973. /**
  23974. * Inserts wrapper `details` in a comment at the top of the `source` body.
  23975. *
  23976. * @private
  23977. * @param {string} source The source to modify.
  23978. * @returns {Array} details The details to insert.
  23979. * @returns {string} Returns the modified source.
  23980. */
  23981. function insertWrapDetails(source, details) {
  23982. var length = details.length;
  23983. if (!length) {
  23984. return source;
  23985. }
  23986. var lastIndex = length - 1;
  23987. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  23988. details = details.join(length > 2 ? ', ' : ' ');
  23989. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  23990. }
  23991. /**
  23992. * Checks if `value` is a flattenable `arguments` object or array.
  23993. *
  23994. * @private
  23995. * @param {*} value The value to check.
  23996. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  23997. */
  23998. function isFlattenable(value) {
  23999. return isArray(value) || isArguments(value) ||
  24000. !!(spreadableSymbol && value && value[spreadableSymbol]);
  24001. }
  24002. /**
  24003. * Checks if `value` is a valid array-like index.
  24004. *
  24005. * @private
  24006. * @param {*} value The value to check.
  24007. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  24008. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  24009. */
  24010. function isIndex(value, length) {
  24011. var type = typeof value;
  24012. length = length == null ? MAX_SAFE_INTEGER : length;
  24013. return !!length &&
  24014. (type == 'number' ||
  24015. (type != 'symbol' && reIsUint.test(value))) &&
  24016. (value > -1 && value % 1 == 0 && value < length);
  24017. }
  24018. /**
  24019. * Checks if the given arguments are from an iteratee call.
  24020. *
  24021. * @private
  24022. * @param {*} value The potential iteratee value argument.
  24023. * @param {*} index The potential iteratee index or key argument.
  24024. * @param {*} object The potential iteratee object argument.
  24025. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  24026. * else `false`.
  24027. */
  24028. function isIterateeCall(value, index, object) {
  24029. if (!isObject(object)) {
  24030. return false;
  24031. }
  24032. var type = typeof index;
  24033. if (type == 'number'
  24034. ? (isArrayLike(object) && isIndex(index, object.length))
  24035. : (type == 'string' && index in object)
  24036. ) {
  24037. return eq(object[index], value);
  24038. }
  24039. return false;
  24040. }
  24041. /**
  24042. * Checks if `value` is a property name and not a property path.
  24043. *
  24044. * @private
  24045. * @param {*} value The value to check.
  24046. * @param {Object} [object] The object to query keys on.
  24047. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  24048. */
  24049. function isKey(value, object) {
  24050. if (isArray(value)) {
  24051. return false;
  24052. }
  24053. var type = typeof value;
  24054. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  24055. value == null || isSymbol(value)) {
  24056. return true;
  24057. }
  24058. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  24059. (object != null && value in Object(object));
  24060. }
  24061. /**
  24062. * Checks if `value` is suitable for use as unique object key.
  24063. *
  24064. * @private
  24065. * @param {*} value The value to check.
  24066. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  24067. */
  24068. function isKeyable(value) {
  24069. var type = typeof value;
  24070. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  24071. ? (value !== '__proto__')
  24072. : (value === null);
  24073. }
  24074. /**
  24075. * Checks if `func` has a lazy counterpart.
  24076. *
  24077. * @private
  24078. * @param {Function} func The function to check.
  24079. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  24080. * else `false`.
  24081. */
  24082. function isLaziable(func) {
  24083. var funcName = getFuncName(func),
  24084. other = lodash[funcName];
  24085. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  24086. return false;
  24087. }
  24088. if (func === other) {
  24089. return true;
  24090. }
  24091. var data = getData(other);
  24092. return !!data && func === data[0];
  24093. }
  24094. /**
  24095. * Checks if `func` has its source masked.
  24096. *
  24097. * @private
  24098. * @param {Function} func The function to check.
  24099. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  24100. */
  24101. function isMasked(func) {
  24102. return !!maskSrcKey && (maskSrcKey in func);
  24103. }
  24104. /**
  24105. * Checks if `func` is capable of being masked.
  24106. *
  24107. * @private
  24108. * @param {*} value The value to check.
  24109. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  24110. */
  24111. var isMaskable = coreJsData ? isFunction : stubFalse;
  24112. /**
  24113. * Checks if `value` is likely a prototype object.
  24114. *
  24115. * @private
  24116. * @param {*} value The value to check.
  24117. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  24118. */
  24119. function isPrototype(value) {
  24120. var Ctor = value && value.constructor,
  24121. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  24122. return value === proto;
  24123. }
  24124. /**
  24125. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  24126. *
  24127. * @private
  24128. * @param {*} value The value to check.
  24129. * @returns {boolean} Returns `true` if `value` if suitable for strict
  24130. * equality comparisons, else `false`.
  24131. */
  24132. function isStrictComparable(value) {
  24133. return value === value && !isObject(value);
  24134. }
  24135. /**
  24136. * A specialized version of `matchesProperty` for source values suitable
  24137. * for strict equality comparisons, i.e. `===`.
  24138. *
  24139. * @private
  24140. * @param {string} key The key of the property to get.
  24141. * @param {*} srcValue The value to match.
  24142. * @returns {Function} Returns the new spec function.
  24143. */
  24144. function matchesStrictComparable(key, srcValue) {
  24145. return function(object) {
  24146. if (object == null) {
  24147. return false;
  24148. }
  24149. return object[key] === srcValue &&
  24150. (srcValue !== undefined || (key in Object(object)));
  24151. };
  24152. }
  24153. /**
  24154. * A specialized version of `_.memoize` which clears the memoized function's
  24155. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  24156. *
  24157. * @private
  24158. * @param {Function} func The function to have its output memoized.
  24159. * @returns {Function} Returns the new memoized function.
  24160. */
  24161. function memoizeCapped(func) {
  24162. var result = memoize(func, function(key) {
  24163. if (cache.size === MAX_MEMOIZE_SIZE) {
  24164. cache.clear();
  24165. }
  24166. return key;
  24167. });
  24168. var cache = result.cache;
  24169. return result;
  24170. }
  24171. /**
  24172. * Merges the function metadata of `source` into `data`.
  24173. *
  24174. * Merging metadata reduces the number of wrappers used to invoke a function.
  24175. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  24176. * may be applied regardless of execution order. Methods like `_.ary` and
  24177. * `_.rearg` modify function arguments, making the order in which they are
  24178. * executed important, preventing the merging of metadata. However, we make
  24179. * an exception for a safe combined case where curried functions have `_.ary`
  24180. * and or `_.rearg` applied.
  24181. *
  24182. * @private
  24183. * @param {Array} data The destination metadata.
  24184. * @param {Array} source The source metadata.
  24185. * @returns {Array} Returns `data`.
  24186. */
  24187. function mergeData(data, source) {
  24188. var bitmask = data[1],
  24189. srcBitmask = source[1],
  24190. newBitmask = bitmask | srcBitmask,
  24191. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  24192. var isCombo =
  24193. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  24194. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  24195. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  24196. // Exit early if metadata can't be merged.
  24197. if (!(isCommon || isCombo)) {
  24198. return data;
  24199. }
  24200. // Use source `thisArg` if available.
  24201. if (srcBitmask & WRAP_BIND_FLAG) {
  24202. data[2] = source[2];
  24203. // Set when currying a bound function.
  24204. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  24205. }
  24206. // Compose partial arguments.
  24207. var value = source[3];
  24208. if (value) {
  24209. var partials = data[3];
  24210. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  24211. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  24212. }
  24213. // Compose partial right arguments.
  24214. value = source[5];
  24215. if (value) {
  24216. partials = data[5];
  24217. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  24218. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  24219. }
  24220. // Use source `argPos` if available.
  24221. value = source[7];
  24222. if (value) {
  24223. data[7] = value;
  24224. }
  24225. // Use source `ary` if it's smaller.
  24226. if (srcBitmask & WRAP_ARY_FLAG) {
  24227. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  24228. }
  24229. // Use source `arity` if one is not provided.
  24230. if (data[9] == null) {
  24231. data[9] = source[9];
  24232. }
  24233. // Use source `func` and merge bitmasks.
  24234. data[0] = source[0];
  24235. data[1] = newBitmask;
  24236. return data;
  24237. }
  24238. /**
  24239. * This function is like
  24240. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  24241. * except that it includes inherited enumerable properties.
  24242. *
  24243. * @private
  24244. * @param {Object} object The object to query.
  24245. * @returns {Array} Returns the array of property names.
  24246. */
  24247. function nativeKeysIn(object) {
  24248. var result = [];
  24249. if (object != null) {
  24250. for (var key in Object(object)) {
  24251. result.push(key);
  24252. }
  24253. }
  24254. return result;
  24255. }
  24256. /**
  24257. * Converts `value` to a string using `Object.prototype.toString`.
  24258. *
  24259. * @private
  24260. * @param {*} value The value to convert.
  24261. * @returns {string} Returns the converted string.
  24262. */
  24263. function objectToString(value) {
  24264. return nativeObjectToString.call(value);
  24265. }
  24266. /**
  24267. * A specialized version of `baseRest` which transforms the rest array.
  24268. *
  24269. * @private
  24270. * @param {Function} func The function to apply a rest parameter to.
  24271. * @param {number} [start=func.length-1] The start position of the rest parameter.
  24272. * @param {Function} transform The rest array transform.
  24273. * @returns {Function} Returns the new function.
  24274. */
  24275. function overRest(func, start, transform) {
  24276. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  24277. return function() {
  24278. var args = arguments,
  24279. index = -1,
  24280. length = nativeMax(args.length - start, 0),
  24281. array = Array(length);
  24282. while (++index < length) {
  24283. array[index] = args[start + index];
  24284. }
  24285. index = -1;
  24286. var otherArgs = Array(start + 1);
  24287. while (++index < start) {
  24288. otherArgs[index] = args[index];
  24289. }
  24290. otherArgs[start] = transform(array);
  24291. return apply(func, this, otherArgs);
  24292. };
  24293. }
  24294. /**
  24295. * Gets the parent value at `path` of `object`.
  24296. *
  24297. * @private
  24298. * @param {Object} object The object to query.
  24299. * @param {Array} path The path to get the parent value of.
  24300. * @returns {*} Returns the parent value.
  24301. */
  24302. function parent(object, path) {
  24303. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  24304. }
  24305. /**
  24306. * Reorder `array` according to the specified indexes where the element at
  24307. * the first index is assigned as the first element, the element at
  24308. * the second index is assigned as the second element, and so on.
  24309. *
  24310. * @private
  24311. * @param {Array} array The array to reorder.
  24312. * @param {Array} indexes The arranged array indexes.
  24313. * @returns {Array} Returns `array`.
  24314. */
  24315. function reorder(array, indexes) {
  24316. var arrLength = array.length,
  24317. length = nativeMin(indexes.length, arrLength),
  24318. oldArray = copyArray(array);
  24319. while (length--) {
  24320. var index = indexes[length];
  24321. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  24322. }
  24323. return array;
  24324. }
  24325. /**
  24326. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  24327. *
  24328. * @private
  24329. * @param {Object} object The object to query.
  24330. * @param {string} key The key of the property to get.
  24331. * @returns {*} Returns the property value.
  24332. */
  24333. function safeGet(object, key) {
  24334. if (key === 'constructor' && typeof object[key] === 'function') {
  24335. return;
  24336. }
  24337. if (key == '__proto__') {
  24338. return;
  24339. }
  24340. return object[key];
  24341. }
  24342. /**
  24343. * Sets metadata for `func`.
  24344. *
  24345. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  24346. * period of time, it will trip its breaker and transition to an identity
  24347. * function to avoid garbage collection pauses in V8. See
  24348. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  24349. * for more details.
  24350. *
  24351. * @private
  24352. * @param {Function} func The function to associate metadata with.
  24353. * @param {*} data The metadata.
  24354. * @returns {Function} Returns `func`.
  24355. */
  24356. var setData = shortOut(baseSetData);
  24357. /**
  24358. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  24359. *
  24360. * @private
  24361. * @param {Function} func The function to delay.
  24362. * @param {number} wait The number of milliseconds to delay invocation.
  24363. * @returns {number|Object} Returns the timer id or timeout object.
  24364. */
  24365. var setTimeout = ctxSetTimeout || function(func, wait) {
  24366. return root.setTimeout(func, wait);
  24367. };
  24368. /**
  24369. * Sets the `toString` method of `func` to return `string`.
  24370. *
  24371. * @private
  24372. * @param {Function} func The function to modify.
  24373. * @param {Function} string The `toString` result.
  24374. * @returns {Function} Returns `func`.
  24375. */
  24376. var setToString = shortOut(baseSetToString);
  24377. /**
  24378. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  24379. * with wrapper details in a comment at the top of the source body.
  24380. *
  24381. * @private
  24382. * @param {Function} wrapper The function to modify.
  24383. * @param {Function} reference The reference function.
  24384. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24385. * @returns {Function} Returns `wrapper`.
  24386. */
  24387. function setWrapToString(wrapper, reference, bitmask) {
  24388. var source = (reference + '');
  24389. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  24390. }
  24391. /**
  24392. * Creates a function that'll short out and invoke `identity` instead
  24393. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  24394. * milliseconds.
  24395. *
  24396. * @private
  24397. * @param {Function} func The function to restrict.
  24398. * @returns {Function} Returns the new shortable function.
  24399. */
  24400. function shortOut(func) {
  24401. var count = 0,
  24402. lastCalled = 0;
  24403. return function() {
  24404. var stamp = nativeNow(),
  24405. remaining = HOT_SPAN - (stamp - lastCalled);
  24406. lastCalled = stamp;
  24407. if (remaining > 0) {
  24408. if (++count >= HOT_COUNT) {
  24409. return arguments[0];
  24410. }
  24411. } else {
  24412. count = 0;
  24413. }
  24414. return func.apply(undefined, arguments);
  24415. };
  24416. }
  24417. /**
  24418. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  24419. *
  24420. * @private
  24421. * @param {Array} array The array to shuffle.
  24422. * @param {number} [size=array.length] The size of `array`.
  24423. * @returns {Array} Returns `array`.
  24424. */
  24425. function shuffleSelf(array, size) {
  24426. var index = -1,
  24427. length = array.length,
  24428. lastIndex = length - 1;
  24429. size = size === undefined ? length : size;
  24430. while (++index < size) {
  24431. var rand = baseRandom(index, lastIndex),
  24432. value = array[rand];
  24433. array[rand] = array[index];
  24434. array[index] = value;
  24435. }
  24436. array.length = size;
  24437. return array;
  24438. }
  24439. /**
  24440. * Converts `string` to a property path array.
  24441. *
  24442. * @private
  24443. * @param {string} string The string to convert.
  24444. * @returns {Array} Returns the property path array.
  24445. */
  24446. var stringToPath = memoizeCapped(function(string) {
  24447. var result = [];
  24448. if (string.charCodeAt(0) === 46 /* . */) {
  24449. result.push('');
  24450. }
  24451. string.replace(rePropName, function(match, number, quote, subString) {
  24452. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  24453. });
  24454. return result;
  24455. });
  24456. /**
  24457. * Converts `value` to a string key if it's not a string or symbol.
  24458. *
  24459. * @private
  24460. * @param {*} value The value to inspect.
  24461. * @returns {string|symbol} Returns the key.
  24462. */
  24463. function toKey(value) {
  24464. if (typeof value == 'string' || isSymbol(value)) {
  24465. return value;
  24466. }
  24467. var result = (value + '');
  24468. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  24469. }
  24470. /**
  24471. * Converts `func` to its source code.
  24472. *
  24473. * @private
  24474. * @param {Function} func The function to convert.
  24475. * @returns {string} Returns the source code.
  24476. */
  24477. function toSource(func) {
  24478. if (func != null) {
  24479. try {
  24480. return funcToString.call(func);
  24481. } catch (e) {}
  24482. try {
  24483. return (func + '');
  24484. } catch (e) {}
  24485. }
  24486. return '';
  24487. }
  24488. /**
  24489. * Updates wrapper `details` based on `bitmask` flags.
  24490. *
  24491. * @private
  24492. * @returns {Array} details The details to modify.
  24493. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24494. * @returns {Array} Returns `details`.
  24495. */
  24496. function updateWrapDetails(details, bitmask) {
  24497. arrayEach(wrapFlags, function(pair) {
  24498. var value = '_.' + pair[0];
  24499. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  24500. details.push(value);
  24501. }
  24502. });
  24503. return details.sort();
  24504. }
  24505. /**
  24506. * Creates a clone of `wrapper`.
  24507. *
  24508. * @private
  24509. * @param {Object} wrapper The wrapper to clone.
  24510. * @returns {Object} Returns the cloned wrapper.
  24511. */
  24512. function wrapperClone(wrapper) {
  24513. if (wrapper instanceof LazyWrapper) {
  24514. return wrapper.clone();
  24515. }
  24516. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  24517. result.__actions__ = copyArray(wrapper.__actions__);
  24518. result.__index__ = wrapper.__index__;
  24519. result.__values__ = wrapper.__values__;
  24520. return result;
  24521. }
  24522. /*------------------------------------------------------------------------*/
  24523. /**
  24524. * Creates an array of elements split into groups the length of `size`.
  24525. * If `array` can't be split evenly, the final chunk will be the remaining
  24526. * elements.
  24527. *
  24528. * @static
  24529. * @memberOf _
  24530. * @since 3.0.0
  24531. * @category Array
  24532. * @param {Array} array The array to process.
  24533. * @param {number} [size=1] The length of each chunk
  24534. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24535. * @returns {Array} Returns the new array of chunks.
  24536. * @example
  24537. *
  24538. * _.chunk(['a', 'b', 'c', 'd'], 2);
  24539. * // => [['a', 'b'], ['c', 'd']]
  24540. *
  24541. * _.chunk(['a', 'b', 'c', 'd'], 3);
  24542. * // => [['a', 'b', 'c'], ['d']]
  24543. */
  24544. function chunk(array, size, guard) {
  24545. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  24546. size = 1;
  24547. } else {
  24548. size = nativeMax(toInteger(size), 0);
  24549. }
  24550. var length = array == null ? 0 : array.length;
  24551. if (!length || size < 1) {
  24552. return [];
  24553. }
  24554. var index = 0,
  24555. resIndex = 0,
  24556. result = Array(nativeCeil(length / size));
  24557. while (index < length) {
  24558. result[resIndex++] = baseSlice(array, index, (index += size));
  24559. }
  24560. return result;
  24561. }
  24562. /**
  24563. * Creates an array with all falsey values removed. The values `false`, `null`,
  24564. * `0`, `""`, `undefined`, and `NaN` are falsey.
  24565. *
  24566. * @static
  24567. * @memberOf _
  24568. * @since 0.1.0
  24569. * @category Array
  24570. * @param {Array} array The array to compact.
  24571. * @returns {Array} Returns the new array of filtered values.
  24572. * @example
  24573. *
  24574. * _.compact([0, 1, false, 2, '', 3]);
  24575. * // => [1, 2, 3]
  24576. */
  24577. function compact(array) {
  24578. var index = -1,
  24579. length = array == null ? 0 : array.length,
  24580. resIndex = 0,
  24581. result = [];
  24582. while (++index < length) {
  24583. var value = array[index];
  24584. if (value) {
  24585. result[resIndex++] = value;
  24586. }
  24587. }
  24588. return result;
  24589. }
  24590. /**
  24591. * Creates a new array concatenating `array` with any additional arrays
  24592. * and/or values.
  24593. *
  24594. * @static
  24595. * @memberOf _
  24596. * @since 4.0.0
  24597. * @category Array
  24598. * @param {Array} array The array to concatenate.
  24599. * @param {...*} [values] The values to concatenate.
  24600. * @returns {Array} Returns the new concatenated array.
  24601. * @example
  24602. *
  24603. * var array = [1];
  24604. * var other = _.concat(array, 2, [3], [[4]]);
  24605. *
  24606. * console.log(other);
  24607. * // => [1, 2, 3, [4]]
  24608. *
  24609. * console.log(array);
  24610. * // => [1]
  24611. */
  24612. function concat() {
  24613. var length = arguments.length;
  24614. if (!length) {
  24615. return [];
  24616. }
  24617. var args = Array(length - 1),
  24618. array = arguments[0],
  24619. index = length;
  24620. while (index--) {
  24621. args[index - 1] = arguments[index];
  24622. }
  24623. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  24624. }
  24625. /**
  24626. * Creates an array of `array` values not included in the other given arrays
  24627. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24628. * for equality comparisons. The order and references of result values are
  24629. * determined by the first array.
  24630. *
  24631. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  24632. *
  24633. * @static
  24634. * @memberOf _
  24635. * @since 0.1.0
  24636. * @category Array
  24637. * @param {Array} array The array to inspect.
  24638. * @param {...Array} [values] The values to exclude.
  24639. * @returns {Array} Returns the new array of filtered values.
  24640. * @see _.without, _.xor
  24641. * @example
  24642. *
  24643. * _.difference([2, 1], [2, 3]);
  24644. * // => [1]
  24645. */
  24646. var difference = baseRest(function(array, values) {
  24647. return isArrayLikeObject(array)
  24648. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  24649. : [];
  24650. });
  24651. /**
  24652. * This method is like `_.difference` except that it accepts `iteratee` which
  24653. * is invoked for each element of `array` and `values` to generate the criterion
  24654. * by which they're compared. The order and references of result values are
  24655. * determined by the first array. The iteratee is invoked with one argument:
  24656. * (value).
  24657. *
  24658. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  24659. *
  24660. * @static
  24661. * @memberOf _
  24662. * @since 4.0.0
  24663. * @category Array
  24664. * @param {Array} array The array to inspect.
  24665. * @param {...Array} [values] The values to exclude.
  24666. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24667. * @returns {Array} Returns the new array of filtered values.
  24668. * @example
  24669. *
  24670. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24671. * // => [1.2]
  24672. *
  24673. * // The `_.property` iteratee shorthand.
  24674. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  24675. * // => [{ 'x': 2 }]
  24676. */
  24677. var differenceBy = baseRest(function(array, values) {
  24678. var iteratee = last(values);
  24679. if (isArrayLikeObject(iteratee)) {
  24680. iteratee = undefined;
  24681. }
  24682. return isArrayLikeObject(array)
  24683. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  24684. : [];
  24685. });
  24686. /**
  24687. * This method is like `_.difference` except that it accepts `comparator`
  24688. * which is invoked to compare elements of `array` to `values`. The order and
  24689. * references of result values are determined by the first array. The comparator
  24690. * is invoked with two arguments: (arrVal, othVal).
  24691. *
  24692. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  24693. *
  24694. * @static
  24695. * @memberOf _
  24696. * @since 4.0.0
  24697. * @category Array
  24698. * @param {Array} array The array to inspect.
  24699. * @param {...Array} [values] The values to exclude.
  24700. * @param {Function} [comparator] The comparator invoked per element.
  24701. * @returns {Array} Returns the new array of filtered values.
  24702. * @example
  24703. *
  24704. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24705. *
  24706. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  24707. * // => [{ 'x': 2, 'y': 1 }]
  24708. */
  24709. var differenceWith = baseRest(function(array, values) {
  24710. var comparator = last(values);
  24711. if (isArrayLikeObject(comparator)) {
  24712. comparator = undefined;
  24713. }
  24714. return isArrayLikeObject(array)
  24715. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  24716. : [];
  24717. });
  24718. /**
  24719. * Creates a slice of `array` with `n` elements dropped from the beginning.
  24720. *
  24721. * @static
  24722. * @memberOf _
  24723. * @since 0.5.0
  24724. * @category Array
  24725. * @param {Array} array The array to query.
  24726. * @param {number} [n=1] The number of elements to drop.
  24727. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24728. * @returns {Array} Returns the slice of `array`.
  24729. * @example
  24730. *
  24731. * _.drop([1, 2, 3]);
  24732. * // => [2, 3]
  24733. *
  24734. * _.drop([1, 2, 3], 2);
  24735. * // => [3]
  24736. *
  24737. * _.drop([1, 2, 3], 5);
  24738. * // => []
  24739. *
  24740. * _.drop([1, 2, 3], 0);
  24741. * // => [1, 2, 3]
  24742. */
  24743. function drop(array, n, guard) {
  24744. var length = array == null ? 0 : array.length;
  24745. if (!length) {
  24746. return [];
  24747. }
  24748. n = (guard || n === undefined) ? 1 : toInteger(n);
  24749. return baseSlice(array, n < 0 ? 0 : n, length);
  24750. }
  24751. /**
  24752. * Creates a slice of `array` with `n` elements dropped from the end.
  24753. *
  24754. * @static
  24755. * @memberOf _
  24756. * @since 3.0.0
  24757. * @category Array
  24758. * @param {Array} array The array to query.
  24759. * @param {number} [n=1] The number of elements to drop.
  24760. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24761. * @returns {Array} Returns the slice of `array`.
  24762. * @example
  24763. *
  24764. * _.dropRight([1, 2, 3]);
  24765. * // => [1, 2]
  24766. *
  24767. * _.dropRight([1, 2, 3], 2);
  24768. * // => [1]
  24769. *
  24770. * _.dropRight([1, 2, 3], 5);
  24771. * // => []
  24772. *
  24773. * _.dropRight([1, 2, 3], 0);
  24774. * // => [1, 2, 3]
  24775. */
  24776. function dropRight(array, n, guard) {
  24777. var length = array == null ? 0 : array.length;
  24778. if (!length) {
  24779. return [];
  24780. }
  24781. n = (guard || n === undefined) ? 1 : toInteger(n);
  24782. n = length - n;
  24783. return baseSlice(array, 0, n < 0 ? 0 : n);
  24784. }
  24785. /**
  24786. * Creates a slice of `array` excluding elements dropped from the end.
  24787. * Elements are dropped until `predicate` returns falsey. The predicate is
  24788. * invoked with three arguments: (value, index, array).
  24789. *
  24790. * @static
  24791. * @memberOf _
  24792. * @since 3.0.0
  24793. * @category Array
  24794. * @param {Array} array The array to query.
  24795. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24796. * @returns {Array} Returns the slice of `array`.
  24797. * @example
  24798. *
  24799. * var users = [
  24800. * { 'user': 'barney', 'active': true },
  24801. * { 'user': 'fred', 'active': false },
  24802. * { 'user': 'pebbles', 'active': false }
  24803. * ];
  24804. *
  24805. * _.dropRightWhile(users, function(o) { return !o.active; });
  24806. * // => objects for ['barney']
  24807. *
  24808. * // The `_.matches` iteratee shorthand.
  24809. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  24810. * // => objects for ['barney', 'fred']
  24811. *
  24812. * // The `_.matchesProperty` iteratee shorthand.
  24813. * _.dropRightWhile(users, ['active', false]);
  24814. * // => objects for ['barney']
  24815. *
  24816. * // The `_.property` iteratee shorthand.
  24817. * _.dropRightWhile(users, 'active');
  24818. * // => objects for ['barney', 'fred', 'pebbles']
  24819. */
  24820. function dropRightWhile(array, predicate) {
  24821. return (array && array.length)
  24822. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  24823. : [];
  24824. }
  24825. /**
  24826. * Creates a slice of `array` excluding elements dropped from the beginning.
  24827. * Elements are dropped until `predicate` returns falsey. The predicate is
  24828. * invoked with three arguments: (value, index, array).
  24829. *
  24830. * @static
  24831. * @memberOf _
  24832. * @since 3.0.0
  24833. * @category Array
  24834. * @param {Array} array The array to query.
  24835. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24836. * @returns {Array} Returns the slice of `array`.
  24837. * @example
  24838. *
  24839. * var users = [
  24840. * { 'user': 'barney', 'active': false },
  24841. * { 'user': 'fred', 'active': false },
  24842. * { 'user': 'pebbles', 'active': true }
  24843. * ];
  24844. *
  24845. * _.dropWhile(users, function(o) { return !o.active; });
  24846. * // => objects for ['pebbles']
  24847. *
  24848. * // The `_.matches` iteratee shorthand.
  24849. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  24850. * // => objects for ['fred', 'pebbles']
  24851. *
  24852. * // The `_.matchesProperty` iteratee shorthand.
  24853. * _.dropWhile(users, ['active', false]);
  24854. * // => objects for ['pebbles']
  24855. *
  24856. * // The `_.property` iteratee shorthand.
  24857. * _.dropWhile(users, 'active');
  24858. * // => objects for ['barney', 'fred', 'pebbles']
  24859. */
  24860. function dropWhile(array, predicate) {
  24861. return (array && array.length)
  24862. ? baseWhile(array, getIteratee(predicate, 3), true)
  24863. : [];
  24864. }
  24865. /**
  24866. * Fills elements of `array` with `value` from `start` up to, but not
  24867. * including, `end`.
  24868. *
  24869. * **Note:** This method mutates `array`.
  24870. *
  24871. * @static
  24872. * @memberOf _
  24873. * @since 3.2.0
  24874. * @category Array
  24875. * @param {Array} array The array to fill.
  24876. * @param {*} value The value to fill `array` with.
  24877. * @param {number} [start=0] The start position.
  24878. * @param {number} [end=array.length] The end position.
  24879. * @returns {Array} Returns `array`.
  24880. * @example
  24881. *
  24882. * var array = [1, 2, 3];
  24883. *
  24884. * _.fill(array, 'a');
  24885. * console.log(array);
  24886. * // => ['a', 'a', 'a']
  24887. *
  24888. * _.fill(Array(3), 2);
  24889. * // => [2, 2, 2]
  24890. *
  24891. * _.fill([4, 6, 8, 10], '*', 1, 3);
  24892. * // => [4, '*', '*', 10]
  24893. */
  24894. function fill(array, value, start, end) {
  24895. var length = array == null ? 0 : array.length;
  24896. if (!length) {
  24897. return [];
  24898. }
  24899. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  24900. start = 0;
  24901. end = length;
  24902. }
  24903. return baseFill(array, value, start, end);
  24904. }
  24905. /**
  24906. * This method is like `_.find` except that it returns the index of the first
  24907. * element `predicate` returns truthy for instead of the element itself.
  24908. *
  24909. * @static
  24910. * @memberOf _
  24911. * @since 1.1.0
  24912. * @category Array
  24913. * @param {Array} array The array to inspect.
  24914. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24915. * @param {number} [fromIndex=0] The index to search from.
  24916. * @returns {number} Returns the index of the found element, else `-1`.
  24917. * @example
  24918. *
  24919. * var users = [
  24920. * { 'user': 'barney', 'active': false },
  24921. * { 'user': 'fred', 'active': false },
  24922. * { 'user': 'pebbles', 'active': true }
  24923. * ];
  24924. *
  24925. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  24926. * // => 0
  24927. *
  24928. * // The `_.matches` iteratee shorthand.
  24929. * _.findIndex(users, { 'user': 'fred', 'active': false });
  24930. * // => 1
  24931. *
  24932. * // The `_.matchesProperty` iteratee shorthand.
  24933. * _.findIndex(users, ['active', false]);
  24934. * // => 0
  24935. *
  24936. * // The `_.property` iteratee shorthand.
  24937. * _.findIndex(users, 'active');
  24938. * // => 2
  24939. */
  24940. function findIndex(array, predicate, fromIndex) {
  24941. var length = array == null ? 0 : array.length;
  24942. if (!length) {
  24943. return -1;
  24944. }
  24945. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  24946. if (index < 0) {
  24947. index = nativeMax(length + index, 0);
  24948. }
  24949. return baseFindIndex(array, getIteratee(predicate, 3), index);
  24950. }
  24951. /**
  24952. * This method is like `_.findIndex` except that it iterates over elements
  24953. * of `collection` from right to left.
  24954. *
  24955. * @static
  24956. * @memberOf _
  24957. * @since 2.0.0
  24958. * @category Array
  24959. * @param {Array} array The array to inspect.
  24960. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24961. * @param {number} [fromIndex=array.length-1] The index to search from.
  24962. * @returns {number} Returns the index of the found element, else `-1`.
  24963. * @example
  24964. *
  24965. * var users = [
  24966. * { 'user': 'barney', 'active': true },
  24967. * { 'user': 'fred', 'active': false },
  24968. * { 'user': 'pebbles', 'active': false }
  24969. * ];
  24970. *
  24971. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  24972. * // => 2
  24973. *
  24974. * // The `_.matches` iteratee shorthand.
  24975. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  24976. * // => 0
  24977. *
  24978. * // The `_.matchesProperty` iteratee shorthand.
  24979. * _.findLastIndex(users, ['active', false]);
  24980. * // => 2
  24981. *
  24982. * // The `_.property` iteratee shorthand.
  24983. * _.findLastIndex(users, 'active');
  24984. * // => 0
  24985. */
  24986. function findLastIndex(array, predicate, fromIndex) {
  24987. var length = array == null ? 0 : array.length;
  24988. if (!length) {
  24989. return -1;
  24990. }
  24991. var index = length - 1;
  24992. if (fromIndex !== undefined) {
  24993. index = toInteger(fromIndex);
  24994. index = fromIndex < 0
  24995. ? nativeMax(length + index, 0)
  24996. : nativeMin(index, length - 1);
  24997. }
  24998. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  24999. }
  25000. /**
  25001. * Flattens `array` a single level deep.
  25002. *
  25003. * @static
  25004. * @memberOf _
  25005. * @since 0.1.0
  25006. * @category Array
  25007. * @param {Array} array The array to flatten.
  25008. * @returns {Array} Returns the new flattened array.
  25009. * @example
  25010. *
  25011. * _.flatten([1, [2, [3, [4]], 5]]);
  25012. * // => [1, 2, [3, [4]], 5]
  25013. */
  25014. function flatten(array) {
  25015. var length = array == null ? 0 : array.length;
  25016. return length ? baseFlatten(array, 1) : [];
  25017. }
  25018. /**
  25019. * Recursively flattens `array`.
  25020. *
  25021. * @static
  25022. * @memberOf _
  25023. * @since 3.0.0
  25024. * @category Array
  25025. * @param {Array} array The array to flatten.
  25026. * @returns {Array} Returns the new flattened array.
  25027. * @example
  25028. *
  25029. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  25030. * // => [1, 2, 3, 4, 5]
  25031. */
  25032. function flattenDeep(array) {
  25033. var length = array == null ? 0 : array.length;
  25034. return length ? baseFlatten(array, INFINITY) : [];
  25035. }
  25036. /**
  25037. * Recursively flatten `array` up to `depth` times.
  25038. *
  25039. * @static
  25040. * @memberOf _
  25041. * @since 4.4.0
  25042. * @category Array
  25043. * @param {Array} array The array to flatten.
  25044. * @param {number} [depth=1] The maximum recursion depth.
  25045. * @returns {Array} Returns the new flattened array.
  25046. * @example
  25047. *
  25048. * var array = [1, [2, [3, [4]], 5]];
  25049. *
  25050. * _.flattenDepth(array, 1);
  25051. * // => [1, 2, [3, [4]], 5]
  25052. *
  25053. * _.flattenDepth(array, 2);
  25054. * // => [1, 2, 3, [4], 5]
  25055. */
  25056. function flattenDepth(array, depth) {
  25057. var length = array == null ? 0 : array.length;
  25058. if (!length) {
  25059. return [];
  25060. }
  25061. depth = depth === undefined ? 1 : toInteger(depth);
  25062. return baseFlatten(array, depth);
  25063. }
  25064. /**
  25065. * The inverse of `_.toPairs`; this method returns an object composed
  25066. * from key-value `pairs`.
  25067. *
  25068. * @static
  25069. * @memberOf _
  25070. * @since 4.0.0
  25071. * @category Array
  25072. * @param {Array} pairs The key-value pairs.
  25073. * @returns {Object} Returns the new object.
  25074. * @example
  25075. *
  25076. * _.fromPairs([['a', 1], ['b', 2]]);
  25077. * // => { 'a': 1, 'b': 2 }
  25078. */
  25079. function fromPairs(pairs) {
  25080. var index = -1,
  25081. length = pairs == null ? 0 : pairs.length,
  25082. result = {};
  25083. while (++index < length) {
  25084. var pair = pairs[index];
  25085. result[pair[0]] = pair[1];
  25086. }
  25087. return result;
  25088. }
  25089. /**
  25090. * Gets the first element of `array`.
  25091. *
  25092. * @static
  25093. * @memberOf _
  25094. * @since 0.1.0
  25095. * @alias first
  25096. * @category Array
  25097. * @param {Array} array The array to query.
  25098. * @returns {*} Returns the first element of `array`.
  25099. * @example
  25100. *
  25101. * _.head([1, 2, 3]);
  25102. * // => 1
  25103. *
  25104. * _.head([]);
  25105. * // => undefined
  25106. */
  25107. function head(array) {
  25108. return (array && array.length) ? array[0] : undefined;
  25109. }
  25110. /**
  25111. * Gets the index at which the first occurrence of `value` is found in `array`
  25112. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25113. * for equality comparisons. If `fromIndex` is negative, it's used as the
  25114. * offset from the end of `array`.
  25115. *
  25116. * @static
  25117. * @memberOf _
  25118. * @since 0.1.0
  25119. * @category Array
  25120. * @param {Array} array The array to inspect.
  25121. * @param {*} value The value to search for.
  25122. * @param {number} [fromIndex=0] The index to search from.
  25123. * @returns {number} Returns the index of the matched value, else `-1`.
  25124. * @example
  25125. *
  25126. * _.indexOf([1, 2, 1, 2], 2);
  25127. * // => 1
  25128. *
  25129. * // Search from the `fromIndex`.
  25130. * _.indexOf([1, 2, 1, 2], 2, 2);
  25131. * // => 3
  25132. */
  25133. function indexOf(array, value, fromIndex) {
  25134. var length = array == null ? 0 : array.length;
  25135. if (!length) {
  25136. return -1;
  25137. }
  25138. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25139. if (index < 0) {
  25140. index = nativeMax(length + index, 0);
  25141. }
  25142. return baseIndexOf(array, value, index);
  25143. }
  25144. /**
  25145. * Gets all but the last element of `array`.
  25146. *
  25147. * @static
  25148. * @memberOf _
  25149. * @since 0.1.0
  25150. * @category Array
  25151. * @param {Array} array The array to query.
  25152. * @returns {Array} Returns the slice of `array`.
  25153. * @example
  25154. *
  25155. * _.initial([1, 2, 3]);
  25156. * // => [1, 2]
  25157. */
  25158. function initial(array) {
  25159. var length = array == null ? 0 : array.length;
  25160. return length ? baseSlice(array, 0, -1) : [];
  25161. }
  25162. /**
  25163. * Creates an array of unique values that are included in all given arrays
  25164. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25165. * for equality comparisons. The order and references of result values are
  25166. * determined by the first array.
  25167. *
  25168. * @static
  25169. * @memberOf _
  25170. * @since 0.1.0
  25171. * @category Array
  25172. * @param {...Array} [arrays] The arrays to inspect.
  25173. * @returns {Array} Returns the new array of intersecting values.
  25174. * @example
  25175. *
  25176. * _.intersection([2, 1], [2, 3]);
  25177. * // => [2]
  25178. */
  25179. var intersection = baseRest(function(arrays) {
  25180. var mapped = arrayMap(arrays, castArrayLikeObject);
  25181. return (mapped.length && mapped[0] === arrays[0])
  25182. ? baseIntersection(mapped)
  25183. : [];
  25184. });
  25185. /**
  25186. * This method is like `_.intersection` except that it accepts `iteratee`
  25187. * which is invoked for each element of each `arrays` to generate the criterion
  25188. * by which they're compared. The order and references of result values are
  25189. * determined by the first array. The iteratee is invoked with one argument:
  25190. * (value).
  25191. *
  25192. * @static
  25193. * @memberOf _
  25194. * @since 4.0.0
  25195. * @category Array
  25196. * @param {...Array} [arrays] The arrays to inspect.
  25197. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25198. * @returns {Array} Returns the new array of intersecting values.
  25199. * @example
  25200. *
  25201. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25202. * // => [2.1]
  25203. *
  25204. * // The `_.property` iteratee shorthand.
  25205. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25206. * // => [{ 'x': 1 }]
  25207. */
  25208. var intersectionBy = baseRest(function(arrays) {
  25209. var iteratee = last(arrays),
  25210. mapped = arrayMap(arrays, castArrayLikeObject);
  25211. if (iteratee === last(mapped)) {
  25212. iteratee = undefined;
  25213. } else {
  25214. mapped.pop();
  25215. }
  25216. return (mapped.length && mapped[0] === arrays[0])
  25217. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  25218. : [];
  25219. });
  25220. /**
  25221. * This method is like `_.intersection` except that it accepts `comparator`
  25222. * which is invoked to compare elements of `arrays`. The order and references
  25223. * of result values are determined by the first array. The comparator is
  25224. * invoked with two arguments: (arrVal, othVal).
  25225. *
  25226. * @static
  25227. * @memberOf _
  25228. * @since 4.0.0
  25229. * @category Array
  25230. * @param {...Array} [arrays] The arrays to inspect.
  25231. * @param {Function} [comparator] The comparator invoked per element.
  25232. * @returns {Array} Returns the new array of intersecting values.
  25233. * @example
  25234. *
  25235. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25236. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25237. *
  25238. * _.intersectionWith(objects, others, _.isEqual);
  25239. * // => [{ 'x': 1, 'y': 2 }]
  25240. */
  25241. var intersectionWith = baseRest(function(arrays) {
  25242. var comparator = last(arrays),
  25243. mapped = arrayMap(arrays, castArrayLikeObject);
  25244. comparator = typeof comparator == 'function' ? comparator : undefined;
  25245. if (comparator) {
  25246. mapped.pop();
  25247. }
  25248. return (mapped.length && mapped[0] === arrays[0])
  25249. ? baseIntersection(mapped, undefined, comparator)
  25250. : [];
  25251. });
  25252. /**
  25253. * Converts all elements in `array` into a string separated by `separator`.
  25254. *
  25255. * @static
  25256. * @memberOf _
  25257. * @since 4.0.0
  25258. * @category Array
  25259. * @param {Array} array The array to convert.
  25260. * @param {string} [separator=','] The element separator.
  25261. * @returns {string} Returns the joined string.
  25262. * @example
  25263. *
  25264. * _.join(['a', 'b', 'c'], '~');
  25265. * // => 'a~b~c'
  25266. */
  25267. function join(array, separator) {
  25268. return array == null ? '' : nativeJoin.call(array, separator);
  25269. }
  25270. /**
  25271. * Gets the last element of `array`.
  25272. *
  25273. * @static
  25274. * @memberOf _
  25275. * @since 0.1.0
  25276. * @category Array
  25277. * @param {Array} array The array to query.
  25278. * @returns {*} Returns the last element of `array`.
  25279. * @example
  25280. *
  25281. * _.last([1, 2, 3]);
  25282. * // => 3
  25283. */
  25284. function last(array) {
  25285. var length = array == null ? 0 : array.length;
  25286. return length ? array[length - 1] : undefined;
  25287. }
  25288. /**
  25289. * This method is like `_.indexOf` except that it iterates over elements of
  25290. * `array` from right to left.
  25291. *
  25292. * @static
  25293. * @memberOf _
  25294. * @since 0.1.0
  25295. * @category Array
  25296. * @param {Array} array The array to inspect.
  25297. * @param {*} value The value to search for.
  25298. * @param {number} [fromIndex=array.length-1] The index to search from.
  25299. * @returns {number} Returns the index of the matched value, else `-1`.
  25300. * @example
  25301. *
  25302. * _.lastIndexOf([1, 2, 1, 2], 2);
  25303. * // => 3
  25304. *
  25305. * // Search from the `fromIndex`.
  25306. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  25307. * // => 1
  25308. */
  25309. function lastIndexOf(array, value, fromIndex) {
  25310. var length = array == null ? 0 : array.length;
  25311. if (!length) {
  25312. return -1;
  25313. }
  25314. var index = length;
  25315. if (fromIndex !== undefined) {
  25316. index = toInteger(fromIndex);
  25317. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  25318. }
  25319. return value === value
  25320. ? strictLastIndexOf(array, value, index)
  25321. : baseFindIndex(array, baseIsNaN, index, true);
  25322. }
  25323. /**
  25324. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  25325. * element from the end is returned.
  25326. *
  25327. * @static
  25328. * @memberOf _
  25329. * @since 4.11.0
  25330. * @category Array
  25331. * @param {Array} array The array to query.
  25332. * @param {number} [n=0] The index of the element to return.
  25333. * @returns {*} Returns the nth element of `array`.
  25334. * @example
  25335. *
  25336. * var array = ['a', 'b', 'c', 'd'];
  25337. *
  25338. * _.nth(array, 1);
  25339. * // => 'b'
  25340. *
  25341. * _.nth(array, -2);
  25342. * // => 'c';
  25343. */
  25344. function nth(array, n) {
  25345. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  25346. }
  25347. /**
  25348. * Removes all given values from `array` using
  25349. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25350. * for equality comparisons.
  25351. *
  25352. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  25353. * to remove elements from an array by predicate.
  25354. *
  25355. * @static
  25356. * @memberOf _
  25357. * @since 2.0.0
  25358. * @category Array
  25359. * @param {Array} array The array to modify.
  25360. * @param {...*} [values] The values to remove.
  25361. * @returns {Array} Returns `array`.
  25362. * @example
  25363. *
  25364. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25365. *
  25366. * _.pull(array, 'a', 'c');
  25367. * console.log(array);
  25368. * // => ['b', 'b']
  25369. */
  25370. var pull = baseRest(pullAll);
  25371. /**
  25372. * This method is like `_.pull` except that it accepts an array of values to remove.
  25373. *
  25374. * **Note:** Unlike `_.difference`, this method mutates `array`.
  25375. *
  25376. * @static
  25377. * @memberOf _
  25378. * @since 4.0.0
  25379. * @category Array
  25380. * @param {Array} array The array to modify.
  25381. * @param {Array} values The values to remove.
  25382. * @returns {Array} Returns `array`.
  25383. * @example
  25384. *
  25385. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25386. *
  25387. * _.pullAll(array, ['a', 'c']);
  25388. * console.log(array);
  25389. * // => ['b', 'b']
  25390. */
  25391. function pullAll(array, values) {
  25392. return (array && array.length && values && values.length)
  25393. ? basePullAll(array, values)
  25394. : array;
  25395. }
  25396. /**
  25397. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  25398. * invoked for each element of `array` and `values` to generate the criterion
  25399. * by which they're compared. The iteratee is invoked with one argument: (value).
  25400. *
  25401. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  25402. *
  25403. * @static
  25404. * @memberOf _
  25405. * @since 4.0.0
  25406. * @category Array
  25407. * @param {Array} array The array to modify.
  25408. * @param {Array} values The values to remove.
  25409. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25410. * @returns {Array} Returns `array`.
  25411. * @example
  25412. *
  25413. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  25414. *
  25415. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  25416. * console.log(array);
  25417. * // => [{ 'x': 2 }]
  25418. */
  25419. function pullAllBy(array, values, iteratee) {
  25420. return (array && array.length && values && values.length)
  25421. ? basePullAll(array, values, getIteratee(iteratee, 2))
  25422. : array;
  25423. }
  25424. /**
  25425. * This method is like `_.pullAll` except that it accepts `comparator` which
  25426. * is invoked to compare elements of `array` to `values`. The comparator is
  25427. * invoked with two arguments: (arrVal, othVal).
  25428. *
  25429. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  25430. *
  25431. * @static
  25432. * @memberOf _
  25433. * @since 4.6.0
  25434. * @category Array
  25435. * @param {Array} array The array to modify.
  25436. * @param {Array} values The values to remove.
  25437. * @param {Function} [comparator] The comparator invoked per element.
  25438. * @returns {Array} Returns `array`.
  25439. * @example
  25440. *
  25441. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  25442. *
  25443. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  25444. * console.log(array);
  25445. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  25446. */
  25447. function pullAllWith(array, values, comparator) {
  25448. return (array && array.length && values && values.length)
  25449. ? basePullAll(array, values, undefined, comparator)
  25450. : array;
  25451. }
  25452. /**
  25453. * Removes elements from `array` corresponding to `indexes` and returns an
  25454. * array of removed elements.
  25455. *
  25456. * **Note:** Unlike `_.at`, this method mutates `array`.
  25457. *
  25458. * @static
  25459. * @memberOf _
  25460. * @since 3.0.0
  25461. * @category Array
  25462. * @param {Array} array The array to modify.
  25463. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  25464. * @returns {Array} Returns the new array of removed elements.
  25465. * @example
  25466. *
  25467. * var array = ['a', 'b', 'c', 'd'];
  25468. * var pulled = _.pullAt(array, [1, 3]);
  25469. *
  25470. * console.log(array);
  25471. * // => ['a', 'c']
  25472. *
  25473. * console.log(pulled);
  25474. * // => ['b', 'd']
  25475. */
  25476. var pullAt = flatRest(function(array, indexes) {
  25477. var length = array == null ? 0 : array.length,
  25478. result = baseAt(array, indexes);
  25479. basePullAt(array, arrayMap(indexes, function(index) {
  25480. return isIndex(index, length) ? +index : index;
  25481. }).sort(compareAscending));
  25482. return result;
  25483. });
  25484. /**
  25485. * Removes all elements from `array` that `predicate` returns truthy for
  25486. * and returns an array of the removed elements. The predicate is invoked
  25487. * with three arguments: (value, index, array).
  25488. *
  25489. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  25490. * to pull elements from an array by value.
  25491. *
  25492. * @static
  25493. * @memberOf _
  25494. * @since 2.0.0
  25495. * @category Array
  25496. * @param {Array} array The array to modify.
  25497. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25498. * @returns {Array} Returns the new array of removed elements.
  25499. * @example
  25500. *
  25501. * var array = [1, 2, 3, 4];
  25502. * var evens = _.remove(array, function(n) {
  25503. * return n % 2 == 0;
  25504. * });
  25505. *
  25506. * console.log(array);
  25507. * // => [1, 3]
  25508. *
  25509. * console.log(evens);
  25510. * // => [2, 4]
  25511. */
  25512. function remove(array, predicate) {
  25513. var result = [];
  25514. if (!(array && array.length)) {
  25515. return result;
  25516. }
  25517. var index = -1,
  25518. indexes = [],
  25519. length = array.length;
  25520. predicate = getIteratee(predicate, 3);
  25521. while (++index < length) {
  25522. var value = array[index];
  25523. if (predicate(value, index, array)) {
  25524. result.push(value);
  25525. indexes.push(index);
  25526. }
  25527. }
  25528. basePullAt(array, indexes);
  25529. return result;
  25530. }
  25531. /**
  25532. * Reverses `array` so that the first element becomes the last, the second
  25533. * element becomes the second to last, and so on.
  25534. *
  25535. * **Note:** This method mutates `array` and is based on
  25536. * [`Array#reverse`](https://mdn.io/Array/reverse).
  25537. *
  25538. * @static
  25539. * @memberOf _
  25540. * @since 4.0.0
  25541. * @category Array
  25542. * @param {Array} array The array to modify.
  25543. * @returns {Array} Returns `array`.
  25544. * @example
  25545. *
  25546. * var array = [1, 2, 3];
  25547. *
  25548. * _.reverse(array);
  25549. * // => [3, 2, 1]
  25550. *
  25551. * console.log(array);
  25552. * // => [3, 2, 1]
  25553. */
  25554. function reverse(array) {
  25555. return array == null ? array : nativeReverse.call(array);
  25556. }
  25557. /**
  25558. * Creates a slice of `array` from `start` up to, but not including, `end`.
  25559. *
  25560. * **Note:** This method is used instead of
  25561. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  25562. * returned.
  25563. *
  25564. * @static
  25565. * @memberOf _
  25566. * @since 3.0.0
  25567. * @category Array
  25568. * @param {Array} array The array to slice.
  25569. * @param {number} [start=0] The start position.
  25570. * @param {number} [end=array.length] The end position.
  25571. * @returns {Array} Returns the slice of `array`.
  25572. */
  25573. function slice(array, start, end) {
  25574. var length = array == null ? 0 : array.length;
  25575. if (!length) {
  25576. return [];
  25577. }
  25578. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  25579. start = 0;
  25580. end = length;
  25581. }
  25582. else {
  25583. start = start == null ? 0 : toInteger(start);
  25584. end = end === undefined ? length : toInteger(end);
  25585. }
  25586. return baseSlice(array, start, end);
  25587. }
  25588. /**
  25589. * Uses a binary search to determine the lowest index at which `value`
  25590. * should be inserted into `array` in order to maintain its sort order.
  25591. *
  25592. * @static
  25593. * @memberOf _
  25594. * @since 0.1.0
  25595. * @category Array
  25596. * @param {Array} array The sorted array to inspect.
  25597. * @param {*} value The value to evaluate.
  25598. * @returns {number} Returns the index at which `value` should be inserted
  25599. * into `array`.
  25600. * @example
  25601. *
  25602. * _.sortedIndex([30, 50], 40);
  25603. * // => 1
  25604. */
  25605. function sortedIndex(array, value) {
  25606. return baseSortedIndex(array, value);
  25607. }
  25608. /**
  25609. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  25610. * which is invoked for `value` and each element of `array` to compute their
  25611. * sort ranking. The iteratee is invoked with one argument: (value).
  25612. *
  25613. * @static
  25614. * @memberOf _
  25615. * @since 4.0.0
  25616. * @category Array
  25617. * @param {Array} array The sorted array to inspect.
  25618. * @param {*} value The value to evaluate.
  25619. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25620. * @returns {number} Returns the index at which `value` should be inserted
  25621. * into `array`.
  25622. * @example
  25623. *
  25624. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25625. *
  25626. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25627. * // => 0
  25628. *
  25629. * // The `_.property` iteratee shorthand.
  25630. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  25631. * // => 0
  25632. */
  25633. function sortedIndexBy(array, value, iteratee) {
  25634. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  25635. }
  25636. /**
  25637. * This method is like `_.indexOf` except that it performs a binary
  25638. * search on a sorted `array`.
  25639. *
  25640. * @static
  25641. * @memberOf _
  25642. * @since 4.0.0
  25643. * @category Array
  25644. * @param {Array} array The array to inspect.
  25645. * @param {*} value The value to search for.
  25646. * @returns {number} Returns the index of the matched value, else `-1`.
  25647. * @example
  25648. *
  25649. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  25650. * // => 1
  25651. */
  25652. function sortedIndexOf(array, value) {
  25653. var length = array == null ? 0 : array.length;
  25654. if (length) {
  25655. var index = baseSortedIndex(array, value);
  25656. if (index < length && eq(array[index], value)) {
  25657. return index;
  25658. }
  25659. }
  25660. return -1;
  25661. }
  25662. /**
  25663. * This method is like `_.sortedIndex` except that it returns the highest
  25664. * index at which `value` should be inserted into `array` in order to
  25665. * maintain its sort order.
  25666. *
  25667. * @static
  25668. * @memberOf _
  25669. * @since 3.0.0
  25670. * @category Array
  25671. * @param {Array} array The sorted array to inspect.
  25672. * @param {*} value The value to evaluate.
  25673. * @returns {number} Returns the index at which `value` should be inserted
  25674. * into `array`.
  25675. * @example
  25676. *
  25677. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  25678. * // => 4
  25679. */
  25680. function sortedLastIndex(array, value) {
  25681. return baseSortedIndex(array, value, true);
  25682. }
  25683. /**
  25684. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  25685. * which is invoked for `value` and each element of `array` to compute their
  25686. * sort ranking. The iteratee is invoked with one argument: (value).
  25687. *
  25688. * @static
  25689. * @memberOf _
  25690. * @since 4.0.0
  25691. * @category Array
  25692. * @param {Array} array The sorted array to inspect.
  25693. * @param {*} value The value to evaluate.
  25694. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25695. * @returns {number} Returns the index at which `value` should be inserted
  25696. * into `array`.
  25697. * @example
  25698. *
  25699. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25700. *
  25701. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25702. * // => 1
  25703. *
  25704. * // The `_.property` iteratee shorthand.
  25705. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  25706. * // => 1
  25707. */
  25708. function sortedLastIndexBy(array, value, iteratee) {
  25709. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  25710. }
  25711. /**
  25712. * This method is like `_.lastIndexOf` except that it performs a binary
  25713. * search on a sorted `array`.
  25714. *
  25715. * @static
  25716. * @memberOf _
  25717. * @since 4.0.0
  25718. * @category Array
  25719. * @param {Array} array The array to inspect.
  25720. * @param {*} value The value to search for.
  25721. * @returns {number} Returns the index of the matched value, else `-1`.
  25722. * @example
  25723. *
  25724. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  25725. * // => 3
  25726. */
  25727. function sortedLastIndexOf(array, value) {
  25728. var length = array == null ? 0 : array.length;
  25729. if (length) {
  25730. var index = baseSortedIndex(array, value, true) - 1;
  25731. if (eq(array[index], value)) {
  25732. return index;
  25733. }
  25734. }
  25735. return -1;
  25736. }
  25737. /**
  25738. * This method is like `_.uniq` except that it's designed and optimized
  25739. * for sorted arrays.
  25740. *
  25741. * @static
  25742. * @memberOf _
  25743. * @since 4.0.0
  25744. * @category Array
  25745. * @param {Array} array The array to inspect.
  25746. * @returns {Array} Returns the new duplicate free array.
  25747. * @example
  25748. *
  25749. * _.sortedUniq([1, 1, 2]);
  25750. * // => [1, 2]
  25751. */
  25752. function sortedUniq(array) {
  25753. return (array && array.length)
  25754. ? baseSortedUniq(array)
  25755. : [];
  25756. }
  25757. /**
  25758. * This method is like `_.uniqBy` except that it's designed and optimized
  25759. * for sorted arrays.
  25760. *
  25761. * @static
  25762. * @memberOf _
  25763. * @since 4.0.0
  25764. * @category Array
  25765. * @param {Array} array The array to inspect.
  25766. * @param {Function} [iteratee] The iteratee invoked per element.
  25767. * @returns {Array} Returns the new duplicate free array.
  25768. * @example
  25769. *
  25770. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  25771. * // => [1.1, 2.3]
  25772. */
  25773. function sortedUniqBy(array, iteratee) {
  25774. return (array && array.length)
  25775. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  25776. : [];
  25777. }
  25778. /**
  25779. * Gets all but the first element of `array`.
  25780. *
  25781. * @static
  25782. * @memberOf _
  25783. * @since 4.0.0
  25784. * @category Array
  25785. * @param {Array} array The array to query.
  25786. * @returns {Array} Returns the slice of `array`.
  25787. * @example
  25788. *
  25789. * _.tail([1, 2, 3]);
  25790. * // => [2, 3]
  25791. */
  25792. function tail(array) {
  25793. var length = array == null ? 0 : array.length;
  25794. return length ? baseSlice(array, 1, length) : [];
  25795. }
  25796. /**
  25797. * Creates a slice of `array` with `n` elements taken from the beginning.
  25798. *
  25799. * @static
  25800. * @memberOf _
  25801. * @since 0.1.0
  25802. * @category Array
  25803. * @param {Array} array The array to query.
  25804. * @param {number} [n=1] The number of elements to take.
  25805. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25806. * @returns {Array} Returns the slice of `array`.
  25807. * @example
  25808. *
  25809. * _.take([1, 2, 3]);
  25810. * // => [1]
  25811. *
  25812. * _.take([1, 2, 3], 2);
  25813. * // => [1, 2]
  25814. *
  25815. * _.take([1, 2, 3], 5);
  25816. * // => [1, 2, 3]
  25817. *
  25818. * _.take([1, 2, 3], 0);
  25819. * // => []
  25820. */
  25821. function take(array, n, guard) {
  25822. if (!(array && array.length)) {
  25823. return [];
  25824. }
  25825. n = (guard || n === undefined) ? 1 : toInteger(n);
  25826. return baseSlice(array, 0, n < 0 ? 0 : n);
  25827. }
  25828. /**
  25829. * Creates a slice of `array` with `n` elements taken from the end.
  25830. *
  25831. * @static
  25832. * @memberOf _
  25833. * @since 3.0.0
  25834. * @category Array
  25835. * @param {Array} array The array to query.
  25836. * @param {number} [n=1] The number of elements to take.
  25837. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25838. * @returns {Array} Returns the slice of `array`.
  25839. * @example
  25840. *
  25841. * _.takeRight([1, 2, 3]);
  25842. * // => [3]
  25843. *
  25844. * _.takeRight([1, 2, 3], 2);
  25845. * // => [2, 3]
  25846. *
  25847. * _.takeRight([1, 2, 3], 5);
  25848. * // => [1, 2, 3]
  25849. *
  25850. * _.takeRight([1, 2, 3], 0);
  25851. * // => []
  25852. */
  25853. function takeRight(array, n, guard) {
  25854. var length = array == null ? 0 : array.length;
  25855. if (!length) {
  25856. return [];
  25857. }
  25858. n = (guard || n === undefined) ? 1 : toInteger(n);
  25859. n = length - n;
  25860. return baseSlice(array, n < 0 ? 0 : n, length);
  25861. }
  25862. /**
  25863. * Creates a slice of `array` with elements taken from the end. Elements are
  25864. * taken until `predicate` returns falsey. The predicate is invoked with
  25865. * three arguments: (value, index, array).
  25866. *
  25867. * @static
  25868. * @memberOf _
  25869. * @since 3.0.0
  25870. * @category Array
  25871. * @param {Array} array The array to query.
  25872. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25873. * @returns {Array} Returns the slice of `array`.
  25874. * @example
  25875. *
  25876. * var users = [
  25877. * { 'user': 'barney', 'active': true },
  25878. * { 'user': 'fred', 'active': false },
  25879. * { 'user': 'pebbles', 'active': false }
  25880. * ];
  25881. *
  25882. * _.takeRightWhile(users, function(o) { return !o.active; });
  25883. * // => objects for ['fred', 'pebbles']
  25884. *
  25885. * // The `_.matches` iteratee shorthand.
  25886. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  25887. * // => objects for ['pebbles']
  25888. *
  25889. * // The `_.matchesProperty` iteratee shorthand.
  25890. * _.takeRightWhile(users, ['active', false]);
  25891. * // => objects for ['fred', 'pebbles']
  25892. *
  25893. * // The `_.property` iteratee shorthand.
  25894. * _.takeRightWhile(users, 'active');
  25895. * // => []
  25896. */
  25897. function takeRightWhile(array, predicate) {
  25898. return (array && array.length)
  25899. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  25900. : [];
  25901. }
  25902. /**
  25903. * Creates a slice of `array` with elements taken from the beginning. Elements
  25904. * are taken until `predicate` returns falsey. The predicate is invoked with
  25905. * three arguments: (value, index, array).
  25906. *
  25907. * @static
  25908. * @memberOf _
  25909. * @since 3.0.0
  25910. * @category Array
  25911. * @param {Array} array The array to query.
  25912. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25913. * @returns {Array} Returns the slice of `array`.
  25914. * @example
  25915. *
  25916. * var users = [
  25917. * { 'user': 'barney', 'active': false },
  25918. * { 'user': 'fred', 'active': false },
  25919. * { 'user': 'pebbles', 'active': true }
  25920. * ];
  25921. *
  25922. * _.takeWhile(users, function(o) { return !o.active; });
  25923. * // => objects for ['barney', 'fred']
  25924. *
  25925. * // The `_.matches` iteratee shorthand.
  25926. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  25927. * // => objects for ['barney']
  25928. *
  25929. * // The `_.matchesProperty` iteratee shorthand.
  25930. * _.takeWhile(users, ['active', false]);
  25931. * // => objects for ['barney', 'fred']
  25932. *
  25933. * // The `_.property` iteratee shorthand.
  25934. * _.takeWhile(users, 'active');
  25935. * // => []
  25936. */
  25937. function takeWhile(array, predicate) {
  25938. return (array && array.length)
  25939. ? baseWhile(array, getIteratee(predicate, 3))
  25940. : [];
  25941. }
  25942. /**
  25943. * Creates an array of unique values, in order, from all given arrays using
  25944. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25945. * for equality comparisons.
  25946. *
  25947. * @static
  25948. * @memberOf _
  25949. * @since 0.1.0
  25950. * @category Array
  25951. * @param {...Array} [arrays] The arrays to inspect.
  25952. * @returns {Array} Returns the new array of combined values.
  25953. * @example
  25954. *
  25955. * _.union([2], [1, 2]);
  25956. * // => [2, 1]
  25957. */
  25958. var union = baseRest(function(arrays) {
  25959. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  25960. });
  25961. /**
  25962. * This method is like `_.union` except that it accepts `iteratee` which is
  25963. * invoked for each element of each `arrays` to generate the criterion by
  25964. * which uniqueness is computed. Result values are chosen from the first
  25965. * array in which the value occurs. The iteratee is invoked with one argument:
  25966. * (value).
  25967. *
  25968. * @static
  25969. * @memberOf _
  25970. * @since 4.0.0
  25971. * @category Array
  25972. * @param {...Array} [arrays] The arrays to inspect.
  25973. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25974. * @returns {Array} Returns the new array of combined values.
  25975. * @example
  25976. *
  25977. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  25978. * // => [2.1, 1.2]
  25979. *
  25980. * // The `_.property` iteratee shorthand.
  25981. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25982. * // => [{ 'x': 1 }, { 'x': 2 }]
  25983. */
  25984. var unionBy = baseRest(function(arrays) {
  25985. var iteratee = last(arrays);
  25986. if (isArrayLikeObject(iteratee)) {
  25987. iteratee = undefined;
  25988. }
  25989. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  25990. });
  25991. /**
  25992. * This method is like `_.union` except that it accepts `comparator` which
  25993. * is invoked to compare elements of `arrays`. Result values are chosen from
  25994. * the first array in which the value occurs. The comparator is invoked
  25995. * with two arguments: (arrVal, othVal).
  25996. *
  25997. * @static
  25998. * @memberOf _
  25999. * @since 4.0.0
  26000. * @category Array
  26001. * @param {...Array} [arrays] The arrays to inspect.
  26002. * @param {Function} [comparator] The comparator invoked per element.
  26003. * @returns {Array} Returns the new array of combined values.
  26004. * @example
  26005. *
  26006. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26007. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26008. *
  26009. * _.unionWith(objects, others, _.isEqual);
  26010. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26011. */
  26012. var unionWith = baseRest(function(arrays) {
  26013. var comparator = last(arrays);
  26014. comparator = typeof comparator == 'function' ? comparator : undefined;
  26015. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  26016. });
  26017. /**
  26018. * Creates a duplicate-free version of an array, using
  26019. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26020. * for equality comparisons, in which only the first occurrence of each element
  26021. * is kept. The order of result values is determined by the order they occur
  26022. * in the array.
  26023. *
  26024. * @static
  26025. * @memberOf _
  26026. * @since 0.1.0
  26027. * @category Array
  26028. * @param {Array} array The array to inspect.
  26029. * @returns {Array} Returns the new duplicate free array.
  26030. * @example
  26031. *
  26032. * _.uniq([2, 1, 2]);
  26033. * // => [2, 1]
  26034. */
  26035. function uniq(array) {
  26036. return (array && array.length) ? baseUniq(array) : [];
  26037. }
  26038. /**
  26039. * This method is like `_.uniq` except that it accepts `iteratee` which is
  26040. * invoked for each element in `array` to generate the criterion by which
  26041. * uniqueness is computed. The order of result values is determined by the
  26042. * order they occur in the array. The iteratee is invoked with one argument:
  26043. * (value).
  26044. *
  26045. * @static
  26046. * @memberOf _
  26047. * @since 4.0.0
  26048. * @category Array
  26049. * @param {Array} array The array to inspect.
  26050. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26051. * @returns {Array} Returns the new duplicate free array.
  26052. * @example
  26053. *
  26054. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  26055. * // => [2.1, 1.2]
  26056. *
  26057. * // The `_.property` iteratee shorthand.
  26058. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  26059. * // => [{ 'x': 1 }, { 'x': 2 }]
  26060. */
  26061. function uniqBy(array, iteratee) {
  26062. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  26063. }
  26064. /**
  26065. * This method is like `_.uniq` except that it accepts `comparator` which
  26066. * is invoked to compare elements of `array`. The order of result values is
  26067. * determined by the order they occur in the array.The comparator is invoked
  26068. * with two arguments: (arrVal, othVal).
  26069. *
  26070. * @static
  26071. * @memberOf _
  26072. * @since 4.0.0
  26073. * @category Array
  26074. * @param {Array} array The array to inspect.
  26075. * @param {Function} [comparator] The comparator invoked per element.
  26076. * @returns {Array} Returns the new duplicate free array.
  26077. * @example
  26078. *
  26079. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26080. *
  26081. * _.uniqWith(objects, _.isEqual);
  26082. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  26083. */
  26084. function uniqWith(array, comparator) {
  26085. comparator = typeof comparator == 'function' ? comparator : undefined;
  26086. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  26087. }
  26088. /**
  26089. * This method is like `_.zip` except that it accepts an array of grouped
  26090. * elements and creates an array regrouping the elements to their pre-zip
  26091. * configuration.
  26092. *
  26093. * @static
  26094. * @memberOf _
  26095. * @since 1.2.0
  26096. * @category Array
  26097. * @param {Array} array The array of grouped elements to process.
  26098. * @returns {Array} Returns the new array of regrouped elements.
  26099. * @example
  26100. *
  26101. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  26102. * // => [['a', 1, true], ['b', 2, false]]
  26103. *
  26104. * _.unzip(zipped);
  26105. * // => [['a', 'b'], [1, 2], [true, false]]
  26106. */
  26107. function unzip(array) {
  26108. if (!(array && array.length)) {
  26109. return [];
  26110. }
  26111. var length = 0;
  26112. array = arrayFilter(array, function(group) {
  26113. if (isArrayLikeObject(group)) {
  26114. length = nativeMax(group.length, length);
  26115. return true;
  26116. }
  26117. });
  26118. return baseTimes(length, function(index) {
  26119. return arrayMap(array, baseProperty(index));
  26120. });
  26121. }
  26122. /**
  26123. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  26124. * how regrouped values should be combined. The iteratee is invoked with the
  26125. * elements of each group: (...group).
  26126. *
  26127. * @static
  26128. * @memberOf _
  26129. * @since 3.8.0
  26130. * @category Array
  26131. * @param {Array} array The array of grouped elements to process.
  26132. * @param {Function} [iteratee=_.identity] The function to combine
  26133. * regrouped values.
  26134. * @returns {Array} Returns the new array of regrouped elements.
  26135. * @example
  26136. *
  26137. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  26138. * // => [[1, 10, 100], [2, 20, 200]]
  26139. *
  26140. * _.unzipWith(zipped, _.add);
  26141. * // => [3, 30, 300]
  26142. */
  26143. function unzipWith(array, iteratee) {
  26144. if (!(array && array.length)) {
  26145. return [];
  26146. }
  26147. var result = unzip(array);
  26148. if (iteratee == null) {
  26149. return result;
  26150. }
  26151. return arrayMap(result, function(group) {
  26152. return apply(iteratee, undefined, group);
  26153. });
  26154. }
  26155. /**
  26156. * Creates an array excluding all given values using
  26157. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26158. * for equality comparisons.
  26159. *
  26160. * **Note:** Unlike `_.pull`, this method returns a new array.
  26161. *
  26162. * @static
  26163. * @memberOf _
  26164. * @since 0.1.0
  26165. * @category Array
  26166. * @param {Array} array The array to inspect.
  26167. * @param {...*} [values] The values to exclude.
  26168. * @returns {Array} Returns the new array of filtered values.
  26169. * @see _.difference, _.xor
  26170. * @example
  26171. *
  26172. * _.without([2, 1, 2, 3], 1, 2);
  26173. * // => [3]
  26174. */
  26175. var without = baseRest(function(array, values) {
  26176. return isArrayLikeObject(array)
  26177. ? baseDifference(array, values)
  26178. : [];
  26179. });
  26180. /**
  26181. * Creates an array of unique values that is the
  26182. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  26183. * of the given arrays. The order of result values is determined by the order
  26184. * they occur in the arrays.
  26185. *
  26186. * @static
  26187. * @memberOf _
  26188. * @since 2.4.0
  26189. * @category Array
  26190. * @param {...Array} [arrays] The arrays to inspect.
  26191. * @returns {Array} Returns the new array of filtered values.
  26192. * @see _.difference, _.without
  26193. * @example
  26194. *
  26195. * _.xor([2, 1], [2, 3]);
  26196. * // => [1, 3]
  26197. */
  26198. var xor = baseRest(function(arrays) {
  26199. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  26200. });
  26201. /**
  26202. * This method is like `_.xor` except that it accepts `iteratee` which is
  26203. * invoked for each element of each `arrays` to generate the criterion by
  26204. * which by which they're compared. The order of result values is determined
  26205. * by the order they occur in the arrays. The iteratee is invoked with one
  26206. * argument: (value).
  26207. *
  26208. * @static
  26209. * @memberOf _
  26210. * @since 4.0.0
  26211. * @category Array
  26212. * @param {...Array} [arrays] The arrays to inspect.
  26213. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26214. * @returns {Array} Returns the new array of filtered values.
  26215. * @example
  26216. *
  26217. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  26218. * // => [1.2, 3.4]
  26219. *
  26220. * // The `_.property` iteratee shorthand.
  26221. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26222. * // => [{ 'x': 2 }]
  26223. */
  26224. var xorBy = baseRest(function(arrays) {
  26225. var iteratee = last(arrays);
  26226. if (isArrayLikeObject(iteratee)) {
  26227. iteratee = undefined;
  26228. }
  26229. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  26230. });
  26231. /**
  26232. * This method is like `_.xor` except that it accepts `comparator` which is
  26233. * invoked to compare elements of `arrays`. The order of result values is
  26234. * determined by the order they occur in the arrays. The comparator is invoked
  26235. * with two arguments: (arrVal, othVal).
  26236. *
  26237. * @static
  26238. * @memberOf _
  26239. * @since 4.0.0
  26240. * @category Array
  26241. * @param {...Array} [arrays] The arrays to inspect.
  26242. * @param {Function} [comparator] The comparator invoked per element.
  26243. * @returns {Array} Returns the new array of filtered values.
  26244. * @example
  26245. *
  26246. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26247. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26248. *
  26249. * _.xorWith(objects, others, _.isEqual);
  26250. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26251. */
  26252. var xorWith = baseRest(function(arrays) {
  26253. var comparator = last(arrays);
  26254. comparator = typeof comparator == 'function' ? comparator : undefined;
  26255. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  26256. });
  26257. /**
  26258. * Creates an array of grouped elements, the first of which contains the
  26259. * first elements of the given arrays, the second of which contains the
  26260. * second elements of the given arrays, and so on.
  26261. *
  26262. * @static
  26263. * @memberOf _
  26264. * @since 0.1.0
  26265. * @category Array
  26266. * @param {...Array} [arrays] The arrays to process.
  26267. * @returns {Array} Returns the new array of grouped elements.
  26268. * @example
  26269. *
  26270. * _.zip(['a', 'b'], [1, 2], [true, false]);
  26271. * // => [['a', 1, true], ['b', 2, false]]
  26272. */
  26273. var zip = baseRest(unzip);
  26274. /**
  26275. * This method is like `_.fromPairs` except that it accepts two arrays,
  26276. * one of property identifiers and one of corresponding values.
  26277. *
  26278. * @static
  26279. * @memberOf _
  26280. * @since 0.4.0
  26281. * @category Array
  26282. * @param {Array} [props=[]] The property identifiers.
  26283. * @param {Array} [values=[]] The property values.
  26284. * @returns {Object} Returns the new object.
  26285. * @example
  26286. *
  26287. * _.zipObject(['a', 'b'], [1, 2]);
  26288. * // => { 'a': 1, 'b': 2 }
  26289. */
  26290. function zipObject(props, values) {
  26291. return baseZipObject(props || [], values || [], assignValue);
  26292. }
  26293. /**
  26294. * This method is like `_.zipObject` except that it supports property paths.
  26295. *
  26296. * @static
  26297. * @memberOf _
  26298. * @since 4.1.0
  26299. * @category Array
  26300. * @param {Array} [props=[]] The property identifiers.
  26301. * @param {Array} [values=[]] The property values.
  26302. * @returns {Object} Returns the new object.
  26303. * @example
  26304. *
  26305. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  26306. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  26307. */
  26308. function zipObjectDeep(props, values) {
  26309. return baseZipObject(props || [], values || [], baseSet);
  26310. }
  26311. /**
  26312. * This method is like `_.zip` except that it accepts `iteratee` to specify
  26313. * how grouped values should be combined. The iteratee is invoked with the
  26314. * elements of each group: (...group).
  26315. *
  26316. * @static
  26317. * @memberOf _
  26318. * @since 3.8.0
  26319. * @category Array
  26320. * @param {...Array} [arrays] The arrays to process.
  26321. * @param {Function} [iteratee=_.identity] The function to combine
  26322. * grouped values.
  26323. * @returns {Array} Returns the new array of grouped elements.
  26324. * @example
  26325. *
  26326. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  26327. * return a + b + c;
  26328. * });
  26329. * // => [111, 222]
  26330. */
  26331. var zipWith = baseRest(function(arrays) {
  26332. var length = arrays.length,
  26333. iteratee = length > 1 ? arrays[length - 1] : undefined;
  26334. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  26335. return unzipWith(arrays, iteratee);
  26336. });
  26337. /*------------------------------------------------------------------------*/
  26338. /**
  26339. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  26340. * chain sequences enabled. The result of such sequences must be unwrapped
  26341. * with `_#value`.
  26342. *
  26343. * @static
  26344. * @memberOf _
  26345. * @since 1.3.0
  26346. * @category Seq
  26347. * @param {*} value The value to wrap.
  26348. * @returns {Object} Returns the new `lodash` wrapper instance.
  26349. * @example
  26350. *
  26351. * var users = [
  26352. * { 'user': 'barney', 'age': 36 },
  26353. * { 'user': 'fred', 'age': 40 },
  26354. * { 'user': 'pebbles', 'age': 1 }
  26355. * ];
  26356. *
  26357. * var youngest = _
  26358. * .chain(users)
  26359. * .sortBy('age')
  26360. * .map(function(o) {
  26361. * return o.user + ' is ' + o.age;
  26362. * })
  26363. * .head()
  26364. * .value();
  26365. * // => 'pebbles is 1'
  26366. */
  26367. function chain(value) {
  26368. var result = lodash(value);
  26369. result.__chain__ = true;
  26370. return result;
  26371. }
  26372. /**
  26373. * This method invokes `interceptor` and returns `value`. The interceptor
  26374. * is invoked with one argument; (value). The purpose of this method is to
  26375. * "tap into" a method chain sequence in order to modify intermediate results.
  26376. *
  26377. * @static
  26378. * @memberOf _
  26379. * @since 0.1.0
  26380. * @category Seq
  26381. * @param {*} value The value to provide to `interceptor`.
  26382. * @param {Function} interceptor The function to invoke.
  26383. * @returns {*} Returns `value`.
  26384. * @example
  26385. *
  26386. * _([1, 2, 3])
  26387. * .tap(function(array) {
  26388. * // Mutate input array.
  26389. * array.pop();
  26390. * })
  26391. * .reverse()
  26392. * .value();
  26393. * // => [2, 1]
  26394. */
  26395. function tap(value, interceptor) {
  26396. interceptor(value);
  26397. return value;
  26398. }
  26399. /**
  26400. * This method is like `_.tap` except that it returns the result of `interceptor`.
  26401. * The purpose of this method is to "pass thru" values replacing intermediate
  26402. * results in a method chain sequence.
  26403. *
  26404. * @static
  26405. * @memberOf _
  26406. * @since 3.0.0
  26407. * @category Seq
  26408. * @param {*} value The value to provide to `interceptor`.
  26409. * @param {Function} interceptor The function to invoke.
  26410. * @returns {*} Returns the result of `interceptor`.
  26411. * @example
  26412. *
  26413. * _(' abc ')
  26414. * .chain()
  26415. * .trim()
  26416. * .thru(function(value) {
  26417. * return [value];
  26418. * })
  26419. * .value();
  26420. * // => ['abc']
  26421. */
  26422. function thru(value, interceptor) {
  26423. return interceptor(value);
  26424. }
  26425. /**
  26426. * This method is the wrapper version of `_.at`.
  26427. *
  26428. * @name at
  26429. * @memberOf _
  26430. * @since 1.0.0
  26431. * @category Seq
  26432. * @param {...(string|string[])} [paths] The property paths to pick.
  26433. * @returns {Object} Returns the new `lodash` wrapper instance.
  26434. * @example
  26435. *
  26436. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  26437. *
  26438. * _(object).at(['a[0].b.c', 'a[1]']).value();
  26439. * // => [3, 4]
  26440. */
  26441. var wrapperAt = flatRest(function(paths) {
  26442. var length = paths.length,
  26443. start = length ? paths[0] : 0,
  26444. value = this.__wrapped__,
  26445. interceptor = function(object) { return baseAt(object, paths); };
  26446. if (length > 1 || this.__actions__.length ||
  26447. !(value instanceof LazyWrapper) || !isIndex(start)) {
  26448. return this.thru(interceptor);
  26449. }
  26450. value = value.slice(start, +start + (length ? 1 : 0));
  26451. value.__actions__.push({
  26452. 'func': thru,
  26453. 'args': [interceptor],
  26454. 'thisArg': undefined
  26455. });
  26456. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  26457. if (length && !array.length) {
  26458. array.push(undefined);
  26459. }
  26460. return array;
  26461. });
  26462. });
  26463. /**
  26464. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  26465. *
  26466. * @name chain
  26467. * @memberOf _
  26468. * @since 0.1.0
  26469. * @category Seq
  26470. * @returns {Object} Returns the new `lodash` wrapper instance.
  26471. * @example
  26472. *
  26473. * var users = [
  26474. * { 'user': 'barney', 'age': 36 },
  26475. * { 'user': 'fred', 'age': 40 }
  26476. * ];
  26477. *
  26478. * // A sequence without explicit chaining.
  26479. * _(users).head();
  26480. * // => { 'user': 'barney', 'age': 36 }
  26481. *
  26482. * // A sequence with explicit chaining.
  26483. * _(users)
  26484. * .chain()
  26485. * .head()
  26486. * .pick('user')
  26487. * .value();
  26488. * // => { 'user': 'barney' }
  26489. */
  26490. function wrapperChain() {
  26491. return chain(this);
  26492. }
  26493. /**
  26494. * Executes the chain sequence and returns the wrapped result.
  26495. *
  26496. * @name commit
  26497. * @memberOf _
  26498. * @since 3.2.0
  26499. * @category Seq
  26500. * @returns {Object} Returns the new `lodash` wrapper instance.
  26501. * @example
  26502. *
  26503. * var array = [1, 2];
  26504. * var wrapped = _(array).push(3);
  26505. *
  26506. * console.log(array);
  26507. * // => [1, 2]
  26508. *
  26509. * wrapped = wrapped.commit();
  26510. * console.log(array);
  26511. * // => [1, 2, 3]
  26512. *
  26513. * wrapped.last();
  26514. * // => 3
  26515. *
  26516. * console.log(array);
  26517. * // => [1, 2, 3]
  26518. */
  26519. function wrapperCommit() {
  26520. return new LodashWrapper(this.value(), this.__chain__);
  26521. }
  26522. /**
  26523. * Gets the next value on a wrapped object following the
  26524. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  26525. *
  26526. * @name next
  26527. * @memberOf _
  26528. * @since 4.0.0
  26529. * @category Seq
  26530. * @returns {Object} Returns the next iterator value.
  26531. * @example
  26532. *
  26533. * var wrapped = _([1, 2]);
  26534. *
  26535. * wrapped.next();
  26536. * // => { 'done': false, 'value': 1 }
  26537. *
  26538. * wrapped.next();
  26539. * // => { 'done': false, 'value': 2 }
  26540. *
  26541. * wrapped.next();
  26542. * // => { 'done': true, 'value': undefined }
  26543. */
  26544. function wrapperNext() {
  26545. if (this.__values__ === undefined) {
  26546. this.__values__ = toArray(this.value());
  26547. }
  26548. var done = this.__index__ >= this.__values__.length,
  26549. value = done ? undefined : this.__values__[this.__index__++];
  26550. return { 'done': done, 'value': value };
  26551. }
  26552. /**
  26553. * Enables the wrapper to be iterable.
  26554. *
  26555. * @name Symbol.iterator
  26556. * @memberOf _
  26557. * @since 4.0.0
  26558. * @category Seq
  26559. * @returns {Object} Returns the wrapper object.
  26560. * @example
  26561. *
  26562. * var wrapped = _([1, 2]);
  26563. *
  26564. * wrapped[Symbol.iterator]() === wrapped;
  26565. * // => true
  26566. *
  26567. * Array.from(wrapped);
  26568. * // => [1, 2]
  26569. */
  26570. function wrapperToIterator() {
  26571. return this;
  26572. }
  26573. /**
  26574. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  26575. *
  26576. * @name plant
  26577. * @memberOf _
  26578. * @since 3.2.0
  26579. * @category Seq
  26580. * @param {*} value The value to plant.
  26581. * @returns {Object} Returns the new `lodash` wrapper instance.
  26582. * @example
  26583. *
  26584. * function square(n) {
  26585. * return n * n;
  26586. * }
  26587. *
  26588. * var wrapped = _([1, 2]).map(square);
  26589. * var other = wrapped.plant([3, 4]);
  26590. *
  26591. * other.value();
  26592. * // => [9, 16]
  26593. *
  26594. * wrapped.value();
  26595. * // => [1, 4]
  26596. */
  26597. function wrapperPlant(value) {
  26598. var result,
  26599. parent = this;
  26600. while (parent instanceof baseLodash) {
  26601. var clone = wrapperClone(parent);
  26602. clone.__index__ = 0;
  26603. clone.__values__ = undefined;
  26604. if (result) {
  26605. previous.__wrapped__ = clone;
  26606. } else {
  26607. result = clone;
  26608. }
  26609. var previous = clone;
  26610. parent = parent.__wrapped__;
  26611. }
  26612. previous.__wrapped__ = value;
  26613. return result;
  26614. }
  26615. /**
  26616. * This method is the wrapper version of `_.reverse`.
  26617. *
  26618. * **Note:** This method mutates the wrapped array.
  26619. *
  26620. * @name reverse
  26621. * @memberOf _
  26622. * @since 0.1.0
  26623. * @category Seq
  26624. * @returns {Object} Returns the new `lodash` wrapper instance.
  26625. * @example
  26626. *
  26627. * var array = [1, 2, 3];
  26628. *
  26629. * _(array).reverse().value()
  26630. * // => [3, 2, 1]
  26631. *
  26632. * console.log(array);
  26633. * // => [3, 2, 1]
  26634. */
  26635. function wrapperReverse() {
  26636. var value = this.__wrapped__;
  26637. if (value instanceof LazyWrapper) {
  26638. var wrapped = value;
  26639. if (this.__actions__.length) {
  26640. wrapped = new LazyWrapper(this);
  26641. }
  26642. wrapped = wrapped.reverse();
  26643. wrapped.__actions__.push({
  26644. 'func': thru,
  26645. 'args': [reverse],
  26646. 'thisArg': undefined
  26647. });
  26648. return new LodashWrapper(wrapped, this.__chain__);
  26649. }
  26650. return this.thru(reverse);
  26651. }
  26652. /**
  26653. * Executes the chain sequence to resolve the unwrapped value.
  26654. *
  26655. * @name value
  26656. * @memberOf _
  26657. * @since 0.1.0
  26658. * @alias toJSON, valueOf
  26659. * @category Seq
  26660. * @returns {*} Returns the resolved unwrapped value.
  26661. * @example
  26662. *
  26663. * _([1, 2, 3]).value();
  26664. * // => [1, 2, 3]
  26665. */
  26666. function wrapperValue() {
  26667. return baseWrapperValue(this.__wrapped__, this.__actions__);
  26668. }
  26669. /*------------------------------------------------------------------------*/
  26670. /**
  26671. * Creates an object composed of keys generated from the results of running
  26672. * each element of `collection` thru `iteratee`. The corresponding value of
  26673. * each key is the number of times the key was returned by `iteratee`. The
  26674. * iteratee is invoked with one argument: (value).
  26675. *
  26676. * @static
  26677. * @memberOf _
  26678. * @since 0.5.0
  26679. * @category Collection
  26680. * @param {Array|Object} collection The collection to iterate over.
  26681. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26682. * @returns {Object} Returns the composed aggregate object.
  26683. * @example
  26684. *
  26685. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  26686. * // => { '4': 1, '6': 2 }
  26687. *
  26688. * // The `_.property` iteratee shorthand.
  26689. * _.countBy(['one', 'two', 'three'], 'length');
  26690. * // => { '3': 2, '5': 1 }
  26691. */
  26692. var countBy = createAggregator(function(result, value, key) {
  26693. if (hasOwnProperty.call(result, key)) {
  26694. ++result[key];
  26695. } else {
  26696. baseAssignValue(result, key, 1);
  26697. }
  26698. });
  26699. /**
  26700. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  26701. * Iteration is stopped once `predicate` returns falsey. The predicate is
  26702. * invoked with three arguments: (value, index|key, collection).
  26703. *
  26704. * **Note:** This method returns `true` for
  26705. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  26706. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  26707. * elements of empty collections.
  26708. *
  26709. * @static
  26710. * @memberOf _
  26711. * @since 0.1.0
  26712. * @category Collection
  26713. * @param {Array|Object} collection The collection to iterate over.
  26714. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26715. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26716. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  26717. * else `false`.
  26718. * @example
  26719. *
  26720. * _.every([true, 1, null, 'yes'], Boolean);
  26721. * // => false
  26722. *
  26723. * var users = [
  26724. * { 'user': 'barney', 'age': 36, 'active': false },
  26725. * { 'user': 'fred', 'age': 40, 'active': false }
  26726. * ];
  26727. *
  26728. * // The `_.matches` iteratee shorthand.
  26729. * _.every(users, { 'user': 'barney', 'active': false });
  26730. * // => false
  26731. *
  26732. * // The `_.matchesProperty` iteratee shorthand.
  26733. * _.every(users, ['active', false]);
  26734. * // => true
  26735. *
  26736. * // The `_.property` iteratee shorthand.
  26737. * _.every(users, 'active');
  26738. * // => false
  26739. */
  26740. function every(collection, predicate, guard) {
  26741. var func = isArray(collection) ? arrayEvery : baseEvery;
  26742. if (guard && isIterateeCall(collection, predicate, guard)) {
  26743. predicate = undefined;
  26744. }
  26745. return func(collection, getIteratee(predicate, 3));
  26746. }
  26747. /**
  26748. * Iterates over elements of `collection`, returning an array of all elements
  26749. * `predicate` returns truthy for. The predicate is invoked with three
  26750. * arguments: (value, index|key, collection).
  26751. *
  26752. * **Note:** Unlike `_.remove`, this method returns a new array.
  26753. *
  26754. * @static
  26755. * @memberOf _
  26756. * @since 0.1.0
  26757. * @category Collection
  26758. * @param {Array|Object} collection The collection to iterate over.
  26759. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26760. * @returns {Array} Returns the new filtered array.
  26761. * @see _.reject
  26762. * @example
  26763. *
  26764. * var users = [
  26765. * { 'user': 'barney', 'age': 36, 'active': true },
  26766. * { 'user': 'fred', 'age': 40, 'active': false }
  26767. * ];
  26768. *
  26769. * _.filter(users, function(o) { return !o.active; });
  26770. * // => objects for ['fred']
  26771. *
  26772. * // The `_.matches` iteratee shorthand.
  26773. * _.filter(users, { 'age': 36, 'active': true });
  26774. * // => objects for ['barney']
  26775. *
  26776. * // The `_.matchesProperty` iteratee shorthand.
  26777. * _.filter(users, ['active', false]);
  26778. * // => objects for ['fred']
  26779. *
  26780. * // The `_.property` iteratee shorthand.
  26781. * _.filter(users, 'active');
  26782. * // => objects for ['barney']
  26783. */
  26784. function filter(collection, predicate) {
  26785. var func = isArray(collection) ? arrayFilter : baseFilter;
  26786. return func(collection, getIteratee(predicate, 3));
  26787. }
  26788. /**
  26789. * Iterates over elements of `collection`, returning the first element
  26790. * `predicate` returns truthy for. The predicate is invoked with three
  26791. * arguments: (value, index|key, collection).
  26792. *
  26793. * @static
  26794. * @memberOf _
  26795. * @since 0.1.0
  26796. * @category Collection
  26797. * @param {Array|Object} collection The collection to inspect.
  26798. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26799. * @param {number} [fromIndex=0] The index to search from.
  26800. * @returns {*} Returns the matched element, else `undefined`.
  26801. * @example
  26802. *
  26803. * var users = [
  26804. * { 'user': 'barney', 'age': 36, 'active': true },
  26805. * { 'user': 'fred', 'age': 40, 'active': false },
  26806. * { 'user': 'pebbles', 'age': 1, 'active': true }
  26807. * ];
  26808. *
  26809. * _.find(users, function(o) { return o.age < 40; });
  26810. * // => object for 'barney'
  26811. *
  26812. * // The `_.matches` iteratee shorthand.
  26813. * _.find(users, { 'age': 1, 'active': true });
  26814. * // => object for 'pebbles'
  26815. *
  26816. * // The `_.matchesProperty` iteratee shorthand.
  26817. * _.find(users, ['active', false]);
  26818. * // => object for 'fred'
  26819. *
  26820. * // The `_.property` iteratee shorthand.
  26821. * _.find(users, 'active');
  26822. * // => object for 'barney'
  26823. */
  26824. var find = createFind(findIndex);
  26825. /**
  26826. * This method is like `_.find` except that it iterates over elements of
  26827. * `collection` from right to left.
  26828. *
  26829. * @static
  26830. * @memberOf _
  26831. * @since 2.0.0
  26832. * @category Collection
  26833. * @param {Array|Object} collection The collection to inspect.
  26834. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26835. * @param {number} [fromIndex=collection.length-1] The index to search from.
  26836. * @returns {*} Returns the matched element, else `undefined`.
  26837. * @example
  26838. *
  26839. * _.findLast([1, 2, 3, 4], function(n) {
  26840. * return n % 2 == 1;
  26841. * });
  26842. * // => 3
  26843. */
  26844. var findLast = createFind(findLastIndex);
  26845. /**
  26846. * Creates a flattened array of values by running each element in `collection`
  26847. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  26848. * with three arguments: (value, index|key, collection).
  26849. *
  26850. * @static
  26851. * @memberOf _
  26852. * @since 4.0.0
  26853. * @category Collection
  26854. * @param {Array|Object} collection The collection to iterate over.
  26855. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26856. * @returns {Array} Returns the new flattened array.
  26857. * @example
  26858. *
  26859. * function duplicate(n) {
  26860. * return [n, n];
  26861. * }
  26862. *
  26863. * _.flatMap([1, 2], duplicate);
  26864. * // => [1, 1, 2, 2]
  26865. */
  26866. function flatMap(collection, iteratee) {
  26867. return baseFlatten(map(collection, iteratee), 1);
  26868. }
  26869. /**
  26870. * This method is like `_.flatMap` except that it recursively flattens the
  26871. * mapped results.
  26872. *
  26873. * @static
  26874. * @memberOf _
  26875. * @since 4.7.0
  26876. * @category Collection
  26877. * @param {Array|Object} collection The collection to iterate over.
  26878. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26879. * @returns {Array} Returns the new flattened array.
  26880. * @example
  26881. *
  26882. * function duplicate(n) {
  26883. * return [[[n, n]]];
  26884. * }
  26885. *
  26886. * _.flatMapDeep([1, 2], duplicate);
  26887. * // => [1, 1, 2, 2]
  26888. */
  26889. function flatMapDeep(collection, iteratee) {
  26890. return baseFlatten(map(collection, iteratee), INFINITY);
  26891. }
  26892. /**
  26893. * This method is like `_.flatMap` except that it recursively flattens the
  26894. * mapped results up to `depth` times.
  26895. *
  26896. * @static
  26897. * @memberOf _
  26898. * @since 4.7.0
  26899. * @category Collection
  26900. * @param {Array|Object} collection The collection to iterate over.
  26901. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26902. * @param {number} [depth=1] The maximum recursion depth.
  26903. * @returns {Array} Returns the new flattened array.
  26904. * @example
  26905. *
  26906. * function duplicate(n) {
  26907. * return [[[n, n]]];
  26908. * }
  26909. *
  26910. * _.flatMapDepth([1, 2], duplicate, 2);
  26911. * // => [[1, 1], [2, 2]]
  26912. */
  26913. function flatMapDepth(collection, iteratee, depth) {
  26914. depth = depth === undefined ? 1 : toInteger(depth);
  26915. return baseFlatten(map(collection, iteratee), depth);
  26916. }
  26917. /**
  26918. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  26919. * The iteratee is invoked with three arguments: (value, index|key, collection).
  26920. * Iteratee functions may exit iteration early by explicitly returning `false`.
  26921. *
  26922. * **Note:** As with other "Collections" methods, objects with a "length"
  26923. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  26924. * or `_.forOwn` for object iteration.
  26925. *
  26926. * @static
  26927. * @memberOf _
  26928. * @since 0.1.0
  26929. * @alias each
  26930. * @category Collection
  26931. * @param {Array|Object} collection The collection to iterate over.
  26932. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26933. * @returns {Array|Object} Returns `collection`.
  26934. * @see _.forEachRight
  26935. * @example
  26936. *
  26937. * _.forEach([1, 2], function(value) {
  26938. * console.log(value);
  26939. * });
  26940. * // => Logs `1` then `2`.
  26941. *
  26942. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  26943. * console.log(key);
  26944. * });
  26945. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  26946. */
  26947. function forEach(collection, iteratee) {
  26948. var func = isArray(collection) ? arrayEach : baseEach;
  26949. return func(collection, getIteratee(iteratee, 3));
  26950. }
  26951. /**
  26952. * This method is like `_.forEach` except that it iterates over elements of
  26953. * `collection` from right to left.
  26954. *
  26955. * @static
  26956. * @memberOf _
  26957. * @since 2.0.0
  26958. * @alias eachRight
  26959. * @category Collection
  26960. * @param {Array|Object} collection The collection to iterate over.
  26961. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26962. * @returns {Array|Object} Returns `collection`.
  26963. * @see _.forEach
  26964. * @example
  26965. *
  26966. * _.forEachRight([1, 2], function(value) {
  26967. * console.log(value);
  26968. * });
  26969. * // => Logs `2` then `1`.
  26970. */
  26971. function forEachRight(collection, iteratee) {
  26972. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  26973. return func(collection, getIteratee(iteratee, 3));
  26974. }
  26975. /**
  26976. * Creates an object composed of keys generated from the results of running
  26977. * each element of `collection` thru `iteratee`. The order of grouped values
  26978. * is determined by the order they occur in `collection`. The corresponding
  26979. * value of each key is an array of elements responsible for generating the
  26980. * key. The iteratee is invoked with one argument: (value).
  26981. *
  26982. * @static
  26983. * @memberOf _
  26984. * @since 0.1.0
  26985. * @category Collection
  26986. * @param {Array|Object} collection The collection to iterate over.
  26987. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26988. * @returns {Object} Returns the composed aggregate object.
  26989. * @example
  26990. *
  26991. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  26992. * // => { '4': [4.2], '6': [6.1, 6.3] }
  26993. *
  26994. * // The `_.property` iteratee shorthand.
  26995. * _.groupBy(['one', 'two', 'three'], 'length');
  26996. * // => { '3': ['one', 'two'], '5': ['three'] }
  26997. */
  26998. var groupBy = createAggregator(function(result, value, key) {
  26999. if (hasOwnProperty.call(result, key)) {
  27000. result[key].push(value);
  27001. } else {
  27002. baseAssignValue(result, key, [value]);
  27003. }
  27004. });
  27005. /**
  27006. * Checks if `value` is in `collection`. If `collection` is a string, it's
  27007. * checked for a substring of `value`, otherwise
  27008. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27009. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  27010. * the offset from the end of `collection`.
  27011. *
  27012. * @static
  27013. * @memberOf _
  27014. * @since 0.1.0
  27015. * @category Collection
  27016. * @param {Array|Object|string} collection The collection to inspect.
  27017. * @param {*} value The value to search for.
  27018. * @param {number} [fromIndex=0] The index to search from.
  27019. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27020. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  27021. * @example
  27022. *
  27023. * _.includes([1, 2, 3], 1);
  27024. * // => true
  27025. *
  27026. * _.includes([1, 2, 3], 1, 2);
  27027. * // => false
  27028. *
  27029. * _.includes({ 'a': 1, 'b': 2 }, 1);
  27030. * // => true
  27031. *
  27032. * _.includes('abcd', 'bc');
  27033. * // => true
  27034. */
  27035. function includes(collection, value, fromIndex, guard) {
  27036. collection = isArrayLike(collection) ? collection : values(collection);
  27037. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  27038. var length = collection.length;
  27039. if (fromIndex < 0) {
  27040. fromIndex = nativeMax(length + fromIndex, 0);
  27041. }
  27042. return isString(collection)
  27043. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  27044. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  27045. }
  27046. /**
  27047. * Invokes the method at `path` of each element in `collection`, returning
  27048. * an array of the results of each invoked method. Any additional arguments
  27049. * are provided to each invoked method. If `path` is a function, it's invoked
  27050. * for, and `this` bound to, each element in `collection`.
  27051. *
  27052. * @static
  27053. * @memberOf _
  27054. * @since 4.0.0
  27055. * @category Collection
  27056. * @param {Array|Object} collection The collection to iterate over.
  27057. * @param {Array|Function|string} path The path of the method to invoke or
  27058. * the function invoked per iteration.
  27059. * @param {...*} [args] The arguments to invoke each method with.
  27060. * @returns {Array} Returns the array of results.
  27061. * @example
  27062. *
  27063. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  27064. * // => [[1, 5, 7], [1, 2, 3]]
  27065. *
  27066. * _.invokeMap([123, 456], String.prototype.split, '');
  27067. * // => [['1', '2', '3'], ['4', '5', '6']]
  27068. */
  27069. var invokeMap = baseRest(function(collection, path, args) {
  27070. var index = -1,
  27071. isFunc = typeof path == 'function',
  27072. result = isArrayLike(collection) ? Array(collection.length) : [];
  27073. baseEach(collection, function(value) {
  27074. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  27075. });
  27076. return result;
  27077. });
  27078. /**
  27079. * Creates an object composed of keys generated from the results of running
  27080. * each element of `collection` thru `iteratee`. The corresponding value of
  27081. * each key is the last element responsible for generating the key. The
  27082. * iteratee is invoked with one argument: (value).
  27083. *
  27084. * @static
  27085. * @memberOf _
  27086. * @since 4.0.0
  27087. * @category Collection
  27088. * @param {Array|Object} collection The collection to iterate over.
  27089. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27090. * @returns {Object} Returns the composed aggregate object.
  27091. * @example
  27092. *
  27093. * var array = [
  27094. * { 'dir': 'left', 'code': 97 },
  27095. * { 'dir': 'right', 'code': 100 }
  27096. * ];
  27097. *
  27098. * _.keyBy(array, function(o) {
  27099. * return String.fromCharCode(o.code);
  27100. * });
  27101. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  27102. *
  27103. * _.keyBy(array, 'dir');
  27104. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  27105. */
  27106. var keyBy = createAggregator(function(result, value, key) {
  27107. baseAssignValue(result, key, value);
  27108. });
  27109. /**
  27110. * Creates an array of values by running each element in `collection` thru
  27111. * `iteratee`. The iteratee is invoked with three arguments:
  27112. * (value, index|key, collection).
  27113. *
  27114. * Many lodash methods are guarded to work as iteratees for methods like
  27115. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  27116. *
  27117. * The guarded methods are:
  27118. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  27119. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  27120. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  27121. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  27122. *
  27123. * @static
  27124. * @memberOf _
  27125. * @since 0.1.0
  27126. * @category Collection
  27127. * @param {Array|Object} collection The collection to iterate over.
  27128. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27129. * @returns {Array} Returns the new mapped array.
  27130. * @example
  27131. *
  27132. * function square(n) {
  27133. * return n * n;
  27134. * }
  27135. *
  27136. * _.map([4, 8], square);
  27137. * // => [16, 64]
  27138. *
  27139. * _.map({ 'a': 4, 'b': 8 }, square);
  27140. * // => [16, 64] (iteration order is not guaranteed)
  27141. *
  27142. * var users = [
  27143. * { 'user': 'barney' },
  27144. * { 'user': 'fred' }
  27145. * ];
  27146. *
  27147. * // The `_.property` iteratee shorthand.
  27148. * _.map(users, 'user');
  27149. * // => ['barney', 'fred']
  27150. */
  27151. function map(collection, iteratee) {
  27152. var func = isArray(collection) ? arrayMap : baseMap;
  27153. return func(collection, getIteratee(iteratee, 3));
  27154. }
  27155. /**
  27156. * This method is like `_.sortBy` except that it allows specifying the sort
  27157. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  27158. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  27159. * descending or "asc" for ascending sort order of corresponding values.
  27160. *
  27161. * @static
  27162. * @memberOf _
  27163. * @since 4.0.0
  27164. * @category Collection
  27165. * @param {Array|Object} collection The collection to iterate over.
  27166. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  27167. * The iteratees to sort by.
  27168. * @param {string[]} [orders] The sort orders of `iteratees`.
  27169. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27170. * @returns {Array} Returns the new sorted array.
  27171. * @example
  27172. *
  27173. * var users = [
  27174. * { 'user': 'fred', 'age': 48 },
  27175. * { 'user': 'barney', 'age': 34 },
  27176. * { 'user': 'fred', 'age': 40 },
  27177. * { 'user': 'barney', 'age': 36 }
  27178. * ];
  27179. *
  27180. * // Sort by `user` in ascending order and by `age` in descending order.
  27181. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  27182. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27183. */
  27184. function orderBy(collection, iteratees, orders, guard) {
  27185. if (collection == null) {
  27186. return [];
  27187. }
  27188. if (!isArray(iteratees)) {
  27189. iteratees = iteratees == null ? [] : [iteratees];
  27190. }
  27191. orders = guard ? undefined : orders;
  27192. if (!isArray(orders)) {
  27193. orders = orders == null ? [] : [orders];
  27194. }
  27195. return baseOrderBy(collection, iteratees, orders);
  27196. }
  27197. /**
  27198. * Creates an array of elements split into two groups, the first of which
  27199. * contains elements `predicate` returns truthy for, the second of which
  27200. * contains elements `predicate` returns falsey for. The predicate is
  27201. * invoked with one argument: (value).
  27202. *
  27203. * @static
  27204. * @memberOf _
  27205. * @since 3.0.0
  27206. * @category Collection
  27207. * @param {Array|Object} collection The collection to iterate over.
  27208. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27209. * @returns {Array} Returns the array of grouped elements.
  27210. * @example
  27211. *
  27212. * var users = [
  27213. * { 'user': 'barney', 'age': 36, 'active': false },
  27214. * { 'user': 'fred', 'age': 40, 'active': true },
  27215. * { 'user': 'pebbles', 'age': 1, 'active': false }
  27216. * ];
  27217. *
  27218. * _.partition(users, function(o) { return o.active; });
  27219. * // => objects for [['fred'], ['barney', 'pebbles']]
  27220. *
  27221. * // The `_.matches` iteratee shorthand.
  27222. * _.partition(users, { 'age': 1, 'active': false });
  27223. * // => objects for [['pebbles'], ['barney', 'fred']]
  27224. *
  27225. * // The `_.matchesProperty` iteratee shorthand.
  27226. * _.partition(users, ['active', false]);
  27227. * // => objects for [['barney', 'pebbles'], ['fred']]
  27228. *
  27229. * // The `_.property` iteratee shorthand.
  27230. * _.partition(users, 'active');
  27231. * // => objects for [['fred'], ['barney', 'pebbles']]
  27232. */
  27233. var partition = createAggregator(function(result, value, key) {
  27234. result[key ? 0 : 1].push(value);
  27235. }, function() { return [[], []]; });
  27236. /**
  27237. * Reduces `collection` to a value which is the accumulated result of running
  27238. * each element in `collection` thru `iteratee`, where each successive
  27239. * invocation is supplied the return value of the previous. If `accumulator`
  27240. * is not given, the first element of `collection` is used as the initial
  27241. * value. The iteratee is invoked with four arguments:
  27242. * (accumulator, value, index|key, collection).
  27243. *
  27244. * Many lodash methods are guarded to work as iteratees for methods like
  27245. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  27246. *
  27247. * The guarded methods are:
  27248. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  27249. * and `sortBy`
  27250. *
  27251. * @static
  27252. * @memberOf _
  27253. * @since 0.1.0
  27254. * @category Collection
  27255. * @param {Array|Object} collection The collection to iterate over.
  27256. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27257. * @param {*} [accumulator] The initial value.
  27258. * @returns {*} Returns the accumulated value.
  27259. * @see _.reduceRight
  27260. * @example
  27261. *
  27262. * _.reduce([1, 2], function(sum, n) {
  27263. * return sum + n;
  27264. * }, 0);
  27265. * // => 3
  27266. *
  27267. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  27268. * (result[value] || (result[value] = [])).push(key);
  27269. * return result;
  27270. * }, {});
  27271. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  27272. */
  27273. function reduce(collection, iteratee, accumulator) {
  27274. var func = isArray(collection) ? arrayReduce : baseReduce,
  27275. initAccum = arguments.length < 3;
  27276. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  27277. }
  27278. /**
  27279. * This method is like `_.reduce` except that it iterates over elements of
  27280. * `collection` from right to left.
  27281. *
  27282. * @static
  27283. * @memberOf _
  27284. * @since 0.1.0
  27285. * @category Collection
  27286. * @param {Array|Object} collection The collection to iterate over.
  27287. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27288. * @param {*} [accumulator] The initial value.
  27289. * @returns {*} Returns the accumulated value.
  27290. * @see _.reduce
  27291. * @example
  27292. *
  27293. * var array = [[0, 1], [2, 3], [4, 5]];
  27294. *
  27295. * _.reduceRight(array, function(flattened, other) {
  27296. * return flattened.concat(other);
  27297. * }, []);
  27298. * // => [4, 5, 2, 3, 0, 1]
  27299. */
  27300. function reduceRight(collection, iteratee, accumulator) {
  27301. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  27302. initAccum = arguments.length < 3;
  27303. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  27304. }
  27305. /**
  27306. * The opposite of `_.filter`; this method returns the elements of `collection`
  27307. * that `predicate` does **not** return truthy for.
  27308. *
  27309. * @static
  27310. * @memberOf _
  27311. * @since 0.1.0
  27312. * @category Collection
  27313. * @param {Array|Object} collection The collection to iterate over.
  27314. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27315. * @returns {Array} Returns the new filtered array.
  27316. * @see _.filter
  27317. * @example
  27318. *
  27319. * var users = [
  27320. * { 'user': 'barney', 'age': 36, 'active': false },
  27321. * { 'user': 'fred', 'age': 40, 'active': true }
  27322. * ];
  27323. *
  27324. * _.reject(users, function(o) { return !o.active; });
  27325. * // => objects for ['fred']
  27326. *
  27327. * // The `_.matches` iteratee shorthand.
  27328. * _.reject(users, { 'age': 40, 'active': true });
  27329. * // => objects for ['barney']
  27330. *
  27331. * // The `_.matchesProperty` iteratee shorthand.
  27332. * _.reject(users, ['active', false]);
  27333. * // => objects for ['fred']
  27334. *
  27335. * // The `_.property` iteratee shorthand.
  27336. * _.reject(users, 'active');
  27337. * // => objects for ['barney']
  27338. */
  27339. function reject(collection, predicate) {
  27340. var func = isArray(collection) ? arrayFilter : baseFilter;
  27341. return func(collection, negate(getIteratee(predicate, 3)));
  27342. }
  27343. /**
  27344. * Gets a random element from `collection`.
  27345. *
  27346. * @static
  27347. * @memberOf _
  27348. * @since 2.0.0
  27349. * @category Collection
  27350. * @param {Array|Object} collection The collection to sample.
  27351. * @returns {*} Returns the random element.
  27352. * @example
  27353. *
  27354. * _.sample([1, 2, 3, 4]);
  27355. * // => 2
  27356. */
  27357. function sample(collection) {
  27358. var func = isArray(collection) ? arraySample : baseSample;
  27359. return func(collection);
  27360. }
  27361. /**
  27362. * Gets `n` random elements at unique keys from `collection` up to the
  27363. * size of `collection`.
  27364. *
  27365. * @static
  27366. * @memberOf _
  27367. * @since 4.0.0
  27368. * @category Collection
  27369. * @param {Array|Object} collection The collection to sample.
  27370. * @param {number} [n=1] The number of elements to sample.
  27371. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27372. * @returns {Array} Returns the random elements.
  27373. * @example
  27374. *
  27375. * _.sampleSize([1, 2, 3], 2);
  27376. * // => [3, 1]
  27377. *
  27378. * _.sampleSize([1, 2, 3], 4);
  27379. * // => [2, 3, 1]
  27380. */
  27381. function sampleSize(collection, n, guard) {
  27382. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  27383. n = 1;
  27384. } else {
  27385. n = toInteger(n);
  27386. }
  27387. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  27388. return func(collection, n);
  27389. }
  27390. /**
  27391. * Creates an array of shuffled values, using a version of the
  27392. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  27393. *
  27394. * @static
  27395. * @memberOf _
  27396. * @since 0.1.0
  27397. * @category Collection
  27398. * @param {Array|Object} collection The collection to shuffle.
  27399. * @returns {Array} Returns the new shuffled array.
  27400. * @example
  27401. *
  27402. * _.shuffle([1, 2, 3, 4]);
  27403. * // => [4, 1, 3, 2]
  27404. */
  27405. function shuffle(collection) {
  27406. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  27407. return func(collection);
  27408. }
  27409. /**
  27410. * Gets the size of `collection` by returning its length for array-like
  27411. * values or the number of own enumerable string keyed properties for objects.
  27412. *
  27413. * @static
  27414. * @memberOf _
  27415. * @since 0.1.0
  27416. * @category Collection
  27417. * @param {Array|Object|string} collection The collection to inspect.
  27418. * @returns {number} Returns the collection size.
  27419. * @example
  27420. *
  27421. * _.size([1, 2, 3]);
  27422. * // => 3
  27423. *
  27424. * _.size({ 'a': 1, 'b': 2 });
  27425. * // => 2
  27426. *
  27427. * _.size('pebbles');
  27428. * // => 7
  27429. */
  27430. function size(collection) {
  27431. if (collection == null) {
  27432. return 0;
  27433. }
  27434. if (isArrayLike(collection)) {
  27435. return isString(collection) ? stringSize(collection) : collection.length;
  27436. }
  27437. var tag = getTag(collection);
  27438. if (tag == mapTag || tag == setTag) {
  27439. return collection.size;
  27440. }
  27441. return baseKeys(collection).length;
  27442. }
  27443. /**
  27444. * Checks if `predicate` returns truthy for **any** element of `collection`.
  27445. * Iteration is stopped once `predicate` returns truthy. The predicate is
  27446. * invoked with three arguments: (value, index|key, collection).
  27447. *
  27448. * @static
  27449. * @memberOf _
  27450. * @since 0.1.0
  27451. * @category Collection
  27452. * @param {Array|Object} collection The collection to iterate over.
  27453. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27454. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27455. * @returns {boolean} Returns `true` if any element passes the predicate check,
  27456. * else `false`.
  27457. * @example
  27458. *
  27459. * _.some([null, 0, 'yes', false], Boolean);
  27460. * // => true
  27461. *
  27462. * var users = [
  27463. * { 'user': 'barney', 'active': true },
  27464. * { 'user': 'fred', 'active': false }
  27465. * ];
  27466. *
  27467. * // The `_.matches` iteratee shorthand.
  27468. * _.some(users, { 'user': 'barney', 'active': false });
  27469. * // => false
  27470. *
  27471. * // The `_.matchesProperty` iteratee shorthand.
  27472. * _.some(users, ['active', false]);
  27473. * // => true
  27474. *
  27475. * // The `_.property` iteratee shorthand.
  27476. * _.some(users, 'active');
  27477. * // => true
  27478. */
  27479. function some(collection, predicate, guard) {
  27480. var func = isArray(collection) ? arraySome : baseSome;
  27481. if (guard && isIterateeCall(collection, predicate, guard)) {
  27482. predicate = undefined;
  27483. }
  27484. return func(collection, getIteratee(predicate, 3));
  27485. }
  27486. /**
  27487. * Creates an array of elements, sorted in ascending order by the results of
  27488. * running each element in a collection thru each iteratee. This method
  27489. * performs a stable sort, that is, it preserves the original sort order of
  27490. * equal elements. The iteratees are invoked with one argument: (value).
  27491. *
  27492. * @static
  27493. * @memberOf _
  27494. * @since 0.1.0
  27495. * @category Collection
  27496. * @param {Array|Object} collection The collection to iterate over.
  27497. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  27498. * The iteratees to sort by.
  27499. * @returns {Array} Returns the new sorted array.
  27500. * @example
  27501. *
  27502. * var users = [
  27503. * { 'user': 'fred', 'age': 48 },
  27504. * { 'user': 'barney', 'age': 36 },
  27505. * { 'user': 'fred', 'age': 40 },
  27506. * { 'user': 'barney', 'age': 34 }
  27507. * ];
  27508. *
  27509. * _.sortBy(users, [function(o) { return o.user; }]);
  27510. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27511. *
  27512. * _.sortBy(users, ['user', 'age']);
  27513. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  27514. */
  27515. var sortBy = baseRest(function(collection, iteratees) {
  27516. if (collection == null) {
  27517. return [];
  27518. }
  27519. var length = iteratees.length;
  27520. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  27521. iteratees = [];
  27522. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  27523. iteratees = [iteratees[0]];
  27524. }
  27525. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  27526. });
  27527. /*------------------------------------------------------------------------*/
  27528. /**
  27529. * Gets the timestamp of the number of milliseconds that have elapsed since
  27530. * the Unix epoch (1 January 1970 00:00:00 UTC).
  27531. *
  27532. * @static
  27533. * @memberOf _
  27534. * @since 2.4.0
  27535. * @category Date
  27536. * @returns {number} Returns the timestamp.
  27537. * @example
  27538. *
  27539. * _.defer(function(stamp) {
  27540. * console.log(_.now() - stamp);
  27541. * }, _.now());
  27542. * // => Logs the number of milliseconds it took for the deferred invocation.
  27543. */
  27544. var now = ctxNow || function() {
  27545. return root.Date.now();
  27546. };
  27547. /*------------------------------------------------------------------------*/
  27548. /**
  27549. * The opposite of `_.before`; this method creates a function that invokes
  27550. * `func` once it's called `n` or more times.
  27551. *
  27552. * @static
  27553. * @memberOf _
  27554. * @since 0.1.0
  27555. * @category Function
  27556. * @param {number} n The number of calls before `func` is invoked.
  27557. * @param {Function} func The function to restrict.
  27558. * @returns {Function} Returns the new restricted function.
  27559. * @example
  27560. *
  27561. * var saves = ['profile', 'settings'];
  27562. *
  27563. * var done = _.after(saves.length, function() {
  27564. * console.log('done saving!');
  27565. * });
  27566. *
  27567. * _.forEach(saves, function(type) {
  27568. * asyncSave({ 'type': type, 'complete': done });
  27569. * });
  27570. * // => Logs 'done saving!' after the two async saves have completed.
  27571. */
  27572. function after(n, func) {
  27573. if (typeof func != 'function') {
  27574. throw new TypeError(FUNC_ERROR_TEXT);
  27575. }
  27576. n = toInteger(n);
  27577. return function() {
  27578. if (--n < 1) {
  27579. return func.apply(this, arguments);
  27580. }
  27581. };
  27582. }
  27583. /**
  27584. * Creates a function that invokes `func`, with up to `n` arguments,
  27585. * ignoring any additional arguments.
  27586. *
  27587. * @static
  27588. * @memberOf _
  27589. * @since 3.0.0
  27590. * @category Function
  27591. * @param {Function} func The function to cap arguments for.
  27592. * @param {number} [n=func.length] The arity cap.
  27593. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27594. * @returns {Function} Returns the new capped function.
  27595. * @example
  27596. *
  27597. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  27598. * // => [6, 8, 10]
  27599. */
  27600. function ary(func, n, guard) {
  27601. n = guard ? undefined : n;
  27602. n = (func && n == null) ? func.length : n;
  27603. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  27604. }
  27605. /**
  27606. * Creates a function that invokes `func`, with the `this` binding and arguments
  27607. * of the created function, while it's called less than `n` times. Subsequent
  27608. * calls to the created function return the result of the last `func` invocation.
  27609. *
  27610. * @static
  27611. * @memberOf _
  27612. * @since 3.0.0
  27613. * @category Function
  27614. * @param {number} n The number of calls at which `func` is no longer invoked.
  27615. * @param {Function} func The function to restrict.
  27616. * @returns {Function} Returns the new restricted function.
  27617. * @example
  27618. *
  27619. * jQuery(element).on('click', _.before(5, addContactToList));
  27620. * // => Allows adding up to 4 contacts to the list.
  27621. */
  27622. function before(n, func) {
  27623. var result;
  27624. if (typeof func != 'function') {
  27625. throw new TypeError(FUNC_ERROR_TEXT);
  27626. }
  27627. n = toInteger(n);
  27628. return function() {
  27629. if (--n > 0) {
  27630. result = func.apply(this, arguments);
  27631. }
  27632. if (n <= 1) {
  27633. func = undefined;
  27634. }
  27635. return result;
  27636. };
  27637. }
  27638. /**
  27639. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  27640. * and `partials` prepended to the arguments it receives.
  27641. *
  27642. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  27643. * may be used as a placeholder for partially applied arguments.
  27644. *
  27645. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  27646. * property of bound functions.
  27647. *
  27648. * @static
  27649. * @memberOf _
  27650. * @since 0.1.0
  27651. * @category Function
  27652. * @param {Function} func The function to bind.
  27653. * @param {*} thisArg The `this` binding of `func`.
  27654. * @param {...*} [partials] The arguments to be partially applied.
  27655. * @returns {Function} Returns the new bound function.
  27656. * @example
  27657. *
  27658. * function greet(greeting, punctuation) {
  27659. * return greeting + ' ' + this.user + punctuation;
  27660. * }
  27661. *
  27662. * var object = { 'user': 'fred' };
  27663. *
  27664. * var bound = _.bind(greet, object, 'hi');
  27665. * bound('!');
  27666. * // => 'hi fred!'
  27667. *
  27668. * // Bound with placeholders.
  27669. * var bound = _.bind(greet, object, _, '!');
  27670. * bound('hi');
  27671. * // => 'hi fred!'
  27672. */
  27673. var bind = baseRest(function(func, thisArg, partials) {
  27674. var bitmask = WRAP_BIND_FLAG;
  27675. if (partials.length) {
  27676. var holders = replaceHolders(partials, getHolder(bind));
  27677. bitmask |= WRAP_PARTIAL_FLAG;
  27678. }
  27679. return createWrap(func, bitmask, thisArg, partials, holders);
  27680. });
  27681. /**
  27682. * Creates a function that invokes the method at `object[key]` with `partials`
  27683. * prepended to the arguments it receives.
  27684. *
  27685. * This method differs from `_.bind` by allowing bound functions to reference
  27686. * methods that may be redefined or don't yet exist. See
  27687. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  27688. * for more details.
  27689. *
  27690. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  27691. * builds, may be used as a placeholder for partially applied arguments.
  27692. *
  27693. * @static
  27694. * @memberOf _
  27695. * @since 0.10.0
  27696. * @category Function
  27697. * @param {Object} object The object to invoke the method on.
  27698. * @param {string} key The key of the method.
  27699. * @param {...*} [partials] The arguments to be partially applied.
  27700. * @returns {Function} Returns the new bound function.
  27701. * @example
  27702. *
  27703. * var object = {
  27704. * 'user': 'fred',
  27705. * 'greet': function(greeting, punctuation) {
  27706. * return greeting + ' ' + this.user + punctuation;
  27707. * }
  27708. * };
  27709. *
  27710. * var bound = _.bindKey(object, 'greet', 'hi');
  27711. * bound('!');
  27712. * // => 'hi fred!'
  27713. *
  27714. * object.greet = function(greeting, punctuation) {
  27715. * return greeting + 'ya ' + this.user + punctuation;
  27716. * };
  27717. *
  27718. * bound('!');
  27719. * // => 'hiya fred!'
  27720. *
  27721. * // Bound with placeholders.
  27722. * var bound = _.bindKey(object, 'greet', _, '!');
  27723. * bound('hi');
  27724. * // => 'hiya fred!'
  27725. */
  27726. var bindKey = baseRest(function(object, key, partials) {
  27727. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  27728. if (partials.length) {
  27729. var holders = replaceHolders(partials, getHolder(bindKey));
  27730. bitmask |= WRAP_PARTIAL_FLAG;
  27731. }
  27732. return createWrap(key, bitmask, object, partials, holders);
  27733. });
  27734. /**
  27735. * Creates a function that accepts arguments of `func` and either invokes
  27736. * `func` returning its result, if at least `arity` number of arguments have
  27737. * been provided, or returns a function that accepts the remaining `func`
  27738. * arguments, and so on. The arity of `func` may be specified if `func.length`
  27739. * is not sufficient.
  27740. *
  27741. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  27742. * may be used as a placeholder for provided arguments.
  27743. *
  27744. * **Note:** This method doesn't set the "length" property of curried functions.
  27745. *
  27746. * @static
  27747. * @memberOf _
  27748. * @since 2.0.0
  27749. * @category Function
  27750. * @param {Function} func The function to curry.
  27751. * @param {number} [arity=func.length] The arity of `func`.
  27752. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27753. * @returns {Function} Returns the new curried function.
  27754. * @example
  27755. *
  27756. * var abc = function(a, b, c) {
  27757. * return [a, b, c];
  27758. * };
  27759. *
  27760. * var curried = _.curry(abc);
  27761. *
  27762. * curried(1)(2)(3);
  27763. * // => [1, 2, 3]
  27764. *
  27765. * curried(1, 2)(3);
  27766. * // => [1, 2, 3]
  27767. *
  27768. * curried(1, 2, 3);
  27769. * // => [1, 2, 3]
  27770. *
  27771. * // Curried with placeholders.
  27772. * curried(1)(_, 3)(2);
  27773. * // => [1, 2, 3]
  27774. */
  27775. function curry(func, arity, guard) {
  27776. arity = guard ? undefined : arity;
  27777. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27778. result.placeholder = curry.placeholder;
  27779. return result;
  27780. }
  27781. /**
  27782. * This method is like `_.curry` except that arguments are applied to `func`
  27783. * in the manner of `_.partialRight` instead of `_.partial`.
  27784. *
  27785. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  27786. * builds, may be used as a placeholder for provided arguments.
  27787. *
  27788. * **Note:** This method doesn't set the "length" property of curried functions.
  27789. *
  27790. * @static
  27791. * @memberOf _
  27792. * @since 3.0.0
  27793. * @category Function
  27794. * @param {Function} func The function to curry.
  27795. * @param {number} [arity=func.length] The arity of `func`.
  27796. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27797. * @returns {Function} Returns the new curried function.
  27798. * @example
  27799. *
  27800. * var abc = function(a, b, c) {
  27801. * return [a, b, c];
  27802. * };
  27803. *
  27804. * var curried = _.curryRight(abc);
  27805. *
  27806. * curried(3)(2)(1);
  27807. * // => [1, 2, 3]
  27808. *
  27809. * curried(2, 3)(1);
  27810. * // => [1, 2, 3]
  27811. *
  27812. * curried(1, 2, 3);
  27813. * // => [1, 2, 3]
  27814. *
  27815. * // Curried with placeholders.
  27816. * curried(3)(1, _)(2);
  27817. * // => [1, 2, 3]
  27818. */
  27819. function curryRight(func, arity, guard) {
  27820. arity = guard ? undefined : arity;
  27821. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27822. result.placeholder = curryRight.placeholder;
  27823. return result;
  27824. }
  27825. /**
  27826. * Creates a debounced function that delays invoking `func` until after `wait`
  27827. * milliseconds have elapsed since the last time the debounced function was
  27828. * invoked. The debounced function comes with a `cancel` method to cancel
  27829. * delayed `func` invocations and a `flush` method to immediately invoke them.
  27830. * Provide `options` to indicate whether `func` should be invoked on the
  27831. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  27832. * with the last arguments provided to the debounced function. Subsequent
  27833. * calls to the debounced function return the result of the last `func`
  27834. * invocation.
  27835. *
  27836. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27837. * invoked on the trailing edge of the timeout only if the debounced function
  27838. * is invoked more than once during the `wait` timeout.
  27839. *
  27840. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27841. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27842. *
  27843. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27844. * for details over the differences between `_.debounce` and `_.throttle`.
  27845. *
  27846. * @static
  27847. * @memberOf _
  27848. * @since 0.1.0
  27849. * @category Function
  27850. * @param {Function} func The function to debounce.
  27851. * @param {number} [wait=0] The number of milliseconds to delay.
  27852. * @param {Object} [options={}] The options object.
  27853. * @param {boolean} [options.leading=false]
  27854. * Specify invoking on the leading edge of the timeout.
  27855. * @param {number} [options.maxWait]
  27856. * The maximum time `func` is allowed to be delayed before it's invoked.
  27857. * @param {boolean} [options.trailing=true]
  27858. * Specify invoking on the trailing edge of the timeout.
  27859. * @returns {Function} Returns the new debounced function.
  27860. * @example
  27861. *
  27862. * // Avoid costly calculations while the window size is in flux.
  27863. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  27864. *
  27865. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  27866. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  27867. * 'leading': true,
  27868. * 'trailing': false
  27869. * }));
  27870. *
  27871. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  27872. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  27873. * var source = new EventSource('/stream');
  27874. * jQuery(source).on('message', debounced);
  27875. *
  27876. * // Cancel the trailing debounced invocation.
  27877. * jQuery(window).on('popstate', debounced.cancel);
  27878. */
  27879. function debounce(func, wait, options) {
  27880. var lastArgs,
  27881. lastThis,
  27882. maxWait,
  27883. result,
  27884. timerId,
  27885. lastCallTime,
  27886. lastInvokeTime = 0,
  27887. leading = false,
  27888. maxing = false,
  27889. trailing = true;
  27890. if (typeof func != 'function') {
  27891. throw new TypeError(FUNC_ERROR_TEXT);
  27892. }
  27893. wait = toNumber(wait) || 0;
  27894. if (isObject(options)) {
  27895. leading = !!options.leading;
  27896. maxing = 'maxWait' in options;
  27897. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  27898. trailing = 'trailing' in options ? !!options.trailing : trailing;
  27899. }
  27900. function invokeFunc(time) {
  27901. var args = lastArgs,
  27902. thisArg = lastThis;
  27903. lastArgs = lastThis = undefined;
  27904. lastInvokeTime = time;
  27905. result = func.apply(thisArg, args);
  27906. return result;
  27907. }
  27908. function leadingEdge(time) {
  27909. // Reset any `maxWait` timer.
  27910. lastInvokeTime = time;
  27911. // Start the timer for the trailing edge.
  27912. timerId = setTimeout(timerExpired, wait);
  27913. // Invoke the leading edge.
  27914. return leading ? invokeFunc(time) : result;
  27915. }
  27916. function remainingWait(time) {
  27917. var timeSinceLastCall = time - lastCallTime,
  27918. timeSinceLastInvoke = time - lastInvokeTime,
  27919. timeWaiting = wait - timeSinceLastCall;
  27920. return maxing
  27921. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  27922. : timeWaiting;
  27923. }
  27924. function shouldInvoke(time) {
  27925. var timeSinceLastCall = time - lastCallTime,
  27926. timeSinceLastInvoke = time - lastInvokeTime;
  27927. // Either this is the first call, activity has stopped and we're at the
  27928. // trailing edge, the system time has gone backwards and we're treating
  27929. // it as the trailing edge, or we've hit the `maxWait` limit.
  27930. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  27931. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  27932. }
  27933. function timerExpired() {
  27934. var time = now();
  27935. if (shouldInvoke(time)) {
  27936. return trailingEdge(time);
  27937. }
  27938. // Restart the timer.
  27939. timerId = setTimeout(timerExpired, remainingWait(time));
  27940. }
  27941. function trailingEdge(time) {
  27942. timerId = undefined;
  27943. // Only invoke if we have `lastArgs` which means `func` has been
  27944. // debounced at least once.
  27945. if (trailing && lastArgs) {
  27946. return invokeFunc(time);
  27947. }
  27948. lastArgs = lastThis = undefined;
  27949. return result;
  27950. }
  27951. function cancel() {
  27952. if (timerId !== undefined) {
  27953. clearTimeout(timerId);
  27954. }
  27955. lastInvokeTime = 0;
  27956. lastArgs = lastCallTime = lastThis = timerId = undefined;
  27957. }
  27958. function flush() {
  27959. return timerId === undefined ? result : trailingEdge(now());
  27960. }
  27961. function debounced() {
  27962. var time = now(),
  27963. isInvoking = shouldInvoke(time);
  27964. lastArgs = arguments;
  27965. lastThis = this;
  27966. lastCallTime = time;
  27967. if (isInvoking) {
  27968. if (timerId === undefined) {
  27969. return leadingEdge(lastCallTime);
  27970. }
  27971. if (maxing) {
  27972. // Handle invocations in a tight loop.
  27973. clearTimeout(timerId);
  27974. timerId = setTimeout(timerExpired, wait);
  27975. return invokeFunc(lastCallTime);
  27976. }
  27977. }
  27978. if (timerId === undefined) {
  27979. timerId = setTimeout(timerExpired, wait);
  27980. }
  27981. return result;
  27982. }
  27983. debounced.cancel = cancel;
  27984. debounced.flush = flush;
  27985. return debounced;
  27986. }
  27987. /**
  27988. * Defers invoking the `func` until the current call stack has cleared. Any
  27989. * additional arguments are provided to `func` when it's invoked.
  27990. *
  27991. * @static
  27992. * @memberOf _
  27993. * @since 0.1.0
  27994. * @category Function
  27995. * @param {Function} func The function to defer.
  27996. * @param {...*} [args] The arguments to invoke `func` with.
  27997. * @returns {number} Returns the timer id.
  27998. * @example
  27999. *
  28000. * _.defer(function(text) {
  28001. * console.log(text);
  28002. * }, 'deferred');
  28003. * // => Logs 'deferred' after one millisecond.
  28004. */
  28005. var defer = baseRest(function(func, args) {
  28006. return baseDelay(func, 1, args);
  28007. });
  28008. /**
  28009. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  28010. * provided to `func` when it's invoked.
  28011. *
  28012. * @static
  28013. * @memberOf _
  28014. * @since 0.1.0
  28015. * @category Function
  28016. * @param {Function} func The function to delay.
  28017. * @param {number} wait The number of milliseconds to delay invocation.
  28018. * @param {...*} [args] The arguments to invoke `func` with.
  28019. * @returns {number} Returns the timer id.
  28020. * @example
  28021. *
  28022. * _.delay(function(text) {
  28023. * console.log(text);
  28024. * }, 1000, 'later');
  28025. * // => Logs 'later' after one second.
  28026. */
  28027. var delay = baseRest(function(func, wait, args) {
  28028. return baseDelay(func, toNumber(wait) || 0, args);
  28029. });
  28030. /**
  28031. * Creates a function that invokes `func` with arguments reversed.
  28032. *
  28033. * @static
  28034. * @memberOf _
  28035. * @since 4.0.0
  28036. * @category Function
  28037. * @param {Function} func The function to flip arguments for.
  28038. * @returns {Function} Returns the new flipped function.
  28039. * @example
  28040. *
  28041. * var flipped = _.flip(function() {
  28042. * return _.toArray(arguments);
  28043. * });
  28044. *
  28045. * flipped('a', 'b', 'c', 'd');
  28046. * // => ['d', 'c', 'b', 'a']
  28047. */
  28048. function flip(func) {
  28049. return createWrap(func, WRAP_FLIP_FLAG);
  28050. }
  28051. /**
  28052. * Creates a function that memoizes the result of `func`. If `resolver` is
  28053. * provided, it determines the cache key for storing the result based on the
  28054. * arguments provided to the memoized function. By default, the first argument
  28055. * provided to the memoized function is used as the map cache key. The `func`
  28056. * is invoked with the `this` binding of the memoized function.
  28057. *
  28058. * **Note:** The cache is exposed as the `cache` property on the memoized
  28059. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  28060. * constructor with one whose instances implement the
  28061. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  28062. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  28063. *
  28064. * @static
  28065. * @memberOf _
  28066. * @since 0.1.0
  28067. * @category Function
  28068. * @param {Function} func The function to have its output memoized.
  28069. * @param {Function} [resolver] The function to resolve the cache key.
  28070. * @returns {Function} Returns the new memoized function.
  28071. * @example
  28072. *
  28073. * var object = { 'a': 1, 'b': 2 };
  28074. * var other = { 'c': 3, 'd': 4 };
  28075. *
  28076. * var values = _.memoize(_.values);
  28077. * values(object);
  28078. * // => [1, 2]
  28079. *
  28080. * values(other);
  28081. * // => [3, 4]
  28082. *
  28083. * object.a = 2;
  28084. * values(object);
  28085. * // => [1, 2]
  28086. *
  28087. * // Modify the result cache.
  28088. * values.cache.set(object, ['a', 'b']);
  28089. * values(object);
  28090. * // => ['a', 'b']
  28091. *
  28092. * // Replace `_.memoize.Cache`.
  28093. * _.memoize.Cache = WeakMap;
  28094. */
  28095. function memoize(func, resolver) {
  28096. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  28097. throw new TypeError(FUNC_ERROR_TEXT);
  28098. }
  28099. var memoized = function() {
  28100. var args = arguments,
  28101. key = resolver ? resolver.apply(this, args) : args[0],
  28102. cache = memoized.cache;
  28103. if (cache.has(key)) {
  28104. return cache.get(key);
  28105. }
  28106. var result = func.apply(this, args);
  28107. memoized.cache = cache.set(key, result) || cache;
  28108. return result;
  28109. };
  28110. memoized.cache = new (memoize.Cache || MapCache);
  28111. return memoized;
  28112. }
  28113. // Expose `MapCache`.
  28114. memoize.Cache = MapCache;
  28115. /**
  28116. * Creates a function that negates the result of the predicate `func`. The
  28117. * `func` predicate is invoked with the `this` binding and arguments of the
  28118. * created function.
  28119. *
  28120. * @static
  28121. * @memberOf _
  28122. * @since 3.0.0
  28123. * @category Function
  28124. * @param {Function} predicate The predicate to negate.
  28125. * @returns {Function} Returns the new negated function.
  28126. * @example
  28127. *
  28128. * function isEven(n) {
  28129. * return n % 2 == 0;
  28130. * }
  28131. *
  28132. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  28133. * // => [1, 3, 5]
  28134. */
  28135. function negate(predicate) {
  28136. if (typeof predicate != 'function') {
  28137. throw new TypeError(FUNC_ERROR_TEXT);
  28138. }
  28139. return function() {
  28140. var args = arguments;
  28141. switch (args.length) {
  28142. case 0: return !predicate.call(this);
  28143. case 1: return !predicate.call(this, args[0]);
  28144. case 2: return !predicate.call(this, args[0], args[1]);
  28145. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  28146. }
  28147. return !predicate.apply(this, args);
  28148. };
  28149. }
  28150. /**
  28151. * Creates a function that is restricted to invoking `func` once. Repeat calls
  28152. * to the function return the value of the first invocation. The `func` is
  28153. * invoked with the `this` binding and arguments of the created function.
  28154. *
  28155. * @static
  28156. * @memberOf _
  28157. * @since 0.1.0
  28158. * @category Function
  28159. * @param {Function} func The function to restrict.
  28160. * @returns {Function} Returns the new restricted function.
  28161. * @example
  28162. *
  28163. * var initialize = _.once(createApplication);
  28164. * initialize();
  28165. * initialize();
  28166. * // => `createApplication` is invoked once
  28167. */
  28168. function once(func) {
  28169. return before(2, func);
  28170. }
  28171. /**
  28172. * Creates a function that invokes `func` with its arguments transformed.
  28173. *
  28174. * @static
  28175. * @since 4.0.0
  28176. * @memberOf _
  28177. * @category Function
  28178. * @param {Function} func The function to wrap.
  28179. * @param {...(Function|Function[])} [transforms=[_.identity]]
  28180. * The argument transforms.
  28181. * @returns {Function} Returns the new function.
  28182. * @example
  28183. *
  28184. * function doubled(n) {
  28185. * return n * 2;
  28186. * }
  28187. *
  28188. * function square(n) {
  28189. * return n * n;
  28190. * }
  28191. *
  28192. * var func = _.overArgs(function(x, y) {
  28193. * return [x, y];
  28194. * }, [square, doubled]);
  28195. *
  28196. * func(9, 3);
  28197. * // => [81, 6]
  28198. *
  28199. * func(10, 5);
  28200. * // => [100, 10]
  28201. */
  28202. var overArgs = castRest(function(func, transforms) {
  28203. transforms = (transforms.length == 1 && isArray(transforms[0]))
  28204. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  28205. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  28206. var funcsLength = transforms.length;
  28207. return baseRest(function(args) {
  28208. var index = -1,
  28209. length = nativeMin(args.length, funcsLength);
  28210. while (++index < length) {
  28211. args[index] = transforms[index].call(this, args[index]);
  28212. }
  28213. return apply(func, this, args);
  28214. });
  28215. });
  28216. /**
  28217. * Creates a function that invokes `func` with `partials` prepended to the
  28218. * arguments it receives. This method is like `_.bind` except it does **not**
  28219. * alter the `this` binding.
  28220. *
  28221. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  28222. * builds, may be used as a placeholder for partially applied arguments.
  28223. *
  28224. * **Note:** This method doesn't set the "length" property of partially
  28225. * applied functions.
  28226. *
  28227. * @static
  28228. * @memberOf _
  28229. * @since 0.2.0
  28230. * @category Function
  28231. * @param {Function} func The function to partially apply arguments to.
  28232. * @param {...*} [partials] The arguments to be partially applied.
  28233. * @returns {Function} Returns the new partially applied function.
  28234. * @example
  28235. *
  28236. * function greet(greeting, name) {
  28237. * return greeting + ' ' + name;
  28238. * }
  28239. *
  28240. * var sayHelloTo = _.partial(greet, 'hello');
  28241. * sayHelloTo('fred');
  28242. * // => 'hello fred'
  28243. *
  28244. * // Partially applied with placeholders.
  28245. * var greetFred = _.partial(greet, _, 'fred');
  28246. * greetFred('hi');
  28247. * // => 'hi fred'
  28248. */
  28249. var partial = baseRest(function(func, partials) {
  28250. var holders = replaceHolders(partials, getHolder(partial));
  28251. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  28252. });
  28253. /**
  28254. * This method is like `_.partial` except that partially applied arguments
  28255. * are appended to the arguments it receives.
  28256. *
  28257. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  28258. * builds, may be used as a placeholder for partially applied arguments.
  28259. *
  28260. * **Note:** This method doesn't set the "length" property of partially
  28261. * applied functions.
  28262. *
  28263. * @static
  28264. * @memberOf _
  28265. * @since 1.0.0
  28266. * @category Function
  28267. * @param {Function} func The function to partially apply arguments to.
  28268. * @param {...*} [partials] The arguments to be partially applied.
  28269. * @returns {Function} Returns the new partially applied function.
  28270. * @example
  28271. *
  28272. * function greet(greeting, name) {
  28273. * return greeting + ' ' + name;
  28274. * }
  28275. *
  28276. * var greetFred = _.partialRight(greet, 'fred');
  28277. * greetFred('hi');
  28278. * // => 'hi fred'
  28279. *
  28280. * // Partially applied with placeholders.
  28281. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  28282. * sayHelloTo('fred');
  28283. * // => 'hello fred'
  28284. */
  28285. var partialRight = baseRest(function(func, partials) {
  28286. var holders = replaceHolders(partials, getHolder(partialRight));
  28287. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  28288. });
  28289. /**
  28290. * Creates a function that invokes `func` with arguments arranged according
  28291. * to the specified `indexes` where the argument value at the first index is
  28292. * provided as the first argument, the argument value at the second index is
  28293. * provided as the second argument, and so on.
  28294. *
  28295. * @static
  28296. * @memberOf _
  28297. * @since 3.0.0
  28298. * @category Function
  28299. * @param {Function} func The function to rearrange arguments for.
  28300. * @param {...(number|number[])} indexes The arranged argument indexes.
  28301. * @returns {Function} Returns the new function.
  28302. * @example
  28303. *
  28304. * var rearged = _.rearg(function(a, b, c) {
  28305. * return [a, b, c];
  28306. * }, [2, 0, 1]);
  28307. *
  28308. * rearged('b', 'c', 'a')
  28309. * // => ['a', 'b', 'c']
  28310. */
  28311. var rearg = flatRest(function(func, indexes) {
  28312. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  28313. });
  28314. /**
  28315. * Creates a function that invokes `func` with the `this` binding of the
  28316. * created function and arguments from `start` and beyond provided as
  28317. * an array.
  28318. *
  28319. * **Note:** This method is based on the
  28320. * [rest parameter](https://mdn.io/rest_parameters).
  28321. *
  28322. * @static
  28323. * @memberOf _
  28324. * @since 4.0.0
  28325. * @category Function
  28326. * @param {Function} func The function to apply a rest parameter to.
  28327. * @param {number} [start=func.length-1] The start position of the rest parameter.
  28328. * @returns {Function} Returns the new function.
  28329. * @example
  28330. *
  28331. * var say = _.rest(function(what, names) {
  28332. * return what + ' ' + _.initial(names).join(', ') +
  28333. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  28334. * });
  28335. *
  28336. * say('hello', 'fred', 'barney', 'pebbles');
  28337. * // => 'hello fred, barney, & pebbles'
  28338. */
  28339. function rest(func, start) {
  28340. if (typeof func != 'function') {
  28341. throw new TypeError(FUNC_ERROR_TEXT);
  28342. }
  28343. start = start === undefined ? start : toInteger(start);
  28344. return baseRest(func, start);
  28345. }
  28346. /**
  28347. * Creates a function that invokes `func` with the `this` binding of the
  28348. * create function and an array of arguments much like
  28349. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  28350. *
  28351. * **Note:** This method is based on the
  28352. * [spread operator](https://mdn.io/spread_operator).
  28353. *
  28354. * @static
  28355. * @memberOf _
  28356. * @since 3.2.0
  28357. * @category Function
  28358. * @param {Function} func The function to spread arguments over.
  28359. * @param {number} [start=0] The start position of the spread.
  28360. * @returns {Function} Returns the new function.
  28361. * @example
  28362. *
  28363. * var say = _.spread(function(who, what) {
  28364. * return who + ' says ' + what;
  28365. * });
  28366. *
  28367. * say(['fred', 'hello']);
  28368. * // => 'fred says hello'
  28369. *
  28370. * var numbers = Promise.all([
  28371. * Promise.resolve(40),
  28372. * Promise.resolve(36)
  28373. * ]);
  28374. *
  28375. * numbers.then(_.spread(function(x, y) {
  28376. * return x + y;
  28377. * }));
  28378. * // => a Promise of 76
  28379. */
  28380. function spread(func, start) {
  28381. if (typeof func != 'function') {
  28382. throw new TypeError(FUNC_ERROR_TEXT);
  28383. }
  28384. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  28385. return baseRest(function(args) {
  28386. var array = args[start],
  28387. otherArgs = castSlice(args, 0, start);
  28388. if (array) {
  28389. arrayPush(otherArgs, array);
  28390. }
  28391. return apply(func, this, otherArgs);
  28392. });
  28393. }
  28394. /**
  28395. * Creates a throttled function that only invokes `func` at most once per
  28396. * every `wait` milliseconds. The throttled function comes with a `cancel`
  28397. * method to cancel delayed `func` invocations and a `flush` method to
  28398. * immediately invoke them. Provide `options` to indicate whether `func`
  28399. * should be invoked on the leading and/or trailing edge of the `wait`
  28400. * timeout. The `func` is invoked with the last arguments provided to the
  28401. * throttled function. Subsequent calls to the throttled function return the
  28402. * result of the last `func` invocation.
  28403. *
  28404. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28405. * invoked on the trailing edge of the timeout only if the throttled function
  28406. * is invoked more than once during the `wait` timeout.
  28407. *
  28408. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28409. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28410. *
  28411. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28412. * for details over the differences between `_.throttle` and `_.debounce`.
  28413. *
  28414. * @static
  28415. * @memberOf _
  28416. * @since 0.1.0
  28417. * @category Function
  28418. * @param {Function} func The function to throttle.
  28419. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  28420. * @param {Object} [options={}] The options object.
  28421. * @param {boolean} [options.leading=true]
  28422. * Specify invoking on the leading edge of the timeout.
  28423. * @param {boolean} [options.trailing=true]
  28424. * Specify invoking on the trailing edge of the timeout.
  28425. * @returns {Function} Returns the new throttled function.
  28426. * @example
  28427. *
  28428. * // Avoid excessively updating the position while scrolling.
  28429. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  28430. *
  28431. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  28432. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  28433. * jQuery(element).on('click', throttled);
  28434. *
  28435. * // Cancel the trailing throttled invocation.
  28436. * jQuery(window).on('popstate', throttled.cancel);
  28437. */
  28438. function throttle(func, wait, options) {
  28439. var leading = true,
  28440. trailing = true;
  28441. if (typeof func != 'function') {
  28442. throw new TypeError(FUNC_ERROR_TEXT);
  28443. }
  28444. if (isObject(options)) {
  28445. leading = 'leading' in options ? !!options.leading : leading;
  28446. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28447. }
  28448. return debounce(func, wait, {
  28449. 'leading': leading,
  28450. 'maxWait': wait,
  28451. 'trailing': trailing
  28452. });
  28453. }
  28454. /**
  28455. * Creates a function that accepts up to one argument, ignoring any
  28456. * additional arguments.
  28457. *
  28458. * @static
  28459. * @memberOf _
  28460. * @since 4.0.0
  28461. * @category Function
  28462. * @param {Function} func The function to cap arguments for.
  28463. * @returns {Function} Returns the new capped function.
  28464. * @example
  28465. *
  28466. * _.map(['6', '8', '10'], _.unary(parseInt));
  28467. * // => [6, 8, 10]
  28468. */
  28469. function unary(func) {
  28470. return ary(func, 1);
  28471. }
  28472. /**
  28473. * Creates a function that provides `value` to `wrapper` as its first
  28474. * argument. Any additional arguments provided to the function are appended
  28475. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  28476. * binding of the created function.
  28477. *
  28478. * @static
  28479. * @memberOf _
  28480. * @since 0.1.0
  28481. * @category Function
  28482. * @param {*} value The value to wrap.
  28483. * @param {Function} [wrapper=identity] The wrapper function.
  28484. * @returns {Function} Returns the new function.
  28485. * @example
  28486. *
  28487. * var p = _.wrap(_.escape, function(func, text) {
  28488. * return '<p>' + func(text) + '</p>';
  28489. * });
  28490. *
  28491. * p('fred, barney, & pebbles');
  28492. * // => '<p>fred, barney, &amp; pebbles</p>'
  28493. */
  28494. function wrap(value, wrapper) {
  28495. return partial(castFunction(wrapper), value);
  28496. }
  28497. /*------------------------------------------------------------------------*/
  28498. /**
  28499. * Casts `value` as an array if it's not one.
  28500. *
  28501. * @static
  28502. * @memberOf _
  28503. * @since 4.4.0
  28504. * @category Lang
  28505. * @param {*} value The value to inspect.
  28506. * @returns {Array} Returns the cast array.
  28507. * @example
  28508. *
  28509. * _.castArray(1);
  28510. * // => [1]
  28511. *
  28512. * _.castArray({ 'a': 1 });
  28513. * // => [{ 'a': 1 }]
  28514. *
  28515. * _.castArray('abc');
  28516. * // => ['abc']
  28517. *
  28518. * _.castArray(null);
  28519. * // => [null]
  28520. *
  28521. * _.castArray(undefined);
  28522. * // => [undefined]
  28523. *
  28524. * _.castArray();
  28525. * // => []
  28526. *
  28527. * var array = [1, 2, 3];
  28528. * console.log(_.castArray(array) === array);
  28529. * // => true
  28530. */
  28531. function castArray() {
  28532. if (!arguments.length) {
  28533. return [];
  28534. }
  28535. var value = arguments[0];
  28536. return isArray(value) ? value : [value];
  28537. }
  28538. /**
  28539. * Creates a shallow clone of `value`.
  28540. *
  28541. * **Note:** This method is loosely based on the
  28542. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  28543. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  28544. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  28545. * arrays. The own enumerable properties of `arguments` objects are cloned
  28546. * as plain objects. An empty object is returned for uncloneable values such
  28547. * as error objects, functions, DOM nodes, and WeakMaps.
  28548. *
  28549. * @static
  28550. * @memberOf _
  28551. * @since 0.1.0
  28552. * @category Lang
  28553. * @param {*} value The value to clone.
  28554. * @returns {*} Returns the cloned value.
  28555. * @see _.cloneDeep
  28556. * @example
  28557. *
  28558. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28559. *
  28560. * var shallow = _.clone(objects);
  28561. * console.log(shallow[0] === objects[0]);
  28562. * // => true
  28563. */
  28564. function clone(value) {
  28565. return baseClone(value, CLONE_SYMBOLS_FLAG);
  28566. }
  28567. /**
  28568. * This method is like `_.clone` except that it accepts `customizer` which
  28569. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  28570. * cloning is handled by the method instead. The `customizer` is invoked with
  28571. * up to four arguments; (value [, index|key, object, stack]).
  28572. *
  28573. * @static
  28574. * @memberOf _
  28575. * @since 4.0.0
  28576. * @category Lang
  28577. * @param {*} value The value to clone.
  28578. * @param {Function} [customizer] The function to customize cloning.
  28579. * @returns {*} Returns the cloned value.
  28580. * @see _.cloneDeepWith
  28581. * @example
  28582. *
  28583. * function customizer(value) {
  28584. * if (_.isElement(value)) {
  28585. * return value.cloneNode(false);
  28586. * }
  28587. * }
  28588. *
  28589. * var el = _.cloneWith(document.body, customizer);
  28590. *
  28591. * console.log(el === document.body);
  28592. * // => false
  28593. * console.log(el.nodeName);
  28594. * // => 'BODY'
  28595. * console.log(el.childNodes.length);
  28596. * // => 0
  28597. */
  28598. function cloneWith(value, customizer) {
  28599. customizer = typeof customizer == 'function' ? customizer : undefined;
  28600. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  28601. }
  28602. /**
  28603. * This method is like `_.clone` except that it recursively clones `value`.
  28604. *
  28605. * @static
  28606. * @memberOf _
  28607. * @since 1.0.0
  28608. * @category Lang
  28609. * @param {*} value The value to recursively clone.
  28610. * @returns {*} Returns the deep cloned value.
  28611. * @see _.clone
  28612. * @example
  28613. *
  28614. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28615. *
  28616. * var deep = _.cloneDeep(objects);
  28617. * console.log(deep[0] === objects[0]);
  28618. * // => false
  28619. */
  28620. function cloneDeep(value) {
  28621. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  28622. }
  28623. /**
  28624. * This method is like `_.cloneWith` except that it recursively clones `value`.
  28625. *
  28626. * @static
  28627. * @memberOf _
  28628. * @since 4.0.0
  28629. * @category Lang
  28630. * @param {*} value The value to recursively clone.
  28631. * @param {Function} [customizer] The function to customize cloning.
  28632. * @returns {*} Returns the deep cloned value.
  28633. * @see _.cloneWith
  28634. * @example
  28635. *
  28636. * function customizer(value) {
  28637. * if (_.isElement(value)) {
  28638. * return value.cloneNode(true);
  28639. * }
  28640. * }
  28641. *
  28642. * var el = _.cloneDeepWith(document.body, customizer);
  28643. *
  28644. * console.log(el === document.body);
  28645. * // => false
  28646. * console.log(el.nodeName);
  28647. * // => 'BODY'
  28648. * console.log(el.childNodes.length);
  28649. * // => 20
  28650. */
  28651. function cloneDeepWith(value, customizer) {
  28652. customizer = typeof customizer == 'function' ? customizer : undefined;
  28653. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  28654. }
  28655. /**
  28656. * Checks if `object` conforms to `source` by invoking the predicate
  28657. * properties of `source` with the corresponding property values of `object`.
  28658. *
  28659. * **Note:** This method is equivalent to `_.conforms` when `source` is
  28660. * partially applied.
  28661. *
  28662. * @static
  28663. * @memberOf _
  28664. * @since 4.14.0
  28665. * @category Lang
  28666. * @param {Object} object The object to inspect.
  28667. * @param {Object} source The object of property predicates to conform to.
  28668. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  28669. * @example
  28670. *
  28671. * var object = { 'a': 1, 'b': 2 };
  28672. *
  28673. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  28674. * // => true
  28675. *
  28676. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  28677. * // => false
  28678. */
  28679. function conformsTo(object, source) {
  28680. return source == null || baseConformsTo(object, source, keys(source));
  28681. }
  28682. /**
  28683. * Performs a
  28684. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28685. * comparison between two values to determine if they are equivalent.
  28686. *
  28687. * @static
  28688. * @memberOf _
  28689. * @since 4.0.0
  28690. * @category Lang
  28691. * @param {*} value The value to compare.
  28692. * @param {*} other The other value to compare.
  28693. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28694. * @example
  28695. *
  28696. * var object = { 'a': 1 };
  28697. * var other = { 'a': 1 };
  28698. *
  28699. * _.eq(object, object);
  28700. * // => true
  28701. *
  28702. * _.eq(object, other);
  28703. * // => false
  28704. *
  28705. * _.eq('a', 'a');
  28706. * // => true
  28707. *
  28708. * _.eq('a', Object('a'));
  28709. * // => false
  28710. *
  28711. * _.eq(NaN, NaN);
  28712. * // => true
  28713. */
  28714. function eq(value, other) {
  28715. return value === other || (value !== value && other !== other);
  28716. }
  28717. /**
  28718. * Checks if `value` is greater than `other`.
  28719. *
  28720. * @static
  28721. * @memberOf _
  28722. * @since 3.9.0
  28723. * @category Lang
  28724. * @param {*} value The value to compare.
  28725. * @param {*} other The other value to compare.
  28726. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  28727. * else `false`.
  28728. * @see _.lt
  28729. * @example
  28730. *
  28731. * _.gt(3, 1);
  28732. * // => true
  28733. *
  28734. * _.gt(3, 3);
  28735. * // => false
  28736. *
  28737. * _.gt(1, 3);
  28738. * // => false
  28739. */
  28740. var gt = createRelationalOperation(baseGt);
  28741. /**
  28742. * Checks if `value` is greater than or equal to `other`.
  28743. *
  28744. * @static
  28745. * @memberOf _
  28746. * @since 3.9.0
  28747. * @category Lang
  28748. * @param {*} value The value to compare.
  28749. * @param {*} other The other value to compare.
  28750. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  28751. * `other`, else `false`.
  28752. * @see _.lte
  28753. * @example
  28754. *
  28755. * _.gte(3, 1);
  28756. * // => true
  28757. *
  28758. * _.gte(3, 3);
  28759. * // => true
  28760. *
  28761. * _.gte(1, 3);
  28762. * // => false
  28763. */
  28764. var gte = createRelationalOperation(function(value, other) {
  28765. return value >= other;
  28766. });
  28767. /**
  28768. * Checks if `value` is likely an `arguments` object.
  28769. *
  28770. * @static
  28771. * @memberOf _
  28772. * @since 0.1.0
  28773. * @category Lang
  28774. * @param {*} value The value to check.
  28775. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  28776. * else `false`.
  28777. * @example
  28778. *
  28779. * _.isArguments(function() { return arguments; }());
  28780. * // => true
  28781. *
  28782. * _.isArguments([1, 2, 3]);
  28783. * // => false
  28784. */
  28785. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  28786. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  28787. !propertyIsEnumerable.call(value, 'callee');
  28788. };
  28789. /**
  28790. * Checks if `value` is classified as an `Array` object.
  28791. *
  28792. * @static
  28793. * @memberOf _
  28794. * @since 0.1.0
  28795. * @category Lang
  28796. * @param {*} value The value to check.
  28797. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  28798. * @example
  28799. *
  28800. * _.isArray([1, 2, 3]);
  28801. * // => true
  28802. *
  28803. * _.isArray(document.body.children);
  28804. * // => false
  28805. *
  28806. * _.isArray('abc');
  28807. * // => false
  28808. *
  28809. * _.isArray(_.noop);
  28810. * // => false
  28811. */
  28812. var isArray = Array.isArray;
  28813. /**
  28814. * Checks if `value` is classified as an `ArrayBuffer` object.
  28815. *
  28816. * @static
  28817. * @memberOf _
  28818. * @since 4.3.0
  28819. * @category Lang
  28820. * @param {*} value The value to check.
  28821. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  28822. * @example
  28823. *
  28824. * _.isArrayBuffer(new ArrayBuffer(2));
  28825. * // => true
  28826. *
  28827. * _.isArrayBuffer(new Array(2));
  28828. * // => false
  28829. */
  28830. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  28831. /**
  28832. * Checks if `value` is array-like. A value is considered array-like if it's
  28833. * not a function and has a `value.length` that's an integer greater than or
  28834. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  28835. *
  28836. * @static
  28837. * @memberOf _
  28838. * @since 4.0.0
  28839. * @category Lang
  28840. * @param {*} value The value to check.
  28841. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  28842. * @example
  28843. *
  28844. * _.isArrayLike([1, 2, 3]);
  28845. * // => true
  28846. *
  28847. * _.isArrayLike(document.body.children);
  28848. * // => true
  28849. *
  28850. * _.isArrayLike('abc');
  28851. * // => true
  28852. *
  28853. * _.isArrayLike(_.noop);
  28854. * // => false
  28855. */
  28856. function isArrayLike(value) {
  28857. return value != null && isLength(value.length) && !isFunction(value);
  28858. }
  28859. /**
  28860. * This method is like `_.isArrayLike` except that it also checks if `value`
  28861. * is an object.
  28862. *
  28863. * @static
  28864. * @memberOf _
  28865. * @since 4.0.0
  28866. * @category Lang
  28867. * @param {*} value The value to check.
  28868. * @returns {boolean} Returns `true` if `value` is an array-like object,
  28869. * else `false`.
  28870. * @example
  28871. *
  28872. * _.isArrayLikeObject([1, 2, 3]);
  28873. * // => true
  28874. *
  28875. * _.isArrayLikeObject(document.body.children);
  28876. * // => true
  28877. *
  28878. * _.isArrayLikeObject('abc');
  28879. * // => false
  28880. *
  28881. * _.isArrayLikeObject(_.noop);
  28882. * // => false
  28883. */
  28884. function isArrayLikeObject(value) {
  28885. return isObjectLike(value) && isArrayLike(value);
  28886. }
  28887. /**
  28888. * Checks if `value` is classified as a boolean primitive or object.
  28889. *
  28890. * @static
  28891. * @memberOf _
  28892. * @since 0.1.0
  28893. * @category Lang
  28894. * @param {*} value The value to check.
  28895. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  28896. * @example
  28897. *
  28898. * _.isBoolean(false);
  28899. * // => true
  28900. *
  28901. * _.isBoolean(null);
  28902. * // => false
  28903. */
  28904. function isBoolean(value) {
  28905. return value === true || value === false ||
  28906. (isObjectLike(value) && baseGetTag(value) == boolTag);
  28907. }
  28908. /**
  28909. * Checks if `value` is a buffer.
  28910. *
  28911. * @static
  28912. * @memberOf _
  28913. * @since 4.3.0
  28914. * @category Lang
  28915. * @param {*} value The value to check.
  28916. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  28917. * @example
  28918. *
  28919. * _.isBuffer(new Buffer(2));
  28920. * // => true
  28921. *
  28922. * _.isBuffer(new Uint8Array(2));
  28923. * // => false
  28924. */
  28925. var isBuffer = nativeIsBuffer || stubFalse;
  28926. /**
  28927. * Checks if `value` is classified as a `Date` object.
  28928. *
  28929. * @static
  28930. * @memberOf _
  28931. * @since 0.1.0
  28932. * @category Lang
  28933. * @param {*} value The value to check.
  28934. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  28935. * @example
  28936. *
  28937. * _.isDate(new Date);
  28938. * // => true
  28939. *
  28940. * _.isDate('Mon April 23 2012');
  28941. * // => false
  28942. */
  28943. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  28944. /**
  28945. * Checks if `value` is likely a DOM element.
  28946. *
  28947. * @static
  28948. * @memberOf _
  28949. * @since 0.1.0
  28950. * @category Lang
  28951. * @param {*} value The value to check.
  28952. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  28953. * @example
  28954. *
  28955. * _.isElement(document.body);
  28956. * // => true
  28957. *
  28958. * _.isElement('<body>');
  28959. * // => false
  28960. */
  28961. function isElement(value) {
  28962. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  28963. }
  28964. /**
  28965. * Checks if `value` is an empty object, collection, map, or set.
  28966. *
  28967. * Objects are considered empty if they have no own enumerable string keyed
  28968. * properties.
  28969. *
  28970. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  28971. * jQuery-like collections are considered empty if they have a `length` of `0`.
  28972. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  28973. *
  28974. * @static
  28975. * @memberOf _
  28976. * @since 0.1.0
  28977. * @category Lang
  28978. * @param {*} value The value to check.
  28979. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  28980. * @example
  28981. *
  28982. * _.isEmpty(null);
  28983. * // => true
  28984. *
  28985. * _.isEmpty(true);
  28986. * // => true
  28987. *
  28988. * _.isEmpty(1);
  28989. * // => true
  28990. *
  28991. * _.isEmpty([1, 2, 3]);
  28992. * // => false
  28993. *
  28994. * _.isEmpty({ 'a': 1 });
  28995. * // => false
  28996. */
  28997. function isEmpty(value) {
  28998. if (value == null) {
  28999. return true;
  29000. }
  29001. if (isArrayLike(value) &&
  29002. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  29003. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  29004. return !value.length;
  29005. }
  29006. var tag = getTag(value);
  29007. if (tag == mapTag || tag == setTag) {
  29008. return !value.size;
  29009. }
  29010. if (isPrototype(value)) {
  29011. return !baseKeys(value).length;
  29012. }
  29013. for (var key in value) {
  29014. if (hasOwnProperty.call(value, key)) {
  29015. return false;
  29016. }
  29017. }
  29018. return true;
  29019. }
  29020. /**
  29021. * Performs a deep comparison between two values to determine if they are
  29022. * equivalent.
  29023. *
  29024. * **Note:** This method supports comparing arrays, array buffers, booleans,
  29025. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  29026. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  29027. * by their own, not inherited, enumerable properties. Functions and DOM
  29028. * nodes are compared by strict equality, i.e. `===`.
  29029. *
  29030. * @static
  29031. * @memberOf _
  29032. * @since 0.1.0
  29033. * @category Lang
  29034. * @param {*} value The value to compare.
  29035. * @param {*} other The other value to compare.
  29036. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29037. * @example
  29038. *
  29039. * var object = { 'a': 1 };
  29040. * var other = { 'a': 1 };
  29041. *
  29042. * _.isEqual(object, other);
  29043. * // => true
  29044. *
  29045. * object === other;
  29046. * // => false
  29047. */
  29048. function isEqual(value, other) {
  29049. return baseIsEqual(value, other);
  29050. }
  29051. /**
  29052. * This method is like `_.isEqual` except that it accepts `customizer` which
  29053. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29054. * are handled by the method instead. The `customizer` is invoked with up to
  29055. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  29056. *
  29057. * @static
  29058. * @memberOf _
  29059. * @since 4.0.0
  29060. * @category Lang
  29061. * @param {*} value The value to compare.
  29062. * @param {*} other The other value to compare.
  29063. * @param {Function} [customizer] The function to customize comparisons.
  29064. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29065. * @example
  29066. *
  29067. * function isGreeting(value) {
  29068. * return /^h(?:i|ello)$/.test(value);
  29069. * }
  29070. *
  29071. * function customizer(objValue, othValue) {
  29072. * if (isGreeting(objValue) && isGreeting(othValue)) {
  29073. * return true;
  29074. * }
  29075. * }
  29076. *
  29077. * var array = ['hello', 'goodbye'];
  29078. * var other = ['hi', 'goodbye'];
  29079. *
  29080. * _.isEqualWith(array, other, customizer);
  29081. * // => true
  29082. */
  29083. function isEqualWith(value, other, customizer) {
  29084. customizer = typeof customizer == 'function' ? customizer : undefined;
  29085. var result = customizer ? customizer(value, other) : undefined;
  29086. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  29087. }
  29088. /**
  29089. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  29090. * `SyntaxError`, `TypeError`, or `URIError` object.
  29091. *
  29092. * @static
  29093. * @memberOf _
  29094. * @since 3.0.0
  29095. * @category Lang
  29096. * @param {*} value The value to check.
  29097. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  29098. * @example
  29099. *
  29100. * _.isError(new Error);
  29101. * // => true
  29102. *
  29103. * _.isError(Error);
  29104. * // => false
  29105. */
  29106. function isError(value) {
  29107. if (!isObjectLike(value)) {
  29108. return false;
  29109. }
  29110. var tag = baseGetTag(value);
  29111. return tag == errorTag || tag == domExcTag ||
  29112. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  29113. }
  29114. /**
  29115. * Checks if `value` is a finite primitive number.
  29116. *
  29117. * **Note:** This method is based on
  29118. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  29119. *
  29120. * @static
  29121. * @memberOf _
  29122. * @since 0.1.0
  29123. * @category Lang
  29124. * @param {*} value The value to check.
  29125. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  29126. * @example
  29127. *
  29128. * _.isFinite(3);
  29129. * // => true
  29130. *
  29131. * _.isFinite(Number.MIN_VALUE);
  29132. * // => true
  29133. *
  29134. * _.isFinite(Infinity);
  29135. * // => false
  29136. *
  29137. * _.isFinite('3');
  29138. * // => false
  29139. */
  29140. function isFinite(value) {
  29141. return typeof value == 'number' && nativeIsFinite(value);
  29142. }
  29143. /**
  29144. * Checks if `value` is classified as a `Function` object.
  29145. *
  29146. * @static
  29147. * @memberOf _
  29148. * @since 0.1.0
  29149. * @category Lang
  29150. * @param {*} value The value to check.
  29151. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  29152. * @example
  29153. *
  29154. * _.isFunction(_);
  29155. * // => true
  29156. *
  29157. * _.isFunction(/abc/);
  29158. * // => false
  29159. */
  29160. function isFunction(value) {
  29161. if (!isObject(value)) {
  29162. return false;
  29163. }
  29164. // The use of `Object#toString` avoids issues with the `typeof` operator
  29165. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  29166. var tag = baseGetTag(value);
  29167. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  29168. }
  29169. /**
  29170. * Checks if `value` is an integer.
  29171. *
  29172. * **Note:** This method is based on
  29173. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  29174. *
  29175. * @static
  29176. * @memberOf _
  29177. * @since 4.0.0
  29178. * @category Lang
  29179. * @param {*} value The value to check.
  29180. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  29181. * @example
  29182. *
  29183. * _.isInteger(3);
  29184. * // => true
  29185. *
  29186. * _.isInteger(Number.MIN_VALUE);
  29187. * // => false
  29188. *
  29189. * _.isInteger(Infinity);
  29190. * // => false
  29191. *
  29192. * _.isInteger('3');
  29193. * // => false
  29194. */
  29195. function isInteger(value) {
  29196. return typeof value == 'number' && value == toInteger(value);
  29197. }
  29198. /**
  29199. * Checks if `value` is a valid array-like length.
  29200. *
  29201. * **Note:** This method is loosely based on
  29202. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29203. *
  29204. * @static
  29205. * @memberOf _
  29206. * @since 4.0.0
  29207. * @category Lang
  29208. * @param {*} value The value to check.
  29209. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  29210. * @example
  29211. *
  29212. * _.isLength(3);
  29213. * // => true
  29214. *
  29215. * _.isLength(Number.MIN_VALUE);
  29216. * // => false
  29217. *
  29218. * _.isLength(Infinity);
  29219. * // => false
  29220. *
  29221. * _.isLength('3');
  29222. * // => false
  29223. */
  29224. function isLength(value) {
  29225. return typeof value == 'number' &&
  29226. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  29227. }
  29228. /**
  29229. * Checks if `value` is the
  29230. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  29231. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  29232. *
  29233. * @static
  29234. * @memberOf _
  29235. * @since 0.1.0
  29236. * @category Lang
  29237. * @param {*} value The value to check.
  29238. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  29239. * @example
  29240. *
  29241. * _.isObject({});
  29242. * // => true
  29243. *
  29244. * _.isObject([1, 2, 3]);
  29245. * // => true
  29246. *
  29247. * _.isObject(_.noop);
  29248. * // => true
  29249. *
  29250. * _.isObject(null);
  29251. * // => false
  29252. */
  29253. function isObject(value) {
  29254. var type = typeof value;
  29255. return value != null && (type == 'object' || type == 'function');
  29256. }
  29257. /**
  29258. * Checks if `value` is object-like. A value is object-like if it's not `null`
  29259. * and has a `typeof` result of "object".
  29260. *
  29261. * @static
  29262. * @memberOf _
  29263. * @since 4.0.0
  29264. * @category Lang
  29265. * @param {*} value The value to check.
  29266. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  29267. * @example
  29268. *
  29269. * _.isObjectLike({});
  29270. * // => true
  29271. *
  29272. * _.isObjectLike([1, 2, 3]);
  29273. * // => true
  29274. *
  29275. * _.isObjectLike(_.noop);
  29276. * // => false
  29277. *
  29278. * _.isObjectLike(null);
  29279. * // => false
  29280. */
  29281. function isObjectLike(value) {
  29282. return value != null && typeof value == 'object';
  29283. }
  29284. /**
  29285. * Checks if `value` is classified as a `Map` object.
  29286. *
  29287. * @static
  29288. * @memberOf _
  29289. * @since 4.3.0
  29290. * @category Lang
  29291. * @param {*} value The value to check.
  29292. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  29293. * @example
  29294. *
  29295. * _.isMap(new Map);
  29296. * // => true
  29297. *
  29298. * _.isMap(new WeakMap);
  29299. * // => false
  29300. */
  29301. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  29302. /**
  29303. * Performs a partial deep comparison between `object` and `source` to
  29304. * determine if `object` contains equivalent property values.
  29305. *
  29306. * **Note:** This method is equivalent to `_.matches` when `source` is
  29307. * partially applied.
  29308. *
  29309. * Partial comparisons will match empty array and empty object `source`
  29310. * values against any array or object value, respectively. See `_.isEqual`
  29311. * for a list of supported value comparisons.
  29312. *
  29313. * @static
  29314. * @memberOf _
  29315. * @since 3.0.0
  29316. * @category Lang
  29317. * @param {Object} object The object to inspect.
  29318. * @param {Object} source The object of property values to match.
  29319. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29320. * @example
  29321. *
  29322. * var object = { 'a': 1, 'b': 2 };
  29323. *
  29324. * _.isMatch(object, { 'b': 2 });
  29325. * // => true
  29326. *
  29327. * _.isMatch(object, { 'b': 1 });
  29328. * // => false
  29329. */
  29330. function isMatch(object, source) {
  29331. return object === source || baseIsMatch(object, source, getMatchData(source));
  29332. }
  29333. /**
  29334. * This method is like `_.isMatch` except that it accepts `customizer` which
  29335. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29336. * are handled by the method instead. The `customizer` is invoked with five
  29337. * arguments: (objValue, srcValue, index|key, object, source).
  29338. *
  29339. * @static
  29340. * @memberOf _
  29341. * @since 4.0.0
  29342. * @category Lang
  29343. * @param {Object} object The object to inspect.
  29344. * @param {Object} source The object of property values to match.
  29345. * @param {Function} [customizer] The function to customize comparisons.
  29346. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29347. * @example
  29348. *
  29349. * function isGreeting(value) {
  29350. * return /^h(?:i|ello)$/.test(value);
  29351. * }
  29352. *
  29353. * function customizer(objValue, srcValue) {
  29354. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  29355. * return true;
  29356. * }
  29357. * }
  29358. *
  29359. * var object = { 'greeting': 'hello' };
  29360. * var source = { 'greeting': 'hi' };
  29361. *
  29362. * _.isMatchWith(object, source, customizer);
  29363. * // => true
  29364. */
  29365. function isMatchWith(object, source, customizer) {
  29366. customizer = typeof customizer == 'function' ? customizer : undefined;
  29367. return baseIsMatch(object, source, getMatchData(source), customizer);
  29368. }
  29369. /**
  29370. * Checks if `value` is `NaN`.
  29371. *
  29372. * **Note:** This method is based on
  29373. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  29374. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  29375. * `undefined` and other non-number values.
  29376. *
  29377. * @static
  29378. * @memberOf _
  29379. * @since 0.1.0
  29380. * @category Lang
  29381. * @param {*} value The value to check.
  29382. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  29383. * @example
  29384. *
  29385. * _.isNaN(NaN);
  29386. * // => true
  29387. *
  29388. * _.isNaN(new Number(NaN));
  29389. * // => true
  29390. *
  29391. * isNaN(undefined);
  29392. * // => true
  29393. *
  29394. * _.isNaN(undefined);
  29395. * // => false
  29396. */
  29397. function isNaN(value) {
  29398. // An `NaN` primitive is the only value that is not equal to itself.
  29399. // Perform the `toStringTag` check first to avoid errors with some
  29400. // ActiveX objects in IE.
  29401. return isNumber(value) && value != +value;
  29402. }
  29403. /**
  29404. * Checks if `value` is a pristine native function.
  29405. *
  29406. * **Note:** This method can't reliably detect native functions in the presence
  29407. * of the core-js package because core-js circumvents this kind of detection.
  29408. * Despite multiple requests, the core-js maintainer has made it clear: any
  29409. * attempt to fix the detection will be obstructed. As a result, we're left
  29410. * with little choice but to throw an error. Unfortunately, this also affects
  29411. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  29412. * which rely on core-js.
  29413. *
  29414. * @static
  29415. * @memberOf _
  29416. * @since 3.0.0
  29417. * @category Lang
  29418. * @param {*} value The value to check.
  29419. * @returns {boolean} Returns `true` if `value` is a native function,
  29420. * else `false`.
  29421. * @example
  29422. *
  29423. * _.isNative(Array.prototype.push);
  29424. * // => true
  29425. *
  29426. * _.isNative(_);
  29427. * // => false
  29428. */
  29429. function isNative(value) {
  29430. if (isMaskable(value)) {
  29431. throw new Error(CORE_ERROR_TEXT);
  29432. }
  29433. return baseIsNative(value);
  29434. }
  29435. /**
  29436. * Checks if `value` is `null`.
  29437. *
  29438. * @static
  29439. * @memberOf _
  29440. * @since 0.1.0
  29441. * @category Lang
  29442. * @param {*} value The value to check.
  29443. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  29444. * @example
  29445. *
  29446. * _.isNull(null);
  29447. * // => true
  29448. *
  29449. * _.isNull(void 0);
  29450. * // => false
  29451. */
  29452. function isNull(value) {
  29453. return value === null;
  29454. }
  29455. /**
  29456. * Checks if `value` is `null` or `undefined`.
  29457. *
  29458. * @static
  29459. * @memberOf _
  29460. * @since 4.0.0
  29461. * @category Lang
  29462. * @param {*} value The value to check.
  29463. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  29464. * @example
  29465. *
  29466. * _.isNil(null);
  29467. * // => true
  29468. *
  29469. * _.isNil(void 0);
  29470. * // => true
  29471. *
  29472. * _.isNil(NaN);
  29473. * // => false
  29474. */
  29475. function isNil(value) {
  29476. return value == null;
  29477. }
  29478. /**
  29479. * Checks if `value` is classified as a `Number` primitive or object.
  29480. *
  29481. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  29482. * classified as numbers, use the `_.isFinite` method.
  29483. *
  29484. * @static
  29485. * @memberOf _
  29486. * @since 0.1.0
  29487. * @category Lang
  29488. * @param {*} value The value to check.
  29489. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  29490. * @example
  29491. *
  29492. * _.isNumber(3);
  29493. * // => true
  29494. *
  29495. * _.isNumber(Number.MIN_VALUE);
  29496. * // => true
  29497. *
  29498. * _.isNumber(Infinity);
  29499. * // => true
  29500. *
  29501. * _.isNumber('3');
  29502. * // => false
  29503. */
  29504. function isNumber(value) {
  29505. return typeof value == 'number' ||
  29506. (isObjectLike(value) && baseGetTag(value) == numberTag);
  29507. }
  29508. /**
  29509. * Checks if `value` is a plain object, that is, an object created by the
  29510. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  29511. *
  29512. * @static
  29513. * @memberOf _
  29514. * @since 0.8.0
  29515. * @category Lang
  29516. * @param {*} value The value to check.
  29517. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  29518. * @example
  29519. *
  29520. * function Foo() {
  29521. * this.a = 1;
  29522. * }
  29523. *
  29524. * _.isPlainObject(new Foo);
  29525. * // => false
  29526. *
  29527. * _.isPlainObject([1, 2, 3]);
  29528. * // => false
  29529. *
  29530. * _.isPlainObject({ 'x': 0, 'y': 0 });
  29531. * // => true
  29532. *
  29533. * _.isPlainObject(Object.create(null));
  29534. * // => true
  29535. */
  29536. function isPlainObject(value) {
  29537. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  29538. return false;
  29539. }
  29540. var proto = getPrototype(value);
  29541. if (proto === null) {
  29542. return true;
  29543. }
  29544. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  29545. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  29546. funcToString.call(Ctor) == objectCtorString;
  29547. }
  29548. /**
  29549. * Checks if `value` is classified as a `RegExp` object.
  29550. *
  29551. * @static
  29552. * @memberOf _
  29553. * @since 0.1.0
  29554. * @category Lang
  29555. * @param {*} value The value to check.
  29556. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  29557. * @example
  29558. *
  29559. * _.isRegExp(/abc/);
  29560. * // => true
  29561. *
  29562. * _.isRegExp('/abc/');
  29563. * // => false
  29564. */
  29565. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  29566. /**
  29567. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  29568. * double precision number which isn't the result of a rounded unsafe integer.
  29569. *
  29570. * **Note:** This method is based on
  29571. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  29572. *
  29573. * @static
  29574. * @memberOf _
  29575. * @since 4.0.0
  29576. * @category Lang
  29577. * @param {*} value The value to check.
  29578. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  29579. * @example
  29580. *
  29581. * _.isSafeInteger(3);
  29582. * // => true
  29583. *
  29584. * _.isSafeInteger(Number.MIN_VALUE);
  29585. * // => false
  29586. *
  29587. * _.isSafeInteger(Infinity);
  29588. * // => false
  29589. *
  29590. * _.isSafeInteger('3');
  29591. * // => false
  29592. */
  29593. function isSafeInteger(value) {
  29594. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  29595. }
  29596. /**
  29597. * Checks if `value` is classified as a `Set` object.
  29598. *
  29599. * @static
  29600. * @memberOf _
  29601. * @since 4.3.0
  29602. * @category Lang
  29603. * @param {*} value The value to check.
  29604. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  29605. * @example
  29606. *
  29607. * _.isSet(new Set);
  29608. * // => true
  29609. *
  29610. * _.isSet(new WeakSet);
  29611. * // => false
  29612. */
  29613. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  29614. /**
  29615. * Checks if `value` is classified as a `String` primitive or object.
  29616. *
  29617. * @static
  29618. * @since 0.1.0
  29619. * @memberOf _
  29620. * @category Lang
  29621. * @param {*} value The value to check.
  29622. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  29623. * @example
  29624. *
  29625. * _.isString('abc');
  29626. * // => true
  29627. *
  29628. * _.isString(1);
  29629. * // => false
  29630. */
  29631. function isString(value) {
  29632. return typeof value == 'string' ||
  29633. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  29634. }
  29635. /**
  29636. * Checks if `value` is classified as a `Symbol` primitive or object.
  29637. *
  29638. * @static
  29639. * @memberOf _
  29640. * @since 4.0.0
  29641. * @category Lang
  29642. * @param {*} value The value to check.
  29643. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  29644. * @example
  29645. *
  29646. * _.isSymbol(Symbol.iterator);
  29647. * // => true
  29648. *
  29649. * _.isSymbol('abc');
  29650. * // => false
  29651. */
  29652. function isSymbol(value) {
  29653. return typeof value == 'symbol' ||
  29654. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  29655. }
  29656. /**
  29657. * Checks if `value` is classified as a typed array.
  29658. *
  29659. * @static
  29660. * @memberOf _
  29661. * @since 3.0.0
  29662. * @category Lang
  29663. * @param {*} value The value to check.
  29664. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  29665. * @example
  29666. *
  29667. * _.isTypedArray(new Uint8Array);
  29668. * // => true
  29669. *
  29670. * _.isTypedArray([]);
  29671. * // => false
  29672. */
  29673. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  29674. /**
  29675. * Checks if `value` is `undefined`.
  29676. *
  29677. * @static
  29678. * @since 0.1.0
  29679. * @memberOf _
  29680. * @category Lang
  29681. * @param {*} value The value to check.
  29682. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  29683. * @example
  29684. *
  29685. * _.isUndefined(void 0);
  29686. * // => true
  29687. *
  29688. * _.isUndefined(null);
  29689. * // => false
  29690. */
  29691. function isUndefined(value) {
  29692. return value === undefined;
  29693. }
  29694. /**
  29695. * Checks if `value` is classified as a `WeakMap` object.
  29696. *
  29697. * @static
  29698. * @memberOf _
  29699. * @since 4.3.0
  29700. * @category Lang
  29701. * @param {*} value The value to check.
  29702. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  29703. * @example
  29704. *
  29705. * _.isWeakMap(new WeakMap);
  29706. * // => true
  29707. *
  29708. * _.isWeakMap(new Map);
  29709. * // => false
  29710. */
  29711. function isWeakMap(value) {
  29712. return isObjectLike(value) && getTag(value) == weakMapTag;
  29713. }
  29714. /**
  29715. * Checks if `value` is classified as a `WeakSet` object.
  29716. *
  29717. * @static
  29718. * @memberOf _
  29719. * @since 4.3.0
  29720. * @category Lang
  29721. * @param {*} value The value to check.
  29722. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  29723. * @example
  29724. *
  29725. * _.isWeakSet(new WeakSet);
  29726. * // => true
  29727. *
  29728. * _.isWeakSet(new Set);
  29729. * // => false
  29730. */
  29731. function isWeakSet(value) {
  29732. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  29733. }
  29734. /**
  29735. * Checks if `value` is less than `other`.
  29736. *
  29737. * @static
  29738. * @memberOf _
  29739. * @since 3.9.0
  29740. * @category Lang
  29741. * @param {*} value The value to compare.
  29742. * @param {*} other The other value to compare.
  29743. * @returns {boolean} Returns `true` if `value` is less than `other`,
  29744. * else `false`.
  29745. * @see _.gt
  29746. * @example
  29747. *
  29748. * _.lt(1, 3);
  29749. * // => true
  29750. *
  29751. * _.lt(3, 3);
  29752. * // => false
  29753. *
  29754. * _.lt(3, 1);
  29755. * // => false
  29756. */
  29757. var lt = createRelationalOperation(baseLt);
  29758. /**
  29759. * Checks if `value` is less than or equal to `other`.
  29760. *
  29761. * @static
  29762. * @memberOf _
  29763. * @since 3.9.0
  29764. * @category Lang
  29765. * @param {*} value The value to compare.
  29766. * @param {*} other The other value to compare.
  29767. * @returns {boolean} Returns `true` if `value` is less than or equal to
  29768. * `other`, else `false`.
  29769. * @see _.gte
  29770. * @example
  29771. *
  29772. * _.lte(1, 3);
  29773. * // => true
  29774. *
  29775. * _.lte(3, 3);
  29776. * // => true
  29777. *
  29778. * _.lte(3, 1);
  29779. * // => false
  29780. */
  29781. var lte = createRelationalOperation(function(value, other) {
  29782. return value <= other;
  29783. });
  29784. /**
  29785. * Converts `value` to an array.
  29786. *
  29787. * @static
  29788. * @since 0.1.0
  29789. * @memberOf _
  29790. * @category Lang
  29791. * @param {*} value The value to convert.
  29792. * @returns {Array} Returns the converted array.
  29793. * @example
  29794. *
  29795. * _.toArray({ 'a': 1, 'b': 2 });
  29796. * // => [1, 2]
  29797. *
  29798. * _.toArray('abc');
  29799. * // => ['a', 'b', 'c']
  29800. *
  29801. * _.toArray(1);
  29802. * // => []
  29803. *
  29804. * _.toArray(null);
  29805. * // => []
  29806. */
  29807. function toArray(value) {
  29808. if (!value) {
  29809. return [];
  29810. }
  29811. if (isArrayLike(value)) {
  29812. return isString(value) ? stringToArray(value) : copyArray(value);
  29813. }
  29814. if (symIterator && value[symIterator]) {
  29815. return iteratorToArray(value[symIterator]());
  29816. }
  29817. var tag = getTag(value),
  29818. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  29819. return func(value);
  29820. }
  29821. /**
  29822. * Converts `value` to a finite number.
  29823. *
  29824. * @static
  29825. * @memberOf _
  29826. * @since 4.12.0
  29827. * @category Lang
  29828. * @param {*} value The value to convert.
  29829. * @returns {number} Returns the converted number.
  29830. * @example
  29831. *
  29832. * _.toFinite(3.2);
  29833. * // => 3.2
  29834. *
  29835. * _.toFinite(Number.MIN_VALUE);
  29836. * // => 5e-324
  29837. *
  29838. * _.toFinite(Infinity);
  29839. * // => 1.7976931348623157e+308
  29840. *
  29841. * _.toFinite('3.2');
  29842. * // => 3.2
  29843. */
  29844. function toFinite(value) {
  29845. if (!value) {
  29846. return value === 0 ? value : 0;
  29847. }
  29848. value = toNumber(value);
  29849. if (value === INFINITY || value === -INFINITY) {
  29850. var sign = (value < 0 ? -1 : 1);
  29851. return sign * MAX_INTEGER;
  29852. }
  29853. return value === value ? value : 0;
  29854. }
  29855. /**
  29856. * Converts `value` to an integer.
  29857. *
  29858. * **Note:** This method is loosely based on
  29859. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  29860. *
  29861. * @static
  29862. * @memberOf _
  29863. * @since 4.0.0
  29864. * @category Lang
  29865. * @param {*} value The value to convert.
  29866. * @returns {number} Returns the converted integer.
  29867. * @example
  29868. *
  29869. * _.toInteger(3.2);
  29870. * // => 3
  29871. *
  29872. * _.toInteger(Number.MIN_VALUE);
  29873. * // => 0
  29874. *
  29875. * _.toInteger(Infinity);
  29876. * // => 1.7976931348623157e+308
  29877. *
  29878. * _.toInteger('3.2');
  29879. * // => 3
  29880. */
  29881. function toInteger(value) {
  29882. var result = toFinite(value),
  29883. remainder = result % 1;
  29884. return result === result ? (remainder ? result - remainder : result) : 0;
  29885. }
  29886. /**
  29887. * Converts `value` to an integer suitable for use as the length of an
  29888. * array-like object.
  29889. *
  29890. * **Note:** This method is based on
  29891. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29892. *
  29893. * @static
  29894. * @memberOf _
  29895. * @since 4.0.0
  29896. * @category Lang
  29897. * @param {*} value The value to convert.
  29898. * @returns {number} Returns the converted integer.
  29899. * @example
  29900. *
  29901. * _.toLength(3.2);
  29902. * // => 3
  29903. *
  29904. * _.toLength(Number.MIN_VALUE);
  29905. * // => 0
  29906. *
  29907. * _.toLength(Infinity);
  29908. * // => 4294967295
  29909. *
  29910. * _.toLength('3.2');
  29911. * // => 3
  29912. */
  29913. function toLength(value) {
  29914. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  29915. }
  29916. /**
  29917. * Converts `value` to a number.
  29918. *
  29919. * @static
  29920. * @memberOf _
  29921. * @since 4.0.0
  29922. * @category Lang
  29923. * @param {*} value The value to process.
  29924. * @returns {number} Returns the number.
  29925. * @example
  29926. *
  29927. * _.toNumber(3.2);
  29928. * // => 3.2
  29929. *
  29930. * _.toNumber(Number.MIN_VALUE);
  29931. * // => 5e-324
  29932. *
  29933. * _.toNumber(Infinity);
  29934. * // => Infinity
  29935. *
  29936. * _.toNumber('3.2');
  29937. * // => 3.2
  29938. */
  29939. function toNumber(value) {
  29940. if (typeof value == 'number') {
  29941. return value;
  29942. }
  29943. if (isSymbol(value)) {
  29944. return NAN;
  29945. }
  29946. if (isObject(value)) {
  29947. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  29948. value = isObject(other) ? (other + '') : other;
  29949. }
  29950. if (typeof value != 'string') {
  29951. return value === 0 ? value : +value;
  29952. }
  29953. value = value.replace(reTrim, '');
  29954. var isBinary = reIsBinary.test(value);
  29955. return (isBinary || reIsOctal.test(value))
  29956. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  29957. : (reIsBadHex.test(value) ? NAN : +value);
  29958. }
  29959. /**
  29960. * Converts `value` to a plain object flattening inherited enumerable string
  29961. * keyed properties of `value` to own properties of the plain object.
  29962. *
  29963. * @static
  29964. * @memberOf _
  29965. * @since 3.0.0
  29966. * @category Lang
  29967. * @param {*} value The value to convert.
  29968. * @returns {Object} Returns the converted plain object.
  29969. * @example
  29970. *
  29971. * function Foo() {
  29972. * this.b = 2;
  29973. * }
  29974. *
  29975. * Foo.prototype.c = 3;
  29976. *
  29977. * _.assign({ 'a': 1 }, new Foo);
  29978. * // => { 'a': 1, 'b': 2 }
  29979. *
  29980. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  29981. * // => { 'a': 1, 'b': 2, 'c': 3 }
  29982. */
  29983. function toPlainObject(value) {
  29984. return copyObject(value, keysIn(value));
  29985. }
  29986. /**
  29987. * Converts `value` to a safe integer. A safe integer can be compared and
  29988. * represented correctly.
  29989. *
  29990. * @static
  29991. * @memberOf _
  29992. * @since 4.0.0
  29993. * @category Lang
  29994. * @param {*} value The value to convert.
  29995. * @returns {number} Returns the converted integer.
  29996. * @example
  29997. *
  29998. * _.toSafeInteger(3.2);
  29999. * // => 3
  30000. *
  30001. * _.toSafeInteger(Number.MIN_VALUE);
  30002. * // => 0
  30003. *
  30004. * _.toSafeInteger(Infinity);
  30005. * // => 9007199254740991
  30006. *
  30007. * _.toSafeInteger('3.2');
  30008. * // => 3
  30009. */
  30010. function toSafeInteger(value) {
  30011. return value
  30012. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  30013. : (value === 0 ? value : 0);
  30014. }
  30015. /**
  30016. * Converts `value` to a string. An empty string is returned for `null`
  30017. * and `undefined` values. The sign of `-0` is preserved.
  30018. *
  30019. * @static
  30020. * @memberOf _
  30021. * @since 4.0.0
  30022. * @category Lang
  30023. * @param {*} value The value to convert.
  30024. * @returns {string} Returns the converted string.
  30025. * @example
  30026. *
  30027. * _.toString(null);
  30028. * // => ''
  30029. *
  30030. * _.toString(-0);
  30031. * // => '-0'
  30032. *
  30033. * _.toString([1, 2, 3]);
  30034. * // => '1,2,3'
  30035. */
  30036. function toString(value) {
  30037. return value == null ? '' : baseToString(value);
  30038. }
  30039. /*------------------------------------------------------------------------*/
  30040. /**
  30041. * Assigns own enumerable string keyed properties of source objects to the
  30042. * destination object. Source objects are applied from left to right.
  30043. * Subsequent sources overwrite property assignments of previous sources.
  30044. *
  30045. * **Note:** This method mutates `object` and is loosely based on
  30046. * [`Object.assign`](https://mdn.io/Object/assign).
  30047. *
  30048. * @static
  30049. * @memberOf _
  30050. * @since 0.10.0
  30051. * @category Object
  30052. * @param {Object} object The destination object.
  30053. * @param {...Object} [sources] The source objects.
  30054. * @returns {Object} Returns `object`.
  30055. * @see _.assignIn
  30056. * @example
  30057. *
  30058. * function Foo() {
  30059. * this.a = 1;
  30060. * }
  30061. *
  30062. * function Bar() {
  30063. * this.c = 3;
  30064. * }
  30065. *
  30066. * Foo.prototype.b = 2;
  30067. * Bar.prototype.d = 4;
  30068. *
  30069. * _.assign({ 'a': 0 }, new Foo, new Bar);
  30070. * // => { 'a': 1, 'c': 3 }
  30071. */
  30072. var assign = createAssigner(function(object, source) {
  30073. if (isPrototype(source) || isArrayLike(source)) {
  30074. copyObject(source, keys(source), object);
  30075. return;
  30076. }
  30077. for (var key in source) {
  30078. if (hasOwnProperty.call(source, key)) {
  30079. assignValue(object, key, source[key]);
  30080. }
  30081. }
  30082. });
  30083. /**
  30084. * This method is like `_.assign` except that it iterates over own and
  30085. * inherited source properties.
  30086. *
  30087. * **Note:** This method mutates `object`.
  30088. *
  30089. * @static
  30090. * @memberOf _
  30091. * @since 4.0.0
  30092. * @alias extend
  30093. * @category Object
  30094. * @param {Object} object The destination object.
  30095. * @param {...Object} [sources] The source objects.
  30096. * @returns {Object} Returns `object`.
  30097. * @see _.assign
  30098. * @example
  30099. *
  30100. * function Foo() {
  30101. * this.a = 1;
  30102. * }
  30103. *
  30104. * function Bar() {
  30105. * this.c = 3;
  30106. * }
  30107. *
  30108. * Foo.prototype.b = 2;
  30109. * Bar.prototype.d = 4;
  30110. *
  30111. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  30112. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  30113. */
  30114. var assignIn = createAssigner(function(object, source) {
  30115. copyObject(source, keysIn(source), object);
  30116. });
  30117. /**
  30118. * This method is like `_.assignIn` except that it accepts `customizer`
  30119. * which is invoked to produce the assigned values. If `customizer` returns
  30120. * `undefined`, assignment is handled by the method instead. The `customizer`
  30121. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30122. *
  30123. * **Note:** This method mutates `object`.
  30124. *
  30125. * @static
  30126. * @memberOf _
  30127. * @since 4.0.0
  30128. * @alias extendWith
  30129. * @category Object
  30130. * @param {Object} object The destination object.
  30131. * @param {...Object} sources The source objects.
  30132. * @param {Function} [customizer] The function to customize assigned values.
  30133. * @returns {Object} Returns `object`.
  30134. * @see _.assignWith
  30135. * @example
  30136. *
  30137. * function customizer(objValue, srcValue) {
  30138. * return _.isUndefined(objValue) ? srcValue : objValue;
  30139. * }
  30140. *
  30141. * var defaults = _.partialRight(_.assignInWith, customizer);
  30142. *
  30143. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30144. * // => { 'a': 1, 'b': 2 }
  30145. */
  30146. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  30147. copyObject(source, keysIn(source), object, customizer);
  30148. });
  30149. /**
  30150. * This method is like `_.assign` except that it accepts `customizer`
  30151. * which is invoked to produce the assigned values. If `customizer` returns
  30152. * `undefined`, assignment is handled by the method instead. The `customizer`
  30153. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30154. *
  30155. * **Note:** This method mutates `object`.
  30156. *
  30157. * @static
  30158. * @memberOf _
  30159. * @since 4.0.0
  30160. * @category Object
  30161. * @param {Object} object The destination object.
  30162. * @param {...Object} sources The source objects.
  30163. * @param {Function} [customizer] The function to customize assigned values.
  30164. * @returns {Object} Returns `object`.
  30165. * @see _.assignInWith
  30166. * @example
  30167. *
  30168. * function customizer(objValue, srcValue) {
  30169. * return _.isUndefined(objValue) ? srcValue : objValue;
  30170. * }
  30171. *
  30172. * var defaults = _.partialRight(_.assignWith, customizer);
  30173. *
  30174. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30175. * // => { 'a': 1, 'b': 2 }
  30176. */
  30177. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  30178. copyObject(source, keys(source), object, customizer);
  30179. });
  30180. /**
  30181. * Creates an array of values corresponding to `paths` of `object`.
  30182. *
  30183. * @static
  30184. * @memberOf _
  30185. * @since 1.0.0
  30186. * @category Object
  30187. * @param {Object} object The object to iterate over.
  30188. * @param {...(string|string[])} [paths] The property paths to pick.
  30189. * @returns {Array} Returns the picked values.
  30190. * @example
  30191. *
  30192. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  30193. *
  30194. * _.at(object, ['a[0].b.c', 'a[1]']);
  30195. * // => [3, 4]
  30196. */
  30197. var at = flatRest(baseAt);
  30198. /**
  30199. * Creates an object that inherits from the `prototype` object. If a
  30200. * `properties` object is given, its own enumerable string keyed properties
  30201. * are assigned to the created object.
  30202. *
  30203. * @static
  30204. * @memberOf _
  30205. * @since 2.3.0
  30206. * @category Object
  30207. * @param {Object} prototype The object to inherit from.
  30208. * @param {Object} [properties] The properties to assign to the object.
  30209. * @returns {Object} Returns the new object.
  30210. * @example
  30211. *
  30212. * function Shape() {
  30213. * this.x = 0;
  30214. * this.y = 0;
  30215. * }
  30216. *
  30217. * function Circle() {
  30218. * Shape.call(this);
  30219. * }
  30220. *
  30221. * Circle.prototype = _.create(Shape.prototype, {
  30222. * 'constructor': Circle
  30223. * });
  30224. *
  30225. * var circle = new Circle;
  30226. * circle instanceof Circle;
  30227. * // => true
  30228. *
  30229. * circle instanceof Shape;
  30230. * // => true
  30231. */
  30232. function create(prototype, properties) {
  30233. var result = baseCreate(prototype);
  30234. return properties == null ? result : baseAssign(result, properties);
  30235. }
  30236. /**
  30237. * Assigns own and inherited enumerable string keyed properties of source
  30238. * objects to the destination object for all destination properties that
  30239. * resolve to `undefined`. Source objects are applied from left to right.
  30240. * Once a property is set, additional values of the same property are ignored.
  30241. *
  30242. * **Note:** This method mutates `object`.
  30243. *
  30244. * @static
  30245. * @since 0.1.0
  30246. * @memberOf _
  30247. * @category Object
  30248. * @param {Object} object The destination object.
  30249. * @param {...Object} [sources] The source objects.
  30250. * @returns {Object} Returns `object`.
  30251. * @see _.defaultsDeep
  30252. * @example
  30253. *
  30254. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30255. * // => { 'a': 1, 'b': 2 }
  30256. */
  30257. var defaults = baseRest(function(object, sources) {
  30258. object = Object(object);
  30259. var index = -1;
  30260. var length = sources.length;
  30261. var guard = length > 2 ? sources[2] : undefined;
  30262. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  30263. length = 1;
  30264. }
  30265. while (++index < length) {
  30266. var source = sources[index];
  30267. var props = keysIn(source);
  30268. var propsIndex = -1;
  30269. var propsLength = props.length;
  30270. while (++propsIndex < propsLength) {
  30271. var key = props[propsIndex];
  30272. var value = object[key];
  30273. if (value === undefined ||
  30274. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  30275. object[key] = source[key];
  30276. }
  30277. }
  30278. }
  30279. return object;
  30280. });
  30281. /**
  30282. * This method is like `_.defaults` except that it recursively assigns
  30283. * default properties.
  30284. *
  30285. * **Note:** This method mutates `object`.
  30286. *
  30287. * @static
  30288. * @memberOf _
  30289. * @since 3.10.0
  30290. * @category Object
  30291. * @param {Object} object The destination object.
  30292. * @param {...Object} [sources] The source objects.
  30293. * @returns {Object} Returns `object`.
  30294. * @see _.defaults
  30295. * @example
  30296. *
  30297. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  30298. * // => { 'a': { 'b': 2, 'c': 3 } }
  30299. */
  30300. var defaultsDeep = baseRest(function(args) {
  30301. args.push(undefined, customDefaultsMerge);
  30302. return apply(mergeWith, undefined, args);
  30303. });
  30304. /**
  30305. * This method is like `_.find` except that it returns the key of the first
  30306. * element `predicate` returns truthy for instead of the element itself.
  30307. *
  30308. * @static
  30309. * @memberOf _
  30310. * @since 1.1.0
  30311. * @category Object
  30312. * @param {Object} object The object to inspect.
  30313. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30314. * @returns {string|undefined} Returns the key of the matched element,
  30315. * else `undefined`.
  30316. * @example
  30317. *
  30318. * var users = {
  30319. * 'barney': { 'age': 36, 'active': true },
  30320. * 'fred': { 'age': 40, 'active': false },
  30321. * 'pebbles': { 'age': 1, 'active': true }
  30322. * };
  30323. *
  30324. * _.findKey(users, function(o) { return o.age < 40; });
  30325. * // => 'barney' (iteration order is not guaranteed)
  30326. *
  30327. * // The `_.matches` iteratee shorthand.
  30328. * _.findKey(users, { 'age': 1, 'active': true });
  30329. * // => 'pebbles'
  30330. *
  30331. * // The `_.matchesProperty` iteratee shorthand.
  30332. * _.findKey(users, ['active', false]);
  30333. * // => 'fred'
  30334. *
  30335. * // The `_.property` iteratee shorthand.
  30336. * _.findKey(users, 'active');
  30337. * // => 'barney'
  30338. */
  30339. function findKey(object, predicate) {
  30340. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  30341. }
  30342. /**
  30343. * This method is like `_.findKey` except that it iterates over elements of
  30344. * a collection in the opposite order.
  30345. *
  30346. * @static
  30347. * @memberOf _
  30348. * @since 2.0.0
  30349. * @category Object
  30350. * @param {Object} object The object to inspect.
  30351. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30352. * @returns {string|undefined} Returns the key of the matched element,
  30353. * else `undefined`.
  30354. * @example
  30355. *
  30356. * var users = {
  30357. * 'barney': { 'age': 36, 'active': true },
  30358. * 'fred': { 'age': 40, 'active': false },
  30359. * 'pebbles': { 'age': 1, 'active': true }
  30360. * };
  30361. *
  30362. * _.findLastKey(users, function(o) { return o.age < 40; });
  30363. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  30364. *
  30365. * // The `_.matches` iteratee shorthand.
  30366. * _.findLastKey(users, { 'age': 36, 'active': true });
  30367. * // => 'barney'
  30368. *
  30369. * // The `_.matchesProperty` iteratee shorthand.
  30370. * _.findLastKey(users, ['active', false]);
  30371. * // => 'fred'
  30372. *
  30373. * // The `_.property` iteratee shorthand.
  30374. * _.findLastKey(users, 'active');
  30375. * // => 'pebbles'
  30376. */
  30377. function findLastKey(object, predicate) {
  30378. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  30379. }
  30380. /**
  30381. * Iterates over own and inherited enumerable string keyed properties of an
  30382. * object and invokes `iteratee` for each property. The iteratee is invoked
  30383. * with three arguments: (value, key, object). Iteratee functions may exit
  30384. * iteration early by explicitly returning `false`.
  30385. *
  30386. * @static
  30387. * @memberOf _
  30388. * @since 0.3.0
  30389. * @category Object
  30390. * @param {Object} object The object to iterate over.
  30391. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30392. * @returns {Object} Returns `object`.
  30393. * @see _.forInRight
  30394. * @example
  30395. *
  30396. * function Foo() {
  30397. * this.a = 1;
  30398. * this.b = 2;
  30399. * }
  30400. *
  30401. * Foo.prototype.c = 3;
  30402. *
  30403. * _.forIn(new Foo, function(value, key) {
  30404. * console.log(key);
  30405. * });
  30406. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  30407. */
  30408. function forIn(object, iteratee) {
  30409. return object == null
  30410. ? object
  30411. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  30412. }
  30413. /**
  30414. * This method is like `_.forIn` except that it iterates over properties of
  30415. * `object` in the opposite order.
  30416. *
  30417. * @static
  30418. * @memberOf _
  30419. * @since 2.0.0
  30420. * @category Object
  30421. * @param {Object} object The object to iterate over.
  30422. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30423. * @returns {Object} Returns `object`.
  30424. * @see _.forIn
  30425. * @example
  30426. *
  30427. * function Foo() {
  30428. * this.a = 1;
  30429. * this.b = 2;
  30430. * }
  30431. *
  30432. * Foo.prototype.c = 3;
  30433. *
  30434. * _.forInRight(new Foo, function(value, key) {
  30435. * console.log(key);
  30436. * });
  30437. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  30438. */
  30439. function forInRight(object, iteratee) {
  30440. return object == null
  30441. ? object
  30442. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  30443. }
  30444. /**
  30445. * Iterates over own enumerable string keyed properties of an object and
  30446. * invokes `iteratee` for each property. The iteratee is invoked with three
  30447. * arguments: (value, key, object). Iteratee functions may exit iteration
  30448. * early by explicitly returning `false`.
  30449. *
  30450. * @static
  30451. * @memberOf _
  30452. * @since 0.3.0
  30453. * @category Object
  30454. * @param {Object} object The object to iterate over.
  30455. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30456. * @returns {Object} Returns `object`.
  30457. * @see _.forOwnRight
  30458. * @example
  30459. *
  30460. * function Foo() {
  30461. * this.a = 1;
  30462. * this.b = 2;
  30463. * }
  30464. *
  30465. * Foo.prototype.c = 3;
  30466. *
  30467. * _.forOwn(new Foo, function(value, key) {
  30468. * console.log(key);
  30469. * });
  30470. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  30471. */
  30472. function forOwn(object, iteratee) {
  30473. return object && baseForOwn(object, getIteratee(iteratee, 3));
  30474. }
  30475. /**
  30476. * This method is like `_.forOwn` except that it iterates over properties of
  30477. * `object` in the opposite order.
  30478. *
  30479. * @static
  30480. * @memberOf _
  30481. * @since 2.0.0
  30482. * @category Object
  30483. * @param {Object} object The object to iterate over.
  30484. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30485. * @returns {Object} Returns `object`.
  30486. * @see _.forOwn
  30487. * @example
  30488. *
  30489. * function Foo() {
  30490. * this.a = 1;
  30491. * this.b = 2;
  30492. * }
  30493. *
  30494. * Foo.prototype.c = 3;
  30495. *
  30496. * _.forOwnRight(new Foo, function(value, key) {
  30497. * console.log(key);
  30498. * });
  30499. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  30500. */
  30501. function forOwnRight(object, iteratee) {
  30502. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  30503. }
  30504. /**
  30505. * Creates an array of function property names from own enumerable properties
  30506. * of `object`.
  30507. *
  30508. * @static
  30509. * @since 0.1.0
  30510. * @memberOf _
  30511. * @category Object
  30512. * @param {Object} object The object to inspect.
  30513. * @returns {Array} Returns the function names.
  30514. * @see _.functionsIn
  30515. * @example
  30516. *
  30517. * function Foo() {
  30518. * this.a = _.constant('a');
  30519. * this.b = _.constant('b');
  30520. * }
  30521. *
  30522. * Foo.prototype.c = _.constant('c');
  30523. *
  30524. * _.functions(new Foo);
  30525. * // => ['a', 'b']
  30526. */
  30527. function functions(object) {
  30528. return object == null ? [] : baseFunctions(object, keys(object));
  30529. }
  30530. /**
  30531. * Creates an array of function property names from own and inherited
  30532. * enumerable properties of `object`.
  30533. *
  30534. * @static
  30535. * @memberOf _
  30536. * @since 4.0.0
  30537. * @category Object
  30538. * @param {Object} object The object to inspect.
  30539. * @returns {Array} Returns the function names.
  30540. * @see _.functions
  30541. * @example
  30542. *
  30543. * function Foo() {
  30544. * this.a = _.constant('a');
  30545. * this.b = _.constant('b');
  30546. * }
  30547. *
  30548. * Foo.prototype.c = _.constant('c');
  30549. *
  30550. * _.functionsIn(new Foo);
  30551. * // => ['a', 'b', 'c']
  30552. */
  30553. function functionsIn(object) {
  30554. return object == null ? [] : baseFunctions(object, keysIn(object));
  30555. }
  30556. /**
  30557. * Gets the value at `path` of `object`. If the resolved value is
  30558. * `undefined`, the `defaultValue` is returned in its place.
  30559. *
  30560. * @static
  30561. * @memberOf _
  30562. * @since 3.7.0
  30563. * @category Object
  30564. * @param {Object} object The object to query.
  30565. * @param {Array|string} path The path of the property to get.
  30566. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30567. * @returns {*} Returns the resolved value.
  30568. * @example
  30569. *
  30570. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30571. *
  30572. * _.get(object, 'a[0].b.c');
  30573. * // => 3
  30574. *
  30575. * _.get(object, ['a', '0', 'b', 'c']);
  30576. * // => 3
  30577. *
  30578. * _.get(object, 'a.b.c', 'default');
  30579. * // => 'default'
  30580. */
  30581. function get(object, path, defaultValue) {
  30582. var result = object == null ? undefined : baseGet(object, path);
  30583. return result === undefined ? defaultValue : result;
  30584. }
  30585. /**
  30586. * Checks if `path` is a direct property of `object`.
  30587. *
  30588. * @static
  30589. * @since 0.1.0
  30590. * @memberOf _
  30591. * @category Object
  30592. * @param {Object} object The object to query.
  30593. * @param {Array|string} path The path to check.
  30594. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30595. * @example
  30596. *
  30597. * var object = { 'a': { 'b': 2 } };
  30598. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  30599. *
  30600. * _.has(object, 'a');
  30601. * // => true
  30602. *
  30603. * _.has(object, 'a.b');
  30604. * // => true
  30605. *
  30606. * _.has(object, ['a', 'b']);
  30607. * // => true
  30608. *
  30609. * _.has(other, 'a');
  30610. * // => false
  30611. */
  30612. function has(object, path) {
  30613. return object != null && hasPath(object, path, baseHas);
  30614. }
  30615. /**
  30616. * Checks if `path` is a direct or inherited property of `object`.
  30617. *
  30618. * @static
  30619. * @memberOf _
  30620. * @since 4.0.0
  30621. * @category Object
  30622. * @param {Object} object The object to query.
  30623. * @param {Array|string} path The path to check.
  30624. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30625. * @example
  30626. *
  30627. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  30628. *
  30629. * _.hasIn(object, 'a');
  30630. * // => true
  30631. *
  30632. * _.hasIn(object, 'a.b');
  30633. * // => true
  30634. *
  30635. * _.hasIn(object, ['a', 'b']);
  30636. * // => true
  30637. *
  30638. * _.hasIn(object, 'b');
  30639. * // => false
  30640. */
  30641. function hasIn(object, path) {
  30642. return object != null && hasPath(object, path, baseHasIn);
  30643. }
  30644. /**
  30645. * Creates an object composed of the inverted keys and values of `object`.
  30646. * If `object` contains duplicate values, subsequent values overwrite
  30647. * property assignments of previous values.
  30648. *
  30649. * @static
  30650. * @memberOf _
  30651. * @since 0.7.0
  30652. * @category Object
  30653. * @param {Object} object The object to invert.
  30654. * @returns {Object} Returns the new inverted object.
  30655. * @example
  30656. *
  30657. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30658. *
  30659. * _.invert(object);
  30660. * // => { '1': 'c', '2': 'b' }
  30661. */
  30662. var invert = createInverter(function(result, value, key) {
  30663. if (value != null &&
  30664. typeof value.toString != 'function') {
  30665. value = nativeObjectToString.call(value);
  30666. }
  30667. result[value] = key;
  30668. }, constant(identity));
  30669. /**
  30670. * This method is like `_.invert` except that the inverted object is generated
  30671. * from the results of running each element of `object` thru `iteratee`. The
  30672. * corresponding inverted value of each inverted key is an array of keys
  30673. * responsible for generating the inverted value. The iteratee is invoked
  30674. * with one argument: (value).
  30675. *
  30676. * @static
  30677. * @memberOf _
  30678. * @since 4.1.0
  30679. * @category Object
  30680. * @param {Object} object The object to invert.
  30681. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  30682. * @returns {Object} Returns the new inverted object.
  30683. * @example
  30684. *
  30685. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30686. *
  30687. * _.invertBy(object);
  30688. * // => { '1': ['a', 'c'], '2': ['b'] }
  30689. *
  30690. * _.invertBy(object, function(value) {
  30691. * return 'group' + value;
  30692. * });
  30693. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  30694. */
  30695. var invertBy = createInverter(function(result, value, key) {
  30696. if (value != null &&
  30697. typeof value.toString != 'function') {
  30698. value = nativeObjectToString.call(value);
  30699. }
  30700. if (hasOwnProperty.call(result, value)) {
  30701. result[value].push(key);
  30702. } else {
  30703. result[value] = [key];
  30704. }
  30705. }, getIteratee);
  30706. /**
  30707. * Invokes the method at `path` of `object`.
  30708. *
  30709. * @static
  30710. * @memberOf _
  30711. * @since 4.0.0
  30712. * @category Object
  30713. * @param {Object} object The object to query.
  30714. * @param {Array|string} path The path of the method to invoke.
  30715. * @param {...*} [args] The arguments to invoke the method with.
  30716. * @returns {*} Returns the result of the invoked method.
  30717. * @example
  30718. *
  30719. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  30720. *
  30721. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  30722. * // => [2, 3]
  30723. */
  30724. var invoke = baseRest(baseInvoke);
  30725. /**
  30726. * Creates an array of the own enumerable property names of `object`.
  30727. *
  30728. * **Note:** Non-object values are coerced to objects. See the
  30729. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  30730. * for more details.
  30731. *
  30732. * @static
  30733. * @since 0.1.0
  30734. * @memberOf _
  30735. * @category Object
  30736. * @param {Object} object The object to query.
  30737. * @returns {Array} Returns the array of property names.
  30738. * @example
  30739. *
  30740. * function Foo() {
  30741. * this.a = 1;
  30742. * this.b = 2;
  30743. * }
  30744. *
  30745. * Foo.prototype.c = 3;
  30746. *
  30747. * _.keys(new Foo);
  30748. * // => ['a', 'b'] (iteration order is not guaranteed)
  30749. *
  30750. * _.keys('hi');
  30751. * // => ['0', '1']
  30752. */
  30753. function keys(object) {
  30754. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  30755. }
  30756. /**
  30757. * Creates an array of the own and inherited enumerable property names of `object`.
  30758. *
  30759. * **Note:** Non-object values are coerced to objects.
  30760. *
  30761. * @static
  30762. * @memberOf _
  30763. * @since 3.0.0
  30764. * @category Object
  30765. * @param {Object} object The object to query.
  30766. * @returns {Array} Returns the array of property names.
  30767. * @example
  30768. *
  30769. * function Foo() {
  30770. * this.a = 1;
  30771. * this.b = 2;
  30772. * }
  30773. *
  30774. * Foo.prototype.c = 3;
  30775. *
  30776. * _.keysIn(new Foo);
  30777. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  30778. */
  30779. function keysIn(object) {
  30780. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  30781. }
  30782. /**
  30783. * The opposite of `_.mapValues`; this method creates an object with the
  30784. * same values as `object` and keys generated by running each own enumerable
  30785. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  30786. * with three arguments: (value, key, object).
  30787. *
  30788. * @static
  30789. * @memberOf _
  30790. * @since 3.8.0
  30791. * @category Object
  30792. * @param {Object} object The object to iterate over.
  30793. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30794. * @returns {Object} Returns the new mapped object.
  30795. * @see _.mapValues
  30796. * @example
  30797. *
  30798. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  30799. * return key + value;
  30800. * });
  30801. * // => { 'a1': 1, 'b2': 2 }
  30802. */
  30803. function mapKeys(object, iteratee) {
  30804. var result = {};
  30805. iteratee = getIteratee(iteratee, 3);
  30806. baseForOwn(object, function(value, key, object) {
  30807. baseAssignValue(result, iteratee(value, key, object), value);
  30808. });
  30809. return result;
  30810. }
  30811. /**
  30812. * Creates an object with the same keys as `object` and values generated
  30813. * by running each own enumerable string keyed property of `object` thru
  30814. * `iteratee`. The iteratee is invoked with three arguments:
  30815. * (value, key, object).
  30816. *
  30817. * @static
  30818. * @memberOf _
  30819. * @since 2.4.0
  30820. * @category Object
  30821. * @param {Object} object The object to iterate over.
  30822. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30823. * @returns {Object} Returns the new mapped object.
  30824. * @see _.mapKeys
  30825. * @example
  30826. *
  30827. * var users = {
  30828. * 'fred': { 'user': 'fred', 'age': 40 },
  30829. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  30830. * };
  30831. *
  30832. * _.mapValues(users, function(o) { return o.age; });
  30833. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30834. *
  30835. * // The `_.property` iteratee shorthand.
  30836. * _.mapValues(users, 'age');
  30837. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30838. */
  30839. function mapValues(object, iteratee) {
  30840. var result = {};
  30841. iteratee = getIteratee(iteratee, 3);
  30842. baseForOwn(object, function(value, key, object) {
  30843. baseAssignValue(result, key, iteratee(value, key, object));
  30844. });
  30845. return result;
  30846. }
  30847. /**
  30848. * This method is like `_.assign` except that it recursively merges own and
  30849. * inherited enumerable string keyed properties of source objects into the
  30850. * destination object. Source properties that resolve to `undefined` are
  30851. * skipped if a destination value exists. Array and plain object properties
  30852. * are merged recursively. Other objects and value types are overridden by
  30853. * assignment. Source objects are applied from left to right. Subsequent
  30854. * sources overwrite property assignments of previous sources.
  30855. *
  30856. * **Note:** This method mutates `object`.
  30857. *
  30858. * @static
  30859. * @memberOf _
  30860. * @since 0.5.0
  30861. * @category Object
  30862. * @param {Object} object The destination object.
  30863. * @param {...Object} [sources] The source objects.
  30864. * @returns {Object} Returns `object`.
  30865. * @example
  30866. *
  30867. * var object = {
  30868. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  30869. * };
  30870. *
  30871. * var other = {
  30872. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  30873. * };
  30874. *
  30875. * _.merge(object, other);
  30876. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  30877. */
  30878. var merge = createAssigner(function(object, source, srcIndex) {
  30879. baseMerge(object, source, srcIndex);
  30880. });
  30881. /**
  30882. * This method is like `_.merge` except that it accepts `customizer` which
  30883. * is invoked to produce the merged values of the destination and source
  30884. * properties. If `customizer` returns `undefined`, merging is handled by the
  30885. * method instead. The `customizer` is invoked with six arguments:
  30886. * (objValue, srcValue, key, object, source, stack).
  30887. *
  30888. * **Note:** This method mutates `object`.
  30889. *
  30890. * @static
  30891. * @memberOf _
  30892. * @since 4.0.0
  30893. * @category Object
  30894. * @param {Object} object The destination object.
  30895. * @param {...Object} sources The source objects.
  30896. * @param {Function} customizer The function to customize assigned values.
  30897. * @returns {Object} Returns `object`.
  30898. * @example
  30899. *
  30900. * function customizer(objValue, srcValue) {
  30901. * if (_.isArray(objValue)) {
  30902. * return objValue.concat(srcValue);
  30903. * }
  30904. * }
  30905. *
  30906. * var object = { 'a': [1], 'b': [2] };
  30907. * var other = { 'a': [3], 'b': [4] };
  30908. *
  30909. * _.mergeWith(object, other, customizer);
  30910. * // => { 'a': [1, 3], 'b': [2, 4] }
  30911. */
  30912. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  30913. baseMerge(object, source, srcIndex, customizer);
  30914. });
  30915. /**
  30916. * The opposite of `_.pick`; this method creates an object composed of the
  30917. * own and inherited enumerable property paths of `object` that are not omitted.
  30918. *
  30919. * **Note:** This method is considerably slower than `_.pick`.
  30920. *
  30921. * @static
  30922. * @since 0.1.0
  30923. * @memberOf _
  30924. * @category Object
  30925. * @param {Object} object The source object.
  30926. * @param {...(string|string[])} [paths] The property paths to omit.
  30927. * @returns {Object} Returns the new object.
  30928. * @example
  30929. *
  30930. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30931. *
  30932. * _.omit(object, ['a', 'c']);
  30933. * // => { 'b': '2' }
  30934. */
  30935. var omit = flatRest(function(object, paths) {
  30936. var result = {};
  30937. if (object == null) {
  30938. return result;
  30939. }
  30940. var isDeep = false;
  30941. paths = arrayMap(paths, function(path) {
  30942. path = castPath(path, object);
  30943. isDeep || (isDeep = path.length > 1);
  30944. return path;
  30945. });
  30946. copyObject(object, getAllKeysIn(object), result);
  30947. if (isDeep) {
  30948. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  30949. }
  30950. var length = paths.length;
  30951. while (length--) {
  30952. baseUnset(result, paths[length]);
  30953. }
  30954. return result;
  30955. });
  30956. /**
  30957. * The opposite of `_.pickBy`; this method creates an object composed of
  30958. * the own and inherited enumerable string keyed properties of `object` that
  30959. * `predicate` doesn't return truthy for. The predicate is invoked with two
  30960. * 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. * _.omitBy(object, _.isNumber);
  30974. * // => { 'b': '2' }
  30975. */
  30976. function omitBy(object, predicate) {
  30977. return pickBy(object, negate(getIteratee(predicate)));
  30978. }
  30979. /**
  30980. * Creates an object composed of the picked `object` properties.
  30981. *
  30982. * @static
  30983. * @since 0.1.0
  30984. * @memberOf _
  30985. * @category Object
  30986. * @param {Object} object The source object.
  30987. * @param {...(string|string[])} [paths] The property paths to pick.
  30988. * @returns {Object} Returns the new object.
  30989. * @example
  30990. *
  30991. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30992. *
  30993. * _.pick(object, ['a', 'c']);
  30994. * // => { 'a': 1, 'c': 3 }
  30995. */
  30996. var pick = flatRest(function(object, paths) {
  30997. return object == null ? {} : basePick(object, paths);
  30998. });
  30999. /**
  31000. * Creates an object composed of the `object` properties `predicate` returns
  31001. * truthy for. The predicate is invoked with two arguments: (value, key).
  31002. *
  31003. * @static
  31004. * @memberOf _
  31005. * @since 4.0.0
  31006. * @category Object
  31007. * @param {Object} object The source object.
  31008. * @param {Function} [predicate=_.identity] The function invoked per property.
  31009. * @returns {Object} Returns the new object.
  31010. * @example
  31011. *
  31012. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31013. *
  31014. * _.pickBy(object, _.isNumber);
  31015. * // => { 'a': 1, 'c': 3 }
  31016. */
  31017. function pickBy(object, predicate) {
  31018. if (object == null) {
  31019. return {};
  31020. }
  31021. var props = arrayMap(getAllKeysIn(object), function(prop) {
  31022. return [prop];
  31023. });
  31024. predicate = getIteratee(predicate);
  31025. return basePickBy(object, props, function(value, path) {
  31026. return predicate(value, path[0]);
  31027. });
  31028. }
  31029. /**
  31030. * This method is like `_.get` except that if the resolved value is a
  31031. * function it's invoked with the `this` binding of its parent object and
  31032. * its result is returned.
  31033. *
  31034. * @static
  31035. * @since 0.1.0
  31036. * @memberOf _
  31037. * @category Object
  31038. * @param {Object} object The object to query.
  31039. * @param {Array|string} path The path of the property to resolve.
  31040. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31041. * @returns {*} Returns the resolved value.
  31042. * @example
  31043. *
  31044. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  31045. *
  31046. * _.result(object, 'a[0].b.c1');
  31047. * // => 3
  31048. *
  31049. * _.result(object, 'a[0].b.c2');
  31050. * // => 4
  31051. *
  31052. * _.result(object, 'a[0].b.c3', 'default');
  31053. * // => 'default'
  31054. *
  31055. * _.result(object, 'a[0].b.c3', _.constant('default'));
  31056. * // => 'default'
  31057. */
  31058. function result(object, path, defaultValue) {
  31059. path = castPath(path, object);
  31060. var index = -1,
  31061. length = path.length;
  31062. // Ensure the loop is entered when path is empty.
  31063. if (!length) {
  31064. length = 1;
  31065. object = undefined;
  31066. }
  31067. while (++index < length) {
  31068. var value = object == null ? undefined : object[toKey(path[index])];
  31069. if (value === undefined) {
  31070. index = length;
  31071. value = defaultValue;
  31072. }
  31073. object = isFunction(value) ? value.call(object) : value;
  31074. }
  31075. return object;
  31076. }
  31077. /**
  31078. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  31079. * it's created. Arrays are created for missing index properties while objects
  31080. * are created for all other missing properties. Use `_.setWith` to customize
  31081. * `path` creation.
  31082. *
  31083. * **Note:** This method mutates `object`.
  31084. *
  31085. * @static
  31086. * @memberOf _
  31087. * @since 3.7.0
  31088. * @category Object
  31089. * @param {Object} object The object to modify.
  31090. * @param {Array|string} path The path of the property to set.
  31091. * @param {*} value The value to set.
  31092. * @returns {Object} Returns `object`.
  31093. * @example
  31094. *
  31095. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31096. *
  31097. * _.set(object, 'a[0].b.c', 4);
  31098. * console.log(object.a[0].b.c);
  31099. * // => 4
  31100. *
  31101. * _.set(object, ['x', '0', 'y', 'z'], 5);
  31102. * console.log(object.x[0].y.z);
  31103. * // => 5
  31104. */
  31105. function set(object, path, value) {
  31106. return object == null ? object : baseSet(object, path, value);
  31107. }
  31108. /**
  31109. * This method is like `_.set` except that it accepts `customizer` which is
  31110. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31111. * path creation is handled by the method instead. The `customizer` is invoked
  31112. * with three arguments: (nsValue, key, nsObject).
  31113. *
  31114. * **Note:** This method mutates `object`.
  31115. *
  31116. * @static
  31117. * @memberOf _
  31118. * @since 4.0.0
  31119. * @category Object
  31120. * @param {Object} object The object to modify.
  31121. * @param {Array|string} path The path of the property to set.
  31122. * @param {*} value The value to set.
  31123. * @param {Function} [customizer] The function to customize assigned values.
  31124. * @returns {Object} Returns `object`.
  31125. * @example
  31126. *
  31127. * var object = {};
  31128. *
  31129. * _.setWith(object, '[0][1]', 'a', Object);
  31130. * // => { '0': { '1': 'a' } }
  31131. */
  31132. function setWith(object, path, value, customizer) {
  31133. customizer = typeof customizer == 'function' ? customizer : undefined;
  31134. return object == null ? object : baseSet(object, path, value, customizer);
  31135. }
  31136. /**
  31137. * Creates an array of own enumerable string keyed-value pairs for `object`
  31138. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  31139. * entries are returned.
  31140. *
  31141. * @static
  31142. * @memberOf _
  31143. * @since 4.0.0
  31144. * @alias entries
  31145. * @category Object
  31146. * @param {Object} object The object to query.
  31147. * @returns {Array} Returns the key-value pairs.
  31148. * @example
  31149. *
  31150. * function Foo() {
  31151. * this.a = 1;
  31152. * this.b = 2;
  31153. * }
  31154. *
  31155. * Foo.prototype.c = 3;
  31156. *
  31157. * _.toPairs(new Foo);
  31158. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  31159. */
  31160. var toPairs = createToPairs(keys);
  31161. /**
  31162. * Creates an array of own and inherited enumerable string keyed-value pairs
  31163. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  31164. * or set, its entries are returned.
  31165. *
  31166. * @static
  31167. * @memberOf _
  31168. * @since 4.0.0
  31169. * @alias entriesIn
  31170. * @category Object
  31171. * @param {Object} object The object to query.
  31172. * @returns {Array} Returns the key-value pairs.
  31173. * @example
  31174. *
  31175. * function Foo() {
  31176. * this.a = 1;
  31177. * this.b = 2;
  31178. * }
  31179. *
  31180. * Foo.prototype.c = 3;
  31181. *
  31182. * _.toPairsIn(new Foo);
  31183. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  31184. */
  31185. var toPairsIn = createToPairs(keysIn);
  31186. /**
  31187. * An alternative to `_.reduce`; this method transforms `object` to a new
  31188. * `accumulator` object which is the result of running each of its own
  31189. * enumerable string keyed properties thru `iteratee`, with each invocation
  31190. * potentially mutating the `accumulator` object. If `accumulator` is not
  31191. * provided, a new object with the same `[[Prototype]]` will be used. The
  31192. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  31193. * Iteratee functions may exit iteration early by explicitly returning `false`.
  31194. *
  31195. * @static
  31196. * @memberOf _
  31197. * @since 1.3.0
  31198. * @category Object
  31199. * @param {Object} object The object to iterate over.
  31200. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31201. * @param {*} [accumulator] The custom accumulator value.
  31202. * @returns {*} Returns the accumulated value.
  31203. * @example
  31204. *
  31205. * _.transform([2, 3, 4], function(result, n) {
  31206. * result.push(n *= n);
  31207. * return n % 2 == 0;
  31208. * }, []);
  31209. * // => [4, 9]
  31210. *
  31211. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  31212. * (result[value] || (result[value] = [])).push(key);
  31213. * }, {});
  31214. * // => { '1': ['a', 'c'], '2': ['b'] }
  31215. */
  31216. function transform(object, iteratee, accumulator) {
  31217. var isArr = isArray(object),
  31218. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  31219. iteratee = getIteratee(iteratee, 4);
  31220. if (accumulator == null) {
  31221. var Ctor = object && object.constructor;
  31222. if (isArrLike) {
  31223. accumulator = isArr ? new Ctor : [];
  31224. }
  31225. else if (isObject(object)) {
  31226. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  31227. }
  31228. else {
  31229. accumulator = {};
  31230. }
  31231. }
  31232. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  31233. return iteratee(accumulator, value, index, object);
  31234. });
  31235. return accumulator;
  31236. }
  31237. /**
  31238. * Removes the property at `path` of `object`.
  31239. *
  31240. * **Note:** This method mutates `object`.
  31241. *
  31242. * @static
  31243. * @memberOf _
  31244. * @since 4.0.0
  31245. * @category Object
  31246. * @param {Object} object The object to modify.
  31247. * @param {Array|string} path The path of the property to unset.
  31248. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  31249. * @example
  31250. *
  31251. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  31252. * _.unset(object, 'a[0].b.c');
  31253. * // => true
  31254. *
  31255. * console.log(object);
  31256. * // => { 'a': [{ 'b': {} }] };
  31257. *
  31258. * _.unset(object, ['a', '0', 'b', 'c']);
  31259. * // => true
  31260. *
  31261. * console.log(object);
  31262. * // => { 'a': [{ 'b': {} }] };
  31263. */
  31264. function unset(object, path) {
  31265. return object == null ? true : baseUnset(object, path);
  31266. }
  31267. /**
  31268. * This method is like `_.set` except that accepts `updater` to produce the
  31269. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  31270. * is invoked with one argument: (value).
  31271. *
  31272. * **Note:** This method mutates `object`.
  31273. *
  31274. * @static
  31275. * @memberOf _
  31276. * @since 4.6.0
  31277. * @category Object
  31278. * @param {Object} object The object to modify.
  31279. * @param {Array|string} path The path of the property to set.
  31280. * @param {Function} updater The function to produce the updated value.
  31281. * @returns {Object} Returns `object`.
  31282. * @example
  31283. *
  31284. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31285. *
  31286. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  31287. * console.log(object.a[0].b.c);
  31288. * // => 9
  31289. *
  31290. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  31291. * console.log(object.x[0].y.z);
  31292. * // => 0
  31293. */
  31294. function update(object, path, updater) {
  31295. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  31296. }
  31297. /**
  31298. * This method is like `_.update` except that it accepts `customizer` which is
  31299. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31300. * path creation is handled by the method instead. The `customizer` is invoked
  31301. * with three arguments: (nsValue, key, nsObject).
  31302. *
  31303. * **Note:** This method mutates `object`.
  31304. *
  31305. * @static
  31306. * @memberOf _
  31307. * @since 4.6.0
  31308. * @category Object
  31309. * @param {Object} object The object to modify.
  31310. * @param {Array|string} path The path of the property to set.
  31311. * @param {Function} updater The function to produce the updated value.
  31312. * @param {Function} [customizer] The function to customize assigned values.
  31313. * @returns {Object} Returns `object`.
  31314. * @example
  31315. *
  31316. * var object = {};
  31317. *
  31318. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  31319. * // => { '0': { '1': 'a' } }
  31320. */
  31321. function updateWith(object, path, updater, customizer) {
  31322. customizer = typeof customizer == 'function' ? customizer : undefined;
  31323. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  31324. }
  31325. /**
  31326. * Creates an array of the own enumerable string keyed property values of `object`.
  31327. *
  31328. * **Note:** Non-object values are coerced to objects.
  31329. *
  31330. * @static
  31331. * @since 0.1.0
  31332. * @memberOf _
  31333. * @category Object
  31334. * @param {Object} object The object to query.
  31335. * @returns {Array} Returns the array of property values.
  31336. * @example
  31337. *
  31338. * function Foo() {
  31339. * this.a = 1;
  31340. * this.b = 2;
  31341. * }
  31342. *
  31343. * Foo.prototype.c = 3;
  31344. *
  31345. * _.values(new Foo);
  31346. * // => [1, 2] (iteration order is not guaranteed)
  31347. *
  31348. * _.values('hi');
  31349. * // => ['h', 'i']
  31350. */
  31351. function values(object) {
  31352. return object == null ? [] : baseValues(object, keys(object));
  31353. }
  31354. /**
  31355. * Creates an array of the own and inherited enumerable string keyed property
  31356. * values of `object`.
  31357. *
  31358. * **Note:** Non-object values are coerced to objects.
  31359. *
  31360. * @static
  31361. * @memberOf _
  31362. * @since 3.0.0
  31363. * @category Object
  31364. * @param {Object} object The object to query.
  31365. * @returns {Array} Returns the array of property values.
  31366. * @example
  31367. *
  31368. * function Foo() {
  31369. * this.a = 1;
  31370. * this.b = 2;
  31371. * }
  31372. *
  31373. * Foo.prototype.c = 3;
  31374. *
  31375. * _.valuesIn(new Foo);
  31376. * // => [1, 2, 3] (iteration order is not guaranteed)
  31377. */
  31378. function valuesIn(object) {
  31379. return object == null ? [] : baseValues(object, keysIn(object));
  31380. }
  31381. /*------------------------------------------------------------------------*/
  31382. /**
  31383. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  31384. *
  31385. * @static
  31386. * @memberOf _
  31387. * @since 4.0.0
  31388. * @category Number
  31389. * @param {number} number The number to clamp.
  31390. * @param {number} [lower] The lower bound.
  31391. * @param {number} upper The upper bound.
  31392. * @returns {number} Returns the clamped number.
  31393. * @example
  31394. *
  31395. * _.clamp(-10, -5, 5);
  31396. * // => -5
  31397. *
  31398. * _.clamp(10, -5, 5);
  31399. * // => 5
  31400. */
  31401. function clamp(number, lower, upper) {
  31402. if (upper === undefined) {
  31403. upper = lower;
  31404. lower = undefined;
  31405. }
  31406. if (upper !== undefined) {
  31407. upper = toNumber(upper);
  31408. upper = upper === upper ? upper : 0;
  31409. }
  31410. if (lower !== undefined) {
  31411. lower = toNumber(lower);
  31412. lower = lower === lower ? lower : 0;
  31413. }
  31414. return baseClamp(toNumber(number), lower, upper);
  31415. }
  31416. /**
  31417. * Checks if `n` is between `start` and up to, but not including, `end`. If
  31418. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  31419. * If `start` is greater than `end` the params are swapped to support
  31420. * negative ranges.
  31421. *
  31422. * @static
  31423. * @memberOf _
  31424. * @since 3.3.0
  31425. * @category Number
  31426. * @param {number} number The number to check.
  31427. * @param {number} [start=0] The start of the range.
  31428. * @param {number} end The end of the range.
  31429. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  31430. * @see _.range, _.rangeRight
  31431. * @example
  31432. *
  31433. * _.inRange(3, 2, 4);
  31434. * // => true
  31435. *
  31436. * _.inRange(4, 8);
  31437. * // => true
  31438. *
  31439. * _.inRange(4, 2);
  31440. * // => false
  31441. *
  31442. * _.inRange(2, 2);
  31443. * // => false
  31444. *
  31445. * _.inRange(1.2, 2);
  31446. * // => true
  31447. *
  31448. * _.inRange(5.2, 4);
  31449. * // => false
  31450. *
  31451. * _.inRange(-3, -2, -6);
  31452. * // => true
  31453. */
  31454. function inRange(number, start, end) {
  31455. start = toFinite(start);
  31456. if (end === undefined) {
  31457. end = start;
  31458. start = 0;
  31459. } else {
  31460. end = toFinite(end);
  31461. }
  31462. number = toNumber(number);
  31463. return baseInRange(number, start, end);
  31464. }
  31465. /**
  31466. * Produces a random number between the inclusive `lower` and `upper` bounds.
  31467. * If only one argument is provided a number between `0` and the given number
  31468. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  31469. * floats, a floating-point number is returned instead of an integer.
  31470. *
  31471. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  31472. * floating-point values which can produce unexpected results.
  31473. *
  31474. * @static
  31475. * @memberOf _
  31476. * @since 0.7.0
  31477. * @category Number
  31478. * @param {number} [lower=0] The lower bound.
  31479. * @param {number} [upper=1] The upper bound.
  31480. * @param {boolean} [floating] Specify returning a floating-point number.
  31481. * @returns {number} Returns the random number.
  31482. * @example
  31483. *
  31484. * _.random(0, 5);
  31485. * // => an integer between 0 and 5
  31486. *
  31487. * _.random(5);
  31488. * // => also an integer between 0 and 5
  31489. *
  31490. * _.random(5, true);
  31491. * // => a floating-point number between 0 and 5
  31492. *
  31493. * _.random(1.2, 5.2);
  31494. * // => a floating-point number between 1.2 and 5.2
  31495. */
  31496. function random(lower, upper, floating) {
  31497. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  31498. upper = floating = undefined;
  31499. }
  31500. if (floating === undefined) {
  31501. if (typeof upper == 'boolean') {
  31502. floating = upper;
  31503. upper = undefined;
  31504. }
  31505. else if (typeof lower == 'boolean') {
  31506. floating = lower;
  31507. lower = undefined;
  31508. }
  31509. }
  31510. if (lower === undefined && upper === undefined) {
  31511. lower = 0;
  31512. upper = 1;
  31513. }
  31514. else {
  31515. lower = toFinite(lower);
  31516. if (upper === undefined) {
  31517. upper = lower;
  31518. lower = 0;
  31519. } else {
  31520. upper = toFinite(upper);
  31521. }
  31522. }
  31523. if (lower > upper) {
  31524. var temp = lower;
  31525. lower = upper;
  31526. upper = temp;
  31527. }
  31528. if (floating || lower % 1 || upper % 1) {
  31529. var rand = nativeRandom();
  31530. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  31531. }
  31532. return baseRandom(lower, upper);
  31533. }
  31534. /*------------------------------------------------------------------------*/
  31535. /**
  31536. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  31537. *
  31538. * @static
  31539. * @memberOf _
  31540. * @since 3.0.0
  31541. * @category String
  31542. * @param {string} [string=''] The string to convert.
  31543. * @returns {string} Returns the camel cased string.
  31544. * @example
  31545. *
  31546. * _.camelCase('Foo Bar');
  31547. * // => 'fooBar'
  31548. *
  31549. * _.camelCase('--foo-bar--');
  31550. * // => 'fooBar'
  31551. *
  31552. * _.camelCase('__FOO_BAR__');
  31553. * // => 'fooBar'
  31554. */
  31555. var camelCase = createCompounder(function(result, word, index) {
  31556. word = word.toLowerCase();
  31557. return result + (index ? capitalize(word) : word);
  31558. });
  31559. /**
  31560. * Converts the first character of `string` to upper case and the remaining
  31561. * to lower case.
  31562. *
  31563. * @static
  31564. * @memberOf _
  31565. * @since 3.0.0
  31566. * @category String
  31567. * @param {string} [string=''] The string to capitalize.
  31568. * @returns {string} Returns the capitalized string.
  31569. * @example
  31570. *
  31571. * _.capitalize('FRED');
  31572. * // => 'Fred'
  31573. */
  31574. function capitalize(string) {
  31575. return upperFirst(toString(string).toLowerCase());
  31576. }
  31577. /**
  31578. * Deburrs `string` by converting
  31579. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  31580. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  31581. * letters to basic Latin letters and removing
  31582. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  31583. *
  31584. * @static
  31585. * @memberOf _
  31586. * @since 3.0.0
  31587. * @category String
  31588. * @param {string} [string=''] The string to deburr.
  31589. * @returns {string} Returns the deburred string.
  31590. * @example
  31591. *
  31592. * _.deburr('déjà vu');
  31593. * // => 'deja vu'
  31594. */
  31595. function deburr(string) {
  31596. string = toString(string);
  31597. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  31598. }
  31599. /**
  31600. * Checks if `string` ends with the given target string.
  31601. *
  31602. * @static
  31603. * @memberOf _
  31604. * @since 3.0.0
  31605. * @category String
  31606. * @param {string} [string=''] The string to inspect.
  31607. * @param {string} [target] The string to search for.
  31608. * @param {number} [position=string.length] The position to search up to.
  31609. * @returns {boolean} Returns `true` if `string` ends with `target`,
  31610. * else `false`.
  31611. * @example
  31612. *
  31613. * _.endsWith('abc', 'c');
  31614. * // => true
  31615. *
  31616. * _.endsWith('abc', 'b');
  31617. * // => false
  31618. *
  31619. * _.endsWith('abc', 'b', 2);
  31620. * // => true
  31621. */
  31622. function endsWith(string, target, position) {
  31623. string = toString(string);
  31624. target = baseToString(target);
  31625. var length = string.length;
  31626. position = position === undefined
  31627. ? length
  31628. : baseClamp(toInteger(position), 0, length);
  31629. var end = position;
  31630. position -= target.length;
  31631. return position >= 0 && string.slice(position, end) == target;
  31632. }
  31633. /**
  31634. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  31635. * corresponding HTML entities.
  31636. *
  31637. * **Note:** No other characters are escaped. To escape additional
  31638. * characters use a third-party library like [_he_](https://mths.be/he).
  31639. *
  31640. * Though the ">" character is escaped for symmetry, characters like
  31641. * ">" and "/" don't need escaping in HTML and have no special meaning
  31642. * unless they're part of a tag or unquoted attribute value. See
  31643. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  31644. * (under "semi-related fun fact") for more details.
  31645. *
  31646. * When working with HTML you should always
  31647. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  31648. * XSS vectors.
  31649. *
  31650. * @static
  31651. * @since 0.1.0
  31652. * @memberOf _
  31653. * @category String
  31654. * @param {string} [string=''] The string to escape.
  31655. * @returns {string} Returns the escaped string.
  31656. * @example
  31657. *
  31658. * _.escape('fred, barney, & pebbles');
  31659. * // => 'fred, barney, &amp; pebbles'
  31660. */
  31661. function escape(string) {
  31662. string = toString(string);
  31663. return (string && reHasUnescapedHtml.test(string))
  31664. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  31665. : string;
  31666. }
  31667. /**
  31668. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  31669. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  31670. *
  31671. * @static
  31672. * @memberOf _
  31673. * @since 3.0.0
  31674. * @category String
  31675. * @param {string} [string=''] The string to escape.
  31676. * @returns {string} Returns the escaped string.
  31677. * @example
  31678. *
  31679. * _.escapeRegExp('[lodash](https://lodash.com/)');
  31680. * // => '\[lodash\]\(https://lodash\.com/\)'
  31681. */
  31682. function escapeRegExp(string) {
  31683. string = toString(string);
  31684. return (string && reHasRegExpChar.test(string))
  31685. ? string.replace(reRegExpChar, '\\$&')
  31686. : string;
  31687. }
  31688. /**
  31689. * Converts `string` to
  31690. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  31691. *
  31692. * @static
  31693. * @memberOf _
  31694. * @since 3.0.0
  31695. * @category String
  31696. * @param {string} [string=''] The string to convert.
  31697. * @returns {string} Returns the kebab cased string.
  31698. * @example
  31699. *
  31700. * _.kebabCase('Foo Bar');
  31701. * // => 'foo-bar'
  31702. *
  31703. * _.kebabCase('fooBar');
  31704. * // => 'foo-bar'
  31705. *
  31706. * _.kebabCase('__FOO_BAR__');
  31707. * // => 'foo-bar'
  31708. */
  31709. var kebabCase = createCompounder(function(result, word, index) {
  31710. return result + (index ? '-' : '') + word.toLowerCase();
  31711. });
  31712. /**
  31713. * Converts `string`, as space separated words, to lower case.
  31714. *
  31715. * @static
  31716. * @memberOf _
  31717. * @since 4.0.0
  31718. * @category String
  31719. * @param {string} [string=''] The string to convert.
  31720. * @returns {string} Returns the lower cased string.
  31721. * @example
  31722. *
  31723. * _.lowerCase('--Foo-Bar--');
  31724. * // => 'foo bar'
  31725. *
  31726. * _.lowerCase('fooBar');
  31727. * // => 'foo bar'
  31728. *
  31729. * _.lowerCase('__FOO_BAR__');
  31730. * // => 'foo bar'
  31731. */
  31732. var lowerCase = createCompounder(function(result, word, index) {
  31733. return result + (index ? ' ' : '') + word.toLowerCase();
  31734. });
  31735. /**
  31736. * Converts the first character of `string` to lower case.
  31737. *
  31738. * @static
  31739. * @memberOf _
  31740. * @since 4.0.0
  31741. * @category String
  31742. * @param {string} [string=''] The string to convert.
  31743. * @returns {string} Returns the converted string.
  31744. * @example
  31745. *
  31746. * _.lowerFirst('Fred');
  31747. * // => 'fred'
  31748. *
  31749. * _.lowerFirst('FRED');
  31750. * // => 'fRED'
  31751. */
  31752. var lowerFirst = createCaseFirst('toLowerCase');
  31753. /**
  31754. * Pads `string` on the left and right sides if it's shorter than `length`.
  31755. * Padding characters are truncated if they can't be evenly divided by `length`.
  31756. *
  31757. * @static
  31758. * @memberOf _
  31759. * @since 3.0.0
  31760. * @category String
  31761. * @param {string} [string=''] The string to pad.
  31762. * @param {number} [length=0] The padding length.
  31763. * @param {string} [chars=' '] The string used as padding.
  31764. * @returns {string} Returns the padded string.
  31765. * @example
  31766. *
  31767. * _.pad('abc', 8);
  31768. * // => ' abc '
  31769. *
  31770. * _.pad('abc', 8, '_-');
  31771. * // => '_-abc_-_'
  31772. *
  31773. * _.pad('abc', 3);
  31774. * // => 'abc'
  31775. */
  31776. function pad(string, length, chars) {
  31777. string = toString(string);
  31778. length = toInteger(length);
  31779. var strLength = length ? stringSize(string) : 0;
  31780. if (!length || strLength >= length) {
  31781. return string;
  31782. }
  31783. var mid = (length - strLength) / 2;
  31784. return (
  31785. createPadding(nativeFloor(mid), chars) +
  31786. string +
  31787. createPadding(nativeCeil(mid), chars)
  31788. );
  31789. }
  31790. /**
  31791. * Pads `string` on the right side if it's shorter than `length`. Padding
  31792. * characters are truncated if they exceed `length`.
  31793. *
  31794. * @static
  31795. * @memberOf _
  31796. * @since 4.0.0
  31797. * @category String
  31798. * @param {string} [string=''] The string to pad.
  31799. * @param {number} [length=0] The padding length.
  31800. * @param {string} [chars=' '] The string used as padding.
  31801. * @returns {string} Returns the padded string.
  31802. * @example
  31803. *
  31804. * _.padEnd('abc', 6);
  31805. * // => 'abc '
  31806. *
  31807. * _.padEnd('abc', 6, '_-');
  31808. * // => 'abc_-_'
  31809. *
  31810. * _.padEnd('abc', 3);
  31811. * // => 'abc'
  31812. */
  31813. function padEnd(string, length, chars) {
  31814. string = toString(string);
  31815. length = toInteger(length);
  31816. var strLength = length ? stringSize(string) : 0;
  31817. return (length && strLength < length)
  31818. ? (string + createPadding(length - strLength, chars))
  31819. : string;
  31820. }
  31821. /**
  31822. * Pads `string` on the left side if it's shorter than `length`. Padding
  31823. * characters are truncated if they exceed `length`.
  31824. *
  31825. * @static
  31826. * @memberOf _
  31827. * @since 4.0.0
  31828. * @category String
  31829. * @param {string} [string=''] The string to pad.
  31830. * @param {number} [length=0] The padding length.
  31831. * @param {string} [chars=' '] The string used as padding.
  31832. * @returns {string} Returns the padded string.
  31833. * @example
  31834. *
  31835. * _.padStart('abc', 6);
  31836. * // => ' abc'
  31837. *
  31838. * _.padStart('abc', 6, '_-');
  31839. * // => '_-_abc'
  31840. *
  31841. * _.padStart('abc', 3);
  31842. * // => 'abc'
  31843. */
  31844. function padStart(string, length, chars) {
  31845. string = toString(string);
  31846. length = toInteger(length);
  31847. var strLength = length ? stringSize(string) : 0;
  31848. return (length && strLength < length)
  31849. ? (createPadding(length - strLength, chars) + string)
  31850. : string;
  31851. }
  31852. /**
  31853. * Converts `string` to an integer of the specified radix. If `radix` is
  31854. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  31855. * hexadecimal, in which case a `radix` of `16` is used.
  31856. *
  31857. * **Note:** This method aligns with the
  31858. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  31859. *
  31860. * @static
  31861. * @memberOf _
  31862. * @since 1.1.0
  31863. * @category String
  31864. * @param {string} string The string to convert.
  31865. * @param {number} [radix=10] The radix to interpret `value` by.
  31866. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31867. * @returns {number} Returns the converted integer.
  31868. * @example
  31869. *
  31870. * _.parseInt('08');
  31871. * // => 8
  31872. *
  31873. * _.map(['6', '08', '10'], _.parseInt);
  31874. * // => [6, 8, 10]
  31875. */
  31876. function parseInt(string, radix, guard) {
  31877. if (guard || radix == null) {
  31878. radix = 0;
  31879. } else if (radix) {
  31880. radix = +radix;
  31881. }
  31882. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  31883. }
  31884. /**
  31885. * Repeats the given string `n` times.
  31886. *
  31887. * @static
  31888. * @memberOf _
  31889. * @since 3.0.0
  31890. * @category String
  31891. * @param {string} [string=''] The string to repeat.
  31892. * @param {number} [n=1] The number of times to repeat the string.
  31893. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31894. * @returns {string} Returns the repeated string.
  31895. * @example
  31896. *
  31897. * _.repeat('*', 3);
  31898. * // => '***'
  31899. *
  31900. * _.repeat('abc', 2);
  31901. * // => 'abcabc'
  31902. *
  31903. * _.repeat('abc', 0);
  31904. * // => ''
  31905. */
  31906. function repeat(string, n, guard) {
  31907. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  31908. n = 1;
  31909. } else {
  31910. n = toInteger(n);
  31911. }
  31912. return baseRepeat(toString(string), n);
  31913. }
  31914. /**
  31915. * Replaces matches for `pattern` in `string` with `replacement`.
  31916. *
  31917. * **Note:** This method is based on
  31918. * [`String#replace`](https://mdn.io/String/replace).
  31919. *
  31920. * @static
  31921. * @memberOf _
  31922. * @since 4.0.0
  31923. * @category String
  31924. * @param {string} [string=''] The string to modify.
  31925. * @param {RegExp|string} pattern The pattern to replace.
  31926. * @param {Function|string} replacement The match replacement.
  31927. * @returns {string} Returns the modified string.
  31928. * @example
  31929. *
  31930. * _.replace('Hi Fred', 'Fred', 'Barney');
  31931. * // => 'Hi Barney'
  31932. */
  31933. function replace() {
  31934. var args = arguments,
  31935. string = toString(args[0]);
  31936. return args.length < 3 ? string : string.replace(args[1], args[2]);
  31937. }
  31938. /**
  31939. * Converts `string` to
  31940. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  31941. *
  31942. * @static
  31943. * @memberOf _
  31944. * @since 3.0.0
  31945. * @category String
  31946. * @param {string} [string=''] The string to convert.
  31947. * @returns {string} Returns the snake cased string.
  31948. * @example
  31949. *
  31950. * _.snakeCase('Foo Bar');
  31951. * // => 'foo_bar'
  31952. *
  31953. * _.snakeCase('fooBar');
  31954. * // => 'foo_bar'
  31955. *
  31956. * _.snakeCase('--FOO-BAR--');
  31957. * // => 'foo_bar'
  31958. */
  31959. var snakeCase = createCompounder(function(result, word, index) {
  31960. return result + (index ? '_' : '') + word.toLowerCase();
  31961. });
  31962. /**
  31963. * Splits `string` by `separator`.
  31964. *
  31965. * **Note:** This method is based on
  31966. * [`String#split`](https://mdn.io/String/split).
  31967. *
  31968. * @static
  31969. * @memberOf _
  31970. * @since 4.0.0
  31971. * @category String
  31972. * @param {string} [string=''] The string to split.
  31973. * @param {RegExp|string} separator The separator pattern to split by.
  31974. * @param {number} [limit] The length to truncate results to.
  31975. * @returns {Array} Returns the string segments.
  31976. * @example
  31977. *
  31978. * _.split('a-b-c', '-', 2);
  31979. * // => ['a', 'b']
  31980. */
  31981. function split(string, separator, limit) {
  31982. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  31983. separator = limit = undefined;
  31984. }
  31985. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  31986. if (!limit) {
  31987. return [];
  31988. }
  31989. string = toString(string);
  31990. if (string && (
  31991. typeof separator == 'string' ||
  31992. (separator != null && !isRegExp(separator))
  31993. )) {
  31994. separator = baseToString(separator);
  31995. if (!separator && hasUnicode(string)) {
  31996. return castSlice(stringToArray(string), 0, limit);
  31997. }
  31998. }
  31999. return string.split(separator, limit);
  32000. }
  32001. /**
  32002. * Converts `string` to
  32003. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  32004. *
  32005. * @static
  32006. * @memberOf _
  32007. * @since 3.1.0
  32008. * @category String
  32009. * @param {string} [string=''] The string to convert.
  32010. * @returns {string} Returns the start cased string.
  32011. * @example
  32012. *
  32013. * _.startCase('--foo-bar--');
  32014. * // => 'Foo Bar'
  32015. *
  32016. * _.startCase('fooBar');
  32017. * // => 'Foo Bar'
  32018. *
  32019. * _.startCase('__FOO_BAR__');
  32020. * // => 'FOO BAR'
  32021. */
  32022. var startCase = createCompounder(function(result, word, index) {
  32023. return result + (index ? ' ' : '') + upperFirst(word);
  32024. });
  32025. /**
  32026. * Checks if `string` starts with the given target string.
  32027. *
  32028. * @static
  32029. * @memberOf _
  32030. * @since 3.0.0
  32031. * @category String
  32032. * @param {string} [string=''] The string to inspect.
  32033. * @param {string} [target] The string to search for.
  32034. * @param {number} [position=0] The position to search from.
  32035. * @returns {boolean} Returns `true` if `string` starts with `target`,
  32036. * else `false`.
  32037. * @example
  32038. *
  32039. * _.startsWith('abc', 'a');
  32040. * // => true
  32041. *
  32042. * _.startsWith('abc', 'b');
  32043. * // => false
  32044. *
  32045. * _.startsWith('abc', 'b', 1);
  32046. * // => true
  32047. */
  32048. function startsWith(string, target, position) {
  32049. string = toString(string);
  32050. position = position == null
  32051. ? 0
  32052. : baseClamp(toInteger(position), 0, string.length);
  32053. target = baseToString(target);
  32054. return string.slice(position, position + target.length) == target;
  32055. }
  32056. /**
  32057. * Creates a compiled template function that can interpolate data properties
  32058. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  32059. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  32060. * properties may be accessed as free variables in the template. If a setting
  32061. * object is given, it takes precedence over `_.templateSettings` values.
  32062. *
  32063. * **Note:** In the development build `_.template` utilizes
  32064. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  32065. * for easier debugging.
  32066. *
  32067. * For more information on precompiling templates see
  32068. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  32069. *
  32070. * For more information on Chrome extension sandboxes see
  32071. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  32072. *
  32073. * @static
  32074. * @since 0.1.0
  32075. * @memberOf _
  32076. * @category String
  32077. * @param {string} [string=''] The template string.
  32078. * @param {Object} [options={}] The options object.
  32079. * @param {RegExp} [options.escape=_.templateSettings.escape]
  32080. * The HTML "escape" delimiter.
  32081. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  32082. * The "evaluate" delimiter.
  32083. * @param {Object} [options.imports=_.templateSettings.imports]
  32084. * An object to import into the template as free variables.
  32085. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  32086. * The "interpolate" delimiter.
  32087. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  32088. * The sourceURL of the compiled template.
  32089. * @param {string} [options.variable='obj']
  32090. * The data object variable name.
  32091. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32092. * @returns {Function} Returns the compiled template function.
  32093. * @example
  32094. *
  32095. * // Use the "interpolate" delimiter to create a compiled template.
  32096. * var compiled = _.template('hello <%= user %>!');
  32097. * compiled({ 'user': 'fred' });
  32098. * // => 'hello fred!'
  32099. *
  32100. * // Use the HTML "escape" delimiter to escape data property values.
  32101. * var compiled = _.template('<b><%- value %></b>');
  32102. * compiled({ 'value': '<script>' });
  32103. * // => '<b>&lt;script&gt;</b>'
  32104. *
  32105. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  32106. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  32107. * compiled({ 'users': ['fred', 'barney'] });
  32108. * // => '<li>fred</li><li>barney</li>'
  32109. *
  32110. * // Use the internal `print` function in "evaluate" delimiters.
  32111. * var compiled = _.template('<% print("hello " + user); %>!');
  32112. * compiled({ 'user': 'barney' });
  32113. * // => 'hello barney!'
  32114. *
  32115. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  32116. * // Disable support by replacing the "interpolate" delimiter.
  32117. * var compiled = _.template('hello ${ user }!');
  32118. * compiled({ 'user': 'pebbles' });
  32119. * // => 'hello pebbles!'
  32120. *
  32121. * // Use backslashes to treat delimiters as plain text.
  32122. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  32123. * compiled({ 'value': 'ignored' });
  32124. * // => '<%- value %>'
  32125. *
  32126. * // Use the `imports` option to import `jQuery` as `jq`.
  32127. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  32128. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  32129. * compiled({ 'users': ['fred', 'barney'] });
  32130. * // => '<li>fred</li><li>barney</li>'
  32131. *
  32132. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  32133. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  32134. * compiled(data);
  32135. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  32136. *
  32137. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  32138. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  32139. * compiled.source;
  32140. * // => function(data) {
  32141. * // var __t, __p = '';
  32142. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  32143. * // return __p;
  32144. * // }
  32145. *
  32146. * // Use custom template delimiters.
  32147. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  32148. * var compiled = _.template('hello {{ user }}!');
  32149. * compiled({ 'user': 'mustache' });
  32150. * // => 'hello mustache!'
  32151. *
  32152. * // Use the `source` property to inline compiled templates for meaningful
  32153. * // line numbers in error messages and stack traces.
  32154. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  32155. * var JST = {\
  32156. * "main": ' + _.template(mainText).source + '\
  32157. * };\
  32158. * ');
  32159. */
  32160. function template(string, options, guard) {
  32161. // Based on John Resig's `tmpl` implementation
  32162. // (http://ejohn.org/blog/javascript-micro-templating/)
  32163. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  32164. var settings = lodash.templateSettings;
  32165. if (guard && isIterateeCall(string, options, guard)) {
  32166. options = undefined;
  32167. }
  32168. string = toString(string);
  32169. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  32170. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  32171. importsKeys = keys(imports),
  32172. importsValues = baseValues(imports, importsKeys);
  32173. var isEscaping,
  32174. isEvaluating,
  32175. index = 0,
  32176. interpolate = options.interpolate || reNoMatch,
  32177. source = "__p += '";
  32178. // Compile the regexp to match each delimiter.
  32179. var reDelimiters = RegExp(
  32180. (options.escape || reNoMatch).source + '|' +
  32181. interpolate.source + '|' +
  32182. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  32183. (options.evaluate || reNoMatch).source + '|$'
  32184. , 'g');
  32185. // Use a sourceURL for easier debugging.
  32186. // The sourceURL gets injected into the source that's eval-ed, so be careful
  32187. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  32188. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  32189. var sourceURL = '//# sourceURL=' +
  32190. (hasOwnProperty.call(options, 'sourceURL')
  32191. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  32192. : ('lodash.templateSources[' + (++templateCounter) + ']')
  32193. ) + '\n';
  32194. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  32195. interpolateValue || (interpolateValue = esTemplateValue);
  32196. // Escape characters that can't be included in string literals.
  32197. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  32198. // Replace delimiters with snippets.
  32199. if (escapeValue) {
  32200. isEscaping = true;
  32201. source += "' +\n__e(" + escapeValue + ") +\n'";
  32202. }
  32203. if (evaluateValue) {
  32204. isEvaluating = true;
  32205. source += "';\n" + evaluateValue + ";\n__p += '";
  32206. }
  32207. if (interpolateValue) {
  32208. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  32209. }
  32210. index = offset + match.length;
  32211. // The JS engine embedded in Adobe products needs `match` returned in
  32212. // order to produce the correct `offset` value.
  32213. return match;
  32214. });
  32215. source += "';\n";
  32216. // If `variable` is not specified wrap a with-statement around the generated
  32217. // code to add the data object to the top of the scope chain.
  32218. // Like with sourceURL, we take care to not check the option's prototype,
  32219. // as this configuration is a code injection vector.
  32220. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  32221. if (!variable) {
  32222. source = 'with (obj) {\n' + source + '\n}\n';
  32223. }
  32224. // Cleanup code by stripping empty strings.
  32225. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  32226. .replace(reEmptyStringMiddle, '$1')
  32227. .replace(reEmptyStringTrailing, '$1;');
  32228. // Frame code as the function body.
  32229. source = 'function(' + (variable || 'obj') + ') {\n' +
  32230. (variable
  32231. ? ''
  32232. : 'obj || (obj = {});\n'
  32233. ) +
  32234. "var __t, __p = ''" +
  32235. (isEscaping
  32236. ? ', __e = _.escape'
  32237. : ''
  32238. ) +
  32239. (isEvaluating
  32240. ? ', __j = Array.prototype.join;\n' +
  32241. "function print() { __p += __j.call(arguments, '') }\n"
  32242. : ';\n'
  32243. ) +
  32244. source +
  32245. 'return __p\n}';
  32246. var result = attempt(function() {
  32247. return Function(importsKeys, sourceURL + 'return ' + source)
  32248. .apply(undefined, importsValues);
  32249. });
  32250. // Provide the compiled function's source by its `toString` method or
  32251. // the `source` property as a convenience for inlining compiled templates.
  32252. result.source = source;
  32253. if (isError(result)) {
  32254. throw result;
  32255. }
  32256. return result;
  32257. }
  32258. /**
  32259. * Converts `string`, as a whole, to lower case just like
  32260. * [String#toLowerCase](https://mdn.io/toLowerCase).
  32261. *
  32262. * @static
  32263. * @memberOf _
  32264. * @since 4.0.0
  32265. * @category String
  32266. * @param {string} [string=''] The string to convert.
  32267. * @returns {string} Returns the lower cased string.
  32268. * @example
  32269. *
  32270. * _.toLower('--Foo-Bar--');
  32271. * // => '--foo-bar--'
  32272. *
  32273. * _.toLower('fooBar');
  32274. * // => 'foobar'
  32275. *
  32276. * _.toLower('__FOO_BAR__');
  32277. * // => '__foo_bar__'
  32278. */
  32279. function toLower(value) {
  32280. return toString(value).toLowerCase();
  32281. }
  32282. /**
  32283. * Converts `string`, as a whole, to upper case just like
  32284. * [String#toUpperCase](https://mdn.io/toUpperCase).
  32285. *
  32286. * @static
  32287. * @memberOf _
  32288. * @since 4.0.0
  32289. * @category String
  32290. * @param {string} [string=''] The string to convert.
  32291. * @returns {string} Returns the upper cased string.
  32292. * @example
  32293. *
  32294. * _.toUpper('--foo-bar--');
  32295. * // => '--FOO-BAR--'
  32296. *
  32297. * _.toUpper('fooBar');
  32298. * // => 'FOOBAR'
  32299. *
  32300. * _.toUpper('__foo_bar__');
  32301. * // => '__FOO_BAR__'
  32302. */
  32303. function toUpper(value) {
  32304. return toString(value).toUpperCase();
  32305. }
  32306. /**
  32307. * Removes leading and trailing whitespace or specified characters from `string`.
  32308. *
  32309. * @static
  32310. * @memberOf _
  32311. * @since 3.0.0
  32312. * @category String
  32313. * @param {string} [string=''] The string to trim.
  32314. * @param {string} [chars=whitespace] The characters to trim.
  32315. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32316. * @returns {string} Returns the trimmed string.
  32317. * @example
  32318. *
  32319. * _.trim(' abc ');
  32320. * // => 'abc'
  32321. *
  32322. * _.trim('-_-abc-_-', '_-');
  32323. * // => 'abc'
  32324. *
  32325. * _.map([' foo ', ' bar '], _.trim);
  32326. * // => ['foo', 'bar']
  32327. */
  32328. function trim(string, chars, guard) {
  32329. string = toString(string);
  32330. if (string && (guard || chars === undefined)) {
  32331. return string.replace(reTrim, '');
  32332. }
  32333. if (!string || !(chars = baseToString(chars))) {
  32334. return string;
  32335. }
  32336. var strSymbols = stringToArray(string),
  32337. chrSymbols = stringToArray(chars),
  32338. start = charsStartIndex(strSymbols, chrSymbols),
  32339. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  32340. return castSlice(strSymbols, start, end).join('');
  32341. }
  32342. /**
  32343. * Removes trailing whitespace or specified characters from `string`.
  32344. *
  32345. * @static
  32346. * @memberOf _
  32347. * @since 4.0.0
  32348. * @category String
  32349. * @param {string} [string=''] The string to trim.
  32350. * @param {string} [chars=whitespace] The characters to trim.
  32351. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32352. * @returns {string} Returns the trimmed string.
  32353. * @example
  32354. *
  32355. * _.trimEnd(' abc ');
  32356. * // => ' abc'
  32357. *
  32358. * _.trimEnd('-_-abc-_-', '_-');
  32359. * // => '-_-abc'
  32360. */
  32361. function trimEnd(string, chars, guard) {
  32362. string = toString(string);
  32363. if (string && (guard || chars === undefined)) {
  32364. return string.replace(reTrimEnd, '');
  32365. }
  32366. if (!string || !(chars = baseToString(chars))) {
  32367. return string;
  32368. }
  32369. var strSymbols = stringToArray(string),
  32370. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  32371. return castSlice(strSymbols, 0, end).join('');
  32372. }
  32373. /**
  32374. * Removes leading whitespace or specified characters from `string`.
  32375. *
  32376. * @static
  32377. * @memberOf _
  32378. * @since 4.0.0
  32379. * @category String
  32380. * @param {string} [string=''] The string to trim.
  32381. * @param {string} [chars=whitespace] The characters to trim.
  32382. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32383. * @returns {string} Returns the trimmed string.
  32384. * @example
  32385. *
  32386. * _.trimStart(' abc ');
  32387. * // => 'abc '
  32388. *
  32389. * _.trimStart('-_-abc-_-', '_-');
  32390. * // => 'abc-_-'
  32391. */
  32392. function trimStart(string, chars, guard) {
  32393. string = toString(string);
  32394. if (string && (guard || chars === undefined)) {
  32395. return string.replace(reTrimStart, '');
  32396. }
  32397. if (!string || !(chars = baseToString(chars))) {
  32398. return string;
  32399. }
  32400. var strSymbols = stringToArray(string),
  32401. start = charsStartIndex(strSymbols, stringToArray(chars));
  32402. return castSlice(strSymbols, start).join('');
  32403. }
  32404. /**
  32405. * Truncates `string` if it's longer than the given maximum string length.
  32406. * The last characters of the truncated string are replaced with the omission
  32407. * string which defaults to "...".
  32408. *
  32409. * @static
  32410. * @memberOf _
  32411. * @since 4.0.0
  32412. * @category String
  32413. * @param {string} [string=''] The string to truncate.
  32414. * @param {Object} [options={}] The options object.
  32415. * @param {number} [options.length=30] The maximum string length.
  32416. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  32417. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  32418. * @returns {string} Returns the truncated string.
  32419. * @example
  32420. *
  32421. * _.truncate('hi-diddly-ho there, neighborino');
  32422. * // => 'hi-diddly-ho there, neighbo...'
  32423. *
  32424. * _.truncate('hi-diddly-ho there, neighborino', {
  32425. * 'length': 24,
  32426. * 'separator': ' '
  32427. * });
  32428. * // => 'hi-diddly-ho there,...'
  32429. *
  32430. * _.truncate('hi-diddly-ho there, neighborino', {
  32431. * 'length': 24,
  32432. * 'separator': /,? +/
  32433. * });
  32434. * // => 'hi-diddly-ho there...'
  32435. *
  32436. * _.truncate('hi-diddly-ho there, neighborino', {
  32437. * 'omission': ' [...]'
  32438. * });
  32439. * // => 'hi-diddly-ho there, neig [...]'
  32440. */
  32441. function truncate(string, options) {
  32442. var length = DEFAULT_TRUNC_LENGTH,
  32443. omission = DEFAULT_TRUNC_OMISSION;
  32444. if (isObject(options)) {
  32445. var separator = 'separator' in options ? options.separator : separator;
  32446. length = 'length' in options ? toInteger(options.length) : length;
  32447. omission = 'omission' in options ? baseToString(options.omission) : omission;
  32448. }
  32449. string = toString(string);
  32450. var strLength = string.length;
  32451. if (hasUnicode(string)) {
  32452. var strSymbols = stringToArray(string);
  32453. strLength = strSymbols.length;
  32454. }
  32455. if (length >= strLength) {
  32456. return string;
  32457. }
  32458. var end = length - stringSize(omission);
  32459. if (end < 1) {
  32460. return omission;
  32461. }
  32462. var result = strSymbols
  32463. ? castSlice(strSymbols, 0, end).join('')
  32464. : string.slice(0, end);
  32465. if (separator === undefined) {
  32466. return result + omission;
  32467. }
  32468. if (strSymbols) {
  32469. end += (result.length - end);
  32470. }
  32471. if (isRegExp(separator)) {
  32472. if (string.slice(end).search(separator)) {
  32473. var match,
  32474. substring = result;
  32475. if (!separator.global) {
  32476. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  32477. }
  32478. separator.lastIndex = 0;
  32479. while ((match = separator.exec(substring))) {
  32480. var newEnd = match.index;
  32481. }
  32482. result = result.slice(0, newEnd === undefined ? end : newEnd);
  32483. }
  32484. } else if (string.indexOf(baseToString(separator), end) != end) {
  32485. var index = result.lastIndexOf(separator);
  32486. if (index > -1) {
  32487. result = result.slice(0, index);
  32488. }
  32489. }
  32490. return result + omission;
  32491. }
  32492. /**
  32493. * The inverse of `_.escape`; this method converts the HTML entities
  32494. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  32495. * their corresponding characters.
  32496. *
  32497. * **Note:** No other HTML entities are unescaped. To unescape additional
  32498. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  32499. *
  32500. * @static
  32501. * @memberOf _
  32502. * @since 0.6.0
  32503. * @category String
  32504. * @param {string} [string=''] The string to unescape.
  32505. * @returns {string} Returns the unescaped string.
  32506. * @example
  32507. *
  32508. * _.unescape('fred, barney, &amp; pebbles');
  32509. * // => 'fred, barney, & pebbles'
  32510. */
  32511. function unescape(string) {
  32512. string = toString(string);
  32513. return (string && reHasEscapedHtml.test(string))
  32514. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  32515. : string;
  32516. }
  32517. /**
  32518. * Converts `string`, as space separated words, to upper case.
  32519. *
  32520. * @static
  32521. * @memberOf _
  32522. * @since 4.0.0
  32523. * @category String
  32524. * @param {string} [string=''] The string to convert.
  32525. * @returns {string} Returns the upper cased string.
  32526. * @example
  32527. *
  32528. * _.upperCase('--foo-bar');
  32529. * // => 'FOO BAR'
  32530. *
  32531. * _.upperCase('fooBar');
  32532. * // => 'FOO BAR'
  32533. *
  32534. * _.upperCase('__foo_bar__');
  32535. * // => 'FOO BAR'
  32536. */
  32537. var upperCase = createCompounder(function(result, word, index) {
  32538. return result + (index ? ' ' : '') + word.toUpperCase();
  32539. });
  32540. /**
  32541. * Converts the first character of `string` to upper case.
  32542. *
  32543. * @static
  32544. * @memberOf _
  32545. * @since 4.0.0
  32546. * @category String
  32547. * @param {string} [string=''] The string to convert.
  32548. * @returns {string} Returns the converted string.
  32549. * @example
  32550. *
  32551. * _.upperFirst('fred');
  32552. * // => 'Fred'
  32553. *
  32554. * _.upperFirst('FRED');
  32555. * // => 'FRED'
  32556. */
  32557. var upperFirst = createCaseFirst('toUpperCase');
  32558. /**
  32559. * Splits `string` into an array of its words.
  32560. *
  32561. * @static
  32562. * @memberOf _
  32563. * @since 3.0.0
  32564. * @category String
  32565. * @param {string} [string=''] The string to inspect.
  32566. * @param {RegExp|string} [pattern] The pattern to match words.
  32567. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32568. * @returns {Array} Returns the words of `string`.
  32569. * @example
  32570. *
  32571. * _.words('fred, barney, & pebbles');
  32572. * // => ['fred', 'barney', 'pebbles']
  32573. *
  32574. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  32575. * // => ['fred', 'barney', '&', 'pebbles']
  32576. */
  32577. function words(string, pattern, guard) {
  32578. string = toString(string);
  32579. pattern = guard ? undefined : pattern;
  32580. if (pattern === undefined) {
  32581. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  32582. }
  32583. return string.match(pattern) || [];
  32584. }
  32585. /*------------------------------------------------------------------------*/
  32586. /**
  32587. * Attempts to invoke `func`, returning either the result or the caught error
  32588. * object. Any additional arguments are provided to `func` when it's invoked.
  32589. *
  32590. * @static
  32591. * @memberOf _
  32592. * @since 3.0.0
  32593. * @category Util
  32594. * @param {Function} func The function to attempt.
  32595. * @param {...*} [args] The arguments to invoke `func` with.
  32596. * @returns {*} Returns the `func` result or error object.
  32597. * @example
  32598. *
  32599. * // Avoid throwing errors for invalid selectors.
  32600. * var elements = _.attempt(function(selector) {
  32601. * return document.querySelectorAll(selector);
  32602. * }, '>_>');
  32603. *
  32604. * if (_.isError(elements)) {
  32605. * elements = [];
  32606. * }
  32607. */
  32608. var attempt = baseRest(function(func, args) {
  32609. try {
  32610. return apply(func, undefined, args);
  32611. } catch (e) {
  32612. return isError(e) ? e : new Error(e);
  32613. }
  32614. });
  32615. /**
  32616. * Binds methods of an object to the object itself, overwriting the existing
  32617. * method.
  32618. *
  32619. * **Note:** This method doesn't set the "length" property of bound functions.
  32620. *
  32621. * @static
  32622. * @since 0.1.0
  32623. * @memberOf _
  32624. * @category Util
  32625. * @param {Object} object The object to bind and assign the bound methods to.
  32626. * @param {...(string|string[])} methodNames The object method names to bind.
  32627. * @returns {Object} Returns `object`.
  32628. * @example
  32629. *
  32630. * var view = {
  32631. * 'label': 'docs',
  32632. * 'click': function() {
  32633. * console.log('clicked ' + this.label);
  32634. * }
  32635. * };
  32636. *
  32637. * _.bindAll(view, ['click']);
  32638. * jQuery(element).on('click', view.click);
  32639. * // => Logs 'clicked docs' when clicked.
  32640. */
  32641. var bindAll = flatRest(function(object, methodNames) {
  32642. arrayEach(methodNames, function(key) {
  32643. key = toKey(key);
  32644. baseAssignValue(object, key, bind(object[key], object));
  32645. });
  32646. return object;
  32647. });
  32648. /**
  32649. * Creates a function that iterates over `pairs` and invokes the corresponding
  32650. * function of the first predicate to return truthy. The predicate-function
  32651. * pairs are invoked with the `this` binding and arguments of the created
  32652. * function.
  32653. *
  32654. * @static
  32655. * @memberOf _
  32656. * @since 4.0.0
  32657. * @category Util
  32658. * @param {Array} pairs The predicate-function pairs.
  32659. * @returns {Function} Returns the new composite function.
  32660. * @example
  32661. *
  32662. * var func = _.cond([
  32663. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  32664. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  32665. * [_.stubTrue, _.constant('no match')]
  32666. * ]);
  32667. *
  32668. * func({ 'a': 1, 'b': 2 });
  32669. * // => 'matches A'
  32670. *
  32671. * func({ 'a': 0, 'b': 1 });
  32672. * // => 'matches B'
  32673. *
  32674. * func({ 'a': '1', 'b': '2' });
  32675. * // => 'no match'
  32676. */
  32677. function cond(pairs) {
  32678. var length = pairs == null ? 0 : pairs.length,
  32679. toIteratee = getIteratee();
  32680. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  32681. if (typeof pair[1] != 'function') {
  32682. throw new TypeError(FUNC_ERROR_TEXT);
  32683. }
  32684. return [toIteratee(pair[0]), pair[1]];
  32685. });
  32686. return baseRest(function(args) {
  32687. var index = -1;
  32688. while (++index < length) {
  32689. var pair = pairs[index];
  32690. if (apply(pair[0], this, args)) {
  32691. return apply(pair[1], this, args);
  32692. }
  32693. }
  32694. });
  32695. }
  32696. /**
  32697. * Creates a function that invokes the predicate properties of `source` with
  32698. * the corresponding property values of a given object, returning `true` if
  32699. * all predicates return truthy, else `false`.
  32700. *
  32701. * **Note:** The created function is equivalent to `_.conformsTo` with
  32702. * `source` partially applied.
  32703. *
  32704. * @static
  32705. * @memberOf _
  32706. * @since 4.0.0
  32707. * @category Util
  32708. * @param {Object} source The object of property predicates to conform to.
  32709. * @returns {Function} Returns the new spec function.
  32710. * @example
  32711. *
  32712. * var objects = [
  32713. * { 'a': 2, 'b': 1 },
  32714. * { 'a': 1, 'b': 2 }
  32715. * ];
  32716. *
  32717. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  32718. * // => [{ 'a': 1, 'b': 2 }]
  32719. */
  32720. function conforms(source) {
  32721. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  32722. }
  32723. /**
  32724. * Creates a function that returns `value`.
  32725. *
  32726. * @static
  32727. * @memberOf _
  32728. * @since 2.4.0
  32729. * @category Util
  32730. * @param {*} value The value to return from the new function.
  32731. * @returns {Function} Returns the new constant function.
  32732. * @example
  32733. *
  32734. * var objects = _.times(2, _.constant({ 'a': 1 }));
  32735. *
  32736. * console.log(objects);
  32737. * // => [{ 'a': 1 }, { 'a': 1 }]
  32738. *
  32739. * console.log(objects[0] === objects[1]);
  32740. * // => true
  32741. */
  32742. function constant(value) {
  32743. return function() {
  32744. return value;
  32745. };
  32746. }
  32747. /**
  32748. * Checks `value` to determine whether a default value should be returned in
  32749. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  32750. * or `undefined`.
  32751. *
  32752. * @static
  32753. * @memberOf _
  32754. * @since 4.14.0
  32755. * @category Util
  32756. * @param {*} value The value to check.
  32757. * @param {*} defaultValue The default value.
  32758. * @returns {*} Returns the resolved value.
  32759. * @example
  32760. *
  32761. * _.defaultTo(1, 10);
  32762. * // => 1
  32763. *
  32764. * _.defaultTo(undefined, 10);
  32765. * // => 10
  32766. */
  32767. function defaultTo(value, defaultValue) {
  32768. return (value == null || value !== value) ? defaultValue : value;
  32769. }
  32770. /**
  32771. * Creates a function that returns the result of invoking the given functions
  32772. * with the `this` binding of the created function, where each successive
  32773. * invocation is supplied the return value of the previous.
  32774. *
  32775. * @static
  32776. * @memberOf _
  32777. * @since 3.0.0
  32778. * @category Util
  32779. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32780. * @returns {Function} Returns the new composite function.
  32781. * @see _.flowRight
  32782. * @example
  32783. *
  32784. * function square(n) {
  32785. * return n * n;
  32786. * }
  32787. *
  32788. * var addSquare = _.flow([_.add, square]);
  32789. * addSquare(1, 2);
  32790. * // => 9
  32791. */
  32792. var flow = createFlow();
  32793. /**
  32794. * This method is like `_.flow` except that it creates a function that
  32795. * invokes the given functions from right to left.
  32796. *
  32797. * @static
  32798. * @since 3.0.0
  32799. * @memberOf _
  32800. * @category Util
  32801. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32802. * @returns {Function} Returns the new composite function.
  32803. * @see _.flow
  32804. * @example
  32805. *
  32806. * function square(n) {
  32807. * return n * n;
  32808. * }
  32809. *
  32810. * var addSquare = _.flowRight([square, _.add]);
  32811. * addSquare(1, 2);
  32812. * // => 9
  32813. */
  32814. var flowRight = createFlow(true);
  32815. /**
  32816. * This method returns the first argument it receives.
  32817. *
  32818. * @static
  32819. * @since 0.1.0
  32820. * @memberOf _
  32821. * @category Util
  32822. * @param {*} value Any value.
  32823. * @returns {*} Returns `value`.
  32824. * @example
  32825. *
  32826. * var object = { 'a': 1 };
  32827. *
  32828. * console.log(_.identity(object) === object);
  32829. * // => true
  32830. */
  32831. function identity(value) {
  32832. return value;
  32833. }
  32834. /**
  32835. * Creates a function that invokes `func` with the arguments of the created
  32836. * function. If `func` is a property name, the created function returns the
  32837. * property value for a given element. If `func` is an array or object, the
  32838. * created function returns `true` for elements that contain the equivalent
  32839. * source properties, otherwise it returns `false`.
  32840. *
  32841. * @static
  32842. * @since 4.0.0
  32843. * @memberOf _
  32844. * @category Util
  32845. * @param {*} [func=_.identity] The value to convert to a callback.
  32846. * @returns {Function} Returns the callback.
  32847. * @example
  32848. *
  32849. * var users = [
  32850. * { 'user': 'barney', 'age': 36, 'active': true },
  32851. * { 'user': 'fred', 'age': 40, 'active': false }
  32852. * ];
  32853. *
  32854. * // The `_.matches` iteratee shorthand.
  32855. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  32856. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  32857. *
  32858. * // The `_.matchesProperty` iteratee shorthand.
  32859. * _.filter(users, _.iteratee(['user', 'fred']));
  32860. * // => [{ 'user': 'fred', 'age': 40 }]
  32861. *
  32862. * // The `_.property` iteratee shorthand.
  32863. * _.map(users, _.iteratee('user'));
  32864. * // => ['barney', 'fred']
  32865. *
  32866. * // Create custom iteratee shorthands.
  32867. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  32868. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  32869. * return func.test(string);
  32870. * };
  32871. * });
  32872. *
  32873. * _.filter(['abc', 'def'], /ef/);
  32874. * // => ['def']
  32875. */
  32876. function iteratee(func) {
  32877. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  32878. }
  32879. /**
  32880. * Creates a function that performs a partial deep comparison between a given
  32881. * object and `source`, returning `true` if the given object has equivalent
  32882. * property values, else `false`.
  32883. *
  32884. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  32885. * partially applied.
  32886. *
  32887. * Partial comparisons will match empty array and empty object `source`
  32888. * values against any array or object value, respectively. See `_.isEqual`
  32889. * for a list of supported value comparisons.
  32890. *
  32891. * @static
  32892. * @memberOf _
  32893. * @since 3.0.0
  32894. * @category Util
  32895. * @param {Object} source The object of property values to match.
  32896. * @returns {Function} Returns the new spec function.
  32897. * @example
  32898. *
  32899. * var objects = [
  32900. * { 'a': 1, 'b': 2, 'c': 3 },
  32901. * { 'a': 4, 'b': 5, 'c': 6 }
  32902. * ];
  32903. *
  32904. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  32905. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  32906. */
  32907. function matches(source) {
  32908. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  32909. }
  32910. /**
  32911. * Creates a function that performs a partial deep comparison between the
  32912. * value at `path` of a given object to `srcValue`, returning `true` if the
  32913. * object value is equivalent, else `false`.
  32914. *
  32915. * **Note:** Partial comparisons will match empty array and empty object
  32916. * `srcValue` values against any array or object value, respectively. See
  32917. * `_.isEqual` for a list of supported value comparisons.
  32918. *
  32919. * @static
  32920. * @memberOf _
  32921. * @since 3.2.0
  32922. * @category Util
  32923. * @param {Array|string} path The path of the property to get.
  32924. * @param {*} srcValue The value to match.
  32925. * @returns {Function} Returns the new spec function.
  32926. * @example
  32927. *
  32928. * var objects = [
  32929. * { 'a': 1, 'b': 2, 'c': 3 },
  32930. * { 'a': 4, 'b': 5, 'c': 6 }
  32931. * ];
  32932. *
  32933. * _.find(objects, _.matchesProperty('a', 4));
  32934. * // => { 'a': 4, 'b': 5, 'c': 6 }
  32935. */
  32936. function matchesProperty(path, srcValue) {
  32937. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  32938. }
  32939. /**
  32940. * Creates a function that invokes the method at `path` of a given object.
  32941. * Any additional arguments are provided to the invoked method.
  32942. *
  32943. * @static
  32944. * @memberOf _
  32945. * @since 3.7.0
  32946. * @category Util
  32947. * @param {Array|string} path The path of the method to invoke.
  32948. * @param {...*} [args] The arguments to invoke the method with.
  32949. * @returns {Function} Returns the new invoker function.
  32950. * @example
  32951. *
  32952. * var objects = [
  32953. * { 'a': { 'b': _.constant(2) } },
  32954. * { 'a': { 'b': _.constant(1) } }
  32955. * ];
  32956. *
  32957. * _.map(objects, _.method('a.b'));
  32958. * // => [2, 1]
  32959. *
  32960. * _.map(objects, _.method(['a', 'b']));
  32961. * // => [2, 1]
  32962. */
  32963. var method = baseRest(function(path, args) {
  32964. return function(object) {
  32965. return baseInvoke(object, path, args);
  32966. };
  32967. });
  32968. /**
  32969. * The opposite of `_.method`; this method creates a function that invokes
  32970. * the method at a given path of `object`. Any additional arguments are
  32971. * provided to the invoked method.
  32972. *
  32973. * @static
  32974. * @memberOf _
  32975. * @since 3.7.0
  32976. * @category Util
  32977. * @param {Object} object The object to query.
  32978. * @param {...*} [args] The arguments to invoke the method with.
  32979. * @returns {Function} Returns the new invoker function.
  32980. * @example
  32981. *
  32982. * var array = _.times(3, _.constant),
  32983. * object = { 'a': array, 'b': array, 'c': array };
  32984. *
  32985. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  32986. * // => [2, 0]
  32987. *
  32988. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  32989. * // => [2, 0]
  32990. */
  32991. var methodOf = baseRest(function(object, args) {
  32992. return function(path) {
  32993. return baseInvoke(object, path, args);
  32994. };
  32995. });
  32996. /**
  32997. * Adds all own enumerable string keyed function properties of a source
  32998. * object to the destination object. If `object` is a function, then methods
  32999. * are added to its prototype as well.
  33000. *
  33001. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  33002. * avoid conflicts caused by modifying the original.
  33003. *
  33004. * @static
  33005. * @since 0.1.0
  33006. * @memberOf _
  33007. * @category Util
  33008. * @param {Function|Object} [object=lodash] The destination object.
  33009. * @param {Object} source The object of functions to add.
  33010. * @param {Object} [options={}] The options object.
  33011. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  33012. * @returns {Function|Object} Returns `object`.
  33013. * @example
  33014. *
  33015. * function vowels(string) {
  33016. * return _.filter(string, function(v) {
  33017. * return /[aeiou]/i.test(v);
  33018. * });
  33019. * }
  33020. *
  33021. * _.mixin({ 'vowels': vowels });
  33022. * _.vowels('fred');
  33023. * // => ['e']
  33024. *
  33025. * _('fred').vowels().value();
  33026. * // => ['e']
  33027. *
  33028. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  33029. * _('fred').vowels();
  33030. * // => ['e']
  33031. */
  33032. function mixin(object, source, options) {
  33033. var props = keys(source),
  33034. methodNames = baseFunctions(source, props);
  33035. if (options == null &&
  33036. !(isObject(source) && (methodNames.length || !props.length))) {
  33037. options = source;
  33038. source = object;
  33039. object = this;
  33040. methodNames = baseFunctions(source, keys(source));
  33041. }
  33042. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  33043. isFunc = isFunction(object);
  33044. arrayEach(methodNames, function(methodName) {
  33045. var func = source[methodName];
  33046. object[methodName] = func;
  33047. if (isFunc) {
  33048. object.prototype[methodName] = function() {
  33049. var chainAll = this.__chain__;
  33050. if (chain || chainAll) {
  33051. var result = object(this.__wrapped__),
  33052. actions = result.__actions__ = copyArray(this.__actions__);
  33053. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  33054. result.__chain__ = chainAll;
  33055. return result;
  33056. }
  33057. return func.apply(object, arrayPush([this.value()], arguments));
  33058. };
  33059. }
  33060. });
  33061. return object;
  33062. }
  33063. /**
  33064. * Reverts the `_` variable to its previous value and returns a reference to
  33065. * the `lodash` function.
  33066. *
  33067. * @static
  33068. * @since 0.1.0
  33069. * @memberOf _
  33070. * @category Util
  33071. * @returns {Function} Returns the `lodash` function.
  33072. * @example
  33073. *
  33074. * var lodash = _.noConflict();
  33075. */
  33076. function noConflict() {
  33077. if (root._ === this) {
  33078. root._ = oldDash;
  33079. }
  33080. return this;
  33081. }
  33082. /**
  33083. * This method returns `undefined`.
  33084. *
  33085. * @static
  33086. * @memberOf _
  33087. * @since 2.3.0
  33088. * @category Util
  33089. * @example
  33090. *
  33091. * _.times(2, _.noop);
  33092. * // => [undefined, undefined]
  33093. */
  33094. function noop() {
  33095. // No operation performed.
  33096. }
  33097. /**
  33098. * Creates a function that gets the argument at index `n`. If `n` is negative,
  33099. * the nth argument from the end is returned.
  33100. *
  33101. * @static
  33102. * @memberOf _
  33103. * @since 4.0.0
  33104. * @category Util
  33105. * @param {number} [n=0] The index of the argument to return.
  33106. * @returns {Function} Returns the new pass-thru function.
  33107. * @example
  33108. *
  33109. * var func = _.nthArg(1);
  33110. * func('a', 'b', 'c', 'd');
  33111. * // => 'b'
  33112. *
  33113. * var func = _.nthArg(-2);
  33114. * func('a', 'b', 'c', 'd');
  33115. * // => 'c'
  33116. */
  33117. function nthArg(n) {
  33118. n = toInteger(n);
  33119. return baseRest(function(args) {
  33120. return baseNth(args, n);
  33121. });
  33122. }
  33123. /**
  33124. * Creates a function that invokes `iteratees` with the arguments it receives
  33125. * and returns their results.
  33126. *
  33127. * @static
  33128. * @memberOf _
  33129. * @since 4.0.0
  33130. * @category Util
  33131. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  33132. * The iteratees to invoke.
  33133. * @returns {Function} Returns the new function.
  33134. * @example
  33135. *
  33136. * var func = _.over([Math.max, Math.min]);
  33137. *
  33138. * func(1, 2, 3, 4);
  33139. * // => [4, 1]
  33140. */
  33141. var over = createOver(arrayMap);
  33142. /**
  33143. * Creates a function that checks if **all** of the `predicates` return
  33144. * truthy when invoked with the arguments it receives.
  33145. *
  33146. * @static
  33147. * @memberOf _
  33148. * @since 4.0.0
  33149. * @category Util
  33150. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33151. * The predicates to check.
  33152. * @returns {Function} Returns the new function.
  33153. * @example
  33154. *
  33155. * var func = _.overEvery([Boolean, isFinite]);
  33156. *
  33157. * func('1');
  33158. * // => true
  33159. *
  33160. * func(null);
  33161. * // => false
  33162. *
  33163. * func(NaN);
  33164. * // => false
  33165. */
  33166. var overEvery = createOver(arrayEvery);
  33167. /**
  33168. * Creates a function that checks if **any** of the `predicates` return
  33169. * truthy when invoked with the arguments it receives.
  33170. *
  33171. * @static
  33172. * @memberOf _
  33173. * @since 4.0.0
  33174. * @category Util
  33175. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33176. * The predicates to check.
  33177. * @returns {Function} Returns the new function.
  33178. * @example
  33179. *
  33180. * var func = _.overSome([Boolean, isFinite]);
  33181. *
  33182. * func('1');
  33183. * // => true
  33184. *
  33185. * func(null);
  33186. * // => true
  33187. *
  33188. * func(NaN);
  33189. * // => false
  33190. */
  33191. var overSome = createOver(arraySome);
  33192. /**
  33193. * Creates a function that returns the value at `path` of a given object.
  33194. *
  33195. * @static
  33196. * @memberOf _
  33197. * @since 2.4.0
  33198. * @category Util
  33199. * @param {Array|string} path The path of the property to get.
  33200. * @returns {Function} Returns the new accessor function.
  33201. * @example
  33202. *
  33203. * var objects = [
  33204. * { 'a': { 'b': 2 } },
  33205. * { 'a': { 'b': 1 } }
  33206. * ];
  33207. *
  33208. * _.map(objects, _.property('a.b'));
  33209. * // => [2, 1]
  33210. *
  33211. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  33212. * // => [1, 2]
  33213. */
  33214. function property(path) {
  33215. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  33216. }
  33217. /**
  33218. * The opposite of `_.property`; this method creates a function that returns
  33219. * the value at a given path of `object`.
  33220. *
  33221. * @static
  33222. * @memberOf _
  33223. * @since 3.0.0
  33224. * @category Util
  33225. * @param {Object} object The object to query.
  33226. * @returns {Function} Returns the new accessor function.
  33227. * @example
  33228. *
  33229. * var array = [0, 1, 2],
  33230. * object = { 'a': array, 'b': array, 'c': array };
  33231. *
  33232. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  33233. * // => [2, 0]
  33234. *
  33235. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  33236. * // => [2, 0]
  33237. */
  33238. function propertyOf(object) {
  33239. return function(path) {
  33240. return object == null ? undefined : baseGet(object, path);
  33241. };
  33242. }
  33243. /**
  33244. * Creates an array of numbers (positive and/or negative) progressing from
  33245. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  33246. * `start` is specified without an `end` or `step`. If `end` is not specified,
  33247. * it's set to `start` with `start` then set to `0`.
  33248. *
  33249. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  33250. * floating-point values which can produce unexpected results.
  33251. *
  33252. * @static
  33253. * @since 0.1.0
  33254. * @memberOf _
  33255. * @category Util
  33256. * @param {number} [start=0] The start of the range.
  33257. * @param {number} end The end of the range.
  33258. * @param {number} [step=1] The value to increment or decrement by.
  33259. * @returns {Array} Returns the range of numbers.
  33260. * @see _.inRange, _.rangeRight
  33261. * @example
  33262. *
  33263. * _.range(4);
  33264. * // => [0, 1, 2, 3]
  33265. *
  33266. * _.range(-4);
  33267. * // => [0, -1, -2, -3]
  33268. *
  33269. * _.range(1, 5);
  33270. * // => [1, 2, 3, 4]
  33271. *
  33272. * _.range(0, 20, 5);
  33273. * // => [0, 5, 10, 15]
  33274. *
  33275. * _.range(0, -4, -1);
  33276. * // => [0, -1, -2, -3]
  33277. *
  33278. * _.range(1, 4, 0);
  33279. * // => [1, 1, 1]
  33280. *
  33281. * _.range(0);
  33282. * // => []
  33283. */
  33284. var range = createRange();
  33285. /**
  33286. * This method is like `_.range` except that it populates values in
  33287. * descending order.
  33288. *
  33289. * @static
  33290. * @memberOf _
  33291. * @since 4.0.0
  33292. * @category Util
  33293. * @param {number} [start=0] The start of the range.
  33294. * @param {number} end The end of the range.
  33295. * @param {number} [step=1] The value to increment or decrement by.
  33296. * @returns {Array} Returns the range of numbers.
  33297. * @see _.inRange, _.range
  33298. * @example
  33299. *
  33300. * _.rangeRight(4);
  33301. * // => [3, 2, 1, 0]
  33302. *
  33303. * _.rangeRight(-4);
  33304. * // => [-3, -2, -1, 0]
  33305. *
  33306. * _.rangeRight(1, 5);
  33307. * // => [4, 3, 2, 1]
  33308. *
  33309. * _.rangeRight(0, 20, 5);
  33310. * // => [15, 10, 5, 0]
  33311. *
  33312. * _.rangeRight(0, -4, -1);
  33313. * // => [-3, -2, -1, 0]
  33314. *
  33315. * _.rangeRight(1, 4, 0);
  33316. * // => [1, 1, 1]
  33317. *
  33318. * _.rangeRight(0);
  33319. * // => []
  33320. */
  33321. var rangeRight = createRange(true);
  33322. /**
  33323. * This method returns a new empty array.
  33324. *
  33325. * @static
  33326. * @memberOf _
  33327. * @since 4.13.0
  33328. * @category Util
  33329. * @returns {Array} Returns the new empty array.
  33330. * @example
  33331. *
  33332. * var arrays = _.times(2, _.stubArray);
  33333. *
  33334. * console.log(arrays);
  33335. * // => [[], []]
  33336. *
  33337. * console.log(arrays[0] === arrays[1]);
  33338. * // => false
  33339. */
  33340. function stubArray() {
  33341. return [];
  33342. }
  33343. /**
  33344. * This method returns `false`.
  33345. *
  33346. * @static
  33347. * @memberOf _
  33348. * @since 4.13.0
  33349. * @category Util
  33350. * @returns {boolean} Returns `false`.
  33351. * @example
  33352. *
  33353. * _.times(2, _.stubFalse);
  33354. * // => [false, false]
  33355. */
  33356. function stubFalse() {
  33357. return false;
  33358. }
  33359. /**
  33360. * This method returns a new empty object.
  33361. *
  33362. * @static
  33363. * @memberOf _
  33364. * @since 4.13.0
  33365. * @category Util
  33366. * @returns {Object} Returns the new empty object.
  33367. * @example
  33368. *
  33369. * var objects = _.times(2, _.stubObject);
  33370. *
  33371. * console.log(objects);
  33372. * // => [{}, {}]
  33373. *
  33374. * console.log(objects[0] === objects[1]);
  33375. * // => false
  33376. */
  33377. function stubObject() {
  33378. return {};
  33379. }
  33380. /**
  33381. * This method returns an empty string.
  33382. *
  33383. * @static
  33384. * @memberOf _
  33385. * @since 4.13.0
  33386. * @category Util
  33387. * @returns {string} Returns the empty string.
  33388. * @example
  33389. *
  33390. * _.times(2, _.stubString);
  33391. * // => ['', '']
  33392. */
  33393. function stubString() {
  33394. return '';
  33395. }
  33396. /**
  33397. * This method returns `true`.
  33398. *
  33399. * @static
  33400. * @memberOf _
  33401. * @since 4.13.0
  33402. * @category Util
  33403. * @returns {boolean} Returns `true`.
  33404. * @example
  33405. *
  33406. * _.times(2, _.stubTrue);
  33407. * // => [true, true]
  33408. */
  33409. function stubTrue() {
  33410. return true;
  33411. }
  33412. /**
  33413. * Invokes the iteratee `n` times, returning an array of the results of
  33414. * each invocation. The iteratee is invoked with one argument; (index).
  33415. *
  33416. * @static
  33417. * @since 0.1.0
  33418. * @memberOf _
  33419. * @category Util
  33420. * @param {number} n The number of times to invoke `iteratee`.
  33421. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33422. * @returns {Array} Returns the array of results.
  33423. * @example
  33424. *
  33425. * _.times(3, String);
  33426. * // => ['0', '1', '2']
  33427. *
  33428. * _.times(4, _.constant(0));
  33429. * // => [0, 0, 0, 0]
  33430. */
  33431. function times(n, iteratee) {
  33432. n = toInteger(n);
  33433. if (n < 1 || n > MAX_SAFE_INTEGER) {
  33434. return [];
  33435. }
  33436. var index = MAX_ARRAY_LENGTH,
  33437. length = nativeMin(n, MAX_ARRAY_LENGTH);
  33438. iteratee = getIteratee(iteratee);
  33439. n -= MAX_ARRAY_LENGTH;
  33440. var result = baseTimes(length, iteratee);
  33441. while (++index < n) {
  33442. iteratee(index);
  33443. }
  33444. return result;
  33445. }
  33446. /**
  33447. * Converts `value` to a property path array.
  33448. *
  33449. * @static
  33450. * @memberOf _
  33451. * @since 4.0.0
  33452. * @category Util
  33453. * @param {*} value The value to convert.
  33454. * @returns {Array} Returns the new property path array.
  33455. * @example
  33456. *
  33457. * _.toPath('a.b.c');
  33458. * // => ['a', 'b', 'c']
  33459. *
  33460. * _.toPath('a[0].b.c');
  33461. * // => ['a', '0', 'b', 'c']
  33462. */
  33463. function toPath(value) {
  33464. if (isArray(value)) {
  33465. return arrayMap(value, toKey);
  33466. }
  33467. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  33468. }
  33469. /**
  33470. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  33471. *
  33472. * @static
  33473. * @since 0.1.0
  33474. * @memberOf _
  33475. * @category Util
  33476. * @param {string} [prefix=''] The value to prefix the ID with.
  33477. * @returns {string} Returns the unique ID.
  33478. * @example
  33479. *
  33480. * _.uniqueId('contact_');
  33481. * // => 'contact_104'
  33482. *
  33483. * _.uniqueId();
  33484. * // => '105'
  33485. */
  33486. function uniqueId(prefix) {
  33487. var id = ++idCounter;
  33488. return toString(prefix) + id;
  33489. }
  33490. /*------------------------------------------------------------------------*/
  33491. /**
  33492. * Adds two numbers.
  33493. *
  33494. * @static
  33495. * @memberOf _
  33496. * @since 3.4.0
  33497. * @category Math
  33498. * @param {number} augend The first number in an addition.
  33499. * @param {number} addend The second number in an addition.
  33500. * @returns {number} Returns the total.
  33501. * @example
  33502. *
  33503. * _.add(6, 4);
  33504. * // => 10
  33505. */
  33506. var add = createMathOperation(function(augend, addend) {
  33507. return augend + addend;
  33508. }, 0);
  33509. /**
  33510. * Computes `number` rounded up to `precision`.
  33511. *
  33512. * @static
  33513. * @memberOf _
  33514. * @since 3.10.0
  33515. * @category Math
  33516. * @param {number} number The number to round up.
  33517. * @param {number} [precision=0] The precision to round up to.
  33518. * @returns {number} Returns the rounded up number.
  33519. * @example
  33520. *
  33521. * _.ceil(4.006);
  33522. * // => 5
  33523. *
  33524. * _.ceil(6.004, 2);
  33525. * // => 6.01
  33526. *
  33527. * _.ceil(6040, -2);
  33528. * // => 6100
  33529. */
  33530. var ceil = createRound('ceil');
  33531. /**
  33532. * Divide two numbers.
  33533. *
  33534. * @static
  33535. * @memberOf _
  33536. * @since 4.7.0
  33537. * @category Math
  33538. * @param {number} dividend The first number in a division.
  33539. * @param {number} divisor The second number in a division.
  33540. * @returns {number} Returns the quotient.
  33541. * @example
  33542. *
  33543. * _.divide(6, 4);
  33544. * // => 1.5
  33545. */
  33546. var divide = createMathOperation(function(dividend, divisor) {
  33547. return dividend / divisor;
  33548. }, 1);
  33549. /**
  33550. * Computes `number` rounded down to `precision`.
  33551. *
  33552. * @static
  33553. * @memberOf _
  33554. * @since 3.10.0
  33555. * @category Math
  33556. * @param {number} number The number to round down.
  33557. * @param {number} [precision=0] The precision to round down to.
  33558. * @returns {number} Returns the rounded down number.
  33559. * @example
  33560. *
  33561. * _.floor(4.006);
  33562. * // => 4
  33563. *
  33564. * _.floor(0.046, 2);
  33565. * // => 0.04
  33566. *
  33567. * _.floor(4060, -2);
  33568. * // => 4000
  33569. */
  33570. var floor = createRound('floor');
  33571. /**
  33572. * Computes the maximum value of `array`. If `array` is empty or falsey,
  33573. * `undefined` is returned.
  33574. *
  33575. * @static
  33576. * @since 0.1.0
  33577. * @memberOf _
  33578. * @category Math
  33579. * @param {Array} array The array to iterate over.
  33580. * @returns {*} Returns the maximum value.
  33581. * @example
  33582. *
  33583. * _.max([4, 2, 8, 6]);
  33584. * // => 8
  33585. *
  33586. * _.max([]);
  33587. * // => undefined
  33588. */
  33589. function max(array) {
  33590. return (array && array.length)
  33591. ? baseExtremum(array, identity, baseGt)
  33592. : undefined;
  33593. }
  33594. /**
  33595. * This method is like `_.max` except that it accepts `iteratee` which is
  33596. * invoked for each element in `array` to generate the criterion by which
  33597. * the value is ranked. The iteratee is invoked with one argument: (value).
  33598. *
  33599. * @static
  33600. * @memberOf _
  33601. * @since 4.0.0
  33602. * @category Math
  33603. * @param {Array} array The array to iterate over.
  33604. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33605. * @returns {*} Returns the maximum value.
  33606. * @example
  33607. *
  33608. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33609. *
  33610. * _.maxBy(objects, function(o) { return o.n; });
  33611. * // => { 'n': 2 }
  33612. *
  33613. * // The `_.property` iteratee shorthand.
  33614. * _.maxBy(objects, 'n');
  33615. * // => { 'n': 2 }
  33616. */
  33617. function maxBy(array, iteratee) {
  33618. return (array && array.length)
  33619. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  33620. : undefined;
  33621. }
  33622. /**
  33623. * Computes the mean of the values in `array`.
  33624. *
  33625. * @static
  33626. * @memberOf _
  33627. * @since 4.0.0
  33628. * @category Math
  33629. * @param {Array} array The array to iterate over.
  33630. * @returns {number} Returns the mean.
  33631. * @example
  33632. *
  33633. * _.mean([4, 2, 8, 6]);
  33634. * // => 5
  33635. */
  33636. function mean(array) {
  33637. return baseMean(array, identity);
  33638. }
  33639. /**
  33640. * This method is like `_.mean` except that it accepts `iteratee` which is
  33641. * invoked for each element in `array` to generate the value to be averaged.
  33642. * The iteratee is invoked with one argument: (value).
  33643. *
  33644. * @static
  33645. * @memberOf _
  33646. * @since 4.7.0
  33647. * @category Math
  33648. * @param {Array} array The array to iterate over.
  33649. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33650. * @returns {number} Returns the mean.
  33651. * @example
  33652. *
  33653. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33654. *
  33655. * _.meanBy(objects, function(o) { return o.n; });
  33656. * // => 5
  33657. *
  33658. * // The `_.property` iteratee shorthand.
  33659. * _.meanBy(objects, 'n');
  33660. * // => 5
  33661. */
  33662. function meanBy(array, iteratee) {
  33663. return baseMean(array, getIteratee(iteratee, 2));
  33664. }
  33665. /**
  33666. * Computes the minimum value of `array`. If `array` is empty or falsey,
  33667. * `undefined` is returned.
  33668. *
  33669. * @static
  33670. * @since 0.1.0
  33671. * @memberOf _
  33672. * @category Math
  33673. * @param {Array} array The array to iterate over.
  33674. * @returns {*} Returns the minimum value.
  33675. * @example
  33676. *
  33677. * _.min([4, 2, 8, 6]);
  33678. * // => 2
  33679. *
  33680. * _.min([]);
  33681. * // => undefined
  33682. */
  33683. function min(array) {
  33684. return (array && array.length)
  33685. ? baseExtremum(array, identity, baseLt)
  33686. : undefined;
  33687. }
  33688. /**
  33689. * This method is like `_.min` except that it accepts `iteratee` which is
  33690. * invoked for each element in `array` to generate the criterion by which
  33691. * the value is ranked. The iteratee is invoked with one argument: (value).
  33692. *
  33693. * @static
  33694. * @memberOf _
  33695. * @since 4.0.0
  33696. * @category Math
  33697. * @param {Array} array The array to iterate over.
  33698. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33699. * @returns {*} Returns the minimum value.
  33700. * @example
  33701. *
  33702. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33703. *
  33704. * _.minBy(objects, function(o) { return o.n; });
  33705. * // => { 'n': 1 }
  33706. *
  33707. * // The `_.property` iteratee shorthand.
  33708. * _.minBy(objects, 'n');
  33709. * // => { 'n': 1 }
  33710. */
  33711. function minBy(array, iteratee) {
  33712. return (array && array.length)
  33713. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  33714. : undefined;
  33715. }
  33716. /**
  33717. * Multiply two numbers.
  33718. *
  33719. * @static
  33720. * @memberOf _
  33721. * @since 4.7.0
  33722. * @category Math
  33723. * @param {number} multiplier The first number in a multiplication.
  33724. * @param {number} multiplicand The second number in a multiplication.
  33725. * @returns {number} Returns the product.
  33726. * @example
  33727. *
  33728. * _.multiply(6, 4);
  33729. * // => 24
  33730. */
  33731. var multiply = createMathOperation(function(multiplier, multiplicand) {
  33732. return multiplier * multiplicand;
  33733. }, 1);
  33734. /**
  33735. * Computes `number` rounded to `precision`.
  33736. *
  33737. * @static
  33738. * @memberOf _
  33739. * @since 3.10.0
  33740. * @category Math
  33741. * @param {number} number The number to round.
  33742. * @param {number} [precision=0] The precision to round to.
  33743. * @returns {number} Returns the rounded number.
  33744. * @example
  33745. *
  33746. * _.round(4.006);
  33747. * // => 4
  33748. *
  33749. * _.round(4.006, 2);
  33750. * // => 4.01
  33751. *
  33752. * _.round(4060, -2);
  33753. * // => 4100
  33754. */
  33755. var round = createRound('round');
  33756. /**
  33757. * Subtract two numbers.
  33758. *
  33759. * @static
  33760. * @memberOf _
  33761. * @since 4.0.0
  33762. * @category Math
  33763. * @param {number} minuend The first number in a subtraction.
  33764. * @param {number} subtrahend The second number in a subtraction.
  33765. * @returns {number} Returns the difference.
  33766. * @example
  33767. *
  33768. * _.subtract(6, 4);
  33769. * // => 2
  33770. */
  33771. var subtract = createMathOperation(function(minuend, subtrahend) {
  33772. return minuend - subtrahend;
  33773. }, 0);
  33774. /**
  33775. * Computes the sum of the values in `array`.
  33776. *
  33777. * @static
  33778. * @memberOf _
  33779. * @since 3.4.0
  33780. * @category Math
  33781. * @param {Array} array The array to iterate over.
  33782. * @returns {number} Returns the sum.
  33783. * @example
  33784. *
  33785. * _.sum([4, 2, 8, 6]);
  33786. * // => 20
  33787. */
  33788. function sum(array) {
  33789. return (array && array.length)
  33790. ? baseSum(array, identity)
  33791. : 0;
  33792. }
  33793. /**
  33794. * This method is like `_.sum` except that it accepts `iteratee` which is
  33795. * invoked for each element in `array` to generate the value to be summed.
  33796. * The iteratee is invoked with one argument: (value).
  33797. *
  33798. * @static
  33799. * @memberOf _
  33800. * @since 4.0.0
  33801. * @category Math
  33802. * @param {Array} array The array to iterate over.
  33803. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33804. * @returns {number} Returns the sum.
  33805. * @example
  33806. *
  33807. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33808. *
  33809. * _.sumBy(objects, function(o) { return o.n; });
  33810. * // => 20
  33811. *
  33812. * // The `_.property` iteratee shorthand.
  33813. * _.sumBy(objects, 'n');
  33814. * // => 20
  33815. */
  33816. function sumBy(array, iteratee) {
  33817. return (array && array.length)
  33818. ? baseSum(array, getIteratee(iteratee, 2))
  33819. : 0;
  33820. }
  33821. /*------------------------------------------------------------------------*/
  33822. // Add methods that return wrapped values in chain sequences.
  33823. lodash.after = after;
  33824. lodash.ary = ary;
  33825. lodash.assign = assign;
  33826. lodash.assignIn = assignIn;
  33827. lodash.assignInWith = assignInWith;
  33828. lodash.assignWith = assignWith;
  33829. lodash.at = at;
  33830. lodash.before = before;
  33831. lodash.bind = bind;
  33832. lodash.bindAll = bindAll;
  33833. lodash.bindKey = bindKey;
  33834. lodash.castArray = castArray;
  33835. lodash.chain = chain;
  33836. lodash.chunk = chunk;
  33837. lodash.compact = compact;
  33838. lodash.concat = concat;
  33839. lodash.cond = cond;
  33840. lodash.conforms = conforms;
  33841. lodash.constant = constant;
  33842. lodash.countBy = countBy;
  33843. lodash.create = create;
  33844. lodash.curry = curry;
  33845. lodash.curryRight = curryRight;
  33846. lodash.debounce = debounce;
  33847. lodash.defaults = defaults;
  33848. lodash.defaultsDeep = defaultsDeep;
  33849. lodash.defer = defer;
  33850. lodash.delay = delay;
  33851. lodash.difference = difference;
  33852. lodash.differenceBy = differenceBy;
  33853. lodash.differenceWith = differenceWith;
  33854. lodash.drop = drop;
  33855. lodash.dropRight = dropRight;
  33856. lodash.dropRightWhile = dropRightWhile;
  33857. lodash.dropWhile = dropWhile;
  33858. lodash.fill = fill;
  33859. lodash.filter = filter;
  33860. lodash.flatMap = flatMap;
  33861. lodash.flatMapDeep = flatMapDeep;
  33862. lodash.flatMapDepth = flatMapDepth;
  33863. lodash.flatten = flatten;
  33864. lodash.flattenDeep = flattenDeep;
  33865. lodash.flattenDepth = flattenDepth;
  33866. lodash.flip = flip;
  33867. lodash.flow = flow;
  33868. lodash.flowRight = flowRight;
  33869. lodash.fromPairs = fromPairs;
  33870. lodash.functions = functions;
  33871. lodash.functionsIn = functionsIn;
  33872. lodash.groupBy = groupBy;
  33873. lodash.initial = initial;
  33874. lodash.intersection = intersection;
  33875. lodash.intersectionBy = intersectionBy;
  33876. lodash.intersectionWith = intersectionWith;
  33877. lodash.invert = invert;
  33878. lodash.invertBy = invertBy;
  33879. lodash.invokeMap = invokeMap;
  33880. lodash.iteratee = iteratee;
  33881. lodash.keyBy = keyBy;
  33882. lodash.keys = keys;
  33883. lodash.keysIn = keysIn;
  33884. lodash.map = map;
  33885. lodash.mapKeys = mapKeys;
  33886. lodash.mapValues = mapValues;
  33887. lodash.matches = matches;
  33888. lodash.matchesProperty = matchesProperty;
  33889. lodash.memoize = memoize;
  33890. lodash.merge = merge;
  33891. lodash.mergeWith = mergeWith;
  33892. lodash.method = method;
  33893. lodash.methodOf = methodOf;
  33894. lodash.mixin = mixin;
  33895. lodash.negate = negate;
  33896. lodash.nthArg = nthArg;
  33897. lodash.omit = omit;
  33898. lodash.omitBy = omitBy;
  33899. lodash.once = once;
  33900. lodash.orderBy = orderBy;
  33901. lodash.over = over;
  33902. lodash.overArgs = overArgs;
  33903. lodash.overEvery = overEvery;
  33904. lodash.overSome = overSome;
  33905. lodash.partial = partial;
  33906. lodash.partialRight = partialRight;
  33907. lodash.partition = partition;
  33908. lodash.pick = pick;
  33909. lodash.pickBy = pickBy;
  33910. lodash.property = property;
  33911. lodash.propertyOf = propertyOf;
  33912. lodash.pull = pull;
  33913. lodash.pullAll = pullAll;
  33914. lodash.pullAllBy = pullAllBy;
  33915. lodash.pullAllWith = pullAllWith;
  33916. lodash.pullAt = pullAt;
  33917. lodash.range = range;
  33918. lodash.rangeRight = rangeRight;
  33919. lodash.rearg = rearg;
  33920. lodash.reject = reject;
  33921. lodash.remove = remove;
  33922. lodash.rest = rest;
  33923. lodash.reverse = reverse;
  33924. lodash.sampleSize = sampleSize;
  33925. lodash.set = set;
  33926. lodash.setWith = setWith;
  33927. lodash.shuffle = shuffle;
  33928. lodash.slice = slice;
  33929. lodash.sortBy = sortBy;
  33930. lodash.sortedUniq = sortedUniq;
  33931. lodash.sortedUniqBy = sortedUniqBy;
  33932. lodash.split = split;
  33933. lodash.spread = spread;
  33934. lodash.tail = tail;
  33935. lodash.take = take;
  33936. lodash.takeRight = takeRight;
  33937. lodash.takeRightWhile = takeRightWhile;
  33938. lodash.takeWhile = takeWhile;
  33939. lodash.tap = tap;
  33940. lodash.throttle = throttle;
  33941. lodash.thru = thru;
  33942. lodash.toArray = toArray;
  33943. lodash.toPairs = toPairs;
  33944. lodash.toPairsIn = toPairsIn;
  33945. lodash.toPath = toPath;
  33946. lodash.toPlainObject = toPlainObject;
  33947. lodash.transform = transform;
  33948. lodash.unary = unary;
  33949. lodash.union = union;
  33950. lodash.unionBy = unionBy;
  33951. lodash.unionWith = unionWith;
  33952. lodash.uniq = uniq;
  33953. lodash.uniqBy = uniqBy;
  33954. lodash.uniqWith = uniqWith;
  33955. lodash.unset = unset;
  33956. lodash.unzip = unzip;
  33957. lodash.unzipWith = unzipWith;
  33958. lodash.update = update;
  33959. lodash.updateWith = updateWith;
  33960. lodash.values = values;
  33961. lodash.valuesIn = valuesIn;
  33962. lodash.without = without;
  33963. lodash.words = words;
  33964. lodash.wrap = wrap;
  33965. lodash.xor = xor;
  33966. lodash.xorBy = xorBy;
  33967. lodash.xorWith = xorWith;
  33968. lodash.zip = zip;
  33969. lodash.zipObject = zipObject;
  33970. lodash.zipObjectDeep = zipObjectDeep;
  33971. lodash.zipWith = zipWith;
  33972. // Add aliases.
  33973. lodash.entries = toPairs;
  33974. lodash.entriesIn = toPairsIn;
  33975. lodash.extend = assignIn;
  33976. lodash.extendWith = assignInWith;
  33977. // Add methods to `lodash.prototype`.
  33978. mixin(lodash, lodash);
  33979. /*------------------------------------------------------------------------*/
  33980. // Add methods that return unwrapped values in chain sequences.
  33981. lodash.add = add;
  33982. lodash.attempt = attempt;
  33983. lodash.camelCase = camelCase;
  33984. lodash.capitalize = capitalize;
  33985. lodash.ceil = ceil;
  33986. lodash.clamp = clamp;
  33987. lodash.clone = clone;
  33988. lodash.cloneDeep = cloneDeep;
  33989. lodash.cloneDeepWith = cloneDeepWith;
  33990. lodash.cloneWith = cloneWith;
  33991. lodash.conformsTo = conformsTo;
  33992. lodash.deburr = deburr;
  33993. lodash.defaultTo = defaultTo;
  33994. lodash.divide = divide;
  33995. lodash.endsWith = endsWith;
  33996. lodash.eq = eq;
  33997. lodash.escape = escape;
  33998. lodash.escapeRegExp = escapeRegExp;
  33999. lodash.every = every;
  34000. lodash.find = find;
  34001. lodash.findIndex = findIndex;
  34002. lodash.findKey = findKey;
  34003. lodash.findLast = findLast;
  34004. lodash.findLastIndex = findLastIndex;
  34005. lodash.findLastKey = findLastKey;
  34006. lodash.floor = floor;
  34007. lodash.forEach = forEach;
  34008. lodash.forEachRight = forEachRight;
  34009. lodash.forIn = forIn;
  34010. lodash.forInRight = forInRight;
  34011. lodash.forOwn = forOwn;
  34012. lodash.forOwnRight = forOwnRight;
  34013. lodash.get = get;
  34014. lodash.gt = gt;
  34015. lodash.gte = gte;
  34016. lodash.has = has;
  34017. lodash.hasIn = hasIn;
  34018. lodash.head = head;
  34019. lodash.identity = identity;
  34020. lodash.includes = includes;
  34021. lodash.indexOf = indexOf;
  34022. lodash.inRange = inRange;
  34023. lodash.invoke = invoke;
  34024. lodash.isArguments = isArguments;
  34025. lodash.isArray = isArray;
  34026. lodash.isArrayBuffer = isArrayBuffer;
  34027. lodash.isArrayLike = isArrayLike;
  34028. lodash.isArrayLikeObject = isArrayLikeObject;
  34029. lodash.isBoolean = isBoolean;
  34030. lodash.isBuffer = isBuffer;
  34031. lodash.isDate = isDate;
  34032. lodash.isElement = isElement;
  34033. lodash.isEmpty = isEmpty;
  34034. lodash.isEqual = isEqual;
  34035. lodash.isEqualWith = isEqualWith;
  34036. lodash.isError = isError;
  34037. lodash.isFinite = isFinite;
  34038. lodash.isFunction = isFunction;
  34039. lodash.isInteger = isInteger;
  34040. lodash.isLength = isLength;
  34041. lodash.isMap = isMap;
  34042. lodash.isMatch = isMatch;
  34043. lodash.isMatchWith = isMatchWith;
  34044. lodash.isNaN = isNaN;
  34045. lodash.isNative = isNative;
  34046. lodash.isNil = isNil;
  34047. lodash.isNull = isNull;
  34048. lodash.isNumber = isNumber;
  34049. lodash.isObject = isObject;
  34050. lodash.isObjectLike = isObjectLike;
  34051. lodash.isPlainObject = isPlainObject;
  34052. lodash.isRegExp = isRegExp;
  34053. lodash.isSafeInteger = isSafeInteger;
  34054. lodash.isSet = isSet;
  34055. lodash.isString = isString;
  34056. lodash.isSymbol = isSymbol;
  34057. lodash.isTypedArray = isTypedArray;
  34058. lodash.isUndefined = isUndefined;
  34059. lodash.isWeakMap = isWeakMap;
  34060. lodash.isWeakSet = isWeakSet;
  34061. lodash.join = join;
  34062. lodash.kebabCase = kebabCase;
  34063. lodash.last = last;
  34064. lodash.lastIndexOf = lastIndexOf;
  34065. lodash.lowerCase = lowerCase;
  34066. lodash.lowerFirst = lowerFirst;
  34067. lodash.lt = lt;
  34068. lodash.lte = lte;
  34069. lodash.max = max;
  34070. lodash.maxBy = maxBy;
  34071. lodash.mean = mean;
  34072. lodash.meanBy = meanBy;
  34073. lodash.min = min;
  34074. lodash.minBy = minBy;
  34075. lodash.stubArray = stubArray;
  34076. lodash.stubFalse = stubFalse;
  34077. lodash.stubObject = stubObject;
  34078. lodash.stubString = stubString;
  34079. lodash.stubTrue = stubTrue;
  34080. lodash.multiply = multiply;
  34081. lodash.nth = nth;
  34082. lodash.noConflict = noConflict;
  34083. lodash.noop = noop;
  34084. lodash.now = now;
  34085. lodash.pad = pad;
  34086. lodash.padEnd = padEnd;
  34087. lodash.padStart = padStart;
  34088. lodash.parseInt = parseInt;
  34089. lodash.random = random;
  34090. lodash.reduce = reduce;
  34091. lodash.reduceRight = reduceRight;
  34092. lodash.repeat = repeat;
  34093. lodash.replace = replace;
  34094. lodash.result = result;
  34095. lodash.round = round;
  34096. lodash.runInContext = runInContext;
  34097. lodash.sample = sample;
  34098. lodash.size = size;
  34099. lodash.snakeCase = snakeCase;
  34100. lodash.some = some;
  34101. lodash.sortedIndex = sortedIndex;
  34102. lodash.sortedIndexBy = sortedIndexBy;
  34103. lodash.sortedIndexOf = sortedIndexOf;
  34104. lodash.sortedLastIndex = sortedLastIndex;
  34105. lodash.sortedLastIndexBy = sortedLastIndexBy;
  34106. lodash.sortedLastIndexOf = sortedLastIndexOf;
  34107. lodash.startCase = startCase;
  34108. lodash.startsWith = startsWith;
  34109. lodash.subtract = subtract;
  34110. lodash.sum = sum;
  34111. lodash.sumBy = sumBy;
  34112. lodash.template = template;
  34113. lodash.times = times;
  34114. lodash.toFinite = toFinite;
  34115. lodash.toInteger = toInteger;
  34116. lodash.toLength = toLength;
  34117. lodash.toLower = toLower;
  34118. lodash.toNumber = toNumber;
  34119. lodash.toSafeInteger = toSafeInteger;
  34120. lodash.toString = toString;
  34121. lodash.toUpper = toUpper;
  34122. lodash.trim = trim;
  34123. lodash.trimEnd = trimEnd;
  34124. lodash.trimStart = trimStart;
  34125. lodash.truncate = truncate;
  34126. lodash.unescape = unescape;
  34127. lodash.uniqueId = uniqueId;
  34128. lodash.upperCase = upperCase;
  34129. lodash.upperFirst = upperFirst;
  34130. // Add aliases.
  34131. lodash.each = forEach;
  34132. lodash.eachRight = forEachRight;
  34133. lodash.first = head;
  34134. mixin(lodash, (function() {
  34135. var source = {};
  34136. baseForOwn(lodash, function(func, methodName) {
  34137. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  34138. source[methodName] = func;
  34139. }
  34140. });
  34141. return source;
  34142. }()), { 'chain': false });
  34143. /*------------------------------------------------------------------------*/
  34144. /**
  34145. * The semantic version number.
  34146. *
  34147. * @static
  34148. * @memberOf _
  34149. * @type {string}
  34150. */
  34151. lodash.VERSION = VERSION;
  34152. // Assign default placeholders.
  34153. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  34154. lodash[methodName].placeholder = lodash;
  34155. });
  34156. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  34157. arrayEach(['drop', 'take'], function(methodName, index) {
  34158. LazyWrapper.prototype[methodName] = function(n) {
  34159. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  34160. var result = (this.__filtered__ && !index)
  34161. ? new LazyWrapper(this)
  34162. : this.clone();
  34163. if (result.__filtered__) {
  34164. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  34165. } else {
  34166. result.__views__.push({
  34167. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  34168. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  34169. });
  34170. }
  34171. return result;
  34172. };
  34173. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  34174. return this.reverse()[methodName](n).reverse();
  34175. };
  34176. });
  34177. // Add `LazyWrapper` methods that accept an `iteratee` value.
  34178. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  34179. var type = index + 1,
  34180. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  34181. LazyWrapper.prototype[methodName] = function(iteratee) {
  34182. var result = this.clone();
  34183. result.__iteratees__.push({
  34184. 'iteratee': getIteratee(iteratee, 3),
  34185. 'type': type
  34186. });
  34187. result.__filtered__ = result.__filtered__ || isFilter;
  34188. return result;
  34189. };
  34190. });
  34191. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  34192. arrayEach(['head', 'last'], function(methodName, index) {
  34193. var takeName = 'take' + (index ? 'Right' : '');
  34194. LazyWrapper.prototype[methodName] = function() {
  34195. return this[takeName](1).value()[0];
  34196. };
  34197. });
  34198. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  34199. arrayEach(['initial', 'tail'], function(methodName, index) {
  34200. var dropName = 'drop' + (index ? '' : 'Right');
  34201. LazyWrapper.prototype[methodName] = function() {
  34202. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  34203. };
  34204. });
  34205. LazyWrapper.prototype.compact = function() {
  34206. return this.filter(identity);
  34207. };
  34208. LazyWrapper.prototype.find = function(predicate) {
  34209. return this.filter(predicate).head();
  34210. };
  34211. LazyWrapper.prototype.findLast = function(predicate) {
  34212. return this.reverse().find(predicate);
  34213. };
  34214. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  34215. if (typeof path == 'function') {
  34216. return new LazyWrapper(this);
  34217. }
  34218. return this.map(function(value) {
  34219. return baseInvoke(value, path, args);
  34220. });
  34221. });
  34222. LazyWrapper.prototype.reject = function(predicate) {
  34223. return this.filter(negate(getIteratee(predicate)));
  34224. };
  34225. LazyWrapper.prototype.slice = function(start, end) {
  34226. start = toInteger(start);
  34227. var result = this;
  34228. if (result.__filtered__ && (start > 0 || end < 0)) {
  34229. return new LazyWrapper(result);
  34230. }
  34231. if (start < 0) {
  34232. result = result.takeRight(-start);
  34233. } else if (start) {
  34234. result = result.drop(start);
  34235. }
  34236. if (end !== undefined) {
  34237. end = toInteger(end);
  34238. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  34239. }
  34240. return result;
  34241. };
  34242. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  34243. return this.reverse().takeWhile(predicate).reverse();
  34244. };
  34245. LazyWrapper.prototype.toArray = function() {
  34246. return this.take(MAX_ARRAY_LENGTH);
  34247. };
  34248. // Add `LazyWrapper` methods to `lodash.prototype`.
  34249. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34250. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  34251. isTaker = /^(?:head|last)$/.test(methodName),
  34252. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  34253. retUnwrapped = isTaker || /^find/.test(methodName);
  34254. if (!lodashFunc) {
  34255. return;
  34256. }
  34257. lodash.prototype[methodName] = function() {
  34258. var value = this.__wrapped__,
  34259. args = isTaker ? [1] : arguments,
  34260. isLazy = value instanceof LazyWrapper,
  34261. iteratee = args[0],
  34262. useLazy = isLazy || isArray(value);
  34263. var interceptor = function(value) {
  34264. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  34265. return (isTaker && chainAll) ? result[0] : result;
  34266. };
  34267. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  34268. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  34269. isLazy = useLazy = false;
  34270. }
  34271. var chainAll = this.__chain__,
  34272. isHybrid = !!this.__actions__.length,
  34273. isUnwrapped = retUnwrapped && !chainAll,
  34274. onlyLazy = isLazy && !isHybrid;
  34275. if (!retUnwrapped && useLazy) {
  34276. value = onlyLazy ? value : new LazyWrapper(this);
  34277. var result = func.apply(value, args);
  34278. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  34279. return new LodashWrapper(result, chainAll);
  34280. }
  34281. if (isUnwrapped && onlyLazy) {
  34282. return func.apply(this, args);
  34283. }
  34284. result = this.thru(interceptor);
  34285. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  34286. };
  34287. });
  34288. // Add `Array` methods to `lodash.prototype`.
  34289. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  34290. var func = arrayProto[methodName],
  34291. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  34292. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  34293. lodash.prototype[methodName] = function() {
  34294. var args = arguments;
  34295. if (retUnwrapped && !this.__chain__) {
  34296. var value = this.value();
  34297. return func.apply(isArray(value) ? value : [], args);
  34298. }
  34299. return this[chainName](function(value) {
  34300. return func.apply(isArray(value) ? value : [], args);
  34301. });
  34302. };
  34303. });
  34304. // Map minified method names to their real names.
  34305. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34306. var lodashFunc = lodash[methodName];
  34307. if (lodashFunc) {
  34308. var key = lodashFunc.name + '';
  34309. if (!hasOwnProperty.call(realNames, key)) {
  34310. realNames[key] = [];
  34311. }
  34312. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  34313. }
  34314. });
  34315. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  34316. 'name': 'wrapper',
  34317. 'func': undefined
  34318. }];
  34319. // Add methods to `LazyWrapper`.
  34320. LazyWrapper.prototype.clone = lazyClone;
  34321. LazyWrapper.prototype.reverse = lazyReverse;
  34322. LazyWrapper.prototype.value = lazyValue;
  34323. // Add chain sequence methods to the `lodash` wrapper.
  34324. lodash.prototype.at = wrapperAt;
  34325. lodash.prototype.chain = wrapperChain;
  34326. lodash.prototype.commit = wrapperCommit;
  34327. lodash.prototype.next = wrapperNext;
  34328. lodash.prototype.plant = wrapperPlant;
  34329. lodash.prototype.reverse = wrapperReverse;
  34330. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  34331. // Add lazy aliases.
  34332. lodash.prototype.first = lodash.prototype.head;
  34333. if (symIterator) {
  34334. lodash.prototype[symIterator] = wrapperToIterator;
  34335. }
  34336. return lodash;
  34337. });
  34338. /*--------------------------------------------------------------------------*/
  34339. // Export lodash.
  34340. var _ = runInContext();
  34341. // Some AMD build optimizers, like r.js, check for condition patterns like:
  34342. if (true) {
  34343. // Expose Lodash on the global object to prevent errors when Lodash is
  34344. // loaded by a script tag in the presence of an AMD loader.
  34345. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  34346. // Use `_.noConflict` to remove Lodash from the global object.
  34347. root._ = _;
  34348. // Define as an anonymous module so, through path mapping, it can be
  34349. // referenced as the "underscore" module.
  34350. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  34351. return _;
  34352. }).call(exports, __webpack_require__, exports, module),
  34353. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  34354. }
  34355. // Check for `exports` after `define` in case a build optimizer adds it.
  34356. else {}
  34357. }.call(this));
  34358. /* 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)))
  34359. /***/ }),
  34360. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  34361. /*!***************************************************!*\
  34362. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  34363. \***************************************************/
  34364. /*! exports provided: default */
  34365. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  34366. "use strict";
  34367. __webpack_require__.r(__webpack_exports__);
  34368. /* WEBPACK VAR INJECTION */(function(global) {/**!
  34369. * @fileOverview Kickass library to create and place poppers near their reference elements.
  34370. * @version 1.16.1
  34371. * @license
  34372. * Copyright (c) 2016 Federico Zivolo and contributors
  34373. *
  34374. * Permission is hereby granted, free of charge, to any person obtaining a copy
  34375. * of this software and associated documentation files (the "Software"), to deal
  34376. * in the Software without restriction, including without limitation the rights
  34377. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  34378. * copies of the Software, and to permit persons to whom the Software is
  34379. * furnished to do so, subject to the following conditions:
  34380. *
  34381. * The above copyright notice and this permission notice shall be included in all
  34382. * copies or substantial portions of the Software.
  34383. *
  34384. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  34385. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  34386. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  34387. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  34388. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  34389. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  34390. * SOFTWARE.
  34391. */
  34392. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  34393. var timeoutDuration = function () {
  34394. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  34395. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  34396. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  34397. return 1;
  34398. }
  34399. }
  34400. return 0;
  34401. }();
  34402. function microtaskDebounce(fn) {
  34403. var called = false;
  34404. return function () {
  34405. if (called) {
  34406. return;
  34407. }
  34408. called = true;
  34409. window.Promise.resolve().then(function () {
  34410. called = false;
  34411. fn();
  34412. });
  34413. };
  34414. }
  34415. function taskDebounce(fn) {
  34416. var scheduled = false;
  34417. return function () {
  34418. if (!scheduled) {
  34419. scheduled = true;
  34420. setTimeout(function () {
  34421. scheduled = false;
  34422. fn();
  34423. }, timeoutDuration);
  34424. }
  34425. };
  34426. }
  34427. var supportsMicroTasks = isBrowser && window.Promise;
  34428. /**
  34429. * Create a debounced version of a method, that's asynchronously deferred
  34430. * but called in the minimum time possible.
  34431. *
  34432. * @method
  34433. * @memberof Popper.Utils
  34434. * @argument {Function} fn
  34435. * @returns {Function}
  34436. */
  34437. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  34438. /**
  34439. * Check if the given variable is a function
  34440. * @method
  34441. * @memberof Popper.Utils
  34442. * @argument {Any} functionToCheck - variable to check
  34443. * @returns {Boolean} answer to: is a function?
  34444. */
  34445. function isFunction(functionToCheck) {
  34446. var getType = {};
  34447. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  34448. }
  34449. /**
  34450. * Get CSS computed property of the given element
  34451. * @method
  34452. * @memberof Popper.Utils
  34453. * @argument {Eement} element
  34454. * @argument {String} property
  34455. */
  34456. function getStyleComputedProperty(element, property) {
  34457. if (element.nodeType !== 1) {
  34458. return [];
  34459. }
  34460. // NOTE: 1 DOM access here
  34461. var window = element.ownerDocument.defaultView;
  34462. var css = window.getComputedStyle(element, null);
  34463. return property ? css[property] : css;
  34464. }
  34465. /**
  34466. * Returns the parentNode or the host of the element
  34467. * @method
  34468. * @memberof Popper.Utils
  34469. * @argument {Element} element
  34470. * @returns {Element} parent
  34471. */
  34472. function getParentNode(element) {
  34473. if (element.nodeName === 'HTML') {
  34474. return element;
  34475. }
  34476. return element.parentNode || element.host;
  34477. }
  34478. /**
  34479. * Returns the scrolling parent of the given element
  34480. * @method
  34481. * @memberof Popper.Utils
  34482. * @argument {Element} element
  34483. * @returns {Element} scroll parent
  34484. */
  34485. function getScrollParent(element) {
  34486. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  34487. if (!element) {
  34488. return document.body;
  34489. }
  34490. switch (element.nodeName) {
  34491. case 'HTML':
  34492. case 'BODY':
  34493. return element.ownerDocument.body;
  34494. case '#document':
  34495. return element.body;
  34496. }
  34497. // Firefox want us to check `-x` and `-y` variations as well
  34498. var _getStyleComputedProp = getStyleComputedProperty(element),
  34499. overflow = _getStyleComputedProp.overflow,
  34500. overflowX = _getStyleComputedProp.overflowX,
  34501. overflowY = _getStyleComputedProp.overflowY;
  34502. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  34503. return element;
  34504. }
  34505. return getScrollParent(getParentNode(element));
  34506. }
  34507. /**
  34508. * Returns the reference node of the reference object, or the reference object itself.
  34509. * @method
  34510. * @memberof Popper.Utils
  34511. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  34512. * @returns {Element} parent
  34513. */
  34514. function getReferenceNode(reference) {
  34515. return reference && reference.referenceNode ? reference.referenceNode : reference;
  34516. }
  34517. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  34518. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  34519. /**
  34520. * Determines if the browser is Internet Explorer
  34521. * @method
  34522. * @memberof Popper.Utils
  34523. * @param {Number} version to check
  34524. * @returns {Boolean} isIE
  34525. */
  34526. function isIE(version) {
  34527. if (version === 11) {
  34528. return isIE11;
  34529. }
  34530. if (version === 10) {
  34531. return isIE10;
  34532. }
  34533. return isIE11 || isIE10;
  34534. }
  34535. /**
  34536. * Returns the offset parent of the given element
  34537. * @method
  34538. * @memberof Popper.Utils
  34539. * @argument {Element} element
  34540. * @returns {Element} offset parent
  34541. */
  34542. function getOffsetParent(element) {
  34543. if (!element) {
  34544. return document.documentElement;
  34545. }
  34546. var noOffsetParent = isIE(10) ? document.body : null;
  34547. // NOTE: 1 DOM access here
  34548. var offsetParent = element.offsetParent || null;
  34549. // Skip hidden elements which don't have an offsetParent
  34550. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  34551. offsetParent = (element = element.nextElementSibling).offsetParent;
  34552. }
  34553. var nodeName = offsetParent && offsetParent.nodeName;
  34554. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  34555. return element ? element.ownerDocument.documentElement : document.documentElement;
  34556. }
  34557. // .offsetParent will return the closest TH, TD or TABLE in case
  34558. // no offsetParent is present, I hate this job...
  34559. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  34560. return getOffsetParent(offsetParent);
  34561. }
  34562. return offsetParent;
  34563. }
  34564. function isOffsetContainer(element) {
  34565. var nodeName = element.nodeName;
  34566. if (nodeName === 'BODY') {
  34567. return false;
  34568. }
  34569. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  34570. }
  34571. /**
  34572. * Finds the root node (document, shadowDOM root) of the given element
  34573. * @method
  34574. * @memberof Popper.Utils
  34575. * @argument {Element} node
  34576. * @returns {Element} root node
  34577. */
  34578. function getRoot(node) {
  34579. if (node.parentNode !== null) {
  34580. return getRoot(node.parentNode);
  34581. }
  34582. return node;
  34583. }
  34584. /**
  34585. * Finds the offset parent common to the two provided nodes
  34586. * @method
  34587. * @memberof Popper.Utils
  34588. * @argument {Element} element1
  34589. * @argument {Element} element2
  34590. * @returns {Element} common offset parent
  34591. */
  34592. function findCommonOffsetParent(element1, element2) {
  34593. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34594. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  34595. return document.documentElement;
  34596. }
  34597. // Here we make sure to give as "start" the element that comes first in the DOM
  34598. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  34599. var start = order ? element1 : element2;
  34600. var end = order ? element2 : element1;
  34601. // Get common ancestor container
  34602. var range = document.createRange();
  34603. range.setStart(start, 0);
  34604. range.setEnd(end, 0);
  34605. var commonAncestorContainer = range.commonAncestorContainer;
  34606. // Both nodes are inside #document
  34607. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  34608. if (isOffsetContainer(commonAncestorContainer)) {
  34609. return commonAncestorContainer;
  34610. }
  34611. return getOffsetParent(commonAncestorContainer);
  34612. }
  34613. // one of the nodes is inside shadowDOM, find which one
  34614. var element1root = getRoot(element1);
  34615. if (element1root.host) {
  34616. return findCommonOffsetParent(element1root.host, element2);
  34617. } else {
  34618. return findCommonOffsetParent(element1, getRoot(element2).host);
  34619. }
  34620. }
  34621. /**
  34622. * Gets the scroll value of the given element in the given side (top and left)
  34623. * @method
  34624. * @memberof Popper.Utils
  34625. * @argument {Element} element
  34626. * @argument {String} side `top` or `left`
  34627. * @returns {number} amount of scrolled pixels
  34628. */
  34629. function getScroll(element) {
  34630. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  34631. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  34632. var nodeName = element.nodeName;
  34633. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34634. var html = element.ownerDocument.documentElement;
  34635. var scrollingElement = element.ownerDocument.scrollingElement || html;
  34636. return scrollingElement[upperSide];
  34637. }
  34638. return element[upperSide];
  34639. }
  34640. /*
  34641. * Sum or subtract the element scroll values (left and top) from a given rect object
  34642. * @method
  34643. * @memberof Popper.Utils
  34644. * @param {Object} rect - Rect object you want to change
  34645. * @param {HTMLElement} element - The element from the function reads the scroll values
  34646. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  34647. * @return {Object} rect - The modifier rect object
  34648. */
  34649. function includeScroll(rect, element) {
  34650. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34651. var scrollTop = getScroll(element, 'top');
  34652. var scrollLeft = getScroll(element, 'left');
  34653. var modifier = subtract ? -1 : 1;
  34654. rect.top += scrollTop * modifier;
  34655. rect.bottom += scrollTop * modifier;
  34656. rect.left += scrollLeft * modifier;
  34657. rect.right += scrollLeft * modifier;
  34658. return rect;
  34659. }
  34660. /*
  34661. * Helper to detect borders of a given element
  34662. * @method
  34663. * @memberof Popper.Utils
  34664. * @param {CSSStyleDeclaration} styles
  34665. * Result of `getStyleComputedProperty` on the given element
  34666. * @param {String} axis - `x` or `y`
  34667. * @return {number} borders - The borders size of the given axis
  34668. */
  34669. function getBordersSize(styles, axis) {
  34670. var sideA = axis === 'x' ? 'Left' : 'Top';
  34671. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  34672. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  34673. }
  34674. function getSize(axis, body, html, computedStyle) {
  34675. 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);
  34676. }
  34677. function getWindowSizes(document) {
  34678. var body = document.body;
  34679. var html = document.documentElement;
  34680. var computedStyle = isIE(10) && getComputedStyle(html);
  34681. return {
  34682. height: getSize('Height', body, html, computedStyle),
  34683. width: getSize('Width', body, html, computedStyle)
  34684. };
  34685. }
  34686. var classCallCheck = function (instance, Constructor) {
  34687. if (!(instance instanceof Constructor)) {
  34688. throw new TypeError("Cannot call a class as a function");
  34689. }
  34690. };
  34691. var createClass = function () {
  34692. function defineProperties(target, props) {
  34693. for (var i = 0; i < props.length; i++) {
  34694. var descriptor = props[i];
  34695. descriptor.enumerable = descriptor.enumerable || false;
  34696. descriptor.configurable = true;
  34697. if ("value" in descriptor) descriptor.writable = true;
  34698. Object.defineProperty(target, descriptor.key, descriptor);
  34699. }
  34700. }
  34701. return function (Constructor, protoProps, staticProps) {
  34702. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  34703. if (staticProps) defineProperties(Constructor, staticProps);
  34704. return Constructor;
  34705. };
  34706. }();
  34707. var defineProperty = function (obj, key, value) {
  34708. if (key in obj) {
  34709. Object.defineProperty(obj, key, {
  34710. value: value,
  34711. enumerable: true,
  34712. configurable: true,
  34713. writable: true
  34714. });
  34715. } else {
  34716. obj[key] = value;
  34717. }
  34718. return obj;
  34719. };
  34720. var _extends = Object.assign || function (target) {
  34721. for (var i = 1; i < arguments.length; i++) {
  34722. var source = arguments[i];
  34723. for (var key in source) {
  34724. if (Object.prototype.hasOwnProperty.call(source, key)) {
  34725. target[key] = source[key];
  34726. }
  34727. }
  34728. }
  34729. return target;
  34730. };
  34731. /**
  34732. * Given element offsets, generate an output similar to getBoundingClientRect
  34733. * @method
  34734. * @memberof Popper.Utils
  34735. * @argument {Object} offsets
  34736. * @returns {Object} ClientRect like output
  34737. */
  34738. function getClientRect(offsets) {
  34739. return _extends({}, offsets, {
  34740. right: offsets.left + offsets.width,
  34741. bottom: offsets.top + offsets.height
  34742. });
  34743. }
  34744. /**
  34745. * Get bounding client rect of given element
  34746. * @method
  34747. * @memberof Popper.Utils
  34748. * @param {HTMLElement} element
  34749. * @return {Object} client rect
  34750. */
  34751. function getBoundingClientRect(element) {
  34752. var rect = {};
  34753. // IE10 10 FIX: Please, don't ask, the element isn't
  34754. // considered in DOM in some circumstances...
  34755. // This isn't reproducible in IE10 compatibility mode of IE11
  34756. try {
  34757. if (isIE(10)) {
  34758. rect = element.getBoundingClientRect();
  34759. var scrollTop = getScroll(element, 'top');
  34760. var scrollLeft = getScroll(element, 'left');
  34761. rect.top += scrollTop;
  34762. rect.left += scrollLeft;
  34763. rect.bottom += scrollTop;
  34764. rect.right += scrollLeft;
  34765. } else {
  34766. rect = element.getBoundingClientRect();
  34767. }
  34768. } catch (e) {}
  34769. var result = {
  34770. left: rect.left,
  34771. top: rect.top,
  34772. width: rect.right - rect.left,
  34773. height: rect.bottom - rect.top
  34774. };
  34775. // subtract scrollbar size from sizes
  34776. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  34777. var width = sizes.width || element.clientWidth || result.width;
  34778. var height = sizes.height || element.clientHeight || result.height;
  34779. var horizScrollbar = element.offsetWidth - width;
  34780. var vertScrollbar = element.offsetHeight - height;
  34781. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  34782. // we make this check conditional for performance reasons
  34783. if (horizScrollbar || vertScrollbar) {
  34784. var styles = getStyleComputedProperty(element);
  34785. horizScrollbar -= getBordersSize(styles, 'x');
  34786. vertScrollbar -= getBordersSize(styles, 'y');
  34787. result.width -= horizScrollbar;
  34788. result.height -= vertScrollbar;
  34789. }
  34790. return getClientRect(result);
  34791. }
  34792. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  34793. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34794. var isIE10 = isIE(10);
  34795. var isHTML = parent.nodeName === 'HTML';
  34796. var childrenRect = getBoundingClientRect(children);
  34797. var parentRect = getBoundingClientRect(parent);
  34798. var scrollParent = getScrollParent(children);
  34799. var styles = getStyleComputedProperty(parent);
  34800. var borderTopWidth = parseFloat(styles.borderTopWidth);
  34801. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  34802. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  34803. if (fixedPosition && isHTML) {
  34804. parentRect.top = Math.max(parentRect.top, 0);
  34805. parentRect.left = Math.max(parentRect.left, 0);
  34806. }
  34807. var offsets = getClientRect({
  34808. top: childrenRect.top - parentRect.top - borderTopWidth,
  34809. left: childrenRect.left - parentRect.left - borderLeftWidth,
  34810. width: childrenRect.width,
  34811. height: childrenRect.height
  34812. });
  34813. offsets.marginTop = 0;
  34814. offsets.marginLeft = 0;
  34815. // Subtract margins of documentElement in case it's being used as parent
  34816. // we do this only on HTML because it's the only element that behaves
  34817. // differently when margins are applied to it. The margins are included in
  34818. // the box of the documentElement, in the other cases not.
  34819. if (!isIE10 && isHTML) {
  34820. var marginTop = parseFloat(styles.marginTop);
  34821. var marginLeft = parseFloat(styles.marginLeft);
  34822. offsets.top -= borderTopWidth - marginTop;
  34823. offsets.bottom -= borderTopWidth - marginTop;
  34824. offsets.left -= borderLeftWidth - marginLeft;
  34825. offsets.right -= borderLeftWidth - marginLeft;
  34826. // Attach marginTop and marginLeft because in some circumstances we may need them
  34827. offsets.marginTop = marginTop;
  34828. offsets.marginLeft = marginLeft;
  34829. }
  34830. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  34831. offsets = includeScroll(offsets, parent);
  34832. }
  34833. return offsets;
  34834. }
  34835. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  34836. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  34837. var html = element.ownerDocument.documentElement;
  34838. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  34839. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  34840. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  34841. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  34842. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  34843. var offset = {
  34844. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  34845. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  34846. width: width,
  34847. height: height
  34848. };
  34849. return getClientRect(offset);
  34850. }
  34851. /**
  34852. * Check if the given element is fixed or is inside a fixed parent
  34853. * @method
  34854. * @memberof Popper.Utils
  34855. * @argument {Element} element
  34856. * @argument {Element} customContainer
  34857. * @returns {Boolean} answer to "isFixed?"
  34858. */
  34859. function isFixed(element) {
  34860. var nodeName = element.nodeName;
  34861. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34862. return false;
  34863. }
  34864. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  34865. return true;
  34866. }
  34867. var parentNode = getParentNode(element);
  34868. if (!parentNode) {
  34869. return false;
  34870. }
  34871. return isFixed(parentNode);
  34872. }
  34873. /**
  34874. * Finds the first parent of an element that has a transformed property defined
  34875. * @method
  34876. * @memberof Popper.Utils
  34877. * @argument {Element} element
  34878. * @returns {Element} first transformed parent or documentElement
  34879. */
  34880. function getFixedPositionOffsetParent(element) {
  34881. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34882. if (!element || !element.parentElement || isIE()) {
  34883. return document.documentElement;
  34884. }
  34885. var el = element.parentElement;
  34886. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  34887. el = el.parentElement;
  34888. }
  34889. return el || document.documentElement;
  34890. }
  34891. /**
  34892. * Computed the boundaries limits and return them
  34893. * @method
  34894. * @memberof Popper.Utils
  34895. * @param {HTMLElement} popper
  34896. * @param {HTMLElement} reference
  34897. * @param {number} padding
  34898. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  34899. * @param {Boolean} fixedPosition - Is in fixed position mode
  34900. * @returns {Object} Coordinates of the boundaries
  34901. */
  34902. function getBoundaries(popper, reference, padding, boundariesElement) {
  34903. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  34904. // NOTE: 1 DOM access here
  34905. var boundaries = { top: 0, left: 0 };
  34906. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34907. // Handle viewport case
  34908. if (boundariesElement === 'viewport') {
  34909. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  34910. } else {
  34911. // Handle other cases based on DOM element used as boundaries
  34912. var boundariesNode = void 0;
  34913. if (boundariesElement === 'scrollParent') {
  34914. boundariesNode = getScrollParent(getParentNode(reference));
  34915. if (boundariesNode.nodeName === 'BODY') {
  34916. boundariesNode = popper.ownerDocument.documentElement;
  34917. }
  34918. } else if (boundariesElement === 'window') {
  34919. boundariesNode = popper.ownerDocument.documentElement;
  34920. } else {
  34921. boundariesNode = boundariesElement;
  34922. }
  34923. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  34924. // In case of HTML, we need a different computation
  34925. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  34926. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  34927. height = _getWindowSizes.height,
  34928. width = _getWindowSizes.width;
  34929. boundaries.top += offsets.top - offsets.marginTop;
  34930. boundaries.bottom = height + offsets.top;
  34931. boundaries.left += offsets.left - offsets.marginLeft;
  34932. boundaries.right = width + offsets.left;
  34933. } else {
  34934. // for all the other DOM elements, this one is good
  34935. boundaries = offsets;
  34936. }
  34937. }
  34938. // Add paddings
  34939. padding = padding || 0;
  34940. var isPaddingNumber = typeof padding === 'number';
  34941. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  34942. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  34943. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  34944. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  34945. return boundaries;
  34946. }
  34947. function getArea(_ref) {
  34948. var width = _ref.width,
  34949. height = _ref.height;
  34950. return width * height;
  34951. }
  34952. /**
  34953. * Utility used to transform the `auto` placement to the placement with more
  34954. * available space.
  34955. * @method
  34956. * @memberof Popper.Utils
  34957. * @argument {Object} data - The data object generated by update method
  34958. * @argument {Object} options - Modifiers configuration and options
  34959. * @returns {Object} The data object, properly modified
  34960. */
  34961. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  34962. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  34963. if (placement.indexOf('auto') === -1) {
  34964. return placement;
  34965. }
  34966. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  34967. var rects = {
  34968. top: {
  34969. width: boundaries.width,
  34970. height: refRect.top - boundaries.top
  34971. },
  34972. right: {
  34973. width: boundaries.right - refRect.right,
  34974. height: boundaries.height
  34975. },
  34976. bottom: {
  34977. width: boundaries.width,
  34978. height: boundaries.bottom - refRect.bottom
  34979. },
  34980. left: {
  34981. width: refRect.left - boundaries.left,
  34982. height: boundaries.height
  34983. }
  34984. };
  34985. var sortedAreas = Object.keys(rects).map(function (key) {
  34986. return _extends({
  34987. key: key
  34988. }, rects[key], {
  34989. area: getArea(rects[key])
  34990. });
  34991. }).sort(function (a, b) {
  34992. return b.area - a.area;
  34993. });
  34994. var filteredAreas = sortedAreas.filter(function (_ref2) {
  34995. var width = _ref2.width,
  34996. height = _ref2.height;
  34997. return width >= popper.clientWidth && height >= popper.clientHeight;
  34998. });
  34999. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  35000. var variation = placement.split('-')[1];
  35001. return computedPlacement + (variation ? '-' + variation : '');
  35002. }
  35003. /**
  35004. * Get offsets to the reference element
  35005. * @method
  35006. * @memberof Popper.Utils
  35007. * @param {Object} state
  35008. * @param {Element} popper - the popper element
  35009. * @param {Element} reference - the reference element (the popper will be relative to this)
  35010. * @param {Element} fixedPosition - is in fixed position mode
  35011. * @returns {Object} An object containing the offsets which will be applied to the popper
  35012. */
  35013. function getReferenceOffsets(state, popper, reference) {
  35014. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  35015. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35016. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  35017. }
  35018. /**
  35019. * Get the outer sizes of the given element (offset size + margins)
  35020. * @method
  35021. * @memberof Popper.Utils
  35022. * @argument {Element} element
  35023. * @returns {Object} object containing width and height properties
  35024. */
  35025. function getOuterSizes(element) {
  35026. var window = element.ownerDocument.defaultView;
  35027. var styles = window.getComputedStyle(element);
  35028. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  35029. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  35030. var result = {
  35031. width: element.offsetWidth + y,
  35032. height: element.offsetHeight + x
  35033. };
  35034. return result;
  35035. }
  35036. /**
  35037. * Get the opposite placement of the given one
  35038. * @method
  35039. * @memberof Popper.Utils
  35040. * @argument {String} placement
  35041. * @returns {String} flipped placement
  35042. */
  35043. function getOppositePlacement(placement) {
  35044. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  35045. return placement.replace(/left|right|bottom|top/g, function (matched) {
  35046. return hash[matched];
  35047. });
  35048. }
  35049. /**
  35050. * Get offsets to the popper
  35051. * @method
  35052. * @memberof Popper.Utils
  35053. * @param {Object} position - CSS position the Popper will get applied
  35054. * @param {HTMLElement} popper - the popper element
  35055. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  35056. * @param {String} placement - one of the valid placement options
  35057. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  35058. */
  35059. function getPopperOffsets(popper, referenceOffsets, placement) {
  35060. placement = placement.split('-')[0];
  35061. // Get popper node sizes
  35062. var popperRect = getOuterSizes(popper);
  35063. // Add position, width and height to our offsets object
  35064. var popperOffsets = {
  35065. width: popperRect.width,
  35066. height: popperRect.height
  35067. };
  35068. // depending by the popper placement we have to compute its offsets slightly differently
  35069. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  35070. var mainSide = isHoriz ? 'top' : 'left';
  35071. var secondarySide = isHoriz ? 'left' : 'top';
  35072. var measurement = isHoriz ? 'height' : 'width';
  35073. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  35074. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  35075. if (placement === secondarySide) {
  35076. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  35077. } else {
  35078. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  35079. }
  35080. return popperOffsets;
  35081. }
  35082. /**
  35083. * Mimics the `find` method of Array
  35084. * @method
  35085. * @memberof Popper.Utils
  35086. * @argument {Array} arr
  35087. * @argument prop
  35088. * @argument value
  35089. * @returns index or -1
  35090. */
  35091. function find(arr, check) {
  35092. // use native find if supported
  35093. if (Array.prototype.find) {
  35094. return arr.find(check);
  35095. }
  35096. // use `filter` to obtain the same behavior of `find`
  35097. return arr.filter(check)[0];
  35098. }
  35099. /**
  35100. * Return the index of the matching object
  35101. * @method
  35102. * @memberof Popper.Utils
  35103. * @argument {Array} arr
  35104. * @argument prop
  35105. * @argument value
  35106. * @returns index or -1
  35107. */
  35108. function findIndex(arr, prop, value) {
  35109. // use native findIndex if supported
  35110. if (Array.prototype.findIndex) {
  35111. return arr.findIndex(function (cur) {
  35112. return cur[prop] === value;
  35113. });
  35114. }
  35115. // use `find` + `indexOf` if `findIndex` isn't supported
  35116. var match = find(arr, function (obj) {
  35117. return obj[prop] === value;
  35118. });
  35119. return arr.indexOf(match);
  35120. }
  35121. /**
  35122. * Loop trough the list of modifiers and run them in order,
  35123. * each of them will then edit the data object.
  35124. * @method
  35125. * @memberof Popper.Utils
  35126. * @param {dataObject} data
  35127. * @param {Array} modifiers
  35128. * @param {String} ends - Optional modifier name used as stopper
  35129. * @returns {dataObject}
  35130. */
  35131. function runModifiers(modifiers, data, ends) {
  35132. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  35133. modifiersToRun.forEach(function (modifier) {
  35134. if (modifier['function']) {
  35135. // eslint-disable-line dot-notation
  35136. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  35137. }
  35138. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  35139. if (modifier.enabled && isFunction(fn)) {
  35140. // Add properties to offsets to make them a complete clientRect object
  35141. // we do this before each modifier to make sure the previous one doesn't
  35142. // mess with these values
  35143. data.offsets.popper = getClientRect(data.offsets.popper);
  35144. data.offsets.reference = getClientRect(data.offsets.reference);
  35145. data = fn(data, modifier);
  35146. }
  35147. });
  35148. return data;
  35149. }
  35150. /**
  35151. * Updates the position of the popper, computing the new offsets and applying
  35152. * the new style.<br />
  35153. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  35154. * @method
  35155. * @memberof Popper
  35156. */
  35157. function update() {
  35158. // if popper is destroyed, don't perform any further update
  35159. if (this.state.isDestroyed) {
  35160. return;
  35161. }
  35162. var data = {
  35163. instance: this,
  35164. styles: {},
  35165. arrowStyles: {},
  35166. attributes: {},
  35167. flipped: false,
  35168. offsets: {}
  35169. };
  35170. // compute reference element offsets
  35171. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  35172. // compute auto placement, store placement inside the data object,
  35173. // modifiers will be able to edit `placement` if needed
  35174. // and refer to originalPlacement to know the original value
  35175. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  35176. // store the computed placement inside `originalPlacement`
  35177. data.originalPlacement = data.placement;
  35178. data.positionFixed = this.options.positionFixed;
  35179. // compute the popper offsets
  35180. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  35181. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  35182. // run the modifiers
  35183. data = runModifiers(this.modifiers, data);
  35184. // the first `update` will call `onCreate` callback
  35185. // the other ones will call `onUpdate` callback
  35186. if (!this.state.isCreated) {
  35187. this.state.isCreated = true;
  35188. this.options.onCreate(data);
  35189. } else {
  35190. this.options.onUpdate(data);
  35191. }
  35192. }
  35193. /**
  35194. * Helper used to know if the given modifier is enabled.
  35195. * @method
  35196. * @memberof Popper.Utils
  35197. * @returns {Boolean}
  35198. */
  35199. function isModifierEnabled(modifiers, modifierName) {
  35200. return modifiers.some(function (_ref) {
  35201. var name = _ref.name,
  35202. enabled = _ref.enabled;
  35203. return enabled && name === modifierName;
  35204. });
  35205. }
  35206. /**
  35207. * Get the prefixed supported property name
  35208. * @method
  35209. * @memberof Popper.Utils
  35210. * @argument {String} property (camelCase)
  35211. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  35212. */
  35213. function getSupportedPropertyName(property) {
  35214. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  35215. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  35216. for (var i = 0; i < prefixes.length; i++) {
  35217. var prefix = prefixes[i];
  35218. var toCheck = prefix ? '' + prefix + upperProp : property;
  35219. if (typeof document.body.style[toCheck] !== 'undefined') {
  35220. return toCheck;
  35221. }
  35222. }
  35223. return null;
  35224. }
  35225. /**
  35226. * Destroys the popper.
  35227. * @method
  35228. * @memberof Popper
  35229. */
  35230. function destroy() {
  35231. this.state.isDestroyed = true;
  35232. // touch DOM only if `applyStyle` modifier is enabled
  35233. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  35234. this.popper.removeAttribute('x-placement');
  35235. this.popper.style.position = '';
  35236. this.popper.style.top = '';
  35237. this.popper.style.left = '';
  35238. this.popper.style.right = '';
  35239. this.popper.style.bottom = '';
  35240. this.popper.style.willChange = '';
  35241. this.popper.style[getSupportedPropertyName('transform')] = '';
  35242. }
  35243. this.disableEventListeners();
  35244. // remove the popper if user explicitly asked for the deletion on destroy
  35245. // do not use `remove` because IE11 doesn't support it
  35246. if (this.options.removeOnDestroy) {
  35247. this.popper.parentNode.removeChild(this.popper);
  35248. }
  35249. return this;
  35250. }
  35251. /**
  35252. * Get the window associated with the element
  35253. * @argument {Element} element
  35254. * @returns {Window}
  35255. */
  35256. function getWindow(element) {
  35257. var ownerDocument = element.ownerDocument;
  35258. return ownerDocument ? ownerDocument.defaultView : window;
  35259. }
  35260. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  35261. var isBody = scrollParent.nodeName === 'BODY';
  35262. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  35263. target.addEventListener(event, callback, { passive: true });
  35264. if (!isBody) {
  35265. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  35266. }
  35267. scrollParents.push(target);
  35268. }
  35269. /**
  35270. * Setup needed event listeners used to update the popper position
  35271. * @method
  35272. * @memberof Popper.Utils
  35273. * @private
  35274. */
  35275. function setupEventListeners(reference, options, state, updateBound) {
  35276. // Resize event listener on window
  35277. state.updateBound = updateBound;
  35278. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  35279. // Scroll event listener on scroll parents
  35280. var scrollElement = getScrollParent(reference);
  35281. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  35282. state.scrollElement = scrollElement;
  35283. state.eventsEnabled = true;
  35284. return state;
  35285. }
  35286. /**
  35287. * It will add resize/scroll events and start recalculating
  35288. * position of the popper element when they are triggered.
  35289. * @method
  35290. * @memberof Popper
  35291. */
  35292. function enableEventListeners() {
  35293. if (!this.state.eventsEnabled) {
  35294. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  35295. }
  35296. }
  35297. /**
  35298. * Remove event listeners used to update the popper position
  35299. * @method
  35300. * @memberof Popper.Utils
  35301. * @private
  35302. */
  35303. function removeEventListeners(reference, state) {
  35304. // Remove resize event listener on window
  35305. getWindow(reference).removeEventListener('resize', state.updateBound);
  35306. // Remove scroll event listener on scroll parents
  35307. state.scrollParents.forEach(function (target) {
  35308. target.removeEventListener('scroll', state.updateBound);
  35309. });
  35310. // Reset state
  35311. state.updateBound = null;
  35312. state.scrollParents = [];
  35313. state.scrollElement = null;
  35314. state.eventsEnabled = false;
  35315. return state;
  35316. }
  35317. /**
  35318. * It will remove resize/scroll events and won't recalculate popper position
  35319. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  35320. * unless you call `update` method manually.
  35321. * @method
  35322. * @memberof Popper
  35323. */
  35324. function disableEventListeners() {
  35325. if (this.state.eventsEnabled) {
  35326. cancelAnimationFrame(this.scheduleUpdate);
  35327. this.state = removeEventListeners(this.reference, this.state);
  35328. }
  35329. }
  35330. /**
  35331. * Tells if a given input is a number
  35332. * @method
  35333. * @memberof Popper.Utils
  35334. * @param {*} input to check
  35335. * @return {Boolean}
  35336. */
  35337. function isNumeric(n) {
  35338. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  35339. }
  35340. /**
  35341. * Set the style to the given popper
  35342. * @method
  35343. * @memberof Popper.Utils
  35344. * @argument {Element} element - Element to apply the style to
  35345. * @argument {Object} styles
  35346. * Object with a list of properties and values which will be applied to the element
  35347. */
  35348. function setStyles(element, styles) {
  35349. Object.keys(styles).forEach(function (prop) {
  35350. var unit = '';
  35351. // add unit if the value is numeric and is one of the following
  35352. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  35353. unit = 'px';
  35354. }
  35355. element.style[prop] = styles[prop] + unit;
  35356. });
  35357. }
  35358. /**
  35359. * Set the attributes to the given popper
  35360. * @method
  35361. * @memberof Popper.Utils
  35362. * @argument {Element} element - Element to apply the attributes to
  35363. * @argument {Object} styles
  35364. * Object with a list of properties and values which will be applied to the element
  35365. */
  35366. function setAttributes(element, attributes) {
  35367. Object.keys(attributes).forEach(function (prop) {
  35368. var value = attributes[prop];
  35369. if (value !== false) {
  35370. element.setAttribute(prop, attributes[prop]);
  35371. } else {
  35372. element.removeAttribute(prop);
  35373. }
  35374. });
  35375. }
  35376. /**
  35377. * @function
  35378. * @memberof Modifiers
  35379. * @argument {Object} data - The data object generated by `update` method
  35380. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  35381. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  35382. * @argument {Object} options - Modifiers configuration and options
  35383. * @returns {Object} The same data object
  35384. */
  35385. function applyStyle(data) {
  35386. // any property present in `data.styles` will be applied to the popper,
  35387. // in this way we can make the 3rd party modifiers add custom styles to it
  35388. // Be aware, modifiers could override the properties defined in the previous
  35389. // lines of this modifier!
  35390. setStyles(data.instance.popper, data.styles);
  35391. // any property present in `data.attributes` will be applied to the popper,
  35392. // they will be set as HTML attributes of the element
  35393. setAttributes(data.instance.popper, data.attributes);
  35394. // if arrowElement is defined and arrowStyles has some properties
  35395. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  35396. setStyles(data.arrowElement, data.arrowStyles);
  35397. }
  35398. return data;
  35399. }
  35400. /**
  35401. * Set the x-placement attribute before everything else because it could be used
  35402. * to add margins to the popper margins needs to be calculated to get the
  35403. * correct popper offsets.
  35404. * @method
  35405. * @memberof Popper.modifiers
  35406. * @param {HTMLElement} reference - The reference element used to position the popper
  35407. * @param {HTMLElement} popper - The HTML element used as popper
  35408. * @param {Object} options - Popper.js options
  35409. */
  35410. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  35411. // compute reference element offsets
  35412. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  35413. // compute auto placement, store placement inside the data object,
  35414. // modifiers will be able to edit `placement` if needed
  35415. // and refer to originalPlacement to know the original value
  35416. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  35417. popper.setAttribute('x-placement', placement);
  35418. // Apply `position` to popper before anything else because
  35419. // without the position applied we can't guarantee correct computations
  35420. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  35421. return options;
  35422. }
  35423. /**
  35424. * @function
  35425. * @memberof Popper.Utils
  35426. * @argument {Object} data - The data object generated by `update` method
  35427. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  35428. * @returns {Object} The popper's position offsets rounded
  35429. *
  35430. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  35431. * good as it can be within reason.
  35432. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  35433. *
  35434. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  35435. * as well on High DPI screens).
  35436. *
  35437. * Firefox prefers no rounding for positioning and does not have blurriness on
  35438. * high DPI screens.
  35439. *
  35440. * Only horizontal placement and left/right values need to be considered.
  35441. */
  35442. function getRoundedOffsets(data, shouldRound) {
  35443. var _data$offsets = data.offsets,
  35444. popper = _data$offsets.popper,
  35445. reference = _data$offsets.reference;
  35446. var round = Math.round,
  35447. floor = Math.floor;
  35448. var noRound = function noRound(v) {
  35449. return v;
  35450. };
  35451. var referenceWidth = round(reference.width);
  35452. var popperWidth = round(popper.width);
  35453. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  35454. var isVariation = data.placement.indexOf('-') !== -1;
  35455. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  35456. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  35457. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  35458. var verticalToInteger = !shouldRound ? noRound : round;
  35459. return {
  35460. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  35461. top: verticalToInteger(popper.top),
  35462. bottom: verticalToInteger(popper.bottom),
  35463. right: horizontalToInteger(popper.right)
  35464. };
  35465. }
  35466. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  35467. /**
  35468. * @function
  35469. * @memberof Modifiers
  35470. * @argument {Object} data - The data object generated by `update` method
  35471. * @argument {Object} options - Modifiers configuration and options
  35472. * @returns {Object} The data object, properly modified
  35473. */
  35474. function computeStyle(data, options) {
  35475. var x = options.x,
  35476. y = options.y;
  35477. var popper = data.offsets.popper;
  35478. // Remove this legacy support in Popper.js v2
  35479. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  35480. return modifier.name === 'applyStyle';
  35481. }).gpuAcceleration;
  35482. if (legacyGpuAccelerationOption !== undefined) {
  35483. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  35484. }
  35485. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  35486. var offsetParent = getOffsetParent(data.instance.popper);
  35487. var offsetParentRect = getBoundingClientRect(offsetParent);
  35488. // Styles
  35489. var styles = {
  35490. position: popper.position
  35491. };
  35492. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  35493. var sideA = x === 'bottom' ? 'top' : 'bottom';
  35494. var sideB = y === 'right' ? 'left' : 'right';
  35495. // if gpuAcceleration is set to `true` and transform is supported,
  35496. // we use `translate3d` to apply the position to the popper we
  35497. // automatically use the supported prefixed version if needed
  35498. var prefixedProperty = getSupportedPropertyName('transform');
  35499. // now, let's make a step back and look at this code closely (wtf?)
  35500. // If the content of the popper grows once it's been positioned, it
  35501. // may happen that the popper gets misplaced because of the new content
  35502. // overflowing its reference element
  35503. // To avoid this problem, we provide two options (x and y), which allow
  35504. // the consumer to define the offset origin.
  35505. // If we position a popper on top of a reference element, we can set
  35506. // `x` to `top` to make the popper grow towards its top instead of
  35507. // its bottom.
  35508. var left = void 0,
  35509. top = void 0;
  35510. if (sideA === 'bottom') {
  35511. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  35512. // and not the bottom of the html element
  35513. if (offsetParent.nodeName === 'HTML') {
  35514. top = -offsetParent.clientHeight + offsets.bottom;
  35515. } else {
  35516. top = -offsetParentRect.height + offsets.bottom;
  35517. }
  35518. } else {
  35519. top = offsets.top;
  35520. }
  35521. if (sideB === 'right') {
  35522. if (offsetParent.nodeName === 'HTML') {
  35523. left = -offsetParent.clientWidth + offsets.right;
  35524. } else {
  35525. left = -offsetParentRect.width + offsets.right;
  35526. }
  35527. } else {
  35528. left = offsets.left;
  35529. }
  35530. if (gpuAcceleration && prefixedProperty) {
  35531. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  35532. styles[sideA] = 0;
  35533. styles[sideB] = 0;
  35534. styles.willChange = 'transform';
  35535. } else {
  35536. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  35537. var invertTop = sideA === 'bottom' ? -1 : 1;
  35538. var invertLeft = sideB === 'right' ? -1 : 1;
  35539. styles[sideA] = top * invertTop;
  35540. styles[sideB] = left * invertLeft;
  35541. styles.willChange = sideA + ', ' + sideB;
  35542. }
  35543. // Attributes
  35544. var attributes = {
  35545. 'x-placement': data.placement
  35546. };
  35547. // Update `data` attributes, styles and arrowStyles
  35548. data.attributes = _extends({}, attributes, data.attributes);
  35549. data.styles = _extends({}, styles, data.styles);
  35550. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  35551. return data;
  35552. }
  35553. /**
  35554. * Helper used to know if the given modifier depends from another one.<br />
  35555. * It checks if the needed modifier is listed and enabled.
  35556. * @method
  35557. * @memberof Popper.Utils
  35558. * @param {Array} modifiers - list of modifiers
  35559. * @param {String} requestingName - name of requesting modifier
  35560. * @param {String} requestedName - name of requested modifier
  35561. * @returns {Boolean}
  35562. */
  35563. function isModifierRequired(modifiers, requestingName, requestedName) {
  35564. var requesting = find(modifiers, function (_ref) {
  35565. var name = _ref.name;
  35566. return name === requestingName;
  35567. });
  35568. var isRequired = !!requesting && modifiers.some(function (modifier) {
  35569. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  35570. });
  35571. if (!isRequired) {
  35572. var _requesting = '`' + requestingName + '`';
  35573. var requested = '`' + requestedName + '`';
  35574. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  35575. }
  35576. return isRequired;
  35577. }
  35578. /**
  35579. * @function
  35580. * @memberof Modifiers
  35581. * @argument {Object} data - The data object generated by update method
  35582. * @argument {Object} options - Modifiers configuration and options
  35583. * @returns {Object} The data object, properly modified
  35584. */
  35585. function arrow(data, options) {
  35586. var _data$offsets$arrow;
  35587. // arrow depends on keepTogether in order to work
  35588. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  35589. return data;
  35590. }
  35591. var arrowElement = options.element;
  35592. // if arrowElement is a string, suppose it's a CSS selector
  35593. if (typeof arrowElement === 'string') {
  35594. arrowElement = data.instance.popper.querySelector(arrowElement);
  35595. // if arrowElement is not found, don't run the modifier
  35596. if (!arrowElement) {
  35597. return data;
  35598. }
  35599. } else {
  35600. // if the arrowElement isn't a query selector we must check that the
  35601. // provided DOM node is child of its popper node
  35602. if (!data.instance.popper.contains(arrowElement)) {
  35603. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  35604. return data;
  35605. }
  35606. }
  35607. var placement = data.placement.split('-')[0];
  35608. var _data$offsets = data.offsets,
  35609. popper = _data$offsets.popper,
  35610. reference = _data$offsets.reference;
  35611. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  35612. var len = isVertical ? 'height' : 'width';
  35613. var sideCapitalized = isVertical ? 'Top' : 'Left';
  35614. var side = sideCapitalized.toLowerCase();
  35615. var altSide = isVertical ? 'left' : 'top';
  35616. var opSide = isVertical ? 'bottom' : 'right';
  35617. var arrowElementSize = getOuterSizes(arrowElement)[len];
  35618. //
  35619. // extends keepTogether behavior making sure the popper and its
  35620. // reference have enough pixels in conjunction
  35621. //
  35622. // top/left side
  35623. if (reference[opSide] - arrowElementSize < popper[side]) {
  35624. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  35625. }
  35626. // bottom/right side
  35627. if (reference[side] + arrowElementSize > popper[opSide]) {
  35628. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  35629. }
  35630. data.offsets.popper = getClientRect(data.offsets.popper);
  35631. // compute center of the popper
  35632. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  35633. // Compute the sideValue using the updated popper offsets
  35634. // take popper margin in account because we don't have this info available
  35635. var css = getStyleComputedProperty(data.instance.popper);
  35636. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  35637. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  35638. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  35639. // prevent arrowElement from being placed not contiguously to its popper
  35640. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  35641. data.arrowElement = arrowElement;
  35642. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  35643. return data;
  35644. }
  35645. /**
  35646. * Get the opposite placement variation of the given one
  35647. * @method
  35648. * @memberof Popper.Utils
  35649. * @argument {String} placement variation
  35650. * @returns {String} flipped placement variation
  35651. */
  35652. function getOppositeVariation(variation) {
  35653. if (variation === 'end') {
  35654. return 'start';
  35655. } else if (variation === 'start') {
  35656. return 'end';
  35657. }
  35658. return variation;
  35659. }
  35660. /**
  35661. * List of accepted placements to use as values of the `placement` option.<br />
  35662. * Valid placements are:
  35663. * - `auto`
  35664. * - `top`
  35665. * - `right`
  35666. * - `bottom`
  35667. * - `left`
  35668. *
  35669. * Each placement can have a variation from this list:
  35670. * - `-start`
  35671. * - `-end`
  35672. *
  35673. * Variations are interpreted easily if you think of them as the left to right
  35674. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  35675. * is right.<br />
  35676. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  35677. *
  35678. * Some valid examples are:
  35679. * - `top-end` (on top of reference, right aligned)
  35680. * - `right-start` (on right of reference, top aligned)
  35681. * - `bottom` (on bottom, centered)
  35682. * - `auto-end` (on the side with more space available, alignment depends by placement)
  35683. *
  35684. * @static
  35685. * @type {Array}
  35686. * @enum {String}
  35687. * @readonly
  35688. * @method placements
  35689. * @memberof Popper
  35690. */
  35691. 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'];
  35692. // Get rid of `auto` `auto-start` and `auto-end`
  35693. var validPlacements = placements.slice(3);
  35694. /**
  35695. * Given an initial placement, returns all the subsequent placements
  35696. * clockwise (or counter-clockwise).
  35697. *
  35698. * @method
  35699. * @memberof Popper.Utils
  35700. * @argument {String} placement - A valid placement (it accepts variations)
  35701. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  35702. * @returns {Array} placements including their variations
  35703. */
  35704. function clockwise(placement) {
  35705. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35706. var index = validPlacements.indexOf(placement);
  35707. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  35708. return counter ? arr.reverse() : arr;
  35709. }
  35710. var BEHAVIORS = {
  35711. FLIP: 'flip',
  35712. CLOCKWISE: 'clockwise',
  35713. COUNTERCLOCKWISE: 'counterclockwise'
  35714. };
  35715. /**
  35716. * @function
  35717. * @memberof Modifiers
  35718. * @argument {Object} data - The data object generated by update method
  35719. * @argument {Object} options - Modifiers configuration and options
  35720. * @returns {Object} The data object, properly modified
  35721. */
  35722. function flip(data, options) {
  35723. // if `inner` modifier is enabled, we can't use the `flip` modifier
  35724. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  35725. return data;
  35726. }
  35727. if (data.flipped && data.placement === data.originalPlacement) {
  35728. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  35729. return data;
  35730. }
  35731. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  35732. var placement = data.placement.split('-')[0];
  35733. var placementOpposite = getOppositePlacement(placement);
  35734. var variation = data.placement.split('-')[1] || '';
  35735. var flipOrder = [];
  35736. switch (options.behavior) {
  35737. case BEHAVIORS.FLIP:
  35738. flipOrder = [placement, placementOpposite];
  35739. break;
  35740. case BEHAVIORS.CLOCKWISE:
  35741. flipOrder = clockwise(placement);
  35742. break;
  35743. case BEHAVIORS.COUNTERCLOCKWISE:
  35744. flipOrder = clockwise(placement, true);
  35745. break;
  35746. default:
  35747. flipOrder = options.behavior;
  35748. }
  35749. flipOrder.forEach(function (step, index) {
  35750. if (placement !== step || flipOrder.length === index + 1) {
  35751. return data;
  35752. }
  35753. placement = data.placement.split('-')[0];
  35754. placementOpposite = getOppositePlacement(placement);
  35755. var popperOffsets = data.offsets.popper;
  35756. var refOffsets = data.offsets.reference;
  35757. // using floor because the reference offsets may contain decimals we are not going to consider here
  35758. var floor = Math.floor;
  35759. 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);
  35760. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  35761. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  35762. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  35763. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  35764. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  35765. // flip the variation if required
  35766. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35767. // flips variation if reference element overflows boundaries
  35768. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  35769. // flips variation if popper content overflows boundaries
  35770. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  35771. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  35772. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  35773. // this boolean to detect any flip loop
  35774. data.flipped = true;
  35775. if (overlapsRef || overflowsBoundaries) {
  35776. placement = flipOrder[index + 1];
  35777. }
  35778. if (flippedVariation) {
  35779. variation = getOppositeVariation(variation);
  35780. }
  35781. data.placement = placement + (variation ? '-' + variation : '');
  35782. // this object contains `position`, we want to preserve it along with
  35783. // any additional property we may add in the future
  35784. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  35785. data = runModifiers(data.instance.modifiers, data, 'flip');
  35786. }
  35787. });
  35788. return data;
  35789. }
  35790. /**
  35791. * @function
  35792. * @memberof Modifiers
  35793. * @argument {Object} data - The data object generated by update method
  35794. * @argument {Object} options - Modifiers configuration and options
  35795. * @returns {Object} The data object, properly modified
  35796. */
  35797. function keepTogether(data) {
  35798. var _data$offsets = data.offsets,
  35799. popper = _data$offsets.popper,
  35800. reference = _data$offsets.reference;
  35801. var placement = data.placement.split('-')[0];
  35802. var floor = Math.floor;
  35803. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35804. var side = isVertical ? 'right' : 'bottom';
  35805. var opSide = isVertical ? 'left' : 'top';
  35806. var measurement = isVertical ? 'width' : 'height';
  35807. if (popper[side] < floor(reference[opSide])) {
  35808. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  35809. }
  35810. if (popper[opSide] > floor(reference[side])) {
  35811. data.offsets.popper[opSide] = floor(reference[side]);
  35812. }
  35813. return data;
  35814. }
  35815. /**
  35816. * Converts a string containing value + unit into a px value number
  35817. * @function
  35818. * @memberof {modifiers~offset}
  35819. * @private
  35820. * @argument {String} str - Value + unit string
  35821. * @argument {String} measurement - `height` or `width`
  35822. * @argument {Object} popperOffsets
  35823. * @argument {Object} referenceOffsets
  35824. * @returns {Number|String}
  35825. * Value in pixels, or original string if no values were extracted
  35826. */
  35827. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  35828. // separate value from unit
  35829. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  35830. var value = +split[1];
  35831. var unit = split[2];
  35832. // If it's not a number it's an operator, I guess
  35833. if (!value) {
  35834. return str;
  35835. }
  35836. if (unit.indexOf('%') === 0) {
  35837. var element = void 0;
  35838. switch (unit) {
  35839. case '%p':
  35840. element = popperOffsets;
  35841. break;
  35842. case '%':
  35843. case '%r':
  35844. default:
  35845. element = referenceOffsets;
  35846. }
  35847. var rect = getClientRect(element);
  35848. return rect[measurement] / 100 * value;
  35849. } else if (unit === 'vh' || unit === 'vw') {
  35850. // if is a vh or vw, we calculate the size based on the viewport
  35851. var size = void 0;
  35852. if (unit === 'vh') {
  35853. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  35854. } else {
  35855. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  35856. }
  35857. return size / 100 * value;
  35858. } else {
  35859. // if is an explicit pixel unit, we get rid of the unit and keep the value
  35860. // if is an implicit unit, it's px, and we return just the value
  35861. return value;
  35862. }
  35863. }
  35864. /**
  35865. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  35866. * @function
  35867. * @memberof {modifiers~offset}
  35868. * @private
  35869. * @argument {String} offset
  35870. * @argument {Object} popperOffsets
  35871. * @argument {Object} referenceOffsets
  35872. * @argument {String} basePlacement
  35873. * @returns {Array} a two cells array with x and y offsets in numbers
  35874. */
  35875. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  35876. var offsets = [0, 0];
  35877. // Use height if placement is left or right and index is 0 otherwise use width
  35878. // in this way the first offset will use an axis and the second one
  35879. // will use the other one
  35880. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  35881. // Split the offset string to obtain a list of values and operands
  35882. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  35883. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  35884. return frag.trim();
  35885. });
  35886. // Detect if the offset string contains a pair of values or a single one
  35887. // they could be separated by comma or space
  35888. var divider = fragments.indexOf(find(fragments, function (frag) {
  35889. return frag.search(/,|\s/) !== -1;
  35890. }));
  35891. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  35892. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  35893. }
  35894. // If divider is found, we divide the list of values and operands to divide
  35895. // them by ofset X and Y.
  35896. var splitRegex = /\s*,\s*|\s+/;
  35897. 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];
  35898. // Convert the values with units to absolute pixels to allow our computations
  35899. ops = ops.map(function (op, index) {
  35900. // Most of the units rely on the orientation of the popper
  35901. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  35902. var mergeWithPrevious = false;
  35903. return op
  35904. // This aggregates any `+` or `-` sign that aren't considered operators
  35905. // e.g.: 10 + +5 => [10, +, +5]
  35906. .reduce(function (a, b) {
  35907. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  35908. a[a.length - 1] = b;
  35909. mergeWithPrevious = true;
  35910. return a;
  35911. } else if (mergeWithPrevious) {
  35912. a[a.length - 1] += b;
  35913. mergeWithPrevious = false;
  35914. return a;
  35915. } else {
  35916. return a.concat(b);
  35917. }
  35918. }, [])
  35919. // Here we convert the string values into number values (in px)
  35920. .map(function (str) {
  35921. return toValue(str, measurement, popperOffsets, referenceOffsets);
  35922. });
  35923. });
  35924. // Loop trough the offsets arrays and execute the operations
  35925. ops.forEach(function (op, index) {
  35926. op.forEach(function (frag, index2) {
  35927. if (isNumeric(frag)) {
  35928. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  35929. }
  35930. });
  35931. });
  35932. return offsets;
  35933. }
  35934. /**
  35935. * @function
  35936. * @memberof Modifiers
  35937. * @argument {Object} data - The data object generated by update method
  35938. * @argument {Object} options - Modifiers configuration and options
  35939. * @argument {Number|String} options.offset=0
  35940. * The offset value as described in the modifier description
  35941. * @returns {Object} The data object, properly modified
  35942. */
  35943. function offset(data, _ref) {
  35944. var offset = _ref.offset;
  35945. var placement = data.placement,
  35946. _data$offsets = data.offsets,
  35947. popper = _data$offsets.popper,
  35948. reference = _data$offsets.reference;
  35949. var basePlacement = placement.split('-')[0];
  35950. var offsets = void 0;
  35951. if (isNumeric(+offset)) {
  35952. offsets = [+offset, 0];
  35953. } else {
  35954. offsets = parseOffset(offset, popper, reference, basePlacement);
  35955. }
  35956. if (basePlacement === 'left') {
  35957. popper.top += offsets[0];
  35958. popper.left -= offsets[1];
  35959. } else if (basePlacement === 'right') {
  35960. popper.top += offsets[0];
  35961. popper.left += offsets[1];
  35962. } else if (basePlacement === 'top') {
  35963. popper.left += offsets[0];
  35964. popper.top -= offsets[1];
  35965. } else if (basePlacement === 'bottom') {
  35966. popper.left += offsets[0];
  35967. popper.top += offsets[1];
  35968. }
  35969. data.popper = popper;
  35970. return data;
  35971. }
  35972. /**
  35973. * @function
  35974. * @memberof Modifiers
  35975. * @argument {Object} data - The data object generated by `update` method
  35976. * @argument {Object} options - Modifiers configuration and options
  35977. * @returns {Object} The data object, properly modified
  35978. */
  35979. function preventOverflow(data, options) {
  35980. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  35981. // If offsetParent is the reference element, we really want to
  35982. // go one step up and use the next offsetParent as reference to
  35983. // avoid to make this modifier completely useless and look like broken
  35984. if (data.instance.reference === boundariesElement) {
  35985. boundariesElement = getOffsetParent(boundariesElement);
  35986. }
  35987. // NOTE: DOM access here
  35988. // resets the popper's position so that the document size can be calculated excluding
  35989. // the size of the popper element itself
  35990. var transformProp = getSupportedPropertyName('transform');
  35991. var popperStyles = data.instance.popper.style; // assignment to help minification
  35992. var top = popperStyles.top,
  35993. left = popperStyles.left,
  35994. transform = popperStyles[transformProp];
  35995. popperStyles.top = '';
  35996. popperStyles.left = '';
  35997. popperStyles[transformProp] = '';
  35998. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  35999. // NOTE: DOM access here
  36000. // restores the original style properties after the offsets have been computed
  36001. popperStyles.top = top;
  36002. popperStyles.left = left;
  36003. popperStyles[transformProp] = transform;
  36004. options.boundaries = boundaries;
  36005. var order = options.priority;
  36006. var popper = data.offsets.popper;
  36007. var check = {
  36008. primary: function primary(placement) {
  36009. var value = popper[placement];
  36010. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  36011. value = Math.max(popper[placement], boundaries[placement]);
  36012. }
  36013. return defineProperty({}, placement, value);
  36014. },
  36015. secondary: function secondary(placement) {
  36016. var mainSide = placement === 'right' ? 'left' : 'top';
  36017. var value = popper[mainSide];
  36018. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  36019. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  36020. }
  36021. return defineProperty({}, mainSide, value);
  36022. }
  36023. };
  36024. order.forEach(function (placement) {
  36025. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  36026. popper = _extends({}, popper, check[side](placement));
  36027. });
  36028. data.offsets.popper = popper;
  36029. return data;
  36030. }
  36031. /**
  36032. * @function
  36033. * @memberof Modifiers
  36034. * @argument {Object} data - The data object generated by `update` method
  36035. * @argument {Object} options - Modifiers configuration and options
  36036. * @returns {Object} The data object, properly modified
  36037. */
  36038. function shift(data) {
  36039. var placement = data.placement;
  36040. var basePlacement = placement.split('-')[0];
  36041. var shiftvariation = placement.split('-')[1];
  36042. // if shift shiftvariation is specified, run the modifier
  36043. if (shiftvariation) {
  36044. var _data$offsets = data.offsets,
  36045. reference = _data$offsets.reference,
  36046. popper = _data$offsets.popper;
  36047. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  36048. var side = isVertical ? 'left' : 'top';
  36049. var measurement = isVertical ? 'width' : 'height';
  36050. var shiftOffsets = {
  36051. start: defineProperty({}, side, reference[side]),
  36052. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  36053. };
  36054. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  36055. }
  36056. return data;
  36057. }
  36058. /**
  36059. * @function
  36060. * @memberof Modifiers
  36061. * @argument {Object} data - The data object generated by update method
  36062. * @argument {Object} options - Modifiers configuration and options
  36063. * @returns {Object} The data object, properly modified
  36064. */
  36065. function hide(data) {
  36066. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  36067. return data;
  36068. }
  36069. var refRect = data.offsets.reference;
  36070. var bound = find(data.instance.modifiers, function (modifier) {
  36071. return modifier.name === 'preventOverflow';
  36072. }).boundaries;
  36073. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  36074. // Avoid unnecessary DOM access if visibility hasn't changed
  36075. if (data.hide === true) {
  36076. return data;
  36077. }
  36078. data.hide = true;
  36079. data.attributes['x-out-of-boundaries'] = '';
  36080. } else {
  36081. // Avoid unnecessary DOM access if visibility hasn't changed
  36082. if (data.hide === false) {
  36083. return data;
  36084. }
  36085. data.hide = false;
  36086. data.attributes['x-out-of-boundaries'] = false;
  36087. }
  36088. return data;
  36089. }
  36090. /**
  36091. * @function
  36092. * @memberof Modifiers
  36093. * @argument {Object} data - The data object generated by `update` method
  36094. * @argument {Object} options - Modifiers configuration and options
  36095. * @returns {Object} The data object, properly modified
  36096. */
  36097. function inner(data) {
  36098. var placement = data.placement;
  36099. var basePlacement = placement.split('-')[0];
  36100. var _data$offsets = data.offsets,
  36101. popper = _data$offsets.popper,
  36102. reference = _data$offsets.reference;
  36103. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  36104. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  36105. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  36106. data.placement = getOppositePlacement(placement);
  36107. data.offsets.popper = getClientRect(popper);
  36108. return data;
  36109. }
  36110. /**
  36111. * Modifier function, each modifier can have a function of this type assigned
  36112. * to its `fn` property.<br />
  36113. * These functions will be called on each update, this means that you must
  36114. * make sure they are performant enough to avoid performance bottlenecks.
  36115. *
  36116. * @function ModifierFn
  36117. * @argument {dataObject} data - The data object generated by `update` method
  36118. * @argument {Object} options - Modifiers configuration and options
  36119. * @returns {dataObject} The data object, properly modified
  36120. */
  36121. /**
  36122. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  36123. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  36124. * needed by the library.
  36125. *
  36126. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  36127. * All the other properties are configurations that could be tweaked.
  36128. * @namespace modifiers
  36129. */
  36130. var modifiers = {
  36131. /**
  36132. * Modifier used to shift the popper on the start or end of its reference
  36133. * element.<br />
  36134. * It will read the variation of the `placement` property.<br />
  36135. * It can be one either `-end` or `-start`.
  36136. * @memberof modifiers
  36137. * @inner
  36138. */
  36139. shift: {
  36140. /** @prop {number} order=100 - Index used to define the order of execution */
  36141. order: 100,
  36142. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36143. enabled: true,
  36144. /** @prop {ModifierFn} */
  36145. fn: shift
  36146. },
  36147. /**
  36148. * The `offset` modifier can shift your popper on both its axis.
  36149. *
  36150. * It accepts the following units:
  36151. * - `px` or unit-less, interpreted as pixels
  36152. * - `%` or `%r`, percentage relative to the length of the reference element
  36153. * - `%p`, percentage relative to the length of the popper element
  36154. * - `vw`, CSS viewport width unit
  36155. * - `vh`, CSS viewport height unit
  36156. *
  36157. * For length is intended the main axis relative to the placement of the popper.<br />
  36158. * This means that if the placement is `top` or `bottom`, the length will be the
  36159. * `width`. In case of `left` or `right`, it will be the `height`.
  36160. *
  36161. * You can provide a single value (as `Number` or `String`), or a pair of values
  36162. * as `String` divided by a comma or one (or more) white spaces.<br />
  36163. * The latter is a deprecated method because it leads to confusion and will be
  36164. * removed in v2.<br />
  36165. * Additionally, it accepts additions and subtractions between different units.
  36166. * Note that multiplications and divisions aren't supported.
  36167. *
  36168. * Valid examples are:
  36169. * ```
  36170. * 10
  36171. * '10%'
  36172. * '10, 10'
  36173. * '10%, 10'
  36174. * '10 + 10%'
  36175. * '10 - 5vh + 3%'
  36176. * '-10px + 5vh, 5px - 6%'
  36177. * ```
  36178. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  36179. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  36180. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  36181. *
  36182. * @memberof modifiers
  36183. * @inner
  36184. */
  36185. offset: {
  36186. /** @prop {number} order=200 - Index used to define the order of execution */
  36187. order: 200,
  36188. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36189. enabled: true,
  36190. /** @prop {ModifierFn} */
  36191. fn: offset,
  36192. /** @prop {Number|String} offset=0
  36193. * The offset value as described in the modifier description
  36194. */
  36195. offset: 0
  36196. },
  36197. /**
  36198. * Modifier used to prevent the popper from being positioned outside the boundary.
  36199. *
  36200. * A scenario exists where the reference itself is not within the boundaries.<br />
  36201. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  36202. * In this case we need to decide whether the popper should either:
  36203. *
  36204. * - detach from the reference and remain "trapped" in the boundaries, or
  36205. * - if it should ignore the boundary and "escape with its reference"
  36206. *
  36207. * When `escapeWithReference` is set to`true` and reference is completely
  36208. * outside its boundaries, the popper will overflow (or completely leave)
  36209. * the boundaries in order to remain attached to the edge of the reference.
  36210. *
  36211. * @memberof modifiers
  36212. * @inner
  36213. */
  36214. preventOverflow: {
  36215. /** @prop {number} order=300 - Index used to define the order of execution */
  36216. order: 300,
  36217. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36218. enabled: true,
  36219. /** @prop {ModifierFn} */
  36220. fn: preventOverflow,
  36221. /**
  36222. * @prop {Array} [priority=['left','right','top','bottom']]
  36223. * Popper will try to prevent overflow following these priorities by default,
  36224. * then, it could overflow on the left and on top of the `boundariesElement`
  36225. */
  36226. priority: ['left', 'right', 'top', 'bottom'],
  36227. /**
  36228. * @prop {number} padding=5
  36229. * Amount of pixel used to define a minimum distance between the boundaries
  36230. * and the popper. This makes sure the popper always has a little padding
  36231. * between the edges of its container
  36232. */
  36233. padding: 5,
  36234. /**
  36235. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  36236. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  36237. * `viewport` or any DOM element.
  36238. */
  36239. boundariesElement: 'scrollParent'
  36240. },
  36241. /**
  36242. * Modifier used to make sure the reference and its popper stay near each other
  36243. * without leaving any gap between the two. Especially useful when the arrow is
  36244. * enabled and you want to ensure that it points to its reference element.
  36245. * It cares only about the first axis. You can still have poppers with margin
  36246. * between the popper and its reference element.
  36247. * @memberof modifiers
  36248. * @inner
  36249. */
  36250. keepTogether: {
  36251. /** @prop {number} order=400 - Index used to define the order of execution */
  36252. order: 400,
  36253. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36254. enabled: true,
  36255. /** @prop {ModifierFn} */
  36256. fn: keepTogether
  36257. },
  36258. /**
  36259. * This modifier is used to move the `arrowElement` of the popper to make
  36260. * sure it is positioned between the reference element and its popper element.
  36261. * It will read the outer size of the `arrowElement` node to detect how many
  36262. * pixels of conjunction are needed.
  36263. *
  36264. * It has no effect if no `arrowElement` is provided.
  36265. * @memberof modifiers
  36266. * @inner
  36267. */
  36268. arrow: {
  36269. /** @prop {number} order=500 - Index used to define the order of execution */
  36270. order: 500,
  36271. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36272. enabled: true,
  36273. /** @prop {ModifierFn} */
  36274. fn: arrow,
  36275. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  36276. element: '[x-arrow]'
  36277. },
  36278. /**
  36279. * Modifier used to flip the popper's placement when it starts to overlap its
  36280. * reference element.
  36281. *
  36282. * Requires the `preventOverflow` modifier before it in order to work.
  36283. *
  36284. * **NOTE:** this modifier will interrupt the current update cycle and will
  36285. * restart it if it detects the need to flip the placement.
  36286. * @memberof modifiers
  36287. * @inner
  36288. */
  36289. flip: {
  36290. /** @prop {number} order=600 - Index used to define the order of execution */
  36291. order: 600,
  36292. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36293. enabled: true,
  36294. /** @prop {ModifierFn} */
  36295. fn: flip,
  36296. /**
  36297. * @prop {String|Array} behavior='flip'
  36298. * The behavior used to change the popper's placement. It can be one of
  36299. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  36300. * placements (with optional variations)
  36301. */
  36302. behavior: 'flip',
  36303. /**
  36304. * @prop {number} padding=5
  36305. * The popper will flip if it hits the edges of the `boundariesElement`
  36306. */
  36307. padding: 5,
  36308. /**
  36309. * @prop {String|HTMLElement} boundariesElement='viewport'
  36310. * The element which will define the boundaries of the popper position.
  36311. * The popper will never be placed outside of the defined boundaries
  36312. * (except if `keepTogether` is enabled)
  36313. */
  36314. boundariesElement: 'viewport',
  36315. /**
  36316. * @prop {Boolean} flipVariations=false
  36317. * The popper will switch placement variation between `-start` and `-end` when
  36318. * the reference element overlaps its boundaries.
  36319. *
  36320. * The original placement should have a set variation.
  36321. */
  36322. flipVariations: false,
  36323. /**
  36324. * @prop {Boolean} flipVariationsByContent=false
  36325. * The popper will switch placement variation between `-start` and `-end` when
  36326. * the popper element overlaps its reference boundaries.
  36327. *
  36328. * The original placement should have a set variation.
  36329. */
  36330. flipVariationsByContent: false
  36331. },
  36332. /**
  36333. * Modifier used to make the popper flow toward the inner of the reference element.
  36334. * By default, when this modifier is disabled, the popper will be placed outside
  36335. * the reference element.
  36336. * @memberof modifiers
  36337. * @inner
  36338. */
  36339. inner: {
  36340. /** @prop {number} order=700 - Index used to define the order of execution */
  36341. order: 700,
  36342. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  36343. enabled: false,
  36344. /** @prop {ModifierFn} */
  36345. fn: inner
  36346. },
  36347. /**
  36348. * Modifier used to hide the popper when its reference element is outside of the
  36349. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  36350. * be used to hide with a CSS selector the popper when its reference is
  36351. * out of boundaries.
  36352. *
  36353. * Requires the `preventOverflow` modifier before it in order to work.
  36354. * @memberof modifiers
  36355. * @inner
  36356. */
  36357. hide: {
  36358. /** @prop {number} order=800 - Index used to define the order of execution */
  36359. order: 800,
  36360. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36361. enabled: true,
  36362. /** @prop {ModifierFn} */
  36363. fn: hide
  36364. },
  36365. /**
  36366. * Computes the style that will be applied to the popper element to gets
  36367. * properly positioned.
  36368. *
  36369. * Note that this modifier will not touch the DOM, it just prepares the styles
  36370. * so that `applyStyle` modifier can apply it. This separation is useful
  36371. * in case you need to replace `applyStyle` with a custom implementation.
  36372. *
  36373. * This modifier has `850` as `order` value to maintain backward compatibility
  36374. * with previous versions of Popper.js. Expect the modifiers ordering method
  36375. * to change in future major versions of the library.
  36376. *
  36377. * @memberof modifiers
  36378. * @inner
  36379. */
  36380. computeStyle: {
  36381. /** @prop {number} order=850 - Index used to define the order of execution */
  36382. order: 850,
  36383. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36384. enabled: true,
  36385. /** @prop {ModifierFn} */
  36386. fn: computeStyle,
  36387. /**
  36388. * @prop {Boolean} gpuAcceleration=true
  36389. * If true, it uses the CSS 3D transformation to position the popper.
  36390. * Otherwise, it will use the `top` and `left` properties
  36391. */
  36392. gpuAcceleration: true,
  36393. /**
  36394. * @prop {string} [x='bottom']
  36395. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  36396. * Change this if your popper should grow in a direction different from `bottom`
  36397. */
  36398. x: 'bottom',
  36399. /**
  36400. * @prop {string} [x='left']
  36401. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  36402. * Change this if your popper should grow in a direction different from `right`
  36403. */
  36404. y: 'right'
  36405. },
  36406. /**
  36407. * Applies the computed styles to the popper element.
  36408. *
  36409. * All the DOM manipulations are limited to this modifier. This is useful in case
  36410. * you want to integrate Popper.js inside a framework or view library and you
  36411. * want to delegate all the DOM manipulations to it.
  36412. *
  36413. * Note that if you disable this modifier, you must make sure the popper element
  36414. * has its position set to `absolute` before Popper.js can do its work!
  36415. *
  36416. * Just disable this modifier and define your own to achieve the desired effect.
  36417. *
  36418. * @memberof modifiers
  36419. * @inner
  36420. */
  36421. applyStyle: {
  36422. /** @prop {number} order=900 - Index used to define the order of execution */
  36423. order: 900,
  36424. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36425. enabled: true,
  36426. /** @prop {ModifierFn} */
  36427. fn: applyStyle,
  36428. /** @prop {Function} */
  36429. onLoad: applyStyleOnLoad,
  36430. /**
  36431. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  36432. * @prop {Boolean} gpuAcceleration=true
  36433. * If true, it uses the CSS 3D transformation to position the popper.
  36434. * Otherwise, it will use the `top` and `left` properties
  36435. */
  36436. gpuAcceleration: undefined
  36437. }
  36438. };
  36439. /**
  36440. * The `dataObject` is an object containing all the information used by Popper.js.
  36441. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  36442. * @name dataObject
  36443. * @property {Object} data.instance The Popper.js instance
  36444. * @property {String} data.placement Placement applied to popper
  36445. * @property {String} data.originalPlacement Placement originally defined on init
  36446. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  36447. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  36448. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  36449. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36450. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36451. * @property {Object} data.boundaries Offsets of the popper boundaries
  36452. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  36453. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  36454. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  36455. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  36456. */
  36457. /**
  36458. * Default options provided to Popper.js constructor.<br />
  36459. * These can be overridden using the `options` argument of Popper.js.<br />
  36460. * To override an option, simply pass an object with the same
  36461. * structure of the `options` object, as the 3rd argument. For example:
  36462. * ```
  36463. * new Popper(ref, pop, {
  36464. * modifiers: {
  36465. * preventOverflow: { enabled: false }
  36466. * }
  36467. * })
  36468. * ```
  36469. * @type {Object}
  36470. * @static
  36471. * @memberof Popper
  36472. */
  36473. var Defaults = {
  36474. /**
  36475. * Popper's placement.
  36476. * @prop {Popper.placements} placement='bottom'
  36477. */
  36478. placement: 'bottom',
  36479. /**
  36480. * Set this to true if you want popper to position it self in 'fixed' mode
  36481. * @prop {Boolean} positionFixed=false
  36482. */
  36483. positionFixed: false,
  36484. /**
  36485. * Whether events (resize, scroll) are initially enabled.
  36486. * @prop {Boolean} eventsEnabled=true
  36487. */
  36488. eventsEnabled: true,
  36489. /**
  36490. * Set to true if you want to automatically remove the popper when
  36491. * you call the `destroy` method.
  36492. * @prop {Boolean} removeOnDestroy=false
  36493. */
  36494. removeOnDestroy: false,
  36495. /**
  36496. * Callback called when the popper is created.<br />
  36497. * By default, it is set to no-op.<br />
  36498. * Access Popper.js instance with `data.instance`.
  36499. * @prop {onCreate}
  36500. */
  36501. onCreate: function onCreate() {},
  36502. /**
  36503. * Callback called when the popper is updated. This callback is not called
  36504. * on the initialization/creation of the popper, but only on subsequent
  36505. * updates.<br />
  36506. * By default, it is set to no-op.<br />
  36507. * Access Popper.js instance with `data.instance`.
  36508. * @prop {onUpdate}
  36509. */
  36510. onUpdate: function onUpdate() {},
  36511. /**
  36512. * List of modifiers used to modify the offsets before they are applied to the popper.
  36513. * They provide most of the functionalities of Popper.js.
  36514. * @prop {modifiers}
  36515. */
  36516. modifiers: modifiers
  36517. };
  36518. /**
  36519. * @callback onCreate
  36520. * @param {dataObject} data
  36521. */
  36522. /**
  36523. * @callback onUpdate
  36524. * @param {dataObject} data
  36525. */
  36526. // Utils
  36527. // Methods
  36528. var Popper = function () {
  36529. /**
  36530. * Creates a new Popper.js instance.
  36531. * @class Popper
  36532. * @param {Element|referenceObject} reference - The reference element used to position the popper
  36533. * @param {Element} popper - The HTML / XML element used as the popper
  36534. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  36535. * @return {Object} instance - The generated Popper.js instance
  36536. */
  36537. function Popper(reference, popper) {
  36538. var _this = this;
  36539. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  36540. classCallCheck(this, Popper);
  36541. this.scheduleUpdate = function () {
  36542. return requestAnimationFrame(_this.update);
  36543. };
  36544. // make update() debounced, so that it only runs at most once-per-tick
  36545. this.update = debounce(this.update.bind(this));
  36546. // with {} we create a new object with the options inside it
  36547. this.options = _extends({}, Popper.Defaults, options);
  36548. // init state
  36549. this.state = {
  36550. isDestroyed: false,
  36551. isCreated: false,
  36552. scrollParents: []
  36553. };
  36554. // get reference and popper elements (allow jQuery wrappers)
  36555. this.reference = reference && reference.jquery ? reference[0] : reference;
  36556. this.popper = popper && popper.jquery ? popper[0] : popper;
  36557. // Deep merge modifiers options
  36558. this.options.modifiers = {};
  36559. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  36560. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  36561. });
  36562. // Refactoring modifiers' list (Object => Array)
  36563. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  36564. return _extends({
  36565. name: name
  36566. }, _this.options.modifiers[name]);
  36567. })
  36568. // sort the modifiers by order
  36569. .sort(function (a, b) {
  36570. return a.order - b.order;
  36571. });
  36572. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  36573. // such code is executed in the same order of its modifier
  36574. // they could add new properties to their options configuration
  36575. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  36576. this.modifiers.forEach(function (modifierOptions) {
  36577. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  36578. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  36579. }
  36580. });
  36581. // fire the first update to position the popper in the right place
  36582. this.update();
  36583. var eventsEnabled = this.options.eventsEnabled;
  36584. if (eventsEnabled) {
  36585. // setup event listeners, they will take care of update the position in specific situations
  36586. this.enableEventListeners();
  36587. }
  36588. this.state.eventsEnabled = eventsEnabled;
  36589. }
  36590. // We can't use class properties because they don't get listed in the
  36591. // class prototype and break stuff like Sinon stubs
  36592. createClass(Popper, [{
  36593. key: 'update',
  36594. value: function update$$1() {
  36595. return update.call(this);
  36596. }
  36597. }, {
  36598. key: 'destroy',
  36599. value: function destroy$$1() {
  36600. return destroy.call(this);
  36601. }
  36602. }, {
  36603. key: 'enableEventListeners',
  36604. value: function enableEventListeners$$1() {
  36605. return enableEventListeners.call(this);
  36606. }
  36607. }, {
  36608. key: 'disableEventListeners',
  36609. value: function disableEventListeners$$1() {
  36610. return disableEventListeners.call(this);
  36611. }
  36612. /**
  36613. * Schedules an update. It will run on the next UI update available.
  36614. * @method scheduleUpdate
  36615. * @memberof Popper
  36616. */
  36617. /**
  36618. * Collection of utilities useful when writing custom modifiers.
  36619. * Starting from version 1.7, this method is available only if you
  36620. * include `popper-utils.js` before `popper.js`.
  36621. *
  36622. * **DEPRECATION**: This way to access PopperUtils is deprecated
  36623. * and will be removed in v2! Use the PopperUtils module directly instead.
  36624. * Due to the high instability of the methods contained in Utils, we can't
  36625. * guarantee them to follow semver. Use them at your own risk!
  36626. * @static
  36627. * @private
  36628. * @type {Object}
  36629. * @deprecated since version 1.8
  36630. * @member Utils
  36631. * @memberof Popper
  36632. */
  36633. }]);
  36634. return Popper;
  36635. }();
  36636. /**
  36637. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  36638. * and lets you use it as replacement of a real DOM node.<br />
  36639. * You can use this method to position a popper relatively to a set of coordinates
  36640. * in case you don't have a DOM node to use as reference.
  36641. *
  36642. * ```
  36643. * new Popper(referenceObject, popperNode);
  36644. * ```
  36645. *
  36646. * NB: This feature isn't supported in Internet Explorer 10.
  36647. * @name referenceObject
  36648. * @property {Function} data.getBoundingClientRect
  36649. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  36650. * @property {number} data.clientWidth
  36651. * An ES6 getter that will return the width of the virtual reference element.
  36652. * @property {number} data.clientHeight
  36653. * An ES6 getter that will return the height of the virtual reference element.
  36654. */
  36655. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  36656. Popper.placements = placements;
  36657. Popper.Defaults = Defaults;
  36658. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  36659. //# sourceMappingURL=popper.js.map
  36660. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  36661. /***/ }),
  36662. /***/ "./node_modules/process/browser.js":
  36663. /*!*****************************************!*\
  36664. !*** ./node_modules/process/browser.js ***!
  36665. \*****************************************/
  36666. /*! no static exports found */
  36667. /***/ (function(module, exports) {
  36668. // shim for using process in browser
  36669. var process = module.exports = {};
  36670. // cached from whatever global is present so that test runners that stub it
  36671. // don't break things. But we need to wrap it in a try catch in case it is
  36672. // wrapped in strict mode code which doesn't define any globals. It's inside a
  36673. // function because try/catches deoptimize in certain engines.
  36674. var cachedSetTimeout;
  36675. var cachedClearTimeout;
  36676. function defaultSetTimout() {
  36677. throw new Error('setTimeout has not been defined');
  36678. }
  36679. function defaultClearTimeout () {
  36680. throw new Error('clearTimeout has not been defined');
  36681. }
  36682. (function () {
  36683. try {
  36684. if (typeof setTimeout === 'function') {
  36685. cachedSetTimeout = setTimeout;
  36686. } else {
  36687. cachedSetTimeout = defaultSetTimout;
  36688. }
  36689. } catch (e) {
  36690. cachedSetTimeout = defaultSetTimout;
  36691. }
  36692. try {
  36693. if (typeof clearTimeout === 'function') {
  36694. cachedClearTimeout = clearTimeout;
  36695. } else {
  36696. cachedClearTimeout = defaultClearTimeout;
  36697. }
  36698. } catch (e) {
  36699. cachedClearTimeout = defaultClearTimeout;
  36700. }
  36701. } ())
  36702. function runTimeout(fun) {
  36703. if (cachedSetTimeout === setTimeout) {
  36704. //normal enviroments in sane situations
  36705. return setTimeout(fun, 0);
  36706. }
  36707. // if setTimeout wasn't available but was latter defined
  36708. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  36709. cachedSetTimeout = setTimeout;
  36710. return setTimeout(fun, 0);
  36711. }
  36712. try {
  36713. // when when somebody has screwed with setTimeout but no I.E. maddness
  36714. return cachedSetTimeout(fun, 0);
  36715. } catch(e){
  36716. try {
  36717. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36718. return cachedSetTimeout.call(null, fun, 0);
  36719. } catch(e){
  36720. // 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
  36721. return cachedSetTimeout.call(this, fun, 0);
  36722. }
  36723. }
  36724. }
  36725. function runClearTimeout(marker) {
  36726. if (cachedClearTimeout === clearTimeout) {
  36727. //normal enviroments in sane situations
  36728. return clearTimeout(marker);
  36729. }
  36730. // if clearTimeout wasn't available but was latter defined
  36731. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  36732. cachedClearTimeout = clearTimeout;
  36733. return clearTimeout(marker);
  36734. }
  36735. try {
  36736. // when when somebody has screwed with setTimeout but no I.E. maddness
  36737. return cachedClearTimeout(marker);
  36738. } catch (e){
  36739. try {
  36740. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36741. return cachedClearTimeout.call(null, marker);
  36742. } catch (e){
  36743. // 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.
  36744. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  36745. return cachedClearTimeout.call(this, marker);
  36746. }
  36747. }
  36748. }
  36749. var queue = [];
  36750. var draining = false;
  36751. var currentQueue;
  36752. var queueIndex = -1;
  36753. function cleanUpNextTick() {
  36754. if (!draining || !currentQueue) {
  36755. return;
  36756. }
  36757. draining = false;
  36758. if (currentQueue.length) {
  36759. queue = currentQueue.concat(queue);
  36760. } else {
  36761. queueIndex = -1;
  36762. }
  36763. if (queue.length) {
  36764. drainQueue();
  36765. }
  36766. }
  36767. function drainQueue() {
  36768. if (draining) {
  36769. return;
  36770. }
  36771. var timeout = runTimeout(cleanUpNextTick);
  36772. draining = true;
  36773. var len = queue.length;
  36774. while(len) {
  36775. currentQueue = queue;
  36776. queue = [];
  36777. while (++queueIndex < len) {
  36778. if (currentQueue) {
  36779. currentQueue[queueIndex].run();
  36780. }
  36781. }
  36782. queueIndex = -1;
  36783. len = queue.length;
  36784. }
  36785. currentQueue = null;
  36786. draining = false;
  36787. runClearTimeout(timeout);
  36788. }
  36789. process.nextTick = function (fun) {
  36790. var args = new Array(arguments.length - 1);
  36791. if (arguments.length > 1) {
  36792. for (var i = 1; i < arguments.length; i++) {
  36793. args[i - 1] = arguments[i];
  36794. }
  36795. }
  36796. queue.push(new Item(fun, args));
  36797. if (queue.length === 1 && !draining) {
  36798. runTimeout(drainQueue);
  36799. }
  36800. };
  36801. // v8 likes predictible objects
  36802. function Item(fun, array) {
  36803. this.fun = fun;
  36804. this.array = array;
  36805. }
  36806. Item.prototype.run = function () {
  36807. this.fun.apply(null, this.array);
  36808. };
  36809. process.title = 'browser';
  36810. process.browser = true;
  36811. process.env = {};
  36812. process.argv = [];
  36813. process.version = ''; // empty string to avoid regexp issues
  36814. process.versions = {};
  36815. function noop() {}
  36816. process.on = noop;
  36817. process.addListener = noop;
  36818. process.once = noop;
  36819. process.off = noop;
  36820. process.removeListener = noop;
  36821. process.removeAllListeners = noop;
  36822. process.emit = noop;
  36823. process.prependListener = noop;
  36824. process.prependOnceListener = noop;
  36825. process.listeners = function (name) { return [] }
  36826. process.binding = function (name) {
  36827. throw new Error('process.binding is not supported');
  36828. };
  36829. process.cwd = function () { return '/' };
  36830. process.chdir = function (dir) {
  36831. throw new Error('process.chdir is not supported');
  36832. };
  36833. process.umask = function() { return 0; };
  36834. /***/ }),
  36835. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  36836. /*!***************************************************!*\
  36837. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  36838. \***************************************************/
  36839. /*! no static exports found */
  36840. /***/ (function(module, exports, __webpack_require__) {
  36841. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  36842. * Pusher JavaScript Library v5.0.3
  36843. * https://pusher.com/
  36844. *
  36845. * Copyright 2017, Pusher
  36846. * Released under the MIT licence.
  36847. */
  36848. (function webpackUniversalModuleDefinition(root, factory) {
  36849. if(true)
  36850. module.exports = factory();
  36851. else {}
  36852. })(window, function() {
  36853. return /******/ (function(modules) { // webpackBootstrap
  36854. /******/ // The module cache
  36855. /******/ var installedModules = {};
  36856. /******/
  36857. /******/ // The require function
  36858. /******/ function __webpack_require__(moduleId) {
  36859. /******/
  36860. /******/ // Check if module is in cache
  36861. /******/ if(installedModules[moduleId]) {
  36862. /******/ return installedModules[moduleId].exports;
  36863. /******/ }
  36864. /******/ // Create a new module (and put it into the cache)
  36865. /******/ var module = installedModules[moduleId] = {
  36866. /******/ i: moduleId,
  36867. /******/ l: false,
  36868. /******/ exports: {}
  36869. /******/ };
  36870. /******/
  36871. /******/ // Execute the module function
  36872. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  36873. /******/
  36874. /******/ // Flag the module as loaded
  36875. /******/ module.l = true;
  36876. /******/
  36877. /******/ // Return the exports of the module
  36878. /******/ return module.exports;
  36879. /******/ }
  36880. /******/
  36881. /******/
  36882. /******/ // expose the modules object (__webpack_modules__)
  36883. /******/ __webpack_require__.m = modules;
  36884. /******/
  36885. /******/ // expose the module cache
  36886. /******/ __webpack_require__.c = installedModules;
  36887. /******/
  36888. /******/ // define getter function for harmony exports
  36889. /******/ __webpack_require__.d = function(exports, name, getter) {
  36890. /******/ if(!__webpack_require__.o(exports, name)) {
  36891. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  36892. /******/ }
  36893. /******/ };
  36894. /******/
  36895. /******/ // define __esModule on exports
  36896. /******/ __webpack_require__.r = function(exports) {
  36897. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  36898. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  36899. /******/ }
  36900. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  36901. /******/ };
  36902. /******/
  36903. /******/ // create a fake namespace object
  36904. /******/ // mode & 1: value is a module id, require it
  36905. /******/ // mode & 2: merge all properties of value into the ns
  36906. /******/ // mode & 4: return value when already ns object
  36907. /******/ // mode & 8|1: behave like require
  36908. /******/ __webpack_require__.t = function(value, mode) {
  36909. /******/ if(mode & 1) value = __webpack_require__(value);
  36910. /******/ if(mode & 8) return value;
  36911. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  36912. /******/ var ns = Object.create(null);
  36913. /******/ __webpack_require__.r(ns);
  36914. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  36915. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  36916. /******/ return ns;
  36917. /******/ };
  36918. /******/
  36919. /******/ // getDefaultExport function for compatibility with non-harmony modules
  36920. /******/ __webpack_require__.n = function(module) {
  36921. /******/ var getter = module && module.__esModule ?
  36922. /******/ function getDefault() { return module['default']; } :
  36923. /******/ function getModuleExports() { return module; };
  36924. /******/ __webpack_require__.d(getter, 'a', getter);
  36925. /******/ return getter;
  36926. /******/ };
  36927. /******/
  36928. /******/ // Object.prototype.hasOwnProperty.call
  36929. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  36930. /******/
  36931. /******/ // __webpack_public_path__
  36932. /******/ __webpack_require__.p = "";
  36933. /******/
  36934. /******/
  36935. /******/ // Load entry module and return exports
  36936. /******/ return __webpack_require__(__webpack_require__.s = 2);
  36937. /******/ })
  36938. /************************************************************************/
  36939. /******/ ([
  36940. /* 0 */
  36941. /***/ (function(module, exports, __webpack_require__) {
  36942. (function(nacl) {
  36943. 'use strict';
  36944. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  36945. // Public domain.
  36946. //
  36947. // Implementation derived from TweetNaCl version 20140427.
  36948. // See for details: http://tweetnacl.cr.yp.to/
  36949. var gf = function(init) {
  36950. var i, r = new Float64Array(16);
  36951. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  36952. return r;
  36953. };
  36954. // Pluggable, initialized in high-level API below.
  36955. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  36956. var _0 = new Uint8Array(16);
  36957. var _9 = new Uint8Array(32); _9[0] = 9;
  36958. var gf0 = gf(),
  36959. gf1 = gf([1]),
  36960. _121665 = gf([0xdb41, 1]),
  36961. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  36962. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  36963. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  36964. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  36965. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  36966. function ts64(x, i, h, l) {
  36967. x[i] = (h >> 24) & 0xff;
  36968. x[i+1] = (h >> 16) & 0xff;
  36969. x[i+2] = (h >> 8) & 0xff;
  36970. x[i+3] = h & 0xff;
  36971. x[i+4] = (l >> 24) & 0xff;
  36972. x[i+5] = (l >> 16) & 0xff;
  36973. x[i+6] = (l >> 8) & 0xff;
  36974. x[i+7] = l & 0xff;
  36975. }
  36976. function vn(x, xi, y, yi, n) {
  36977. var i,d = 0;
  36978. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  36979. return (1 & ((d - 1) >>> 8)) - 1;
  36980. }
  36981. function crypto_verify_16(x, xi, y, yi) {
  36982. return vn(x,xi,y,yi,16);
  36983. }
  36984. function crypto_verify_32(x, xi, y, yi) {
  36985. return vn(x,xi,y,yi,32);
  36986. }
  36987. function core_salsa20(o, p, k, c) {
  36988. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  36989. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  36990. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  36991. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  36992. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  36993. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  36994. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  36995. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  36996. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  36997. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  36998. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  36999. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37000. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37001. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37002. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37003. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37004. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37005. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37006. x15 = j15, u;
  37007. for (var i = 0; i < 20; i += 2) {
  37008. u = x0 + x12 | 0;
  37009. x4 ^= u<<7 | u>>>(32-7);
  37010. u = x4 + x0 | 0;
  37011. x8 ^= u<<9 | u>>>(32-9);
  37012. u = x8 + x4 | 0;
  37013. x12 ^= u<<13 | u>>>(32-13);
  37014. u = x12 + x8 | 0;
  37015. x0 ^= u<<18 | u>>>(32-18);
  37016. u = x5 + x1 | 0;
  37017. x9 ^= u<<7 | u>>>(32-7);
  37018. u = x9 + x5 | 0;
  37019. x13 ^= u<<9 | u>>>(32-9);
  37020. u = x13 + x9 | 0;
  37021. x1 ^= u<<13 | u>>>(32-13);
  37022. u = x1 + x13 | 0;
  37023. x5 ^= u<<18 | u>>>(32-18);
  37024. u = x10 + x6 | 0;
  37025. x14 ^= u<<7 | u>>>(32-7);
  37026. u = x14 + x10 | 0;
  37027. x2 ^= u<<9 | u>>>(32-9);
  37028. u = x2 + x14 | 0;
  37029. x6 ^= u<<13 | u>>>(32-13);
  37030. u = x6 + x2 | 0;
  37031. x10 ^= u<<18 | u>>>(32-18);
  37032. u = x15 + x11 | 0;
  37033. x3 ^= u<<7 | u>>>(32-7);
  37034. u = x3 + x15 | 0;
  37035. x7 ^= u<<9 | u>>>(32-9);
  37036. u = x7 + x3 | 0;
  37037. x11 ^= u<<13 | u>>>(32-13);
  37038. u = x11 + x7 | 0;
  37039. x15 ^= u<<18 | u>>>(32-18);
  37040. u = x0 + x3 | 0;
  37041. x1 ^= u<<7 | u>>>(32-7);
  37042. u = x1 + x0 | 0;
  37043. x2 ^= u<<9 | u>>>(32-9);
  37044. u = x2 + x1 | 0;
  37045. x3 ^= u<<13 | u>>>(32-13);
  37046. u = x3 + x2 | 0;
  37047. x0 ^= u<<18 | u>>>(32-18);
  37048. u = x5 + x4 | 0;
  37049. x6 ^= u<<7 | u>>>(32-7);
  37050. u = x6 + x5 | 0;
  37051. x7 ^= u<<9 | u>>>(32-9);
  37052. u = x7 + x6 | 0;
  37053. x4 ^= u<<13 | u>>>(32-13);
  37054. u = x4 + x7 | 0;
  37055. x5 ^= u<<18 | u>>>(32-18);
  37056. u = x10 + x9 | 0;
  37057. x11 ^= u<<7 | u>>>(32-7);
  37058. u = x11 + x10 | 0;
  37059. x8 ^= u<<9 | u>>>(32-9);
  37060. u = x8 + x11 | 0;
  37061. x9 ^= u<<13 | u>>>(32-13);
  37062. u = x9 + x8 | 0;
  37063. x10 ^= u<<18 | u>>>(32-18);
  37064. u = x15 + x14 | 0;
  37065. x12 ^= u<<7 | u>>>(32-7);
  37066. u = x12 + x15 | 0;
  37067. x13 ^= u<<9 | u>>>(32-9);
  37068. u = x13 + x12 | 0;
  37069. x14 ^= u<<13 | u>>>(32-13);
  37070. u = x14 + x13 | 0;
  37071. x15 ^= u<<18 | u>>>(32-18);
  37072. }
  37073. x0 = x0 + j0 | 0;
  37074. x1 = x1 + j1 | 0;
  37075. x2 = x2 + j2 | 0;
  37076. x3 = x3 + j3 | 0;
  37077. x4 = x4 + j4 | 0;
  37078. x5 = x5 + j5 | 0;
  37079. x6 = x6 + j6 | 0;
  37080. x7 = x7 + j7 | 0;
  37081. x8 = x8 + j8 | 0;
  37082. x9 = x9 + j9 | 0;
  37083. x10 = x10 + j10 | 0;
  37084. x11 = x11 + j11 | 0;
  37085. x12 = x12 + j12 | 0;
  37086. x13 = x13 + j13 | 0;
  37087. x14 = x14 + j14 | 0;
  37088. x15 = x15 + j15 | 0;
  37089. o[ 0] = x0 >>> 0 & 0xff;
  37090. o[ 1] = x0 >>> 8 & 0xff;
  37091. o[ 2] = x0 >>> 16 & 0xff;
  37092. o[ 3] = x0 >>> 24 & 0xff;
  37093. o[ 4] = x1 >>> 0 & 0xff;
  37094. o[ 5] = x1 >>> 8 & 0xff;
  37095. o[ 6] = x1 >>> 16 & 0xff;
  37096. o[ 7] = x1 >>> 24 & 0xff;
  37097. o[ 8] = x2 >>> 0 & 0xff;
  37098. o[ 9] = x2 >>> 8 & 0xff;
  37099. o[10] = x2 >>> 16 & 0xff;
  37100. o[11] = x2 >>> 24 & 0xff;
  37101. o[12] = x3 >>> 0 & 0xff;
  37102. o[13] = x3 >>> 8 & 0xff;
  37103. o[14] = x3 >>> 16 & 0xff;
  37104. o[15] = x3 >>> 24 & 0xff;
  37105. o[16] = x4 >>> 0 & 0xff;
  37106. o[17] = x4 >>> 8 & 0xff;
  37107. o[18] = x4 >>> 16 & 0xff;
  37108. o[19] = x4 >>> 24 & 0xff;
  37109. o[20] = x5 >>> 0 & 0xff;
  37110. o[21] = x5 >>> 8 & 0xff;
  37111. o[22] = x5 >>> 16 & 0xff;
  37112. o[23] = x5 >>> 24 & 0xff;
  37113. o[24] = x6 >>> 0 & 0xff;
  37114. o[25] = x6 >>> 8 & 0xff;
  37115. o[26] = x6 >>> 16 & 0xff;
  37116. o[27] = x6 >>> 24 & 0xff;
  37117. o[28] = x7 >>> 0 & 0xff;
  37118. o[29] = x7 >>> 8 & 0xff;
  37119. o[30] = x7 >>> 16 & 0xff;
  37120. o[31] = x7 >>> 24 & 0xff;
  37121. o[32] = x8 >>> 0 & 0xff;
  37122. o[33] = x8 >>> 8 & 0xff;
  37123. o[34] = x8 >>> 16 & 0xff;
  37124. o[35] = x8 >>> 24 & 0xff;
  37125. o[36] = x9 >>> 0 & 0xff;
  37126. o[37] = x9 >>> 8 & 0xff;
  37127. o[38] = x9 >>> 16 & 0xff;
  37128. o[39] = x9 >>> 24 & 0xff;
  37129. o[40] = x10 >>> 0 & 0xff;
  37130. o[41] = x10 >>> 8 & 0xff;
  37131. o[42] = x10 >>> 16 & 0xff;
  37132. o[43] = x10 >>> 24 & 0xff;
  37133. o[44] = x11 >>> 0 & 0xff;
  37134. o[45] = x11 >>> 8 & 0xff;
  37135. o[46] = x11 >>> 16 & 0xff;
  37136. o[47] = x11 >>> 24 & 0xff;
  37137. o[48] = x12 >>> 0 & 0xff;
  37138. o[49] = x12 >>> 8 & 0xff;
  37139. o[50] = x12 >>> 16 & 0xff;
  37140. o[51] = x12 >>> 24 & 0xff;
  37141. o[52] = x13 >>> 0 & 0xff;
  37142. o[53] = x13 >>> 8 & 0xff;
  37143. o[54] = x13 >>> 16 & 0xff;
  37144. o[55] = x13 >>> 24 & 0xff;
  37145. o[56] = x14 >>> 0 & 0xff;
  37146. o[57] = x14 >>> 8 & 0xff;
  37147. o[58] = x14 >>> 16 & 0xff;
  37148. o[59] = x14 >>> 24 & 0xff;
  37149. o[60] = x15 >>> 0 & 0xff;
  37150. o[61] = x15 >>> 8 & 0xff;
  37151. o[62] = x15 >>> 16 & 0xff;
  37152. o[63] = x15 >>> 24 & 0xff;
  37153. }
  37154. function core_hsalsa20(o,p,k,c) {
  37155. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37156. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37157. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37158. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37159. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37160. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37161. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37162. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37163. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37164. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37165. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37166. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37167. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37168. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37169. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37170. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37171. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37172. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37173. x15 = j15, u;
  37174. for (var i = 0; i < 20; i += 2) {
  37175. u = x0 + x12 | 0;
  37176. x4 ^= u<<7 | u>>>(32-7);
  37177. u = x4 + x0 | 0;
  37178. x8 ^= u<<9 | u>>>(32-9);
  37179. u = x8 + x4 | 0;
  37180. x12 ^= u<<13 | u>>>(32-13);
  37181. u = x12 + x8 | 0;
  37182. x0 ^= u<<18 | u>>>(32-18);
  37183. u = x5 + x1 | 0;
  37184. x9 ^= u<<7 | u>>>(32-7);
  37185. u = x9 + x5 | 0;
  37186. x13 ^= u<<9 | u>>>(32-9);
  37187. u = x13 + x9 | 0;
  37188. x1 ^= u<<13 | u>>>(32-13);
  37189. u = x1 + x13 | 0;
  37190. x5 ^= u<<18 | u>>>(32-18);
  37191. u = x10 + x6 | 0;
  37192. x14 ^= u<<7 | u>>>(32-7);
  37193. u = x14 + x10 | 0;
  37194. x2 ^= u<<9 | u>>>(32-9);
  37195. u = x2 + x14 | 0;
  37196. x6 ^= u<<13 | u>>>(32-13);
  37197. u = x6 + x2 | 0;
  37198. x10 ^= u<<18 | u>>>(32-18);
  37199. u = x15 + x11 | 0;
  37200. x3 ^= u<<7 | u>>>(32-7);
  37201. u = x3 + x15 | 0;
  37202. x7 ^= u<<9 | u>>>(32-9);
  37203. u = x7 + x3 | 0;
  37204. x11 ^= u<<13 | u>>>(32-13);
  37205. u = x11 + x7 | 0;
  37206. x15 ^= u<<18 | u>>>(32-18);
  37207. u = x0 + x3 | 0;
  37208. x1 ^= u<<7 | u>>>(32-7);
  37209. u = x1 + x0 | 0;
  37210. x2 ^= u<<9 | u>>>(32-9);
  37211. u = x2 + x1 | 0;
  37212. x3 ^= u<<13 | u>>>(32-13);
  37213. u = x3 + x2 | 0;
  37214. x0 ^= u<<18 | u>>>(32-18);
  37215. u = x5 + x4 | 0;
  37216. x6 ^= u<<7 | u>>>(32-7);
  37217. u = x6 + x5 | 0;
  37218. x7 ^= u<<9 | u>>>(32-9);
  37219. u = x7 + x6 | 0;
  37220. x4 ^= u<<13 | u>>>(32-13);
  37221. u = x4 + x7 | 0;
  37222. x5 ^= u<<18 | u>>>(32-18);
  37223. u = x10 + x9 | 0;
  37224. x11 ^= u<<7 | u>>>(32-7);
  37225. u = x11 + x10 | 0;
  37226. x8 ^= u<<9 | u>>>(32-9);
  37227. u = x8 + x11 | 0;
  37228. x9 ^= u<<13 | u>>>(32-13);
  37229. u = x9 + x8 | 0;
  37230. x10 ^= u<<18 | u>>>(32-18);
  37231. u = x15 + x14 | 0;
  37232. x12 ^= u<<7 | u>>>(32-7);
  37233. u = x12 + x15 | 0;
  37234. x13 ^= u<<9 | u>>>(32-9);
  37235. u = x13 + x12 | 0;
  37236. x14 ^= u<<13 | u>>>(32-13);
  37237. u = x14 + x13 | 0;
  37238. x15 ^= u<<18 | u>>>(32-18);
  37239. }
  37240. o[ 0] = x0 >>> 0 & 0xff;
  37241. o[ 1] = x0 >>> 8 & 0xff;
  37242. o[ 2] = x0 >>> 16 & 0xff;
  37243. o[ 3] = x0 >>> 24 & 0xff;
  37244. o[ 4] = x5 >>> 0 & 0xff;
  37245. o[ 5] = x5 >>> 8 & 0xff;
  37246. o[ 6] = x5 >>> 16 & 0xff;
  37247. o[ 7] = x5 >>> 24 & 0xff;
  37248. o[ 8] = x10 >>> 0 & 0xff;
  37249. o[ 9] = x10 >>> 8 & 0xff;
  37250. o[10] = x10 >>> 16 & 0xff;
  37251. o[11] = x10 >>> 24 & 0xff;
  37252. o[12] = x15 >>> 0 & 0xff;
  37253. o[13] = x15 >>> 8 & 0xff;
  37254. o[14] = x15 >>> 16 & 0xff;
  37255. o[15] = x15 >>> 24 & 0xff;
  37256. o[16] = x6 >>> 0 & 0xff;
  37257. o[17] = x6 >>> 8 & 0xff;
  37258. o[18] = x6 >>> 16 & 0xff;
  37259. o[19] = x6 >>> 24 & 0xff;
  37260. o[20] = x7 >>> 0 & 0xff;
  37261. o[21] = x7 >>> 8 & 0xff;
  37262. o[22] = x7 >>> 16 & 0xff;
  37263. o[23] = x7 >>> 24 & 0xff;
  37264. o[24] = x8 >>> 0 & 0xff;
  37265. o[25] = x8 >>> 8 & 0xff;
  37266. o[26] = x8 >>> 16 & 0xff;
  37267. o[27] = x8 >>> 24 & 0xff;
  37268. o[28] = x9 >>> 0 & 0xff;
  37269. o[29] = x9 >>> 8 & 0xff;
  37270. o[30] = x9 >>> 16 & 0xff;
  37271. o[31] = x9 >>> 24 & 0xff;
  37272. }
  37273. function crypto_core_salsa20(out,inp,k,c) {
  37274. core_salsa20(out,inp,k,c);
  37275. }
  37276. function crypto_core_hsalsa20(out,inp,k,c) {
  37277. core_hsalsa20(out,inp,k,c);
  37278. }
  37279. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  37280. // "expand 32-byte k"
  37281. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  37282. var z = new Uint8Array(16), x = new Uint8Array(64);
  37283. var u, i;
  37284. for (i = 0; i < 16; i++) z[i] = 0;
  37285. for (i = 0; i < 8; i++) z[i] = n[i];
  37286. while (b >= 64) {
  37287. crypto_core_salsa20(x,z,k,sigma);
  37288. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37289. u = 1;
  37290. for (i = 8; i < 16; i++) {
  37291. u = u + (z[i] & 0xff) | 0;
  37292. z[i] = u & 0xff;
  37293. u >>>= 8;
  37294. }
  37295. b -= 64;
  37296. cpos += 64;
  37297. mpos += 64;
  37298. }
  37299. if (b > 0) {
  37300. crypto_core_salsa20(x,z,k,sigma);
  37301. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37302. }
  37303. return 0;
  37304. }
  37305. function crypto_stream_salsa20(c,cpos,b,n,k) {
  37306. var z = new Uint8Array(16), x = new Uint8Array(64);
  37307. var u, i;
  37308. for (i = 0; i < 16; i++) z[i] = 0;
  37309. for (i = 0; i < 8; i++) z[i] = n[i];
  37310. while (b >= 64) {
  37311. crypto_core_salsa20(x,z,k,sigma);
  37312. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  37313. u = 1;
  37314. for (i = 8; i < 16; i++) {
  37315. u = u + (z[i] & 0xff) | 0;
  37316. z[i] = u & 0xff;
  37317. u >>>= 8;
  37318. }
  37319. b -= 64;
  37320. cpos += 64;
  37321. }
  37322. if (b > 0) {
  37323. crypto_core_salsa20(x,z,k,sigma);
  37324. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  37325. }
  37326. return 0;
  37327. }
  37328. function crypto_stream(c,cpos,d,n,k) {
  37329. var s = new Uint8Array(32);
  37330. crypto_core_hsalsa20(s,n,k,sigma);
  37331. var sn = new Uint8Array(8);
  37332. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37333. return crypto_stream_salsa20(c,cpos,d,sn,s);
  37334. }
  37335. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  37336. var s = new Uint8Array(32);
  37337. crypto_core_hsalsa20(s,n,k,sigma);
  37338. var sn = new Uint8Array(8);
  37339. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37340. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  37341. }
  37342. /*
  37343. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  37344. * https://github.com/floodyberry/poly1305-donna
  37345. */
  37346. var poly1305 = function(key) {
  37347. this.buffer = new Uint8Array(16);
  37348. this.r = new Uint16Array(10);
  37349. this.h = new Uint16Array(10);
  37350. this.pad = new Uint16Array(8);
  37351. this.leftover = 0;
  37352. this.fin = 0;
  37353. var t0, t1, t2, t3, t4, t5, t6, t7;
  37354. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  37355. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37356. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  37357. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37358. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  37359. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  37360. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37361. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  37362. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37363. this.r[9] = ((t7 >>> 5)) & 0x007f;
  37364. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  37365. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  37366. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  37367. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  37368. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  37369. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  37370. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  37371. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  37372. };
  37373. poly1305.prototype.blocks = function(m, mpos, bytes) {
  37374. var hibit = this.fin ? 0 : (1 << 11);
  37375. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  37376. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  37377. var h0 = this.h[0],
  37378. h1 = this.h[1],
  37379. h2 = this.h[2],
  37380. h3 = this.h[3],
  37381. h4 = this.h[4],
  37382. h5 = this.h[5],
  37383. h6 = this.h[6],
  37384. h7 = this.h[7],
  37385. h8 = this.h[8],
  37386. h9 = this.h[9];
  37387. var r0 = this.r[0],
  37388. r1 = this.r[1],
  37389. r2 = this.r[2],
  37390. r3 = this.r[3],
  37391. r4 = this.r[4],
  37392. r5 = this.r[5],
  37393. r6 = this.r[6],
  37394. r7 = this.r[7],
  37395. r8 = this.r[8],
  37396. r9 = this.r[9];
  37397. while (bytes >= 16) {
  37398. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  37399. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37400. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  37401. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37402. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  37403. h5 += ((t4 >>> 1)) & 0x1fff;
  37404. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37405. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  37406. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37407. h9 += ((t7 >>> 5)) | hibit;
  37408. c = 0;
  37409. d0 = c;
  37410. d0 += h0 * r0;
  37411. d0 += h1 * (5 * r9);
  37412. d0 += h2 * (5 * r8);
  37413. d0 += h3 * (5 * r7);
  37414. d0 += h4 * (5 * r6);
  37415. c = (d0 >>> 13); d0 &= 0x1fff;
  37416. d0 += h5 * (5 * r5);
  37417. d0 += h6 * (5 * r4);
  37418. d0 += h7 * (5 * r3);
  37419. d0 += h8 * (5 * r2);
  37420. d0 += h9 * (5 * r1);
  37421. c += (d0 >>> 13); d0 &= 0x1fff;
  37422. d1 = c;
  37423. d1 += h0 * r1;
  37424. d1 += h1 * r0;
  37425. d1 += h2 * (5 * r9);
  37426. d1 += h3 * (5 * r8);
  37427. d1 += h4 * (5 * r7);
  37428. c = (d1 >>> 13); d1 &= 0x1fff;
  37429. d1 += h5 * (5 * r6);
  37430. d1 += h6 * (5 * r5);
  37431. d1 += h7 * (5 * r4);
  37432. d1 += h8 * (5 * r3);
  37433. d1 += h9 * (5 * r2);
  37434. c += (d1 >>> 13); d1 &= 0x1fff;
  37435. d2 = c;
  37436. d2 += h0 * r2;
  37437. d2 += h1 * r1;
  37438. d2 += h2 * r0;
  37439. d2 += h3 * (5 * r9);
  37440. d2 += h4 * (5 * r8);
  37441. c = (d2 >>> 13); d2 &= 0x1fff;
  37442. d2 += h5 * (5 * r7);
  37443. d2 += h6 * (5 * r6);
  37444. d2 += h7 * (5 * r5);
  37445. d2 += h8 * (5 * r4);
  37446. d2 += h9 * (5 * r3);
  37447. c += (d2 >>> 13); d2 &= 0x1fff;
  37448. d3 = c;
  37449. d3 += h0 * r3;
  37450. d3 += h1 * r2;
  37451. d3 += h2 * r1;
  37452. d3 += h3 * r0;
  37453. d3 += h4 * (5 * r9);
  37454. c = (d3 >>> 13); d3 &= 0x1fff;
  37455. d3 += h5 * (5 * r8);
  37456. d3 += h6 * (5 * r7);
  37457. d3 += h7 * (5 * r6);
  37458. d3 += h8 * (5 * r5);
  37459. d3 += h9 * (5 * r4);
  37460. c += (d3 >>> 13); d3 &= 0x1fff;
  37461. d4 = c;
  37462. d4 += h0 * r4;
  37463. d4 += h1 * r3;
  37464. d4 += h2 * r2;
  37465. d4 += h3 * r1;
  37466. d4 += h4 * r0;
  37467. c = (d4 >>> 13); d4 &= 0x1fff;
  37468. d4 += h5 * (5 * r9);
  37469. d4 += h6 * (5 * r8);
  37470. d4 += h7 * (5 * r7);
  37471. d4 += h8 * (5 * r6);
  37472. d4 += h9 * (5 * r5);
  37473. c += (d4 >>> 13); d4 &= 0x1fff;
  37474. d5 = c;
  37475. d5 += h0 * r5;
  37476. d5 += h1 * r4;
  37477. d5 += h2 * r3;
  37478. d5 += h3 * r2;
  37479. d5 += h4 * r1;
  37480. c = (d5 >>> 13); d5 &= 0x1fff;
  37481. d5 += h5 * r0;
  37482. d5 += h6 * (5 * r9);
  37483. d5 += h7 * (5 * r8);
  37484. d5 += h8 * (5 * r7);
  37485. d5 += h9 * (5 * r6);
  37486. c += (d5 >>> 13); d5 &= 0x1fff;
  37487. d6 = c;
  37488. d6 += h0 * r6;
  37489. d6 += h1 * r5;
  37490. d6 += h2 * r4;
  37491. d6 += h3 * r3;
  37492. d6 += h4 * r2;
  37493. c = (d6 >>> 13); d6 &= 0x1fff;
  37494. d6 += h5 * r1;
  37495. d6 += h6 * r0;
  37496. d6 += h7 * (5 * r9);
  37497. d6 += h8 * (5 * r8);
  37498. d6 += h9 * (5 * r7);
  37499. c += (d6 >>> 13); d6 &= 0x1fff;
  37500. d7 = c;
  37501. d7 += h0 * r7;
  37502. d7 += h1 * r6;
  37503. d7 += h2 * r5;
  37504. d7 += h3 * r4;
  37505. d7 += h4 * r3;
  37506. c = (d7 >>> 13); d7 &= 0x1fff;
  37507. d7 += h5 * r2;
  37508. d7 += h6 * r1;
  37509. d7 += h7 * r0;
  37510. d7 += h8 * (5 * r9);
  37511. d7 += h9 * (5 * r8);
  37512. c += (d7 >>> 13); d7 &= 0x1fff;
  37513. d8 = c;
  37514. d8 += h0 * r8;
  37515. d8 += h1 * r7;
  37516. d8 += h2 * r6;
  37517. d8 += h3 * r5;
  37518. d8 += h4 * r4;
  37519. c = (d8 >>> 13); d8 &= 0x1fff;
  37520. d8 += h5 * r3;
  37521. d8 += h6 * r2;
  37522. d8 += h7 * r1;
  37523. d8 += h8 * r0;
  37524. d8 += h9 * (5 * r9);
  37525. c += (d8 >>> 13); d8 &= 0x1fff;
  37526. d9 = c;
  37527. d9 += h0 * r9;
  37528. d9 += h1 * r8;
  37529. d9 += h2 * r7;
  37530. d9 += h3 * r6;
  37531. d9 += h4 * r5;
  37532. c = (d9 >>> 13); d9 &= 0x1fff;
  37533. d9 += h5 * r4;
  37534. d9 += h6 * r3;
  37535. d9 += h7 * r2;
  37536. d9 += h8 * r1;
  37537. d9 += h9 * r0;
  37538. c += (d9 >>> 13); d9 &= 0x1fff;
  37539. c = (((c << 2) + c)) | 0;
  37540. c = (c + d0) | 0;
  37541. d0 = c & 0x1fff;
  37542. c = (c >>> 13);
  37543. d1 += c;
  37544. h0 = d0;
  37545. h1 = d1;
  37546. h2 = d2;
  37547. h3 = d3;
  37548. h4 = d4;
  37549. h5 = d5;
  37550. h6 = d6;
  37551. h7 = d7;
  37552. h8 = d8;
  37553. h9 = d9;
  37554. mpos += 16;
  37555. bytes -= 16;
  37556. }
  37557. this.h[0] = h0;
  37558. this.h[1] = h1;
  37559. this.h[2] = h2;
  37560. this.h[3] = h3;
  37561. this.h[4] = h4;
  37562. this.h[5] = h5;
  37563. this.h[6] = h6;
  37564. this.h[7] = h7;
  37565. this.h[8] = h8;
  37566. this.h[9] = h9;
  37567. };
  37568. poly1305.prototype.finish = function(mac, macpos) {
  37569. var g = new Uint16Array(10);
  37570. var c, mask, f, i;
  37571. if (this.leftover) {
  37572. i = this.leftover;
  37573. this.buffer[i++] = 1;
  37574. for (; i < 16; i++) this.buffer[i] = 0;
  37575. this.fin = 1;
  37576. this.blocks(this.buffer, 0, 16);
  37577. }
  37578. c = this.h[1] >>> 13;
  37579. this.h[1] &= 0x1fff;
  37580. for (i = 2; i < 10; i++) {
  37581. this.h[i] += c;
  37582. c = this.h[i] >>> 13;
  37583. this.h[i] &= 0x1fff;
  37584. }
  37585. this.h[0] += (c * 5);
  37586. c = this.h[0] >>> 13;
  37587. this.h[0] &= 0x1fff;
  37588. this.h[1] += c;
  37589. c = this.h[1] >>> 13;
  37590. this.h[1] &= 0x1fff;
  37591. this.h[2] += c;
  37592. g[0] = this.h[0] + 5;
  37593. c = g[0] >>> 13;
  37594. g[0] &= 0x1fff;
  37595. for (i = 1; i < 10; i++) {
  37596. g[i] = this.h[i] + c;
  37597. c = g[i] >>> 13;
  37598. g[i] &= 0x1fff;
  37599. }
  37600. g[9] -= (1 << 13);
  37601. mask = (c ^ 1) - 1;
  37602. for (i = 0; i < 10; i++) g[i] &= mask;
  37603. mask = ~mask;
  37604. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  37605. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  37606. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  37607. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  37608. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  37609. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  37610. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  37611. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  37612. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  37613. f = this.h[0] + this.pad[0];
  37614. this.h[0] = f & 0xffff;
  37615. for (i = 1; i < 8; i++) {
  37616. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  37617. this.h[i] = f & 0xffff;
  37618. }
  37619. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  37620. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  37621. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  37622. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  37623. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  37624. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  37625. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  37626. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  37627. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  37628. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  37629. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  37630. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  37631. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  37632. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  37633. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  37634. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  37635. };
  37636. poly1305.prototype.update = function(m, mpos, bytes) {
  37637. var i, want;
  37638. if (this.leftover) {
  37639. want = (16 - this.leftover);
  37640. if (want > bytes)
  37641. want = bytes;
  37642. for (i = 0; i < want; i++)
  37643. this.buffer[this.leftover + i] = m[mpos+i];
  37644. bytes -= want;
  37645. mpos += want;
  37646. this.leftover += want;
  37647. if (this.leftover < 16)
  37648. return;
  37649. this.blocks(this.buffer, 0, 16);
  37650. this.leftover = 0;
  37651. }
  37652. if (bytes >= 16) {
  37653. want = bytes - (bytes % 16);
  37654. this.blocks(m, mpos, want);
  37655. mpos += want;
  37656. bytes -= want;
  37657. }
  37658. if (bytes) {
  37659. for (i = 0; i < bytes; i++)
  37660. this.buffer[this.leftover + i] = m[mpos+i];
  37661. this.leftover += bytes;
  37662. }
  37663. };
  37664. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  37665. var s = new poly1305(k);
  37666. s.update(m, mpos, n);
  37667. s.finish(out, outpos);
  37668. return 0;
  37669. }
  37670. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  37671. var x = new Uint8Array(16);
  37672. crypto_onetimeauth(x,0,m,mpos,n,k);
  37673. return crypto_verify_16(h,hpos,x,0);
  37674. }
  37675. function crypto_secretbox(c,m,d,n,k) {
  37676. var i;
  37677. if (d < 32) return -1;
  37678. crypto_stream_xor(c,0,m,0,d,n,k);
  37679. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  37680. for (i = 0; i < 16; i++) c[i] = 0;
  37681. return 0;
  37682. }
  37683. function crypto_secretbox_open(m,c,d,n,k) {
  37684. var i;
  37685. var x = new Uint8Array(32);
  37686. if (d < 32) return -1;
  37687. crypto_stream(x,0,32,n,k);
  37688. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  37689. crypto_stream_xor(m,0,c,0,d,n,k);
  37690. for (i = 0; i < 32; i++) m[i] = 0;
  37691. return 0;
  37692. }
  37693. function set25519(r, a) {
  37694. var i;
  37695. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  37696. }
  37697. function car25519(o) {
  37698. var i, v, c = 1;
  37699. for (i = 0; i < 16; i++) {
  37700. v = o[i] + c + 65535;
  37701. c = Math.floor(v / 65536);
  37702. o[i] = v - c * 65536;
  37703. }
  37704. o[0] += c-1 + 37 * (c-1);
  37705. }
  37706. function sel25519(p, q, b) {
  37707. var t, c = ~(b-1);
  37708. for (var i = 0; i < 16; i++) {
  37709. t = c & (p[i] ^ q[i]);
  37710. p[i] ^= t;
  37711. q[i] ^= t;
  37712. }
  37713. }
  37714. function pack25519(o, n) {
  37715. var i, j, b;
  37716. var m = gf(), t = gf();
  37717. for (i = 0; i < 16; i++) t[i] = n[i];
  37718. car25519(t);
  37719. car25519(t);
  37720. car25519(t);
  37721. for (j = 0; j < 2; j++) {
  37722. m[0] = t[0] - 0xffed;
  37723. for (i = 1; i < 15; i++) {
  37724. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  37725. m[i-1] &= 0xffff;
  37726. }
  37727. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  37728. b = (m[15]>>16) & 1;
  37729. m[14] &= 0xffff;
  37730. sel25519(t, m, 1-b);
  37731. }
  37732. for (i = 0; i < 16; i++) {
  37733. o[2*i] = t[i] & 0xff;
  37734. o[2*i+1] = t[i]>>8;
  37735. }
  37736. }
  37737. function neq25519(a, b) {
  37738. var c = new Uint8Array(32), d = new Uint8Array(32);
  37739. pack25519(c, a);
  37740. pack25519(d, b);
  37741. return crypto_verify_32(c, 0, d, 0);
  37742. }
  37743. function par25519(a) {
  37744. var d = new Uint8Array(32);
  37745. pack25519(d, a);
  37746. return d[0] & 1;
  37747. }
  37748. function unpack25519(o, n) {
  37749. var i;
  37750. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  37751. o[15] &= 0x7fff;
  37752. }
  37753. function A(o, a, b) {
  37754. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  37755. }
  37756. function Z(o, a, b) {
  37757. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  37758. }
  37759. function M(o, a, b) {
  37760. var v, c,
  37761. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  37762. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  37763. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  37764. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  37765. b0 = b[0],
  37766. b1 = b[1],
  37767. b2 = b[2],
  37768. b3 = b[3],
  37769. b4 = b[4],
  37770. b5 = b[5],
  37771. b6 = b[6],
  37772. b7 = b[7],
  37773. b8 = b[8],
  37774. b9 = b[9],
  37775. b10 = b[10],
  37776. b11 = b[11],
  37777. b12 = b[12],
  37778. b13 = b[13],
  37779. b14 = b[14],
  37780. b15 = b[15];
  37781. v = a[0];
  37782. t0 += v * b0;
  37783. t1 += v * b1;
  37784. t2 += v * b2;
  37785. t3 += v * b3;
  37786. t4 += v * b4;
  37787. t5 += v * b5;
  37788. t6 += v * b6;
  37789. t7 += v * b7;
  37790. t8 += v * b8;
  37791. t9 += v * b9;
  37792. t10 += v * b10;
  37793. t11 += v * b11;
  37794. t12 += v * b12;
  37795. t13 += v * b13;
  37796. t14 += v * b14;
  37797. t15 += v * b15;
  37798. v = a[1];
  37799. t1 += v * b0;
  37800. t2 += v * b1;
  37801. t3 += v * b2;
  37802. t4 += v * b3;
  37803. t5 += v * b4;
  37804. t6 += v * b5;
  37805. t7 += v * b6;
  37806. t8 += v * b7;
  37807. t9 += v * b8;
  37808. t10 += v * b9;
  37809. t11 += v * b10;
  37810. t12 += v * b11;
  37811. t13 += v * b12;
  37812. t14 += v * b13;
  37813. t15 += v * b14;
  37814. t16 += v * b15;
  37815. v = a[2];
  37816. t2 += v * b0;
  37817. t3 += v * b1;
  37818. t4 += v * b2;
  37819. t5 += v * b3;
  37820. t6 += v * b4;
  37821. t7 += v * b5;
  37822. t8 += v * b6;
  37823. t9 += v * b7;
  37824. t10 += v * b8;
  37825. t11 += v * b9;
  37826. t12 += v * b10;
  37827. t13 += v * b11;
  37828. t14 += v * b12;
  37829. t15 += v * b13;
  37830. t16 += v * b14;
  37831. t17 += v * b15;
  37832. v = a[3];
  37833. t3 += v * b0;
  37834. t4 += v * b1;
  37835. t5 += v * b2;
  37836. t6 += v * b3;
  37837. t7 += v * b4;
  37838. t8 += v * b5;
  37839. t9 += v * b6;
  37840. t10 += v * b7;
  37841. t11 += v * b8;
  37842. t12 += v * b9;
  37843. t13 += v * b10;
  37844. t14 += v * b11;
  37845. t15 += v * b12;
  37846. t16 += v * b13;
  37847. t17 += v * b14;
  37848. t18 += v * b15;
  37849. v = a[4];
  37850. t4 += v * b0;
  37851. t5 += v * b1;
  37852. t6 += v * b2;
  37853. t7 += v * b3;
  37854. t8 += v * b4;
  37855. t9 += v * b5;
  37856. t10 += v * b6;
  37857. t11 += v * b7;
  37858. t12 += v * b8;
  37859. t13 += v * b9;
  37860. t14 += v * b10;
  37861. t15 += v * b11;
  37862. t16 += v * b12;
  37863. t17 += v * b13;
  37864. t18 += v * b14;
  37865. t19 += v * b15;
  37866. v = a[5];
  37867. t5 += v * b0;
  37868. t6 += v * b1;
  37869. t7 += v * b2;
  37870. t8 += v * b3;
  37871. t9 += v * b4;
  37872. t10 += v * b5;
  37873. t11 += v * b6;
  37874. t12 += v * b7;
  37875. t13 += v * b8;
  37876. t14 += v * b9;
  37877. t15 += v * b10;
  37878. t16 += v * b11;
  37879. t17 += v * b12;
  37880. t18 += v * b13;
  37881. t19 += v * b14;
  37882. t20 += v * b15;
  37883. v = a[6];
  37884. t6 += v * b0;
  37885. t7 += v * b1;
  37886. t8 += v * b2;
  37887. t9 += v * b3;
  37888. t10 += v * b4;
  37889. t11 += v * b5;
  37890. t12 += v * b6;
  37891. t13 += v * b7;
  37892. t14 += v * b8;
  37893. t15 += v * b9;
  37894. t16 += v * b10;
  37895. t17 += v * b11;
  37896. t18 += v * b12;
  37897. t19 += v * b13;
  37898. t20 += v * b14;
  37899. t21 += v * b15;
  37900. v = a[7];
  37901. t7 += v * b0;
  37902. t8 += v * b1;
  37903. t9 += v * b2;
  37904. t10 += v * b3;
  37905. t11 += v * b4;
  37906. t12 += v * b5;
  37907. t13 += v * b6;
  37908. t14 += v * b7;
  37909. t15 += v * b8;
  37910. t16 += v * b9;
  37911. t17 += v * b10;
  37912. t18 += v * b11;
  37913. t19 += v * b12;
  37914. t20 += v * b13;
  37915. t21 += v * b14;
  37916. t22 += v * b15;
  37917. v = a[8];
  37918. t8 += v * b0;
  37919. t9 += v * b1;
  37920. t10 += v * b2;
  37921. t11 += v * b3;
  37922. t12 += v * b4;
  37923. t13 += v * b5;
  37924. t14 += v * b6;
  37925. t15 += v * b7;
  37926. t16 += v * b8;
  37927. t17 += v * b9;
  37928. t18 += v * b10;
  37929. t19 += v * b11;
  37930. t20 += v * b12;
  37931. t21 += v * b13;
  37932. t22 += v * b14;
  37933. t23 += v * b15;
  37934. v = a[9];
  37935. t9 += v * b0;
  37936. t10 += v * b1;
  37937. t11 += v * b2;
  37938. t12 += v * b3;
  37939. t13 += v * b4;
  37940. t14 += v * b5;
  37941. t15 += v * b6;
  37942. t16 += v * b7;
  37943. t17 += v * b8;
  37944. t18 += v * b9;
  37945. t19 += v * b10;
  37946. t20 += v * b11;
  37947. t21 += v * b12;
  37948. t22 += v * b13;
  37949. t23 += v * b14;
  37950. t24 += v * b15;
  37951. v = a[10];
  37952. t10 += v * b0;
  37953. t11 += v * b1;
  37954. t12 += v * b2;
  37955. t13 += v * b3;
  37956. t14 += v * b4;
  37957. t15 += v * b5;
  37958. t16 += v * b6;
  37959. t17 += v * b7;
  37960. t18 += v * b8;
  37961. t19 += v * b9;
  37962. t20 += v * b10;
  37963. t21 += v * b11;
  37964. t22 += v * b12;
  37965. t23 += v * b13;
  37966. t24 += v * b14;
  37967. t25 += v * b15;
  37968. v = a[11];
  37969. t11 += v * b0;
  37970. t12 += v * b1;
  37971. t13 += v * b2;
  37972. t14 += v * b3;
  37973. t15 += v * b4;
  37974. t16 += v * b5;
  37975. t17 += v * b6;
  37976. t18 += v * b7;
  37977. t19 += v * b8;
  37978. t20 += v * b9;
  37979. t21 += v * b10;
  37980. t22 += v * b11;
  37981. t23 += v * b12;
  37982. t24 += v * b13;
  37983. t25 += v * b14;
  37984. t26 += v * b15;
  37985. v = a[12];
  37986. t12 += v * b0;
  37987. t13 += v * b1;
  37988. t14 += v * b2;
  37989. t15 += v * b3;
  37990. t16 += v * b4;
  37991. t17 += v * b5;
  37992. t18 += v * b6;
  37993. t19 += v * b7;
  37994. t20 += v * b8;
  37995. t21 += v * b9;
  37996. t22 += v * b10;
  37997. t23 += v * b11;
  37998. t24 += v * b12;
  37999. t25 += v * b13;
  38000. t26 += v * b14;
  38001. t27 += v * b15;
  38002. v = a[13];
  38003. t13 += v * b0;
  38004. t14 += v * b1;
  38005. t15 += v * b2;
  38006. t16 += v * b3;
  38007. t17 += v * b4;
  38008. t18 += v * b5;
  38009. t19 += v * b6;
  38010. t20 += v * b7;
  38011. t21 += v * b8;
  38012. t22 += v * b9;
  38013. t23 += v * b10;
  38014. t24 += v * b11;
  38015. t25 += v * b12;
  38016. t26 += v * b13;
  38017. t27 += v * b14;
  38018. t28 += v * b15;
  38019. v = a[14];
  38020. t14 += v * b0;
  38021. t15 += v * b1;
  38022. t16 += v * b2;
  38023. t17 += v * b3;
  38024. t18 += v * b4;
  38025. t19 += v * b5;
  38026. t20 += v * b6;
  38027. t21 += v * b7;
  38028. t22 += v * b8;
  38029. t23 += v * b9;
  38030. t24 += v * b10;
  38031. t25 += v * b11;
  38032. t26 += v * b12;
  38033. t27 += v * b13;
  38034. t28 += v * b14;
  38035. t29 += v * b15;
  38036. v = a[15];
  38037. t15 += v * b0;
  38038. t16 += v * b1;
  38039. t17 += v * b2;
  38040. t18 += v * b3;
  38041. t19 += v * b4;
  38042. t20 += v * b5;
  38043. t21 += v * b6;
  38044. t22 += v * b7;
  38045. t23 += v * b8;
  38046. t24 += v * b9;
  38047. t25 += v * b10;
  38048. t26 += v * b11;
  38049. t27 += v * b12;
  38050. t28 += v * b13;
  38051. t29 += v * b14;
  38052. t30 += v * b15;
  38053. t0 += 38 * t16;
  38054. t1 += 38 * t17;
  38055. t2 += 38 * t18;
  38056. t3 += 38 * t19;
  38057. t4 += 38 * t20;
  38058. t5 += 38 * t21;
  38059. t6 += 38 * t22;
  38060. t7 += 38 * t23;
  38061. t8 += 38 * t24;
  38062. t9 += 38 * t25;
  38063. t10 += 38 * t26;
  38064. t11 += 38 * t27;
  38065. t12 += 38 * t28;
  38066. t13 += 38 * t29;
  38067. t14 += 38 * t30;
  38068. // t15 left as is
  38069. // first car
  38070. c = 1;
  38071. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38072. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38073. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38074. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38075. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38076. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38077. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38078. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38079. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38080. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38081. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38082. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38083. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38084. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38085. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38086. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38087. t0 += c-1 + 37 * (c-1);
  38088. // second car
  38089. c = 1;
  38090. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38091. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38092. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38093. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38094. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38095. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38096. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38097. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38098. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38099. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38100. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38101. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38102. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38103. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38104. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38105. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38106. t0 += c-1 + 37 * (c-1);
  38107. o[ 0] = t0;
  38108. o[ 1] = t1;
  38109. o[ 2] = t2;
  38110. o[ 3] = t3;
  38111. o[ 4] = t4;
  38112. o[ 5] = t5;
  38113. o[ 6] = t6;
  38114. o[ 7] = t7;
  38115. o[ 8] = t8;
  38116. o[ 9] = t9;
  38117. o[10] = t10;
  38118. o[11] = t11;
  38119. o[12] = t12;
  38120. o[13] = t13;
  38121. o[14] = t14;
  38122. o[15] = t15;
  38123. }
  38124. function S(o, a) {
  38125. M(o, a, a);
  38126. }
  38127. function inv25519(o, i) {
  38128. var c = gf();
  38129. var a;
  38130. for (a = 0; a < 16; a++) c[a] = i[a];
  38131. for (a = 253; a >= 0; a--) {
  38132. S(c, c);
  38133. if(a !== 2 && a !== 4) M(c, c, i);
  38134. }
  38135. for (a = 0; a < 16; a++) o[a] = c[a];
  38136. }
  38137. function pow2523(o, i) {
  38138. var c = gf();
  38139. var a;
  38140. for (a = 0; a < 16; a++) c[a] = i[a];
  38141. for (a = 250; a >= 0; a--) {
  38142. S(c, c);
  38143. if(a !== 1) M(c, c, i);
  38144. }
  38145. for (a = 0; a < 16; a++) o[a] = c[a];
  38146. }
  38147. function crypto_scalarmult(q, n, p) {
  38148. var z = new Uint8Array(32);
  38149. var x = new Float64Array(80), r, i;
  38150. var a = gf(), b = gf(), c = gf(),
  38151. d = gf(), e = gf(), f = gf();
  38152. for (i = 0; i < 31; i++) z[i] = n[i];
  38153. z[31]=(n[31]&127)|64;
  38154. z[0]&=248;
  38155. unpack25519(x,p);
  38156. for (i = 0; i < 16; i++) {
  38157. b[i]=x[i];
  38158. d[i]=a[i]=c[i]=0;
  38159. }
  38160. a[0]=d[0]=1;
  38161. for (i=254; i>=0; --i) {
  38162. r=(z[i>>>3]>>>(i&7))&1;
  38163. sel25519(a,b,r);
  38164. sel25519(c,d,r);
  38165. A(e,a,c);
  38166. Z(a,a,c);
  38167. A(c,b,d);
  38168. Z(b,b,d);
  38169. S(d,e);
  38170. S(f,a);
  38171. M(a,c,a);
  38172. M(c,b,e);
  38173. A(e,a,c);
  38174. Z(a,a,c);
  38175. S(b,a);
  38176. Z(c,d,f);
  38177. M(a,c,_121665);
  38178. A(a,a,d);
  38179. M(c,c,a);
  38180. M(a,d,f);
  38181. M(d,b,x);
  38182. S(b,e);
  38183. sel25519(a,b,r);
  38184. sel25519(c,d,r);
  38185. }
  38186. for (i = 0; i < 16; i++) {
  38187. x[i+16]=a[i];
  38188. x[i+32]=c[i];
  38189. x[i+48]=b[i];
  38190. x[i+64]=d[i];
  38191. }
  38192. var x32 = x.subarray(32);
  38193. var x16 = x.subarray(16);
  38194. inv25519(x32,x32);
  38195. M(x16,x16,x32);
  38196. pack25519(q,x16);
  38197. return 0;
  38198. }
  38199. function crypto_scalarmult_base(q, n) {
  38200. return crypto_scalarmult(q, n, _9);
  38201. }
  38202. function crypto_box_keypair(y, x) {
  38203. randombytes(x, 32);
  38204. return crypto_scalarmult_base(y, x);
  38205. }
  38206. function crypto_box_beforenm(k, y, x) {
  38207. var s = new Uint8Array(32);
  38208. crypto_scalarmult(s, x, y);
  38209. return crypto_core_hsalsa20(k, _0, s, sigma);
  38210. }
  38211. var crypto_box_afternm = crypto_secretbox;
  38212. var crypto_box_open_afternm = crypto_secretbox_open;
  38213. function crypto_box(c, m, d, n, y, x) {
  38214. var k = new Uint8Array(32);
  38215. crypto_box_beforenm(k, y, x);
  38216. return crypto_box_afternm(c, m, d, n, k);
  38217. }
  38218. function crypto_box_open(m, c, d, n, y, x) {
  38219. var k = new Uint8Array(32);
  38220. crypto_box_beforenm(k, y, x);
  38221. return crypto_box_open_afternm(m, c, d, n, k);
  38222. }
  38223. var K = [
  38224. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  38225. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  38226. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  38227. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  38228. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  38229. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  38230. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  38231. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  38232. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  38233. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  38234. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  38235. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  38236. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  38237. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  38238. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  38239. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  38240. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  38241. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  38242. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  38243. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  38244. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  38245. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  38246. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  38247. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  38248. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  38249. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  38250. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  38251. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  38252. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  38253. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  38254. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  38255. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  38256. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  38257. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  38258. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  38259. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  38260. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  38261. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  38262. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  38263. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  38264. ];
  38265. function crypto_hashblocks_hl(hh, hl, m, n) {
  38266. var wh = new Int32Array(16), wl = new Int32Array(16),
  38267. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  38268. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  38269. th, tl, i, j, h, l, a, b, c, d;
  38270. var ah0 = hh[0],
  38271. ah1 = hh[1],
  38272. ah2 = hh[2],
  38273. ah3 = hh[3],
  38274. ah4 = hh[4],
  38275. ah5 = hh[5],
  38276. ah6 = hh[6],
  38277. ah7 = hh[7],
  38278. al0 = hl[0],
  38279. al1 = hl[1],
  38280. al2 = hl[2],
  38281. al3 = hl[3],
  38282. al4 = hl[4],
  38283. al5 = hl[5],
  38284. al6 = hl[6],
  38285. al7 = hl[7];
  38286. var pos = 0;
  38287. while (n >= 128) {
  38288. for (i = 0; i < 16; i++) {
  38289. j = 8 * i + pos;
  38290. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  38291. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  38292. }
  38293. for (i = 0; i < 80; i++) {
  38294. bh0 = ah0;
  38295. bh1 = ah1;
  38296. bh2 = ah2;
  38297. bh3 = ah3;
  38298. bh4 = ah4;
  38299. bh5 = ah5;
  38300. bh6 = ah6;
  38301. bh7 = ah7;
  38302. bl0 = al0;
  38303. bl1 = al1;
  38304. bl2 = al2;
  38305. bl3 = al3;
  38306. bl4 = al4;
  38307. bl5 = al5;
  38308. bl6 = al6;
  38309. bl7 = al7;
  38310. // add
  38311. h = ah7;
  38312. l = al7;
  38313. a = l & 0xffff; b = l >>> 16;
  38314. c = h & 0xffff; d = h >>> 16;
  38315. // Sigma1
  38316. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  38317. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  38318. a += l & 0xffff; b += l >>> 16;
  38319. c += h & 0xffff; d += h >>> 16;
  38320. // Ch
  38321. h = (ah4 & ah5) ^ (~ah4 & ah6);
  38322. l = (al4 & al5) ^ (~al4 & al6);
  38323. a += l & 0xffff; b += l >>> 16;
  38324. c += h & 0xffff; d += h >>> 16;
  38325. // K
  38326. h = K[i*2];
  38327. l = K[i*2+1];
  38328. a += l & 0xffff; b += l >>> 16;
  38329. c += h & 0xffff; d += h >>> 16;
  38330. // w
  38331. h = wh[i%16];
  38332. l = wl[i%16];
  38333. a += l & 0xffff; b += l >>> 16;
  38334. c += h & 0xffff; d += h >>> 16;
  38335. b += a >>> 16;
  38336. c += b >>> 16;
  38337. d += c >>> 16;
  38338. th = c & 0xffff | d << 16;
  38339. tl = a & 0xffff | b << 16;
  38340. // add
  38341. h = th;
  38342. l = tl;
  38343. a = l & 0xffff; b = l >>> 16;
  38344. c = h & 0xffff; d = h >>> 16;
  38345. // Sigma0
  38346. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  38347. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  38348. a += l & 0xffff; b += l >>> 16;
  38349. c += h & 0xffff; d += h >>> 16;
  38350. // Maj
  38351. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  38352. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  38353. a += l & 0xffff; b += l >>> 16;
  38354. c += h & 0xffff; d += h >>> 16;
  38355. b += a >>> 16;
  38356. c += b >>> 16;
  38357. d += c >>> 16;
  38358. bh7 = (c & 0xffff) | (d << 16);
  38359. bl7 = (a & 0xffff) | (b << 16);
  38360. // add
  38361. h = bh3;
  38362. l = bl3;
  38363. a = l & 0xffff; b = l >>> 16;
  38364. c = h & 0xffff; d = h >>> 16;
  38365. h = th;
  38366. l = tl;
  38367. a += l & 0xffff; b += l >>> 16;
  38368. c += h & 0xffff; d += h >>> 16;
  38369. b += a >>> 16;
  38370. c += b >>> 16;
  38371. d += c >>> 16;
  38372. bh3 = (c & 0xffff) | (d << 16);
  38373. bl3 = (a & 0xffff) | (b << 16);
  38374. ah1 = bh0;
  38375. ah2 = bh1;
  38376. ah3 = bh2;
  38377. ah4 = bh3;
  38378. ah5 = bh4;
  38379. ah6 = bh5;
  38380. ah7 = bh6;
  38381. ah0 = bh7;
  38382. al1 = bl0;
  38383. al2 = bl1;
  38384. al3 = bl2;
  38385. al4 = bl3;
  38386. al5 = bl4;
  38387. al6 = bl5;
  38388. al7 = bl6;
  38389. al0 = bl7;
  38390. if (i%16 === 15) {
  38391. for (j = 0; j < 16; j++) {
  38392. // add
  38393. h = wh[j];
  38394. l = wl[j];
  38395. a = l & 0xffff; b = l >>> 16;
  38396. c = h & 0xffff; d = h >>> 16;
  38397. h = wh[(j+9)%16];
  38398. l = wl[(j+9)%16];
  38399. a += l & 0xffff; b += l >>> 16;
  38400. c += h & 0xffff; d += h >>> 16;
  38401. // sigma0
  38402. th = wh[(j+1)%16];
  38403. tl = wl[(j+1)%16];
  38404. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  38405. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  38406. a += l & 0xffff; b += l >>> 16;
  38407. c += h & 0xffff; d += h >>> 16;
  38408. // sigma1
  38409. th = wh[(j+14)%16];
  38410. tl = wl[(j+14)%16];
  38411. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  38412. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  38413. a += l & 0xffff; b += l >>> 16;
  38414. c += h & 0xffff; d += h >>> 16;
  38415. b += a >>> 16;
  38416. c += b >>> 16;
  38417. d += c >>> 16;
  38418. wh[j] = (c & 0xffff) | (d << 16);
  38419. wl[j] = (a & 0xffff) | (b << 16);
  38420. }
  38421. }
  38422. }
  38423. // add
  38424. h = ah0;
  38425. l = al0;
  38426. a = l & 0xffff; b = l >>> 16;
  38427. c = h & 0xffff; d = h >>> 16;
  38428. h = hh[0];
  38429. l = hl[0];
  38430. a += l & 0xffff; b += l >>> 16;
  38431. c += h & 0xffff; d += h >>> 16;
  38432. b += a >>> 16;
  38433. c += b >>> 16;
  38434. d += c >>> 16;
  38435. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  38436. hl[0] = al0 = (a & 0xffff) | (b << 16);
  38437. h = ah1;
  38438. l = al1;
  38439. a = l & 0xffff; b = l >>> 16;
  38440. c = h & 0xffff; d = h >>> 16;
  38441. h = hh[1];
  38442. l = hl[1];
  38443. a += l & 0xffff; b += l >>> 16;
  38444. c += h & 0xffff; d += h >>> 16;
  38445. b += a >>> 16;
  38446. c += b >>> 16;
  38447. d += c >>> 16;
  38448. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  38449. hl[1] = al1 = (a & 0xffff) | (b << 16);
  38450. h = ah2;
  38451. l = al2;
  38452. a = l & 0xffff; b = l >>> 16;
  38453. c = h & 0xffff; d = h >>> 16;
  38454. h = hh[2];
  38455. l = hl[2];
  38456. a += l & 0xffff; b += l >>> 16;
  38457. c += h & 0xffff; d += h >>> 16;
  38458. b += a >>> 16;
  38459. c += b >>> 16;
  38460. d += c >>> 16;
  38461. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  38462. hl[2] = al2 = (a & 0xffff) | (b << 16);
  38463. h = ah3;
  38464. l = al3;
  38465. a = l & 0xffff; b = l >>> 16;
  38466. c = h & 0xffff; d = h >>> 16;
  38467. h = hh[3];
  38468. l = hl[3];
  38469. a += l & 0xffff; b += l >>> 16;
  38470. c += h & 0xffff; d += h >>> 16;
  38471. b += a >>> 16;
  38472. c += b >>> 16;
  38473. d += c >>> 16;
  38474. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  38475. hl[3] = al3 = (a & 0xffff) | (b << 16);
  38476. h = ah4;
  38477. l = al4;
  38478. a = l & 0xffff; b = l >>> 16;
  38479. c = h & 0xffff; d = h >>> 16;
  38480. h = hh[4];
  38481. l = hl[4];
  38482. a += l & 0xffff; b += l >>> 16;
  38483. c += h & 0xffff; d += h >>> 16;
  38484. b += a >>> 16;
  38485. c += b >>> 16;
  38486. d += c >>> 16;
  38487. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  38488. hl[4] = al4 = (a & 0xffff) | (b << 16);
  38489. h = ah5;
  38490. l = al5;
  38491. a = l & 0xffff; b = l >>> 16;
  38492. c = h & 0xffff; d = h >>> 16;
  38493. h = hh[5];
  38494. l = hl[5];
  38495. a += l & 0xffff; b += l >>> 16;
  38496. c += h & 0xffff; d += h >>> 16;
  38497. b += a >>> 16;
  38498. c += b >>> 16;
  38499. d += c >>> 16;
  38500. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  38501. hl[5] = al5 = (a & 0xffff) | (b << 16);
  38502. h = ah6;
  38503. l = al6;
  38504. a = l & 0xffff; b = l >>> 16;
  38505. c = h & 0xffff; d = h >>> 16;
  38506. h = hh[6];
  38507. l = hl[6];
  38508. a += l & 0xffff; b += l >>> 16;
  38509. c += h & 0xffff; d += h >>> 16;
  38510. b += a >>> 16;
  38511. c += b >>> 16;
  38512. d += c >>> 16;
  38513. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  38514. hl[6] = al6 = (a & 0xffff) | (b << 16);
  38515. h = ah7;
  38516. l = al7;
  38517. a = l & 0xffff; b = l >>> 16;
  38518. c = h & 0xffff; d = h >>> 16;
  38519. h = hh[7];
  38520. l = hl[7];
  38521. a += l & 0xffff; b += l >>> 16;
  38522. c += h & 0xffff; d += h >>> 16;
  38523. b += a >>> 16;
  38524. c += b >>> 16;
  38525. d += c >>> 16;
  38526. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  38527. hl[7] = al7 = (a & 0xffff) | (b << 16);
  38528. pos += 128;
  38529. n -= 128;
  38530. }
  38531. return n;
  38532. }
  38533. function crypto_hash(out, m, n) {
  38534. var hh = new Int32Array(8),
  38535. hl = new Int32Array(8),
  38536. x = new Uint8Array(256),
  38537. i, b = n;
  38538. hh[0] = 0x6a09e667;
  38539. hh[1] = 0xbb67ae85;
  38540. hh[2] = 0x3c6ef372;
  38541. hh[3] = 0xa54ff53a;
  38542. hh[4] = 0x510e527f;
  38543. hh[5] = 0x9b05688c;
  38544. hh[6] = 0x1f83d9ab;
  38545. hh[7] = 0x5be0cd19;
  38546. hl[0] = 0xf3bcc908;
  38547. hl[1] = 0x84caa73b;
  38548. hl[2] = 0xfe94f82b;
  38549. hl[3] = 0x5f1d36f1;
  38550. hl[4] = 0xade682d1;
  38551. hl[5] = 0x2b3e6c1f;
  38552. hl[6] = 0xfb41bd6b;
  38553. hl[7] = 0x137e2179;
  38554. crypto_hashblocks_hl(hh, hl, m, n);
  38555. n %= 128;
  38556. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  38557. x[n] = 128;
  38558. n = 256-128*(n<112?1:0);
  38559. x[n-9] = 0;
  38560. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  38561. crypto_hashblocks_hl(hh, hl, x, n);
  38562. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  38563. return 0;
  38564. }
  38565. function add(p, q) {
  38566. var a = gf(), b = gf(), c = gf(),
  38567. d = gf(), e = gf(), f = gf(),
  38568. g = gf(), h = gf(), t = gf();
  38569. Z(a, p[1], p[0]);
  38570. Z(t, q[1], q[0]);
  38571. M(a, a, t);
  38572. A(b, p[0], p[1]);
  38573. A(t, q[0], q[1]);
  38574. M(b, b, t);
  38575. M(c, p[3], q[3]);
  38576. M(c, c, D2);
  38577. M(d, p[2], q[2]);
  38578. A(d, d, d);
  38579. Z(e, b, a);
  38580. Z(f, d, c);
  38581. A(g, d, c);
  38582. A(h, b, a);
  38583. M(p[0], e, f);
  38584. M(p[1], h, g);
  38585. M(p[2], g, f);
  38586. M(p[3], e, h);
  38587. }
  38588. function cswap(p, q, b) {
  38589. var i;
  38590. for (i = 0; i < 4; i++) {
  38591. sel25519(p[i], q[i], b);
  38592. }
  38593. }
  38594. function pack(r, p) {
  38595. var tx = gf(), ty = gf(), zi = gf();
  38596. inv25519(zi, p[2]);
  38597. M(tx, p[0], zi);
  38598. M(ty, p[1], zi);
  38599. pack25519(r, ty);
  38600. r[31] ^= par25519(tx) << 7;
  38601. }
  38602. function scalarmult(p, q, s) {
  38603. var b, i;
  38604. set25519(p[0], gf0);
  38605. set25519(p[1], gf1);
  38606. set25519(p[2], gf1);
  38607. set25519(p[3], gf0);
  38608. for (i = 255; i >= 0; --i) {
  38609. b = (s[(i/8)|0] >> (i&7)) & 1;
  38610. cswap(p, q, b);
  38611. add(q, p);
  38612. add(p, p);
  38613. cswap(p, q, b);
  38614. }
  38615. }
  38616. function scalarbase(p, s) {
  38617. var q = [gf(), gf(), gf(), gf()];
  38618. set25519(q[0], X);
  38619. set25519(q[1], Y);
  38620. set25519(q[2], gf1);
  38621. M(q[3], X, Y);
  38622. scalarmult(p, q, s);
  38623. }
  38624. function crypto_sign_keypair(pk, sk, seeded) {
  38625. var d = new Uint8Array(64);
  38626. var p = [gf(), gf(), gf(), gf()];
  38627. var i;
  38628. if (!seeded) randombytes(sk, 32);
  38629. crypto_hash(d, sk, 32);
  38630. d[0] &= 248;
  38631. d[31] &= 127;
  38632. d[31] |= 64;
  38633. scalarbase(p, d);
  38634. pack(pk, p);
  38635. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  38636. return 0;
  38637. }
  38638. 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]);
  38639. function modL(r, x) {
  38640. var carry, i, j, k;
  38641. for (i = 63; i >= 32; --i) {
  38642. carry = 0;
  38643. for (j = i - 32, k = i - 12; j < k; ++j) {
  38644. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  38645. carry = (x[j] + 128) >> 8;
  38646. x[j] -= carry * 256;
  38647. }
  38648. x[j] += carry;
  38649. x[i] = 0;
  38650. }
  38651. carry = 0;
  38652. for (j = 0; j < 32; j++) {
  38653. x[j] += carry - (x[31] >> 4) * L[j];
  38654. carry = x[j] >> 8;
  38655. x[j] &= 255;
  38656. }
  38657. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  38658. for (i = 0; i < 32; i++) {
  38659. x[i+1] += x[i] >> 8;
  38660. r[i] = x[i] & 255;
  38661. }
  38662. }
  38663. function reduce(r) {
  38664. var x = new Float64Array(64), i;
  38665. for (i = 0; i < 64; i++) x[i] = r[i];
  38666. for (i = 0; i < 64; i++) r[i] = 0;
  38667. modL(r, x);
  38668. }
  38669. // Note: difference from C - smlen returned, not passed as argument.
  38670. function crypto_sign(sm, m, n, sk) {
  38671. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  38672. var i, j, x = new Float64Array(64);
  38673. var p = [gf(), gf(), gf(), gf()];
  38674. crypto_hash(d, sk, 32);
  38675. d[0] &= 248;
  38676. d[31] &= 127;
  38677. d[31] |= 64;
  38678. var smlen = n + 64;
  38679. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  38680. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  38681. crypto_hash(r, sm.subarray(32), n+32);
  38682. reduce(r);
  38683. scalarbase(p, r);
  38684. pack(sm, p);
  38685. for (i = 32; i < 64; i++) sm[i] = sk[i];
  38686. crypto_hash(h, sm, n + 64);
  38687. reduce(h);
  38688. for (i = 0; i < 64; i++) x[i] = 0;
  38689. for (i = 0; i < 32; i++) x[i] = r[i];
  38690. for (i = 0; i < 32; i++) {
  38691. for (j = 0; j < 32; j++) {
  38692. x[i+j] += h[i] * d[j];
  38693. }
  38694. }
  38695. modL(sm.subarray(32), x);
  38696. return smlen;
  38697. }
  38698. function unpackneg(r, p) {
  38699. var t = gf(), chk = gf(), num = gf(),
  38700. den = gf(), den2 = gf(), den4 = gf(),
  38701. den6 = gf();
  38702. set25519(r[2], gf1);
  38703. unpack25519(r[1], p);
  38704. S(num, r[1]);
  38705. M(den, num, D);
  38706. Z(num, num, r[2]);
  38707. A(den, r[2], den);
  38708. S(den2, den);
  38709. S(den4, den2);
  38710. M(den6, den4, den2);
  38711. M(t, den6, num);
  38712. M(t, t, den);
  38713. pow2523(t, t);
  38714. M(t, t, num);
  38715. M(t, t, den);
  38716. M(t, t, den);
  38717. M(r[0], t, den);
  38718. S(chk, r[0]);
  38719. M(chk, chk, den);
  38720. if (neq25519(chk, num)) M(r[0], r[0], I);
  38721. S(chk, r[0]);
  38722. M(chk, chk, den);
  38723. if (neq25519(chk, num)) return -1;
  38724. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  38725. M(r[3], r[0], r[1]);
  38726. return 0;
  38727. }
  38728. function crypto_sign_open(m, sm, n, pk) {
  38729. var i, mlen;
  38730. var t = new Uint8Array(32), h = new Uint8Array(64);
  38731. var p = [gf(), gf(), gf(), gf()],
  38732. q = [gf(), gf(), gf(), gf()];
  38733. mlen = -1;
  38734. if (n < 64) return -1;
  38735. if (unpackneg(q, pk)) return -1;
  38736. for (i = 0; i < n; i++) m[i] = sm[i];
  38737. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  38738. crypto_hash(h, m, n);
  38739. reduce(h);
  38740. scalarmult(p, q, h);
  38741. scalarbase(q, sm.subarray(32));
  38742. add(p, q);
  38743. pack(t, p);
  38744. n -= 64;
  38745. if (crypto_verify_32(sm, 0, t, 0)) {
  38746. for (i = 0; i < n; i++) m[i] = 0;
  38747. return -1;
  38748. }
  38749. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  38750. mlen = n;
  38751. return mlen;
  38752. }
  38753. var crypto_secretbox_KEYBYTES = 32,
  38754. crypto_secretbox_NONCEBYTES = 24,
  38755. crypto_secretbox_ZEROBYTES = 32,
  38756. crypto_secretbox_BOXZEROBYTES = 16,
  38757. crypto_scalarmult_BYTES = 32,
  38758. crypto_scalarmult_SCALARBYTES = 32,
  38759. crypto_box_PUBLICKEYBYTES = 32,
  38760. crypto_box_SECRETKEYBYTES = 32,
  38761. crypto_box_BEFORENMBYTES = 32,
  38762. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  38763. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  38764. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  38765. crypto_sign_BYTES = 64,
  38766. crypto_sign_PUBLICKEYBYTES = 32,
  38767. crypto_sign_SECRETKEYBYTES = 64,
  38768. crypto_sign_SEEDBYTES = 32,
  38769. crypto_hash_BYTES = 64;
  38770. nacl.lowlevel = {
  38771. crypto_core_hsalsa20: crypto_core_hsalsa20,
  38772. crypto_stream_xor: crypto_stream_xor,
  38773. crypto_stream: crypto_stream,
  38774. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  38775. crypto_stream_salsa20: crypto_stream_salsa20,
  38776. crypto_onetimeauth: crypto_onetimeauth,
  38777. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  38778. crypto_verify_16: crypto_verify_16,
  38779. crypto_verify_32: crypto_verify_32,
  38780. crypto_secretbox: crypto_secretbox,
  38781. crypto_secretbox_open: crypto_secretbox_open,
  38782. crypto_scalarmult: crypto_scalarmult,
  38783. crypto_scalarmult_base: crypto_scalarmult_base,
  38784. crypto_box_beforenm: crypto_box_beforenm,
  38785. crypto_box_afternm: crypto_box_afternm,
  38786. crypto_box: crypto_box,
  38787. crypto_box_open: crypto_box_open,
  38788. crypto_box_keypair: crypto_box_keypair,
  38789. crypto_hash: crypto_hash,
  38790. crypto_sign: crypto_sign,
  38791. crypto_sign_keypair: crypto_sign_keypair,
  38792. crypto_sign_open: crypto_sign_open,
  38793. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  38794. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  38795. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  38796. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  38797. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  38798. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  38799. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  38800. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  38801. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  38802. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  38803. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  38804. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  38805. crypto_sign_BYTES: crypto_sign_BYTES,
  38806. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  38807. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  38808. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  38809. crypto_hash_BYTES: crypto_hash_BYTES
  38810. };
  38811. /* High-level API */
  38812. function checkLengths(k, n) {
  38813. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  38814. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  38815. }
  38816. function checkBoxLengths(pk, sk) {
  38817. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  38818. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  38819. }
  38820. function checkArrayTypes() {
  38821. for (var i = 0; i < arguments.length; i++) {
  38822. if (!(arguments[i] instanceof Uint8Array))
  38823. throw new TypeError('unexpected type, use Uint8Array');
  38824. }
  38825. }
  38826. function cleanup(arr) {
  38827. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  38828. }
  38829. nacl.randomBytes = function(n) {
  38830. var b = new Uint8Array(n);
  38831. randombytes(b, n);
  38832. return b;
  38833. };
  38834. nacl.secretbox = function(msg, nonce, key) {
  38835. checkArrayTypes(msg, nonce, key);
  38836. checkLengths(key, nonce);
  38837. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  38838. var c = new Uint8Array(m.length);
  38839. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  38840. crypto_secretbox(c, m, m.length, nonce, key);
  38841. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  38842. };
  38843. nacl.secretbox.open = function(box, nonce, key) {
  38844. checkArrayTypes(box, nonce, key);
  38845. checkLengths(key, nonce);
  38846. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  38847. var m = new Uint8Array(c.length);
  38848. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  38849. if (c.length < 32) return null;
  38850. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  38851. return m.subarray(crypto_secretbox_ZEROBYTES);
  38852. };
  38853. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  38854. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  38855. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  38856. nacl.scalarMult = function(n, p) {
  38857. checkArrayTypes(n, p);
  38858. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38859. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  38860. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38861. crypto_scalarmult(q, n, p);
  38862. return q;
  38863. };
  38864. nacl.scalarMult.base = function(n) {
  38865. checkArrayTypes(n);
  38866. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38867. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38868. crypto_scalarmult_base(q, n);
  38869. return q;
  38870. };
  38871. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  38872. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  38873. nacl.box = function(msg, nonce, publicKey, secretKey) {
  38874. var k = nacl.box.before(publicKey, secretKey);
  38875. return nacl.secretbox(msg, nonce, k);
  38876. };
  38877. nacl.box.before = function(publicKey, secretKey) {
  38878. checkArrayTypes(publicKey, secretKey);
  38879. checkBoxLengths(publicKey, secretKey);
  38880. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  38881. crypto_box_beforenm(k, publicKey, secretKey);
  38882. return k;
  38883. };
  38884. nacl.box.after = nacl.secretbox;
  38885. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  38886. var k = nacl.box.before(publicKey, secretKey);
  38887. return nacl.secretbox.open(msg, nonce, k);
  38888. };
  38889. nacl.box.open.after = nacl.secretbox.open;
  38890. nacl.box.keyPair = function() {
  38891. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38892. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  38893. crypto_box_keypair(pk, sk);
  38894. return {publicKey: pk, secretKey: sk};
  38895. };
  38896. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  38897. checkArrayTypes(secretKey);
  38898. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  38899. throw new Error('bad secret key size');
  38900. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38901. crypto_scalarmult_base(pk, secretKey);
  38902. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38903. };
  38904. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  38905. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  38906. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  38907. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  38908. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  38909. nacl.sign = function(msg, secretKey) {
  38910. checkArrayTypes(msg, secretKey);
  38911. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38912. throw new Error('bad secret key size');
  38913. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  38914. crypto_sign(signedMsg, msg, msg.length, secretKey);
  38915. return signedMsg;
  38916. };
  38917. nacl.sign.open = function(signedMsg, publicKey) {
  38918. checkArrayTypes(signedMsg, publicKey);
  38919. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38920. throw new Error('bad public key size');
  38921. var tmp = new Uint8Array(signedMsg.length);
  38922. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  38923. if (mlen < 0) return null;
  38924. var m = new Uint8Array(mlen);
  38925. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  38926. return m;
  38927. };
  38928. nacl.sign.detached = function(msg, secretKey) {
  38929. var signedMsg = nacl.sign(msg, secretKey);
  38930. var sig = new Uint8Array(crypto_sign_BYTES);
  38931. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  38932. return sig;
  38933. };
  38934. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  38935. checkArrayTypes(msg, sig, publicKey);
  38936. if (sig.length !== crypto_sign_BYTES)
  38937. throw new Error('bad signature size');
  38938. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38939. throw new Error('bad public key size');
  38940. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  38941. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  38942. var i;
  38943. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  38944. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  38945. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  38946. };
  38947. nacl.sign.keyPair = function() {
  38948. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38949. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38950. crypto_sign_keypair(pk, sk);
  38951. return {publicKey: pk, secretKey: sk};
  38952. };
  38953. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  38954. checkArrayTypes(secretKey);
  38955. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38956. throw new Error('bad secret key size');
  38957. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38958. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  38959. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38960. };
  38961. nacl.sign.keyPair.fromSeed = function(seed) {
  38962. checkArrayTypes(seed);
  38963. if (seed.length !== crypto_sign_SEEDBYTES)
  38964. throw new Error('bad seed size');
  38965. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38966. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38967. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  38968. crypto_sign_keypair(pk, sk, true);
  38969. return {publicKey: pk, secretKey: sk};
  38970. };
  38971. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  38972. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  38973. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  38974. nacl.sign.signatureLength = crypto_sign_BYTES;
  38975. nacl.hash = function(msg) {
  38976. checkArrayTypes(msg);
  38977. var h = new Uint8Array(crypto_hash_BYTES);
  38978. crypto_hash(h, msg, msg.length);
  38979. return h;
  38980. };
  38981. nacl.hash.hashLength = crypto_hash_BYTES;
  38982. nacl.verify = function(x, y) {
  38983. checkArrayTypes(x, y);
  38984. // Zero length arguments are considered not equal.
  38985. if (x.length === 0 || y.length === 0) return false;
  38986. if (x.length !== y.length) return false;
  38987. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  38988. };
  38989. nacl.setPRNG = function(fn) {
  38990. randombytes = fn;
  38991. };
  38992. (function() {
  38993. // Initialize PRNG if environment provides CSPRNG.
  38994. // If not, methods calling randombytes will throw.
  38995. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  38996. if (crypto && crypto.getRandomValues) {
  38997. // Browsers.
  38998. var QUOTA = 65536;
  38999. nacl.setPRNG(function(x, n) {
  39000. var i, v = new Uint8Array(n);
  39001. for (i = 0; i < n; i += QUOTA) {
  39002. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  39003. }
  39004. for (i = 0; i < n; i++) x[i] = v[i];
  39005. cleanup(v);
  39006. });
  39007. } else if (true) {
  39008. // Node.js.
  39009. crypto = __webpack_require__(3);
  39010. if (crypto && crypto.randomBytes) {
  39011. nacl.setPRNG(function(x, n) {
  39012. var i, v = crypto.randomBytes(n);
  39013. for (i = 0; i < n; i++) x[i] = v[i];
  39014. cleanup(v);
  39015. });
  39016. }
  39017. }
  39018. })();
  39019. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  39020. /***/ }),
  39021. /* 1 */
  39022. /***/ (function(module, exports, __webpack_require__) {
  39023. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  39024. // Public domain.
  39025. (function(root, f) {
  39026. 'use strict';
  39027. if ( true && module.exports) module.exports = f();
  39028. else if (root.nacl) root.nacl.util = f();
  39029. else {
  39030. root.nacl = {};
  39031. root.nacl.util = f();
  39032. }
  39033. }(this, function() {
  39034. 'use strict';
  39035. var util = {};
  39036. function validateBase64(s) {
  39037. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  39038. throw new TypeError('invalid encoding');
  39039. }
  39040. }
  39041. util.decodeUTF8 = function(s) {
  39042. if (typeof s !== 'string') throw new TypeError('expected string');
  39043. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  39044. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39045. return b;
  39046. };
  39047. util.encodeUTF8 = function(arr) {
  39048. var i, s = [];
  39049. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  39050. return decodeURIComponent(escape(s.join('')));
  39051. };
  39052. if (typeof atob === 'undefined') {
  39053. // Node.js
  39054. if (typeof Buffer.from !== 'undefined') {
  39055. // Node v6 and later
  39056. util.encodeBase64 = function (arr) { // v6 and later
  39057. return Buffer.from(arr).toString('base64');
  39058. };
  39059. util.decodeBase64 = function (s) {
  39060. validateBase64(s);
  39061. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  39062. };
  39063. } else {
  39064. // Node earlier than v6
  39065. util.encodeBase64 = function (arr) { // v6 and later
  39066. return (new Buffer(arr)).toString('base64');
  39067. };
  39068. util.decodeBase64 = function(s) {
  39069. validateBase64(s);
  39070. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  39071. };
  39072. }
  39073. } else {
  39074. // Browsers
  39075. util.encodeBase64 = function(arr) {
  39076. var i, s = [], len = arr.length;
  39077. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  39078. return btoa(s.join(''));
  39079. };
  39080. util.decodeBase64 = function(s) {
  39081. validateBase64(s);
  39082. var i, d = atob(s), b = new Uint8Array(d.length);
  39083. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39084. return b;
  39085. };
  39086. }
  39087. return util;
  39088. }));
  39089. /***/ }),
  39090. /* 2 */
  39091. /***/ (function(module, exports, __webpack_require__) {
  39092. // required so we don't have to do require('pusher').default etc.
  39093. module.exports = __webpack_require__(4).default;
  39094. /***/ }),
  39095. /* 3 */
  39096. /***/ (function(module, exports) {
  39097. /* (ignored) */
  39098. /***/ }),
  39099. /* 4 */
  39100. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  39101. "use strict";
  39102. __webpack_require__.r(__webpack_exports__);
  39103. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  39104. var ScriptReceiverFactory = (function () {
  39105. function ScriptReceiverFactory(prefix, name) {
  39106. this.lastId = 0;
  39107. this.prefix = prefix;
  39108. this.name = name;
  39109. }
  39110. ScriptReceiverFactory.prototype.create = function (callback) {
  39111. this.lastId++;
  39112. var number = this.lastId;
  39113. var id = this.prefix + number;
  39114. var name = this.name + "[" + number + "]";
  39115. var called = false;
  39116. var callbackWrapper = function () {
  39117. if (!called) {
  39118. callback.apply(null, arguments);
  39119. called = true;
  39120. }
  39121. };
  39122. this[number] = callbackWrapper;
  39123. return { number: number, id: id, name: name, callback: callbackWrapper };
  39124. };
  39125. ScriptReceiverFactory.prototype.remove = function (receiver) {
  39126. delete this[receiver.number];
  39127. };
  39128. return ScriptReceiverFactory;
  39129. }());
  39130. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  39131. // CONCATENATED MODULE: ./src/core/defaults.ts
  39132. var Defaults = {
  39133. VERSION: "5.0.3",
  39134. PROTOCOL: 7,
  39135. host: 'ws.pusherapp.com',
  39136. ws_port: 80,
  39137. wss_port: 443,
  39138. ws_path: '',
  39139. sockjs_host: 'sockjs.pusher.com',
  39140. sockjs_http_port: 80,
  39141. sockjs_https_port: 443,
  39142. sockjs_path: '/pusher',
  39143. stats_host: 'stats.pusher.com',
  39144. channel_auth_endpoint: '/pusher/auth',
  39145. channel_auth_transport: 'ajax',
  39146. activity_timeout: 120000,
  39147. pong_timeout: 30000,
  39148. unavailable_timeout: 10000,
  39149. cdn_http: "http://js.pusher.com",
  39150. cdn_https: "https://js.pusher.com",
  39151. dependency_suffix: ""
  39152. };
  39153. /* harmony default export */ var defaults = (Defaults);
  39154. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  39155. var dependency_loader_DependencyLoader = (function () {
  39156. function DependencyLoader(options) {
  39157. this.options = options;
  39158. this.receivers = options.receivers || ScriptReceivers;
  39159. this.loading = {};
  39160. }
  39161. DependencyLoader.prototype.load = function (name, options, callback) {
  39162. var self = this;
  39163. if (self.loading[name] && self.loading[name].length > 0) {
  39164. self.loading[name].push(callback);
  39165. }
  39166. else {
  39167. self.loading[name] = [callback];
  39168. var request = runtime.createScriptRequest(self.getPath(name, options));
  39169. var receiver = self.receivers.create(function (error) {
  39170. self.receivers.remove(receiver);
  39171. if (self.loading[name]) {
  39172. var callbacks = self.loading[name];
  39173. delete self.loading[name];
  39174. var successCallback = function (wasSuccessful) {
  39175. if (!wasSuccessful) {
  39176. request.cleanup();
  39177. }
  39178. };
  39179. for (var i = 0; i < callbacks.length; i++) {
  39180. callbacks[i](error, successCallback);
  39181. }
  39182. }
  39183. });
  39184. request.send(receiver);
  39185. }
  39186. };
  39187. DependencyLoader.prototype.getRoot = function (options) {
  39188. var cdn;
  39189. var protocol = runtime.getDocument().location.protocol;
  39190. if ((options && options.useTLS) || protocol === "https:") {
  39191. cdn = this.options.cdn_https;
  39192. }
  39193. else {
  39194. cdn = this.options.cdn_http;
  39195. }
  39196. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  39197. };
  39198. DependencyLoader.prototype.getPath = function (name, options) {
  39199. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  39200. };
  39201. ;
  39202. return DependencyLoader;
  39203. }());
  39204. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  39205. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  39206. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  39207. var Dependencies = new dependency_loader({
  39208. cdn_http: defaults.cdn_http,
  39209. cdn_https: defaults.cdn_https,
  39210. version: defaults.VERSION,
  39211. suffix: defaults.dependency_suffix,
  39212. receivers: DependenciesReceivers
  39213. });
  39214. // CONCATENATED MODULE: ./src/core/base64.ts
  39215. function encode(s) {
  39216. return btoa(utob(s));
  39217. }
  39218. var fromCharCode = String.fromCharCode;
  39219. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  39220. var b64tab = {};
  39221. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  39222. b64tab[b64chars.charAt(base64_i)] = base64_i;
  39223. }
  39224. var cb_utob = function (c) {
  39225. var cc = c.charCodeAt(0);
  39226. return cc < 0x80
  39227. ? c
  39228. : cc < 0x800
  39229. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  39230. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  39231. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  39232. fromCharCode(0x80 | (cc & 0x3f));
  39233. };
  39234. var utob = function (u) {
  39235. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  39236. };
  39237. var cb_encode = function (ccc) {
  39238. var padlen = [0, 2, 1][ccc.length % 3];
  39239. var ord = (ccc.charCodeAt(0) << 16) |
  39240. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  39241. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  39242. var chars = [
  39243. b64chars.charAt(ord >>> 18),
  39244. b64chars.charAt((ord >>> 12) & 63),
  39245. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  39246. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  39247. ];
  39248. return chars.join('');
  39249. };
  39250. var btoa = window.btoa ||
  39251. function (b) {
  39252. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  39253. };
  39254. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  39255. var Timer = (function () {
  39256. function Timer(set, clear, delay, callback) {
  39257. var _this = this;
  39258. this.clear = clear;
  39259. this.timer = set(function () {
  39260. if (_this.timer) {
  39261. _this.timer = callback(_this.timer);
  39262. }
  39263. }, delay);
  39264. }
  39265. Timer.prototype.isRunning = function () {
  39266. return this.timer !== null;
  39267. };
  39268. Timer.prototype.ensureAborted = function () {
  39269. if (this.timer) {
  39270. this.clear(this.timer);
  39271. this.timer = null;
  39272. }
  39273. };
  39274. return Timer;
  39275. }());
  39276. /* harmony default export */ var abstract_timer = (Timer);
  39277. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  39278. var __extends = (undefined && undefined.__extends) || (function () {
  39279. var extendStatics = function (d, b) {
  39280. extendStatics = Object.setPrototypeOf ||
  39281. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39282. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39283. return extendStatics(d, b);
  39284. };
  39285. return function (d, b) {
  39286. extendStatics(d, b);
  39287. function __() { this.constructor = d; }
  39288. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39289. };
  39290. })();
  39291. function timers_clearTimeout(timer) {
  39292. window.clearTimeout(timer);
  39293. }
  39294. function timers_clearInterval(timer) {
  39295. window.clearInterval(timer);
  39296. }
  39297. var OneOffTimer = (function (_super) {
  39298. __extends(OneOffTimer, _super);
  39299. function OneOffTimer(delay, callback) {
  39300. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  39301. callback();
  39302. return null;
  39303. }) || this;
  39304. }
  39305. return OneOffTimer;
  39306. }(abstract_timer));
  39307. var PeriodicTimer = (function (_super) {
  39308. __extends(PeriodicTimer, _super);
  39309. function PeriodicTimer(delay, callback) {
  39310. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  39311. callback();
  39312. return timer;
  39313. }) || this;
  39314. }
  39315. return PeriodicTimer;
  39316. }(abstract_timer));
  39317. // CONCATENATED MODULE: ./src/core/util.ts
  39318. var Util = {
  39319. now: function () {
  39320. if (Date.now) {
  39321. return Date.now();
  39322. }
  39323. else {
  39324. return new Date().valueOf();
  39325. }
  39326. },
  39327. defer: function (callback) {
  39328. return new OneOffTimer(0, callback);
  39329. },
  39330. method: function (name) {
  39331. var args = [];
  39332. for (var _i = 1; _i < arguments.length; _i++) {
  39333. args[_i - 1] = arguments[_i];
  39334. }
  39335. var boundArguments = Array.prototype.slice.call(arguments, 1);
  39336. return function (object) {
  39337. return object[name].apply(object, boundArguments.concat(arguments));
  39338. };
  39339. }
  39340. };
  39341. /* harmony default export */ var util = (Util);
  39342. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  39343. function extend(target) {
  39344. var sources = [];
  39345. for (var _i = 1; _i < arguments.length; _i++) {
  39346. sources[_i - 1] = arguments[_i];
  39347. }
  39348. for (var i = 0; i < sources.length; i++) {
  39349. var extensions = sources[i];
  39350. for (var property in extensions) {
  39351. if (extensions[property] && extensions[property].constructor &&
  39352. extensions[property].constructor === Object) {
  39353. target[property] = extend(target[property] || {}, extensions[property]);
  39354. }
  39355. else {
  39356. target[property] = extensions[property];
  39357. }
  39358. }
  39359. }
  39360. return target;
  39361. }
  39362. function stringify() {
  39363. var m = ["Pusher"];
  39364. for (var i = 0; i < arguments.length; i++) {
  39365. if (typeof arguments[i] === "string") {
  39366. m.push(arguments[i]);
  39367. }
  39368. else {
  39369. m.push(safeJSONStringify(arguments[i]));
  39370. }
  39371. }
  39372. return m.join(" : ");
  39373. }
  39374. function arrayIndexOf(array, item) {
  39375. var nativeIndexOf = Array.prototype.indexOf;
  39376. if (array === null) {
  39377. return -1;
  39378. }
  39379. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  39380. return array.indexOf(item);
  39381. }
  39382. for (var i = 0, l = array.length; i < l; i++) {
  39383. if (array[i] === item) {
  39384. return i;
  39385. }
  39386. }
  39387. return -1;
  39388. }
  39389. function objectApply(object, f) {
  39390. for (var key in object) {
  39391. if (Object.prototype.hasOwnProperty.call(object, key)) {
  39392. f(object[key], key, object);
  39393. }
  39394. }
  39395. }
  39396. function keys(object) {
  39397. var keys = [];
  39398. objectApply(object, function (_, key) {
  39399. keys.push(key);
  39400. });
  39401. return keys;
  39402. }
  39403. function values(object) {
  39404. var values = [];
  39405. objectApply(object, function (value) {
  39406. values.push(value);
  39407. });
  39408. return values;
  39409. }
  39410. function apply(array, f, context) {
  39411. for (var i = 0; i < array.length; i++) {
  39412. f.call(context || window, array[i], i, array);
  39413. }
  39414. }
  39415. function map(array, f) {
  39416. var result = [];
  39417. for (var i = 0; i < array.length; i++) {
  39418. result.push(f(array[i], i, array, result));
  39419. }
  39420. return result;
  39421. }
  39422. function mapObject(object, f) {
  39423. var result = {};
  39424. objectApply(object, function (value, key) {
  39425. result[key] = f(value);
  39426. });
  39427. return result;
  39428. }
  39429. function filter(array, test) {
  39430. test = test || function (value) { return !!value; };
  39431. var result = [];
  39432. for (var i = 0; i < array.length; i++) {
  39433. if (test(array[i], i, array, result)) {
  39434. result.push(array[i]);
  39435. }
  39436. }
  39437. return result;
  39438. }
  39439. function filterObject(object, test) {
  39440. var result = {};
  39441. objectApply(object, function (value, key) {
  39442. if ((test && test(value, key, object, result)) || Boolean(value)) {
  39443. result[key] = value;
  39444. }
  39445. });
  39446. return result;
  39447. }
  39448. function flatten(object) {
  39449. var result = [];
  39450. objectApply(object, function (value, key) {
  39451. result.push([key, value]);
  39452. });
  39453. return result;
  39454. }
  39455. function any(array, test) {
  39456. for (var i = 0; i < array.length; i++) {
  39457. if (test(array[i], i, array)) {
  39458. return true;
  39459. }
  39460. }
  39461. return false;
  39462. }
  39463. function collections_all(array, test) {
  39464. for (var i = 0; i < array.length; i++) {
  39465. if (!test(array[i], i, array)) {
  39466. return false;
  39467. }
  39468. }
  39469. return true;
  39470. }
  39471. function encodeParamsObject(data) {
  39472. return mapObject(data, function (value) {
  39473. if (typeof value === "object") {
  39474. value = safeJSONStringify(value);
  39475. }
  39476. return encodeURIComponent(encode(value.toString()));
  39477. });
  39478. }
  39479. function buildQueryString(data) {
  39480. var params = filterObject(data, function (value) {
  39481. return value !== undefined;
  39482. });
  39483. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  39484. return query;
  39485. }
  39486. function decycleObject(object) {
  39487. var objects = [], paths = [];
  39488. return (function derez(value, path) {
  39489. var i, name, nu;
  39490. switch (typeof value) {
  39491. case 'object':
  39492. if (!value) {
  39493. return null;
  39494. }
  39495. for (i = 0; i < objects.length; i += 1) {
  39496. if (objects[i] === value) {
  39497. return { $ref: paths[i] };
  39498. }
  39499. }
  39500. objects.push(value);
  39501. paths.push(path);
  39502. if (Object.prototype.toString.apply(value) === '[object Array]') {
  39503. nu = [];
  39504. for (i = 0; i < value.length; i += 1) {
  39505. nu[i] = derez(value[i], path + '[' + i + ']');
  39506. }
  39507. }
  39508. else {
  39509. nu = {};
  39510. for (name in value) {
  39511. if (Object.prototype.hasOwnProperty.call(value, name)) {
  39512. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  39513. }
  39514. }
  39515. }
  39516. return nu;
  39517. case 'number':
  39518. case 'string':
  39519. case 'boolean':
  39520. return value;
  39521. }
  39522. }(object, '$'));
  39523. }
  39524. function safeJSONStringify(source) {
  39525. try {
  39526. return JSON.stringify(source);
  39527. }
  39528. catch (e) {
  39529. return JSON.stringify(decycleObject(source));
  39530. }
  39531. }
  39532. // CONCATENATED MODULE: ./src/core/logger.ts
  39533. var logger_Logger = (function () {
  39534. function Logger() {
  39535. this.globalLog = function (message) {
  39536. if (window.console && window.console.log) {
  39537. window.console.log(message);
  39538. }
  39539. };
  39540. }
  39541. Logger.prototype.debug = function () {
  39542. var args = [];
  39543. for (var _i = 0; _i < arguments.length; _i++) {
  39544. args[_i] = arguments[_i];
  39545. }
  39546. this.log(this.globalLog, args);
  39547. };
  39548. Logger.prototype.warn = function () {
  39549. var args = [];
  39550. for (var _i = 0; _i < arguments.length; _i++) {
  39551. args[_i] = arguments[_i];
  39552. }
  39553. this.log(this.globalLogWarn, args);
  39554. };
  39555. Logger.prototype.error = function () {
  39556. var args = [];
  39557. for (var _i = 0; _i < arguments.length; _i++) {
  39558. args[_i] = arguments[_i];
  39559. }
  39560. this.log(this.globalLogError, args);
  39561. };
  39562. Logger.prototype.globalLogWarn = function (message) {
  39563. if (window.console && window.console.warn) {
  39564. window.console.warn(message);
  39565. }
  39566. else {
  39567. this.globalLog(message);
  39568. }
  39569. };
  39570. Logger.prototype.globalLogError = function (message) {
  39571. if (window.console && window.console.error) {
  39572. window.console.error(message);
  39573. }
  39574. else {
  39575. this.globalLogWarn(message);
  39576. }
  39577. };
  39578. Logger.prototype.log = function (defaultLoggingFunction) {
  39579. var args = [];
  39580. for (var _i = 1; _i < arguments.length; _i++) {
  39581. args[_i - 1] = arguments[_i];
  39582. }
  39583. var message = stringify.apply(this, arguments);
  39584. if (core_pusher.log) {
  39585. core_pusher.log(message);
  39586. }
  39587. else if (core_pusher.logToConsole) {
  39588. var log = defaultLoggingFunction.bind(this);
  39589. log(message);
  39590. }
  39591. };
  39592. return Logger;
  39593. }());
  39594. /* harmony default export */ var logger = (new logger_Logger());
  39595. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  39596. var urlStore = {
  39597. baseUrl: "https://pusher.com",
  39598. urls: {
  39599. authenticationEndpoint: {
  39600. path: "/docs/authenticating_users",
  39601. },
  39602. javascriptQuickStart: {
  39603. path: "/docs/javascript_quick_start"
  39604. },
  39605. triggeringClientEvents: {
  39606. path: "/docs/client_api_guide/client_events#trigger-events"
  39607. }
  39608. }
  39609. };
  39610. var buildLogSuffix = function (key) {
  39611. var urlPrefix = "See:";
  39612. var urlObj = urlStore.urls[key];
  39613. if (!urlObj)
  39614. return "";
  39615. var url;
  39616. if (urlObj.fullUrl) {
  39617. url = urlObj.fullUrl;
  39618. }
  39619. else if (urlObj.path) {
  39620. url = urlStore.baseUrl + urlObj.path;
  39621. }
  39622. if (!url)
  39623. return "";
  39624. return urlPrefix + " " + url;
  39625. };
  39626. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  39627. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  39628. var ajax = function (context, socketId, callback) {
  39629. var self = this, xhr;
  39630. xhr = runtime.createXHR();
  39631. xhr.open("POST", self.options.authEndpoint, true);
  39632. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  39633. for (var headerName in this.authOptions.headers) {
  39634. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  39635. }
  39636. xhr.onreadystatechange = function () {
  39637. if (xhr.readyState === 4) {
  39638. if (xhr.status === 200) {
  39639. var data, parsed = false;
  39640. try {
  39641. data = JSON.parse(xhr.responseText);
  39642. parsed = true;
  39643. }
  39644. catch (e) {
  39645. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  39646. }
  39647. if (parsed) {
  39648. callback(false, data);
  39649. }
  39650. }
  39651. else {
  39652. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  39653. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  39654. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  39655. ("Clients must be authenticated to join private or presence channels. " + suffix));
  39656. callback(true, xhr.status);
  39657. }
  39658. }
  39659. };
  39660. xhr.send(this.composeQuery(socketId));
  39661. return xhr;
  39662. };
  39663. /* harmony default export */ var xhr_auth = (ajax);
  39664. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  39665. var jsonp = function (context, socketId, callback) {
  39666. if (this.authOptions.headers !== undefined) {
  39667. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  39668. }
  39669. var callbackName = context.nextAuthCallbackID.toString();
  39670. context.nextAuthCallbackID++;
  39671. var document = context.getDocument();
  39672. var script = document.createElement("script");
  39673. context.auth_callbacks[callbackName] = function (data) {
  39674. callback(false, data);
  39675. };
  39676. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  39677. script.src = this.options.authEndpoint +
  39678. '?callback=' +
  39679. encodeURIComponent(callback_name) +
  39680. '&' +
  39681. this.composeQuery(socketId);
  39682. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  39683. head.insertBefore(script, head.firstChild);
  39684. };
  39685. /* harmony default export */ var jsonp_auth = (jsonp);
  39686. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  39687. var ScriptRequest = (function () {
  39688. function ScriptRequest(src) {
  39689. this.src = src;
  39690. }
  39691. ScriptRequest.prototype.send = function (receiver) {
  39692. var self = this;
  39693. var errorString = "Error loading " + self.src;
  39694. self.script = document.createElement("script");
  39695. self.script.id = receiver.id;
  39696. self.script.src = self.src;
  39697. self.script.type = "text/javascript";
  39698. self.script.charset = "UTF-8";
  39699. if (self.script.addEventListener) {
  39700. self.script.onerror = function () {
  39701. receiver.callback(errorString);
  39702. };
  39703. self.script.onload = function () {
  39704. receiver.callback(null);
  39705. };
  39706. }
  39707. else {
  39708. self.script.onreadystatechange = function () {
  39709. if (self.script.readyState === 'loaded' ||
  39710. self.script.readyState === 'complete') {
  39711. receiver.callback(null);
  39712. }
  39713. };
  39714. }
  39715. if (self.script.async === undefined && document.attachEvent &&
  39716. /opera/i.test(navigator.userAgent)) {
  39717. self.errorScript = document.createElement("script");
  39718. self.errorScript.id = receiver.id + "_error";
  39719. self.errorScript.text = receiver.name + "('" + errorString + "');";
  39720. self.script.async = self.errorScript.async = false;
  39721. }
  39722. else {
  39723. self.script.async = true;
  39724. }
  39725. var head = document.getElementsByTagName('head')[0];
  39726. head.insertBefore(self.script, head.firstChild);
  39727. if (self.errorScript) {
  39728. head.insertBefore(self.errorScript, self.script.nextSibling);
  39729. }
  39730. };
  39731. ScriptRequest.prototype.cleanup = function () {
  39732. if (this.script) {
  39733. this.script.onload = this.script.onerror = null;
  39734. this.script.onreadystatechange = null;
  39735. }
  39736. if (this.script && this.script.parentNode) {
  39737. this.script.parentNode.removeChild(this.script);
  39738. }
  39739. if (this.errorScript && this.errorScript.parentNode) {
  39740. this.errorScript.parentNode.removeChild(this.errorScript);
  39741. }
  39742. this.script = null;
  39743. this.errorScript = null;
  39744. };
  39745. return ScriptRequest;
  39746. }());
  39747. /* harmony default export */ var script_request = (ScriptRequest);
  39748. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  39749. var jsonp_request_JSONPRequest = (function () {
  39750. function JSONPRequest(url, data) {
  39751. this.url = url;
  39752. this.data = data;
  39753. }
  39754. JSONPRequest.prototype.send = function (receiver) {
  39755. if (this.request) {
  39756. return;
  39757. }
  39758. var query = buildQueryString(this.data);
  39759. var url = this.url + "/" + receiver.number + "?" + query;
  39760. this.request = runtime.createScriptRequest(url);
  39761. this.request.send(receiver);
  39762. };
  39763. JSONPRequest.prototype.cleanup = function () {
  39764. if (this.request) {
  39765. this.request.cleanup();
  39766. }
  39767. };
  39768. return JSONPRequest;
  39769. }());
  39770. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  39771. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  39772. var getAgent = function (sender, useTLS) {
  39773. return function (data, callback) {
  39774. var scheme = "http" + (useTLS ? "s" : "") + "://";
  39775. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  39776. var request = runtime.createJSONPRequest(url, data);
  39777. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  39778. ScriptReceivers.remove(receiver);
  39779. request.cleanup();
  39780. if (result && result.host) {
  39781. sender.host = result.host;
  39782. }
  39783. if (callback) {
  39784. callback(error, result);
  39785. }
  39786. });
  39787. request.send(receiver);
  39788. };
  39789. };
  39790. var jsonp_timeline_jsonp = {
  39791. name: 'jsonp',
  39792. getAgent: getAgent
  39793. };
  39794. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  39795. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  39796. function getGenericURL(baseScheme, params, path) {
  39797. var scheme = baseScheme + (params.useTLS ? "s" : "");
  39798. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  39799. return scheme + "://" + host + path;
  39800. }
  39801. function getGenericPath(key, queryString) {
  39802. var path = "/app/" + key;
  39803. var query = "?protocol=" + defaults.PROTOCOL +
  39804. "&client=js" +
  39805. "&version=" + defaults.VERSION +
  39806. (queryString ? ("&" + queryString) : "");
  39807. return path + query;
  39808. }
  39809. var ws = {
  39810. getInitial: function (key, params) {
  39811. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  39812. return getGenericURL("ws", params, path);
  39813. }
  39814. };
  39815. var http = {
  39816. getInitial: function (key, params) {
  39817. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  39818. return getGenericURL("http", params, path);
  39819. }
  39820. };
  39821. var sockjs = {
  39822. getInitial: function (key, params) {
  39823. return getGenericURL("http", params, params.httpPath || "/pusher");
  39824. },
  39825. getPath: function (key, params) {
  39826. return getGenericPath(key);
  39827. }
  39828. };
  39829. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  39830. var callback_registry_CallbackRegistry = (function () {
  39831. function CallbackRegistry() {
  39832. this._callbacks = {};
  39833. }
  39834. CallbackRegistry.prototype.get = function (name) {
  39835. return this._callbacks[prefix(name)];
  39836. };
  39837. CallbackRegistry.prototype.add = function (name, callback, context) {
  39838. var prefixedEventName = prefix(name);
  39839. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  39840. this._callbacks[prefixedEventName].push({
  39841. fn: callback,
  39842. context: context
  39843. });
  39844. };
  39845. CallbackRegistry.prototype.remove = function (name, callback, context) {
  39846. if (!name && !callback && !context) {
  39847. this._callbacks = {};
  39848. return;
  39849. }
  39850. var names = name ? [prefix(name)] : keys(this._callbacks);
  39851. if (callback || context) {
  39852. this.removeCallback(names, callback, context);
  39853. }
  39854. else {
  39855. this.removeAllCallbacks(names);
  39856. }
  39857. };
  39858. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  39859. apply(names, function (name) {
  39860. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  39861. return (callback && callback !== binding.fn) ||
  39862. (context && context !== binding.context);
  39863. });
  39864. if (this._callbacks[name].length === 0) {
  39865. delete this._callbacks[name];
  39866. }
  39867. }, this);
  39868. };
  39869. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  39870. apply(names, function (name) {
  39871. delete this._callbacks[name];
  39872. }, this);
  39873. };
  39874. return CallbackRegistry;
  39875. }());
  39876. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  39877. function prefix(name) {
  39878. return "_" + name;
  39879. }
  39880. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  39881. var dispatcher_Dispatcher = (function () {
  39882. function Dispatcher(failThrough) {
  39883. this.callbacks = new callback_registry();
  39884. this.global_callbacks = [];
  39885. this.failThrough = failThrough;
  39886. }
  39887. Dispatcher.prototype.bind = function (eventName, callback, context) {
  39888. this.callbacks.add(eventName, callback, context);
  39889. return this;
  39890. };
  39891. Dispatcher.prototype.bind_global = function (callback) {
  39892. this.global_callbacks.push(callback);
  39893. return this;
  39894. };
  39895. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  39896. this.callbacks.remove(eventName, callback, context);
  39897. return this;
  39898. };
  39899. Dispatcher.prototype.unbind_global = function (callback) {
  39900. if (!callback) {
  39901. this.global_callbacks = [];
  39902. return this;
  39903. }
  39904. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  39905. return this;
  39906. };
  39907. Dispatcher.prototype.unbind_all = function () {
  39908. this.unbind();
  39909. this.unbind_global();
  39910. return this;
  39911. };
  39912. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  39913. for (var i = 0; i < this.global_callbacks.length; i++) {
  39914. this.global_callbacks[i](eventName, data);
  39915. }
  39916. var callbacks = this.callbacks.get(eventName);
  39917. var args = [];
  39918. if (metadata) {
  39919. args.push(data, metadata);
  39920. }
  39921. else if (data) {
  39922. args.push(data);
  39923. }
  39924. if (callbacks && callbacks.length > 0) {
  39925. for (var i = 0; i < callbacks.length; i++) {
  39926. callbacks[i].fn.apply(callbacks[i].context || window, args);
  39927. }
  39928. }
  39929. else if (this.failThrough) {
  39930. this.failThrough(eventName, data);
  39931. }
  39932. return this;
  39933. };
  39934. return Dispatcher;
  39935. }());
  39936. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  39937. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  39938. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  39939. var extendStatics = function (d, b) {
  39940. extendStatics = Object.setPrototypeOf ||
  39941. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39942. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39943. return extendStatics(d, b);
  39944. };
  39945. return function (d, b) {
  39946. extendStatics(d, b);
  39947. function __() { this.constructor = d; }
  39948. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39949. };
  39950. })();
  39951. var transport_connection_TransportConnection = (function (_super) {
  39952. transport_connection_extends(TransportConnection, _super);
  39953. function TransportConnection(hooks, name, priority, key, options) {
  39954. var _this = _super.call(this) || this;
  39955. _this.initialize = runtime.transportConnectionInitializer;
  39956. _this.hooks = hooks;
  39957. _this.name = name;
  39958. _this.priority = priority;
  39959. _this.key = key;
  39960. _this.options = options;
  39961. _this.state = "new";
  39962. _this.timeline = options.timeline;
  39963. _this.activityTimeout = options.activityTimeout;
  39964. _this.id = _this.timeline.generateUniqueID();
  39965. return _this;
  39966. }
  39967. TransportConnection.prototype.handlesActivityChecks = function () {
  39968. return Boolean(this.hooks.handlesActivityChecks);
  39969. };
  39970. TransportConnection.prototype.supportsPing = function () {
  39971. return Boolean(this.hooks.supportsPing);
  39972. };
  39973. TransportConnection.prototype.connect = function () {
  39974. var _this = this;
  39975. if (this.socket || this.state !== "initialized") {
  39976. return false;
  39977. }
  39978. var url = this.hooks.urls.getInitial(this.key, this.options);
  39979. try {
  39980. this.socket = this.hooks.getSocket(url, this.options);
  39981. }
  39982. catch (e) {
  39983. util.defer(function () {
  39984. _this.onError(e);
  39985. _this.changeState("closed");
  39986. });
  39987. return false;
  39988. }
  39989. this.bindListeners();
  39990. logger.debug("Connecting", { transport: this.name, url: url });
  39991. this.changeState("connecting");
  39992. return true;
  39993. };
  39994. TransportConnection.prototype.close = function () {
  39995. if (this.socket) {
  39996. this.socket.close();
  39997. return true;
  39998. }
  39999. else {
  40000. return false;
  40001. }
  40002. };
  40003. TransportConnection.prototype.send = function (data) {
  40004. var _this = this;
  40005. if (this.state === "open") {
  40006. util.defer(function () {
  40007. if (_this.socket) {
  40008. _this.socket.send(data);
  40009. }
  40010. });
  40011. return true;
  40012. }
  40013. else {
  40014. return false;
  40015. }
  40016. };
  40017. TransportConnection.prototype.ping = function () {
  40018. if (this.state === "open" && this.supportsPing()) {
  40019. this.socket.ping();
  40020. }
  40021. };
  40022. TransportConnection.prototype.onOpen = function () {
  40023. if (this.hooks.beforeOpen) {
  40024. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  40025. }
  40026. this.changeState("open");
  40027. this.socket.onopen = undefined;
  40028. };
  40029. TransportConnection.prototype.onError = function (error) {
  40030. this.emit("error", { type: 'WebSocketError', error: error });
  40031. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  40032. };
  40033. TransportConnection.prototype.onClose = function (closeEvent) {
  40034. if (closeEvent) {
  40035. this.changeState("closed", {
  40036. code: closeEvent.code,
  40037. reason: closeEvent.reason,
  40038. wasClean: closeEvent.wasClean
  40039. });
  40040. }
  40041. else {
  40042. this.changeState("closed");
  40043. }
  40044. this.unbindListeners();
  40045. this.socket = undefined;
  40046. };
  40047. TransportConnection.prototype.onMessage = function (message) {
  40048. this.emit("message", message);
  40049. };
  40050. TransportConnection.prototype.onActivity = function () {
  40051. this.emit("activity");
  40052. };
  40053. TransportConnection.prototype.bindListeners = function () {
  40054. var _this = this;
  40055. this.socket.onopen = function () {
  40056. _this.onOpen();
  40057. };
  40058. this.socket.onerror = function (error) {
  40059. _this.onError(error);
  40060. };
  40061. this.socket.onclose = function (closeEvent) {
  40062. _this.onClose(closeEvent);
  40063. };
  40064. this.socket.onmessage = function (message) {
  40065. _this.onMessage(message);
  40066. };
  40067. if (this.supportsPing()) {
  40068. this.socket.onactivity = function () { _this.onActivity(); };
  40069. }
  40070. };
  40071. TransportConnection.prototype.unbindListeners = function () {
  40072. if (this.socket) {
  40073. this.socket.onopen = undefined;
  40074. this.socket.onerror = undefined;
  40075. this.socket.onclose = undefined;
  40076. this.socket.onmessage = undefined;
  40077. if (this.supportsPing()) {
  40078. this.socket.onactivity = undefined;
  40079. }
  40080. }
  40081. };
  40082. TransportConnection.prototype.changeState = function (state, params) {
  40083. this.state = state;
  40084. this.timeline.info(this.buildTimelineMessage({
  40085. state: state,
  40086. params: params
  40087. }));
  40088. this.emit(state, params);
  40089. };
  40090. TransportConnection.prototype.buildTimelineMessage = function (message) {
  40091. return extend({ cid: this.id }, message);
  40092. };
  40093. return TransportConnection;
  40094. }(dispatcher));
  40095. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  40096. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  40097. var transport_Transport = (function () {
  40098. function Transport(hooks) {
  40099. this.hooks = hooks;
  40100. }
  40101. Transport.prototype.isSupported = function (environment) {
  40102. return this.hooks.isSupported(environment);
  40103. };
  40104. Transport.prototype.createConnection = function (name, priority, key, options) {
  40105. return new transport_connection(this.hooks, name, priority, key, options);
  40106. };
  40107. return Transport;
  40108. }());
  40109. /* harmony default export */ var transports_transport = (transport_Transport);
  40110. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  40111. var WSTransport = new transports_transport({
  40112. urls: ws,
  40113. handlesActivityChecks: false,
  40114. supportsPing: false,
  40115. isInitialized: function () {
  40116. return Boolean(runtime.getWebSocketAPI());
  40117. },
  40118. isSupported: function () {
  40119. return Boolean(runtime.getWebSocketAPI());
  40120. },
  40121. getSocket: function (url) {
  40122. return runtime.createWebSocket(url);
  40123. }
  40124. });
  40125. var httpConfiguration = {
  40126. urls: http,
  40127. handlesActivityChecks: false,
  40128. supportsPing: true,
  40129. isInitialized: function () {
  40130. return true;
  40131. }
  40132. };
  40133. var streamingConfiguration = extend({ getSocket: function (url) {
  40134. return runtime.HTTPFactory.createStreamingSocket(url);
  40135. }
  40136. }, httpConfiguration);
  40137. var pollingConfiguration = extend({ getSocket: function (url) {
  40138. return runtime.HTTPFactory.createPollingSocket(url);
  40139. }
  40140. }, httpConfiguration);
  40141. var xhrConfiguration = {
  40142. isSupported: function () {
  40143. return runtime.isXHRSupported();
  40144. }
  40145. };
  40146. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  40147. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  40148. var Transports = {
  40149. ws: WSTransport,
  40150. xhr_streaming: XHRStreamingTransport,
  40151. xhr_polling: XHRPollingTransport
  40152. };
  40153. /* harmony default export */ var transports = (Transports);
  40154. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  40155. var SockJSTransport = new transports_transport({
  40156. file: "sockjs",
  40157. urls: sockjs,
  40158. handlesActivityChecks: true,
  40159. supportsPing: false,
  40160. isSupported: function () {
  40161. return true;
  40162. },
  40163. isInitialized: function () {
  40164. return window.SockJS !== undefined;
  40165. },
  40166. getSocket: function (url, options) {
  40167. return new window.SockJS(url, null, {
  40168. js_path: Dependencies.getPath("sockjs", {
  40169. useTLS: options.useTLS
  40170. }),
  40171. ignore_null_origin: options.ignoreNullOrigin
  40172. });
  40173. },
  40174. beforeOpen: function (socket, path) {
  40175. socket.send(JSON.stringify({
  40176. path: path
  40177. }));
  40178. }
  40179. });
  40180. var xdrConfiguration = {
  40181. isSupported: function (environment) {
  40182. var yes = runtime.isXDRSupported(environment.useTLS);
  40183. return yes;
  40184. }
  40185. };
  40186. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  40187. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  40188. transports.xdr_streaming = XDRStreamingTransport;
  40189. transports.xdr_polling = XDRPollingTransport;
  40190. transports.sockjs = SockJSTransport;
  40191. /* harmony default export */ var transports_transports = (transports);
  40192. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  40193. var net_info_extends = (undefined && undefined.__extends) || (function () {
  40194. var extendStatics = function (d, b) {
  40195. extendStatics = Object.setPrototypeOf ||
  40196. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40197. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40198. return extendStatics(d, b);
  40199. };
  40200. return function (d, b) {
  40201. extendStatics(d, b);
  40202. function __() { this.constructor = d; }
  40203. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40204. };
  40205. })();
  40206. var NetInfo = (function (_super) {
  40207. net_info_extends(NetInfo, _super);
  40208. function NetInfo() {
  40209. var _this = _super.call(this) || this;
  40210. var self = _this;
  40211. if (window.addEventListener !== undefined) {
  40212. window.addEventListener("online", function () {
  40213. self.emit('online');
  40214. }, false);
  40215. window.addEventListener("offline", function () {
  40216. self.emit('offline');
  40217. }, false);
  40218. }
  40219. return _this;
  40220. }
  40221. NetInfo.prototype.isOnline = function () {
  40222. if (window.navigator.onLine === undefined) {
  40223. return true;
  40224. }
  40225. else {
  40226. return window.navigator.onLine;
  40227. }
  40228. };
  40229. return NetInfo;
  40230. }(dispatcher));
  40231. var net_info_Network = new NetInfo();
  40232. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  40233. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  40234. function AssistantToTheTransportManager(manager, transport, options) {
  40235. this.manager = manager;
  40236. this.transport = transport;
  40237. this.minPingDelay = options.minPingDelay;
  40238. this.maxPingDelay = options.maxPingDelay;
  40239. this.pingDelay = undefined;
  40240. }
  40241. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  40242. var _this = this;
  40243. options = extend({}, options, {
  40244. activityTimeout: this.pingDelay
  40245. });
  40246. var connection = this.transport.createConnection(name, priority, key, options);
  40247. var openTimestamp = null;
  40248. var onOpen = function () {
  40249. connection.unbind("open", onOpen);
  40250. connection.bind("closed", onClosed);
  40251. openTimestamp = util.now();
  40252. };
  40253. var onClosed = function (closeEvent) {
  40254. connection.unbind("closed", onClosed);
  40255. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  40256. _this.manager.reportDeath();
  40257. }
  40258. else if (!closeEvent.wasClean && openTimestamp) {
  40259. var lifespan = util.now() - openTimestamp;
  40260. if (lifespan < 2 * _this.maxPingDelay) {
  40261. _this.manager.reportDeath();
  40262. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  40263. }
  40264. }
  40265. };
  40266. connection.bind("open", onOpen);
  40267. return connection;
  40268. };
  40269. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  40270. return this.manager.isAlive() && this.transport.isSupported(environment);
  40271. };
  40272. return AssistantToTheTransportManager;
  40273. }());
  40274. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  40275. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  40276. var Protocol = {
  40277. decodeMessage: function (messageEvent) {
  40278. try {
  40279. var messageData = JSON.parse(messageEvent.data);
  40280. var pusherEventData = messageData.data;
  40281. if (typeof pusherEventData === 'string') {
  40282. try {
  40283. pusherEventData = JSON.parse(messageData.data);
  40284. }
  40285. catch (e) { }
  40286. }
  40287. var pusherEvent = {
  40288. event: messageData.event,
  40289. channel: messageData.channel,
  40290. data: pusherEventData,
  40291. };
  40292. if (messageData.user_id) {
  40293. pusherEvent.user_id = messageData.user_id;
  40294. }
  40295. return pusherEvent;
  40296. }
  40297. catch (e) {
  40298. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  40299. }
  40300. },
  40301. encodeMessage: function (event) {
  40302. return JSON.stringify(event);
  40303. },
  40304. processHandshake: function (messageEvent) {
  40305. var message = Protocol.decodeMessage(messageEvent);
  40306. if (message.event === "pusher:connection_established") {
  40307. if (!message.data.activity_timeout) {
  40308. throw "No activity timeout specified in handshake";
  40309. }
  40310. return {
  40311. action: "connected",
  40312. id: message.data.socket_id,
  40313. activityTimeout: message.data.activity_timeout * 1000
  40314. };
  40315. }
  40316. else if (message.event === "pusher:error") {
  40317. return {
  40318. action: this.getCloseAction(message.data),
  40319. error: this.getCloseError(message.data)
  40320. };
  40321. }
  40322. else {
  40323. throw "Invalid handshake";
  40324. }
  40325. },
  40326. getCloseAction: function (closeEvent) {
  40327. if (closeEvent.code < 4000) {
  40328. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  40329. return "backoff";
  40330. }
  40331. else {
  40332. return null;
  40333. }
  40334. }
  40335. else if (closeEvent.code === 4000) {
  40336. return "tls_only";
  40337. }
  40338. else if (closeEvent.code < 4100) {
  40339. return "refused";
  40340. }
  40341. else if (closeEvent.code < 4200) {
  40342. return "backoff";
  40343. }
  40344. else if (closeEvent.code < 4300) {
  40345. return "retry";
  40346. }
  40347. else {
  40348. return "refused";
  40349. }
  40350. },
  40351. getCloseError: function (closeEvent) {
  40352. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  40353. return {
  40354. type: 'PusherError',
  40355. data: {
  40356. code: closeEvent.code,
  40357. message: closeEvent.reason || closeEvent.message
  40358. }
  40359. };
  40360. }
  40361. else {
  40362. return null;
  40363. }
  40364. }
  40365. };
  40366. /* harmony default export */ var protocol_protocol = (Protocol);
  40367. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  40368. var connection_extends = (undefined && undefined.__extends) || (function () {
  40369. var extendStatics = function (d, b) {
  40370. extendStatics = Object.setPrototypeOf ||
  40371. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40372. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40373. return extendStatics(d, b);
  40374. };
  40375. return function (d, b) {
  40376. extendStatics(d, b);
  40377. function __() { this.constructor = d; }
  40378. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40379. };
  40380. })();
  40381. var connection_Connection = (function (_super) {
  40382. connection_extends(Connection, _super);
  40383. function Connection(id, transport) {
  40384. var _this = _super.call(this) || this;
  40385. _this.id = id;
  40386. _this.transport = transport;
  40387. _this.activityTimeout = transport.activityTimeout;
  40388. _this.bindListeners();
  40389. return _this;
  40390. }
  40391. Connection.prototype.handlesActivityChecks = function () {
  40392. return this.transport.handlesActivityChecks();
  40393. };
  40394. Connection.prototype.send = function (data) {
  40395. return this.transport.send(data);
  40396. };
  40397. Connection.prototype.send_event = function (name, data, channel) {
  40398. var event = { event: name, data: data };
  40399. if (channel) {
  40400. event.channel = channel;
  40401. }
  40402. logger.debug('Event sent', event);
  40403. return this.send(protocol_protocol.encodeMessage(event));
  40404. };
  40405. Connection.prototype.ping = function () {
  40406. if (this.transport.supportsPing()) {
  40407. this.transport.ping();
  40408. }
  40409. else {
  40410. this.send_event('pusher:ping', {});
  40411. }
  40412. };
  40413. Connection.prototype.close = function () {
  40414. this.transport.close();
  40415. };
  40416. Connection.prototype.bindListeners = function () {
  40417. var _this = this;
  40418. var listeners = {
  40419. message: function (messageEvent) {
  40420. var pusherEvent;
  40421. try {
  40422. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  40423. }
  40424. catch (e) {
  40425. _this.emit('error', {
  40426. type: 'MessageParseError',
  40427. error: e,
  40428. data: messageEvent.data
  40429. });
  40430. }
  40431. if (pusherEvent !== undefined) {
  40432. logger.debug('Event recd', pusherEvent);
  40433. switch (pusherEvent.event) {
  40434. case 'pusher:error':
  40435. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  40436. break;
  40437. case 'pusher:ping':
  40438. _this.emit("ping");
  40439. break;
  40440. case 'pusher:pong':
  40441. _this.emit("pong");
  40442. break;
  40443. }
  40444. _this.emit('message', pusherEvent);
  40445. }
  40446. },
  40447. activity: function () {
  40448. _this.emit("activity");
  40449. },
  40450. error: function (error) {
  40451. _this.emit("error", { type: "WebSocketError", error: error });
  40452. },
  40453. closed: function (closeEvent) {
  40454. unbindListeners();
  40455. if (closeEvent && closeEvent.code) {
  40456. _this.handleCloseEvent(closeEvent);
  40457. }
  40458. _this.transport = null;
  40459. _this.emit("closed");
  40460. }
  40461. };
  40462. var unbindListeners = function () {
  40463. objectApply(listeners, function (listener, event) {
  40464. _this.transport.unbind(event, listener);
  40465. });
  40466. };
  40467. objectApply(listeners, function (listener, event) {
  40468. _this.transport.bind(event, listener);
  40469. });
  40470. };
  40471. Connection.prototype.handleCloseEvent = function (closeEvent) {
  40472. var action = protocol_protocol.getCloseAction(closeEvent);
  40473. var error = protocol_protocol.getCloseError(closeEvent);
  40474. if (error) {
  40475. this.emit('error', error);
  40476. }
  40477. if (action) {
  40478. this.emit(action, { action: action, error: error });
  40479. }
  40480. };
  40481. return Connection;
  40482. }(dispatcher));
  40483. /* harmony default export */ var connection_connection = (connection_Connection);
  40484. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  40485. var handshake_Handshake = (function () {
  40486. function Handshake(transport, callback) {
  40487. this.transport = transport;
  40488. this.callback = callback;
  40489. this.bindListeners();
  40490. }
  40491. Handshake.prototype.close = function () {
  40492. this.unbindListeners();
  40493. this.transport.close();
  40494. };
  40495. Handshake.prototype.bindListeners = function () {
  40496. var _this = this;
  40497. this.onMessage = function (m) {
  40498. _this.unbindListeners();
  40499. var result;
  40500. try {
  40501. result = protocol_protocol.processHandshake(m);
  40502. }
  40503. catch (e) {
  40504. _this.finish("error", { error: e });
  40505. _this.transport.close();
  40506. return;
  40507. }
  40508. if (result.action === "connected") {
  40509. _this.finish("connected", {
  40510. connection: new connection_connection(result.id, _this.transport),
  40511. activityTimeout: result.activityTimeout
  40512. });
  40513. }
  40514. else {
  40515. _this.finish(result.action, { error: result.error });
  40516. _this.transport.close();
  40517. }
  40518. };
  40519. this.onClosed = function (closeEvent) {
  40520. _this.unbindListeners();
  40521. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  40522. var error = protocol_protocol.getCloseError(closeEvent);
  40523. _this.finish(action, { error: error });
  40524. };
  40525. this.transport.bind("message", this.onMessage);
  40526. this.transport.bind("closed", this.onClosed);
  40527. };
  40528. Handshake.prototype.unbindListeners = function () {
  40529. this.transport.unbind("message", this.onMessage);
  40530. this.transport.unbind("closed", this.onClosed);
  40531. };
  40532. Handshake.prototype.finish = function (action, params) {
  40533. this.callback(extend({ transport: this.transport, action: action }, params));
  40534. };
  40535. return Handshake;
  40536. }());
  40537. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  40538. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  40539. var pusher_authorizer_PusherAuthorizer = (function () {
  40540. function PusherAuthorizer(channel, options) {
  40541. this.channel = channel;
  40542. var authTransport = options.authTransport;
  40543. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  40544. throw "'" + authTransport + "' is not a recognized auth transport";
  40545. }
  40546. this.type = authTransport;
  40547. this.options = options;
  40548. this.authOptions = (options || {}).auth || {};
  40549. }
  40550. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  40551. var query = 'socket_id=' + encodeURIComponent(socketId) +
  40552. '&channel_name=' + encodeURIComponent(this.channel.name);
  40553. for (var i in this.authOptions.params) {
  40554. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  40555. }
  40556. return query;
  40557. };
  40558. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  40559. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  40560. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  40561. };
  40562. return PusherAuthorizer;
  40563. }());
  40564. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  40565. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  40566. var timeline_sender_TimelineSender = (function () {
  40567. function TimelineSender(timeline, options) {
  40568. this.timeline = timeline;
  40569. this.options = options || {};
  40570. }
  40571. TimelineSender.prototype.send = function (useTLS, callback) {
  40572. if (this.timeline.isEmpty()) {
  40573. return;
  40574. }
  40575. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  40576. };
  40577. return TimelineSender;
  40578. }());
  40579. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  40580. // CONCATENATED MODULE: ./src/core/errors.ts
  40581. var errors_extends = (undefined && undefined.__extends) || (function () {
  40582. var extendStatics = function (d, b) {
  40583. extendStatics = Object.setPrototypeOf ||
  40584. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40585. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40586. return extendStatics(d, b);
  40587. };
  40588. return function (d, b) {
  40589. extendStatics(d, b);
  40590. function __() { this.constructor = d; }
  40591. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40592. };
  40593. })();
  40594. var BadEventName = (function (_super) {
  40595. errors_extends(BadEventName, _super);
  40596. function BadEventName(msg) {
  40597. var _newTarget = this.constructor;
  40598. var _this = _super.call(this, msg) || this;
  40599. Object.setPrototypeOf(_this, _newTarget.prototype);
  40600. return _this;
  40601. }
  40602. return BadEventName;
  40603. }(Error));
  40604. var RequestTimedOut = (function (_super) {
  40605. errors_extends(RequestTimedOut, _super);
  40606. function RequestTimedOut(msg) {
  40607. var _newTarget = this.constructor;
  40608. var _this = _super.call(this, msg) || this;
  40609. Object.setPrototypeOf(_this, _newTarget.prototype);
  40610. return _this;
  40611. }
  40612. return RequestTimedOut;
  40613. }(Error));
  40614. var TransportPriorityTooLow = (function (_super) {
  40615. errors_extends(TransportPriorityTooLow, _super);
  40616. function TransportPriorityTooLow(msg) {
  40617. var _newTarget = this.constructor;
  40618. var _this = _super.call(this, msg) || this;
  40619. Object.setPrototypeOf(_this, _newTarget.prototype);
  40620. return _this;
  40621. }
  40622. return TransportPriorityTooLow;
  40623. }(Error));
  40624. var TransportClosed = (function (_super) {
  40625. errors_extends(TransportClosed, _super);
  40626. function TransportClosed(msg) {
  40627. var _newTarget = this.constructor;
  40628. var _this = _super.call(this, msg) || this;
  40629. Object.setPrototypeOf(_this, _newTarget.prototype);
  40630. return _this;
  40631. }
  40632. return TransportClosed;
  40633. }(Error));
  40634. var UnsupportedFeature = (function (_super) {
  40635. errors_extends(UnsupportedFeature, _super);
  40636. function UnsupportedFeature(msg) {
  40637. var _newTarget = this.constructor;
  40638. var _this = _super.call(this, msg) || this;
  40639. Object.setPrototypeOf(_this, _newTarget.prototype);
  40640. return _this;
  40641. }
  40642. return UnsupportedFeature;
  40643. }(Error));
  40644. var UnsupportedTransport = (function (_super) {
  40645. errors_extends(UnsupportedTransport, _super);
  40646. function UnsupportedTransport(msg) {
  40647. var _newTarget = this.constructor;
  40648. var _this = _super.call(this, msg) || this;
  40649. Object.setPrototypeOf(_this, _newTarget.prototype);
  40650. return _this;
  40651. }
  40652. return UnsupportedTransport;
  40653. }(Error));
  40654. var UnsupportedStrategy = (function (_super) {
  40655. errors_extends(UnsupportedStrategy, _super);
  40656. function UnsupportedStrategy(msg) {
  40657. var _newTarget = this.constructor;
  40658. var _this = _super.call(this, msg) || this;
  40659. Object.setPrototypeOf(_this, _newTarget.prototype);
  40660. return _this;
  40661. }
  40662. return UnsupportedStrategy;
  40663. }(Error));
  40664. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  40665. var channel_extends = (undefined && undefined.__extends) || (function () {
  40666. var extendStatics = function (d, b) {
  40667. extendStatics = Object.setPrototypeOf ||
  40668. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40669. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40670. return extendStatics(d, b);
  40671. };
  40672. return function (d, b) {
  40673. extendStatics(d, b);
  40674. function __() { this.constructor = d; }
  40675. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40676. };
  40677. })();
  40678. var channel_Channel = (function (_super) {
  40679. channel_extends(Channel, _super);
  40680. function Channel(name, pusher) {
  40681. var _this = _super.call(this, function (event, data) {
  40682. logger.debug('No callbacks on ' + name + ' for ' + event);
  40683. }) || this;
  40684. _this.name = name;
  40685. _this.pusher = pusher;
  40686. _this.subscribed = false;
  40687. _this.subscriptionPending = false;
  40688. _this.subscriptionCancelled = false;
  40689. return _this;
  40690. }
  40691. Channel.prototype.authorize = function (socketId, callback) {
  40692. return callback(false, {});
  40693. };
  40694. Channel.prototype.trigger = function (event, data) {
  40695. if (event.indexOf("client-") !== 0) {
  40696. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  40697. }
  40698. if (!this.subscribed) {
  40699. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  40700. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  40701. }
  40702. return this.pusher.send_event(event, data, this.name);
  40703. };
  40704. Channel.prototype.disconnect = function () {
  40705. this.subscribed = false;
  40706. this.subscriptionPending = false;
  40707. };
  40708. Channel.prototype.handleEvent = function (event) {
  40709. var eventName = event.event;
  40710. var data = event.data;
  40711. if (eventName === "pusher_internal:subscription_succeeded") {
  40712. this.handleSubscriptionSucceededEvent(event);
  40713. }
  40714. else if (eventName.indexOf("pusher_internal:") !== 0) {
  40715. var metadata = {};
  40716. this.emit(eventName, data, metadata);
  40717. }
  40718. };
  40719. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40720. this.subscriptionPending = false;
  40721. this.subscribed = true;
  40722. if (this.subscriptionCancelled) {
  40723. this.pusher.unsubscribe(this.name);
  40724. }
  40725. else {
  40726. this.emit("pusher:subscription_succeeded", event.data);
  40727. }
  40728. };
  40729. Channel.prototype.subscribe = function () {
  40730. var _this = this;
  40731. if (this.subscribed) {
  40732. return;
  40733. }
  40734. this.subscriptionPending = true;
  40735. this.subscriptionCancelled = false;
  40736. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  40737. if (error) {
  40738. logger.error(data);
  40739. _this.emit('pusher:subscription_error', data);
  40740. }
  40741. else {
  40742. _this.pusher.send_event('pusher:subscribe', {
  40743. auth: data.auth,
  40744. channel_data: data.channel_data,
  40745. channel: _this.name
  40746. });
  40747. }
  40748. });
  40749. };
  40750. Channel.prototype.unsubscribe = function () {
  40751. this.subscribed = false;
  40752. this.pusher.send_event('pusher:unsubscribe', {
  40753. channel: this.name
  40754. });
  40755. };
  40756. Channel.prototype.cancelSubscription = function () {
  40757. this.subscriptionCancelled = true;
  40758. };
  40759. Channel.prototype.reinstateSubscription = function () {
  40760. this.subscriptionCancelled = false;
  40761. };
  40762. return Channel;
  40763. }(dispatcher));
  40764. /* harmony default export */ var channels_channel = (channel_Channel);
  40765. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  40766. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  40767. var extendStatics = function (d, b) {
  40768. extendStatics = Object.setPrototypeOf ||
  40769. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40770. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40771. return extendStatics(d, b);
  40772. };
  40773. return function (d, b) {
  40774. extendStatics(d, b);
  40775. function __() { this.constructor = d; }
  40776. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40777. };
  40778. })();
  40779. var private_channel_PrivateChannel = (function (_super) {
  40780. private_channel_extends(PrivateChannel, _super);
  40781. function PrivateChannel() {
  40782. return _super !== null && _super.apply(this, arguments) || this;
  40783. }
  40784. PrivateChannel.prototype.authorize = function (socketId, callback) {
  40785. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  40786. return authorizer.authorize(socketId, callback);
  40787. };
  40788. return PrivateChannel;
  40789. }(channels_channel));
  40790. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  40791. // CONCATENATED MODULE: ./src/core/channels/members.ts
  40792. var members_Members = (function () {
  40793. function Members() {
  40794. this.reset();
  40795. }
  40796. Members.prototype.get = function (id) {
  40797. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  40798. return {
  40799. id: id,
  40800. info: this.members[id]
  40801. };
  40802. }
  40803. else {
  40804. return null;
  40805. }
  40806. };
  40807. Members.prototype.each = function (callback) {
  40808. var _this = this;
  40809. objectApply(this.members, function (member, id) {
  40810. callback(_this.get(id));
  40811. });
  40812. };
  40813. Members.prototype.setMyID = function (id) {
  40814. this.myID = id;
  40815. };
  40816. Members.prototype.onSubscription = function (subscriptionData) {
  40817. this.members = subscriptionData.presence.hash;
  40818. this.count = subscriptionData.presence.count;
  40819. this.me = this.get(this.myID);
  40820. };
  40821. Members.prototype.addMember = function (memberData) {
  40822. if (this.get(memberData.user_id) === null) {
  40823. this.count++;
  40824. }
  40825. this.members[memberData.user_id] = memberData.user_info;
  40826. return this.get(memberData.user_id);
  40827. };
  40828. Members.prototype.removeMember = function (memberData) {
  40829. var member = this.get(memberData.user_id);
  40830. if (member) {
  40831. delete this.members[memberData.user_id];
  40832. this.count--;
  40833. }
  40834. return member;
  40835. };
  40836. Members.prototype.reset = function () {
  40837. this.members = {};
  40838. this.count = 0;
  40839. this.myID = null;
  40840. this.me = null;
  40841. };
  40842. return Members;
  40843. }());
  40844. /* harmony default export */ var members = (members_Members);
  40845. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  40846. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  40847. var extendStatics = function (d, b) {
  40848. extendStatics = Object.setPrototypeOf ||
  40849. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40850. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40851. return extendStatics(d, b);
  40852. };
  40853. return function (d, b) {
  40854. extendStatics(d, b);
  40855. function __() { this.constructor = d; }
  40856. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40857. };
  40858. })();
  40859. var presence_channel_PresenceChannel = (function (_super) {
  40860. presence_channel_extends(PresenceChannel, _super);
  40861. function PresenceChannel(name, pusher) {
  40862. var _this = _super.call(this, name, pusher) || this;
  40863. _this.members = new members();
  40864. return _this;
  40865. }
  40866. PresenceChannel.prototype.authorize = function (socketId, callback) {
  40867. var _this = this;
  40868. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40869. if (!error) {
  40870. if (authData.channel_data === undefined) {
  40871. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40872. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  40873. ("expected 'channel_data' field. " + suffix));
  40874. callback("Invalid auth response");
  40875. return;
  40876. }
  40877. var channelData = JSON.parse(authData.channel_data);
  40878. _this.members.setMyID(channelData.user_id);
  40879. }
  40880. callback(error, authData);
  40881. });
  40882. };
  40883. PresenceChannel.prototype.handleEvent = function (event) {
  40884. var eventName = event.event;
  40885. if (eventName.indexOf("pusher_internal:") === 0) {
  40886. this.handleInternalEvent(event);
  40887. }
  40888. else {
  40889. var data = event.data;
  40890. var metadata = {};
  40891. if (event.user_id) {
  40892. metadata.user_id = event.user_id;
  40893. }
  40894. this.emit(eventName, data, metadata);
  40895. }
  40896. };
  40897. PresenceChannel.prototype.handleInternalEvent = function (event) {
  40898. var eventName = event.event;
  40899. var data = event.data;
  40900. switch (eventName) {
  40901. case "pusher_internal:subscription_succeeded":
  40902. this.handleSubscriptionSucceededEvent(event);
  40903. break;
  40904. case "pusher_internal:member_added":
  40905. var addedMember = this.members.addMember(data);
  40906. this.emit('pusher:member_added', addedMember);
  40907. break;
  40908. case "pusher_internal:member_removed":
  40909. var removedMember = this.members.removeMember(data);
  40910. if (removedMember) {
  40911. this.emit('pusher:member_removed', removedMember);
  40912. }
  40913. break;
  40914. }
  40915. };
  40916. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40917. this.subscriptionPending = false;
  40918. this.subscribed = true;
  40919. if (this.subscriptionCancelled) {
  40920. this.pusher.unsubscribe(this.name);
  40921. }
  40922. else {
  40923. this.members.onSubscription(event.data);
  40924. this.emit("pusher:subscription_succeeded", this.members);
  40925. }
  40926. };
  40927. PresenceChannel.prototype.disconnect = function () {
  40928. this.members.reset();
  40929. _super.prototype.disconnect.call(this);
  40930. };
  40931. return PresenceChannel;
  40932. }(private_channel));
  40933. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  40934. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  40935. var nacl_fast = __webpack_require__(0);
  40936. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  40937. var nacl_util = __webpack_require__(1);
  40938. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  40939. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  40940. var extendStatics = function (d, b) {
  40941. extendStatics = Object.setPrototypeOf ||
  40942. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40943. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40944. return extendStatics(d, b);
  40945. };
  40946. return function (d, b) {
  40947. extendStatics(d, b);
  40948. function __() { this.constructor = d; }
  40949. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40950. };
  40951. })();
  40952. var encrypted_channel_EncryptedChannel = (function (_super) {
  40953. encrypted_channel_extends(EncryptedChannel, _super);
  40954. function EncryptedChannel() {
  40955. var _this = _super !== null && _super.apply(this, arguments) || this;
  40956. _this.key = null;
  40957. return _this;
  40958. }
  40959. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  40960. var _this = this;
  40961. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40962. if (error) {
  40963. callback(true, authData);
  40964. return;
  40965. }
  40966. var sharedSecret = authData["shared_secret"];
  40967. if (!sharedSecret) {
  40968. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  40969. callback(true, errorMsg);
  40970. return;
  40971. }
  40972. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  40973. delete authData["shared_secret"];
  40974. callback(false, authData);
  40975. });
  40976. };
  40977. EncryptedChannel.prototype.trigger = function (event, data) {
  40978. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  40979. };
  40980. EncryptedChannel.prototype.handleEvent = function (event) {
  40981. var eventName = event.event;
  40982. var data = event.data;
  40983. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  40984. _super.prototype.handleEvent.call(this, event);
  40985. return;
  40986. }
  40987. this.handleEncryptedEvent(eventName, data);
  40988. };
  40989. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  40990. var _this = this;
  40991. if (!this.key) {
  40992. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  40993. return;
  40994. }
  40995. if (!data.ciphertext || !data.nonce) {
  40996. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  40997. return;
  40998. }
  40999. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  41000. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  41001. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  41002. return;
  41003. }
  41004. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  41005. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  41006. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  41007. return;
  41008. }
  41009. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  41010. if (bytes === null) {
  41011. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  41012. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  41013. if (error) {
  41014. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  41015. return;
  41016. }
  41017. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  41018. if (bytes === null) {
  41019. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  41020. return;
  41021. }
  41022. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41023. return;
  41024. });
  41025. return;
  41026. }
  41027. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41028. };
  41029. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  41030. try {
  41031. this.emit(eventName, JSON.parse(data));
  41032. }
  41033. catch (e) {
  41034. this.emit(eventName, data);
  41035. }
  41036. return this;
  41037. };
  41038. return EncryptedChannel;
  41039. }(private_channel));
  41040. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  41041. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  41042. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  41043. var extendStatics = function (d, b) {
  41044. extendStatics = Object.setPrototypeOf ||
  41045. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41046. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41047. return extendStatics(d, b);
  41048. };
  41049. return function (d, b) {
  41050. extendStatics(d, b);
  41051. function __() { this.constructor = d; }
  41052. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41053. };
  41054. })();
  41055. var connection_manager_ConnectionManager = (function (_super) {
  41056. connection_manager_extends(ConnectionManager, _super);
  41057. function ConnectionManager(key, options) {
  41058. var _this = _super.call(this) || this;
  41059. _this.key = key;
  41060. _this.options = options || {};
  41061. _this.state = "initialized";
  41062. _this.connection = null;
  41063. _this.usingTLS = !!options.useTLS;
  41064. _this.timeline = _this.options.timeline;
  41065. _this.errorCallbacks = _this.buildErrorCallbacks();
  41066. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  41067. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  41068. var Network = runtime.getNetwork();
  41069. Network.bind("online", function () {
  41070. _this.timeline.info({ netinfo: "online" });
  41071. if (_this.state === "connecting" || _this.state === "unavailable") {
  41072. _this.retryIn(0);
  41073. }
  41074. });
  41075. Network.bind("offline", function () {
  41076. _this.timeline.info({ netinfo: "offline" });
  41077. if (_this.connection) {
  41078. _this.sendActivityCheck();
  41079. }
  41080. });
  41081. _this.updateStrategy();
  41082. return _this;
  41083. }
  41084. ConnectionManager.prototype.connect = function () {
  41085. if (this.connection || this.runner) {
  41086. return;
  41087. }
  41088. if (!this.strategy.isSupported()) {
  41089. this.updateState("failed");
  41090. return;
  41091. }
  41092. this.updateState("connecting");
  41093. this.startConnecting();
  41094. this.setUnavailableTimer();
  41095. };
  41096. ;
  41097. ConnectionManager.prototype.send = function (data) {
  41098. if (this.connection) {
  41099. return this.connection.send(data);
  41100. }
  41101. else {
  41102. return false;
  41103. }
  41104. };
  41105. ;
  41106. ConnectionManager.prototype.send_event = function (name, data, channel) {
  41107. if (this.connection) {
  41108. return this.connection.send_event(name, data, channel);
  41109. }
  41110. else {
  41111. return false;
  41112. }
  41113. };
  41114. ;
  41115. ConnectionManager.prototype.disconnect = function () {
  41116. this.disconnectInternally();
  41117. this.updateState("disconnected");
  41118. };
  41119. ;
  41120. ConnectionManager.prototype.isUsingTLS = function () {
  41121. return this.usingTLS;
  41122. };
  41123. ;
  41124. ConnectionManager.prototype.startConnecting = function () {
  41125. var _this = this;
  41126. var callback = function (error, handshake) {
  41127. if (error) {
  41128. _this.runner = _this.strategy.connect(0, callback);
  41129. }
  41130. else {
  41131. if (handshake.action === "error") {
  41132. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  41133. _this.timeline.error({ handshakeError: handshake.error });
  41134. }
  41135. else {
  41136. _this.abortConnecting();
  41137. _this.handshakeCallbacks[handshake.action](handshake);
  41138. }
  41139. }
  41140. };
  41141. this.runner = this.strategy.connect(0, callback);
  41142. };
  41143. ;
  41144. ConnectionManager.prototype.abortConnecting = function () {
  41145. if (this.runner) {
  41146. this.runner.abort();
  41147. this.runner = null;
  41148. }
  41149. };
  41150. ;
  41151. ConnectionManager.prototype.disconnectInternally = function () {
  41152. this.abortConnecting();
  41153. this.clearRetryTimer();
  41154. this.clearUnavailableTimer();
  41155. if (this.connection) {
  41156. var connection = this.abandonConnection();
  41157. connection.close();
  41158. }
  41159. };
  41160. ;
  41161. ConnectionManager.prototype.updateStrategy = function () {
  41162. this.strategy = this.options.getStrategy({
  41163. key: this.key,
  41164. timeline: this.timeline,
  41165. useTLS: this.usingTLS
  41166. });
  41167. };
  41168. ;
  41169. ConnectionManager.prototype.retryIn = function (delay) {
  41170. var _this = this;
  41171. this.timeline.info({ action: "retry", delay: delay });
  41172. if (delay > 0) {
  41173. this.emit("connecting_in", Math.round(delay / 1000));
  41174. }
  41175. this.retryTimer = new OneOffTimer(delay || 0, function () {
  41176. _this.disconnectInternally();
  41177. _this.connect();
  41178. });
  41179. };
  41180. ;
  41181. ConnectionManager.prototype.clearRetryTimer = function () {
  41182. if (this.retryTimer) {
  41183. this.retryTimer.ensureAborted();
  41184. this.retryTimer = null;
  41185. }
  41186. };
  41187. ;
  41188. ConnectionManager.prototype.setUnavailableTimer = function () {
  41189. var _this = this;
  41190. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  41191. _this.updateState("unavailable");
  41192. });
  41193. };
  41194. ;
  41195. ConnectionManager.prototype.clearUnavailableTimer = function () {
  41196. if (this.unavailableTimer) {
  41197. this.unavailableTimer.ensureAborted();
  41198. }
  41199. };
  41200. ;
  41201. ConnectionManager.prototype.sendActivityCheck = function () {
  41202. var _this = this;
  41203. this.stopActivityCheck();
  41204. this.connection.ping();
  41205. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  41206. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  41207. _this.retryIn(0);
  41208. });
  41209. };
  41210. ;
  41211. ConnectionManager.prototype.resetActivityCheck = function () {
  41212. var _this = this;
  41213. this.stopActivityCheck();
  41214. if (this.connection && !this.connection.handlesActivityChecks()) {
  41215. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  41216. _this.sendActivityCheck();
  41217. });
  41218. }
  41219. };
  41220. ;
  41221. ConnectionManager.prototype.stopActivityCheck = function () {
  41222. if (this.activityTimer) {
  41223. this.activityTimer.ensureAborted();
  41224. }
  41225. };
  41226. ;
  41227. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  41228. var _this = this;
  41229. return extend({}, errorCallbacks, {
  41230. message: function (message) {
  41231. _this.resetActivityCheck();
  41232. _this.emit('message', message);
  41233. },
  41234. ping: function () {
  41235. _this.send_event('pusher:pong', {});
  41236. },
  41237. activity: function () {
  41238. _this.resetActivityCheck();
  41239. },
  41240. error: function (error) {
  41241. _this.emit("error", { type: "WebSocketError", error: error });
  41242. },
  41243. closed: function () {
  41244. _this.abandonConnection();
  41245. if (_this.shouldRetry()) {
  41246. _this.retryIn(1000);
  41247. }
  41248. }
  41249. });
  41250. };
  41251. ;
  41252. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  41253. var _this = this;
  41254. return extend({}, errorCallbacks, {
  41255. connected: function (handshake) {
  41256. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  41257. _this.clearUnavailableTimer();
  41258. _this.setConnection(handshake.connection);
  41259. _this.socket_id = _this.connection.id;
  41260. _this.updateState("connected", { socket_id: _this.socket_id });
  41261. }
  41262. });
  41263. };
  41264. ;
  41265. ConnectionManager.prototype.buildErrorCallbacks = function () {
  41266. var _this = this;
  41267. var withErrorEmitted = function (callback) {
  41268. return function (result) {
  41269. if (result.error) {
  41270. _this.emit("error", { type: "WebSocketError", error: result.error });
  41271. }
  41272. callback(result);
  41273. };
  41274. };
  41275. return {
  41276. tls_only: withErrorEmitted(function () {
  41277. _this.usingTLS = true;
  41278. _this.updateStrategy();
  41279. _this.retryIn(0);
  41280. }),
  41281. refused: withErrorEmitted(function () {
  41282. _this.disconnect();
  41283. }),
  41284. backoff: withErrorEmitted(function () {
  41285. _this.retryIn(1000);
  41286. }),
  41287. retry: withErrorEmitted(function () {
  41288. _this.retryIn(0);
  41289. })
  41290. };
  41291. };
  41292. ;
  41293. ConnectionManager.prototype.setConnection = function (connection) {
  41294. this.connection = connection;
  41295. for (var event in this.connectionCallbacks) {
  41296. this.connection.bind(event, this.connectionCallbacks[event]);
  41297. }
  41298. this.resetActivityCheck();
  41299. };
  41300. ;
  41301. ConnectionManager.prototype.abandonConnection = function () {
  41302. if (!this.connection) {
  41303. return;
  41304. }
  41305. this.stopActivityCheck();
  41306. for (var event in this.connectionCallbacks) {
  41307. this.connection.unbind(event, this.connectionCallbacks[event]);
  41308. }
  41309. var connection = this.connection;
  41310. this.connection = null;
  41311. return connection;
  41312. };
  41313. ConnectionManager.prototype.updateState = function (newState, data) {
  41314. var previousState = this.state;
  41315. this.state = newState;
  41316. if (previousState !== newState) {
  41317. var newStateDescription = newState;
  41318. if (newStateDescription === "connected") {
  41319. newStateDescription += " with new socket ID " + data.socket_id;
  41320. }
  41321. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  41322. this.timeline.info({ state: newState, params: data });
  41323. this.emit('state_change', { previous: previousState, current: newState });
  41324. this.emit(newState, data);
  41325. }
  41326. };
  41327. ConnectionManager.prototype.shouldRetry = function () {
  41328. return this.state === "connecting" || this.state === "connected";
  41329. };
  41330. return ConnectionManager;
  41331. }(dispatcher));
  41332. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  41333. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  41334. var channels_Channels = (function () {
  41335. function Channels() {
  41336. this.channels = {};
  41337. }
  41338. Channels.prototype.add = function (name, pusher) {
  41339. if (!this.channels[name]) {
  41340. this.channels[name] = createChannel(name, pusher);
  41341. }
  41342. return this.channels[name];
  41343. };
  41344. Channels.prototype.all = function () {
  41345. return values(this.channels);
  41346. };
  41347. Channels.prototype.find = function (name) {
  41348. return this.channels[name];
  41349. };
  41350. Channels.prototype.remove = function (name) {
  41351. var channel = this.channels[name];
  41352. delete this.channels[name];
  41353. return channel;
  41354. };
  41355. Channels.prototype.disconnect = function () {
  41356. objectApply(this.channels, function (channel) {
  41357. channel.disconnect();
  41358. });
  41359. };
  41360. return Channels;
  41361. }());
  41362. /* harmony default export */ var channels = (channels_Channels);
  41363. function createChannel(name, pusher) {
  41364. if (name.indexOf('private-encrypted-') === 0) {
  41365. if (false) { var errorMsg; }
  41366. return factory.createEncryptedChannel(name, pusher);
  41367. }
  41368. else if (name.indexOf('private-') === 0) {
  41369. return factory.createPrivateChannel(name, pusher);
  41370. }
  41371. else if (name.indexOf('presence-') === 0) {
  41372. return factory.createPresenceChannel(name, pusher);
  41373. }
  41374. else {
  41375. return factory.createChannel(name, pusher);
  41376. }
  41377. }
  41378. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  41379. var Factory = {
  41380. createChannels: function () {
  41381. return new channels();
  41382. },
  41383. createConnectionManager: function (key, options) {
  41384. return new connection_manager(key, options);
  41385. },
  41386. createChannel: function (name, pusher) {
  41387. return new channels_channel(name, pusher);
  41388. },
  41389. createPrivateChannel: function (name, pusher) {
  41390. return new private_channel(name, pusher);
  41391. },
  41392. createPresenceChannel: function (name, pusher) {
  41393. return new presence_channel(name, pusher);
  41394. },
  41395. createEncryptedChannel: function (name, pusher) {
  41396. return new encrypted_channel(name, pusher);
  41397. },
  41398. createTimelineSender: function (timeline, options) {
  41399. return new timeline_sender(timeline, options);
  41400. },
  41401. createAuthorizer: function (channel, options) {
  41402. if (options.authorizer) {
  41403. return options.authorizer(channel, options);
  41404. }
  41405. return new pusher_authorizer(channel, options);
  41406. },
  41407. createHandshake: function (transport, callback) {
  41408. return new connection_handshake(transport, callback);
  41409. },
  41410. createAssistantToTheTransportManager: function (manager, transport, options) {
  41411. return new assistant_to_the_transport_manager(manager, transport, options);
  41412. }
  41413. };
  41414. /* harmony default export */ var factory = (Factory);
  41415. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  41416. var transport_manager_TransportManager = (function () {
  41417. function TransportManager(options) {
  41418. this.options = options || {};
  41419. this.livesLeft = this.options.lives || Infinity;
  41420. }
  41421. TransportManager.prototype.getAssistant = function (transport) {
  41422. return factory.createAssistantToTheTransportManager(this, transport, {
  41423. minPingDelay: this.options.minPingDelay,
  41424. maxPingDelay: this.options.maxPingDelay
  41425. });
  41426. };
  41427. TransportManager.prototype.isAlive = function () {
  41428. return this.livesLeft > 0;
  41429. };
  41430. TransportManager.prototype.reportDeath = function () {
  41431. this.livesLeft -= 1;
  41432. };
  41433. return TransportManager;
  41434. }());
  41435. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  41436. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  41437. var sequential_strategy_SequentialStrategy = (function () {
  41438. function SequentialStrategy(strategies, options) {
  41439. this.strategies = strategies;
  41440. this.loop = Boolean(options.loop);
  41441. this.failFast = Boolean(options.failFast);
  41442. this.timeout = options.timeout;
  41443. this.timeoutLimit = options.timeoutLimit;
  41444. }
  41445. SequentialStrategy.prototype.isSupported = function () {
  41446. return any(this.strategies, util.method("isSupported"));
  41447. };
  41448. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  41449. var _this = this;
  41450. var strategies = this.strategies;
  41451. var current = 0;
  41452. var timeout = this.timeout;
  41453. var runner = null;
  41454. var tryNextStrategy = function (error, handshake) {
  41455. if (handshake) {
  41456. callback(null, handshake);
  41457. }
  41458. else {
  41459. current = current + 1;
  41460. if (_this.loop) {
  41461. current = current % strategies.length;
  41462. }
  41463. if (current < strategies.length) {
  41464. if (timeout) {
  41465. timeout = timeout * 2;
  41466. if (_this.timeoutLimit) {
  41467. timeout = Math.min(timeout, _this.timeoutLimit);
  41468. }
  41469. }
  41470. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  41471. }
  41472. else {
  41473. callback(true);
  41474. }
  41475. }
  41476. };
  41477. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  41478. return {
  41479. abort: function () {
  41480. runner.abort();
  41481. },
  41482. forceMinPriority: function (p) {
  41483. minPriority = p;
  41484. if (runner) {
  41485. runner.forceMinPriority(p);
  41486. }
  41487. }
  41488. };
  41489. };
  41490. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  41491. var timer = null;
  41492. var runner = null;
  41493. if (options.timeout > 0) {
  41494. timer = new OneOffTimer(options.timeout, function () {
  41495. runner.abort();
  41496. callback(true);
  41497. });
  41498. }
  41499. runner = strategy.connect(minPriority, function (error, handshake) {
  41500. if (error && timer && timer.isRunning() && !options.failFast) {
  41501. return;
  41502. }
  41503. if (timer) {
  41504. timer.ensureAborted();
  41505. }
  41506. callback(error, handshake);
  41507. });
  41508. return {
  41509. abort: function () {
  41510. if (timer) {
  41511. timer.ensureAborted();
  41512. }
  41513. runner.abort();
  41514. },
  41515. forceMinPriority: function (p) {
  41516. runner.forceMinPriority(p);
  41517. }
  41518. };
  41519. };
  41520. return SequentialStrategy;
  41521. }());
  41522. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  41523. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  41524. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  41525. function BestConnectedEverStrategy(strategies) {
  41526. this.strategies = strategies;
  41527. }
  41528. BestConnectedEverStrategy.prototype.isSupported = function () {
  41529. return any(this.strategies, util.method("isSupported"));
  41530. };
  41531. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  41532. return connect(this.strategies, minPriority, function (i, runners) {
  41533. return function (error, handshake) {
  41534. runners[i].error = error;
  41535. if (error) {
  41536. if (allRunnersFailed(runners)) {
  41537. callback(true);
  41538. }
  41539. return;
  41540. }
  41541. apply(runners, function (runner) {
  41542. runner.forceMinPriority(handshake.transport.priority);
  41543. });
  41544. callback(null, handshake);
  41545. };
  41546. });
  41547. };
  41548. return BestConnectedEverStrategy;
  41549. }());
  41550. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  41551. function connect(strategies, minPriority, callbackBuilder) {
  41552. var runners = map(strategies, function (strategy, i, _, rs) {
  41553. return strategy.connect(minPriority, callbackBuilder(i, rs));
  41554. });
  41555. return {
  41556. abort: function () {
  41557. apply(runners, abortRunner);
  41558. },
  41559. forceMinPriority: function (p) {
  41560. apply(runners, function (runner) {
  41561. runner.forceMinPriority(p);
  41562. });
  41563. }
  41564. };
  41565. }
  41566. function allRunnersFailed(runners) {
  41567. return collections_all(runners, function (runner) {
  41568. return Boolean(runner.error);
  41569. });
  41570. }
  41571. function abortRunner(runner) {
  41572. if (!runner.error && !runner.aborted) {
  41573. runner.abort();
  41574. runner.aborted = true;
  41575. }
  41576. }
  41577. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  41578. var cached_strategy_CachedStrategy = (function () {
  41579. function CachedStrategy(strategy, transports, options) {
  41580. this.strategy = strategy;
  41581. this.transports = transports;
  41582. this.ttl = options.ttl || 1800 * 1000;
  41583. this.usingTLS = options.useTLS;
  41584. this.timeline = options.timeline;
  41585. }
  41586. CachedStrategy.prototype.isSupported = function () {
  41587. return this.strategy.isSupported();
  41588. };
  41589. CachedStrategy.prototype.connect = function (minPriority, callback) {
  41590. var usingTLS = this.usingTLS;
  41591. var info = fetchTransportCache(usingTLS);
  41592. var strategies = [this.strategy];
  41593. if (info && info.timestamp + this.ttl >= util.now()) {
  41594. var transport = this.transports[info.transport];
  41595. if (transport) {
  41596. this.timeline.info({
  41597. cached: true,
  41598. transport: info.transport,
  41599. latency: info.latency
  41600. });
  41601. strategies.push(new sequential_strategy([transport], {
  41602. timeout: info.latency * 2 + 1000,
  41603. failFast: true
  41604. }));
  41605. }
  41606. }
  41607. var startTimestamp = util.now();
  41608. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  41609. if (error) {
  41610. flushTransportCache(usingTLS);
  41611. if (strategies.length > 0) {
  41612. startTimestamp = util.now();
  41613. runner = strategies.pop().connect(minPriority, cb);
  41614. }
  41615. else {
  41616. callback(error);
  41617. }
  41618. }
  41619. else {
  41620. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  41621. callback(null, handshake);
  41622. }
  41623. });
  41624. return {
  41625. abort: function () {
  41626. runner.abort();
  41627. },
  41628. forceMinPriority: function (p) {
  41629. minPriority = p;
  41630. if (runner) {
  41631. runner.forceMinPriority(p);
  41632. }
  41633. }
  41634. };
  41635. };
  41636. return CachedStrategy;
  41637. }());
  41638. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  41639. function getTransportCacheKey(usingTLS) {
  41640. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  41641. }
  41642. function fetchTransportCache(usingTLS) {
  41643. var storage = runtime.getLocalStorage();
  41644. if (storage) {
  41645. try {
  41646. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  41647. if (serializedCache) {
  41648. return JSON.parse(serializedCache);
  41649. }
  41650. }
  41651. catch (e) {
  41652. flushTransportCache(usingTLS);
  41653. }
  41654. }
  41655. return null;
  41656. }
  41657. function storeTransportCache(usingTLS, transport, latency) {
  41658. var storage = runtime.getLocalStorage();
  41659. if (storage) {
  41660. try {
  41661. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  41662. timestamp: util.now(),
  41663. transport: transport,
  41664. latency: latency
  41665. });
  41666. }
  41667. catch (e) {
  41668. }
  41669. }
  41670. }
  41671. function flushTransportCache(usingTLS) {
  41672. var storage = runtime.getLocalStorage();
  41673. if (storage) {
  41674. try {
  41675. delete storage[getTransportCacheKey(usingTLS)];
  41676. }
  41677. catch (e) {
  41678. }
  41679. }
  41680. }
  41681. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  41682. var delayed_strategy_DelayedStrategy = (function () {
  41683. function DelayedStrategy(strategy, _a) {
  41684. var number = _a.delay;
  41685. this.strategy = strategy;
  41686. this.options = { delay: number };
  41687. }
  41688. DelayedStrategy.prototype.isSupported = function () {
  41689. return this.strategy.isSupported();
  41690. };
  41691. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  41692. var strategy = this.strategy;
  41693. var runner;
  41694. var timer = new OneOffTimer(this.options.delay, function () {
  41695. runner = strategy.connect(minPriority, callback);
  41696. });
  41697. return {
  41698. abort: function () {
  41699. timer.ensureAborted();
  41700. if (runner) {
  41701. runner.abort();
  41702. }
  41703. },
  41704. forceMinPriority: function (p) {
  41705. minPriority = p;
  41706. if (runner) {
  41707. runner.forceMinPriority(p);
  41708. }
  41709. }
  41710. };
  41711. };
  41712. return DelayedStrategy;
  41713. }());
  41714. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  41715. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  41716. var IfStrategy = (function () {
  41717. function IfStrategy(test, trueBranch, falseBranch) {
  41718. this.test = test;
  41719. this.trueBranch = trueBranch;
  41720. this.falseBranch = falseBranch;
  41721. }
  41722. IfStrategy.prototype.isSupported = function () {
  41723. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41724. return branch.isSupported();
  41725. };
  41726. IfStrategy.prototype.connect = function (minPriority, callback) {
  41727. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41728. return branch.connect(minPriority, callback);
  41729. };
  41730. return IfStrategy;
  41731. }());
  41732. /* harmony default export */ var if_strategy = (IfStrategy);
  41733. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  41734. var FirstConnectedStrategy = (function () {
  41735. function FirstConnectedStrategy(strategy) {
  41736. this.strategy = strategy;
  41737. }
  41738. FirstConnectedStrategy.prototype.isSupported = function () {
  41739. return this.strategy.isSupported();
  41740. };
  41741. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  41742. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  41743. if (handshake) {
  41744. runner.abort();
  41745. }
  41746. callback(error, handshake);
  41747. });
  41748. return runner;
  41749. };
  41750. return FirstConnectedStrategy;
  41751. }());
  41752. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  41753. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  41754. function testSupportsStrategy(strategy) {
  41755. return function () {
  41756. return strategy.isSupported();
  41757. };
  41758. }
  41759. var getDefaultStrategy = function (config, defineTransport) {
  41760. var definedTransports = {};
  41761. function defineTransportStrategy(name, type, priority, options, manager) {
  41762. var transport = defineTransport(config, name, type, priority, options, manager);
  41763. definedTransports[name] = transport;
  41764. return transport;
  41765. }
  41766. var ws_options = {
  41767. hostNonTLS: config.wsHost + ":" + config.wsPort,
  41768. hostTLS: config.wsHost + ":" + config.wssPort,
  41769. httpPath: config.wsPath
  41770. };
  41771. var wss_options = extend({}, ws_options, {
  41772. useTLS: true
  41773. });
  41774. var sockjs_options = {
  41775. hostNonTLS: config.httpHost + ":" + config.httpPort,
  41776. hostTLS: config.httpHost + ":" + config.httpsPort,
  41777. httpPath: config.httpPath
  41778. };
  41779. var timeouts = {
  41780. loop: true,
  41781. timeout: 15000,
  41782. timeoutLimit: 60000
  41783. };
  41784. var ws_manager = new transport_manager({
  41785. lives: 2,
  41786. minPingDelay: 10000,
  41787. maxPingDelay: config.activity_timeout
  41788. });
  41789. var streaming_manager = new transport_manager({
  41790. lives: 2,
  41791. minPingDelay: 10000,
  41792. maxPingDelay: config.activity_timeout
  41793. });
  41794. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  41795. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  41796. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  41797. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  41798. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  41799. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  41800. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  41801. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  41802. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  41803. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  41804. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  41805. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  41806. 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);
  41807. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  41808. var wsStrategy;
  41809. if (config.useTLS) {
  41810. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  41811. }
  41812. else {
  41813. wsStrategy = new best_connected_ever_strategy([
  41814. ws_loop,
  41815. new delayed_strategy(wss_loop, { delay: 2000 }),
  41816. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  41817. ]);
  41818. }
  41819. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  41820. ttl: 1800000,
  41821. timeline: config.timeline,
  41822. useTLS: config.useTLS
  41823. });
  41824. };
  41825. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  41826. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  41827. /* harmony default export */ var transport_connection_initializer = (function () {
  41828. var self = this;
  41829. self.timeline.info(self.buildTimelineMessage({
  41830. transport: self.name + (self.options.useTLS ? "s" : "")
  41831. }));
  41832. if (self.hooks.isInitialized()) {
  41833. self.changeState("initialized");
  41834. }
  41835. else if (self.hooks.file) {
  41836. self.changeState("initializing");
  41837. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  41838. if (self.hooks.isInitialized()) {
  41839. self.changeState("initialized");
  41840. callback(true);
  41841. }
  41842. else {
  41843. if (error) {
  41844. self.onError(error);
  41845. }
  41846. self.onClose();
  41847. callback(false);
  41848. }
  41849. });
  41850. }
  41851. else {
  41852. self.onClose();
  41853. }
  41854. });
  41855. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  41856. var http_xdomain_request_hooks = {
  41857. getRequest: function (socket) {
  41858. var xdr = new window.XDomainRequest();
  41859. xdr.ontimeout = function () {
  41860. socket.emit("error", new RequestTimedOut());
  41861. socket.close();
  41862. };
  41863. xdr.onerror = function (e) {
  41864. socket.emit("error", e);
  41865. socket.close();
  41866. };
  41867. xdr.onprogress = function () {
  41868. if (xdr.responseText && xdr.responseText.length > 0) {
  41869. socket.onChunk(200, xdr.responseText);
  41870. }
  41871. };
  41872. xdr.onload = function () {
  41873. if (xdr.responseText && xdr.responseText.length > 0) {
  41874. socket.onChunk(200, xdr.responseText);
  41875. }
  41876. socket.emit("finished", 200);
  41877. socket.close();
  41878. };
  41879. return xdr;
  41880. },
  41881. abortRequest: function (xdr) {
  41882. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  41883. xdr.abort();
  41884. }
  41885. };
  41886. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  41887. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  41888. var http_request_extends = (undefined && undefined.__extends) || (function () {
  41889. var extendStatics = function (d, b) {
  41890. extendStatics = Object.setPrototypeOf ||
  41891. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41892. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41893. return extendStatics(d, b);
  41894. };
  41895. return function (d, b) {
  41896. extendStatics(d, b);
  41897. function __() { this.constructor = d; }
  41898. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41899. };
  41900. })();
  41901. var MAX_BUFFER_LENGTH = 256 * 1024;
  41902. var http_request_HTTPRequest = (function (_super) {
  41903. http_request_extends(HTTPRequest, _super);
  41904. function HTTPRequest(hooks, method, url) {
  41905. var _this = _super.call(this) || this;
  41906. _this.hooks = hooks;
  41907. _this.method = method;
  41908. _this.url = url;
  41909. return _this;
  41910. }
  41911. HTTPRequest.prototype.start = function (payload) {
  41912. var _this = this;
  41913. this.position = 0;
  41914. this.xhr = this.hooks.getRequest(this);
  41915. this.unloader = function () {
  41916. _this.close();
  41917. };
  41918. runtime.addUnloadListener(this.unloader);
  41919. this.xhr.open(this.method, this.url, true);
  41920. if (this.xhr.setRequestHeader) {
  41921. this.xhr.setRequestHeader("Content-Type", "application/json");
  41922. }
  41923. this.xhr.send(payload);
  41924. };
  41925. HTTPRequest.prototype.close = function () {
  41926. if (this.unloader) {
  41927. runtime.removeUnloadListener(this.unloader);
  41928. this.unloader = null;
  41929. }
  41930. if (this.xhr) {
  41931. this.hooks.abortRequest(this.xhr);
  41932. this.xhr = null;
  41933. }
  41934. };
  41935. HTTPRequest.prototype.onChunk = function (status, data) {
  41936. while (true) {
  41937. var chunk = this.advanceBuffer(data);
  41938. if (chunk) {
  41939. this.emit("chunk", { status: status, data: chunk });
  41940. }
  41941. else {
  41942. break;
  41943. }
  41944. }
  41945. if (this.isBufferTooLong(data)) {
  41946. this.emit("buffer_too_long");
  41947. }
  41948. };
  41949. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  41950. var unreadData = buffer.slice(this.position);
  41951. var endOfLinePosition = unreadData.indexOf("\n");
  41952. if (endOfLinePosition !== -1) {
  41953. this.position += endOfLinePosition + 1;
  41954. return unreadData.slice(0, endOfLinePosition);
  41955. }
  41956. else {
  41957. return null;
  41958. }
  41959. };
  41960. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  41961. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  41962. };
  41963. return HTTPRequest;
  41964. }(dispatcher));
  41965. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  41966. // CONCATENATED MODULE: ./src/core/http/state.ts
  41967. var State;
  41968. (function (State) {
  41969. State[State["CONNECTING"] = 0] = "CONNECTING";
  41970. State[State["OPEN"] = 1] = "OPEN";
  41971. State[State["CLOSED"] = 3] = "CLOSED";
  41972. })(State || (State = {}));
  41973. /* harmony default export */ var state = (State);
  41974. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  41975. var autoIncrement = 1;
  41976. var http_socket_HTTPSocket = (function () {
  41977. function HTTPSocket(hooks, url) {
  41978. this.hooks = hooks;
  41979. this.session = randomNumber(1000) + "/" + randomString(8);
  41980. this.location = getLocation(url);
  41981. this.readyState = state.CONNECTING;
  41982. this.openStream();
  41983. }
  41984. HTTPSocket.prototype.send = function (payload) {
  41985. return this.sendRaw(JSON.stringify([payload]));
  41986. };
  41987. HTTPSocket.prototype.ping = function () {
  41988. this.hooks.sendHeartbeat(this);
  41989. };
  41990. HTTPSocket.prototype.close = function (code, reason) {
  41991. this.onClose(code, reason, true);
  41992. };
  41993. HTTPSocket.prototype.sendRaw = function (payload) {
  41994. if (this.readyState === state.OPEN) {
  41995. try {
  41996. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  41997. return true;
  41998. }
  41999. catch (e) {
  42000. return false;
  42001. }
  42002. }
  42003. else {
  42004. return false;
  42005. }
  42006. };
  42007. HTTPSocket.prototype.reconnect = function () {
  42008. this.closeStream();
  42009. this.openStream();
  42010. };
  42011. ;
  42012. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  42013. this.closeStream();
  42014. this.readyState = state.CLOSED;
  42015. if (this.onclose) {
  42016. this.onclose({
  42017. code: code,
  42018. reason: reason,
  42019. wasClean: wasClean
  42020. });
  42021. }
  42022. };
  42023. HTTPSocket.prototype.onChunk = function (chunk) {
  42024. if (chunk.status !== 200) {
  42025. return;
  42026. }
  42027. if (this.readyState === state.OPEN) {
  42028. this.onActivity();
  42029. }
  42030. var payload;
  42031. var type = chunk.data.slice(0, 1);
  42032. switch (type) {
  42033. case 'o':
  42034. payload = JSON.parse(chunk.data.slice(1) || '{}');
  42035. this.onOpen(payload);
  42036. break;
  42037. case 'a':
  42038. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42039. for (var i = 0; i < payload.length; i++) {
  42040. this.onEvent(payload[i]);
  42041. }
  42042. break;
  42043. case 'm':
  42044. payload = JSON.parse(chunk.data.slice(1) || 'null');
  42045. this.onEvent(payload);
  42046. break;
  42047. case 'h':
  42048. this.hooks.onHeartbeat(this);
  42049. break;
  42050. case 'c':
  42051. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42052. this.onClose(payload[0], payload[1], true);
  42053. break;
  42054. }
  42055. };
  42056. HTTPSocket.prototype.onOpen = function (options) {
  42057. if (this.readyState === state.CONNECTING) {
  42058. if (options && options.hostname) {
  42059. this.location.base = replaceHost(this.location.base, options.hostname);
  42060. }
  42061. this.readyState = state.OPEN;
  42062. if (this.onopen) {
  42063. this.onopen();
  42064. }
  42065. }
  42066. else {
  42067. this.onClose(1006, "Server lost session", true);
  42068. }
  42069. };
  42070. HTTPSocket.prototype.onEvent = function (event) {
  42071. if (this.readyState === state.OPEN && this.onmessage) {
  42072. this.onmessage({ data: event });
  42073. }
  42074. };
  42075. HTTPSocket.prototype.onActivity = function () {
  42076. if (this.onactivity) {
  42077. this.onactivity();
  42078. }
  42079. };
  42080. HTTPSocket.prototype.onError = function (error) {
  42081. if (this.onerror) {
  42082. this.onerror(error);
  42083. }
  42084. };
  42085. HTTPSocket.prototype.openStream = function () {
  42086. var _this = this;
  42087. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  42088. this.stream.bind("chunk", function (chunk) {
  42089. _this.onChunk(chunk);
  42090. });
  42091. this.stream.bind("finished", function (status) {
  42092. _this.hooks.onFinished(_this, status);
  42093. });
  42094. this.stream.bind("buffer_too_long", function () {
  42095. _this.reconnect();
  42096. });
  42097. try {
  42098. this.stream.start();
  42099. }
  42100. catch (error) {
  42101. util.defer(function () {
  42102. _this.onError(error);
  42103. _this.onClose(1006, "Could not start streaming", false);
  42104. });
  42105. }
  42106. };
  42107. HTTPSocket.prototype.closeStream = function () {
  42108. if (this.stream) {
  42109. this.stream.unbind_all();
  42110. this.stream.close();
  42111. this.stream = null;
  42112. }
  42113. };
  42114. return HTTPSocket;
  42115. }());
  42116. function getLocation(url) {
  42117. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  42118. return {
  42119. base: parts[1],
  42120. queryString: parts[2]
  42121. };
  42122. }
  42123. function getSendURL(url, session) {
  42124. return url.base + "/" + session + "/xhr_send";
  42125. }
  42126. function getUniqueURL(url) {
  42127. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  42128. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  42129. }
  42130. function replaceHost(url, hostname) {
  42131. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  42132. return urlParts[1] + hostname + urlParts[3];
  42133. }
  42134. function randomNumber(max) {
  42135. return Math.floor(Math.random() * max);
  42136. }
  42137. function randomString(length) {
  42138. var result = [];
  42139. for (var i = 0; i < length; i++) {
  42140. result.push(randomNumber(32).toString(32));
  42141. }
  42142. return result.join('');
  42143. }
  42144. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  42145. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  42146. var http_streaming_socket_hooks = {
  42147. getReceiveURL: function (url, session) {
  42148. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  42149. },
  42150. onHeartbeat: function (socket) {
  42151. socket.sendRaw("[]");
  42152. },
  42153. sendHeartbeat: function (socket) {
  42154. socket.sendRaw("[]");
  42155. },
  42156. onFinished: function (socket, status) {
  42157. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42158. }
  42159. };
  42160. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  42161. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  42162. var http_polling_socket_hooks = {
  42163. getReceiveURL: function (url, session) {
  42164. return url.base + "/" + session + "/xhr" + url.queryString;
  42165. },
  42166. onHeartbeat: function () {
  42167. },
  42168. sendHeartbeat: function (socket) {
  42169. socket.sendRaw("[]");
  42170. },
  42171. onFinished: function (socket, status) {
  42172. if (status === 200) {
  42173. socket.reconnect();
  42174. }
  42175. else {
  42176. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42177. }
  42178. }
  42179. };
  42180. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  42181. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  42182. var http_xhr_request_hooks = {
  42183. getRequest: function (socket) {
  42184. var Constructor = runtime.getXHRAPI();
  42185. var xhr = new Constructor();
  42186. xhr.onreadystatechange = xhr.onprogress = function () {
  42187. switch (xhr.readyState) {
  42188. case 3:
  42189. if (xhr.responseText && xhr.responseText.length > 0) {
  42190. socket.onChunk(xhr.status, xhr.responseText);
  42191. }
  42192. break;
  42193. case 4:
  42194. if (xhr.responseText && xhr.responseText.length > 0) {
  42195. socket.onChunk(xhr.status, xhr.responseText);
  42196. }
  42197. socket.emit("finished", xhr.status);
  42198. socket.close();
  42199. break;
  42200. }
  42201. };
  42202. return xhr;
  42203. },
  42204. abortRequest: function (xhr) {
  42205. xhr.onreadystatechange = null;
  42206. xhr.abort();
  42207. }
  42208. };
  42209. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  42210. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  42211. var HTTP = {
  42212. createStreamingSocket: function (url) {
  42213. return this.createSocket(http_streaming_socket, url);
  42214. },
  42215. createPollingSocket: function (url) {
  42216. return this.createSocket(http_polling_socket, url);
  42217. },
  42218. createSocket: function (hooks, url) {
  42219. return new http_socket(hooks, url);
  42220. },
  42221. createXHR: function (method, url) {
  42222. return this.createRequest(http_xhr_request, method, url);
  42223. },
  42224. createRequest: function (hooks, method, url) {
  42225. return new http_request(hooks, method, url);
  42226. }
  42227. };
  42228. /* harmony default export */ var http_http = (HTTP);
  42229. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  42230. http_http.createXDR = function (method, url) {
  42231. return this.createRequest(http_xdomain_request, method, url);
  42232. };
  42233. /* harmony default export */ var web_http_http = (http_http);
  42234. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  42235. var Runtime = {
  42236. nextAuthCallbackID: 1,
  42237. auth_callbacks: {},
  42238. ScriptReceivers: ScriptReceivers,
  42239. DependenciesReceivers: DependenciesReceivers,
  42240. getDefaultStrategy: default_strategy,
  42241. Transports: transports_transports,
  42242. transportConnectionInitializer: transport_connection_initializer,
  42243. HTTPFactory: web_http_http,
  42244. TimelineTransport: jsonp_timeline,
  42245. getXHRAPI: function () {
  42246. return window.XMLHttpRequest;
  42247. },
  42248. getWebSocketAPI: function () {
  42249. return window.WebSocket || window.MozWebSocket;
  42250. },
  42251. setup: function (PusherClass) {
  42252. var _this = this;
  42253. window.Pusher = PusherClass;
  42254. var initializeOnDocumentBody = function () {
  42255. _this.onDocumentBody(PusherClass.ready);
  42256. };
  42257. if (!window.JSON) {
  42258. Dependencies.load("json2", {}, initializeOnDocumentBody);
  42259. }
  42260. else {
  42261. initializeOnDocumentBody();
  42262. }
  42263. },
  42264. getDocument: function () {
  42265. return document;
  42266. },
  42267. getProtocol: function () {
  42268. return this.getDocument().location.protocol;
  42269. },
  42270. getAuthorizers: function () {
  42271. return { ajax: xhr_auth, jsonp: jsonp_auth };
  42272. },
  42273. onDocumentBody: function (callback) {
  42274. var _this = this;
  42275. if (document.body) {
  42276. callback();
  42277. }
  42278. else {
  42279. setTimeout(function () {
  42280. _this.onDocumentBody(callback);
  42281. }, 0);
  42282. }
  42283. },
  42284. createJSONPRequest: function (url, data) {
  42285. return new jsonp_request(url, data);
  42286. },
  42287. createScriptRequest: function (src) {
  42288. return new script_request(src);
  42289. },
  42290. getLocalStorage: function () {
  42291. try {
  42292. return window.localStorage;
  42293. }
  42294. catch (e) {
  42295. return undefined;
  42296. }
  42297. },
  42298. createXHR: function () {
  42299. if (this.getXHRAPI()) {
  42300. return this.createXMLHttpRequest();
  42301. }
  42302. else {
  42303. return this.createMicrosoftXHR();
  42304. }
  42305. },
  42306. createXMLHttpRequest: function () {
  42307. var Constructor = this.getXHRAPI();
  42308. return new Constructor();
  42309. },
  42310. createMicrosoftXHR: function () {
  42311. return new ActiveXObject("Microsoft.XMLHTTP");
  42312. },
  42313. getNetwork: function () {
  42314. return net_info_Network;
  42315. },
  42316. createWebSocket: function (url) {
  42317. var Constructor = this.getWebSocketAPI();
  42318. return new Constructor(url);
  42319. },
  42320. createSocketRequest: function (method, url) {
  42321. if (this.isXHRSupported()) {
  42322. return this.HTTPFactory.createXHR(method, url);
  42323. }
  42324. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  42325. return this.HTTPFactory.createXDR(method, url);
  42326. }
  42327. else {
  42328. throw "Cross-origin HTTP requests are not supported";
  42329. }
  42330. },
  42331. isXHRSupported: function () {
  42332. var Constructor = this.getXHRAPI();
  42333. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  42334. },
  42335. isXDRSupported: function (useTLS) {
  42336. var protocol = useTLS ? "https:" : "http:";
  42337. var documentProtocol = this.getProtocol();
  42338. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  42339. },
  42340. addUnloadListener: function (listener) {
  42341. if (window.addEventListener !== undefined) {
  42342. window.addEventListener("unload", listener, false);
  42343. }
  42344. else if (window.attachEvent !== undefined) {
  42345. window.attachEvent("onunload", listener);
  42346. }
  42347. },
  42348. removeUnloadListener: function (listener) {
  42349. if (window.addEventListener !== undefined) {
  42350. window.removeEventListener("unload", listener, false);
  42351. }
  42352. else if (window.detachEvent !== undefined) {
  42353. window.detachEvent("onunload", listener);
  42354. }
  42355. }
  42356. };
  42357. /* harmony default export */ var runtime = (Runtime);
  42358. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  42359. var TimelineLevel;
  42360. (function (TimelineLevel) {
  42361. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  42362. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  42363. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  42364. })(TimelineLevel || (TimelineLevel = {}));
  42365. /* harmony default export */ var timeline_level = (TimelineLevel);
  42366. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  42367. var timeline_Timeline = (function () {
  42368. function Timeline(key, session, options) {
  42369. this.key = key;
  42370. this.session = session;
  42371. this.events = [];
  42372. this.options = options || {};
  42373. this.sent = 0;
  42374. this.uniqueID = 0;
  42375. }
  42376. Timeline.prototype.log = function (level, event) {
  42377. if (level <= this.options.level) {
  42378. this.events.push(extend({}, event, { timestamp: util.now() }));
  42379. if (this.options.limit && this.events.length > this.options.limit) {
  42380. this.events.shift();
  42381. }
  42382. }
  42383. };
  42384. Timeline.prototype.error = function (event) {
  42385. this.log(timeline_level.ERROR, event);
  42386. };
  42387. Timeline.prototype.info = function (event) {
  42388. this.log(timeline_level.INFO, event);
  42389. };
  42390. Timeline.prototype.debug = function (event) {
  42391. this.log(timeline_level.DEBUG, event);
  42392. };
  42393. Timeline.prototype.isEmpty = function () {
  42394. return this.events.length === 0;
  42395. };
  42396. Timeline.prototype.send = function (sendfn, callback) {
  42397. var _this = this;
  42398. var data = extend({
  42399. session: this.session,
  42400. bundle: this.sent + 1,
  42401. key: this.key,
  42402. lib: "js",
  42403. version: this.options.version,
  42404. cluster: this.options.cluster,
  42405. features: this.options.features,
  42406. timeline: this.events
  42407. }, this.options.params);
  42408. this.events = [];
  42409. sendfn(data, function (error, result) {
  42410. if (!error) {
  42411. _this.sent++;
  42412. }
  42413. if (callback) {
  42414. callback(error, result);
  42415. }
  42416. });
  42417. return true;
  42418. };
  42419. Timeline.prototype.generateUniqueID = function () {
  42420. this.uniqueID++;
  42421. return this.uniqueID;
  42422. };
  42423. return Timeline;
  42424. }());
  42425. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  42426. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  42427. var transport_strategy_TransportStrategy = (function () {
  42428. function TransportStrategy(name, priority, transport, options) {
  42429. this.name = name;
  42430. this.priority = priority;
  42431. this.transport = transport;
  42432. this.options = options || {};
  42433. }
  42434. TransportStrategy.prototype.isSupported = function () {
  42435. return this.transport.isSupported({
  42436. useTLS: this.options.useTLS
  42437. });
  42438. };
  42439. TransportStrategy.prototype.connect = function (minPriority, callback) {
  42440. var _this = this;
  42441. if (!this.isSupported()) {
  42442. return failAttempt(new UnsupportedStrategy(), callback);
  42443. }
  42444. else if (this.priority < minPriority) {
  42445. return failAttempt(new TransportPriorityTooLow(), callback);
  42446. }
  42447. var connected = false;
  42448. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  42449. var handshake = null;
  42450. var onInitialized = function () {
  42451. transport.unbind("initialized", onInitialized);
  42452. transport.connect();
  42453. };
  42454. var onOpen = function () {
  42455. handshake = factory.createHandshake(transport, function (result) {
  42456. connected = true;
  42457. unbindListeners();
  42458. callback(null, result);
  42459. });
  42460. };
  42461. var onError = function (error) {
  42462. unbindListeners();
  42463. callback(error);
  42464. };
  42465. var onClosed = function () {
  42466. unbindListeners();
  42467. var serializedTransport;
  42468. serializedTransport = safeJSONStringify(transport);
  42469. callback(new TransportClosed(serializedTransport));
  42470. };
  42471. var unbindListeners = function () {
  42472. transport.unbind("initialized", onInitialized);
  42473. transport.unbind("open", onOpen);
  42474. transport.unbind("error", onError);
  42475. transport.unbind("closed", onClosed);
  42476. };
  42477. transport.bind("initialized", onInitialized);
  42478. transport.bind("open", onOpen);
  42479. transport.bind("error", onError);
  42480. transport.bind("closed", onClosed);
  42481. transport.initialize();
  42482. return {
  42483. abort: function () {
  42484. if (connected) {
  42485. return;
  42486. }
  42487. unbindListeners();
  42488. if (handshake) {
  42489. handshake.close();
  42490. }
  42491. else {
  42492. transport.close();
  42493. }
  42494. },
  42495. forceMinPriority: function (p) {
  42496. if (connected) {
  42497. return;
  42498. }
  42499. if (_this.priority < p) {
  42500. if (handshake) {
  42501. handshake.close();
  42502. }
  42503. else {
  42504. transport.close();
  42505. }
  42506. }
  42507. }
  42508. };
  42509. };
  42510. return TransportStrategy;
  42511. }());
  42512. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  42513. function failAttempt(error, callback) {
  42514. util.defer(function () {
  42515. callback(error);
  42516. });
  42517. return {
  42518. abort: function () { },
  42519. forceMinPriority: function () { }
  42520. };
  42521. }
  42522. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  42523. var strategy_builder_Transports = runtime.Transports;
  42524. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  42525. var transportClass = strategy_builder_Transports[type];
  42526. if (!transportClass) {
  42527. throw new UnsupportedTransport(type);
  42528. }
  42529. var enabled = (!config.enabledTransports ||
  42530. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  42531. (!config.disabledTransports ||
  42532. arrayIndexOf(config.disabledTransports, name) === -1);
  42533. var transport;
  42534. if (enabled) {
  42535. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  42536. key: config.key,
  42537. useTLS: config.useTLS,
  42538. timeline: config.timeline,
  42539. ignoreNullOrigin: config.ignoreNullOrigin
  42540. }, options));
  42541. }
  42542. else {
  42543. transport = strategy_builder_UnsupportedStrategy;
  42544. }
  42545. return transport;
  42546. };
  42547. var strategy_builder_UnsupportedStrategy = {
  42548. isSupported: function () {
  42549. return false;
  42550. },
  42551. connect: function (_, callback) {
  42552. var deferred = util.defer(function () {
  42553. callback(new UnsupportedStrategy());
  42554. });
  42555. return {
  42556. abort: function () {
  42557. deferred.ensureAborted();
  42558. },
  42559. forceMinPriority: function () { }
  42560. };
  42561. }
  42562. };
  42563. // CONCATENATED MODULE: ./src/core/config.ts
  42564. var getGlobalConfig = function () {
  42565. return {
  42566. wsHost: defaults.host,
  42567. wsPort: defaults.ws_port,
  42568. wssPort: defaults.wss_port,
  42569. wsPath: defaults.ws_path,
  42570. httpHost: defaults.sockjs_host,
  42571. httpPort: defaults.sockjs_http_port,
  42572. httpsPort: defaults.sockjs_https_port,
  42573. httpPath: defaults.sockjs_path,
  42574. statsHost: defaults.stats_host,
  42575. authEndpoint: defaults.channel_auth_endpoint,
  42576. authTransport: defaults.channel_auth_transport,
  42577. activity_timeout: defaults.activity_timeout,
  42578. pong_timeout: defaults.pong_timeout,
  42579. unavailable_timeout: defaults.unavailable_timeout
  42580. };
  42581. };
  42582. var getClusterConfig = function (clusterName) {
  42583. return {
  42584. wsHost: 'ws-' + clusterName + '.pusher.com',
  42585. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  42586. };
  42587. };
  42588. // CONCATENATED MODULE: ./src/core/pusher.ts
  42589. var pusher_Pusher = (function () {
  42590. function Pusher(app_key, options) {
  42591. var _this = this;
  42592. checkAppKey(app_key);
  42593. options = options || {};
  42594. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  42595. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  42596. logger.warn("You should always specify a cluster when connecting. " + suffix);
  42597. }
  42598. this.key = app_key;
  42599. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  42600. this.channels = factory.createChannels();
  42601. this.global_emitter = new dispatcher();
  42602. this.sessionID = Math.floor(Math.random() * 1000000000);
  42603. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  42604. cluster: this.config.cluster,
  42605. features: Pusher.getClientFeatures(),
  42606. params: this.config.timelineParams || {},
  42607. limit: 50,
  42608. level: timeline_level.INFO,
  42609. version: defaults.VERSION
  42610. });
  42611. if (!this.config.disableStats) {
  42612. this.timelineSender = factory.createTimelineSender(this.timeline, {
  42613. host: this.config.statsHost,
  42614. path: '/timeline/v2/' + runtime.TimelineTransport.name
  42615. });
  42616. }
  42617. var getStrategy = function (options) {
  42618. var config = extend({}, _this.config, options);
  42619. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  42620. };
  42621. this.connection = factory.createConnectionManager(this.key, extend({
  42622. getStrategy: getStrategy,
  42623. timeline: this.timeline,
  42624. activityTimeout: this.config.activity_timeout,
  42625. pongTimeout: this.config.pong_timeout,
  42626. unavailableTimeout: this.config.unavailable_timeout
  42627. }, this.config, { useTLS: this.shouldUseTLS() }));
  42628. this.connection.bind('connected', function () {
  42629. _this.subscribeAll();
  42630. if (_this.timelineSender) {
  42631. _this.timelineSender.send(_this.connection.isUsingTLS());
  42632. }
  42633. });
  42634. this.connection.bind('message', function (event) {
  42635. var eventName = event.event;
  42636. var internal = eventName.indexOf('pusher_internal:') === 0;
  42637. if (event.channel) {
  42638. var channel = _this.channel(event.channel);
  42639. if (channel) {
  42640. channel.handleEvent(event);
  42641. }
  42642. }
  42643. if (!internal) {
  42644. _this.global_emitter.emit(event.event, event.data);
  42645. }
  42646. });
  42647. this.connection.bind('connecting', function () {
  42648. _this.channels.disconnect();
  42649. });
  42650. this.connection.bind('disconnected', function () {
  42651. _this.channels.disconnect();
  42652. });
  42653. this.connection.bind('error', function (err) {
  42654. logger.warn(err);
  42655. });
  42656. Pusher.instances.push(this);
  42657. this.timeline.info({ instances: Pusher.instances.length });
  42658. if (Pusher.isReady) {
  42659. this.connect();
  42660. }
  42661. }
  42662. Pusher.ready = function () {
  42663. Pusher.isReady = true;
  42664. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  42665. Pusher.instances[i].connect();
  42666. }
  42667. };
  42668. Pusher.getClientFeatures = function () {
  42669. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  42670. return t.isSupported({});
  42671. }));
  42672. };
  42673. Pusher.prototype.channel = function (name) {
  42674. return this.channels.find(name);
  42675. };
  42676. Pusher.prototype.allChannels = function () {
  42677. return this.channels.all();
  42678. };
  42679. Pusher.prototype.connect = function () {
  42680. this.connection.connect();
  42681. if (this.timelineSender) {
  42682. if (!this.timelineSenderTimer) {
  42683. var usingTLS = this.connection.isUsingTLS();
  42684. var timelineSender = this.timelineSender;
  42685. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  42686. timelineSender.send(usingTLS);
  42687. });
  42688. }
  42689. }
  42690. };
  42691. Pusher.prototype.disconnect = function () {
  42692. this.connection.disconnect();
  42693. if (this.timelineSenderTimer) {
  42694. this.timelineSenderTimer.ensureAborted();
  42695. this.timelineSenderTimer = null;
  42696. }
  42697. };
  42698. Pusher.prototype.bind = function (event_name, callback, context) {
  42699. this.global_emitter.bind(event_name, callback, context);
  42700. return this;
  42701. };
  42702. Pusher.prototype.unbind = function (event_name, callback, context) {
  42703. this.global_emitter.unbind(event_name, callback, context);
  42704. return this;
  42705. };
  42706. Pusher.prototype.bind_global = function (callback) {
  42707. this.global_emitter.bind_global(callback);
  42708. return this;
  42709. };
  42710. Pusher.prototype.unbind_global = function (callback) {
  42711. this.global_emitter.unbind_global(callback);
  42712. return this;
  42713. };
  42714. Pusher.prototype.unbind_all = function (callback) {
  42715. this.global_emitter.unbind_all();
  42716. return this;
  42717. };
  42718. Pusher.prototype.subscribeAll = function () {
  42719. var channelName;
  42720. for (channelName in this.channels.channels) {
  42721. if (this.channels.channels.hasOwnProperty(channelName)) {
  42722. this.subscribe(channelName);
  42723. }
  42724. }
  42725. };
  42726. Pusher.prototype.subscribe = function (channel_name) {
  42727. var channel = this.channels.add(channel_name, this);
  42728. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  42729. channel.reinstateSubscription();
  42730. }
  42731. else if (!channel.subscriptionPending &&
  42732. this.connection.state === 'connected') {
  42733. channel.subscribe();
  42734. }
  42735. return channel;
  42736. };
  42737. Pusher.prototype.unsubscribe = function (channel_name) {
  42738. var channel = this.channels.find(channel_name);
  42739. if (channel && channel.subscriptionPending) {
  42740. channel.cancelSubscription();
  42741. }
  42742. else {
  42743. channel = this.channels.remove(channel_name);
  42744. if (channel && this.connection.state === 'connected') {
  42745. channel.unsubscribe();
  42746. }
  42747. }
  42748. };
  42749. Pusher.prototype.send_event = function (event_name, data, channel) {
  42750. return this.connection.send_event(event_name, data, channel);
  42751. };
  42752. Pusher.prototype.shouldUseTLS = function () {
  42753. if (runtime.getProtocol() === 'https:') {
  42754. return true;
  42755. }
  42756. else if (this.config.forceTLS === true) {
  42757. return true;
  42758. }
  42759. else {
  42760. return Boolean(this.config.encrypted);
  42761. }
  42762. };
  42763. Pusher.instances = [];
  42764. Pusher.isReady = false;
  42765. Pusher.logToConsole = false;
  42766. Pusher.Runtime = runtime;
  42767. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  42768. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  42769. Pusher.auth_callbacks = runtime.auth_callbacks;
  42770. return Pusher;
  42771. }());
  42772. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  42773. function checkAppKey(key) {
  42774. if (key === null || key === undefined) {
  42775. throw 'You must pass your app key when you instantiate Pusher.';
  42776. }
  42777. }
  42778. runtime.setup(pusher_Pusher);
  42779. /***/ })
  42780. /******/ ]);
  42781. });
  42782. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  42783. /***/ }),
  42784. /***/ "./node_modules/setimmediate/setImmediate.js":
  42785. /*!***************************************************!*\
  42786. !*** ./node_modules/setimmediate/setImmediate.js ***!
  42787. \***************************************************/
  42788. /*! no static exports found */
  42789. /***/ (function(module, exports, __webpack_require__) {
  42790. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  42791. "use strict";
  42792. if (global.setImmediate) {
  42793. return;
  42794. }
  42795. var nextHandle = 1; // Spec says greater than zero
  42796. var tasksByHandle = {};
  42797. var currentlyRunningATask = false;
  42798. var doc = global.document;
  42799. var registerImmediate;
  42800. function setImmediate(callback) {
  42801. // Callback can either be a function or a string
  42802. if (typeof callback !== "function") {
  42803. callback = new Function("" + callback);
  42804. }
  42805. // Copy function arguments
  42806. var args = new Array(arguments.length - 1);
  42807. for (var i = 0; i < args.length; i++) {
  42808. args[i] = arguments[i + 1];
  42809. }
  42810. // Store and register the task
  42811. var task = { callback: callback, args: args };
  42812. tasksByHandle[nextHandle] = task;
  42813. registerImmediate(nextHandle);
  42814. return nextHandle++;
  42815. }
  42816. function clearImmediate(handle) {
  42817. delete tasksByHandle[handle];
  42818. }
  42819. function run(task) {
  42820. var callback = task.callback;
  42821. var args = task.args;
  42822. switch (args.length) {
  42823. case 0:
  42824. callback();
  42825. break;
  42826. case 1:
  42827. callback(args[0]);
  42828. break;
  42829. case 2:
  42830. callback(args[0], args[1]);
  42831. break;
  42832. case 3:
  42833. callback(args[0], args[1], args[2]);
  42834. break;
  42835. default:
  42836. callback.apply(undefined, args);
  42837. break;
  42838. }
  42839. }
  42840. function runIfPresent(handle) {
  42841. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  42842. // So if we're currently running a task, we'll need to delay this invocation.
  42843. if (currentlyRunningATask) {
  42844. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  42845. // "too much recursion" error.
  42846. setTimeout(runIfPresent, 0, handle);
  42847. } else {
  42848. var task = tasksByHandle[handle];
  42849. if (task) {
  42850. currentlyRunningATask = true;
  42851. try {
  42852. run(task);
  42853. } finally {
  42854. clearImmediate(handle);
  42855. currentlyRunningATask = false;
  42856. }
  42857. }
  42858. }
  42859. }
  42860. function installNextTickImplementation() {
  42861. registerImmediate = function(handle) {
  42862. process.nextTick(function () { runIfPresent(handle); });
  42863. };
  42864. }
  42865. function canUsePostMessage() {
  42866. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  42867. // where `global.postMessage` means something completely different and can't be used for this purpose.
  42868. if (global.postMessage && !global.importScripts) {
  42869. var postMessageIsAsynchronous = true;
  42870. var oldOnMessage = global.onmessage;
  42871. global.onmessage = function() {
  42872. postMessageIsAsynchronous = false;
  42873. };
  42874. global.postMessage("", "*");
  42875. global.onmessage = oldOnMessage;
  42876. return postMessageIsAsynchronous;
  42877. }
  42878. }
  42879. function installPostMessageImplementation() {
  42880. // Installs an event handler on `global` for the `message` event: see
  42881. // * https://developer.mozilla.org/en/DOM/window.postMessage
  42882. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  42883. var messagePrefix = "setImmediate$" + Math.random() + "$";
  42884. var onGlobalMessage = function(event) {
  42885. if (event.source === global &&
  42886. typeof event.data === "string" &&
  42887. event.data.indexOf(messagePrefix) === 0) {
  42888. runIfPresent(+event.data.slice(messagePrefix.length));
  42889. }
  42890. };
  42891. if (global.addEventListener) {
  42892. global.addEventListener("message", onGlobalMessage, false);
  42893. } else {
  42894. global.attachEvent("onmessage", onGlobalMessage);
  42895. }
  42896. registerImmediate = function(handle) {
  42897. global.postMessage(messagePrefix + handle, "*");
  42898. };
  42899. }
  42900. function installMessageChannelImplementation() {
  42901. var channel = new MessageChannel();
  42902. channel.port1.onmessage = function(event) {
  42903. var handle = event.data;
  42904. runIfPresent(handle);
  42905. };
  42906. registerImmediate = function(handle) {
  42907. channel.port2.postMessage(handle);
  42908. };
  42909. }
  42910. function installReadyStateChangeImplementation() {
  42911. var html = doc.documentElement;
  42912. registerImmediate = function(handle) {
  42913. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  42914. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  42915. var script = doc.createElement("script");
  42916. script.onreadystatechange = function () {
  42917. runIfPresent(handle);
  42918. script.onreadystatechange = null;
  42919. html.removeChild(script);
  42920. script = null;
  42921. };
  42922. html.appendChild(script);
  42923. };
  42924. }
  42925. function installSetTimeoutImplementation() {
  42926. registerImmediate = function(handle) {
  42927. setTimeout(runIfPresent, 0, handle);
  42928. };
  42929. }
  42930. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  42931. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  42932. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  42933. // Don't get fooled by e.g. browserify environments.
  42934. if ({}.toString.call(global.process) === "[object process]") {
  42935. // For Node.js before 0.9
  42936. installNextTickImplementation();
  42937. } else if (canUsePostMessage()) {
  42938. // For non-IE10 modern browsers
  42939. installPostMessageImplementation();
  42940. } else if (global.MessageChannel) {
  42941. // For web workers, where supported
  42942. installMessageChannelImplementation();
  42943. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  42944. // For IE 6–8
  42945. installReadyStateChangeImplementation();
  42946. } else {
  42947. // For older browsers
  42948. installSetTimeoutImplementation();
  42949. }
  42950. attachTo.setImmediate = setImmediate;
  42951. attachTo.clearImmediate = clearImmediate;
  42952. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  42953. /* 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")))
  42954. /***/ }),
  42955. /***/ "./node_modules/timers-browserify/main.js":
  42956. /*!************************************************!*\
  42957. !*** ./node_modules/timers-browserify/main.js ***!
  42958. \************************************************/
  42959. /*! no static exports found */
  42960. /***/ (function(module, exports, __webpack_require__) {
  42961. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  42962. (typeof self !== "undefined" && self) ||
  42963. window;
  42964. var apply = Function.prototype.apply;
  42965. // DOM APIs, for completeness
  42966. exports.setTimeout = function() {
  42967. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  42968. };
  42969. exports.setInterval = function() {
  42970. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  42971. };
  42972. exports.clearTimeout =
  42973. exports.clearInterval = function(timeout) {
  42974. if (timeout) {
  42975. timeout.close();
  42976. }
  42977. };
  42978. function Timeout(id, clearFn) {
  42979. this._id = id;
  42980. this._clearFn = clearFn;
  42981. }
  42982. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  42983. Timeout.prototype.close = function() {
  42984. this._clearFn.call(scope, this._id);
  42985. };
  42986. // Does not start the time, just sets up the members needed.
  42987. exports.enroll = function(item, msecs) {
  42988. clearTimeout(item._idleTimeoutId);
  42989. item._idleTimeout = msecs;
  42990. };
  42991. exports.unenroll = function(item) {
  42992. clearTimeout(item._idleTimeoutId);
  42993. item._idleTimeout = -1;
  42994. };
  42995. exports._unrefActive = exports.active = function(item) {
  42996. clearTimeout(item._idleTimeoutId);
  42997. var msecs = item._idleTimeout;
  42998. if (msecs >= 0) {
  42999. item._idleTimeoutId = setTimeout(function onTimeout() {
  43000. if (item._onTimeout)
  43001. item._onTimeout();
  43002. }, msecs);
  43003. }
  43004. };
  43005. // setimmediate attaches itself to the global object
  43006. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  43007. // On some exotic environments, it's not clear which object `setimmediate` was
  43008. // able to install onto. Search each possibility in the same order as the
  43009. // `setimmediate` library.
  43010. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  43011. (typeof global !== "undefined" && global.setImmediate) ||
  43012. (this && this.setImmediate);
  43013. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  43014. (typeof global !== "undefined" && global.clearImmediate) ||
  43015. (this && this.clearImmediate);
  43016. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  43017. /***/ }),
  43018. /***/ "./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&":
  43019. /*!*******************************************************************************************************************************************************************************************************************!*\
  43020. !*** ./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& ***!
  43021. \*******************************************************************************************************************************************************************************************************************/
  43022. /*! exports provided: render, staticRenderFns */
  43023. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43024. "use strict";
  43025. __webpack_require__.r(__webpack_exports__);
  43026. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43027. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43028. var render = function() {
  43029. var _vm = this
  43030. var _h = _vm.$createElement
  43031. var _c = _vm._self._c || _h
  43032. return _vm._m(0)
  43033. }
  43034. var staticRenderFns = [
  43035. function() {
  43036. var _vm = this
  43037. var _h = _vm.$createElement
  43038. var _c = _vm._self._c || _h
  43039. return _c("div", { staticClass: "container" }, [
  43040. _c("div", { staticClass: "row justify-content-center" }, [
  43041. _c("div", { staticClass: "col-md-8" }, [
  43042. _c("div", { staticClass: "card" }, [
  43043. _c("div", { staticClass: "card-header" }, [
  43044. _vm._v("Example Component")
  43045. ]),
  43046. _vm._v(" "),
  43047. _c("div", { staticClass: "card-body" }, [
  43048. _vm._v(
  43049. "\n I'm an example component.\n "
  43050. )
  43051. ])
  43052. ])
  43053. ])
  43054. ])
  43055. ])
  43056. }
  43057. ]
  43058. render._withStripped = true
  43059. /***/ }),
  43060. /***/ "./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&":
  43061. /*!************************************************************************************************************************************************************************************************************!*\
  43062. !*** ./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& ***!
  43063. \************************************************************************************************************************************************************************************************************/
  43064. /*! exports provided: render, staticRenderFns */
  43065. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43066. "use strict";
  43067. __webpack_require__.r(__webpack_exports__);
  43068. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43069. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43070. var render = function() {
  43071. var _vm = this
  43072. var _h = _vm.$createElement
  43073. var _c = _vm._self._c || _h
  43074. return _c(
  43075. "div",
  43076. [
  43077. _c(
  43078. "modal",
  43079. {
  43080. attrs: {
  43081. id: "asseteditModal",
  43082. tabindex: "-1",
  43083. role: "dialog",
  43084. "aria-labelledby": "asseteditModalLabel"
  43085. }
  43086. },
  43087. [
  43088. _c(
  43089. "h5",
  43090. {
  43091. staticClass: "modal-title",
  43092. attrs: { slot: "header", id: "asseteditModalLabel" },
  43093. slot: "header"
  43094. },
  43095. [_vm._v("\n Edit Work Order Information\n ")]
  43096. ),
  43097. _vm._v(" "),
  43098. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43099. _c("div", { staticClass: "form-group" }, [
  43100. _c("label", { attrs: { for: "manufacturer" } }, [
  43101. _vm._v("Manufacturer")
  43102. ]),
  43103. _vm._v(" "),
  43104. _c("input", {
  43105. directives: [
  43106. {
  43107. name: "model",
  43108. rawName: "v-model.lazy",
  43109. value: _vm.data.pcmanu,
  43110. expression: "data.pcmanu",
  43111. modifiers: { lazy: true }
  43112. }
  43113. ],
  43114. staticClass: "form-control",
  43115. attrs: {
  43116. type: "text",
  43117. name: "manufacturer",
  43118. id: "manufacturer"
  43119. },
  43120. domProps: { value: _vm.data.pcmanu },
  43121. on: {
  43122. change: function($event) {
  43123. return _vm.$set(_vm.data, "pcmanu", $event.target.value)
  43124. }
  43125. }
  43126. })
  43127. ]),
  43128. _vm._v(" "),
  43129. _c("div", { staticClass: "form-group" }, [
  43130. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  43131. _vm._v(" "),
  43132. _c("input", {
  43133. directives: [
  43134. {
  43135. name: "model",
  43136. rawName: "v-model.lazy",
  43137. value: _vm.data.pcmake,
  43138. expression: "data.pcmake",
  43139. modifiers: { lazy: true }
  43140. }
  43141. ],
  43142. staticClass: "form-control",
  43143. attrs: { type: "text", name: "make", id: "make" },
  43144. domProps: { value: _vm.data.pcmake },
  43145. on: {
  43146. change: function($event) {
  43147. return _vm.$set(_vm.data, "pcmake", $event.target.value)
  43148. }
  43149. }
  43150. })
  43151. ]),
  43152. _vm._v(" "),
  43153. _c("div", { staticClass: "form-group" }, [
  43154. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  43155. _vm._v(" "),
  43156. _c("input", {
  43157. directives: [
  43158. {
  43159. name: "model",
  43160. rawName: "v-model.lazy",
  43161. value: _vm.data.pcnickname,
  43162. expression: "data.pcnickname",
  43163. modifiers: { lazy: true }
  43164. }
  43165. ],
  43166. staticClass: "form-control",
  43167. attrs: { type: "text", name: "nickname", id: "nickname" },
  43168. domProps: { value: _vm.data.pcnickname },
  43169. on: {
  43170. change: function($event) {
  43171. return _vm.$set(_vm.data, "pcnickname", $event.target.value)
  43172. }
  43173. }
  43174. })
  43175. ]),
  43176. _vm._v(" "),
  43177. _c("div", { staticClass: "form-group" }, [
  43178. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  43179. _vm._v(" "),
  43180. _c("input", {
  43181. directives: [
  43182. {
  43183. name: "model",
  43184. rawName: "v-model.lazy",
  43185. value: _vm.pcextra[2],
  43186. expression: "pcextra[2]",
  43187. modifiers: { lazy: true }
  43188. }
  43189. ],
  43190. staticClass: "form-control",
  43191. attrs: { type: "text", name: "os", id: "os" },
  43192. domProps: { value: _vm.pcextra[2] },
  43193. on: {
  43194. change: function($event) {
  43195. return _vm.$set(_vm.pcextra, 2, $event.target.value)
  43196. }
  43197. }
  43198. })
  43199. ]),
  43200. _vm._v(" "),
  43201. _c("div", { staticClass: "form-group" }, [
  43202. _c("label", { attrs: { for: "serial" } }, [
  43203. _vm._v("Serial Number")
  43204. ]),
  43205. _vm._v(" "),
  43206. _c("input", {
  43207. directives: [
  43208. {
  43209. name: "model",
  43210. rawName: "v-model.lazy",
  43211. value: _vm.pcextra[104],
  43212. expression: "pcextra[104]",
  43213. modifiers: { lazy: true }
  43214. }
  43215. ],
  43216. staticClass: "form-control",
  43217. attrs: { type: "text", id: "serial", name: "serial" },
  43218. domProps: { value: _vm.pcextra[104] },
  43219. on: {
  43220. change: function($event) {
  43221. return _vm.$set(_vm.pcextra, 104, $event.target.value)
  43222. }
  43223. }
  43224. })
  43225. ]),
  43226. _vm._v(" "),
  43227. _c("div", { staticClass: "form-group" }, [
  43228. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  43229. _vm._v(" "),
  43230. _c("input", {
  43231. directives: [
  43232. {
  43233. name: "model",
  43234. rawName: "v-model.lazy",
  43235. value: _vm.pcextra[101],
  43236. expression: "pcextra[101]",
  43237. modifiers: { lazy: true }
  43238. }
  43239. ],
  43240. staticClass: "form-control",
  43241. attrs: { type: "text", id: "cpu", name: "cpu" },
  43242. domProps: { value: _vm.pcextra[101] },
  43243. on: {
  43244. change: function($event) {
  43245. return _vm.$set(_vm.pcextra, 101, $event.target.value)
  43246. }
  43247. }
  43248. })
  43249. ]),
  43250. _vm._v(" "),
  43251. _c("div", { staticClass: "form-group" }, [
  43252. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  43253. _vm._v(" "),
  43254. _c("input", {
  43255. directives: [
  43256. {
  43257. name: "model",
  43258. rawName: "v-model.lazy",
  43259. value: _vm.pcextra[100],
  43260. expression: "pcextra[100]",
  43261. modifiers: { lazy: true }
  43262. }
  43263. ],
  43264. staticClass: "form-control",
  43265. attrs: { type: "text", name: "ram", id: "ram" },
  43266. domProps: { value: _vm.pcextra[100] },
  43267. on: {
  43268. change: function($event) {
  43269. return _vm.$set(_vm.pcextra, 100, $event.target.value)
  43270. }
  43271. }
  43272. })
  43273. ]),
  43274. _vm._v(" "),
  43275. _c("div", { staticClass: "form-group" }, [
  43276. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  43277. _vm._v(" "),
  43278. _c("input", {
  43279. directives: [
  43280. {
  43281. name: "model",
  43282. rawName: "v-model.lazy",
  43283. value: _vm.pcextra[4],
  43284. expression: "pcextra[4]",
  43285. modifiers: { lazy: true }
  43286. }
  43287. ],
  43288. staticClass: "form-control",
  43289. attrs: { type: "text", name: "graphics", id: "grapics" },
  43290. domProps: { value: _vm.pcextra[4] },
  43291. on: {
  43292. change: function($event) {
  43293. return _vm.$set(_vm.pcextra, 4, $event.target.value)
  43294. }
  43295. }
  43296. })
  43297. ])
  43298. ]),
  43299. _vm._v(" "),
  43300. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43301. _c(
  43302. "button",
  43303. {
  43304. staticClass: "btn btn-secondary",
  43305. attrs: { type: "button", "data-dismiss": "modal" }
  43306. },
  43307. [_vm._v("Close")]
  43308. ),
  43309. _vm._v(" "),
  43310. _c(
  43311. "button",
  43312. {
  43313. staticClass: "btn btn-primary",
  43314. attrs: { type: "button" },
  43315. on: {
  43316. click: function($event) {
  43317. return _vm.updateAsset()
  43318. }
  43319. }
  43320. },
  43321. [_vm._v("Save")]
  43322. )
  43323. ])
  43324. ]
  43325. ),
  43326. _vm._v(" "),
  43327. _c("h4", { staticClass: "text-center" }, [
  43328. _vm._v(
  43329. _vm._s(this.data.pcmanu) + " " + _vm._s(this.data.pcmake) + " - "
  43330. ),
  43331. _c("small", { staticClass: "text-muted" }, [
  43332. _vm._v(_vm._s(this.data.pcnickname))
  43333. ])
  43334. ]),
  43335. _vm._v(" "),
  43336. _c("p", [_vm._v("OS: " + _vm._s(this.pcextra[2]))]),
  43337. _vm._v(" "),
  43338. _c("p", [_vm._v("S/N: " + _vm._s(this.pcextra[104]))]),
  43339. _vm._v(" "),
  43340. _c("p", [_vm._v("CPU: " + _vm._s(this.pcextra[101]))]),
  43341. _vm._v(" "),
  43342. _c("p", [_vm._v("RAM: " + _vm._s(this.pcextra[100]))]),
  43343. _vm._v(" "),
  43344. _c("p", [_vm._v("Graphics: " + _vm._s(this.pcextra[4]))]),
  43345. _vm._v(" "),
  43346. _c(
  43347. "button",
  43348. {
  43349. staticClass: "btn btn-primary",
  43350. attrs: {
  43351. type: "button",
  43352. "data-toggle": "modal",
  43353. "data-target": "#asseteditModal"
  43354. }
  43355. },
  43356. [_vm._v("Edit")]
  43357. )
  43358. ],
  43359. 1
  43360. )
  43361. }
  43362. var staticRenderFns = []
  43363. render._withStripped = true
  43364. /***/ }),
  43365. /***/ "./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&":
  43366. /*!*******************************************************************************************************************************************************************************************************************************!*\
  43367. !*** ./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& ***!
  43368. \*******************************************************************************************************************************************************************************************************************************/
  43369. /*! exports provided: render, staticRenderFns */
  43370. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43371. "use strict";
  43372. __webpack_require__.r(__webpack_exports__);
  43373. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43374. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43375. var render = function() {
  43376. var _vm = this
  43377. var _h = _vm.$createElement
  43378. var _c = _vm._self._c || _h
  43379. return _c("div", { staticClass: "dropdown", class: { open: _vm.open } }, [
  43380. _c("div", { staticClass: "input-group" }, [
  43381. _c("input", {
  43382. directives: [
  43383. {
  43384. name: "model",
  43385. rawName: "v-model",
  43386. value: _vm.searchText,
  43387. expression: "searchText"
  43388. }
  43389. ],
  43390. staticClass: "form-control",
  43391. attrs: { type: "text" },
  43392. domProps: { value: _vm.searchText },
  43393. on: {
  43394. input: [
  43395. function($event) {
  43396. if ($event.target.composing) {
  43397. return
  43398. }
  43399. _vm.searchText = $event.target.value
  43400. },
  43401. _vm.searchChanged
  43402. ]
  43403. }
  43404. }),
  43405. _vm._v(" "),
  43406. _c("div", { staticClass: "form-group-append" }, [
  43407. _c(
  43408. "a",
  43409. {
  43410. staticClass: "toggle input-group-text bg-primary text-light",
  43411. on: {
  43412. mousedown: function($event) {
  43413. $event.preventDefault()
  43414. },
  43415. click: function($event) {
  43416. return _vm.setOpen(!_vm.open)
  43417. }
  43418. }
  43419. },
  43420. [
  43421. _c("span", { staticClass: "arrow-up" }, [_vm._v("▲")]),
  43422. _vm._v(" "),
  43423. _c("span", { staticClass: "arrow-down" }, [_vm._v("▼")])
  43424. ]
  43425. )
  43426. ])
  43427. ]),
  43428. _vm._v(" "),
  43429. _c(
  43430. "ul",
  43431. { staticClass: "suggestion-list list-unstyled" },
  43432. _vm._l(_vm.matches, function(suggestion, index) {
  43433. return _c(
  43434. "li",
  43435. {
  43436. key: index,
  43437. on: {
  43438. mousedown: function($event) {
  43439. $event.preventDefault()
  43440. },
  43441. click: function($event) {
  43442. return _vm.suggestionSelected(suggestion)
  43443. }
  43444. }
  43445. },
  43446. [_vm._v("\n " + _vm._s(suggestion[1]) + "\n ")]
  43447. )
  43448. }),
  43449. 0
  43450. )
  43451. ])
  43452. }
  43453. var staticRenderFns = []
  43454. render._withStripped = true
  43455. /***/ }),
  43456. /***/ "./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&":
  43457. /*!************************************************************************************************************************************************************************************************************************!*\
  43458. !*** ./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& ***!
  43459. \************************************************************************************************************************************************************************************************************************/
  43460. /*! exports provided: render, staticRenderFns */
  43461. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43462. "use strict";
  43463. __webpack_require__.r(__webpack_exports__);
  43464. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43465. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43466. var render = function() {
  43467. var _vm = this
  43468. var _h = _vm.$createElement
  43469. var _c = _vm._self._c || _h
  43470. return _c(
  43471. "modal",
  43472. {
  43473. attrs: {
  43474. id: _vm.id,
  43475. tabindex: "-1",
  43476. role: "dialog",
  43477. "aria-labelledby": _vm.id + "Label"
  43478. }
  43479. },
  43480. [
  43481. _c(
  43482. "h5",
  43483. {
  43484. staticClass: "modal-title",
  43485. attrs: { slot: "header", id: _vm.id + "Label" },
  43486. slot: "header"
  43487. },
  43488. [_vm._v("\n Edit Credential\n ")]
  43489. ),
  43490. _vm._v(" "),
  43491. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43492. _c(
  43493. "div",
  43494. { staticClass: "form" },
  43495. [
  43496. _c("autocomplete-custom-dropdown", {
  43497. attrs: {
  43498. options: _vm.descriptions,
  43499. value: _vm.creddesc,
  43500. "allow-custom": true
  43501. },
  43502. model: {
  43503. value: _vm.creddesc,
  43504. callback: function($$v) {
  43505. _vm.creddesc = $$v
  43506. },
  43507. expression: "creddesc"
  43508. }
  43509. })
  43510. ],
  43511. 1
  43512. ),
  43513. _vm._v(" "),
  43514. _c("div", { staticClass: "form-group" }, [
  43515. _c("label", { attrs: { for: "newusername" } }, [_vm._v("Username")]),
  43516. _vm._v(" "),
  43517. _c("input", {
  43518. directives: [
  43519. {
  43520. name: "model",
  43521. rawName: "v-model",
  43522. value: _vm.data.creduser,
  43523. expression: "data.creduser"
  43524. }
  43525. ],
  43526. staticClass: "form-control credential",
  43527. attrs: {
  43528. type: "text",
  43529. name: "newusername" + _vm.data.credid,
  43530. id: "newusername" + _vm.data.credid
  43531. },
  43532. domProps: { value: _vm.data.creduser },
  43533. on: {
  43534. input: function($event) {
  43535. if ($event.target.composing) {
  43536. return
  43537. }
  43538. _vm.$set(_vm.data, "creduser", $event.target.value)
  43539. }
  43540. }
  43541. })
  43542. ]),
  43543. _vm._v(" "),
  43544. _c("div", { staticClass: "form-group" }, [
  43545. _c("label", { attrs: { for: "newpassword" } }, [_vm._v("Password")]),
  43546. _vm._v(" "),
  43547. _c("input", {
  43548. directives: [
  43549. {
  43550. name: "model",
  43551. rawName: "v-model",
  43552. value: _vm.data.credpass,
  43553. expression: "data.credpass"
  43554. }
  43555. ],
  43556. staticClass: "form-control credential",
  43557. attrs: {
  43558. type: "text",
  43559. name: "newpassword" + _vm.data.credid,
  43560. id: "newpassword" + _vm.data.credid
  43561. },
  43562. domProps: { value: _vm.data.credpass },
  43563. on: {
  43564. input: function($event) {
  43565. if ($event.target.composing) {
  43566. return
  43567. }
  43568. _vm.$set(_vm.data, "credpass", $event.target.value)
  43569. }
  43570. }
  43571. }),
  43572. _vm._v(" "),
  43573. _c(
  43574. "button",
  43575. {
  43576. staticClass: "btn btn-secondary",
  43577. attrs: { type: "button" },
  43578. on: {
  43579. click: function($event) {
  43580. return _vm.getRandomPassword(_vm.data.credid)
  43581. }
  43582. }
  43583. },
  43584. [_vm._v("Generate Random")]
  43585. )
  43586. ]),
  43587. _vm._v(" "),
  43588. _c("div", { staticClass: "form-group" })
  43589. ]),
  43590. _vm._v(" "),
  43591. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43592. _c(
  43593. "button",
  43594. {
  43595. staticClass: "btn btn-secondary",
  43596. attrs: { type: "button", "data-dismiss": "modal" }
  43597. },
  43598. [_vm._v("Close")]
  43599. ),
  43600. _vm._v(" "),
  43601. _c(
  43602. "button",
  43603. {
  43604. staticClass: "btn btn-primary",
  43605. attrs: { type: "button" },
  43606. on: {
  43607. click: function($event) {
  43608. return _vm.updateCredential()
  43609. }
  43610. }
  43611. },
  43612. [_vm._v("Save")]
  43613. )
  43614. ])
  43615. ]
  43616. )
  43617. }
  43618. var staticRenderFns = []
  43619. render._withStripped = true
  43620. /***/ }),
  43621. /***/ "./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&":
  43622. /*!******************************************************************************************************************************************************************************************************************!*\
  43623. !*** ./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& ***!
  43624. \******************************************************************************************************************************************************************************************************************/
  43625. /*! exports provided: render, staticRenderFns */
  43626. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43627. "use strict";
  43628. __webpack_require__.r(__webpack_exports__);
  43629. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43630. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43631. var render = function() {
  43632. var _vm = this
  43633. var _h = _vm.$createElement
  43634. var _c = _vm._self._c || _h
  43635. return _c(
  43636. "div",
  43637. [
  43638. _c("credential-form-modal", {
  43639. attrs: {
  43640. "modal-id": "newCredentialModal",
  43641. descriptions: _vm.creddescList,
  43642. create: true,
  43643. pcid: _vm.pcid
  43644. }
  43645. }),
  43646. _vm._v(" "),
  43647. _c(
  43648. "button",
  43649. {
  43650. staticClass: "btn btn-primary",
  43651. attrs: {
  43652. type: "button",
  43653. "data-toggle": "modal",
  43654. "data-target": "#newCredentialModal"
  43655. }
  43656. },
  43657. [_vm._v("New Credential")]
  43658. ),
  43659. _vm._v(" "),
  43660. _vm._l(_vm.credentials, function(credential) {
  43661. return _c(
  43662. "div",
  43663. { key: credential.credid },
  43664. [
  43665. _c("credential", {
  43666. attrs: { credential: credential, descriptions: _vm.creddescList }
  43667. })
  43668. ],
  43669. 1
  43670. )
  43671. })
  43672. ],
  43673. 2
  43674. )
  43675. }
  43676. var staticRenderFns = []
  43677. render._withStripped = true
  43678. /***/ }),
  43679. /***/ "./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&":
  43680. /*!*************************************************************************************************************************************************************************************************************!*\
  43681. !*** ./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& ***!
  43682. \*************************************************************************************************************************************************************************************************************/
  43683. /*! exports provided: render, staticRenderFns */
  43684. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43685. "use strict";
  43686. __webpack_require__.r(__webpack_exports__);
  43687. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43688. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43689. var render = function() {
  43690. var _vm = this
  43691. var _h = _vm.$createElement
  43692. var _c = _vm._self._c || _h
  43693. return _c(
  43694. "div",
  43695. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  43696. [
  43697. _c("credential-form-modal", {
  43698. attrs: {
  43699. descriptions: _vm.creddescList,
  43700. "modal-id": "credential" + this.data.credid + "editModal",
  43701. populateWith: this.data
  43702. }
  43703. }),
  43704. _vm._v(" "),
  43705. _c(
  43706. "modal",
  43707. {
  43708. attrs: {
  43709. id: "credential" + this.data.credid + "deleteModal",
  43710. tabindex: "-1"
  43711. }
  43712. },
  43713. [
  43714. _c(
  43715. "h5",
  43716. {
  43717. staticClass: "modal-title",
  43718. attrs: {
  43719. slot: "header",
  43720. id: "credential" + this.data.credid + "deleteModalLabel"
  43721. },
  43722. slot: "header"
  43723. },
  43724. [_vm._v("\r\n Delete Credential\r\n ")]
  43725. ),
  43726. _vm._v(" "),
  43727. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43728. _vm._v("\r\n Are you sure?\r\n ")
  43729. ]),
  43730. _vm._v(" "),
  43731. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43732. _c(
  43733. "button",
  43734. {
  43735. staticClass: "btn btn-secondary",
  43736. attrs: { type: "button", "data-dismiss": "modal" }
  43737. },
  43738. [_vm._v("Cancel")]
  43739. ),
  43740. _vm._v(" "),
  43741. _c(
  43742. "button",
  43743. {
  43744. staticClass: "btn btn-danger",
  43745. attrs: { type: "button" },
  43746. on: {
  43747. click: function($event) {
  43748. return _vm.deleteCredential()
  43749. }
  43750. }
  43751. },
  43752. [_vm._v("Confirm")]
  43753. )
  43754. ])
  43755. ]
  43756. ),
  43757. _vm._v(" "),
  43758. _c("div", { staticClass: "row no-gutters" }, [
  43759. _c("div", { staticClass: "h5 col-3 text-left" }, [
  43760. _vm._v(_vm._s(this.data.creddesc))
  43761. ]),
  43762. _vm._v(" "),
  43763. _c("div", { staticClass: "col-9 text-right" }, [
  43764. _vm._v(_vm._s(this.data.creddate))
  43765. ])
  43766. ]),
  43767. _vm._v(" "),
  43768. _c("div", { staticClass: "row" }, [
  43769. _c("div", { staticClass: "col-lg-9" }, [
  43770. _c("div", [
  43771. _vm._m(0),
  43772. _vm._v(" "),
  43773. _c("input", {
  43774. staticClass: "border-0 credential",
  43775. attrs: {
  43776. type: "text",
  43777. id: "username" + this.data.credid,
  43778. readonly: ""
  43779. },
  43780. domProps: { value: this.data.creduser }
  43781. }),
  43782. _vm._v(" "),
  43783. _c(
  43784. "button",
  43785. {
  43786. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43787. attrs: {
  43788. id: "btn-username" + this.data.credid,
  43789. "data-clipboard-target": "#username" + this.data.credid
  43790. }
  43791. },
  43792. [_c("i", { staticClass: "far fa-clone" })]
  43793. )
  43794. ]),
  43795. _vm._v(" "),
  43796. _c("div", [
  43797. _vm._m(1),
  43798. _vm._v(" "),
  43799. _c("input", {
  43800. staticClass: "border-0 credential",
  43801. attrs: {
  43802. type: "text",
  43803. id: "password" + this.data.credid,
  43804. readonly: ""
  43805. },
  43806. domProps: { value: this.data.credpass }
  43807. }),
  43808. _vm._v(" "),
  43809. _c(
  43810. "button",
  43811. {
  43812. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43813. attrs: {
  43814. id: "btn-password" + this.data.credid,
  43815. "data-clipboard-target": "#password" + this.data.credid
  43816. }
  43817. },
  43818. [_c("i", { staticClass: "far fa-clone" })]
  43819. )
  43820. ])
  43821. ]),
  43822. _vm._v(" "),
  43823. _c(
  43824. "div",
  43825. {
  43826. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  43827. attrs: { role: "group", "aria-label": "Edit and Delete" }
  43828. },
  43829. [
  43830. _c(
  43831. "button",
  43832. {
  43833. staticClass: "btn btn-sm btn-secondary p-lg-1",
  43834. attrs: {
  43835. type: "button",
  43836. "data-toggle": "modal",
  43837. "data-target": "#credential" + this.data.credid + "editModal"
  43838. }
  43839. },
  43840. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  43841. ),
  43842. _vm._v(" "),
  43843. _c(
  43844. "button",
  43845. {
  43846. staticClass: "btn btn-sm btn-danger p-lg-1",
  43847. attrs: {
  43848. type: "button",
  43849. "data-toggle": "modal",
  43850. "data-target":
  43851. "#credential" + this.data.credid + "deleteModal"
  43852. }
  43853. },
  43854. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  43855. )
  43856. ]
  43857. )
  43858. ])
  43859. ],
  43860. 1
  43861. )
  43862. }
  43863. var staticRenderFns = [
  43864. function() {
  43865. var _vm = this
  43866. var _h = _vm.$createElement
  43867. var _c = _vm._self._c || _h
  43868. return _c("label", { attrs: { for: "username" } }, [
  43869. _c("i", { staticClass: "fas fa-fw fa-user" })
  43870. ])
  43871. },
  43872. function() {
  43873. var _vm = this
  43874. var _h = _vm.$createElement
  43875. var _c = _vm._self._c || _h
  43876. return _c("label", { attrs: { for: "password" } }, [
  43877. _c("i", { staticClass: "fas fa-fw fa-key" })
  43878. ])
  43879. }
  43880. ]
  43881. render._withStripped = true
  43882. /***/ }),
  43883. /***/ "./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&":
  43884. /*!************************************************************************************************************************************************************************************************************!*\
  43885. !*** ./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& ***!
  43886. \************************************************************************************************************************************************************************************************************/
  43887. /*! exports provided: render, staticRenderFns */
  43888. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43889. "use strict";
  43890. __webpack_require__.r(__webpack_exports__);
  43891. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43892. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43893. var render = function() {
  43894. var _vm = this
  43895. var _h = _vm.$createElement
  43896. var _c = _vm._self._c || _h
  43897. return _c(
  43898. "ul",
  43899. { staticClass: "list-unstyled" },
  43900. _vm._l(_vm.errorList, function(error) {
  43901. return _c("li", { key: error, staticClass: "text-danger" }, [
  43902. _vm._v(" " + _vm._s(error) + " ")
  43903. ])
  43904. }),
  43905. 0
  43906. )
  43907. }
  43908. var staticRenderFns = []
  43909. render._withStripped = true
  43910. /***/ }),
  43911. /***/ "./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&":
  43912. /*!********************************************************************************************************************************************************************************************************!*\
  43913. !*** ./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& ***!
  43914. \********************************************************************************************************************************************************************************************************/
  43915. /*! exports provided: render, staticRenderFns */
  43916. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43917. "use strict";
  43918. __webpack_require__.r(__webpack_exports__);
  43919. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43920. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43921. var render = function() {
  43922. var _vm = this
  43923. var _h = _vm.$createElement
  43924. var _c = _vm._self._c || _h
  43925. return _c("div", { staticClass: "modal fade" }, [
  43926. _c(
  43927. "div",
  43928. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  43929. [
  43930. _c("div", { staticClass: "modal-content" }, [
  43931. _c(
  43932. "div",
  43933. { staticClass: "modal-header" },
  43934. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  43935. 2
  43936. ),
  43937. _vm._v(" "),
  43938. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  43939. _vm._v(" "),
  43940. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  43941. ])
  43942. ]
  43943. )
  43944. ])
  43945. }
  43946. var staticRenderFns = [
  43947. function() {
  43948. var _vm = this
  43949. var _h = _vm.$createElement
  43950. var _c = _vm._self._c || _h
  43951. return _c(
  43952. "button",
  43953. {
  43954. staticClass: "close",
  43955. attrs: {
  43956. type: "button",
  43957. "data-dismiss": "modal",
  43958. "aria-label": "Close"
  43959. }
  43960. },
  43961. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  43962. )
  43963. }
  43964. ]
  43965. render._withStripped = true
  43966. /***/ }),
  43967. /***/ "./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&":
  43968. /*!********************************************************************************************************************************************************************************************************!*\
  43969. !*** ./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& ***!
  43970. \********************************************************************************************************************************************************************************************************/
  43971. /*! exports provided: render, staticRenderFns */
  43972. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43973. "use strict";
  43974. __webpack_require__.r(__webpack_exports__);
  43975. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43976. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43977. var render = function() {
  43978. var _vm = this
  43979. var _h = _vm.$createElement
  43980. var _c = _vm._self._c || _h
  43981. return _c(
  43982. "ul",
  43983. { staticClass: "list-unstyled" },
  43984. _vm._l(this.notes, function(note, index) {
  43985. return _c(
  43986. "li",
  43987. { key: note.noteid, staticClass: "row no-gutters mb-2" },
  43988. [
  43989. _c(
  43990. "modal",
  43991. {
  43992. attrs: {
  43993. id: "note" + note.noteid + "editModal",
  43994. tabindex: "-1",
  43995. role: "dialog",
  43996. "aria-labelledby": "note" + note.noteid + "editModalLabel"
  43997. }
  43998. },
  43999. [
  44000. _c(
  44001. "h5",
  44002. {
  44003. staticClass: "modal-title",
  44004. attrs: {
  44005. slot: "header",
  44006. id: "note" + note.noteid + "editModalLabel"
  44007. },
  44008. slot: "header"
  44009. },
  44010. [_vm._v("\n Edit Note\n ")]
  44011. ),
  44012. _vm._v(" "),
  44013. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44014. _c("div", { staticClass: "form-group" }, [
  44015. _c("label", { attrs: { for: "content" } }, [
  44016. _vm._v("Content")
  44017. ]),
  44018. _vm._v(" "),
  44019. _c("textarea", {
  44020. directives: [
  44021. {
  44022. name: "model",
  44023. rawName: "v-model",
  44024. value: note.thenote,
  44025. expression: "note.thenote"
  44026. }
  44027. ],
  44028. staticClass: "form-control",
  44029. attrs: {
  44030. name: "content" + note.noteid,
  44031. id: "content" + note.noteid
  44032. },
  44033. domProps: { value: note.thenote },
  44034. on: {
  44035. input: function($event) {
  44036. if ($event.target.composing) {
  44037. return
  44038. }
  44039. _vm.$set(note, "thenote", $event.target.value)
  44040. }
  44041. }
  44042. })
  44043. ])
  44044. ]),
  44045. _vm._v(" "),
  44046. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44047. _c(
  44048. "button",
  44049. {
  44050. staticClass: "btn btn-secondary",
  44051. attrs: { type: "button", "data-dismiss": "modal" }
  44052. },
  44053. [_vm._v("Close")]
  44054. ),
  44055. _vm._v(" "),
  44056. _c(
  44057. "button",
  44058. {
  44059. staticClass: "btn btn-primary",
  44060. attrs: { type: "button" },
  44061. on: {
  44062. click: function($event) {
  44063. return _vm.updateNote(note.noteid)
  44064. }
  44065. }
  44066. },
  44067. [_vm._v("Save")]
  44068. )
  44069. ])
  44070. ]
  44071. ),
  44072. _vm._v(" "),
  44073. _c(
  44074. "div",
  44075. {
  44076. staticClass: "col-md-1 d-flex flex-column mx-md-3",
  44077. class: { "order-last": _vm.userChanged(index) }
  44078. },
  44079. [
  44080. _c("div", { staticClass: "text-center p-0 m-0" }, [
  44081. _vm._v(_vm._s(note.noteuser))
  44082. ]),
  44083. _vm._v(" "),
  44084. _c(
  44085. "div",
  44086. { staticClass: "text-muted text-small text-center p-0 m-0" },
  44087. [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
  44088. ),
  44089. _vm._v(" "),
  44090. _c(
  44091. "div",
  44092. { staticClass: "btn-group justify-content-center p-0 m-0" },
  44093. [
  44094. _vm.authusername === note.noteuser ||
  44095. _vm.authusername === "admin"
  44096. ? [
  44097. _c(
  44098. "button",
  44099. {
  44100. staticClass: "btn btn-sm btn-primary m-1",
  44101. attrs: {
  44102. "data-toggle": "modal",
  44103. "data-target": "#note" + note.noteid + "editModal"
  44104. }
  44105. },
  44106. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  44107. ),
  44108. _vm._v(" "),
  44109. _vm._m(0, true),
  44110. _vm._v(" "),
  44111. _vm._m(1, true)
  44112. ]
  44113. : _vm._e()
  44114. ],
  44115. 2
  44116. )
  44117. ]
  44118. ),
  44119. _vm._v(" "),
  44120. _c("div", { staticClass: "col-md-10" }, [
  44121. _c("div", { staticClass: "card m-2" }, [
  44122. _c("div", { staticClass: "card-body p-2" }, [
  44123. _vm._v(
  44124. "\n " +
  44125. _vm._s(note.thenote) +
  44126. "\n "
  44127. )
  44128. ])
  44129. ])
  44130. ])
  44131. ],
  44132. 1
  44133. )
  44134. }),
  44135. 0
  44136. )
  44137. }
  44138. var staticRenderFns = [
  44139. function() {
  44140. var _vm = this
  44141. var _h = _vm.$createElement
  44142. var _c = _vm._self._c || _h
  44143. return _c("button", { staticClass: "btn btn-sm btn-danger m-1" }, [
  44144. _c("i", { staticClass: "fas fa-fw fa-trash-alt" })
  44145. ])
  44146. },
  44147. function() {
  44148. var _vm = this
  44149. var _h = _vm.$createElement
  44150. var _c = _vm._self._c || _h
  44151. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  44152. _c("i", { staticClass: "fa fa-fw fa-random" })
  44153. ])
  44154. }
  44155. ]
  44156. render._withStripped = true
  44157. /***/ }),
  44158. /***/ "./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&":
  44159. /*!********************************************************************************************************************************************************************************************************************!*\
  44160. !*** ./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& ***!
  44161. \********************************************************************************************************************************************************************************************************************/
  44162. /*! exports provided: render, staticRenderFns */
  44163. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44164. "use strict";
  44165. __webpack_require__.r(__webpack_exports__);
  44166. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44167. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44168. var render = function() {
  44169. var _vm = this
  44170. var _h = _vm.$createElement
  44171. var _c = _vm._self._c || _h
  44172. return _c(
  44173. "modal",
  44174. {
  44175. attrs: {
  44176. id: _vm.id,
  44177. tabindex: "-1",
  44178. role: "dialog",
  44179. "aria-labelledby": _vm.id + "Label"
  44180. }
  44181. },
  44182. [
  44183. _c(
  44184. "h5",
  44185. {
  44186. staticClass: "modal-title",
  44187. attrs: { slot: "header", id: _vm.id + "Label" },
  44188. slot: "header"
  44189. },
  44190. [_vm._v("\r\n Edit Work Order Information\r\n ")]
  44191. ),
  44192. _vm._v(" "),
  44193. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44194. _c(
  44195. "div",
  44196. { staticClass: "form-group" },
  44197. [
  44198. _c("label", { attrs: { for: "probdesc" } }, [
  44199. _vm._v("Problem Description")
  44200. ]),
  44201. _vm._v(" "),
  44202. _c("textarea", {
  44203. directives: [
  44204. {
  44205. name: "model",
  44206. rawName: "v-model",
  44207. value: _vm.data.probdesc,
  44208. expression: "data.probdesc"
  44209. }
  44210. ],
  44211. class: {
  44212. "form-control": true,
  44213. "is-invalid": _vm.errors.probdesc
  44214. },
  44215. attrs: { id: "probdesc", name: "probdesc" },
  44216. domProps: { value: _vm.data.probdesc },
  44217. on: {
  44218. input: function($event) {
  44219. if ($event.target.composing) {
  44220. return
  44221. }
  44222. _vm.$set(_vm.data, "probdesc", $event.target.value)
  44223. }
  44224. }
  44225. }),
  44226. _vm._v(" "),
  44227. _c("errorlist", { attrs: { errors: _vm.errors.probdesc } })
  44228. ],
  44229. 1
  44230. ),
  44231. _vm._v(" "),
  44232. _c(
  44233. "div",
  44234. { staticClass: "form-group" },
  44235. [
  44236. _c("label", { attrs: { for: "suggested" } }, [
  44237. _vm._v("Suggested Solution")
  44238. ]),
  44239. _vm._v(" "),
  44240. _c("textarea", {
  44241. directives: [
  44242. {
  44243. name: "model",
  44244. rawName: "v-model",
  44245. value: _vm.data.suggested,
  44246. expression: "data.suggested"
  44247. }
  44248. ],
  44249. class: {
  44250. "form-control": true,
  44251. "is-invalid": _vm.errors.suggested
  44252. },
  44253. attrs: { id: "suggested", name: "suggested" },
  44254. domProps: { value: _vm.data.suggested },
  44255. on: {
  44256. input: function($event) {
  44257. if ($event.target.composing) {
  44258. return
  44259. }
  44260. _vm.$set(_vm.data, "suggested", $event.target.value)
  44261. }
  44262. }
  44263. }),
  44264. _vm._v(" "),
  44265. _c("errorlist", { attrs: { errors: _vm.errors.suggested } })
  44266. ],
  44267. 1
  44268. ),
  44269. _vm._v(" "),
  44270. _c(
  44271. "div",
  44272. { staticClass: "form-group" },
  44273. [
  44274. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  44275. _vm._v(" "),
  44276. _c("autocomplete-custom-dropdown", {
  44277. attrs: { options: _vm.storeList, value: this.store },
  44278. model: {
  44279. value: _vm.store,
  44280. callback: function($$v) {
  44281. _vm.store = $$v
  44282. },
  44283. expression: "store"
  44284. }
  44285. })
  44286. ],
  44287. 1
  44288. )
  44289. ]),
  44290. _vm._v(" "),
  44291. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44292. _c(
  44293. "button",
  44294. {
  44295. staticClass: "btn btn-secondary",
  44296. attrs: { type: "button", "data-dismiss": "modal" }
  44297. },
  44298. [_vm._v("Close")]
  44299. ),
  44300. _vm._v(" "),
  44301. _c(
  44302. "button",
  44303. {
  44304. staticClass: "btn btn-primary",
  44305. attrs: { type: "button" },
  44306. on: {
  44307. click: function($event) {
  44308. return _vm.updateWorkOrder()
  44309. }
  44310. }
  44311. },
  44312. [_vm._v("Save")]
  44313. )
  44314. ])
  44315. ]
  44316. )
  44317. }
  44318. var staticRenderFns = []
  44319. render._withStripped = true
  44320. /***/ }),
  44321. /***/ "./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&":
  44322. /*!*********************************************************************************************************************************************************************************************************!*\
  44323. !*** ./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& ***!
  44324. \*********************************************************************************************************************************************************************************************************/
  44325. /*! exports provided: render, staticRenderFns */
  44326. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44327. "use strict";
  44328. __webpack_require__.r(__webpack_exports__);
  44329. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44330. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44331. var render = function() {
  44332. var _vm = this
  44333. var _h = _vm.$createElement
  44334. var _c = _vm._self._c || _h
  44335. return _c(
  44336. "div",
  44337. [
  44338. _c("woinfo-edit-modal", {
  44339. attrs: {
  44340. "modal-id": "workordereditModal",
  44341. "populate-with": this.data,
  44342. "store-list": this.storeList
  44343. }
  44344. }),
  44345. _vm._v(" "),
  44346. _c("p", [
  44347. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  44348. _vm._v(" "),
  44349. _c("span", { domProps: { textContent: _vm._s(this.data.probdesc) } })
  44350. ]),
  44351. _vm._v(" "),
  44352. _c("p", [
  44353. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  44354. _vm._v(" "),
  44355. _c("span", { domProps: { textContent: _vm._s(this.data.suggested) } })
  44356. ]),
  44357. _vm._v(" "),
  44358. _c("p", [
  44359. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  44360. _vm._v(" "),
  44361. _c("span", { domProps: { textContent: _vm._s(this.data.woid) } })
  44362. ]),
  44363. _vm._v(" "),
  44364. _c("p", [
  44365. _c("i", { staticClass: "fas fa-fw fa-building" }),
  44366. _vm._v(" "),
  44367. _c("span", [_vm._v(_vm._s(_vm.storeList[_vm.data.storeid]))])
  44368. ]),
  44369. _vm._v(" "),
  44370. _c("p", [
  44371. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  44372. _vm._v(" "),
  44373. _c(
  44374. "span",
  44375. {
  44376. staticClass: "dashed-underline",
  44377. attrs: {
  44378. "data-toggle": "tooltip",
  44379. "data-placement": "bottom",
  44380. title: this.getHRDate(this.data.dropdate)
  44381. }
  44382. },
  44383. [
  44384. _vm._v(
  44385. "\n " +
  44386. _vm._s(Math.floor(this.daysSinceToday(this.data.dropdate))) +
  44387. " days ago\n "
  44388. )
  44389. ]
  44390. )
  44391. ]),
  44392. _vm._v(" "),
  44393. _c("p", [
  44394. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  44395. _vm._v(" "),
  44396. !this.isZero(this.data.pickupdate)
  44397. ? _c(
  44398. "span",
  44399. {
  44400. staticClass: "dashed-underline",
  44401. attrs: {
  44402. "data-toggle": "tooltip",
  44403. "data-placement": "bottom",
  44404. title: this.getHRDate(this.data.pickupdate)
  44405. }
  44406. },
  44407. [
  44408. _vm._v(
  44409. "\n " +
  44410. _vm._s(
  44411. Math.floor(this.daysSinceToday(this.data.pickupdate))
  44412. ) +
  44413. " days ago\n "
  44414. )
  44415. ]
  44416. )
  44417. : _vm._e()
  44418. ]),
  44419. _vm._v(" "),
  44420. _c(
  44421. "button",
  44422. {
  44423. staticClass: "btn btn-primary",
  44424. attrs: {
  44425. type: "button",
  44426. "data-toggle": "modal",
  44427. "data-target": "#workordereditModal"
  44428. }
  44429. },
  44430. [_vm._v("Edit")]
  44431. )
  44432. ],
  44433. 1
  44434. )
  44435. }
  44436. var staticRenderFns = []
  44437. render._withStripped = true
  44438. /***/ }),
  44439. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  44440. /*!********************************************************************!*\
  44441. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  44442. \********************************************************************/
  44443. /*! exports provided: default */
  44444. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44445. "use strict";
  44446. __webpack_require__.r(__webpack_exports__);
  44447. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  44448. /* globals __VUE_SSR_CONTEXT__ */
  44449. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  44450. // This module is a runtime utility for cleaner component module output and will
  44451. // be included in the final webpack user bundle.
  44452. function normalizeComponent (
  44453. scriptExports,
  44454. render,
  44455. staticRenderFns,
  44456. functionalTemplate,
  44457. injectStyles,
  44458. scopeId,
  44459. moduleIdentifier, /* server only */
  44460. shadowMode /* vue-cli only */
  44461. ) {
  44462. // Vue.extend constructor export interop
  44463. var options = typeof scriptExports === 'function'
  44464. ? scriptExports.options
  44465. : scriptExports
  44466. // render functions
  44467. if (render) {
  44468. options.render = render
  44469. options.staticRenderFns = staticRenderFns
  44470. options._compiled = true
  44471. }
  44472. // functional template
  44473. if (functionalTemplate) {
  44474. options.functional = true
  44475. }
  44476. // scopedId
  44477. if (scopeId) {
  44478. options._scopeId = 'data-v-' + scopeId
  44479. }
  44480. var hook
  44481. if (moduleIdentifier) { // server build
  44482. hook = function (context) {
  44483. // 2.3 injection
  44484. context =
  44485. context || // cached call
  44486. (this.$vnode && this.$vnode.ssrContext) || // stateful
  44487. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  44488. // 2.2 with runInNewContext: true
  44489. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  44490. context = __VUE_SSR_CONTEXT__
  44491. }
  44492. // inject component styles
  44493. if (injectStyles) {
  44494. injectStyles.call(this, context)
  44495. }
  44496. // register component module identifier for async chunk inferrence
  44497. if (context && context._registeredComponents) {
  44498. context._registeredComponents.add(moduleIdentifier)
  44499. }
  44500. }
  44501. // used by ssr in case component is cached and beforeCreate
  44502. // never gets called
  44503. options._ssrRegister = hook
  44504. } else if (injectStyles) {
  44505. hook = shadowMode
  44506. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  44507. : injectStyles
  44508. }
  44509. if (hook) {
  44510. if (options.functional) {
  44511. // for template-only hot-reload because in that case the render fn doesn't
  44512. // go through the normalizer
  44513. options._injectStyles = hook
  44514. // register for functioal component in vue file
  44515. var originalRender = options.render
  44516. options.render = function renderWithStyleInjection (h, context) {
  44517. hook.call(context)
  44518. return originalRender(h, context)
  44519. }
  44520. } else {
  44521. // inject component registration as beforeCreate hook
  44522. var existing = options.beforeCreate
  44523. options.beforeCreate = existing
  44524. ? [].concat(existing, hook)
  44525. : [hook]
  44526. }
  44527. }
  44528. return {
  44529. exports: scriptExports,
  44530. options: options
  44531. }
  44532. }
  44533. /***/ }),
  44534. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  44535. /*!*************************************************!*\
  44536. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  44537. \*************************************************/
  44538. /*! no static exports found */
  44539. /***/ (function(module, exports, __webpack_require__) {
  44540. "use strict";
  44541. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  44542. * Vue.js v2.6.11
  44543. * (c) 2014-2019 Evan You
  44544. * Released under the MIT License.
  44545. */
  44546. /* */
  44547. var emptyObject = Object.freeze({});
  44548. // These helpers produce better VM code in JS engines due to their
  44549. // explicitness and function inlining.
  44550. function isUndef (v) {
  44551. return v === undefined || v === null
  44552. }
  44553. function isDef (v) {
  44554. return v !== undefined && v !== null
  44555. }
  44556. function isTrue (v) {
  44557. return v === true
  44558. }
  44559. function isFalse (v) {
  44560. return v === false
  44561. }
  44562. /**
  44563. * Check if value is primitive.
  44564. */
  44565. function isPrimitive (value) {
  44566. return (
  44567. typeof value === 'string' ||
  44568. typeof value === 'number' ||
  44569. // $flow-disable-line
  44570. typeof value === 'symbol' ||
  44571. typeof value === 'boolean'
  44572. )
  44573. }
  44574. /**
  44575. * Quick object check - this is primarily used to tell
  44576. * Objects from primitive values when we know the value
  44577. * is a JSON-compliant type.
  44578. */
  44579. function isObject (obj) {
  44580. return obj !== null && typeof obj === 'object'
  44581. }
  44582. /**
  44583. * Get the raw type string of a value, e.g., [object Object].
  44584. */
  44585. var _toString = Object.prototype.toString;
  44586. function toRawType (value) {
  44587. return _toString.call(value).slice(8, -1)
  44588. }
  44589. /**
  44590. * Strict object type check. Only returns true
  44591. * for plain JavaScript objects.
  44592. */
  44593. function isPlainObject (obj) {
  44594. return _toString.call(obj) === '[object Object]'
  44595. }
  44596. function isRegExp (v) {
  44597. return _toString.call(v) === '[object RegExp]'
  44598. }
  44599. /**
  44600. * Check if val is a valid array index.
  44601. */
  44602. function isValidArrayIndex (val) {
  44603. var n = parseFloat(String(val));
  44604. return n >= 0 && Math.floor(n) === n && isFinite(val)
  44605. }
  44606. function isPromise (val) {
  44607. return (
  44608. isDef(val) &&
  44609. typeof val.then === 'function' &&
  44610. typeof val.catch === 'function'
  44611. )
  44612. }
  44613. /**
  44614. * Convert a value to a string that is actually rendered.
  44615. */
  44616. function toString (val) {
  44617. return val == null
  44618. ? ''
  44619. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  44620. ? JSON.stringify(val, null, 2)
  44621. : String(val)
  44622. }
  44623. /**
  44624. * Convert an input value to a number for persistence.
  44625. * If the conversion fails, return original string.
  44626. */
  44627. function toNumber (val) {
  44628. var n = parseFloat(val);
  44629. return isNaN(n) ? val : n
  44630. }
  44631. /**
  44632. * Make a map and return a function for checking if a key
  44633. * is in that map.
  44634. */
  44635. function makeMap (
  44636. str,
  44637. expectsLowerCase
  44638. ) {
  44639. var map = Object.create(null);
  44640. var list = str.split(',');
  44641. for (var i = 0; i < list.length; i++) {
  44642. map[list[i]] = true;
  44643. }
  44644. return expectsLowerCase
  44645. ? function (val) { return map[val.toLowerCase()]; }
  44646. : function (val) { return map[val]; }
  44647. }
  44648. /**
  44649. * Check if a tag is a built-in tag.
  44650. */
  44651. var isBuiltInTag = makeMap('slot,component', true);
  44652. /**
  44653. * Check if an attribute is a reserved attribute.
  44654. */
  44655. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  44656. /**
  44657. * Remove an item from an array.
  44658. */
  44659. function remove (arr, item) {
  44660. if (arr.length) {
  44661. var index = arr.indexOf(item);
  44662. if (index > -1) {
  44663. return arr.splice(index, 1)
  44664. }
  44665. }
  44666. }
  44667. /**
  44668. * Check whether an object has the property.
  44669. */
  44670. var hasOwnProperty = Object.prototype.hasOwnProperty;
  44671. function hasOwn (obj, key) {
  44672. return hasOwnProperty.call(obj, key)
  44673. }
  44674. /**
  44675. * Create a cached version of a pure function.
  44676. */
  44677. function cached (fn) {
  44678. var cache = Object.create(null);
  44679. return (function cachedFn (str) {
  44680. var hit = cache[str];
  44681. return hit || (cache[str] = fn(str))
  44682. })
  44683. }
  44684. /**
  44685. * Camelize a hyphen-delimited string.
  44686. */
  44687. var camelizeRE = /-(\w)/g;
  44688. var camelize = cached(function (str) {
  44689. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  44690. });
  44691. /**
  44692. * Capitalize a string.
  44693. */
  44694. var capitalize = cached(function (str) {
  44695. return str.charAt(0).toUpperCase() + str.slice(1)
  44696. });
  44697. /**
  44698. * Hyphenate a camelCase string.
  44699. */
  44700. var hyphenateRE = /\B([A-Z])/g;
  44701. var hyphenate = cached(function (str) {
  44702. return str.replace(hyphenateRE, '-$1').toLowerCase()
  44703. });
  44704. /**
  44705. * Simple bind polyfill for environments that do not support it,
  44706. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  44707. * since native bind is now performant enough in most browsers.
  44708. * But removing it would mean breaking code that was able to run in
  44709. * PhantomJS 1.x, so this must be kept for backward compatibility.
  44710. */
  44711. /* istanbul ignore next */
  44712. function polyfillBind (fn, ctx) {
  44713. function boundFn (a) {
  44714. var l = arguments.length;
  44715. return l
  44716. ? l > 1
  44717. ? fn.apply(ctx, arguments)
  44718. : fn.call(ctx, a)
  44719. : fn.call(ctx)
  44720. }
  44721. boundFn._length = fn.length;
  44722. return boundFn
  44723. }
  44724. function nativeBind (fn, ctx) {
  44725. return fn.bind(ctx)
  44726. }
  44727. var bind = Function.prototype.bind
  44728. ? nativeBind
  44729. : polyfillBind;
  44730. /**
  44731. * Convert an Array-like object to a real Array.
  44732. */
  44733. function toArray (list, start) {
  44734. start = start || 0;
  44735. var i = list.length - start;
  44736. var ret = new Array(i);
  44737. while (i--) {
  44738. ret[i] = list[i + start];
  44739. }
  44740. return ret
  44741. }
  44742. /**
  44743. * Mix properties into target object.
  44744. */
  44745. function extend (to, _from) {
  44746. for (var key in _from) {
  44747. to[key] = _from[key];
  44748. }
  44749. return to
  44750. }
  44751. /**
  44752. * Merge an Array of Objects into a single Object.
  44753. */
  44754. function toObject (arr) {
  44755. var res = {};
  44756. for (var i = 0; i < arr.length; i++) {
  44757. if (arr[i]) {
  44758. extend(res, arr[i]);
  44759. }
  44760. }
  44761. return res
  44762. }
  44763. /* eslint-disable no-unused-vars */
  44764. /**
  44765. * Perform no operation.
  44766. * Stubbing args to make Flow happy without leaving useless transpiled code
  44767. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  44768. */
  44769. function noop (a, b, c) {}
  44770. /**
  44771. * Always return false.
  44772. */
  44773. var no = function (a, b, c) { return false; };
  44774. /* eslint-enable no-unused-vars */
  44775. /**
  44776. * Return the same value.
  44777. */
  44778. var identity = function (_) { return _; };
  44779. /**
  44780. * Generate a string containing static keys from compiler modules.
  44781. */
  44782. function genStaticKeys (modules) {
  44783. return modules.reduce(function (keys, m) {
  44784. return keys.concat(m.staticKeys || [])
  44785. }, []).join(',')
  44786. }
  44787. /**
  44788. * Check if two values are loosely equal - that is,
  44789. * if they are plain objects, do they have the same shape?
  44790. */
  44791. function looseEqual (a, b) {
  44792. if (a === b) { return true }
  44793. var isObjectA = isObject(a);
  44794. var isObjectB = isObject(b);
  44795. if (isObjectA && isObjectB) {
  44796. try {
  44797. var isArrayA = Array.isArray(a);
  44798. var isArrayB = Array.isArray(b);
  44799. if (isArrayA && isArrayB) {
  44800. return a.length === b.length && a.every(function (e, i) {
  44801. return looseEqual(e, b[i])
  44802. })
  44803. } else if (a instanceof Date && b instanceof Date) {
  44804. return a.getTime() === b.getTime()
  44805. } else if (!isArrayA && !isArrayB) {
  44806. var keysA = Object.keys(a);
  44807. var keysB = Object.keys(b);
  44808. return keysA.length === keysB.length && keysA.every(function (key) {
  44809. return looseEqual(a[key], b[key])
  44810. })
  44811. } else {
  44812. /* istanbul ignore next */
  44813. return false
  44814. }
  44815. } catch (e) {
  44816. /* istanbul ignore next */
  44817. return false
  44818. }
  44819. } else if (!isObjectA && !isObjectB) {
  44820. return String(a) === String(b)
  44821. } else {
  44822. return false
  44823. }
  44824. }
  44825. /**
  44826. * Return the first index at which a loosely equal value can be
  44827. * found in the array (if value is a plain object, the array must
  44828. * contain an object of the same shape), or -1 if it is not present.
  44829. */
  44830. function looseIndexOf (arr, val) {
  44831. for (var i = 0; i < arr.length; i++) {
  44832. if (looseEqual(arr[i], val)) { return i }
  44833. }
  44834. return -1
  44835. }
  44836. /**
  44837. * Ensure a function is called only once.
  44838. */
  44839. function once (fn) {
  44840. var called = false;
  44841. return function () {
  44842. if (!called) {
  44843. called = true;
  44844. fn.apply(this, arguments);
  44845. }
  44846. }
  44847. }
  44848. var SSR_ATTR = 'data-server-rendered';
  44849. var ASSET_TYPES = [
  44850. 'component',
  44851. 'directive',
  44852. 'filter'
  44853. ];
  44854. var LIFECYCLE_HOOKS = [
  44855. 'beforeCreate',
  44856. 'created',
  44857. 'beforeMount',
  44858. 'mounted',
  44859. 'beforeUpdate',
  44860. 'updated',
  44861. 'beforeDestroy',
  44862. 'destroyed',
  44863. 'activated',
  44864. 'deactivated',
  44865. 'errorCaptured',
  44866. 'serverPrefetch'
  44867. ];
  44868. /* */
  44869. var config = ({
  44870. /**
  44871. * Option merge strategies (used in core/util/options)
  44872. */
  44873. // $flow-disable-line
  44874. optionMergeStrategies: Object.create(null),
  44875. /**
  44876. * Whether to suppress warnings.
  44877. */
  44878. silent: false,
  44879. /**
  44880. * Show production mode tip message on boot?
  44881. */
  44882. productionTip: "development" !== 'production',
  44883. /**
  44884. * Whether to enable devtools
  44885. */
  44886. devtools: "development" !== 'production',
  44887. /**
  44888. * Whether to record perf
  44889. */
  44890. performance: false,
  44891. /**
  44892. * Error handler for watcher errors
  44893. */
  44894. errorHandler: null,
  44895. /**
  44896. * Warn handler for watcher warns
  44897. */
  44898. warnHandler: null,
  44899. /**
  44900. * Ignore certain custom elements
  44901. */
  44902. ignoredElements: [],
  44903. /**
  44904. * Custom user key aliases for v-on
  44905. */
  44906. // $flow-disable-line
  44907. keyCodes: Object.create(null),
  44908. /**
  44909. * Check if a tag is reserved so that it cannot be registered as a
  44910. * component. This is platform-dependent and may be overwritten.
  44911. */
  44912. isReservedTag: no,
  44913. /**
  44914. * Check if an attribute is reserved so that it cannot be used as a component
  44915. * prop. This is platform-dependent and may be overwritten.
  44916. */
  44917. isReservedAttr: no,
  44918. /**
  44919. * Check if a tag is an unknown element.
  44920. * Platform-dependent.
  44921. */
  44922. isUnknownElement: no,
  44923. /**
  44924. * Get the namespace of an element
  44925. */
  44926. getTagNamespace: noop,
  44927. /**
  44928. * Parse the real tag name for the specific platform.
  44929. */
  44930. parsePlatformTagName: identity,
  44931. /**
  44932. * Check if an attribute must be bound using property, e.g. value
  44933. * Platform-dependent.
  44934. */
  44935. mustUseProp: no,
  44936. /**
  44937. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  44938. * This will significantly reduce performance if set to false.
  44939. */
  44940. async: true,
  44941. /**
  44942. * Exposed for legacy reasons
  44943. */
  44944. _lifecycleHooks: LIFECYCLE_HOOKS
  44945. });
  44946. /* */
  44947. /**
  44948. * unicode letters used for parsing html tags, component names and property paths.
  44949. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  44950. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  44951. */
  44952. 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/;
  44953. /**
  44954. * Check if a string starts with $ or _
  44955. */
  44956. function isReserved (str) {
  44957. var c = (str + '').charCodeAt(0);
  44958. return c === 0x24 || c === 0x5F
  44959. }
  44960. /**
  44961. * Define a property.
  44962. */
  44963. function def (obj, key, val, enumerable) {
  44964. Object.defineProperty(obj, key, {
  44965. value: val,
  44966. enumerable: !!enumerable,
  44967. writable: true,
  44968. configurable: true
  44969. });
  44970. }
  44971. /**
  44972. * Parse simple path.
  44973. */
  44974. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  44975. function parsePath (path) {
  44976. if (bailRE.test(path)) {
  44977. return
  44978. }
  44979. var segments = path.split('.');
  44980. return function (obj) {
  44981. for (var i = 0; i < segments.length; i++) {
  44982. if (!obj) { return }
  44983. obj = obj[segments[i]];
  44984. }
  44985. return obj
  44986. }
  44987. }
  44988. /* */
  44989. // can we use __proto__?
  44990. var hasProto = '__proto__' in {};
  44991. // Browser environment sniffing
  44992. var inBrowser = typeof window !== 'undefined';
  44993. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  44994. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  44995. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  44996. var isIE = UA && /msie|trident/.test(UA);
  44997. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  44998. var isEdge = UA && UA.indexOf('edge/') > 0;
  44999. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  45000. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  45001. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  45002. var isPhantomJS = UA && /phantomjs/.test(UA);
  45003. var isFF = UA && UA.match(/firefox\/(\d+)/);
  45004. // Firefox has a "watch" function on Object.prototype...
  45005. var nativeWatch = ({}).watch;
  45006. var supportsPassive = false;
  45007. if (inBrowser) {
  45008. try {
  45009. var opts = {};
  45010. Object.defineProperty(opts, 'passive', ({
  45011. get: function get () {
  45012. /* istanbul ignore next */
  45013. supportsPassive = true;
  45014. }
  45015. })); // https://github.com/facebook/flow/issues/285
  45016. window.addEventListener('test-passive', null, opts);
  45017. } catch (e) {}
  45018. }
  45019. // this needs to be lazy-evaled because vue may be required before
  45020. // vue-server-renderer can set VUE_ENV
  45021. var _isServer;
  45022. var isServerRendering = function () {
  45023. if (_isServer === undefined) {
  45024. /* istanbul ignore if */
  45025. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  45026. // detect presence of vue-server-renderer and avoid
  45027. // Webpack shimming the process
  45028. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  45029. } else {
  45030. _isServer = false;
  45031. }
  45032. }
  45033. return _isServer
  45034. };
  45035. // detect devtools
  45036. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  45037. /* istanbul ignore next */
  45038. function isNative (Ctor) {
  45039. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  45040. }
  45041. var hasSymbol =
  45042. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  45043. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  45044. var _Set;
  45045. /* istanbul ignore if */ // $flow-disable-line
  45046. if (typeof Set !== 'undefined' && isNative(Set)) {
  45047. // use native Set when available.
  45048. _Set = Set;
  45049. } else {
  45050. // a non-standard Set polyfill that only works with primitive keys.
  45051. _Set = /*@__PURE__*/(function () {
  45052. function Set () {
  45053. this.set = Object.create(null);
  45054. }
  45055. Set.prototype.has = function has (key) {
  45056. return this.set[key] === true
  45057. };
  45058. Set.prototype.add = function add (key) {
  45059. this.set[key] = true;
  45060. };
  45061. Set.prototype.clear = function clear () {
  45062. this.set = Object.create(null);
  45063. };
  45064. return Set;
  45065. }());
  45066. }
  45067. /* */
  45068. var warn = noop;
  45069. var tip = noop;
  45070. var generateComponentTrace = (noop); // work around flow check
  45071. var formatComponentName = (noop);
  45072. {
  45073. var hasConsole = typeof console !== 'undefined';
  45074. var classifyRE = /(?:^|[-_])(\w)/g;
  45075. var classify = function (str) { return str
  45076. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  45077. .replace(/[-_]/g, ''); };
  45078. warn = function (msg, vm) {
  45079. var trace = vm ? generateComponentTrace(vm) : '';
  45080. if (config.warnHandler) {
  45081. config.warnHandler.call(null, msg, vm, trace);
  45082. } else if (hasConsole && (!config.silent)) {
  45083. console.error(("[Vue warn]: " + msg + trace));
  45084. }
  45085. };
  45086. tip = function (msg, vm) {
  45087. if (hasConsole && (!config.silent)) {
  45088. console.warn("[Vue tip]: " + msg + (
  45089. vm ? generateComponentTrace(vm) : ''
  45090. ));
  45091. }
  45092. };
  45093. formatComponentName = function (vm, includeFile) {
  45094. if (vm.$root === vm) {
  45095. return '<Root>'
  45096. }
  45097. var options = typeof vm === 'function' && vm.cid != null
  45098. ? vm.options
  45099. : vm._isVue
  45100. ? vm.$options || vm.constructor.options
  45101. : vm;
  45102. var name = options.name || options._componentTag;
  45103. var file = options.__file;
  45104. if (!name && file) {
  45105. var match = file.match(/([^/\\]+)\.vue$/);
  45106. name = match && match[1];
  45107. }
  45108. return (
  45109. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  45110. (file && includeFile !== false ? (" at " + file) : '')
  45111. )
  45112. };
  45113. var repeat = function (str, n) {
  45114. var res = '';
  45115. while (n) {
  45116. if (n % 2 === 1) { res += str; }
  45117. if (n > 1) { str += str; }
  45118. n >>= 1;
  45119. }
  45120. return res
  45121. };
  45122. generateComponentTrace = function (vm) {
  45123. if (vm._isVue && vm.$parent) {
  45124. var tree = [];
  45125. var currentRecursiveSequence = 0;
  45126. while (vm) {
  45127. if (tree.length > 0) {
  45128. var last = tree[tree.length - 1];
  45129. if (last.constructor === vm.constructor) {
  45130. currentRecursiveSequence++;
  45131. vm = vm.$parent;
  45132. continue
  45133. } else if (currentRecursiveSequence > 0) {
  45134. tree[tree.length - 1] = [last, currentRecursiveSequence];
  45135. currentRecursiveSequence = 0;
  45136. }
  45137. }
  45138. tree.push(vm);
  45139. vm = vm.$parent;
  45140. }
  45141. return '\n\nfound in\n\n' + tree
  45142. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  45143. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  45144. : formatComponentName(vm))); })
  45145. .join('\n')
  45146. } else {
  45147. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  45148. }
  45149. };
  45150. }
  45151. /* */
  45152. var uid = 0;
  45153. /**
  45154. * A dep is an observable that can have multiple
  45155. * directives subscribing to it.
  45156. */
  45157. var Dep = function Dep () {
  45158. this.id = uid++;
  45159. this.subs = [];
  45160. };
  45161. Dep.prototype.addSub = function addSub (sub) {
  45162. this.subs.push(sub);
  45163. };
  45164. Dep.prototype.removeSub = function removeSub (sub) {
  45165. remove(this.subs, sub);
  45166. };
  45167. Dep.prototype.depend = function depend () {
  45168. if (Dep.target) {
  45169. Dep.target.addDep(this);
  45170. }
  45171. };
  45172. Dep.prototype.notify = function notify () {
  45173. // stabilize the subscriber list first
  45174. var subs = this.subs.slice();
  45175. if (!config.async) {
  45176. // subs aren't sorted in scheduler if not running async
  45177. // we need to sort them now to make sure they fire in correct
  45178. // order
  45179. subs.sort(function (a, b) { return a.id - b.id; });
  45180. }
  45181. for (var i = 0, l = subs.length; i < l; i++) {
  45182. subs[i].update();
  45183. }
  45184. };
  45185. // The current target watcher being evaluated.
  45186. // This is globally unique because only one watcher
  45187. // can be evaluated at a time.
  45188. Dep.target = null;
  45189. var targetStack = [];
  45190. function pushTarget (target) {
  45191. targetStack.push(target);
  45192. Dep.target = target;
  45193. }
  45194. function popTarget () {
  45195. targetStack.pop();
  45196. Dep.target = targetStack[targetStack.length - 1];
  45197. }
  45198. /* */
  45199. var VNode = function VNode (
  45200. tag,
  45201. data,
  45202. children,
  45203. text,
  45204. elm,
  45205. context,
  45206. componentOptions,
  45207. asyncFactory
  45208. ) {
  45209. this.tag = tag;
  45210. this.data = data;
  45211. this.children = children;
  45212. this.text = text;
  45213. this.elm = elm;
  45214. this.ns = undefined;
  45215. this.context = context;
  45216. this.fnContext = undefined;
  45217. this.fnOptions = undefined;
  45218. this.fnScopeId = undefined;
  45219. this.key = data && data.key;
  45220. this.componentOptions = componentOptions;
  45221. this.componentInstance = undefined;
  45222. this.parent = undefined;
  45223. this.raw = false;
  45224. this.isStatic = false;
  45225. this.isRootInsert = true;
  45226. this.isComment = false;
  45227. this.isCloned = false;
  45228. this.isOnce = false;
  45229. this.asyncFactory = asyncFactory;
  45230. this.asyncMeta = undefined;
  45231. this.isAsyncPlaceholder = false;
  45232. };
  45233. var prototypeAccessors = { child: { configurable: true } };
  45234. // DEPRECATED: alias for componentInstance for backwards compat.
  45235. /* istanbul ignore next */
  45236. prototypeAccessors.child.get = function () {
  45237. return this.componentInstance
  45238. };
  45239. Object.defineProperties( VNode.prototype, prototypeAccessors );
  45240. var createEmptyVNode = function (text) {
  45241. if ( text === void 0 ) text = '';
  45242. var node = new VNode();
  45243. node.text = text;
  45244. node.isComment = true;
  45245. return node
  45246. };
  45247. function createTextVNode (val) {
  45248. return new VNode(undefined, undefined, undefined, String(val))
  45249. }
  45250. // optimized shallow clone
  45251. // used for static nodes and slot nodes because they may be reused across
  45252. // multiple renders, cloning them avoids errors when DOM manipulations rely
  45253. // on their elm reference.
  45254. function cloneVNode (vnode) {
  45255. var cloned = new VNode(
  45256. vnode.tag,
  45257. vnode.data,
  45258. // #7975
  45259. // clone children array to avoid mutating original in case of cloning
  45260. // a child.
  45261. vnode.children && vnode.children.slice(),
  45262. vnode.text,
  45263. vnode.elm,
  45264. vnode.context,
  45265. vnode.componentOptions,
  45266. vnode.asyncFactory
  45267. );
  45268. cloned.ns = vnode.ns;
  45269. cloned.isStatic = vnode.isStatic;
  45270. cloned.key = vnode.key;
  45271. cloned.isComment = vnode.isComment;
  45272. cloned.fnContext = vnode.fnContext;
  45273. cloned.fnOptions = vnode.fnOptions;
  45274. cloned.fnScopeId = vnode.fnScopeId;
  45275. cloned.asyncMeta = vnode.asyncMeta;
  45276. cloned.isCloned = true;
  45277. return cloned
  45278. }
  45279. /*
  45280. * not type checking this file because flow doesn't play well with
  45281. * dynamically accessing methods on Array prototype
  45282. */
  45283. var arrayProto = Array.prototype;
  45284. var arrayMethods = Object.create(arrayProto);
  45285. var methodsToPatch = [
  45286. 'push',
  45287. 'pop',
  45288. 'shift',
  45289. 'unshift',
  45290. 'splice',
  45291. 'sort',
  45292. 'reverse'
  45293. ];
  45294. /**
  45295. * Intercept mutating methods and emit events
  45296. */
  45297. methodsToPatch.forEach(function (method) {
  45298. // cache original method
  45299. var original = arrayProto[method];
  45300. def(arrayMethods, method, function mutator () {
  45301. var args = [], len = arguments.length;
  45302. while ( len-- ) args[ len ] = arguments[ len ];
  45303. var result = original.apply(this, args);
  45304. var ob = this.__ob__;
  45305. var inserted;
  45306. switch (method) {
  45307. case 'push':
  45308. case 'unshift':
  45309. inserted = args;
  45310. break
  45311. case 'splice':
  45312. inserted = args.slice(2);
  45313. break
  45314. }
  45315. if (inserted) { ob.observeArray(inserted); }
  45316. // notify change
  45317. ob.dep.notify();
  45318. return result
  45319. });
  45320. });
  45321. /* */
  45322. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  45323. /**
  45324. * In some cases we may want to disable observation inside a component's
  45325. * update computation.
  45326. */
  45327. var shouldObserve = true;
  45328. function toggleObserving (value) {
  45329. shouldObserve = value;
  45330. }
  45331. /**
  45332. * Observer class that is attached to each observed
  45333. * object. Once attached, the observer converts the target
  45334. * object's property keys into getter/setters that
  45335. * collect dependencies and dispatch updates.
  45336. */
  45337. var Observer = function Observer (value) {
  45338. this.value = value;
  45339. this.dep = new Dep();
  45340. this.vmCount = 0;
  45341. def(value, '__ob__', this);
  45342. if (Array.isArray(value)) {
  45343. if (hasProto) {
  45344. protoAugment(value, arrayMethods);
  45345. } else {
  45346. copyAugment(value, arrayMethods, arrayKeys);
  45347. }
  45348. this.observeArray(value);
  45349. } else {
  45350. this.walk(value);
  45351. }
  45352. };
  45353. /**
  45354. * Walk through all properties and convert them into
  45355. * getter/setters. This method should only be called when
  45356. * value type is Object.
  45357. */
  45358. Observer.prototype.walk = function walk (obj) {
  45359. var keys = Object.keys(obj);
  45360. for (var i = 0; i < keys.length; i++) {
  45361. defineReactive$$1(obj, keys[i]);
  45362. }
  45363. };
  45364. /**
  45365. * Observe a list of Array items.
  45366. */
  45367. Observer.prototype.observeArray = function observeArray (items) {
  45368. for (var i = 0, l = items.length; i < l; i++) {
  45369. observe(items[i]);
  45370. }
  45371. };
  45372. // helpers
  45373. /**
  45374. * Augment a target Object or Array by intercepting
  45375. * the prototype chain using __proto__
  45376. */
  45377. function protoAugment (target, src) {
  45378. /* eslint-disable no-proto */
  45379. target.__proto__ = src;
  45380. /* eslint-enable no-proto */
  45381. }
  45382. /**
  45383. * Augment a target Object or Array by defining
  45384. * hidden properties.
  45385. */
  45386. /* istanbul ignore next */
  45387. function copyAugment (target, src, keys) {
  45388. for (var i = 0, l = keys.length; i < l; i++) {
  45389. var key = keys[i];
  45390. def(target, key, src[key]);
  45391. }
  45392. }
  45393. /**
  45394. * Attempt to create an observer instance for a value,
  45395. * returns the new observer if successfully observed,
  45396. * or the existing observer if the value already has one.
  45397. */
  45398. function observe (value, asRootData) {
  45399. if (!isObject(value) || value instanceof VNode) {
  45400. return
  45401. }
  45402. var ob;
  45403. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  45404. ob = value.__ob__;
  45405. } else if (
  45406. shouldObserve &&
  45407. !isServerRendering() &&
  45408. (Array.isArray(value) || isPlainObject(value)) &&
  45409. Object.isExtensible(value) &&
  45410. !value._isVue
  45411. ) {
  45412. ob = new Observer(value);
  45413. }
  45414. if (asRootData && ob) {
  45415. ob.vmCount++;
  45416. }
  45417. return ob
  45418. }
  45419. /**
  45420. * Define a reactive property on an Object.
  45421. */
  45422. function defineReactive$$1 (
  45423. obj,
  45424. key,
  45425. val,
  45426. customSetter,
  45427. shallow
  45428. ) {
  45429. var dep = new Dep();
  45430. var property = Object.getOwnPropertyDescriptor(obj, key);
  45431. if (property && property.configurable === false) {
  45432. return
  45433. }
  45434. // cater for pre-defined getter/setters
  45435. var getter = property && property.get;
  45436. var setter = property && property.set;
  45437. if ((!getter || setter) && arguments.length === 2) {
  45438. val = obj[key];
  45439. }
  45440. var childOb = !shallow && observe(val);
  45441. Object.defineProperty(obj, key, {
  45442. enumerable: true,
  45443. configurable: true,
  45444. get: function reactiveGetter () {
  45445. var value = getter ? getter.call(obj) : val;
  45446. if (Dep.target) {
  45447. dep.depend();
  45448. if (childOb) {
  45449. childOb.dep.depend();
  45450. if (Array.isArray(value)) {
  45451. dependArray(value);
  45452. }
  45453. }
  45454. }
  45455. return value
  45456. },
  45457. set: function reactiveSetter (newVal) {
  45458. var value = getter ? getter.call(obj) : val;
  45459. /* eslint-disable no-self-compare */
  45460. if (newVal === value || (newVal !== newVal && value !== value)) {
  45461. return
  45462. }
  45463. /* eslint-enable no-self-compare */
  45464. if (customSetter) {
  45465. customSetter();
  45466. }
  45467. // #7981: for accessor properties without setter
  45468. if (getter && !setter) { return }
  45469. if (setter) {
  45470. setter.call(obj, newVal);
  45471. } else {
  45472. val = newVal;
  45473. }
  45474. childOb = !shallow && observe(newVal);
  45475. dep.notify();
  45476. }
  45477. });
  45478. }
  45479. /**
  45480. * Set a property on an object. Adds the new property and
  45481. * triggers change notification if the property doesn't
  45482. * already exist.
  45483. */
  45484. function set (target, key, val) {
  45485. if (isUndef(target) || isPrimitive(target)
  45486. ) {
  45487. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  45488. }
  45489. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45490. target.length = Math.max(target.length, key);
  45491. target.splice(key, 1, val);
  45492. return val
  45493. }
  45494. if (key in target && !(key in Object.prototype)) {
  45495. target[key] = val;
  45496. return val
  45497. }
  45498. var ob = (target).__ob__;
  45499. if (target._isVue || (ob && ob.vmCount)) {
  45500. warn(
  45501. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  45502. 'at runtime - declare it upfront in the data option.'
  45503. );
  45504. return val
  45505. }
  45506. if (!ob) {
  45507. target[key] = val;
  45508. return val
  45509. }
  45510. defineReactive$$1(ob.value, key, val);
  45511. ob.dep.notify();
  45512. return val
  45513. }
  45514. /**
  45515. * Delete a property and trigger change if necessary.
  45516. */
  45517. function del (target, key) {
  45518. if (isUndef(target) || isPrimitive(target)
  45519. ) {
  45520. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  45521. }
  45522. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45523. target.splice(key, 1);
  45524. return
  45525. }
  45526. var ob = (target).__ob__;
  45527. if (target._isVue || (ob && ob.vmCount)) {
  45528. warn(
  45529. 'Avoid deleting properties on a Vue instance or its root $data ' +
  45530. '- just set it to null.'
  45531. );
  45532. return
  45533. }
  45534. if (!hasOwn(target, key)) {
  45535. return
  45536. }
  45537. delete target[key];
  45538. if (!ob) {
  45539. return
  45540. }
  45541. ob.dep.notify();
  45542. }
  45543. /**
  45544. * Collect dependencies on array elements when the array is touched, since
  45545. * we cannot intercept array element access like property getters.
  45546. */
  45547. function dependArray (value) {
  45548. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  45549. e = value[i];
  45550. e && e.__ob__ && e.__ob__.dep.depend();
  45551. if (Array.isArray(e)) {
  45552. dependArray(e);
  45553. }
  45554. }
  45555. }
  45556. /* */
  45557. /**
  45558. * Option overwriting strategies are functions that handle
  45559. * how to merge a parent option value and a child option
  45560. * value into the final value.
  45561. */
  45562. var strats = config.optionMergeStrategies;
  45563. /**
  45564. * Options with restrictions
  45565. */
  45566. {
  45567. strats.el = strats.propsData = function (parent, child, vm, key) {
  45568. if (!vm) {
  45569. warn(
  45570. "option \"" + key + "\" can only be used during instance " +
  45571. 'creation with the `new` keyword.'
  45572. );
  45573. }
  45574. return defaultStrat(parent, child)
  45575. };
  45576. }
  45577. /**
  45578. * Helper that recursively merges two data objects together.
  45579. */
  45580. function mergeData (to, from) {
  45581. if (!from) { return to }
  45582. var key, toVal, fromVal;
  45583. var keys = hasSymbol
  45584. ? Reflect.ownKeys(from)
  45585. : Object.keys(from);
  45586. for (var i = 0; i < keys.length; i++) {
  45587. key = keys[i];
  45588. // in case the object is already observed...
  45589. if (key === '__ob__') { continue }
  45590. toVal = to[key];
  45591. fromVal = from[key];
  45592. if (!hasOwn(to, key)) {
  45593. set(to, key, fromVal);
  45594. } else if (
  45595. toVal !== fromVal &&
  45596. isPlainObject(toVal) &&
  45597. isPlainObject(fromVal)
  45598. ) {
  45599. mergeData(toVal, fromVal);
  45600. }
  45601. }
  45602. return to
  45603. }
  45604. /**
  45605. * Data
  45606. */
  45607. function mergeDataOrFn (
  45608. parentVal,
  45609. childVal,
  45610. vm
  45611. ) {
  45612. if (!vm) {
  45613. // in a Vue.extend merge, both should be functions
  45614. if (!childVal) {
  45615. return parentVal
  45616. }
  45617. if (!parentVal) {
  45618. return childVal
  45619. }
  45620. // when parentVal & childVal are both present,
  45621. // we need to return a function that returns the
  45622. // merged result of both functions... no need to
  45623. // check if parentVal is a function here because
  45624. // it has to be a function to pass previous merges.
  45625. return function mergedDataFn () {
  45626. return mergeData(
  45627. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  45628. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  45629. )
  45630. }
  45631. } else {
  45632. return function mergedInstanceDataFn () {
  45633. // instance merge
  45634. var instanceData = typeof childVal === 'function'
  45635. ? childVal.call(vm, vm)
  45636. : childVal;
  45637. var defaultData = typeof parentVal === 'function'
  45638. ? parentVal.call(vm, vm)
  45639. : parentVal;
  45640. if (instanceData) {
  45641. return mergeData(instanceData, defaultData)
  45642. } else {
  45643. return defaultData
  45644. }
  45645. }
  45646. }
  45647. }
  45648. strats.data = function (
  45649. parentVal,
  45650. childVal,
  45651. vm
  45652. ) {
  45653. if (!vm) {
  45654. if (childVal && typeof childVal !== 'function') {
  45655. warn(
  45656. 'The "data" option should be a function ' +
  45657. 'that returns a per-instance value in component ' +
  45658. 'definitions.',
  45659. vm
  45660. );
  45661. return parentVal
  45662. }
  45663. return mergeDataOrFn(parentVal, childVal)
  45664. }
  45665. return mergeDataOrFn(parentVal, childVal, vm)
  45666. };
  45667. /**
  45668. * Hooks and props are merged as arrays.
  45669. */
  45670. function mergeHook (
  45671. parentVal,
  45672. childVal
  45673. ) {
  45674. var res = childVal
  45675. ? parentVal
  45676. ? parentVal.concat(childVal)
  45677. : Array.isArray(childVal)
  45678. ? childVal
  45679. : [childVal]
  45680. : parentVal;
  45681. return res
  45682. ? dedupeHooks(res)
  45683. : res
  45684. }
  45685. function dedupeHooks (hooks) {
  45686. var res = [];
  45687. for (var i = 0; i < hooks.length; i++) {
  45688. if (res.indexOf(hooks[i]) === -1) {
  45689. res.push(hooks[i]);
  45690. }
  45691. }
  45692. return res
  45693. }
  45694. LIFECYCLE_HOOKS.forEach(function (hook) {
  45695. strats[hook] = mergeHook;
  45696. });
  45697. /**
  45698. * Assets
  45699. *
  45700. * When a vm is present (instance creation), we need to do
  45701. * a three-way merge between constructor options, instance
  45702. * options and parent options.
  45703. */
  45704. function mergeAssets (
  45705. parentVal,
  45706. childVal,
  45707. vm,
  45708. key
  45709. ) {
  45710. var res = Object.create(parentVal || null);
  45711. if (childVal) {
  45712. assertObjectType(key, childVal, vm);
  45713. return extend(res, childVal)
  45714. } else {
  45715. return res
  45716. }
  45717. }
  45718. ASSET_TYPES.forEach(function (type) {
  45719. strats[type + 's'] = mergeAssets;
  45720. });
  45721. /**
  45722. * Watchers.
  45723. *
  45724. * Watchers hashes should not overwrite one
  45725. * another, so we merge them as arrays.
  45726. */
  45727. strats.watch = function (
  45728. parentVal,
  45729. childVal,
  45730. vm,
  45731. key
  45732. ) {
  45733. // work around Firefox's Object.prototype.watch...
  45734. if (parentVal === nativeWatch) { parentVal = undefined; }
  45735. if (childVal === nativeWatch) { childVal = undefined; }
  45736. /* istanbul ignore if */
  45737. if (!childVal) { return Object.create(parentVal || null) }
  45738. {
  45739. assertObjectType(key, childVal, vm);
  45740. }
  45741. if (!parentVal) { return childVal }
  45742. var ret = {};
  45743. extend(ret, parentVal);
  45744. for (var key$1 in childVal) {
  45745. var parent = ret[key$1];
  45746. var child = childVal[key$1];
  45747. if (parent && !Array.isArray(parent)) {
  45748. parent = [parent];
  45749. }
  45750. ret[key$1] = parent
  45751. ? parent.concat(child)
  45752. : Array.isArray(child) ? child : [child];
  45753. }
  45754. return ret
  45755. };
  45756. /**
  45757. * Other object hashes.
  45758. */
  45759. strats.props =
  45760. strats.methods =
  45761. strats.inject =
  45762. strats.computed = function (
  45763. parentVal,
  45764. childVal,
  45765. vm,
  45766. key
  45767. ) {
  45768. if (childVal && "development" !== 'production') {
  45769. assertObjectType(key, childVal, vm);
  45770. }
  45771. if (!parentVal) { return childVal }
  45772. var ret = Object.create(null);
  45773. extend(ret, parentVal);
  45774. if (childVal) { extend(ret, childVal); }
  45775. return ret
  45776. };
  45777. strats.provide = mergeDataOrFn;
  45778. /**
  45779. * Default strategy.
  45780. */
  45781. var defaultStrat = function (parentVal, childVal) {
  45782. return childVal === undefined
  45783. ? parentVal
  45784. : childVal
  45785. };
  45786. /**
  45787. * Validate component names
  45788. */
  45789. function checkComponents (options) {
  45790. for (var key in options.components) {
  45791. validateComponentName(key);
  45792. }
  45793. }
  45794. function validateComponentName (name) {
  45795. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  45796. warn(
  45797. 'Invalid component name: "' + name + '". Component names ' +
  45798. 'should conform to valid custom element name in html5 specification.'
  45799. );
  45800. }
  45801. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  45802. warn(
  45803. 'Do not use built-in or reserved HTML elements as component ' +
  45804. 'id: ' + name
  45805. );
  45806. }
  45807. }
  45808. /**
  45809. * Ensure all props option syntax are normalized into the
  45810. * Object-based format.
  45811. */
  45812. function normalizeProps (options, vm) {
  45813. var props = options.props;
  45814. if (!props) { return }
  45815. var res = {};
  45816. var i, val, name;
  45817. if (Array.isArray(props)) {
  45818. i = props.length;
  45819. while (i--) {
  45820. val = props[i];
  45821. if (typeof val === 'string') {
  45822. name = camelize(val);
  45823. res[name] = { type: null };
  45824. } else {
  45825. warn('props must be strings when using array syntax.');
  45826. }
  45827. }
  45828. } else if (isPlainObject(props)) {
  45829. for (var key in props) {
  45830. val = props[key];
  45831. name = camelize(key);
  45832. res[name] = isPlainObject(val)
  45833. ? val
  45834. : { type: val };
  45835. }
  45836. } else {
  45837. warn(
  45838. "Invalid value for option \"props\": expected an Array or an Object, " +
  45839. "but got " + (toRawType(props)) + ".",
  45840. vm
  45841. );
  45842. }
  45843. options.props = res;
  45844. }
  45845. /**
  45846. * Normalize all injections into Object-based format
  45847. */
  45848. function normalizeInject (options, vm) {
  45849. var inject = options.inject;
  45850. if (!inject) { return }
  45851. var normalized = options.inject = {};
  45852. if (Array.isArray(inject)) {
  45853. for (var i = 0; i < inject.length; i++) {
  45854. normalized[inject[i]] = { from: inject[i] };
  45855. }
  45856. } else if (isPlainObject(inject)) {
  45857. for (var key in inject) {
  45858. var val = inject[key];
  45859. normalized[key] = isPlainObject(val)
  45860. ? extend({ from: key }, val)
  45861. : { from: val };
  45862. }
  45863. } else {
  45864. warn(
  45865. "Invalid value for option \"inject\": expected an Array or an Object, " +
  45866. "but got " + (toRawType(inject)) + ".",
  45867. vm
  45868. );
  45869. }
  45870. }
  45871. /**
  45872. * Normalize raw function directives into object format.
  45873. */
  45874. function normalizeDirectives (options) {
  45875. var dirs = options.directives;
  45876. if (dirs) {
  45877. for (var key in dirs) {
  45878. var def$$1 = dirs[key];
  45879. if (typeof def$$1 === 'function') {
  45880. dirs[key] = { bind: def$$1, update: def$$1 };
  45881. }
  45882. }
  45883. }
  45884. }
  45885. function assertObjectType (name, value, vm) {
  45886. if (!isPlainObject(value)) {
  45887. warn(
  45888. "Invalid value for option \"" + name + "\": expected an Object, " +
  45889. "but got " + (toRawType(value)) + ".",
  45890. vm
  45891. );
  45892. }
  45893. }
  45894. /**
  45895. * Merge two option objects into a new one.
  45896. * Core utility used in both instantiation and inheritance.
  45897. */
  45898. function mergeOptions (
  45899. parent,
  45900. child,
  45901. vm
  45902. ) {
  45903. {
  45904. checkComponents(child);
  45905. }
  45906. if (typeof child === 'function') {
  45907. child = child.options;
  45908. }
  45909. normalizeProps(child, vm);
  45910. normalizeInject(child, vm);
  45911. normalizeDirectives(child);
  45912. // Apply extends and mixins on the child options,
  45913. // but only if it is a raw options object that isn't
  45914. // the result of another mergeOptions call.
  45915. // Only merged options has the _base property.
  45916. if (!child._base) {
  45917. if (child.extends) {
  45918. parent = mergeOptions(parent, child.extends, vm);
  45919. }
  45920. if (child.mixins) {
  45921. for (var i = 0, l = child.mixins.length; i < l; i++) {
  45922. parent = mergeOptions(parent, child.mixins[i], vm);
  45923. }
  45924. }
  45925. }
  45926. var options = {};
  45927. var key;
  45928. for (key in parent) {
  45929. mergeField(key);
  45930. }
  45931. for (key in child) {
  45932. if (!hasOwn(parent, key)) {
  45933. mergeField(key);
  45934. }
  45935. }
  45936. function mergeField (key) {
  45937. var strat = strats[key] || defaultStrat;
  45938. options[key] = strat(parent[key], child[key], vm, key);
  45939. }
  45940. return options
  45941. }
  45942. /**
  45943. * Resolve an asset.
  45944. * This function is used because child instances need access
  45945. * to assets defined in its ancestor chain.
  45946. */
  45947. function resolveAsset (
  45948. options,
  45949. type,
  45950. id,
  45951. warnMissing
  45952. ) {
  45953. /* istanbul ignore if */
  45954. if (typeof id !== 'string') {
  45955. return
  45956. }
  45957. var assets = options[type];
  45958. // check local registration variations first
  45959. if (hasOwn(assets, id)) { return assets[id] }
  45960. var camelizedId = camelize(id);
  45961. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  45962. var PascalCaseId = capitalize(camelizedId);
  45963. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  45964. // fallback to prototype chain
  45965. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  45966. if (warnMissing && !res) {
  45967. warn(
  45968. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  45969. options
  45970. );
  45971. }
  45972. return res
  45973. }
  45974. /* */
  45975. function validateProp (
  45976. key,
  45977. propOptions,
  45978. propsData,
  45979. vm
  45980. ) {
  45981. var prop = propOptions[key];
  45982. var absent = !hasOwn(propsData, key);
  45983. var value = propsData[key];
  45984. // boolean casting
  45985. var booleanIndex = getTypeIndex(Boolean, prop.type);
  45986. if (booleanIndex > -1) {
  45987. if (absent && !hasOwn(prop, 'default')) {
  45988. value = false;
  45989. } else if (value === '' || value === hyphenate(key)) {
  45990. // only cast empty string / same name to boolean if
  45991. // boolean has higher priority
  45992. var stringIndex = getTypeIndex(String, prop.type);
  45993. if (stringIndex < 0 || booleanIndex < stringIndex) {
  45994. value = true;
  45995. }
  45996. }
  45997. }
  45998. // check default value
  45999. if (value === undefined) {
  46000. value = getPropDefaultValue(vm, prop, key);
  46001. // since the default value is a fresh copy,
  46002. // make sure to observe it.
  46003. var prevShouldObserve = shouldObserve;
  46004. toggleObserving(true);
  46005. observe(value);
  46006. toggleObserving(prevShouldObserve);
  46007. }
  46008. {
  46009. assertProp(prop, key, value, vm, absent);
  46010. }
  46011. return value
  46012. }
  46013. /**
  46014. * Get the default value of a prop.
  46015. */
  46016. function getPropDefaultValue (vm, prop, key) {
  46017. // no default, return undefined
  46018. if (!hasOwn(prop, 'default')) {
  46019. return undefined
  46020. }
  46021. var def = prop.default;
  46022. // warn against non-factory defaults for Object & Array
  46023. if (isObject(def)) {
  46024. warn(
  46025. 'Invalid default value for prop "' + key + '": ' +
  46026. 'Props with type Object/Array must use a factory function ' +
  46027. 'to return the default value.',
  46028. vm
  46029. );
  46030. }
  46031. // the raw prop value was also undefined from previous render,
  46032. // return previous default value to avoid unnecessary watcher trigger
  46033. if (vm && vm.$options.propsData &&
  46034. vm.$options.propsData[key] === undefined &&
  46035. vm._props[key] !== undefined
  46036. ) {
  46037. return vm._props[key]
  46038. }
  46039. // call factory function for non-Function types
  46040. // a value is Function if its prototype is function even across different execution context
  46041. return typeof def === 'function' && getType(prop.type) !== 'Function'
  46042. ? def.call(vm)
  46043. : def
  46044. }
  46045. /**
  46046. * Assert whether a prop is valid.
  46047. */
  46048. function assertProp (
  46049. prop,
  46050. name,
  46051. value,
  46052. vm,
  46053. absent
  46054. ) {
  46055. if (prop.required && absent) {
  46056. warn(
  46057. 'Missing required prop: "' + name + '"',
  46058. vm
  46059. );
  46060. return
  46061. }
  46062. if (value == null && !prop.required) {
  46063. return
  46064. }
  46065. var type = prop.type;
  46066. var valid = !type || type === true;
  46067. var expectedTypes = [];
  46068. if (type) {
  46069. if (!Array.isArray(type)) {
  46070. type = [type];
  46071. }
  46072. for (var i = 0; i < type.length && !valid; i++) {
  46073. var assertedType = assertType(value, type[i]);
  46074. expectedTypes.push(assertedType.expectedType || '');
  46075. valid = assertedType.valid;
  46076. }
  46077. }
  46078. if (!valid) {
  46079. warn(
  46080. getInvalidTypeMessage(name, value, expectedTypes),
  46081. vm
  46082. );
  46083. return
  46084. }
  46085. var validator = prop.validator;
  46086. if (validator) {
  46087. if (!validator(value)) {
  46088. warn(
  46089. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  46090. vm
  46091. );
  46092. }
  46093. }
  46094. }
  46095. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  46096. function assertType (value, type) {
  46097. var valid;
  46098. var expectedType = getType(type);
  46099. if (simpleCheckRE.test(expectedType)) {
  46100. var t = typeof value;
  46101. valid = t === expectedType.toLowerCase();
  46102. // for primitive wrapper objects
  46103. if (!valid && t === 'object') {
  46104. valid = value instanceof type;
  46105. }
  46106. } else if (expectedType === 'Object') {
  46107. valid = isPlainObject(value);
  46108. } else if (expectedType === 'Array') {
  46109. valid = Array.isArray(value);
  46110. } else {
  46111. valid = value instanceof type;
  46112. }
  46113. return {
  46114. valid: valid,
  46115. expectedType: expectedType
  46116. }
  46117. }
  46118. /**
  46119. * Use function string name to check built-in types,
  46120. * because a simple equality check will fail when running
  46121. * across different vms / iframes.
  46122. */
  46123. function getType (fn) {
  46124. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  46125. return match ? match[1] : ''
  46126. }
  46127. function isSameType (a, b) {
  46128. return getType(a) === getType(b)
  46129. }
  46130. function getTypeIndex (type, expectedTypes) {
  46131. if (!Array.isArray(expectedTypes)) {
  46132. return isSameType(expectedTypes, type) ? 0 : -1
  46133. }
  46134. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  46135. if (isSameType(expectedTypes[i], type)) {
  46136. return i
  46137. }
  46138. }
  46139. return -1
  46140. }
  46141. function getInvalidTypeMessage (name, value, expectedTypes) {
  46142. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  46143. " Expected " + (expectedTypes.map(capitalize).join(', '));
  46144. var expectedType = expectedTypes[0];
  46145. var receivedType = toRawType(value);
  46146. var expectedValue = styleValue(value, expectedType);
  46147. var receivedValue = styleValue(value, receivedType);
  46148. // check if we need to specify expected value
  46149. if (expectedTypes.length === 1 &&
  46150. isExplicable(expectedType) &&
  46151. !isBoolean(expectedType, receivedType)) {
  46152. message += " with value " + expectedValue;
  46153. }
  46154. message += ", got " + receivedType + " ";
  46155. // check if we need to specify received value
  46156. if (isExplicable(receivedType)) {
  46157. message += "with value " + receivedValue + ".";
  46158. }
  46159. return message
  46160. }
  46161. function styleValue (value, type) {
  46162. if (type === 'String') {
  46163. return ("\"" + value + "\"")
  46164. } else if (type === 'Number') {
  46165. return ("" + (Number(value)))
  46166. } else {
  46167. return ("" + value)
  46168. }
  46169. }
  46170. function isExplicable (value) {
  46171. var explicitTypes = ['string', 'number', 'boolean'];
  46172. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  46173. }
  46174. function isBoolean () {
  46175. var args = [], len = arguments.length;
  46176. while ( len-- ) args[ len ] = arguments[ len ];
  46177. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  46178. }
  46179. /* */
  46180. function handleError (err, vm, info) {
  46181. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  46182. // See: https://github.com/vuejs/vuex/issues/1505
  46183. pushTarget();
  46184. try {
  46185. if (vm) {
  46186. var cur = vm;
  46187. while ((cur = cur.$parent)) {
  46188. var hooks = cur.$options.errorCaptured;
  46189. if (hooks) {
  46190. for (var i = 0; i < hooks.length; i++) {
  46191. try {
  46192. var capture = hooks[i].call(cur, err, vm, info) === false;
  46193. if (capture) { return }
  46194. } catch (e) {
  46195. globalHandleError(e, cur, 'errorCaptured hook');
  46196. }
  46197. }
  46198. }
  46199. }
  46200. }
  46201. globalHandleError(err, vm, info);
  46202. } finally {
  46203. popTarget();
  46204. }
  46205. }
  46206. function invokeWithErrorHandling (
  46207. handler,
  46208. context,
  46209. args,
  46210. vm,
  46211. info
  46212. ) {
  46213. var res;
  46214. try {
  46215. res = args ? handler.apply(context, args) : handler.call(context);
  46216. if (res && !res._isVue && isPromise(res) && !res._handled) {
  46217. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  46218. // issue #9511
  46219. // avoid catch triggering multiple times when nested calls
  46220. res._handled = true;
  46221. }
  46222. } catch (e) {
  46223. handleError(e, vm, info);
  46224. }
  46225. return res
  46226. }
  46227. function globalHandleError (err, vm, info) {
  46228. if (config.errorHandler) {
  46229. try {
  46230. return config.errorHandler.call(null, err, vm, info)
  46231. } catch (e) {
  46232. // if the user intentionally throws the original error in the handler,
  46233. // do not log it twice
  46234. if (e !== err) {
  46235. logError(e, null, 'config.errorHandler');
  46236. }
  46237. }
  46238. }
  46239. logError(err, vm, info);
  46240. }
  46241. function logError (err, vm, info) {
  46242. {
  46243. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  46244. }
  46245. /* istanbul ignore else */
  46246. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  46247. console.error(err);
  46248. } else {
  46249. throw err
  46250. }
  46251. }
  46252. /* */
  46253. var isUsingMicroTask = false;
  46254. var callbacks = [];
  46255. var pending = false;
  46256. function flushCallbacks () {
  46257. pending = false;
  46258. var copies = callbacks.slice(0);
  46259. callbacks.length = 0;
  46260. for (var i = 0; i < copies.length; i++) {
  46261. copies[i]();
  46262. }
  46263. }
  46264. // Here we have async deferring wrappers using microtasks.
  46265. // In 2.5 we used (macro) tasks (in combination with microtasks).
  46266. // However, it has subtle problems when state is changed right before repaint
  46267. // (e.g. #6813, out-in transitions).
  46268. // Also, using (macro) tasks in event handler would cause some weird behaviors
  46269. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  46270. // So we now use microtasks everywhere, again.
  46271. // A major drawback of this tradeoff is that there are some scenarios
  46272. // where microtasks have too high a priority and fire in between supposedly
  46273. // sequential events (e.g. #4521, #6690, which have workarounds)
  46274. // or even between bubbling of the same event (#6566).
  46275. var timerFunc;
  46276. // The nextTick behavior leverages the microtask queue, which can be accessed
  46277. // via either native Promise.then or MutationObserver.
  46278. // MutationObserver has wider support, however it is seriously bugged in
  46279. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  46280. // completely stops working after triggering a few times... so, if native
  46281. // Promise is available, we will use it:
  46282. /* istanbul ignore next, $flow-disable-line */
  46283. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  46284. var p = Promise.resolve();
  46285. timerFunc = function () {
  46286. p.then(flushCallbacks);
  46287. // In problematic UIWebViews, Promise.then doesn't completely break, but
  46288. // it can get stuck in a weird state where callbacks are pushed into the
  46289. // microtask queue but the queue isn't being flushed, until the browser
  46290. // needs to do some other work, e.g. handle a timer. Therefore we can
  46291. // "force" the microtask queue to be flushed by adding an empty timer.
  46292. if (isIOS) { setTimeout(noop); }
  46293. };
  46294. isUsingMicroTask = true;
  46295. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  46296. isNative(MutationObserver) ||
  46297. // PhantomJS and iOS 7.x
  46298. MutationObserver.toString() === '[object MutationObserverConstructor]'
  46299. )) {
  46300. // Use MutationObserver where native Promise is not available,
  46301. // e.g. PhantomJS, iOS7, Android 4.4
  46302. // (#6466 MutationObserver is unreliable in IE11)
  46303. var counter = 1;
  46304. var observer = new MutationObserver(flushCallbacks);
  46305. var textNode = document.createTextNode(String(counter));
  46306. observer.observe(textNode, {
  46307. characterData: true
  46308. });
  46309. timerFunc = function () {
  46310. counter = (counter + 1) % 2;
  46311. textNode.data = String(counter);
  46312. };
  46313. isUsingMicroTask = true;
  46314. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  46315. // Fallback to setImmediate.
  46316. // Technically it leverages the (macro) task queue,
  46317. // but it is still a better choice than setTimeout.
  46318. timerFunc = function () {
  46319. setImmediate(flushCallbacks);
  46320. };
  46321. } else {
  46322. // Fallback to setTimeout.
  46323. timerFunc = function () {
  46324. setTimeout(flushCallbacks, 0);
  46325. };
  46326. }
  46327. function nextTick (cb, ctx) {
  46328. var _resolve;
  46329. callbacks.push(function () {
  46330. if (cb) {
  46331. try {
  46332. cb.call(ctx);
  46333. } catch (e) {
  46334. handleError(e, ctx, 'nextTick');
  46335. }
  46336. } else if (_resolve) {
  46337. _resolve(ctx);
  46338. }
  46339. });
  46340. if (!pending) {
  46341. pending = true;
  46342. timerFunc();
  46343. }
  46344. // $flow-disable-line
  46345. if (!cb && typeof Promise !== 'undefined') {
  46346. return new Promise(function (resolve) {
  46347. _resolve = resolve;
  46348. })
  46349. }
  46350. }
  46351. /* */
  46352. var mark;
  46353. var measure;
  46354. {
  46355. var perf = inBrowser && window.performance;
  46356. /* istanbul ignore if */
  46357. if (
  46358. perf &&
  46359. perf.mark &&
  46360. perf.measure &&
  46361. perf.clearMarks &&
  46362. perf.clearMeasures
  46363. ) {
  46364. mark = function (tag) { return perf.mark(tag); };
  46365. measure = function (name, startTag, endTag) {
  46366. perf.measure(name, startTag, endTag);
  46367. perf.clearMarks(startTag);
  46368. perf.clearMarks(endTag);
  46369. // perf.clearMeasures(name)
  46370. };
  46371. }
  46372. }
  46373. /* not type checking this file because flow doesn't play well with Proxy */
  46374. var initProxy;
  46375. {
  46376. var allowedGlobals = makeMap(
  46377. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  46378. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  46379. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  46380. 'require' // for Webpack/Browserify
  46381. );
  46382. var warnNonPresent = function (target, key) {
  46383. warn(
  46384. "Property or method \"" + key + "\" is not defined on the instance but " +
  46385. 'referenced during render. Make sure that this property is reactive, ' +
  46386. 'either in the data option, or for class-based components, by ' +
  46387. 'initializing the property. ' +
  46388. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  46389. target
  46390. );
  46391. };
  46392. var warnReservedPrefix = function (target, key) {
  46393. warn(
  46394. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  46395. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  46396. 'prevent conflicts with Vue internals. ' +
  46397. 'See: https://vuejs.org/v2/api/#data',
  46398. target
  46399. );
  46400. };
  46401. var hasProxy =
  46402. typeof Proxy !== 'undefined' && isNative(Proxy);
  46403. if (hasProxy) {
  46404. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  46405. config.keyCodes = new Proxy(config.keyCodes, {
  46406. set: function set (target, key, value) {
  46407. if (isBuiltInModifier(key)) {
  46408. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  46409. return false
  46410. } else {
  46411. target[key] = value;
  46412. return true
  46413. }
  46414. }
  46415. });
  46416. }
  46417. var hasHandler = {
  46418. has: function has (target, key) {
  46419. var has = key in target;
  46420. var isAllowed = allowedGlobals(key) ||
  46421. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  46422. if (!has && !isAllowed) {
  46423. if (key in target.$data) { warnReservedPrefix(target, key); }
  46424. else { warnNonPresent(target, key); }
  46425. }
  46426. return has || !isAllowed
  46427. }
  46428. };
  46429. var getHandler = {
  46430. get: function get (target, key) {
  46431. if (typeof key === 'string' && !(key in target)) {
  46432. if (key in target.$data) { warnReservedPrefix(target, key); }
  46433. else { warnNonPresent(target, key); }
  46434. }
  46435. return target[key]
  46436. }
  46437. };
  46438. initProxy = function initProxy (vm) {
  46439. if (hasProxy) {
  46440. // determine which proxy handler to use
  46441. var options = vm.$options;
  46442. var handlers = options.render && options.render._withStripped
  46443. ? getHandler
  46444. : hasHandler;
  46445. vm._renderProxy = new Proxy(vm, handlers);
  46446. } else {
  46447. vm._renderProxy = vm;
  46448. }
  46449. };
  46450. }
  46451. /* */
  46452. var seenObjects = new _Set();
  46453. /**
  46454. * Recursively traverse an object to evoke all converted
  46455. * getters, so that every nested property inside the object
  46456. * is collected as a "deep" dependency.
  46457. */
  46458. function traverse (val) {
  46459. _traverse(val, seenObjects);
  46460. seenObjects.clear();
  46461. }
  46462. function _traverse (val, seen) {
  46463. var i, keys;
  46464. var isA = Array.isArray(val);
  46465. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  46466. return
  46467. }
  46468. if (val.__ob__) {
  46469. var depId = val.__ob__.dep.id;
  46470. if (seen.has(depId)) {
  46471. return
  46472. }
  46473. seen.add(depId);
  46474. }
  46475. if (isA) {
  46476. i = val.length;
  46477. while (i--) { _traverse(val[i], seen); }
  46478. } else {
  46479. keys = Object.keys(val);
  46480. i = keys.length;
  46481. while (i--) { _traverse(val[keys[i]], seen); }
  46482. }
  46483. }
  46484. /* */
  46485. var normalizeEvent = cached(function (name) {
  46486. var passive = name.charAt(0) === '&';
  46487. name = passive ? name.slice(1) : name;
  46488. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  46489. name = once$$1 ? name.slice(1) : name;
  46490. var capture = name.charAt(0) === '!';
  46491. name = capture ? name.slice(1) : name;
  46492. return {
  46493. name: name,
  46494. once: once$$1,
  46495. capture: capture,
  46496. passive: passive
  46497. }
  46498. });
  46499. function createFnInvoker (fns, vm) {
  46500. function invoker () {
  46501. var arguments$1 = arguments;
  46502. var fns = invoker.fns;
  46503. if (Array.isArray(fns)) {
  46504. var cloned = fns.slice();
  46505. for (var i = 0; i < cloned.length; i++) {
  46506. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  46507. }
  46508. } else {
  46509. // return handler return value for single handlers
  46510. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  46511. }
  46512. }
  46513. invoker.fns = fns;
  46514. return invoker
  46515. }
  46516. function updateListeners (
  46517. on,
  46518. oldOn,
  46519. add,
  46520. remove$$1,
  46521. createOnceHandler,
  46522. vm
  46523. ) {
  46524. var name, def$$1, cur, old, event;
  46525. for (name in on) {
  46526. def$$1 = cur = on[name];
  46527. old = oldOn[name];
  46528. event = normalizeEvent(name);
  46529. if (isUndef(cur)) {
  46530. warn(
  46531. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  46532. vm
  46533. );
  46534. } else if (isUndef(old)) {
  46535. if (isUndef(cur.fns)) {
  46536. cur = on[name] = createFnInvoker(cur, vm);
  46537. }
  46538. if (isTrue(event.once)) {
  46539. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  46540. }
  46541. add(event.name, cur, event.capture, event.passive, event.params);
  46542. } else if (cur !== old) {
  46543. old.fns = cur;
  46544. on[name] = old;
  46545. }
  46546. }
  46547. for (name in oldOn) {
  46548. if (isUndef(on[name])) {
  46549. event = normalizeEvent(name);
  46550. remove$$1(event.name, oldOn[name], event.capture);
  46551. }
  46552. }
  46553. }
  46554. /* */
  46555. function mergeVNodeHook (def, hookKey, hook) {
  46556. if (def instanceof VNode) {
  46557. def = def.data.hook || (def.data.hook = {});
  46558. }
  46559. var invoker;
  46560. var oldHook = def[hookKey];
  46561. function wrappedHook () {
  46562. hook.apply(this, arguments);
  46563. // important: remove merged hook to ensure it's called only once
  46564. // and prevent memory leak
  46565. remove(invoker.fns, wrappedHook);
  46566. }
  46567. if (isUndef(oldHook)) {
  46568. // no existing hook
  46569. invoker = createFnInvoker([wrappedHook]);
  46570. } else {
  46571. /* istanbul ignore if */
  46572. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  46573. // already a merged invoker
  46574. invoker = oldHook;
  46575. invoker.fns.push(wrappedHook);
  46576. } else {
  46577. // existing plain hook
  46578. invoker = createFnInvoker([oldHook, wrappedHook]);
  46579. }
  46580. }
  46581. invoker.merged = true;
  46582. def[hookKey] = invoker;
  46583. }
  46584. /* */
  46585. function extractPropsFromVNodeData (
  46586. data,
  46587. Ctor,
  46588. tag
  46589. ) {
  46590. // we are only extracting raw values here.
  46591. // validation and default values are handled in the child
  46592. // component itself.
  46593. var propOptions = Ctor.options.props;
  46594. if (isUndef(propOptions)) {
  46595. return
  46596. }
  46597. var res = {};
  46598. var attrs = data.attrs;
  46599. var props = data.props;
  46600. if (isDef(attrs) || isDef(props)) {
  46601. for (var key in propOptions) {
  46602. var altKey = hyphenate(key);
  46603. {
  46604. var keyInLowerCase = key.toLowerCase();
  46605. if (
  46606. key !== keyInLowerCase &&
  46607. attrs && hasOwn(attrs, keyInLowerCase)
  46608. ) {
  46609. tip(
  46610. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  46611. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  46612. " \"" + key + "\". " +
  46613. "Note that HTML attributes are case-insensitive and camelCased " +
  46614. "props need to use their kebab-case equivalents when using in-DOM " +
  46615. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  46616. );
  46617. }
  46618. }
  46619. checkProp(res, props, key, altKey, true) ||
  46620. checkProp(res, attrs, key, altKey, false);
  46621. }
  46622. }
  46623. return res
  46624. }
  46625. function checkProp (
  46626. res,
  46627. hash,
  46628. key,
  46629. altKey,
  46630. preserve
  46631. ) {
  46632. if (isDef(hash)) {
  46633. if (hasOwn(hash, key)) {
  46634. res[key] = hash[key];
  46635. if (!preserve) {
  46636. delete hash[key];
  46637. }
  46638. return true
  46639. } else if (hasOwn(hash, altKey)) {
  46640. res[key] = hash[altKey];
  46641. if (!preserve) {
  46642. delete hash[altKey];
  46643. }
  46644. return true
  46645. }
  46646. }
  46647. return false
  46648. }
  46649. /* */
  46650. // The template compiler attempts to minimize the need for normalization by
  46651. // statically analyzing the template at compile time.
  46652. //
  46653. // For plain HTML markup, normalization can be completely skipped because the
  46654. // generated render function is guaranteed to return Array<VNode>. There are
  46655. // two cases where extra normalization is needed:
  46656. // 1. When the children contains components - because a functional component
  46657. // may return an Array instead of a single root. In this case, just a simple
  46658. // normalization is needed - if any child is an Array, we flatten the whole
  46659. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  46660. // because functional components already normalize their own children.
  46661. function simpleNormalizeChildren (children) {
  46662. for (var i = 0; i < children.length; i++) {
  46663. if (Array.isArray(children[i])) {
  46664. return Array.prototype.concat.apply([], children)
  46665. }
  46666. }
  46667. return children
  46668. }
  46669. // 2. When the children contains constructs that always generated nested Arrays,
  46670. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  46671. // with hand-written render functions / JSX. In such cases a full normalization
  46672. // is needed to cater to all possible types of children values.
  46673. function normalizeChildren (children) {
  46674. return isPrimitive(children)
  46675. ? [createTextVNode(children)]
  46676. : Array.isArray(children)
  46677. ? normalizeArrayChildren(children)
  46678. : undefined
  46679. }
  46680. function isTextNode (node) {
  46681. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  46682. }
  46683. function normalizeArrayChildren (children, nestedIndex) {
  46684. var res = [];
  46685. var i, c, lastIndex, last;
  46686. for (i = 0; i < children.length; i++) {
  46687. c = children[i];
  46688. if (isUndef(c) || typeof c === 'boolean') { continue }
  46689. lastIndex = res.length - 1;
  46690. last = res[lastIndex];
  46691. // nested
  46692. if (Array.isArray(c)) {
  46693. if (c.length > 0) {
  46694. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  46695. // merge adjacent text nodes
  46696. if (isTextNode(c[0]) && isTextNode(last)) {
  46697. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  46698. c.shift();
  46699. }
  46700. res.push.apply(res, c);
  46701. }
  46702. } else if (isPrimitive(c)) {
  46703. if (isTextNode(last)) {
  46704. // merge adjacent text nodes
  46705. // this is necessary for SSR hydration because text nodes are
  46706. // essentially merged when rendered to HTML strings
  46707. res[lastIndex] = createTextVNode(last.text + c);
  46708. } else if (c !== '') {
  46709. // convert primitive to vnode
  46710. res.push(createTextVNode(c));
  46711. }
  46712. } else {
  46713. if (isTextNode(c) && isTextNode(last)) {
  46714. // merge adjacent text nodes
  46715. res[lastIndex] = createTextVNode(last.text + c.text);
  46716. } else {
  46717. // default key for nested array children (likely generated by v-for)
  46718. if (isTrue(children._isVList) &&
  46719. isDef(c.tag) &&
  46720. isUndef(c.key) &&
  46721. isDef(nestedIndex)) {
  46722. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  46723. }
  46724. res.push(c);
  46725. }
  46726. }
  46727. }
  46728. return res
  46729. }
  46730. /* */
  46731. function initProvide (vm) {
  46732. var provide = vm.$options.provide;
  46733. if (provide) {
  46734. vm._provided = typeof provide === 'function'
  46735. ? provide.call(vm)
  46736. : provide;
  46737. }
  46738. }
  46739. function initInjections (vm) {
  46740. var result = resolveInject(vm.$options.inject, vm);
  46741. if (result) {
  46742. toggleObserving(false);
  46743. Object.keys(result).forEach(function (key) {
  46744. /* istanbul ignore else */
  46745. {
  46746. defineReactive$$1(vm, key, result[key], function () {
  46747. warn(
  46748. "Avoid mutating an injected value directly since the changes will be " +
  46749. "overwritten whenever the provided component re-renders. " +
  46750. "injection being mutated: \"" + key + "\"",
  46751. vm
  46752. );
  46753. });
  46754. }
  46755. });
  46756. toggleObserving(true);
  46757. }
  46758. }
  46759. function resolveInject (inject, vm) {
  46760. if (inject) {
  46761. // inject is :any because flow is not smart enough to figure out cached
  46762. var result = Object.create(null);
  46763. var keys = hasSymbol
  46764. ? Reflect.ownKeys(inject)
  46765. : Object.keys(inject);
  46766. for (var i = 0; i < keys.length; i++) {
  46767. var key = keys[i];
  46768. // #6574 in case the inject object is observed...
  46769. if (key === '__ob__') { continue }
  46770. var provideKey = inject[key].from;
  46771. var source = vm;
  46772. while (source) {
  46773. if (source._provided && hasOwn(source._provided, provideKey)) {
  46774. result[key] = source._provided[provideKey];
  46775. break
  46776. }
  46777. source = source.$parent;
  46778. }
  46779. if (!source) {
  46780. if ('default' in inject[key]) {
  46781. var provideDefault = inject[key].default;
  46782. result[key] = typeof provideDefault === 'function'
  46783. ? provideDefault.call(vm)
  46784. : provideDefault;
  46785. } else {
  46786. warn(("Injection \"" + key + "\" not found"), vm);
  46787. }
  46788. }
  46789. }
  46790. return result
  46791. }
  46792. }
  46793. /* */
  46794. /**
  46795. * Runtime helper for resolving raw children VNodes into a slot object.
  46796. */
  46797. function resolveSlots (
  46798. children,
  46799. context
  46800. ) {
  46801. if (!children || !children.length) {
  46802. return {}
  46803. }
  46804. var slots = {};
  46805. for (var i = 0, l = children.length; i < l; i++) {
  46806. var child = children[i];
  46807. var data = child.data;
  46808. // remove slot attribute if the node is resolved as a Vue slot node
  46809. if (data && data.attrs && data.attrs.slot) {
  46810. delete data.attrs.slot;
  46811. }
  46812. // named slots should only be respected if the vnode was rendered in the
  46813. // same context.
  46814. if ((child.context === context || child.fnContext === context) &&
  46815. data && data.slot != null
  46816. ) {
  46817. var name = data.slot;
  46818. var slot = (slots[name] || (slots[name] = []));
  46819. if (child.tag === 'template') {
  46820. slot.push.apply(slot, child.children || []);
  46821. } else {
  46822. slot.push(child);
  46823. }
  46824. } else {
  46825. (slots.default || (slots.default = [])).push(child);
  46826. }
  46827. }
  46828. // ignore slots that contains only whitespace
  46829. for (var name$1 in slots) {
  46830. if (slots[name$1].every(isWhitespace)) {
  46831. delete slots[name$1];
  46832. }
  46833. }
  46834. return slots
  46835. }
  46836. function isWhitespace (node) {
  46837. return (node.isComment && !node.asyncFactory) || node.text === ' '
  46838. }
  46839. /* */
  46840. function normalizeScopedSlots (
  46841. slots,
  46842. normalSlots,
  46843. prevSlots
  46844. ) {
  46845. var res;
  46846. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  46847. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  46848. var key = slots && slots.$key;
  46849. if (!slots) {
  46850. res = {};
  46851. } else if (slots._normalized) {
  46852. // fast path 1: child component re-render only, parent did not change
  46853. return slots._normalized
  46854. } else if (
  46855. isStable &&
  46856. prevSlots &&
  46857. prevSlots !== emptyObject &&
  46858. key === prevSlots.$key &&
  46859. !hasNormalSlots &&
  46860. !prevSlots.$hasNormal
  46861. ) {
  46862. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  46863. // only need to normalize once
  46864. return prevSlots
  46865. } else {
  46866. res = {};
  46867. for (var key$1 in slots) {
  46868. if (slots[key$1] && key$1[0] !== '$') {
  46869. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  46870. }
  46871. }
  46872. }
  46873. // expose normal slots on scopedSlots
  46874. for (var key$2 in normalSlots) {
  46875. if (!(key$2 in res)) {
  46876. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  46877. }
  46878. }
  46879. // avoriaz seems to mock a non-extensible $scopedSlots object
  46880. // and when that is passed down this would cause an error
  46881. if (slots && Object.isExtensible(slots)) {
  46882. (slots)._normalized = res;
  46883. }
  46884. def(res, '$stable', isStable);
  46885. def(res, '$key', key);
  46886. def(res, '$hasNormal', hasNormalSlots);
  46887. return res
  46888. }
  46889. function normalizeScopedSlot(normalSlots, key, fn) {
  46890. var normalized = function () {
  46891. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  46892. res = res && typeof res === 'object' && !Array.isArray(res)
  46893. ? [res] // single vnode
  46894. : normalizeChildren(res);
  46895. return res && (
  46896. res.length === 0 ||
  46897. (res.length === 1 && res[0].isComment) // #9658
  46898. ) ? undefined
  46899. : res
  46900. };
  46901. // this is a slot using the new v-slot syntax without scope. although it is
  46902. // compiled as a scoped slot, render fn users would expect it to be present
  46903. // on this.$slots because the usage is semantically a normal slot.
  46904. if (fn.proxy) {
  46905. Object.defineProperty(normalSlots, key, {
  46906. get: normalized,
  46907. enumerable: true,
  46908. configurable: true
  46909. });
  46910. }
  46911. return normalized
  46912. }
  46913. function proxyNormalSlot(slots, key) {
  46914. return function () { return slots[key]; }
  46915. }
  46916. /* */
  46917. /**
  46918. * Runtime helper for rendering v-for lists.
  46919. */
  46920. function renderList (
  46921. val,
  46922. render
  46923. ) {
  46924. var ret, i, l, keys, key;
  46925. if (Array.isArray(val) || typeof val === 'string') {
  46926. ret = new Array(val.length);
  46927. for (i = 0, l = val.length; i < l; i++) {
  46928. ret[i] = render(val[i], i);
  46929. }
  46930. } else if (typeof val === 'number') {
  46931. ret = new Array(val);
  46932. for (i = 0; i < val; i++) {
  46933. ret[i] = render(i + 1, i);
  46934. }
  46935. } else if (isObject(val)) {
  46936. if (hasSymbol && val[Symbol.iterator]) {
  46937. ret = [];
  46938. var iterator = val[Symbol.iterator]();
  46939. var result = iterator.next();
  46940. while (!result.done) {
  46941. ret.push(render(result.value, ret.length));
  46942. result = iterator.next();
  46943. }
  46944. } else {
  46945. keys = Object.keys(val);
  46946. ret = new Array(keys.length);
  46947. for (i = 0, l = keys.length; i < l; i++) {
  46948. key = keys[i];
  46949. ret[i] = render(val[key], key, i);
  46950. }
  46951. }
  46952. }
  46953. if (!isDef(ret)) {
  46954. ret = [];
  46955. }
  46956. (ret)._isVList = true;
  46957. return ret
  46958. }
  46959. /* */
  46960. /**
  46961. * Runtime helper for rendering <slot>
  46962. */
  46963. function renderSlot (
  46964. name,
  46965. fallback,
  46966. props,
  46967. bindObject
  46968. ) {
  46969. var scopedSlotFn = this.$scopedSlots[name];
  46970. var nodes;
  46971. if (scopedSlotFn) { // scoped slot
  46972. props = props || {};
  46973. if (bindObject) {
  46974. if (!isObject(bindObject)) {
  46975. warn(
  46976. 'slot v-bind without argument expects an Object',
  46977. this
  46978. );
  46979. }
  46980. props = extend(extend({}, bindObject), props);
  46981. }
  46982. nodes = scopedSlotFn(props) || fallback;
  46983. } else {
  46984. nodes = this.$slots[name] || fallback;
  46985. }
  46986. var target = props && props.slot;
  46987. if (target) {
  46988. return this.$createElement('template', { slot: target }, nodes)
  46989. } else {
  46990. return nodes
  46991. }
  46992. }
  46993. /* */
  46994. /**
  46995. * Runtime helper for resolving filters
  46996. */
  46997. function resolveFilter (id) {
  46998. return resolveAsset(this.$options, 'filters', id, true) || identity
  46999. }
  47000. /* */
  47001. function isKeyNotMatch (expect, actual) {
  47002. if (Array.isArray(expect)) {
  47003. return expect.indexOf(actual) === -1
  47004. } else {
  47005. return expect !== actual
  47006. }
  47007. }
  47008. /**
  47009. * Runtime helper for checking keyCodes from config.
  47010. * exposed as Vue.prototype._k
  47011. * passing in eventKeyName as last argument separately for backwards compat
  47012. */
  47013. function checkKeyCodes (
  47014. eventKeyCode,
  47015. key,
  47016. builtInKeyCode,
  47017. eventKeyName,
  47018. builtInKeyName
  47019. ) {
  47020. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  47021. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  47022. return isKeyNotMatch(builtInKeyName, eventKeyName)
  47023. } else if (mappedKeyCode) {
  47024. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  47025. } else if (eventKeyName) {
  47026. return hyphenate(eventKeyName) !== key
  47027. }
  47028. }
  47029. /* */
  47030. /**
  47031. * Runtime helper for merging v-bind="object" into a VNode's data.
  47032. */
  47033. function bindObjectProps (
  47034. data,
  47035. tag,
  47036. value,
  47037. asProp,
  47038. isSync
  47039. ) {
  47040. if (value) {
  47041. if (!isObject(value)) {
  47042. warn(
  47043. 'v-bind without argument expects an Object or Array value',
  47044. this
  47045. );
  47046. } else {
  47047. if (Array.isArray(value)) {
  47048. value = toObject(value);
  47049. }
  47050. var hash;
  47051. var loop = function ( key ) {
  47052. if (
  47053. key === 'class' ||
  47054. key === 'style' ||
  47055. isReservedAttribute(key)
  47056. ) {
  47057. hash = data;
  47058. } else {
  47059. var type = data.attrs && data.attrs.type;
  47060. hash = asProp || config.mustUseProp(tag, type, key)
  47061. ? data.domProps || (data.domProps = {})
  47062. : data.attrs || (data.attrs = {});
  47063. }
  47064. var camelizedKey = camelize(key);
  47065. var hyphenatedKey = hyphenate(key);
  47066. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  47067. hash[key] = value[key];
  47068. if (isSync) {
  47069. var on = data.on || (data.on = {});
  47070. on[("update:" + key)] = function ($event) {
  47071. value[key] = $event;
  47072. };
  47073. }
  47074. }
  47075. };
  47076. for (var key in value) loop( key );
  47077. }
  47078. }
  47079. return data
  47080. }
  47081. /* */
  47082. /**
  47083. * Runtime helper for rendering static trees.
  47084. */
  47085. function renderStatic (
  47086. index,
  47087. isInFor
  47088. ) {
  47089. var cached = this._staticTrees || (this._staticTrees = []);
  47090. var tree = cached[index];
  47091. // if has already-rendered static tree and not inside v-for,
  47092. // we can reuse the same tree.
  47093. if (tree && !isInFor) {
  47094. return tree
  47095. }
  47096. // otherwise, render a fresh tree.
  47097. tree = cached[index] = this.$options.staticRenderFns[index].call(
  47098. this._renderProxy,
  47099. null,
  47100. this // for render fns generated for functional component templates
  47101. );
  47102. markStatic(tree, ("__static__" + index), false);
  47103. return tree
  47104. }
  47105. /**
  47106. * Runtime helper for v-once.
  47107. * Effectively it means marking the node as static with a unique key.
  47108. */
  47109. function markOnce (
  47110. tree,
  47111. index,
  47112. key
  47113. ) {
  47114. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  47115. return tree
  47116. }
  47117. function markStatic (
  47118. tree,
  47119. key,
  47120. isOnce
  47121. ) {
  47122. if (Array.isArray(tree)) {
  47123. for (var i = 0; i < tree.length; i++) {
  47124. if (tree[i] && typeof tree[i] !== 'string') {
  47125. markStaticNode(tree[i], (key + "_" + i), isOnce);
  47126. }
  47127. }
  47128. } else {
  47129. markStaticNode(tree, key, isOnce);
  47130. }
  47131. }
  47132. function markStaticNode (node, key, isOnce) {
  47133. node.isStatic = true;
  47134. node.key = key;
  47135. node.isOnce = isOnce;
  47136. }
  47137. /* */
  47138. function bindObjectListeners (data, value) {
  47139. if (value) {
  47140. if (!isPlainObject(value)) {
  47141. warn(
  47142. 'v-on without argument expects an Object value',
  47143. this
  47144. );
  47145. } else {
  47146. var on = data.on = data.on ? extend({}, data.on) : {};
  47147. for (var key in value) {
  47148. var existing = on[key];
  47149. var ours = value[key];
  47150. on[key] = existing ? [].concat(existing, ours) : ours;
  47151. }
  47152. }
  47153. }
  47154. return data
  47155. }
  47156. /* */
  47157. function resolveScopedSlots (
  47158. fns, // see flow/vnode
  47159. res,
  47160. // the following are added in 2.6
  47161. hasDynamicKeys,
  47162. contentHashKey
  47163. ) {
  47164. res = res || { $stable: !hasDynamicKeys };
  47165. for (var i = 0; i < fns.length; i++) {
  47166. var slot = fns[i];
  47167. if (Array.isArray(slot)) {
  47168. resolveScopedSlots(slot, res, hasDynamicKeys);
  47169. } else if (slot) {
  47170. // marker for reverse proxying v-slot without scope on this.$slots
  47171. if (slot.proxy) {
  47172. slot.fn.proxy = true;
  47173. }
  47174. res[slot.key] = slot.fn;
  47175. }
  47176. }
  47177. if (contentHashKey) {
  47178. (res).$key = contentHashKey;
  47179. }
  47180. return res
  47181. }
  47182. /* */
  47183. function bindDynamicKeys (baseObj, values) {
  47184. for (var i = 0; i < values.length; i += 2) {
  47185. var key = values[i];
  47186. if (typeof key === 'string' && key) {
  47187. baseObj[values[i]] = values[i + 1];
  47188. } else if (key !== '' && key !== null) {
  47189. // null is a special value for explicitly removing a binding
  47190. warn(
  47191. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  47192. this
  47193. );
  47194. }
  47195. }
  47196. return baseObj
  47197. }
  47198. // helper to dynamically append modifier runtime markers to event names.
  47199. // ensure only append when value is already string, otherwise it will be cast
  47200. // to string and cause the type check to miss.
  47201. function prependModifier (value, symbol) {
  47202. return typeof value === 'string' ? symbol + value : value
  47203. }
  47204. /* */
  47205. function installRenderHelpers (target) {
  47206. target._o = markOnce;
  47207. target._n = toNumber;
  47208. target._s = toString;
  47209. target._l = renderList;
  47210. target._t = renderSlot;
  47211. target._q = looseEqual;
  47212. target._i = looseIndexOf;
  47213. target._m = renderStatic;
  47214. target._f = resolveFilter;
  47215. target._k = checkKeyCodes;
  47216. target._b = bindObjectProps;
  47217. target._v = createTextVNode;
  47218. target._e = createEmptyVNode;
  47219. target._u = resolveScopedSlots;
  47220. target._g = bindObjectListeners;
  47221. target._d = bindDynamicKeys;
  47222. target._p = prependModifier;
  47223. }
  47224. /* */
  47225. function FunctionalRenderContext (
  47226. data,
  47227. props,
  47228. children,
  47229. parent,
  47230. Ctor
  47231. ) {
  47232. var this$1 = this;
  47233. var options = Ctor.options;
  47234. // ensure the createElement function in functional components
  47235. // gets a unique context - this is necessary for correct named slot check
  47236. var contextVm;
  47237. if (hasOwn(parent, '_uid')) {
  47238. contextVm = Object.create(parent);
  47239. // $flow-disable-line
  47240. contextVm._original = parent;
  47241. } else {
  47242. // the context vm passed in is a functional context as well.
  47243. // in this case we want to make sure we are able to get a hold to the
  47244. // real context instance.
  47245. contextVm = parent;
  47246. // $flow-disable-line
  47247. parent = parent._original;
  47248. }
  47249. var isCompiled = isTrue(options._compiled);
  47250. var needNormalization = !isCompiled;
  47251. this.data = data;
  47252. this.props = props;
  47253. this.children = children;
  47254. this.parent = parent;
  47255. this.listeners = data.on || emptyObject;
  47256. this.injections = resolveInject(options.inject, parent);
  47257. this.slots = function () {
  47258. if (!this$1.$slots) {
  47259. normalizeScopedSlots(
  47260. data.scopedSlots,
  47261. this$1.$slots = resolveSlots(children, parent)
  47262. );
  47263. }
  47264. return this$1.$slots
  47265. };
  47266. Object.defineProperty(this, 'scopedSlots', ({
  47267. enumerable: true,
  47268. get: function get () {
  47269. return normalizeScopedSlots(data.scopedSlots, this.slots())
  47270. }
  47271. }));
  47272. // support for compiled functional template
  47273. if (isCompiled) {
  47274. // exposing $options for renderStatic()
  47275. this.$options = options;
  47276. // pre-resolve slots for renderSlot()
  47277. this.$slots = this.slots();
  47278. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  47279. }
  47280. if (options._scopeId) {
  47281. this._c = function (a, b, c, d) {
  47282. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  47283. if (vnode && !Array.isArray(vnode)) {
  47284. vnode.fnScopeId = options._scopeId;
  47285. vnode.fnContext = parent;
  47286. }
  47287. return vnode
  47288. };
  47289. } else {
  47290. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  47291. }
  47292. }
  47293. installRenderHelpers(FunctionalRenderContext.prototype);
  47294. function createFunctionalComponent (
  47295. Ctor,
  47296. propsData,
  47297. data,
  47298. contextVm,
  47299. children
  47300. ) {
  47301. var options = Ctor.options;
  47302. var props = {};
  47303. var propOptions = options.props;
  47304. if (isDef(propOptions)) {
  47305. for (var key in propOptions) {
  47306. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  47307. }
  47308. } else {
  47309. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  47310. if (isDef(data.props)) { mergeProps(props, data.props); }
  47311. }
  47312. var renderContext = new FunctionalRenderContext(
  47313. data,
  47314. props,
  47315. children,
  47316. contextVm,
  47317. Ctor
  47318. );
  47319. var vnode = options.render.call(null, renderContext._c, renderContext);
  47320. if (vnode instanceof VNode) {
  47321. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  47322. } else if (Array.isArray(vnode)) {
  47323. var vnodes = normalizeChildren(vnode) || [];
  47324. var res = new Array(vnodes.length);
  47325. for (var i = 0; i < vnodes.length; i++) {
  47326. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  47327. }
  47328. return res
  47329. }
  47330. }
  47331. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  47332. // #7817 clone node before setting fnContext, otherwise if the node is reused
  47333. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  47334. // that should not be matched to match.
  47335. var clone = cloneVNode(vnode);
  47336. clone.fnContext = contextVm;
  47337. clone.fnOptions = options;
  47338. {
  47339. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  47340. }
  47341. if (data.slot) {
  47342. (clone.data || (clone.data = {})).slot = data.slot;
  47343. }
  47344. return clone
  47345. }
  47346. function mergeProps (to, from) {
  47347. for (var key in from) {
  47348. to[camelize(key)] = from[key];
  47349. }
  47350. }
  47351. /* */
  47352. /* */
  47353. /* */
  47354. /* */
  47355. // inline hooks to be invoked on component VNodes during patch
  47356. var componentVNodeHooks = {
  47357. init: function init (vnode, hydrating) {
  47358. if (
  47359. vnode.componentInstance &&
  47360. !vnode.componentInstance._isDestroyed &&
  47361. vnode.data.keepAlive
  47362. ) {
  47363. // kept-alive components, treat as a patch
  47364. var mountedNode = vnode; // work around flow
  47365. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  47366. } else {
  47367. var child = vnode.componentInstance = createComponentInstanceForVnode(
  47368. vnode,
  47369. activeInstance
  47370. );
  47371. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  47372. }
  47373. },
  47374. prepatch: function prepatch (oldVnode, vnode) {
  47375. var options = vnode.componentOptions;
  47376. var child = vnode.componentInstance = oldVnode.componentInstance;
  47377. updateChildComponent(
  47378. child,
  47379. options.propsData, // updated props
  47380. options.listeners, // updated listeners
  47381. vnode, // new parent vnode
  47382. options.children // new children
  47383. );
  47384. },
  47385. insert: function insert (vnode) {
  47386. var context = vnode.context;
  47387. var componentInstance = vnode.componentInstance;
  47388. if (!componentInstance._isMounted) {
  47389. componentInstance._isMounted = true;
  47390. callHook(componentInstance, 'mounted');
  47391. }
  47392. if (vnode.data.keepAlive) {
  47393. if (context._isMounted) {
  47394. // vue-router#1212
  47395. // During updates, a kept-alive component's child components may
  47396. // change, so directly walking the tree here may call activated hooks
  47397. // on incorrect children. Instead we push them into a queue which will
  47398. // be processed after the whole patch process ended.
  47399. queueActivatedComponent(componentInstance);
  47400. } else {
  47401. activateChildComponent(componentInstance, true /* direct */);
  47402. }
  47403. }
  47404. },
  47405. destroy: function destroy (vnode) {
  47406. var componentInstance = vnode.componentInstance;
  47407. if (!componentInstance._isDestroyed) {
  47408. if (!vnode.data.keepAlive) {
  47409. componentInstance.$destroy();
  47410. } else {
  47411. deactivateChildComponent(componentInstance, true /* direct */);
  47412. }
  47413. }
  47414. }
  47415. };
  47416. var hooksToMerge = Object.keys(componentVNodeHooks);
  47417. function createComponent (
  47418. Ctor,
  47419. data,
  47420. context,
  47421. children,
  47422. tag
  47423. ) {
  47424. if (isUndef(Ctor)) {
  47425. return
  47426. }
  47427. var baseCtor = context.$options._base;
  47428. // plain options object: turn it into a constructor
  47429. if (isObject(Ctor)) {
  47430. Ctor = baseCtor.extend(Ctor);
  47431. }
  47432. // if at this stage it's not a constructor or an async component factory,
  47433. // reject.
  47434. if (typeof Ctor !== 'function') {
  47435. {
  47436. warn(("Invalid Component definition: " + (String(Ctor))), context);
  47437. }
  47438. return
  47439. }
  47440. // async component
  47441. var asyncFactory;
  47442. if (isUndef(Ctor.cid)) {
  47443. asyncFactory = Ctor;
  47444. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  47445. if (Ctor === undefined) {
  47446. // return a placeholder node for async component, which is rendered
  47447. // as a comment node but preserves all the raw information for the node.
  47448. // the information will be used for async server-rendering and hydration.
  47449. return createAsyncPlaceholder(
  47450. asyncFactory,
  47451. data,
  47452. context,
  47453. children,
  47454. tag
  47455. )
  47456. }
  47457. }
  47458. data = data || {};
  47459. // resolve constructor options in case global mixins are applied after
  47460. // component constructor creation
  47461. resolveConstructorOptions(Ctor);
  47462. // transform component v-model data into props & events
  47463. if (isDef(data.model)) {
  47464. transformModel(Ctor.options, data);
  47465. }
  47466. // extract props
  47467. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  47468. // functional component
  47469. if (isTrue(Ctor.options.functional)) {
  47470. return createFunctionalComponent(Ctor, propsData, data, context, children)
  47471. }
  47472. // extract listeners, since these needs to be treated as
  47473. // child component listeners instead of DOM listeners
  47474. var listeners = data.on;
  47475. // replace with listeners with .native modifier
  47476. // so it gets processed during parent component patch.
  47477. data.on = data.nativeOn;
  47478. if (isTrue(Ctor.options.abstract)) {
  47479. // abstract components do not keep anything
  47480. // other than props & listeners & slot
  47481. // work around flow
  47482. var slot = data.slot;
  47483. data = {};
  47484. if (slot) {
  47485. data.slot = slot;
  47486. }
  47487. }
  47488. // install component management hooks onto the placeholder node
  47489. installComponentHooks(data);
  47490. // return a placeholder vnode
  47491. var name = Ctor.options.name || tag;
  47492. var vnode = new VNode(
  47493. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  47494. data, undefined, undefined, undefined, context,
  47495. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  47496. asyncFactory
  47497. );
  47498. return vnode
  47499. }
  47500. function createComponentInstanceForVnode (
  47501. vnode, // we know it's MountedComponentVNode but flow doesn't
  47502. parent // activeInstance in lifecycle state
  47503. ) {
  47504. var options = {
  47505. _isComponent: true,
  47506. _parentVnode: vnode,
  47507. parent: parent
  47508. };
  47509. // check inline-template render functions
  47510. var inlineTemplate = vnode.data.inlineTemplate;
  47511. if (isDef(inlineTemplate)) {
  47512. options.render = inlineTemplate.render;
  47513. options.staticRenderFns = inlineTemplate.staticRenderFns;
  47514. }
  47515. return new vnode.componentOptions.Ctor(options)
  47516. }
  47517. function installComponentHooks (data) {
  47518. var hooks = data.hook || (data.hook = {});
  47519. for (var i = 0; i < hooksToMerge.length; i++) {
  47520. var key = hooksToMerge[i];
  47521. var existing = hooks[key];
  47522. var toMerge = componentVNodeHooks[key];
  47523. if (existing !== toMerge && !(existing && existing._merged)) {
  47524. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  47525. }
  47526. }
  47527. }
  47528. function mergeHook$1 (f1, f2) {
  47529. var merged = function (a, b) {
  47530. // flow complains about extra args which is why we use any
  47531. f1(a, b);
  47532. f2(a, b);
  47533. };
  47534. merged._merged = true;
  47535. return merged
  47536. }
  47537. // transform component v-model info (value and callback) into
  47538. // prop and event handler respectively.
  47539. function transformModel (options, data) {
  47540. var prop = (options.model && options.model.prop) || 'value';
  47541. var event = (options.model && options.model.event) || 'input'
  47542. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  47543. var on = data.on || (data.on = {});
  47544. var existing = on[event];
  47545. var callback = data.model.callback;
  47546. if (isDef(existing)) {
  47547. if (
  47548. Array.isArray(existing)
  47549. ? existing.indexOf(callback) === -1
  47550. : existing !== callback
  47551. ) {
  47552. on[event] = [callback].concat(existing);
  47553. }
  47554. } else {
  47555. on[event] = callback;
  47556. }
  47557. }
  47558. /* */
  47559. var SIMPLE_NORMALIZE = 1;
  47560. var ALWAYS_NORMALIZE = 2;
  47561. // wrapper function for providing a more flexible interface
  47562. // without getting yelled at by flow
  47563. function createElement (
  47564. context,
  47565. tag,
  47566. data,
  47567. children,
  47568. normalizationType,
  47569. alwaysNormalize
  47570. ) {
  47571. if (Array.isArray(data) || isPrimitive(data)) {
  47572. normalizationType = children;
  47573. children = data;
  47574. data = undefined;
  47575. }
  47576. if (isTrue(alwaysNormalize)) {
  47577. normalizationType = ALWAYS_NORMALIZE;
  47578. }
  47579. return _createElement(context, tag, data, children, normalizationType)
  47580. }
  47581. function _createElement (
  47582. context,
  47583. tag,
  47584. data,
  47585. children,
  47586. normalizationType
  47587. ) {
  47588. if (isDef(data) && isDef((data).__ob__)) {
  47589. warn(
  47590. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  47591. 'Always create fresh vnode data objects in each render!',
  47592. context
  47593. );
  47594. return createEmptyVNode()
  47595. }
  47596. // object syntax in v-bind
  47597. if (isDef(data) && isDef(data.is)) {
  47598. tag = data.is;
  47599. }
  47600. if (!tag) {
  47601. // in case of component :is set to falsy value
  47602. return createEmptyVNode()
  47603. }
  47604. // warn against non-primitive key
  47605. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  47606. ) {
  47607. {
  47608. warn(
  47609. 'Avoid using non-primitive value as key, ' +
  47610. 'use string/number value instead.',
  47611. context
  47612. );
  47613. }
  47614. }
  47615. // support single function children as default scoped slot
  47616. if (Array.isArray(children) &&
  47617. typeof children[0] === 'function'
  47618. ) {
  47619. data = data || {};
  47620. data.scopedSlots = { default: children[0] };
  47621. children.length = 0;
  47622. }
  47623. if (normalizationType === ALWAYS_NORMALIZE) {
  47624. children = normalizeChildren(children);
  47625. } else if (normalizationType === SIMPLE_NORMALIZE) {
  47626. children = simpleNormalizeChildren(children);
  47627. }
  47628. var vnode, ns;
  47629. if (typeof tag === 'string') {
  47630. var Ctor;
  47631. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  47632. if (config.isReservedTag(tag)) {
  47633. // platform built-in elements
  47634. if (isDef(data) && isDef(data.nativeOn)) {
  47635. warn(
  47636. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  47637. context
  47638. );
  47639. }
  47640. vnode = new VNode(
  47641. config.parsePlatformTagName(tag), data, children,
  47642. undefined, undefined, context
  47643. );
  47644. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  47645. // component
  47646. vnode = createComponent(Ctor, data, context, children, tag);
  47647. } else {
  47648. // unknown or unlisted namespaced elements
  47649. // check at runtime because it may get assigned a namespace when its
  47650. // parent normalizes children
  47651. vnode = new VNode(
  47652. tag, data, children,
  47653. undefined, undefined, context
  47654. );
  47655. }
  47656. } else {
  47657. // direct component options / constructor
  47658. vnode = createComponent(tag, data, context, children);
  47659. }
  47660. if (Array.isArray(vnode)) {
  47661. return vnode
  47662. } else if (isDef(vnode)) {
  47663. if (isDef(ns)) { applyNS(vnode, ns); }
  47664. if (isDef(data)) { registerDeepBindings(data); }
  47665. return vnode
  47666. } else {
  47667. return createEmptyVNode()
  47668. }
  47669. }
  47670. function applyNS (vnode, ns, force) {
  47671. vnode.ns = ns;
  47672. if (vnode.tag === 'foreignObject') {
  47673. // use default namespace inside foreignObject
  47674. ns = undefined;
  47675. force = true;
  47676. }
  47677. if (isDef(vnode.children)) {
  47678. for (var i = 0, l = vnode.children.length; i < l; i++) {
  47679. var child = vnode.children[i];
  47680. if (isDef(child.tag) && (
  47681. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  47682. applyNS(child, ns, force);
  47683. }
  47684. }
  47685. }
  47686. }
  47687. // ref #5318
  47688. // necessary to ensure parent re-render when deep bindings like :style and
  47689. // :class are used on slot nodes
  47690. function registerDeepBindings (data) {
  47691. if (isObject(data.style)) {
  47692. traverse(data.style);
  47693. }
  47694. if (isObject(data.class)) {
  47695. traverse(data.class);
  47696. }
  47697. }
  47698. /* */
  47699. function initRender (vm) {
  47700. vm._vnode = null; // the root of the child tree
  47701. vm._staticTrees = null; // v-once cached trees
  47702. var options = vm.$options;
  47703. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  47704. var renderContext = parentVnode && parentVnode.context;
  47705. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  47706. vm.$scopedSlots = emptyObject;
  47707. // bind the createElement fn to this instance
  47708. // so that we get proper render context inside it.
  47709. // args order: tag, data, children, normalizationType, alwaysNormalize
  47710. // internal version is used by render functions compiled from templates
  47711. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  47712. // normalization is always applied for the public version, used in
  47713. // user-written render functions.
  47714. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  47715. // $attrs & $listeners are exposed for easier HOC creation.
  47716. // they need to be reactive so that HOCs using them are always updated
  47717. var parentData = parentVnode && parentVnode.data;
  47718. /* istanbul ignore else */
  47719. {
  47720. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  47721. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  47722. }, true);
  47723. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  47724. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  47725. }, true);
  47726. }
  47727. }
  47728. var currentRenderingInstance = null;
  47729. function renderMixin (Vue) {
  47730. // install runtime convenience helpers
  47731. installRenderHelpers(Vue.prototype);
  47732. Vue.prototype.$nextTick = function (fn) {
  47733. return nextTick(fn, this)
  47734. };
  47735. Vue.prototype._render = function () {
  47736. var vm = this;
  47737. var ref = vm.$options;
  47738. var render = ref.render;
  47739. var _parentVnode = ref._parentVnode;
  47740. if (_parentVnode) {
  47741. vm.$scopedSlots = normalizeScopedSlots(
  47742. _parentVnode.data.scopedSlots,
  47743. vm.$slots,
  47744. vm.$scopedSlots
  47745. );
  47746. }
  47747. // set parent vnode. this allows render functions to have access
  47748. // to the data on the placeholder node.
  47749. vm.$vnode = _parentVnode;
  47750. // render self
  47751. var vnode;
  47752. try {
  47753. // There's no need to maintain a stack because all render fns are called
  47754. // separately from one another. Nested component's render fns are called
  47755. // when parent component is patched.
  47756. currentRenderingInstance = vm;
  47757. vnode = render.call(vm._renderProxy, vm.$createElement);
  47758. } catch (e) {
  47759. handleError(e, vm, "render");
  47760. // return error render result,
  47761. // or previous vnode to prevent render error causing blank component
  47762. /* istanbul ignore else */
  47763. if (vm.$options.renderError) {
  47764. try {
  47765. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  47766. } catch (e) {
  47767. handleError(e, vm, "renderError");
  47768. vnode = vm._vnode;
  47769. }
  47770. } else {
  47771. vnode = vm._vnode;
  47772. }
  47773. } finally {
  47774. currentRenderingInstance = null;
  47775. }
  47776. // if the returned array contains only a single node, allow it
  47777. if (Array.isArray(vnode) && vnode.length === 1) {
  47778. vnode = vnode[0];
  47779. }
  47780. // return empty vnode in case the render function errored out
  47781. if (!(vnode instanceof VNode)) {
  47782. if (Array.isArray(vnode)) {
  47783. warn(
  47784. 'Multiple root nodes returned from render function. Render function ' +
  47785. 'should return a single root node.',
  47786. vm
  47787. );
  47788. }
  47789. vnode = createEmptyVNode();
  47790. }
  47791. // set parent
  47792. vnode.parent = _parentVnode;
  47793. return vnode
  47794. };
  47795. }
  47796. /* */
  47797. function ensureCtor (comp, base) {
  47798. if (
  47799. comp.__esModule ||
  47800. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  47801. ) {
  47802. comp = comp.default;
  47803. }
  47804. return isObject(comp)
  47805. ? base.extend(comp)
  47806. : comp
  47807. }
  47808. function createAsyncPlaceholder (
  47809. factory,
  47810. data,
  47811. context,
  47812. children,
  47813. tag
  47814. ) {
  47815. var node = createEmptyVNode();
  47816. node.asyncFactory = factory;
  47817. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  47818. return node
  47819. }
  47820. function resolveAsyncComponent (
  47821. factory,
  47822. baseCtor
  47823. ) {
  47824. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  47825. return factory.errorComp
  47826. }
  47827. if (isDef(factory.resolved)) {
  47828. return factory.resolved
  47829. }
  47830. var owner = currentRenderingInstance;
  47831. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  47832. // already pending
  47833. factory.owners.push(owner);
  47834. }
  47835. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  47836. return factory.loadingComp
  47837. }
  47838. if (owner && !isDef(factory.owners)) {
  47839. var owners = factory.owners = [owner];
  47840. var sync = true;
  47841. var timerLoading = null;
  47842. var timerTimeout = null
  47843. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  47844. var forceRender = function (renderCompleted) {
  47845. for (var i = 0, l = owners.length; i < l; i++) {
  47846. (owners[i]).$forceUpdate();
  47847. }
  47848. if (renderCompleted) {
  47849. owners.length = 0;
  47850. if (timerLoading !== null) {
  47851. clearTimeout(timerLoading);
  47852. timerLoading = null;
  47853. }
  47854. if (timerTimeout !== null) {
  47855. clearTimeout(timerTimeout);
  47856. timerTimeout = null;
  47857. }
  47858. }
  47859. };
  47860. var resolve = once(function (res) {
  47861. // cache resolved
  47862. factory.resolved = ensureCtor(res, baseCtor);
  47863. // invoke callbacks only if this is not a synchronous resolve
  47864. // (async resolves are shimmed as synchronous during SSR)
  47865. if (!sync) {
  47866. forceRender(true);
  47867. } else {
  47868. owners.length = 0;
  47869. }
  47870. });
  47871. var reject = once(function (reason) {
  47872. warn(
  47873. "Failed to resolve async component: " + (String(factory)) +
  47874. (reason ? ("\nReason: " + reason) : '')
  47875. );
  47876. if (isDef(factory.errorComp)) {
  47877. factory.error = true;
  47878. forceRender(true);
  47879. }
  47880. });
  47881. var res = factory(resolve, reject);
  47882. if (isObject(res)) {
  47883. if (isPromise(res)) {
  47884. // () => Promise
  47885. if (isUndef(factory.resolved)) {
  47886. res.then(resolve, reject);
  47887. }
  47888. } else if (isPromise(res.component)) {
  47889. res.component.then(resolve, reject);
  47890. if (isDef(res.error)) {
  47891. factory.errorComp = ensureCtor(res.error, baseCtor);
  47892. }
  47893. if (isDef(res.loading)) {
  47894. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  47895. if (res.delay === 0) {
  47896. factory.loading = true;
  47897. } else {
  47898. timerLoading = setTimeout(function () {
  47899. timerLoading = null;
  47900. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  47901. factory.loading = true;
  47902. forceRender(false);
  47903. }
  47904. }, res.delay || 200);
  47905. }
  47906. }
  47907. if (isDef(res.timeout)) {
  47908. timerTimeout = setTimeout(function () {
  47909. timerTimeout = null;
  47910. if (isUndef(factory.resolved)) {
  47911. reject(
  47912. "timeout (" + (res.timeout) + "ms)"
  47913. );
  47914. }
  47915. }, res.timeout);
  47916. }
  47917. }
  47918. }
  47919. sync = false;
  47920. // return in case resolved synchronously
  47921. return factory.loading
  47922. ? factory.loadingComp
  47923. : factory.resolved
  47924. }
  47925. }
  47926. /* */
  47927. function isAsyncPlaceholder (node) {
  47928. return node.isComment && node.asyncFactory
  47929. }
  47930. /* */
  47931. function getFirstComponentChild (children) {
  47932. if (Array.isArray(children)) {
  47933. for (var i = 0; i < children.length; i++) {
  47934. var c = children[i];
  47935. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  47936. return c
  47937. }
  47938. }
  47939. }
  47940. }
  47941. /* */
  47942. /* */
  47943. function initEvents (vm) {
  47944. vm._events = Object.create(null);
  47945. vm._hasHookEvent = false;
  47946. // init parent attached events
  47947. var listeners = vm.$options._parentListeners;
  47948. if (listeners) {
  47949. updateComponentListeners(vm, listeners);
  47950. }
  47951. }
  47952. var target;
  47953. function add (event, fn) {
  47954. target.$on(event, fn);
  47955. }
  47956. function remove$1 (event, fn) {
  47957. target.$off(event, fn);
  47958. }
  47959. function createOnceHandler (event, fn) {
  47960. var _target = target;
  47961. return function onceHandler () {
  47962. var res = fn.apply(null, arguments);
  47963. if (res !== null) {
  47964. _target.$off(event, onceHandler);
  47965. }
  47966. }
  47967. }
  47968. function updateComponentListeners (
  47969. vm,
  47970. listeners,
  47971. oldListeners
  47972. ) {
  47973. target = vm;
  47974. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  47975. target = undefined;
  47976. }
  47977. function eventsMixin (Vue) {
  47978. var hookRE = /^hook:/;
  47979. Vue.prototype.$on = function (event, fn) {
  47980. var vm = this;
  47981. if (Array.isArray(event)) {
  47982. for (var i = 0, l = event.length; i < l; i++) {
  47983. vm.$on(event[i], fn);
  47984. }
  47985. } else {
  47986. (vm._events[event] || (vm._events[event] = [])).push(fn);
  47987. // optimize hook:event cost by using a boolean flag marked at registration
  47988. // instead of a hash lookup
  47989. if (hookRE.test(event)) {
  47990. vm._hasHookEvent = true;
  47991. }
  47992. }
  47993. return vm
  47994. };
  47995. Vue.prototype.$once = function (event, fn) {
  47996. var vm = this;
  47997. function on () {
  47998. vm.$off(event, on);
  47999. fn.apply(vm, arguments);
  48000. }
  48001. on.fn = fn;
  48002. vm.$on(event, on);
  48003. return vm
  48004. };
  48005. Vue.prototype.$off = function (event, fn) {
  48006. var vm = this;
  48007. // all
  48008. if (!arguments.length) {
  48009. vm._events = Object.create(null);
  48010. return vm
  48011. }
  48012. // array of events
  48013. if (Array.isArray(event)) {
  48014. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  48015. vm.$off(event[i$1], fn);
  48016. }
  48017. return vm
  48018. }
  48019. // specific event
  48020. var cbs = vm._events[event];
  48021. if (!cbs) {
  48022. return vm
  48023. }
  48024. if (!fn) {
  48025. vm._events[event] = null;
  48026. return vm
  48027. }
  48028. // specific handler
  48029. var cb;
  48030. var i = cbs.length;
  48031. while (i--) {
  48032. cb = cbs[i];
  48033. if (cb === fn || cb.fn === fn) {
  48034. cbs.splice(i, 1);
  48035. break
  48036. }
  48037. }
  48038. return vm
  48039. };
  48040. Vue.prototype.$emit = function (event) {
  48041. var vm = this;
  48042. {
  48043. var lowerCaseEvent = event.toLowerCase();
  48044. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  48045. tip(
  48046. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  48047. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  48048. "Note that HTML attributes are case-insensitive and you cannot use " +
  48049. "v-on to listen to camelCase events when using in-DOM templates. " +
  48050. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  48051. );
  48052. }
  48053. }
  48054. var cbs = vm._events[event];
  48055. if (cbs) {
  48056. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  48057. var args = toArray(arguments, 1);
  48058. var info = "event handler for \"" + event + "\"";
  48059. for (var i = 0, l = cbs.length; i < l; i++) {
  48060. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  48061. }
  48062. }
  48063. return vm
  48064. };
  48065. }
  48066. /* */
  48067. var activeInstance = null;
  48068. var isUpdatingChildComponent = false;
  48069. function setActiveInstance(vm) {
  48070. var prevActiveInstance = activeInstance;
  48071. activeInstance = vm;
  48072. return function () {
  48073. activeInstance = prevActiveInstance;
  48074. }
  48075. }
  48076. function initLifecycle (vm) {
  48077. var options = vm.$options;
  48078. // locate first non-abstract parent
  48079. var parent = options.parent;
  48080. if (parent && !options.abstract) {
  48081. while (parent.$options.abstract && parent.$parent) {
  48082. parent = parent.$parent;
  48083. }
  48084. parent.$children.push(vm);
  48085. }
  48086. vm.$parent = parent;
  48087. vm.$root = parent ? parent.$root : vm;
  48088. vm.$children = [];
  48089. vm.$refs = {};
  48090. vm._watcher = null;
  48091. vm._inactive = null;
  48092. vm._directInactive = false;
  48093. vm._isMounted = false;
  48094. vm._isDestroyed = false;
  48095. vm._isBeingDestroyed = false;
  48096. }
  48097. function lifecycleMixin (Vue) {
  48098. Vue.prototype._update = function (vnode, hydrating) {
  48099. var vm = this;
  48100. var prevEl = vm.$el;
  48101. var prevVnode = vm._vnode;
  48102. var restoreActiveInstance = setActiveInstance(vm);
  48103. vm._vnode = vnode;
  48104. // Vue.prototype.__patch__ is injected in entry points
  48105. // based on the rendering backend used.
  48106. if (!prevVnode) {
  48107. // initial render
  48108. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  48109. } else {
  48110. // updates
  48111. vm.$el = vm.__patch__(prevVnode, vnode);
  48112. }
  48113. restoreActiveInstance();
  48114. // update __vue__ reference
  48115. if (prevEl) {
  48116. prevEl.__vue__ = null;
  48117. }
  48118. if (vm.$el) {
  48119. vm.$el.__vue__ = vm;
  48120. }
  48121. // if parent is an HOC, update its $el as well
  48122. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  48123. vm.$parent.$el = vm.$el;
  48124. }
  48125. // updated hook is called by the scheduler to ensure that children are
  48126. // updated in a parent's updated hook.
  48127. };
  48128. Vue.prototype.$forceUpdate = function () {
  48129. var vm = this;
  48130. if (vm._watcher) {
  48131. vm._watcher.update();
  48132. }
  48133. };
  48134. Vue.prototype.$destroy = function () {
  48135. var vm = this;
  48136. if (vm._isBeingDestroyed) {
  48137. return
  48138. }
  48139. callHook(vm, 'beforeDestroy');
  48140. vm._isBeingDestroyed = true;
  48141. // remove self from parent
  48142. var parent = vm.$parent;
  48143. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  48144. remove(parent.$children, vm);
  48145. }
  48146. // teardown watchers
  48147. if (vm._watcher) {
  48148. vm._watcher.teardown();
  48149. }
  48150. var i = vm._watchers.length;
  48151. while (i--) {
  48152. vm._watchers[i].teardown();
  48153. }
  48154. // remove reference from data ob
  48155. // frozen object may not have observer.
  48156. if (vm._data.__ob__) {
  48157. vm._data.__ob__.vmCount--;
  48158. }
  48159. // call the last hook...
  48160. vm._isDestroyed = true;
  48161. // invoke destroy hooks on current rendered tree
  48162. vm.__patch__(vm._vnode, null);
  48163. // fire destroyed hook
  48164. callHook(vm, 'destroyed');
  48165. // turn off all instance listeners.
  48166. vm.$off();
  48167. // remove __vue__ reference
  48168. if (vm.$el) {
  48169. vm.$el.__vue__ = null;
  48170. }
  48171. // release circular reference (#6759)
  48172. if (vm.$vnode) {
  48173. vm.$vnode.parent = null;
  48174. }
  48175. };
  48176. }
  48177. function mountComponent (
  48178. vm,
  48179. el,
  48180. hydrating
  48181. ) {
  48182. vm.$el = el;
  48183. if (!vm.$options.render) {
  48184. vm.$options.render = createEmptyVNode;
  48185. {
  48186. /* istanbul ignore if */
  48187. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  48188. vm.$options.el || el) {
  48189. warn(
  48190. 'You are using the runtime-only build of Vue where the template ' +
  48191. 'compiler is not available. Either pre-compile the templates into ' +
  48192. 'render functions, or use the compiler-included build.',
  48193. vm
  48194. );
  48195. } else {
  48196. warn(
  48197. 'Failed to mount component: template or render function not defined.',
  48198. vm
  48199. );
  48200. }
  48201. }
  48202. }
  48203. callHook(vm, 'beforeMount');
  48204. var updateComponent;
  48205. /* istanbul ignore if */
  48206. if (config.performance && mark) {
  48207. updateComponent = function () {
  48208. var name = vm._name;
  48209. var id = vm._uid;
  48210. var startTag = "vue-perf-start:" + id;
  48211. var endTag = "vue-perf-end:" + id;
  48212. mark(startTag);
  48213. var vnode = vm._render();
  48214. mark(endTag);
  48215. measure(("vue " + name + " render"), startTag, endTag);
  48216. mark(startTag);
  48217. vm._update(vnode, hydrating);
  48218. mark(endTag);
  48219. measure(("vue " + name + " patch"), startTag, endTag);
  48220. };
  48221. } else {
  48222. updateComponent = function () {
  48223. vm._update(vm._render(), hydrating);
  48224. };
  48225. }
  48226. // we set this to vm._watcher inside the watcher's constructor
  48227. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  48228. // component's mounted hook), which relies on vm._watcher being already defined
  48229. new Watcher(vm, updateComponent, noop, {
  48230. before: function before () {
  48231. if (vm._isMounted && !vm._isDestroyed) {
  48232. callHook(vm, 'beforeUpdate');
  48233. }
  48234. }
  48235. }, true /* isRenderWatcher */);
  48236. hydrating = false;
  48237. // manually mounted instance, call mounted on self
  48238. // mounted is called for render-created child components in its inserted hook
  48239. if (vm.$vnode == null) {
  48240. vm._isMounted = true;
  48241. callHook(vm, 'mounted');
  48242. }
  48243. return vm
  48244. }
  48245. function updateChildComponent (
  48246. vm,
  48247. propsData,
  48248. listeners,
  48249. parentVnode,
  48250. renderChildren
  48251. ) {
  48252. {
  48253. isUpdatingChildComponent = true;
  48254. }
  48255. // determine whether component has slot children
  48256. // we need to do this before overwriting $options._renderChildren.
  48257. // check if there are dynamic scopedSlots (hand-written or compiled but with
  48258. // dynamic slot names). Static scoped slots compiled from template has the
  48259. // "$stable" marker.
  48260. var newScopedSlots = parentVnode.data.scopedSlots;
  48261. var oldScopedSlots = vm.$scopedSlots;
  48262. var hasDynamicScopedSlot = !!(
  48263. (newScopedSlots && !newScopedSlots.$stable) ||
  48264. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  48265. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  48266. );
  48267. // Any static slot children from the parent may have changed during parent's
  48268. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  48269. // update is necessary to ensure correctness.
  48270. var needsForceUpdate = !!(
  48271. renderChildren || // has new static slots
  48272. vm.$options._renderChildren || // has old static slots
  48273. hasDynamicScopedSlot
  48274. );
  48275. vm.$options._parentVnode = parentVnode;
  48276. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  48277. if (vm._vnode) { // update child tree's parent
  48278. vm._vnode.parent = parentVnode;
  48279. }
  48280. vm.$options._renderChildren = renderChildren;
  48281. // update $attrs and $listeners hash
  48282. // these are also reactive so they may trigger child update if the child
  48283. // used them during render
  48284. vm.$attrs = parentVnode.data.attrs || emptyObject;
  48285. vm.$listeners = listeners || emptyObject;
  48286. // update props
  48287. if (propsData && vm.$options.props) {
  48288. toggleObserving(false);
  48289. var props = vm._props;
  48290. var propKeys = vm.$options._propKeys || [];
  48291. for (var i = 0; i < propKeys.length; i++) {
  48292. var key = propKeys[i];
  48293. var propOptions = vm.$options.props; // wtf flow?
  48294. props[key] = validateProp(key, propOptions, propsData, vm);
  48295. }
  48296. toggleObserving(true);
  48297. // keep a copy of raw propsData
  48298. vm.$options.propsData = propsData;
  48299. }
  48300. // update listeners
  48301. listeners = listeners || emptyObject;
  48302. var oldListeners = vm.$options._parentListeners;
  48303. vm.$options._parentListeners = listeners;
  48304. updateComponentListeners(vm, listeners, oldListeners);
  48305. // resolve slots + force update if has children
  48306. if (needsForceUpdate) {
  48307. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  48308. vm.$forceUpdate();
  48309. }
  48310. {
  48311. isUpdatingChildComponent = false;
  48312. }
  48313. }
  48314. function isInInactiveTree (vm) {
  48315. while (vm && (vm = vm.$parent)) {
  48316. if (vm._inactive) { return true }
  48317. }
  48318. return false
  48319. }
  48320. function activateChildComponent (vm, direct) {
  48321. if (direct) {
  48322. vm._directInactive = false;
  48323. if (isInInactiveTree(vm)) {
  48324. return
  48325. }
  48326. } else if (vm._directInactive) {
  48327. return
  48328. }
  48329. if (vm._inactive || vm._inactive === null) {
  48330. vm._inactive = false;
  48331. for (var i = 0; i < vm.$children.length; i++) {
  48332. activateChildComponent(vm.$children[i]);
  48333. }
  48334. callHook(vm, 'activated');
  48335. }
  48336. }
  48337. function deactivateChildComponent (vm, direct) {
  48338. if (direct) {
  48339. vm._directInactive = true;
  48340. if (isInInactiveTree(vm)) {
  48341. return
  48342. }
  48343. }
  48344. if (!vm._inactive) {
  48345. vm._inactive = true;
  48346. for (var i = 0; i < vm.$children.length; i++) {
  48347. deactivateChildComponent(vm.$children[i]);
  48348. }
  48349. callHook(vm, 'deactivated');
  48350. }
  48351. }
  48352. function callHook (vm, hook) {
  48353. // #7573 disable dep collection when invoking lifecycle hooks
  48354. pushTarget();
  48355. var handlers = vm.$options[hook];
  48356. var info = hook + " hook";
  48357. if (handlers) {
  48358. for (var i = 0, j = handlers.length; i < j; i++) {
  48359. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  48360. }
  48361. }
  48362. if (vm._hasHookEvent) {
  48363. vm.$emit('hook:' + hook);
  48364. }
  48365. popTarget();
  48366. }
  48367. /* */
  48368. var MAX_UPDATE_COUNT = 100;
  48369. var queue = [];
  48370. var activatedChildren = [];
  48371. var has = {};
  48372. var circular = {};
  48373. var waiting = false;
  48374. var flushing = false;
  48375. var index = 0;
  48376. /**
  48377. * Reset the scheduler's state.
  48378. */
  48379. function resetSchedulerState () {
  48380. index = queue.length = activatedChildren.length = 0;
  48381. has = {};
  48382. {
  48383. circular = {};
  48384. }
  48385. waiting = flushing = false;
  48386. }
  48387. // Async edge case #6566 requires saving the timestamp when event listeners are
  48388. // attached. However, calling performance.now() has a perf overhead especially
  48389. // if the page has thousands of event listeners. Instead, we take a timestamp
  48390. // every time the scheduler flushes and use that for all event listeners
  48391. // attached during that flush.
  48392. var currentFlushTimestamp = 0;
  48393. // Async edge case fix requires storing an event listener's attach timestamp.
  48394. var getNow = Date.now;
  48395. // Determine what event timestamp the browser is using. Annoyingly, the
  48396. // timestamp can either be hi-res (relative to page load) or low-res
  48397. // (relative to UNIX epoch), so in order to compare time we have to use the
  48398. // same timestamp type when saving the flush timestamp.
  48399. // All IE versions use low-res event timestamps, and have problematic clock
  48400. // implementations (#9632)
  48401. if (inBrowser && !isIE) {
  48402. var performance = window.performance;
  48403. if (
  48404. performance &&
  48405. typeof performance.now === 'function' &&
  48406. getNow() > document.createEvent('Event').timeStamp
  48407. ) {
  48408. // if the event timestamp, although evaluated AFTER the Date.now(), is
  48409. // smaller than it, it means the event is using a hi-res timestamp,
  48410. // and we need to use the hi-res version for event listener timestamps as
  48411. // well.
  48412. getNow = function () { return performance.now(); };
  48413. }
  48414. }
  48415. /**
  48416. * Flush both queues and run the watchers.
  48417. */
  48418. function flushSchedulerQueue () {
  48419. currentFlushTimestamp = getNow();
  48420. flushing = true;
  48421. var watcher, id;
  48422. // Sort queue before flush.
  48423. // This ensures that:
  48424. // 1. Components are updated from parent to child. (because parent is always
  48425. // created before the child)
  48426. // 2. A component's user watchers are run before its render watcher (because
  48427. // user watchers are created before the render watcher)
  48428. // 3. If a component is destroyed during a parent component's watcher run,
  48429. // its watchers can be skipped.
  48430. queue.sort(function (a, b) { return a.id - b.id; });
  48431. // do not cache length because more watchers might be pushed
  48432. // as we run existing watchers
  48433. for (index = 0; index < queue.length; index++) {
  48434. watcher = queue[index];
  48435. if (watcher.before) {
  48436. watcher.before();
  48437. }
  48438. id = watcher.id;
  48439. has[id] = null;
  48440. watcher.run();
  48441. // in dev build, check and stop circular updates.
  48442. if (has[id] != null) {
  48443. circular[id] = (circular[id] || 0) + 1;
  48444. if (circular[id] > MAX_UPDATE_COUNT) {
  48445. warn(
  48446. 'You may have an infinite update loop ' + (
  48447. watcher.user
  48448. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  48449. : "in a component render function."
  48450. ),
  48451. watcher.vm
  48452. );
  48453. break
  48454. }
  48455. }
  48456. }
  48457. // keep copies of post queues before resetting state
  48458. var activatedQueue = activatedChildren.slice();
  48459. var updatedQueue = queue.slice();
  48460. resetSchedulerState();
  48461. // call component updated and activated hooks
  48462. callActivatedHooks(activatedQueue);
  48463. callUpdatedHooks(updatedQueue);
  48464. // devtool hook
  48465. /* istanbul ignore if */
  48466. if (devtools && config.devtools) {
  48467. devtools.emit('flush');
  48468. }
  48469. }
  48470. function callUpdatedHooks (queue) {
  48471. var i = queue.length;
  48472. while (i--) {
  48473. var watcher = queue[i];
  48474. var vm = watcher.vm;
  48475. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  48476. callHook(vm, 'updated');
  48477. }
  48478. }
  48479. }
  48480. /**
  48481. * Queue a kept-alive component that was activated during patch.
  48482. * The queue will be processed after the entire tree has been patched.
  48483. */
  48484. function queueActivatedComponent (vm) {
  48485. // setting _inactive to false here so that a render function can
  48486. // rely on checking whether it's in an inactive tree (e.g. router-view)
  48487. vm._inactive = false;
  48488. activatedChildren.push(vm);
  48489. }
  48490. function callActivatedHooks (queue) {
  48491. for (var i = 0; i < queue.length; i++) {
  48492. queue[i]._inactive = true;
  48493. activateChildComponent(queue[i], true /* true */);
  48494. }
  48495. }
  48496. /**
  48497. * Push a watcher into the watcher queue.
  48498. * Jobs with duplicate IDs will be skipped unless it's
  48499. * pushed when the queue is being flushed.
  48500. */
  48501. function queueWatcher (watcher) {
  48502. var id = watcher.id;
  48503. if (has[id] == null) {
  48504. has[id] = true;
  48505. if (!flushing) {
  48506. queue.push(watcher);
  48507. } else {
  48508. // if already flushing, splice the watcher based on its id
  48509. // if already past its id, it will be run next immediately.
  48510. var i = queue.length - 1;
  48511. while (i > index && queue[i].id > watcher.id) {
  48512. i--;
  48513. }
  48514. queue.splice(i + 1, 0, watcher);
  48515. }
  48516. // queue the flush
  48517. if (!waiting) {
  48518. waiting = true;
  48519. if (!config.async) {
  48520. flushSchedulerQueue();
  48521. return
  48522. }
  48523. nextTick(flushSchedulerQueue);
  48524. }
  48525. }
  48526. }
  48527. /* */
  48528. var uid$2 = 0;
  48529. /**
  48530. * A watcher parses an expression, collects dependencies,
  48531. * and fires callback when the expression value changes.
  48532. * This is used for both the $watch() api and directives.
  48533. */
  48534. var Watcher = function Watcher (
  48535. vm,
  48536. expOrFn,
  48537. cb,
  48538. options,
  48539. isRenderWatcher
  48540. ) {
  48541. this.vm = vm;
  48542. if (isRenderWatcher) {
  48543. vm._watcher = this;
  48544. }
  48545. vm._watchers.push(this);
  48546. // options
  48547. if (options) {
  48548. this.deep = !!options.deep;
  48549. this.user = !!options.user;
  48550. this.lazy = !!options.lazy;
  48551. this.sync = !!options.sync;
  48552. this.before = options.before;
  48553. } else {
  48554. this.deep = this.user = this.lazy = this.sync = false;
  48555. }
  48556. this.cb = cb;
  48557. this.id = ++uid$2; // uid for batching
  48558. this.active = true;
  48559. this.dirty = this.lazy; // for lazy watchers
  48560. this.deps = [];
  48561. this.newDeps = [];
  48562. this.depIds = new _Set();
  48563. this.newDepIds = new _Set();
  48564. this.expression = expOrFn.toString();
  48565. // parse expression for getter
  48566. if (typeof expOrFn === 'function') {
  48567. this.getter = expOrFn;
  48568. } else {
  48569. this.getter = parsePath(expOrFn);
  48570. if (!this.getter) {
  48571. this.getter = noop;
  48572. warn(
  48573. "Failed watching path: \"" + expOrFn + "\" " +
  48574. 'Watcher only accepts simple dot-delimited paths. ' +
  48575. 'For full control, use a function instead.',
  48576. vm
  48577. );
  48578. }
  48579. }
  48580. this.value = this.lazy
  48581. ? undefined
  48582. : this.get();
  48583. };
  48584. /**
  48585. * Evaluate the getter, and re-collect dependencies.
  48586. */
  48587. Watcher.prototype.get = function get () {
  48588. pushTarget(this);
  48589. var value;
  48590. var vm = this.vm;
  48591. try {
  48592. value = this.getter.call(vm, vm);
  48593. } catch (e) {
  48594. if (this.user) {
  48595. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  48596. } else {
  48597. throw e
  48598. }
  48599. } finally {
  48600. // "touch" every property so they are all tracked as
  48601. // dependencies for deep watching
  48602. if (this.deep) {
  48603. traverse(value);
  48604. }
  48605. popTarget();
  48606. this.cleanupDeps();
  48607. }
  48608. return value
  48609. };
  48610. /**
  48611. * Add a dependency to this directive.
  48612. */
  48613. Watcher.prototype.addDep = function addDep (dep) {
  48614. var id = dep.id;
  48615. if (!this.newDepIds.has(id)) {
  48616. this.newDepIds.add(id);
  48617. this.newDeps.push(dep);
  48618. if (!this.depIds.has(id)) {
  48619. dep.addSub(this);
  48620. }
  48621. }
  48622. };
  48623. /**
  48624. * Clean up for dependency collection.
  48625. */
  48626. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  48627. var i = this.deps.length;
  48628. while (i--) {
  48629. var dep = this.deps[i];
  48630. if (!this.newDepIds.has(dep.id)) {
  48631. dep.removeSub(this);
  48632. }
  48633. }
  48634. var tmp = this.depIds;
  48635. this.depIds = this.newDepIds;
  48636. this.newDepIds = tmp;
  48637. this.newDepIds.clear();
  48638. tmp = this.deps;
  48639. this.deps = this.newDeps;
  48640. this.newDeps = tmp;
  48641. this.newDeps.length = 0;
  48642. };
  48643. /**
  48644. * Subscriber interface.
  48645. * Will be called when a dependency changes.
  48646. */
  48647. Watcher.prototype.update = function update () {
  48648. /* istanbul ignore else */
  48649. if (this.lazy) {
  48650. this.dirty = true;
  48651. } else if (this.sync) {
  48652. this.run();
  48653. } else {
  48654. queueWatcher(this);
  48655. }
  48656. };
  48657. /**
  48658. * Scheduler job interface.
  48659. * Will be called by the scheduler.
  48660. */
  48661. Watcher.prototype.run = function run () {
  48662. if (this.active) {
  48663. var value = this.get();
  48664. if (
  48665. value !== this.value ||
  48666. // Deep watchers and watchers on Object/Arrays should fire even
  48667. // when the value is the same, because the value may
  48668. // have mutated.
  48669. isObject(value) ||
  48670. this.deep
  48671. ) {
  48672. // set new value
  48673. var oldValue = this.value;
  48674. this.value = value;
  48675. if (this.user) {
  48676. try {
  48677. this.cb.call(this.vm, value, oldValue);
  48678. } catch (e) {
  48679. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  48680. }
  48681. } else {
  48682. this.cb.call(this.vm, value, oldValue);
  48683. }
  48684. }
  48685. }
  48686. };
  48687. /**
  48688. * Evaluate the value of the watcher.
  48689. * This only gets called for lazy watchers.
  48690. */
  48691. Watcher.prototype.evaluate = function evaluate () {
  48692. this.value = this.get();
  48693. this.dirty = false;
  48694. };
  48695. /**
  48696. * Depend on all deps collected by this watcher.
  48697. */
  48698. Watcher.prototype.depend = function depend () {
  48699. var i = this.deps.length;
  48700. while (i--) {
  48701. this.deps[i].depend();
  48702. }
  48703. };
  48704. /**
  48705. * Remove self from all dependencies' subscriber list.
  48706. */
  48707. Watcher.prototype.teardown = function teardown () {
  48708. if (this.active) {
  48709. // remove self from vm's watcher list
  48710. // this is a somewhat expensive operation so we skip it
  48711. // if the vm is being destroyed.
  48712. if (!this.vm._isBeingDestroyed) {
  48713. remove(this.vm._watchers, this);
  48714. }
  48715. var i = this.deps.length;
  48716. while (i--) {
  48717. this.deps[i].removeSub(this);
  48718. }
  48719. this.active = false;
  48720. }
  48721. };
  48722. /* */
  48723. var sharedPropertyDefinition = {
  48724. enumerable: true,
  48725. configurable: true,
  48726. get: noop,
  48727. set: noop
  48728. };
  48729. function proxy (target, sourceKey, key) {
  48730. sharedPropertyDefinition.get = function proxyGetter () {
  48731. return this[sourceKey][key]
  48732. };
  48733. sharedPropertyDefinition.set = function proxySetter (val) {
  48734. this[sourceKey][key] = val;
  48735. };
  48736. Object.defineProperty(target, key, sharedPropertyDefinition);
  48737. }
  48738. function initState (vm) {
  48739. vm._watchers = [];
  48740. var opts = vm.$options;
  48741. if (opts.props) { initProps(vm, opts.props); }
  48742. if (opts.methods) { initMethods(vm, opts.methods); }
  48743. if (opts.data) {
  48744. initData(vm);
  48745. } else {
  48746. observe(vm._data = {}, true /* asRootData */);
  48747. }
  48748. if (opts.computed) { initComputed(vm, opts.computed); }
  48749. if (opts.watch && opts.watch !== nativeWatch) {
  48750. initWatch(vm, opts.watch);
  48751. }
  48752. }
  48753. function initProps (vm, propsOptions) {
  48754. var propsData = vm.$options.propsData || {};
  48755. var props = vm._props = {};
  48756. // cache prop keys so that future props updates can iterate using Array
  48757. // instead of dynamic object key enumeration.
  48758. var keys = vm.$options._propKeys = [];
  48759. var isRoot = !vm.$parent;
  48760. // root instance props should be converted
  48761. if (!isRoot) {
  48762. toggleObserving(false);
  48763. }
  48764. var loop = function ( key ) {
  48765. keys.push(key);
  48766. var value = validateProp(key, propsOptions, propsData, vm);
  48767. /* istanbul ignore else */
  48768. {
  48769. var hyphenatedKey = hyphenate(key);
  48770. if (isReservedAttribute(hyphenatedKey) ||
  48771. config.isReservedAttr(hyphenatedKey)) {
  48772. warn(
  48773. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  48774. vm
  48775. );
  48776. }
  48777. defineReactive$$1(props, key, value, function () {
  48778. if (!isRoot && !isUpdatingChildComponent) {
  48779. warn(
  48780. "Avoid mutating a prop directly since the value will be " +
  48781. "overwritten whenever the parent component re-renders. " +
  48782. "Instead, use a data or computed property based on the prop's " +
  48783. "value. Prop being mutated: \"" + key + "\"",
  48784. vm
  48785. );
  48786. }
  48787. });
  48788. }
  48789. // static props are already proxied on the component's prototype
  48790. // during Vue.extend(). We only need to proxy props defined at
  48791. // instantiation here.
  48792. if (!(key in vm)) {
  48793. proxy(vm, "_props", key);
  48794. }
  48795. };
  48796. for (var key in propsOptions) loop( key );
  48797. toggleObserving(true);
  48798. }
  48799. function initData (vm) {
  48800. var data = vm.$options.data;
  48801. data = vm._data = typeof data === 'function'
  48802. ? getData(data, vm)
  48803. : data || {};
  48804. if (!isPlainObject(data)) {
  48805. data = {};
  48806. warn(
  48807. 'data functions should return an object:\n' +
  48808. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  48809. vm
  48810. );
  48811. }
  48812. // proxy data on instance
  48813. var keys = Object.keys(data);
  48814. var props = vm.$options.props;
  48815. var methods = vm.$options.methods;
  48816. var i = keys.length;
  48817. while (i--) {
  48818. var key = keys[i];
  48819. {
  48820. if (methods && hasOwn(methods, key)) {
  48821. warn(
  48822. ("Method \"" + key + "\" has already been defined as a data property."),
  48823. vm
  48824. );
  48825. }
  48826. }
  48827. if (props && hasOwn(props, key)) {
  48828. warn(
  48829. "The data property \"" + key + "\" is already declared as a prop. " +
  48830. "Use prop default value instead.",
  48831. vm
  48832. );
  48833. } else if (!isReserved(key)) {
  48834. proxy(vm, "_data", key);
  48835. }
  48836. }
  48837. // observe data
  48838. observe(data, true /* asRootData */);
  48839. }
  48840. function getData (data, vm) {
  48841. // #7573 disable dep collection when invoking data getters
  48842. pushTarget();
  48843. try {
  48844. return data.call(vm, vm)
  48845. } catch (e) {
  48846. handleError(e, vm, "data()");
  48847. return {}
  48848. } finally {
  48849. popTarget();
  48850. }
  48851. }
  48852. var computedWatcherOptions = { lazy: true };
  48853. function initComputed (vm, computed) {
  48854. // $flow-disable-line
  48855. var watchers = vm._computedWatchers = Object.create(null);
  48856. // computed properties are just getters during SSR
  48857. var isSSR = isServerRendering();
  48858. for (var key in computed) {
  48859. var userDef = computed[key];
  48860. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  48861. if (getter == null) {
  48862. warn(
  48863. ("Getter is missing for computed property \"" + key + "\"."),
  48864. vm
  48865. );
  48866. }
  48867. if (!isSSR) {
  48868. // create internal watcher for the computed property.
  48869. watchers[key] = new Watcher(
  48870. vm,
  48871. getter || noop,
  48872. noop,
  48873. computedWatcherOptions
  48874. );
  48875. }
  48876. // component-defined computed properties are already defined on the
  48877. // component prototype. We only need to define computed properties defined
  48878. // at instantiation here.
  48879. if (!(key in vm)) {
  48880. defineComputed(vm, key, userDef);
  48881. } else {
  48882. if (key in vm.$data) {
  48883. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  48884. } else if (vm.$options.props && key in vm.$options.props) {
  48885. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  48886. }
  48887. }
  48888. }
  48889. }
  48890. function defineComputed (
  48891. target,
  48892. key,
  48893. userDef
  48894. ) {
  48895. var shouldCache = !isServerRendering();
  48896. if (typeof userDef === 'function') {
  48897. sharedPropertyDefinition.get = shouldCache
  48898. ? createComputedGetter(key)
  48899. : createGetterInvoker(userDef);
  48900. sharedPropertyDefinition.set = noop;
  48901. } else {
  48902. sharedPropertyDefinition.get = userDef.get
  48903. ? shouldCache && userDef.cache !== false
  48904. ? createComputedGetter(key)
  48905. : createGetterInvoker(userDef.get)
  48906. : noop;
  48907. sharedPropertyDefinition.set = userDef.set || noop;
  48908. }
  48909. if (sharedPropertyDefinition.set === noop) {
  48910. sharedPropertyDefinition.set = function () {
  48911. warn(
  48912. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  48913. this
  48914. );
  48915. };
  48916. }
  48917. Object.defineProperty(target, key, sharedPropertyDefinition);
  48918. }
  48919. function createComputedGetter (key) {
  48920. return function computedGetter () {
  48921. var watcher = this._computedWatchers && this._computedWatchers[key];
  48922. if (watcher) {
  48923. if (watcher.dirty) {
  48924. watcher.evaluate();
  48925. }
  48926. if (Dep.target) {
  48927. watcher.depend();
  48928. }
  48929. return watcher.value
  48930. }
  48931. }
  48932. }
  48933. function createGetterInvoker(fn) {
  48934. return function computedGetter () {
  48935. return fn.call(this, this)
  48936. }
  48937. }
  48938. function initMethods (vm, methods) {
  48939. var props = vm.$options.props;
  48940. for (var key in methods) {
  48941. {
  48942. if (typeof methods[key] !== 'function') {
  48943. warn(
  48944. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  48945. "Did you reference the function correctly?",
  48946. vm
  48947. );
  48948. }
  48949. if (props && hasOwn(props, key)) {
  48950. warn(
  48951. ("Method \"" + key + "\" has already been defined as a prop."),
  48952. vm
  48953. );
  48954. }
  48955. if ((key in vm) && isReserved(key)) {
  48956. warn(
  48957. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  48958. "Avoid defining component methods that start with _ or $."
  48959. );
  48960. }
  48961. }
  48962. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  48963. }
  48964. }
  48965. function initWatch (vm, watch) {
  48966. for (var key in watch) {
  48967. var handler = watch[key];
  48968. if (Array.isArray(handler)) {
  48969. for (var i = 0; i < handler.length; i++) {
  48970. createWatcher(vm, key, handler[i]);
  48971. }
  48972. } else {
  48973. createWatcher(vm, key, handler);
  48974. }
  48975. }
  48976. }
  48977. function createWatcher (
  48978. vm,
  48979. expOrFn,
  48980. handler,
  48981. options
  48982. ) {
  48983. if (isPlainObject(handler)) {
  48984. options = handler;
  48985. handler = handler.handler;
  48986. }
  48987. if (typeof handler === 'string') {
  48988. handler = vm[handler];
  48989. }
  48990. return vm.$watch(expOrFn, handler, options)
  48991. }
  48992. function stateMixin (Vue) {
  48993. // flow somehow has problems with directly declared definition object
  48994. // when using Object.defineProperty, so we have to procedurally build up
  48995. // the object here.
  48996. var dataDef = {};
  48997. dataDef.get = function () { return this._data };
  48998. var propsDef = {};
  48999. propsDef.get = function () { return this._props };
  49000. {
  49001. dataDef.set = function () {
  49002. warn(
  49003. 'Avoid replacing instance root $data. ' +
  49004. 'Use nested data properties instead.',
  49005. this
  49006. );
  49007. };
  49008. propsDef.set = function () {
  49009. warn("$props is readonly.", this);
  49010. };
  49011. }
  49012. Object.defineProperty(Vue.prototype, '$data', dataDef);
  49013. Object.defineProperty(Vue.prototype, '$props', propsDef);
  49014. Vue.prototype.$set = set;
  49015. Vue.prototype.$delete = del;
  49016. Vue.prototype.$watch = function (
  49017. expOrFn,
  49018. cb,
  49019. options
  49020. ) {
  49021. var vm = this;
  49022. if (isPlainObject(cb)) {
  49023. return createWatcher(vm, expOrFn, cb, options)
  49024. }
  49025. options = options || {};
  49026. options.user = true;
  49027. var watcher = new Watcher(vm, expOrFn, cb, options);
  49028. if (options.immediate) {
  49029. try {
  49030. cb.call(vm, watcher.value);
  49031. } catch (error) {
  49032. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  49033. }
  49034. }
  49035. return function unwatchFn () {
  49036. watcher.teardown();
  49037. }
  49038. };
  49039. }
  49040. /* */
  49041. var uid$3 = 0;
  49042. function initMixin (Vue) {
  49043. Vue.prototype._init = function (options) {
  49044. var vm = this;
  49045. // a uid
  49046. vm._uid = uid$3++;
  49047. var startTag, endTag;
  49048. /* istanbul ignore if */
  49049. if (config.performance && mark) {
  49050. startTag = "vue-perf-start:" + (vm._uid);
  49051. endTag = "vue-perf-end:" + (vm._uid);
  49052. mark(startTag);
  49053. }
  49054. // a flag to avoid this being observed
  49055. vm._isVue = true;
  49056. // merge options
  49057. if (options && options._isComponent) {
  49058. // optimize internal component instantiation
  49059. // since dynamic options merging is pretty slow, and none of the
  49060. // internal component options needs special treatment.
  49061. initInternalComponent(vm, options);
  49062. } else {
  49063. vm.$options = mergeOptions(
  49064. resolveConstructorOptions(vm.constructor),
  49065. options || {},
  49066. vm
  49067. );
  49068. }
  49069. /* istanbul ignore else */
  49070. {
  49071. initProxy(vm);
  49072. }
  49073. // expose real self
  49074. vm._self = vm;
  49075. initLifecycle(vm);
  49076. initEvents(vm);
  49077. initRender(vm);
  49078. callHook(vm, 'beforeCreate');
  49079. initInjections(vm); // resolve injections before data/props
  49080. initState(vm);
  49081. initProvide(vm); // resolve provide after data/props
  49082. callHook(vm, 'created');
  49083. /* istanbul ignore if */
  49084. if (config.performance && mark) {
  49085. vm._name = formatComponentName(vm, false);
  49086. mark(endTag);
  49087. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  49088. }
  49089. if (vm.$options.el) {
  49090. vm.$mount(vm.$options.el);
  49091. }
  49092. };
  49093. }
  49094. function initInternalComponent (vm, options) {
  49095. var opts = vm.$options = Object.create(vm.constructor.options);
  49096. // doing this because it's faster than dynamic enumeration.
  49097. var parentVnode = options._parentVnode;
  49098. opts.parent = options.parent;
  49099. opts._parentVnode = parentVnode;
  49100. var vnodeComponentOptions = parentVnode.componentOptions;
  49101. opts.propsData = vnodeComponentOptions.propsData;
  49102. opts._parentListeners = vnodeComponentOptions.listeners;
  49103. opts._renderChildren = vnodeComponentOptions.children;
  49104. opts._componentTag = vnodeComponentOptions.tag;
  49105. if (options.render) {
  49106. opts.render = options.render;
  49107. opts.staticRenderFns = options.staticRenderFns;
  49108. }
  49109. }
  49110. function resolveConstructorOptions (Ctor) {
  49111. var options = Ctor.options;
  49112. if (Ctor.super) {
  49113. var superOptions = resolveConstructorOptions(Ctor.super);
  49114. var cachedSuperOptions = Ctor.superOptions;
  49115. if (superOptions !== cachedSuperOptions) {
  49116. // super option changed,
  49117. // need to resolve new options.
  49118. Ctor.superOptions = superOptions;
  49119. // check if there are any late-modified/attached options (#4976)
  49120. var modifiedOptions = resolveModifiedOptions(Ctor);
  49121. // update base extend options
  49122. if (modifiedOptions) {
  49123. extend(Ctor.extendOptions, modifiedOptions);
  49124. }
  49125. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  49126. if (options.name) {
  49127. options.components[options.name] = Ctor;
  49128. }
  49129. }
  49130. }
  49131. return options
  49132. }
  49133. function resolveModifiedOptions (Ctor) {
  49134. var modified;
  49135. var latest = Ctor.options;
  49136. var sealed = Ctor.sealedOptions;
  49137. for (var key in latest) {
  49138. if (latest[key] !== sealed[key]) {
  49139. if (!modified) { modified = {}; }
  49140. modified[key] = latest[key];
  49141. }
  49142. }
  49143. return modified
  49144. }
  49145. function Vue (options) {
  49146. if (!(this instanceof Vue)
  49147. ) {
  49148. warn('Vue is a constructor and should be called with the `new` keyword');
  49149. }
  49150. this._init(options);
  49151. }
  49152. initMixin(Vue);
  49153. stateMixin(Vue);
  49154. eventsMixin(Vue);
  49155. lifecycleMixin(Vue);
  49156. renderMixin(Vue);
  49157. /* */
  49158. function initUse (Vue) {
  49159. Vue.use = function (plugin) {
  49160. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  49161. if (installedPlugins.indexOf(plugin) > -1) {
  49162. return this
  49163. }
  49164. // additional parameters
  49165. var args = toArray(arguments, 1);
  49166. args.unshift(this);
  49167. if (typeof plugin.install === 'function') {
  49168. plugin.install.apply(plugin, args);
  49169. } else if (typeof plugin === 'function') {
  49170. plugin.apply(null, args);
  49171. }
  49172. installedPlugins.push(plugin);
  49173. return this
  49174. };
  49175. }
  49176. /* */
  49177. function initMixin$1 (Vue) {
  49178. Vue.mixin = function (mixin) {
  49179. this.options = mergeOptions(this.options, mixin);
  49180. return this
  49181. };
  49182. }
  49183. /* */
  49184. function initExtend (Vue) {
  49185. /**
  49186. * Each instance constructor, including Vue, has a unique
  49187. * cid. This enables us to create wrapped "child
  49188. * constructors" for prototypal inheritance and cache them.
  49189. */
  49190. Vue.cid = 0;
  49191. var cid = 1;
  49192. /**
  49193. * Class inheritance
  49194. */
  49195. Vue.extend = function (extendOptions) {
  49196. extendOptions = extendOptions || {};
  49197. var Super = this;
  49198. var SuperId = Super.cid;
  49199. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  49200. if (cachedCtors[SuperId]) {
  49201. return cachedCtors[SuperId]
  49202. }
  49203. var name = extendOptions.name || Super.options.name;
  49204. if (name) {
  49205. validateComponentName(name);
  49206. }
  49207. var Sub = function VueComponent (options) {
  49208. this._init(options);
  49209. };
  49210. Sub.prototype = Object.create(Super.prototype);
  49211. Sub.prototype.constructor = Sub;
  49212. Sub.cid = cid++;
  49213. Sub.options = mergeOptions(
  49214. Super.options,
  49215. extendOptions
  49216. );
  49217. Sub['super'] = Super;
  49218. // For props and computed properties, we define the proxy getters on
  49219. // the Vue instances at extension time, on the extended prototype. This
  49220. // avoids Object.defineProperty calls for each instance created.
  49221. if (Sub.options.props) {
  49222. initProps$1(Sub);
  49223. }
  49224. if (Sub.options.computed) {
  49225. initComputed$1(Sub);
  49226. }
  49227. // allow further extension/mixin/plugin usage
  49228. Sub.extend = Super.extend;
  49229. Sub.mixin = Super.mixin;
  49230. Sub.use = Super.use;
  49231. // create asset registers, so extended classes
  49232. // can have their private assets too.
  49233. ASSET_TYPES.forEach(function (type) {
  49234. Sub[type] = Super[type];
  49235. });
  49236. // enable recursive self-lookup
  49237. if (name) {
  49238. Sub.options.components[name] = Sub;
  49239. }
  49240. // keep a reference to the super options at extension time.
  49241. // later at instantiation we can check if Super's options have
  49242. // been updated.
  49243. Sub.superOptions = Super.options;
  49244. Sub.extendOptions = extendOptions;
  49245. Sub.sealedOptions = extend({}, Sub.options);
  49246. // cache constructor
  49247. cachedCtors[SuperId] = Sub;
  49248. return Sub
  49249. };
  49250. }
  49251. function initProps$1 (Comp) {
  49252. var props = Comp.options.props;
  49253. for (var key in props) {
  49254. proxy(Comp.prototype, "_props", key);
  49255. }
  49256. }
  49257. function initComputed$1 (Comp) {
  49258. var computed = Comp.options.computed;
  49259. for (var key in computed) {
  49260. defineComputed(Comp.prototype, key, computed[key]);
  49261. }
  49262. }
  49263. /* */
  49264. function initAssetRegisters (Vue) {
  49265. /**
  49266. * Create asset registration methods.
  49267. */
  49268. ASSET_TYPES.forEach(function (type) {
  49269. Vue[type] = function (
  49270. id,
  49271. definition
  49272. ) {
  49273. if (!definition) {
  49274. return this.options[type + 's'][id]
  49275. } else {
  49276. /* istanbul ignore if */
  49277. if (type === 'component') {
  49278. validateComponentName(id);
  49279. }
  49280. if (type === 'component' && isPlainObject(definition)) {
  49281. definition.name = definition.name || id;
  49282. definition = this.options._base.extend(definition);
  49283. }
  49284. if (type === 'directive' && typeof definition === 'function') {
  49285. definition = { bind: definition, update: definition };
  49286. }
  49287. this.options[type + 's'][id] = definition;
  49288. return definition
  49289. }
  49290. };
  49291. });
  49292. }
  49293. /* */
  49294. function getComponentName (opts) {
  49295. return opts && (opts.Ctor.options.name || opts.tag)
  49296. }
  49297. function matches (pattern, name) {
  49298. if (Array.isArray(pattern)) {
  49299. return pattern.indexOf(name) > -1
  49300. } else if (typeof pattern === 'string') {
  49301. return pattern.split(',').indexOf(name) > -1
  49302. } else if (isRegExp(pattern)) {
  49303. return pattern.test(name)
  49304. }
  49305. /* istanbul ignore next */
  49306. return false
  49307. }
  49308. function pruneCache (keepAliveInstance, filter) {
  49309. var cache = keepAliveInstance.cache;
  49310. var keys = keepAliveInstance.keys;
  49311. var _vnode = keepAliveInstance._vnode;
  49312. for (var key in cache) {
  49313. var cachedNode = cache[key];
  49314. if (cachedNode) {
  49315. var name = getComponentName(cachedNode.componentOptions);
  49316. if (name && !filter(name)) {
  49317. pruneCacheEntry(cache, key, keys, _vnode);
  49318. }
  49319. }
  49320. }
  49321. }
  49322. function pruneCacheEntry (
  49323. cache,
  49324. key,
  49325. keys,
  49326. current
  49327. ) {
  49328. var cached$$1 = cache[key];
  49329. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  49330. cached$$1.componentInstance.$destroy();
  49331. }
  49332. cache[key] = null;
  49333. remove(keys, key);
  49334. }
  49335. var patternTypes = [String, RegExp, Array];
  49336. var KeepAlive = {
  49337. name: 'keep-alive',
  49338. abstract: true,
  49339. props: {
  49340. include: patternTypes,
  49341. exclude: patternTypes,
  49342. max: [String, Number]
  49343. },
  49344. created: function created () {
  49345. this.cache = Object.create(null);
  49346. this.keys = [];
  49347. },
  49348. destroyed: function destroyed () {
  49349. for (var key in this.cache) {
  49350. pruneCacheEntry(this.cache, key, this.keys);
  49351. }
  49352. },
  49353. mounted: function mounted () {
  49354. var this$1 = this;
  49355. this.$watch('include', function (val) {
  49356. pruneCache(this$1, function (name) { return matches(val, name); });
  49357. });
  49358. this.$watch('exclude', function (val) {
  49359. pruneCache(this$1, function (name) { return !matches(val, name); });
  49360. });
  49361. },
  49362. render: function render () {
  49363. var slot = this.$slots.default;
  49364. var vnode = getFirstComponentChild(slot);
  49365. var componentOptions = vnode && vnode.componentOptions;
  49366. if (componentOptions) {
  49367. // check pattern
  49368. var name = getComponentName(componentOptions);
  49369. var ref = this;
  49370. var include = ref.include;
  49371. var exclude = ref.exclude;
  49372. if (
  49373. // not included
  49374. (include && (!name || !matches(include, name))) ||
  49375. // excluded
  49376. (exclude && name && matches(exclude, name))
  49377. ) {
  49378. return vnode
  49379. }
  49380. var ref$1 = this;
  49381. var cache = ref$1.cache;
  49382. var keys = ref$1.keys;
  49383. var key = vnode.key == null
  49384. // same constructor may get registered as different local components
  49385. // so cid alone is not enough (#3269)
  49386. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  49387. : vnode.key;
  49388. if (cache[key]) {
  49389. vnode.componentInstance = cache[key].componentInstance;
  49390. // make current key freshest
  49391. remove(keys, key);
  49392. keys.push(key);
  49393. } else {
  49394. cache[key] = vnode;
  49395. keys.push(key);
  49396. // prune oldest entry
  49397. if (this.max && keys.length > parseInt(this.max)) {
  49398. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  49399. }
  49400. }
  49401. vnode.data.keepAlive = true;
  49402. }
  49403. return vnode || (slot && slot[0])
  49404. }
  49405. };
  49406. var builtInComponents = {
  49407. KeepAlive: KeepAlive
  49408. };
  49409. /* */
  49410. function initGlobalAPI (Vue) {
  49411. // config
  49412. var configDef = {};
  49413. configDef.get = function () { return config; };
  49414. {
  49415. configDef.set = function () {
  49416. warn(
  49417. 'Do not replace the Vue.config object, set individual fields instead.'
  49418. );
  49419. };
  49420. }
  49421. Object.defineProperty(Vue, 'config', configDef);
  49422. // exposed util methods.
  49423. // NOTE: these are not considered part of the public API - avoid relying on
  49424. // them unless you are aware of the risk.
  49425. Vue.util = {
  49426. warn: warn,
  49427. extend: extend,
  49428. mergeOptions: mergeOptions,
  49429. defineReactive: defineReactive$$1
  49430. };
  49431. Vue.set = set;
  49432. Vue.delete = del;
  49433. Vue.nextTick = nextTick;
  49434. // 2.6 explicit observable API
  49435. Vue.observable = function (obj) {
  49436. observe(obj);
  49437. return obj
  49438. };
  49439. Vue.options = Object.create(null);
  49440. ASSET_TYPES.forEach(function (type) {
  49441. Vue.options[type + 's'] = Object.create(null);
  49442. });
  49443. // this is used to identify the "base" constructor to extend all plain-object
  49444. // components with in Weex's multi-instance scenarios.
  49445. Vue.options._base = Vue;
  49446. extend(Vue.options.components, builtInComponents);
  49447. initUse(Vue);
  49448. initMixin$1(Vue);
  49449. initExtend(Vue);
  49450. initAssetRegisters(Vue);
  49451. }
  49452. initGlobalAPI(Vue);
  49453. Object.defineProperty(Vue.prototype, '$isServer', {
  49454. get: isServerRendering
  49455. });
  49456. Object.defineProperty(Vue.prototype, '$ssrContext', {
  49457. get: function get () {
  49458. /* istanbul ignore next */
  49459. return this.$vnode && this.$vnode.ssrContext
  49460. }
  49461. });
  49462. // expose FunctionalRenderContext for ssr runtime helper installation
  49463. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  49464. value: FunctionalRenderContext
  49465. });
  49466. Vue.version = '2.6.11';
  49467. /* */
  49468. // these are reserved for web because they are directly compiled away
  49469. // during template compilation
  49470. var isReservedAttr = makeMap('style,class');
  49471. // attributes that should be using props for binding
  49472. var acceptValue = makeMap('input,textarea,option,select,progress');
  49473. var mustUseProp = function (tag, type, attr) {
  49474. return (
  49475. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  49476. (attr === 'selected' && tag === 'option') ||
  49477. (attr === 'checked' && tag === 'input') ||
  49478. (attr === 'muted' && tag === 'video')
  49479. )
  49480. };
  49481. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  49482. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  49483. var convertEnumeratedValue = function (key, value) {
  49484. return isFalsyAttrValue(value) || value === 'false'
  49485. ? 'false'
  49486. // allow arbitrary string value for contenteditable
  49487. : key === 'contenteditable' && isValidContentEditableValue(value)
  49488. ? value
  49489. : 'true'
  49490. };
  49491. var isBooleanAttr = makeMap(
  49492. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  49493. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  49494. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  49495. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  49496. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  49497. 'truespeed,typemustmatch,visible'
  49498. );
  49499. var xlinkNS = 'http://www.w3.org/1999/xlink';
  49500. var isXlink = function (name) {
  49501. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  49502. };
  49503. var getXlinkProp = function (name) {
  49504. return isXlink(name) ? name.slice(6, name.length) : ''
  49505. };
  49506. var isFalsyAttrValue = function (val) {
  49507. return val == null || val === false
  49508. };
  49509. /* */
  49510. function genClassForVnode (vnode) {
  49511. var data = vnode.data;
  49512. var parentNode = vnode;
  49513. var childNode = vnode;
  49514. while (isDef(childNode.componentInstance)) {
  49515. childNode = childNode.componentInstance._vnode;
  49516. if (childNode && childNode.data) {
  49517. data = mergeClassData(childNode.data, data);
  49518. }
  49519. }
  49520. while (isDef(parentNode = parentNode.parent)) {
  49521. if (parentNode && parentNode.data) {
  49522. data = mergeClassData(data, parentNode.data);
  49523. }
  49524. }
  49525. return renderClass(data.staticClass, data.class)
  49526. }
  49527. function mergeClassData (child, parent) {
  49528. return {
  49529. staticClass: concat(child.staticClass, parent.staticClass),
  49530. class: isDef(child.class)
  49531. ? [child.class, parent.class]
  49532. : parent.class
  49533. }
  49534. }
  49535. function renderClass (
  49536. staticClass,
  49537. dynamicClass
  49538. ) {
  49539. if (isDef(staticClass) || isDef(dynamicClass)) {
  49540. return concat(staticClass, stringifyClass(dynamicClass))
  49541. }
  49542. /* istanbul ignore next */
  49543. return ''
  49544. }
  49545. function concat (a, b) {
  49546. return a ? b ? (a + ' ' + b) : a : (b || '')
  49547. }
  49548. function stringifyClass (value) {
  49549. if (Array.isArray(value)) {
  49550. return stringifyArray(value)
  49551. }
  49552. if (isObject(value)) {
  49553. return stringifyObject(value)
  49554. }
  49555. if (typeof value === 'string') {
  49556. return value
  49557. }
  49558. /* istanbul ignore next */
  49559. return ''
  49560. }
  49561. function stringifyArray (value) {
  49562. var res = '';
  49563. var stringified;
  49564. for (var i = 0, l = value.length; i < l; i++) {
  49565. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  49566. if (res) { res += ' '; }
  49567. res += stringified;
  49568. }
  49569. }
  49570. return res
  49571. }
  49572. function stringifyObject (value) {
  49573. var res = '';
  49574. for (var key in value) {
  49575. if (value[key]) {
  49576. if (res) { res += ' '; }
  49577. res += key;
  49578. }
  49579. }
  49580. return res
  49581. }
  49582. /* */
  49583. var namespaceMap = {
  49584. svg: 'http://www.w3.org/2000/svg',
  49585. math: 'http://www.w3.org/1998/Math/MathML'
  49586. };
  49587. var isHTMLTag = makeMap(
  49588. 'html,body,base,head,link,meta,style,title,' +
  49589. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  49590. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  49591. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  49592. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  49593. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  49594. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  49595. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  49596. 'output,progress,select,textarea,' +
  49597. 'details,dialog,menu,menuitem,summary,' +
  49598. 'content,element,shadow,template,blockquote,iframe,tfoot'
  49599. );
  49600. // this map is intentionally selective, only covering SVG elements that may
  49601. // contain child elements.
  49602. var isSVG = makeMap(
  49603. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  49604. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  49605. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  49606. true
  49607. );
  49608. var isPreTag = function (tag) { return tag === 'pre'; };
  49609. var isReservedTag = function (tag) {
  49610. return isHTMLTag(tag) || isSVG(tag)
  49611. };
  49612. function getTagNamespace (tag) {
  49613. if (isSVG(tag)) {
  49614. return 'svg'
  49615. }
  49616. // basic support for MathML
  49617. // note it doesn't support other MathML elements being component roots
  49618. if (tag === 'math') {
  49619. return 'math'
  49620. }
  49621. }
  49622. var unknownElementCache = Object.create(null);
  49623. function isUnknownElement (tag) {
  49624. /* istanbul ignore if */
  49625. if (!inBrowser) {
  49626. return true
  49627. }
  49628. if (isReservedTag(tag)) {
  49629. return false
  49630. }
  49631. tag = tag.toLowerCase();
  49632. /* istanbul ignore if */
  49633. if (unknownElementCache[tag] != null) {
  49634. return unknownElementCache[tag]
  49635. }
  49636. var el = document.createElement(tag);
  49637. if (tag.indexOf('-') > -1) {
  49638. // http://stackoverflow.com/a/28210364/1070244
  49639. return (unknownElementCache[tag] = (
  49640. el.constructor === window.HTMLUnknownElement ||
  49641. el.constructor === window.HTMLElement
  49642. ))
  49643. } else {
  49644. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  49645. }
  49646. }
  49647. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  49648. /* */
  49649. /**
  49650. * Query an element selector if it's not an element already.
  49651. */
  49652. function query (el) {
  49653. if (typeof el === 'string') {
  49654. var selected = document.querySelector(el);
  49655. if (!selected) {
  49656. warn(
  49657. 'Cannot find element: ' + el
  49658. );
  49659. return document.createElement('div')
  49660. }
  49661. return selected
  49662. } else {
  49663. return el
  49664. }
  49665. }
  49666. /* */
  49667. function createElement$1 (tagName, vnode) {
  49668. var elm = document.createElement(tagName);
  49669. if (tagName !== 'select') {
  49670. return elm
  49671. }
  49672. // false or null will remove the attribute but undefined will not
  49673. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  49674. elm.setAttribute('multiple', 'multiple');
  49675. }
  49676. return elm
  49677. }
  49678. function createElementNS (namespace, tagName) {
  49679. return document.createElementNS(namespaceMap[namespace], tagName)
  49680. }
  49681. function createTextNode (text) {
  49682. return document.createTextNode(text)
  49683. }
  49684. function createComment (text) {
  49685. return document.createComment(text)
  49686. }
  49687. function insertBefore (parentNode, newNode, referenceNode) {
  49688. parentNode.insertBefore(newNode, referenceNode);
  49689. }
  49690. function removeChild (node, child) {
  49691. node.removeChild(child);
  49692. }
  49693. function appendChild (node, child) {
  49694. node.appendChild(child);
  49695. }
  49696. function parentNode (node) {
  49697. return node.parentNode
  49698. }
  49699. function nextSibling (node) {
  49700. return node.nextSibling
  49701. }
  49702. function tagName (node) {
  49703. return node.tagName
  49704. }
  49705. function setTextContent (node, text) {
  49706. node.textContent = text;
  49707. }
  49708. function setStyleScope (node, scopeId) {
  49709. node.setAttribute(scopeId, '');
  49710. }
  49711. var nodeOps = /*#__PURE__*/Object.freeze({
  49712. createElement: createElement$1,
  49713. createElementNS: createElementNS,
  49714. createTextNode: createTextNode,
  49715. createComment: createComment,
  49716. insertBefore: insertBefore,
  49717. removeChild: removeChild,
  49718. appendChild: appendChild,
  49719. parentNode: parentNode,
  49720. nextSibling: nextSibling,
  49721. tagName: tagName,
  49722. setTextContent: setTextContent,
  49723. setStyleScope: setStyleScope
  49724. });
  49725. /* */
  49726. var ref = {
  49727. create: function create (_, vnode) {
  49728. registerRef(vnode);
  49729. },
  49730. update: function update (oldVnode, vnode) {
  49731. if (oldVnode.data.ref !== vnode.data.ref) {
  49732. registerRef(oldVnode, true);
  49733. registerRef(vnode);
  49734. }
  49735. },
  49736. destroy: function destroy (vnode) {
  49737. registerRef(vnode, true);
  49738. }
  49739. };
  49740. function registerRef (vnode, isRemoval) {
  49741. var key = vnode.data.ref;
  49742. if (!isDef(key)) { return }
  49743. var vm = vnode.context;
  49744. var ref = vnode.componentInstance || vnode.elm;
  49745. var refs = vm.$refs;
  49746. if (isRemoval) {
  49747. if (Array.isArray(refs[key])) {
  49748. remove(refs[key], ref);
  49749. } else if (refs[key] === ref) {
  49750. refs[key] = undefined;
  49751. }
  49752. } else {
  49753. if (vnode.data.refInFor) {
  49754. if (!Array.isArray(refs[key])) {
  49755. refs[key] = [ref];
  49756. } else if (refs[key].indexOf(ref) < 0) {
  49757. // $flow-disable-line
  49758. refs[key].push(ref);
  49759. }
  49760. } else {
  49761. refs[key] = ref;
  49762. }
  49763. }
  49764. }
  49765. /**
  49766. * Virtual DOM patching algorithm based on Snabbdom by
  49767. * Simon Friis Vindum (@paldepind)
  49768. * Licensed under the MIT License
  49769. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  49770. *
  49771. * modified by Evan You (@yyx990803)
  49772. *
  49773. * Not type-checking this because this file is perf-critical and the cost
  49774. * of making flow understand it is not worth it.
  49775. */
  49776. var emptyNode = new VNode('', {}, []);
  49777. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  49778. function sameVnode (a, b) {
  49779. return (
  49780. a.key === b.key && (
  49781. (
  49782. a.tag === b.tag &&
  49783. a.isComment === b.isComment &&
  49784. isDef(a.data) === isDef(b.data) &&
  49785. sameInputType(a, b)
  49786. ) || (
  49787. isTrue(a.isAsyncPlaceholder) &&
  49788. a.asyncFactory === b.asyncFactory &&
  49789. isUndef(b.asyncFactory.error)
  49790. )
  49791. )
  49792. )
  49793. }
  49794. function sameInputType (a, b) {
  49795. if (a.tag !== 'input') { return true }
  49796. var i;
  49797. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  49798. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  49799. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  49800. }
  49801. function createKeyToOldIdx (children, beginIdx, endIdx) {
  49802. var i, key;
  49803. var map = {};
  49804. for (i = beginIdx; i <= endIdx; ++i) {
  49805. key = children[i].key;
  49806. if (isDef(key)) { map[key] = i; }
  49807. }
  49808. return map
  49809. }
  49810. function createPatchFunction (backend) {
  49811. var i, j;
  49812. var cbs = {};
  49813. var modules = backend.modules;
  49814. var nodeOps = backend.nodeOps;
  49815. for (i = 0; i < hooks.length; ++i) {
  49816. cbs[hooks[i]] = [];
  49817. for (j = 0; j < modules.length; ++j) {
  49818. if (isDef(modules[j][hooks[i]])) {
  49819. cbs[hooks[i]].push(modules[j][hooks[i]]);
  49820. }
  49821. }
  49822. }
  49823. function emptyNodeAt (elm) {
  49824. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  49825. }
  49826. function createRmCb (childElm, listeners) {
  49827. function remove$$1 () {
  49828. if (--remove$$1.listeners === 0) {
  49829. removeNode(childElm);
  49830. }
  49831. }
  49832. remove$$1.listeners = listeners;
  49833. return remove$$1
  49834. }
  49835. function removeNode (el) {
  49836. var parent = nodeOps.parentNode(el);
  49837. // element may have already been removed due to v-html / v-text
  49838. if (isDef(parent)) {
  49839. nodeOps.removeChild(parent, el);
  49840. }
  49841. }
  49842. function isUnknownElement$$1 (vnode, inVPre) {
  49843. return (
  49844. !inVPre &&
  49845. !vnode.ns &&
  49846. !(
  49847. config.ignoredElements.length &&
  49848. config.ignoredElements.some(function (ignore) {
  49849. return isRegExp(ignore)
  49850. ? ignore.test(vnode.tag)
  49851. : ignore === vnode.tag
  49852. })
  49853. ) &&
  49854. config.isUnknownElement(vnode.tag)
  49855. )
  49856. }
  49857. var creatingElmInVPre = 0;
  49858. function createElm (
  49859. vnode,
  49860. insertedVnodeQueue,
  49861. parentElm,
  49862. refElm,
  49863. nested,
  49864. ownerArray,
  49865. index
  49866. ) {
  49867. if (isDef(vnode.elm) && isDef(ownerArray)) {
  49868. // This vnode was used in a previous render!
  49869. // now it's used as a new node, overwriting its elm would cause
  49870. // potential patch errors down the road when it's used as an insertion
  49871. // reference node. Instead, we clone the node on-demand before creating
  49872. // associated DOM element for it.
  49873. vnode = ownerArray[index] = cloneVNode(vnode);
  49874. }
  49875. vnode.isRootInsert = !nested; // for transition enter check
  49876. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  49877. return
  49878. }
  49879. var data = vnode.data;
  49880. var children = vnode.children;
  49881. var tag = vnode.tag;
  49882. if (isDef(tag)) {
  49883. {
  49884. if (data && data.pre) {
  49885. creatingElmInVPre++;
  49886. }
  49887. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  49888. warn(
  49889. 'Unknown custom element: <' + tag + '> - did you ' +
  49890. 'register the component correctly? For recursive components, ' +
  49891. 'make sure to provide the "name" option.',
  49892. vnode.context
  49893. );
  49894. }
  49895. }
  49896. vnode.elm = vnode.ns
  49897. ? nodeOps.createElementNS(vnode.ns, tag)
  49898. : nodeOps.createElement(tag, vnode);
  49899. setScope(vnode);
  49900. /* istanbul ignore if */
  49901. {
  49902. createChildren(vnode, children, insertedVnodeQueue);
  49903. if (isDef(data)) {
  49904. invokeCreateHooks(vnode, insertedVnodeQueue);
  49905. }
  49906. insert(parentElm, vnode.elm, refElm);
  49907. }
  49908. if (data && data.pre) {
  49909. creatingElmInVPre--;
  49910. }
  49911. } else if (isTrue(vnode.isComment)) {
  49912. vnode.elm = nodeOps.createComment(vnode.text);
  49913. insert(parentElm, vnode.elm, refElm);
  49914. } else {
  49915. vnode.elm = nodeOps.createTextNode(vnode.text);
  49916. insert(parentElm, vnode.elm, refElm);
  49917. }
  49918. }
  49919. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  49920. var i = vnode.data;
  49921. if (isDef(i)) {
  49922. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  49923. if (isDef(i = i.hook) && isDef(i = i.init)) {
  49924. i(vnode, false /* hydrating */);
  49925. }
  49926. // after calling the init hook, if the vnode is a child component
  49927. // it should've created a child instance and mounted it. the child
  49928. // component also has set the placeholder vnode's elm.
  49929. // in that case we can just return the element and be done.
  49930. if (isDef(vnode.componentInstance)) {
  49931. initComponent(vnode, insertedVnodeQueue);
  49932. insert(parentElm, vnode.elm, refElm);
  49933. if (isTrue(isReactivated)) {
  49934. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  49935. }
  49936. return true
  49937. }
  49938. }
  49939. }
  49940. function initComponent (vnode, insertedVnodeQueue) {
  49941. if (isDef(vnode.data.pendingInsert)) {
  49942. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  49943. vnode.data.pendingInsert = null;
  49944. }
  49945. vnode.elm = vnode.componentInstance.$el;
  49946. if (isPatchable(vnode)) {
  49947. invokeCreateHooks(vnode, insertedVnodeQueue);
  49948. setScope(vnode);
  49949. } else {
  49950. // empty component root.
  49951. // skip all element-related modules except for ref (#3455)
  49952. registerRef(vnode);
  49953. // make sure to invoke the insert hook
  49954. insertedVnodeQueue.push(vnode);
  49955. }
  49956. }
  49957. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  49958. var i;
  49959. // hack for #4339: a reactivated component with inner transition
  49960. // does not trigger because the inner node's created hooks are not called
  49961. // again. It's not ideal to involve module-specific logic in here but
  49962. // there doesn't seem to be a better way to do it.
  49963. var innerNode = vnode;
  49964. while (innerNode.componentInstance) {
  49965. innerNode = innerNode.componentInstance._vnode;
  49966. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  49967. for (i = 0; i < cbs.activate.length; ++i) {
  49968. cbs.activate[i](emptyNode, innerNode);
  49969. }
  49970. insertedVnodeQueue.push(innerNode);
  49971. break
  49972. }
  49973. }
  49974. // unlike a newly created component,
  49975. // a reactivated keep-alive component doesn't insert itself
  49976. insert(parentElm, vnode.elm, refElm);
  49977. }
  49978. function insert (parent, elm, ref$$1) {
  49979. if (isDef(parent)) {
  49980. if (isDef(ref$$1)) {
  49981. if (nodeOps.parentNode(ref$$1) === parent) {
  49982. nodeOps.insertBefore(parent, elm, ref$$1);
  49983. }
  49984. } else {
  49985. nodeOps.appendChild(parent, elm);
  49986. }
  49987. }
  49988. }
  49989. function createChildren (vnode, children, insertedVnodeQueue) {
  49990. if (Array.isArray(children)) {
  49991. {
  49992. checkDuplicateKeys(children);
  49993. }
  49994. for (var i = 0; i < children.length; ++i) {
  49995. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  49996. }
  49997. } else if (isPrimitive(vnode.text)) {
  49998. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  49999. }
  50000. }
  50001. function isPatchable (vnode) {
  50002. while (vnode.componentInstance) {
  50003. vnode = vnode.componentInstance._vnode;
  50004. }
  50005. return isDef(vnode.tag)
  50006. }
  50007. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  50008. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  50009. cbs.create[i$1](emptyNode, vnode);
  50010. }
  50011. i = vnode.data.hook; // Reuse variable
  50012. if (isDef(i)) {
  50013. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  50014. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  50015. }
  50016. }
  50017. // set scope id attribute for scoped CSS.
  50018. // this is implemented as a special case to avoid the overhead
  50019. // of going through the normal attribute patching process.
  50020. function setScope (vnode) {
  50021. var i;
  50022. if (isDef(i = vnode.fnScopeId)) {
  50023. nodeOps.setStyleScope(vnode.elm, i);
  50024. } else {
  50025. var ancestor = vnode;
  50026. while (ancestor) {
  50027. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  50028. nodeOps.setStyleScope(vnode.elm, i);
  50029. }
  50030. ancestor = ancestor.parent;
  50031. }
  50032. }
  50033. // for slot content they should also get the scopeId from the host instance.
  50034. if (isDef(i = activeInstance) &&
  50035. i !== vnode.context &&
  50036. i !== vnode.fnContext &&
  50037. isDef(i = i.$options._scopeId)
  50038. ) {
  50039. nodeOps.setStyleScope(vnode.elm, i);
  50040. }
  50041. }
  50042. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  50043. for (; startIdx <= endIdx; ++startIdx) {
  50044. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  50045. }
  50046. }
  50047. function invokeDestroyHook (vnode) {
  50048. var i, j;
  50049. var data = vnode.data;
  50050. if (isDef(data)) {
  50051. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  50052. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  50053. }
  50054. if (isDef(i = vnode.children)) {
  50055. for (j = 0; j < vnode.children.length; ++j) {
  50056. invokeDestroyHook(vnode.children[j]);
  50057. }
  50058. }
  50059. }
  50060. function removeVnodes (vnodes, startIdx, endIdx) {
  50061. for (; startIdx <= endIdx; ++startIdx) {
  50062. var ch = vnodes[startIdx];
  50063. if (isDef(ch)) {
  50064. if (isDef(ch.tag)) {
  50065. removeAndInvokeRemoveHook(ch);
  50066. invokeDestroyHook(ch);
  50067. } else { // Text node
  50068. removeNode(ch.elm);
  50069. }
  50070. }
  50071. }
  50072. }
  50073. function removeAndInvokeRemoveHook (vnode, rm) {
  50074. if (isDef(rm) || isDef(vnode.data)) {
  50075. var i;
  50076. var listeners = cbs.remove.length + 1;
  50077. if (isDef(rm)) {
  50078. // we have a recursively passed down rm callback
  50079. // increase the listeners count
  50080. rm.listeners += listeners;
  50081. } else {
  50082. // directly removing
  50083. rm = createRmCb(vnode.elm, listeners);
  50084. }
  50085. // recursively invoke hooks on child component root node
  50086. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  50087. removeAndInvokeRemoveHook(i, rm);
  50088. }
  50089. for (i = 0; i < cbs.remove.length; ++i) {
  50090. cbs.remove[i](vnode, rm);
  50091. }
  50092. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  50093. i(vnode, rm);
  50094. } else {
  50095. rm();
  50096. }
  50097. } else {
  50098. removeNode(vnode.elm);
  50099. }
  50100. }
  50101. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  50102. var oldStartIdx = 0;
  50103. var newStartIdx = 0;
  50104. var oldEndIdx = oldCh.length - 1;
  50105. var oldStartVnode = oldCh[0];
  50106. var oldEndVnode = oldCh[oldEndIdx];
  50107. var newEndIdx = newCh.length - 1;
  50108. var newStartVnode = newCh[0];
  50109. var newEndVnode = newCh[newEndIdx];
  50110. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  50111. // removeOnly is a special flag used only by <transition-group>
  50112. // to ensure removed elements stay in correct relative positions
  50113. // during leaving transitions
  50114. var canMove = !removeOnly;
  50115. {
  50116. checkDuplicateKeys(newCh);
  50117. }
  50118. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  50119. if (isUndef(oldStartVnode)) {
  50120. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  50121. } else if (isUndef(oldEndVnode)) {
  50122. oldEndVnode = oldCh[--oldEndIdx];
  50123. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  50124. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50125. oldStartVnode = oldCh[++oldStartIdx];
  50126. newStartVnode = newCh[++newStartIdx];
  50127. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  50128. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  50129. oldEndVnode = oldCh[--oldEndIdx];
  50130. newEndVnode = newCh[--newEndIdx];
  50131. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  50132. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  50133. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  50134. oldStartVnode = oldCh[++oldStartIdx];
  50135. newEndVnode = newCh[--newEndIdx];
  50136. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  50137. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50138. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  50139. oldEndVnode = oldCh[--oldEndIdx];
  50140. newStartVnode = newCh[++newStartIdx];
  50141. } else {
  50142. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  50143. idxInOld = isDef(newStartVnode.key)
  50144. ? oldKeyToIdx[newStartVnode.key]
  50145. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  50146. if (isUndef(idxInOld)) { // New element
  50147. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  50148. } else {
  50149. vnodeToMove = oldCh[idxInOld];
  50150. if (sameVnode(vnodeToMove, newStartVnode)) {
  50151. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50152. oldCh[idxInOld] = undefined;
  50153. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  50154. } else {
  50155. // same key but different element. treat as new element
  50156. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  50157. }
  50158. }
  50159. newStartVnode = newCh[++newStartIdx];
  50160. }
  50161. }
  50162. if (oldStartIdx > oldEndIdx) {
  50163. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  50164. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  50165. } else if (newStartIdx > newEndIdx) {
  50166. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  50167. }
  50168. }
  50169. function checkDuplicateKeys (children) {
  50170. var seenKeys = {};
  50171. for (var i = 0; i < children.length; i++) {
  50172. var vnode = children[i];
  50173. var key = vnode.key;
  50174. if (isDef(key)) {
  50175. if (seenKeys[key]) {
  50176. warn(
  50177. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  50178. vnode.context
  50179. );
  50180. } else {
  50181. seenKeys[key] = true;
  50182. }
  50183. }
  50184. }
  50185. }
  50186. function findIdxInOld (node, oldCh, start, end) {
  50187. for (var i = start; i < end; i++) {
  50188. var c = oldCh[i];
  50189. if (isDef(c) && sameVnode(node, c)) { return i }
  50190. }
  50191. }
  50192. function patchVnode (
  50193. oldVnode,
  50194. vnode,
  50195. insertedVnodeQueue,
  50196. ownerArray,
  50197. index,
  50198. removeOnly
  50199. ) {
  50200. if (oldVnode === vnode) {
  50201. return
  50202. }
  50203. if (isDef(vnode.elm) && isDef(ownerArray)) {
  50204. // clone reused vnode
  50205. vnode = ownerArray[index] = cloneVNode(vnode);
  50206. }
  50207. var elm = vnode.elm = oldVnode.elm;
  50208. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  50209. if (isDef(vnode.asyncFactory.resolved)) {
  50210. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  50211. } else {
  50212. vnode.isAsyncPlaceholder = true;
  50213. }
  50214. return
  50215. }
  50216. // reuse element for static trees.
  50217. // note we only do this if the vnode is cloned -
  50218. // if the new node is not cloned it means the render functions have been
  50219. // reset by the hot-reload-api and we need to do a proper re-render.
  50220. if (isTrue(vnode.isStatic) &&
  50221. isTrue(oldVnode.isStatic) &&
  50222. vnode.key === oldVnode.key &&
  50223. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  50224. ) {
  50225. vnode.componentInstance = oldVnode.componentInstance;
  50226. return
  50227. }
  50228. var i;
  50229. var data = vnode.data;
  50230. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  50231. i(oldVnode, vnode);
  50232. }
  50233. var oldCh = oldVnode.children;
  50234. var ch = vnode.children;
  50235. if (isDef(data) && isPatchable(vnode)) {
  50236. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  50237. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  50238. }
  50239. if (isUndef(vnode.text)) {
  50240. if (isDef(oldCh) && isDef(ch)) {
  50241. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  50242. } else if (isDef(ch)) {
  50243. {
  50244. checkDuplicateKeys(ch);
  50245. }
  50246. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  50247. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  50248. } else if (isDef(oldCh)) {
  50249. removeVnodes(oldCh, 0, oldCh.length - 1);
  50250. } else if (isDef(oldVnode.text)) {
  50251. nodeOps.setTextContent(elm, '');
  50252. }
  50253. } else if (oldVnode.text !== vnode.text) {
  50254. nodeOps.setTextContent(elm, vnode.text);
  50255. }
  50256. if (isDef(data)) {
  50257. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  50258. }
  50259. }
  50260. function invokeInsertHook (vnode, queue, initial) {
  50261. // delay insert hooks for component root nodes, invoke them after the
  50262. // element is really inserted
  50263. if (isTrue(initial) && isDef(vnode.parent)) {
  50264. vnode.parent.data.pendingInsert = queue;
  50265. } else {
  50266. for (var i = 0; i < queue.length; ++i) {
  50267. queue[i].data.hook.insert(queue[i]);
  50268. }
  50269. }
  50270. }
  50271. var hydrationBailed = false;
  50272. // list of modules that can skip create hook during hydration because they
  50273. // are already rendered on the client or has no need for initialization
  50274. // Note: style is excluded because it relies on initial clone for future
  50275. // deep updates (#7063).
  50276. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  50277. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  50278. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  50279. var i;
  50280. var tag = vnode.tag;
  50281. var data = vnode.data;
  50282. var children = vnode.children;
  50283. inVPre = inVPre || (data && data.pre);
  50284. vnode.elm = elm;
  50285. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  50286. vnode.isAsyncPlaceholder = true;
  50287. return true
  50288. }
  50289. // assert node match
  50290. {
  50291. if (!assertNodeMatch(elm, vnode, inVPre)) {
  50292. return false
  50293. }
  50294. }
  50295. if (isDef(data)) {
  50296. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  50297. if (isDef(i = vnode.componentInstance)) {
  50298. // child component. it should have hydrated its own tree.
  50299. initComponent(vnode, insertedVnodeQueue);
  50300. return true
  50301. }
  50302. }
  50303. if (isDef(tag)) {
  50304. if (isDef(children)) {
  50305. // empty element, allow client to pick up and populate children
  50306. if (!elm.hasChildNodes()) {
  50307. createChildren(vnode, children, insertedVnodeQueue);
  50308. } else {
  50309. // v-html and domProps: innerHTML
  50310. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  50311. if (i !== elm.innerHTML) {
  50312. /* istanbul ignore if */
  50313. if (typeof console !== 'undefined' &&
  50314. !hydrationBailed
  50315. ) {
  50316. hydrationBailed = true;
  50317. console.warn('Parent: ', elm);
  50318. console.warn('server innerHTML: ', i);
  50319. console.warn('client innerHTML: ', elm.innerHTML);
  50320. }
  50321. return false
  50322. }
  50323. } else {
  50324. // iterate and compare children lists
  50325. var childrenMatch = true;
  50326. var childNode = elm.firstChild;
  50327. for (var i$1 = 0; i$1 < children.length; i$1++) {
  50328. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  50329. childrenMatch = false;
  50330. break
  50331. }
  50332. childNode = childNode.nextSibling;
  50333. }
  50334. // if childNode is not null, it means the actual childNodes list is
  50335. // longer than the virtual children list.
  50336. if (!childrenMatch || childNode) {
  50337. /* istanbul ignore if */
  50338. if (typeof console !== 'undefined' &&
  50339. !hydrationBailed
  50340. ) {
  50341. hydrationBailed = true;
  50342. console.warn('Parent: ', elm);
  50343. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  50344. }
  50345. return false
  50346. }
  50347. }
  50348. }
  50349. }
  50350. if (isDef(data)) {
  50351. var fullInvoke = false;
  50352. for (var key in data) {
  50353. if (!isRenderedModule(key)) {
  50354. fullInvoke = true;
  50355. invokeCreateHooks(vnode, insertedVnodeQueue);
  50356. break
  50357. }
  50358. }
  50359. if (!fullInvoke && data['class']) {
  50360. // ensure collecting deps for deep class bindings for future updates
  50361. traverse(data['class']);
  50362. }
  50363. }
  50364. } else if (elm.data !== vnode.text) {
  50365. elm.data = vnode.text;
  50366. }
  50367. return true
  50368. }
  50369. function assertNodeMatch (node, vnode, inVPre) {
  50370. if (isDef(vnode.tag)) {
  50371. return vnode.tag.indexOf('vue-component') === 0 || (
  50372. !isUnknownElement$$1(vnode, inVPre) &&
  50373. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  50374. )
  50375. } else {
  50376. return node.nodeType === (vnode.isComment ? 8 : 3)
  50377. }
  50378. }
  50379. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  50380. if (isUndef(vnode)) {
  50381. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  50382. return
  50383. }
  50384. var isInitialPatch = false;
  50385. var insertedVnodeQueue = [];
  50386. if (isUndef(oldVnode)) {
  50387. // empty mount (likely as component), create new root element
  50388. isInitialPatch = true;
  50389. createElm(vnode, insertedVnodeQueue);
  50390. } else {
  50391. var isRealElement = isDef(oldVnode.nodeType);
  50392. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  50393. // patch existing root node
  50394. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  50395. } else {
  50396. if (isRealElement) {
  50397. // mounting to a real element
  50398. // check if this is server-rendered content and if we can perform
  50399. // a successful hydration.
  50400. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  50401. oldVnode.removeAttribute(SSR_ATTR);
  50402. hydrating = true;
  50403. }
  50404. if (isTrue(hydrating)) {
  50405. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  50406. invokeInsertHook(vnode, insertedVnodeQueue, true);
  50407. return oldVnode
  50408. } else {
  50409. warn(
  50410. 'The client-side rendered virtual DOM tree is not matching ' +
  50411. 'server-rendered content. This is likely caused by incorrect ' +
  50412. 'HTML markup, for example nesting block-level elements inside ' +
  50413. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  50414. 'full client-side render.'
  50415. );
  50416. }
  50417. }
  50418. // either not server-rendered, or hydration failed.
  50419. // create an empty node and replace it
  50420. oldVnode = emptyNodeAt(oldVnode);
  50421. }
  50422. // replacing existing element
  50423. var oldElm = oldVnode.elm;
  50424. var parentElm = nodeOps.parentNode(oldElm);
  50425. // create new node
  50426. createElm(
  50427. vnode,
  50428. insertedVnodeQueue,
  50429. // extremely rare edge case: do not insert if old element is in a
  50430. // leaving transition. Only happens when combining transition +
  50431. // keep-alive + HOCs. (#4590)
  50432. oldElm._leaveCb ? null : parentElm,
  50433. nodeOps.nextSibling(oldElm)
  50434. );
  50435. // update parent placeholder node element, recursively
  50436. if (isDef(vnode.parent)) {
  50437. var ancestor = vnode.parent;
  50438. var patchable = isPatchable(vnode);
  50439. while (ancestor) {
  50440. for (var i = 0; i < cbs.destroy.length; ++i) {
  50441. cbs.destroy[i](ancestor);
  50442. }
  50443. ancestor.elm = vnode.elm;
  50444. if (patchable) {
  50445. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  50446. cbs.create[i$1](emptyNode, ancestor);
  50447. }
  50448. // #6513
  50449. // invoke insert hooks that may have been merged by create hooks.
  50450. // e.g. for directives that uses the "inserted" hook.
  50451. var insert = ancestor.data.hook.insert;
  50452. if (insert.merged) {
  50453. // start at index 1 to avoid re-invoking component mounted hook
  50454. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  50455. insert.fns[i$2]();
  50456. }
  50457. }
  50458. } else {
  50459. registerRef(ancestor);
  50460. }
  50461. ancestor = ancestor.parent;
  50462. }
  50463. }
  50464. // destroy old node
  50465. if (isDef(parentElm)) {
  50466. removeVnodes([oldVnode], 0, 0);
  50467. } else if (isDef(oldVnode.tag)) {
  50468. invokeDestroyHook(oldVnode);
  50469. }
  50470. }
  50471. }
  50472. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  50473. return vnode.elm
  50474. }
  50475. }
  50476. /* */
  50477. var directives = {
  50478. create: updateDirectives,
  50479. update: updateDirectives,
  50480. destroy: function unbindDirectives (vnode) {
  50481. updateDirectives(vnode, emptyNode);
  50482. }
  50483. };
  50484. function updateDirectives (oldVnode, vnode) {
  50485. if (oldVnode.data.directives || vnode.data.directives) {
  50486. _update(oldVnode, vnode);
  50487. }
  50488. }
  50489. function _update (oldVnode, vnode) {
  50490. var isCreate = oldVnode === emptyNode;
  50491. var isDestroy = vnode === emptyNode;
  50492. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  50493. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  50494. var dirsWithInsert = [];
  50495. var dirsWithPostpatch = [];
  50496. var key, oldDir, dir;
  50497. for (key in newDirs) {
  50498. oldDir = oldDirs[key];
  50499. dir = newDirs[key];
  50500. if (!oldDir) {
  50501. // new directive, bind
  50502. callHook$1(dir, 'bind', vnode, oldVnode);
  50503. if (dir.def && dir.def.inserted) {
  50504. dirsWithInsert.push(dir);
  50505. }
  50506. } else {
  50507. // existing directive, update
  50508. dir.oldValue = oldDir.value;
  50509. dir.oldArg = oldDir.arg;
  50510. callHook$1(dir, 'update', vnode, oldVnode);
  50511. if (dir.def && dir.def.componentUpdated) {
  50512. dirsWithPostpatch.push(dir);
  50513. }
  50514. }
  50515. }
  50516. if (dirsWithInsert.length) {
  50517. var callInsert = function () {
  50518. for (var i = 0; i < dirsWithInsert.length; i++) {
  50519. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  50520. }
  50521. };
  50522. if (isCreate) {
  50523. mergeVNodeHook(vnode, 'insert', callInsert);
  50524. } else {
  50525. callInsert();
  50526. }
  50527. }
  50528. if (dirsWithPostpatch.length) {
  50529. mergeVNodeHook(vnode, 'postpatch', function () {
  50530. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  50531. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  50532. }
  50533. });
  50534. }
  50535. if (!isCreate) {
  50536. for (key in oldDirs) {
  50537. if (!newDirs[key]) {
  50538. // no longer present, unbind
  50539. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  50540. }
  50541. }
  50542. }
  50543. }
  50544. var emptyModifiers = Object.create(null);
  50545. function normalizeDirectives$1 (
  50546. dirs,
  50547. vm
  50548. ) {
  50549. var res = Object.create(null);
  50550. if (!dirs) {
  50551. // $flow-disable-line
  50552. return res
  50553. }
  50554. var i, dir;
  50555. for (i = 0; i < dirs.length; i++) {
  50556. dir = dirs[i];
  50557. if (!dir.modifiers) {
  50558. // $flow-disable-line
  50559. dir.modifiers = emptyModifiers;
  50560. }
  50561. res[getRawDirName(dir)] = dir;
  50562. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  50563. }
  50564. // $flow-disable-line
  50565. return res
  50566. }
  50567. function getRawDirName (dir) {
  50568. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  50569. }
  50570. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  50571. var fn = dir.def && dir.def[hook];
  50572. if (fn) {
  50573. try {
  50574. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  50575. } catch (e) {
  50576. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  50577. }
  50578. }
  50579. }
  50580. var baseModules = [
  50581. ref,
  50582. directives
  50583. ];
  50584. /* */
  50585. function updateAttrs (oldVnode, vnode) {
  50586. var opts = vnode.componentOptions;
  50587. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  50588. return
  50589. }
  50590. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  50591. return
  50592. }
  50593. var key, cur, old;
  50594. var elm = vnode.elm;
  50595. var oldAttrs = oldVnode.data.attrs || {};
  50596. var attrs = vnode.data.attrs || {};
  50597. // clone observed objects, as the user probably wants to mutate it
  50598. if (isDef(attrs.__ob__)) {
  50599. attrs = vnode.data.attrs = extend({}, attrs);
  50600. }
  50601. for (key in attrs) {
  50602. cur = attrs[key];
  50603. old = oldAttrs[key];
  50604. if (old !== cur) {
  50605. setAttr(elm, key, cur);
  50606. }
  50607. }
  50608. // #4391: in IE9, setting type can reset value for input[type=radio]
  50609. // #6666: IE/Edge forces progress value down to 1 before setting a max
  50610. /* istanbul ignore if */
  50611. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  50612. setAttr(elm, 'value', attrs.value);
  50613. }
  50614. for (key in oldAttrs) {
  50615. if (isUndef(attrs[key])) {
  50616. if (isXlink(key)) {
  50617. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50618. } else if (!isEnumeratedAttr(key)) {
  50619. elm.removeAttribute(key);
  50620. }
  50621. }
  50622. }
  50623. }
  50624. function setAttr (el, key, value) {
  50625. if (el.tagName.indexOf('-') > -1) {
  50626. baseSetAttr(el, key, value);
  50627. } else if (isBooleanAttr(key)) {
  50628. // set attribute for blank value
  50629. // e.g. <option disabled>Select one</option>
  50630. if (isFalsyAttrValue(value)) {
  50631. el.removeAttribute(key);
  50632. } else {
  50633. // technically allowfullscreen is a boolean attribute for <iframe>,
  50634. // but Flash expects a value of "true" when used on <embed> tag
  50635. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  50636. ? 'true'
  50637. : key;
  50638. el.setAttribute(key, value);
  50639. }
  50640. } else if (isEnumeratedAttr(key)) {
  50641. el.setAttribute(key, convertEnumeratedValue(key, value));
  50642. } else if (isXlink(key)) {
  50643. if (isFalsyAttrValue(value)) {
  50644. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50645. } else {
  50646. el.setAttributeNS(xlinkNS, key, value);
  50647. }
  50648. } else {
  50649. baseSetAttr(el, key, value);
  50650. }
  50651. }
  50652. function baseSetAttr (el, key, value) {
  50653. if (isFalsyAttrValue(value)) {
  50654. el.removeAttribute(key);
  50655. } else {
  50656. // #7138: IE10 & 11 fires input event when setting placeholder on
  50657. // <textarea>... block the first input event and remove the blocker
  50658. // immediately.
  50659. /* istanbul ignore if */
  50660. if (
  50661. isIE && !isIE9 &&
  50662. el.tagName === 'TEXTAREA' &&
  50663. key === 'placeholder' && value !== '' && !el.__ieph
  50664. ) {
  50665. var blocker = function (e) {
  50666. e.stopImmediatePropagation();
  50667. el.removeEventListener('input', blocker);
  50668. };
  50669. el.addEventListener('input', blocker);
  50670. // $flow-disable-line
  50671. el.__ieph = true; /* IE placeholder patched */
  50672. }
  50673. el.setAttribute(key, value);
  50674. }
  50675. }
  50676. var attrs = {
  50677. create: updateAttrs,
  50678. update: updateAttrs
  50679. };
  50680. /* */
  50681. function updateClass (oldVnode, vnode) {
  50682. var el = vnode.elm;
  50683. var data = vnode.data;
  50684. var oldData = oldVnode.data;
  50685. if (
  50686. isUndef(data.staticClass) &&
  50687. isUndef(data.class) && (
  50688. isUndef(oldData) || (
  50689. isUndef(oldData.staticClass) &&
  50690. isUndef(oldData.class)
  50691. )
  50692. )
  50693. ) {
  50694. return
  50695. }
  50696. var cls = genClassForVnode(vnode);
  50697. // handle transition classes
  50698. var transitionClass = el._transitionClasses;
  50699. if (isDef(transitionClass)) {
  50700. cls = concat(cls, stringifyClass(transitionClass));
  50701. }
  50702. // set the class
  50703. if (cls !== el._prevClass) {
  50704. el.setAttribute('class', cls);
  50705. el._prevClass = cls;
  50706. }
  50707. }
  50708. var klass = {
  50709. create: updateClass,
  50710. update: updateClass
  50711. };
  50712. /* */
  50713. var validDivisionCharRE = /[\w).+\-_$\]]/;
  50714. function parseFilters (exp) {
  50715. var inSingle = false;
  50716. var inDouble = false;
  50717. var inTemplateString = false;
  50718. var inRegex = false;
  50719. var curly = 0;
  50720. var square = 0;
  50721. var paren = 0;
  50722. var lastFilterIndex = 0;
  50723. var c, prev, i, expression, filters;
  50724. for (i = 0; i < exp.length; i++) {
  50725. prev = c;
  50726. c = exp.charCodeAt(i);
  50727. if (inSingle) {
  50728. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  50729. } else if (inDouble) {
  50730. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  50731. } else if (inTemplateString) {
  50732. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  50733. } else if (inRegex) {
  50734. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  50735. } else if (
  50736. c === 0x7C && // pipe
  50737. exp.charCodeAt(i + 1) !== 0x7C &&
  50738. exp.charCodeAt(i - 1) !== 0x7C &&
  50739. !curly && !square && !paren
  50740. ) {
  50741. if (expression === undefined) {
  50742. // first filter, end of expression
  50743. lastFilterIndex = i + 1;
  50744. expression = exp.slice(0, i).trim();
  50745. } else {
  50746. pushFilter();
  50747. }
  50748. } else {
  50749. switch (c) {
  50750. case 0x22: inDouble = true; break // "
  50751. case 0x27: inSingle = true; break // '
  50752. case 0x60: inTemplateString = true; break // `
  50753. case 0x28: paren++; break // (
  50754. case 0x29: paren--; break // )
  50755. case 0x5B: square++; break // [
  50756. case 0x5D: square--; break // ]
  50757. case 0x7B: curly++; break // {
  50758. case 0x7D: curly--; break // }
  50759. }
  50760. if (c === 0x2f) { // /
  50761. var j = i - 1;
  50762. var p = (void 0);
  50763. // find first non-whitespace prev char
  50764. for (; j >= 0; j--) {
  50765. p = exp.charAt(j);
  50766. if (p !== ' ') { break }
  50767. }
  50768. if (!p || !validDivisionCharRE.test(p)) {
  50769. inRegex = true;
  50770. }
  50771. }
  50772. }
  50773. }
  50774. if (expression === undefined) {
  50775. expression = exp.slice(0, i).trim();
  50776. } else if (lastFilterIndex !== 0) {
  50777. pushFilter();
  50778. }
  50779. function pushFilter () {
  50780. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  50781. lastFilterIndex = i + 1;
  50782. }
  50783. if (filters) {
  50784. for (i = 0; i < filters.length; i++) {
  50785. expression = wrapFilter(expression, filters[i]);
  50786. }
  50787. }
  50788. return expression
  50789. }
  50790. function wrapFilter (exp, filter) {
  50791. var i = filter.indexOf('(');
  50792. if (i < 0) {
  50793. // _f: resolveFilter
  50794. return ("_f(\"" + filter + "\")(" + exp + ")")
  50795. } else {
  50796. var name = filter.slice(0, i);
  50797. var args = filter.slice(i + 1);
  50798. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  50799. }
  50800. }
  50801. /* */
  50802. /* eslint-disable no-unused-vars */
  50803. function baseWarn (msg, range) {
  50804. console.error(("[Vue compiler]: " + msg));
  50805. }
  50806. /* eslint-enable no-unused-vars */
  50807. function pluckModuleFunction (
  50808. modules,
  50809. key
  50810. ) {
  50811. return modules
  50812. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  50813. : []
  50814. }
  50815. function addProp (el, name, value, range, dynamic) {
  50816. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50817. el.plain = false;
  50818. }
  50819. function addAttr (el, name, value, range, dynamic) {
  50820. var attrs = dynamic
  50821. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  50822. : (el.attrs || (el.attrs = []));
  50823. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50824. el.plain = false;
  50825. }
  50826. // add a raw attr (use this in preTransforms)
  50827. function addRawAttr (el, name, value, range) {
  50828. el.attrsMap[name] = value;
  50829. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  50830. }
  50831. function addDirective (
  50832. el,
  50833. name,
  50834. rawName,
  50835. value,
  50836. arg,
  50837. isDynamicArg,
  50838. modifiers,
  50839. range
  50840. ) {
  50841. (el.directives || (el.directives = [])).push(rangeSetItem({
  50842. name: name,
  50843. rawName: rawName,
  50844. value: value,
  50845. arg: arg,
  50846. isDynamicArg: isDynamicArg,
  50847. modifiers: modifiers
  50848. }, range));
  50849. el.plain = false;
  50850. }
  50851. function prependModifierMarker (symbol, name, dynamic) {
  50852. return dynamic
  50853. ? ("_p(" + name + ",\"" + symbol + "\")")
  50854. : symbol + name // mark the event as captured
  50855. }
  50856. function addHandler (
  50857. el,
  50858. name,
  50859. value,
  50860. modifiers,
  50861. important,
  50862. warn,
  50863. range,
  50864. dynamic
  50865. ) {
  50866. modifiers = modifiers || emptyObject;
  50867. // warn prevent and passive modifier
  50868. /* istanbul ignore if */
  50869. if (
  50870. warn &&
  50871. modifiers.prevent && modifiers.passive
  50872. ) {
  50873. warn(
  50874. 'passive and prevent can\'t be used together. ' +
  50875. 'Passive handler can\'t prevent default event.',
  50876. range
  50877. );
  50878. }
  50879. // normalize click.right and click.middle since they don't actually fire
  50880. // this is technically browser-specific, but at least for now browsers are
  50881. // the only target envs that have right/middle clicks.
  50882. if (modifiers.right) {
  50883. if (dynamic) {
  50884. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  50885. } else if (name === 'click') {
  50886. name = 'contextmenu';
  50887. delete modifiers.right;
  50888. }
  50889. } else if (modifiers.middle) {
  50890. if (dynamic) {
  50891. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  50892. } else if (name === 'click') {
  50893. name = 'mouseup';
  50894. }
  50895. }
  50896. // check capture modifier
  50897. if (modifiers.capture) {
  50898. delete modifiers.capture;
  50899. name = prependModifierMarker('!', name, dynamic);
  50900. }
  50901. if (modifiers.once) {
  50902. delete modifiers.once;
  50903. name = prependModifierMarker('~', name, dynamic);
  50904. }
  50905. /* istanbul ignore if */
  50906. if (modifiers.passive) {
  50907. delete modifiers.passive;
  50908. name = prependModifierMarker('&', name, dynamic);
  50909. }
  50910. var events;
  50911. if (modifiers.native) {
  50912. delete modifiers.native;
  50913. events = el.nativeEvents || (el.nativeEvents = {});
  50914. } else {
  50915. events = el.events || (el.events = {});
  50916. }
  50917. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  50918. if (modifiers !== emptyObject) {
  50919. newHandler.modifiers = modifiers;
  50920. }
  50921. var handlers = events[name];
  50922. /* istanbul ignore if */
  50923. if (Array.isArray(handlers)) {
  50924. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  50925. } else if (handlers) {
  50926. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  50927. } else {
  50928. events[name] = newHandler;
  50929. }
  50930. el.plain = false;
  50931. }
  50932. function getRawBindingAttr (
  50933. el,
  50934. name
  50935. ) {
  50936. return el.rawAttrsMap[':' + name] ||
  50937. el.rawAttrsMap['v-bind:' + name] ||
  50938. el.rawAttrsMap[name]
  50939. }
  50940. function getBindingAttr (
  50941. el,
  50942. name,
  50943. getStatic
  50944. ) {
  50945. var dynamicValue =
  50946. getAndRemoveAttr(el, ':' + name) ||
  50947. getAndRemoveAttr(el, 'v-bind:' + name);
  50948. if (dynamicValue != null) {
  50949. return parseFilters(dynamicValue)
  50950. } else if (getStatic !== false) {
  50951. var staticValue = getAndRemoveAttr(el, name);
  50952. if (staticValue != null) {
  50953. return JSON.stringify(staticValue)
  50954. }
  50955. }
  50956. }
  50957. // note: this only removes the attr from the Array (attrsList) so that it
  50958. // doesn't get processed by processAttrs.
  50959. // By default it does NOT remove it from the map (attrsMap) because the map is
  50960. // needed during codegen.
  50961. function getAndRemoveAttr (
  50962. el,
  50963. name,
  50964. removeFromMap
  50965. ) {
  50966. var val;
  50967. if ((val = el.attrsMap[name]) != null) {
  50968. var list = el.attrsList;
  50969. for (var i = 0, l = list.length; i < l; i++) {
  50970. if (list[i].name === name) {
  50971. list.splice(i, 1);
  50972. break
  50973. }
  50974. }
  50975. }
  50976. if (removeFromMap) {
  50977. delete el.attrsMap[name];
  50978. }
  50979. return val
  50980. }
  50981. function getAndRemoveAttrByRegex (
  50982. el,
  50983. name
  50984. ) {
  50985. var list = el.attrsList;
  50986. for (var i = 0, l = list.length; i < l; i++) {
  50987. var attr = list[i];
  50988. if (name.test(attr.name)) {
  50989. list.splice(i, 1);
  50990. return attr
  50991. }
  50992. }
  50993. }
  50994. function rangeSetItem (
  50995. item,
  50996. range
  50997. ) {
  50998. if (range) {
  50999. if (range.start != null) {
  51000. item.start = range.start;
  51001. }
  51002. if (range.end != null) {
  51003. item.end = range.end;
  51004. }
  51005. }
  51006. return item
  51007. }
  51008. /* */
  51009. /**
  51010. * Cross-platform code generation for component v-model
  51011. */
  51012. function genComponentModel (
  51013. el,
  51014. value,
  51015. modifiers
  51016. ) {
  51017. var ref = modifiers || {};
  51018. var number = ref.number;
  51019. var trim = ref.trim;
  51020. var baseValueExpression = '$$v';
  51021. var valueExpression = baseValueExpression;
  51022. if (trim) {
  51023. valueExpression =
  51024. "(typeof " + baseValueExpression + " === 'string'" +
  51025. "? " + baseValueExpression + ".trim()" +
  51026. ": " + baseValueExpression + ")";
  51027. }
  51028. if (number) {
  51029. valueExpression = "_n(" + valueExpression + ")";
  51030. }
  51031. var assignment = genAssignmentCode(value, valueExpression);
  51032. el.model = {
  51033. value: ("(" + value + ")"),
  51034. expression: JSON.stringify(value),
  51035. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  51036. };
  51037. }
  51038. /**
  51039. * Cross-platform codegen helper for generating v-model value assignment code.
  51040. */
  51041. function genAssignmentCode (
  51042. value,
  51043. assignment
  51044. ) {
  51045. var res = parseModel(value);
  51046. if (res.key === null) {
  51047. return (value + "=" + assignment)
  51048. } else {
  51049. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  51050. }
  51051. }
  51052. /**
  51053. * Parse a v-model expression into a base path and a final key segment.
  51054. * Handles both dot-path and possible square brackets.
  51055. *
  51056. * Possible cases:
  51057. *
  51058. * - test
  51059. * - test[key]
  51060. * - test[test1[key]]
  51061. * - test["a"][key]
  51062. * - xxx.test[a[a].test1[key]]
  51063. * - test.xxx.a["asa"][test1[key]]
  51064. *
  51065. */
  51066. var len, str, chr, index$1, expressionPos, expressionEndPos;
  51067. function parseModel (val) {
  51068. // Fix https://github.com/vuejs/vue/pull/7730
  51069. // allow v-model="obj.val " (trailing whitespace)
  51070. val = val.trim();
  51071. len = val.length;
  51072. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  51073. index$1 = val.lastIndexOf('.');
  51074. if (index$1 > -1) {
  51075. return {
  51076. exp: val.slice(0, index$1),
  51077. key: '"' + val.slice(index$1 + 1) + '"'
  51078. }
  51079. } else {
  51080. return {
  51081. exp: val,
  51082. key: null
  51083. }
  51084. }
  51085. }
  51086. str = val;
  51087. index$1 = expressionPos = expressionEndPos = 0;
  51088. while (!eof()) {
  51089. chr = next();
  51090. /* istanbul ignore if */
  51091. if (isStringStart(chr)) {
  51092. parseString(chr);
  51093. } else if (chr === 0x5B) {
  51094. parseBracket(chr);
  51095. }
  51096. }
  51097. return {
  51098. exp: val.slice(0, expressionPos),
  51099. key: val.slice(expressionPos + 1, expressionEndPos)
  51100. }
  51101. }
  51102. function next () {
  51103. return str.charCodeAt(++index$1)
  51104. }
  51105. function eof () {
  51106. return index$1 >= len
  51107. }
  51108. function isStringStart (chr) {
  51109. return chr === 0x22 || chr === 0x27
  51110. }
  51111. function parseBracket (chr) {
  51112. var inBracket = 1;
  51113. expressionPos = index$1;
  51114. while (!eof()) {
  51115. chr = next();
  51116. if (isStringStart(chr)) {
  51117. parseString(chr);
  51118. continue
  51119. }
  51120. if (chr === 0x5B) { inBracket++; }
  51121. if (chr === 0x5D) { inBracket--; }
  51122. if (inBracket === 0) {
  51123. expressionEndPos = index$1;
  51124. break
  51125. }
  51126. }
  51127. }
  51128. function parseString (chr) {
  51129. var stringQuote = chr;
  51130. while (!eof()) {
  51131. chr = next();
  51132. if (chr === stringQuote) {
  51133. break
  51134. }
  51135. }
  51136. }
  51137. /* */
  51138. var warn$1;
  51139. // in some cases, the event used has to be determined at runtime
  51140. // so we used some reserved tokens during compile.
  51141. var RANGE_TOKEN = '__r';
  51142. var CHECKBOX_RADIO_TOKEN = '__c';
  51143. function model (
  51144. el,
  51145. dir,
  51146. _warn
  51147. ) {
  51148. warn$1 = _warn;
  51149. var value = dir.value;
  51150. var modifiers = dir.modifiers;
  51151. var tag = el.tag;
  51152. var type = el.attrsMap.type;
  51153. {
  51154. // inputs with type="file" are read only and setting the input's
  51155. // value will throw an error.
  51156. if (tag === 'input' && type === 'file') {
  51157. warn$1(
  51158. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  51159. "File inputs are read only. Use a v-on:change listener instead.",
  51160. el.rawAttrsMap['v-model']
  51161. );
  51162. }
  51163. }
  51164. if (el.component) {
  51165. genComponentModel(el, value, modifiers);
  51166. // component v-model doesn't need extra runtime
  51167. return false
  51168. } else if (tag === 'select') {
  51169. genSelect(el, value, modifiers);
  51170. } else if (tag === 'input' && type === 'checkbox') {
  51171. genCheckboxModel(el, value, modifiers);
  51172. } else if (tag === 'input' && type === 'radio') {
  51173. genRadioModel(el, value, modifiers);
  51174. } else if (tag === 'input' || tag === 'textarea') {
  51175. genDefaultModel(el, value, modifiers);
  51176. } else if (!config.isReservedTag(tag)) {
  51177. genComponentModel(el, value, modifiers);
  51178. // component v-model doesn't need extra runtime
  51179. return false
  51180. } else {
  51181. warn$1(
  51182. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  51183. "v-model is not supported on this element type. " +
  51184. 'If you are working with contenteditable, it\'s recommended to ' +
  51185. 'wrap a library dedicated for that purpose inside a custom component.',
  51186. el.rawAttrsMap['v-model']
  51187. );
  51188. }
  51189. // ensure runtime directive metadata
  51190. return true
  51191. }
  51192. function genCheckboxModel (
  51193. el,
  51194. value,
  51195. modifiers
  51196. ) {
  51197. var number = modifiers && modifiers.number;
  51198. var valueBinding = getBindingAttr(el, 'value') || 'null';
  51199. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  51200. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  51201. addProp(el, 'checked',
  51202. "Array.isArray(" + value + ")" +
  51203. "?_i(" + value + "," + valueBinding + ")>-1" + (
  51204. trueValueBinding === 'true'
  51205. ? (":(" + value + ")")
  51206. : (":_q(" + value + "," + trueValueBinding + ")")
  51207. )
  51208. );
  51209. addHandler(el, 'change',
  51210. "var $$a=" + value + "," +
  51211. '$$el=$event.target,' +
  51212. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  51213. 'if(Array.isArray($$a)){' +
  51214. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  51215. '$$i=_i($$a,$$v);' +
  51216. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  51217. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  51218. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  51219. null, true
  51220. );
  51221. }
  51222. function genRadioModel (
  51223. el,
  51224. value,
  51225. modifiers
  51226. ) {
  51227. var number = modifiers && modifiers.number;
  51228. var valueBinding = getBindingAttr(el, 'value') || 'null';
  51229. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  51230. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  51231. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  51232. }
  51233. function genSelect (
  51234. el,
  51235. value,
  51236. modifiers
  51237. ) {
  51238. var number = modifiers && modifiers.number;
  51239. var selectedVal = "Array.prototype.filter" +
  51240. ".call($event.target.options,function(o){return o.selected})" +
  51241. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  51242. "return " + (number ? '_n(val)' : 'val') + "})";
  51243. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  51244. var code = "var $$selectedVal = " + selectedVal + ";";
  51245. code = code + " " + (genAssignmentCode(value, assignment));
  51246. addHandler(el, 'change', code, null, true);
  51247. }
  51248. function genDefaultModel (
  51249. el,
  51250. value,
  51251. modifiers
  51252. ) {
  51253. var type = el.attrsMap.type;
  51254. // warn if v-bind:value conflicts with v-model
  51255. // except for inputs with v-bind:type
  51256. {
  51257. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  51258. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  51259. if (value$1 && !typeBinding) {
  51260. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  51261. warn$1(
  51262. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  51263. 'because the latter already expands to a value binding internally',
  51264. el.rawAttrsMap[binding]
  51265. );
  51266. }
  51267. }
  51268. var ref = modifiers || {};
  51269. var lazy = ref.lazy;
  51270. var number = ref.number;
  51271. var trim = ref.trim;
  51272. var needCompositionGuard = !lazy && type !== 'range';
  51273. var event = lazy
  51274. ? 'change'
  51275. : type === 'range'
  51276. ? RANGE_TOKEN
  51277. : 'input';
  51278. var valueExpression = '$event.target.value';
  51279. if (trim) {
  51280. valueExpression = "$event.target.value.trim()";
  51281. }
  51282. if (number) {
  51283. valueExpression = "_n(" + valueExpression + ")";
  51284. }
  51285. var code = genAssignmentCode(value, valueExpression);
  51286. if (needCompositionGuard) {
  51287. code = "if($event.target.composing)return;" + code;
  51288. }
  51289. addProp(el, 'value', ("(" + value + ")"));
  51290. addHandler(el, event, code, null, true);
  51291. if (trim || number) {
  51292. addHandler(el, 'blur', '$forceUpdate()');
  51293. }
  51294. }
  51295. /* */
  51296. // normalize v-model event tokens that can only be determined at runtime.
  51297. // it's important to place the event as the first in the array because
  51298. // the whole point is ensuring the v-model callback gets called before
  51299. // user-attached handlers.
  51300. function normalizeEvents (on) {
  51301. /* istanbul ignore if */
  51302. if (isDef(on[RANGE_TOKEN])) {
  51303. // IE input[type=range] only supports `change` event
  51304. var event = isIE ? 'change' : 'input';
  51305. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  51306. delete on[RANGE_TOKEN];
  51307. }
  51308. // This was originally intended to fix #4521 but no longer necessary
  51309. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  51310. /* istanbul ignore if */
  51311. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  51312. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  51313. delete on[CHECKBOX_RADIO_TOKEN];
  51314. }
  51315. }
  51316. var target$1;
  51317. function createOnceHandler$1 (event, handler, capture) {
  51318. var _target = target$1; // save current target element in closure
  51319. return function onceHandler () {
  51320. var res = handler.apply(null, arguments);
  51321. if (res !== null) {
  51322. remove$2(event, onceHandler, capture, _target);
  51323. }
  51324. }
  51325. }
  51326. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  51327. // implementation and does not fire microtasks in between event propagation, so
  51328. // safe to exclude.
  51329. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  51330. function add$1 (
  51331. name,
  51332. handler,
  51333. capture,
  51334. passive
  51335. ) {
  51336. // async edge case #6566: inner click event triggers patch, event handler
  51337. // attached to outer element during patch, and triggered again. This
  51338. // happens because browsers fire microtask ticks between event propagation.
  51339. // the solution is simple: we save the timestamp when a handler is attached,
  51340. // and the handler would only fire if the event passed to it was fired
  51341. // AFTER it was attached.
  51342. if (useMicrotaskFix) {
  51343. var attachedTimestamp = currentFlushTimestamp;
  51344. var original = handler;
  51345. handler = original._wrapper = function (e) {
  51346. if (
  51347. // no bubbling, should always fire.
  51348. // this is just a safety net in case event.timeStamp is unreliable in
  51349. // certain weird environments...
  51350. e.target === e.currentTarget ||
  51351. // event is fired after handler attachment
  51352. e.timeStamp >= attachedTimestamp ||
  51353. // bail for environments that have buggy event.timeStamp implementations
  51354. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  51355. // #9681 QtWebEngine event.timeStamp is negative value
  51356. e.timeStamp <= 0 ||
  51357. // #9448 bail if event is fired in another document in a multi-page
  51358. // electron/nw.js app, since event.timeStamp will be using a different
  51359. // starting reference
  51360. e.target.ownerDocument !== document
  51361. ) {
  51362. return original.apply(this, arguments)
  51363. }
  51364. };
  51365. }
  51366. target$1.addEventListener(
  51367. name,
  51368. handler,
  51369. supportsPassive
  51370. ? { capture: capture, passive: passive }
  51371. : capture
  51372. );
  51373. }
  51374. function remove$2 (
  51375. name,
  51376. handler,
  51377. capture,
  51378. _target
  51379. ) {
  51380. (_target || target$1).removeEventListener(
  51381. name,
  51382. handler._wrapper || handler,
  51383. capture
  51384. );
  51385. }
  51386. function updateDOMListeners (oldVnode, vnode) {
  51387. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  51388. return
  51389. }
  51390. var on = vnode.data.on || {};
  51391. var oldOn = oldVnode.data.on || {};
  51392. target$1 = vnode.elm;
  51393. normalizeEvents(on);
  51394. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  51395. target$1 = undefined;
  51396. }
  51397. var events = {
  51398. create: updateDOMListeners,
  51399. update: updateDOMListeners
  51400. };
  51401. /* */
  51402. var svgContainer;
  51403. function updateDOMProps (oldVnode, vnode) {
  51404. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  51405. return
  51406. }
  51407. var key, cur;
  51408. var elm = vnode.elm;
  51409. var oldProps = oldVnode.data.domProps || {};
  51410. var props = vnode.data.domProps || {};
  51411. // clone observed objects, as the user probably wants to mutate it
  51412. if (isDef(props.__ob__)) {
  51413. props = vnode.data.domProps = extend({}, props);
  51414. }
  51415. for (key in oldProps) {
  51416. if (!(key in props)) {
  51417. elm[key] = '';
  51418. }
  51419. }
  51420. for (key in props) {
  51421. cur = props[key];
  51422. // ignore children if the node has textContent or innerHTML,
  51423. // as these will throw away existing DOM nodes and cause removal errors
  51424. // on subsequent patches (#3360)
  51425. if (key === 'textContent' || key === 'innerHTML') {
  51426. if (vnode.children) { vnode.children.length = 0; }
  51427. if (cur === oldProps[key]) { continue }
  51428. // #6601 work around Chrome version <= 55 bug where single textNode
  51429. // replaced by innerHTML/textContent retains its parentNode property
  51430. if (elm.childNodes.length === 1) {
  51431. elm.removeChild(elm.childNodes[0]);
  51432. }
  51433. }
  51434. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  51435. // store value as _value as well since
  51436. // non-string values will be stringified
  51437. elm._value = cur;
  51438. // avoid resetting cursor position when value is the same
  51439. var strCur = isUndef(cur) ? '' : String(cur);
  51440. if (shouldUpdateValue(elm, strCur)) {
  51441. elm.value = strCur;
  51442. }
  51443. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  51444. // IE doesn't support innerHTML for SVG elements
  51445. svgContainer = svgContainer || document.createElement('div');
  51446. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  51447. var svg = svgContainer.firstChild;
  51448. while (elm.firstChild) {
  51449. elm.removeChild(elm.firstChild);
  51450. }
  51451. while (svg.firstChild) {
  51452. elm.appendChild(svg.firstChild);
  51453. }
  51454. } else if (
  51455. // skip the update if old and new VDOM state is the same.
  51456. // `value` is handled separately because the DOM value may be temporarily
  51457. // out of sync with VDOM state due to focus, composition and modifiers.
  51458. // This #4521 by skipping the unnecesarry `checked` update.
  51459. cur !== oldProps[key]
  51460. ) {
  51461. // some property updates can throw
  51462. // e.g. `value` on <progress> w/ non-finite value
  51463. try {
  51464. elm[key] = cur;
  51465. } catch (e) {}
  51466. }
  51467. }
  51468. }
  51469. // check platforms/web/util/attrs.js acceptValue
  51470. function shouldUpdateValue (elm, checkVal) {
  51471. return (!elm.composing && (
  51472. elm.tagName === 'OPTION' ||
  51473. isNotInFocusAndDirty(elm, checkVal) ||
  51474. isDirtyWithModifiers(elm, checkVal)
  51475. ))
  51476. }
  51477. function isNotInFocusAndDirty (elm, checkVal) {
  51478. // return true when textbox (.number and .trim) loses focus and its value is
  51479. // not equal to the updated value
  51480. var notInFocus = true;
  51481. // #6157
  51482. // work around IE bug when accessing document.activeElement in an iframe
  51483. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  51484. return notInFocus && elm.value !== checkVal
  51485. }
  51486. function isDirtyWithModifiers (elm, newVal) {
  51487. var value = elm.value;
  51488. var modifiers = elm._vModifiers; // injected by v-model runtime
  51489. if (isDef(modifiers)) {
  51490. if (modifiers.number) {
  51491. return toNumber(value) !== toNumber(newVal)
  51492. }
  51493. if (modifiers.trim) {
  51494. return value.trim() !== newVal.trim()
  51495. }
  51496. }
  51497. return value !== newVal
  51498. }
  51499. var domProps = {
  51500. create: updateDOMProps,
  51501. update: updateDOMProps
  51502. };
  51503. /* */
  51504. var parseStyleText = cached(function (cssText) {
  51505. var res = {};
  51506. var listDelimiter = /;(?![^(]*\))/g;
  51507. var propertyDelimiter = /:(.+)/;
  51508. cssText.split(listDelimiter).forEach(function (item) {
  51509. if (item) {
  51510. var tmp = item.split(propertyDelimiter);
  51511. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  51512. }
  51513. });
  51514. return res
  51515. });
  51516. // merge static and dynamic style data on the same vnode
  51517. function normalizeStyleData (data) {
  51518. var style = normalizeStyleBinding(data.style);
  51519. // static style is pre-processed into an object during compilation
  51520. // and is always a fresh object, so it's safe to merge into it
  51521. return data.staticStyle
  51522. ? extend(data.staticStyle, style)
  51523. : style
  51524. }
  51525. // normalize possible array / string values into Object
  51526. function normalizeStyleBinding (bindingStyle) {
  51527. if (Array.isArray(bindingStyle)) {
  51528. return toObject(bindingStyle)
  51529. }
  51530. if (typeof bindingStyle === 'string') {
  51531. return parseStyleText(bindingStyle)
  51532. }
  51533. return bindingStyle
  51534. }
  51535. /**
  51536. * parent component style should be after child's
  51537. * so that parent component's style could override it
  51538. */
  51539. function getStyle (vnode, checkChild) {
  51540. var res = {};
  51541. var styleData;
  51542. if (checkChild) {
  51543. var childNode = vnode;
  51544. while (childNode.componentInstance) {
  51545. childNode = childNode.componentInstance._vnode;
  51546. if (
  51547. childNode && childNode.data &&
  51548. (styleData = normalizeStyleData(childNode.data))
  51549. ) {
  51550. extend(res, styleData);
  51551. }
  51552. }
  51553. }
  51554. if ((styleData = normalizeStyleData(vnode.data))) {
  51555. extend(res, styleData);
  51556. }
  51557. var parentNode = vnode;
  51558. while ((parentNode = parentNode.parent)) {
  51559. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  51560. extend(res, styleData);
  51561. }
  51562. }
  51563. return res
  51564. }
  51565. /* */
  51566. var cssVarRE = /^--/;
  51567. var importantRE = /\s*!important$/;
  51568. var setProp = function (el, name, val) {
  51569. /* istanbul ignore if */
  51570. if (cssVarRE.test(name)) {
  51571. el.style.setProperty(name, val);
  51572. } else if (importantRE.test(val)) {
  51573. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  51574. } else {
  51575. var normalizedName = normalize(name);
  51576. if (Array.isArray(val)) {
  51577. // Support values array created by autoprefixer, e.g.
  51578. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  51579. // Set them one by one, and the browser will only set those it can recognize
  51580. for (var i = 0, len = val.length; i < len; i++) {
  51581. el.style[normalizedName] = val[i];
  51582. }
  51583. } else {
  51584. el.style[normalizedName] = val;
  51585. }
  51586. }
  51587. };
  51588. var vendorNames = ['Webkit', 'Moz', 'ms'];
  51589. var emptyStyle;
  51590. var normalize = cached(function (prop) {
  51591. emptyStyle = emptyStyle || document.createElement('div').style;
  51592. prop = camelize(prop);
  51593. if (prop !== 'filter' && (prop in emptyStyle)) {
  51594. return prop
  51595. }
  51596. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  51597. for (var i = 0; i < vendorNames.length; i++) {
  51598. var name = vendorNames[i] + capName;
  51599. if (name in emptyStyle) {
  51600. return name
  51601. }
  51602. }
  51603. });
  51604. function updateStyle (oldVnode, vnode) {
  51605. var data = vnode.data;
  51606. var oldData = oldVnode.data;
  51607. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  51608. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  51609. ) {
  51610. return
  51611. }
  51612. var cur, name;
  51613. var el = vnode.elm;
  51614. var oldStaticStyle = oldData.staticStyle;
  51615. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  51616. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  51617. var oldStyle = oldStaticStyle || oldStyleBinding;
  51618. var style = normalizeStyleBinding(vnode.data.style) || {};
  51619. // store normalized style under a different key for next diff
  51620. // make sure to clone it if it's reactive, since the user likely wants
  51621. // to mutate it.
  51622. vnode.data.normalizedStyle = isDef(style.__ob__)
  51623. ? extend({}, style)
  51624. : style;
  51625. var newStyle = getStyle(vnode, true);
  51626. for (name in oldStyle) {
  51627. if (isUndef(newStyle[name])) {
  51628. setProp(el, name, '');
  51629. }
  51630. }
  51631. for (name in newStyle) {
  51632. cur = newStyle[name];
  51633. if (cur !== oldStyle[name]) {
  51634. // ie9 setting to null has no effect, must use empty string
  51635. setProp(el, name, cur == null ? '' : cur);
  51636. }
  51637. }
  51638. }
  51639. var style = {
  51640. create: updateStyle,
  51641. update: updateStyle
  51642. };
  51643. /* */
  51644. var whitespaceRE = /\s+/;
  51645. /**
  51646. * Add class with compatibility for SVG since classList is not supported on
  51647. * SVG elements in IE
  51648. */
  51649. function addClass (el, cls) {
  51650. /* istanbul ignore if */
  51651. if (!cls || !(cls = cls.trim())) {
  51652. return
  51653. }
  51654. /* istanbul ignore else */
  51655. if (el.classList) {
  51656. if (cls.indexOf(' ') > -1) {
  51657. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  51658. } else {
  51659. el.classList.add(cls);
  51660. }
  51661. } else {
  51662. var cur = " " + (el.getAttribute('class') || '') + " ";
  51663. if (cur.indexOf(' ' + cls + ' ') < 0) {
  51664. el.setAttribute('class', (cur + cls).trim());
  51665. }
  51666. }
  51667. }
  51668. /**
  51669. * Remove class with compatibility for SVG since classList is not supported on
  51670. * SVG elements in IE
  51671. */
  51672. function removeClass (el, cls) {
  51673. /* istanbul ignore if */
  51674. if (!cls || !(cls = cls.trim())) {
  51675. return
  51676. }
  51677. /* istanbul ignore else */
  51678. if (el.classList) {
  51679. if (cls.indexOf(' ') > -1) {
  51680. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  51681. } else {
  51682. el.classList.remove(cls);
  51683. }
  51684. if (!el.classList.length) {
  51685. el.removeAttribute('class');
  51686. }
  51687. } else {
  51688. var cur = " " + (el.getAttribute('class') || '') + " ";
  51689. var tar = ' ' + cls + ' ';
  51690. while (cur.indexOf(tar) >= 0) {
  51691. cur = cur.replace(tar, ' ');
  51692. }
  51693. cur = cur.trim();
  51694. if (cur) {
  51695. el.setAttribute('class', cur);
  51696. } else {
  51697. el.removeAttribute('class');
  51698. }
  51699. }
  51700. }
  51701. /* */
  51702. function resolveTransition (def$$1) {
  51703. if (!def$$1) {
  51704. return
  51705. }
  51706. /* istanbul ignore else */
  51707. if (typeof def$$1 === 'object') {
  51708. var res = {};
  51709. if (def$$1.css !== false) {
  51710. extend(res, autoCssTransition(def$$1.name || 'v'));
  51711. }
  51712. extend(res, def$$1);
  51713. return res
  51714. } else if (typeof def$$1 === 'string') {
  51715. return autoCssTransition(def$$1)
  51716. }
  51717. }
  51718. var autoCssTransition = cached(function (name) {
  51719. return {
  51720. enterClass: (name + "-enter"),
  51721. enterToClass: (name + "-enter-to"),
  51722. enterActiveClass: (name + "-enter-active"),
  51723. leaveClass: (name + "-leave"),
  51724. leaveToClass: (name + "-leave-to"),
  51725. leaveActiveClass: (name + "-leave-active")
  51726. }
  51727. });
  51728. var hasTransition = inBrowser && !isIE9;
  51729. var TRANSITION = 'transition';
  51730. var ANIMATION = 'animation';
  51731. // Transition property/event sniffing
  51732. var transitionProp = 'transition';
  51733. var transitionEndEvent = 'transitionend';
  51734. var animationProp = 'animation';
  51735. var animationEndEvent = 'animationend';
  51736. if (hasTransition) {
  51737. /* istanbul ignore if */
  51738. if (window.ontransitionend === undefined &&
  51739. window.onwebkittransitionend !== undefined
  51740. ) {
  51741. transitionProp = 'WebkitTransition';
  51742. transitionEndEvent = 'webkitTransitionEnd';
  51743. }
  51744. if (window.onanimationend === undefined &&
  51745. window.onwebkitanimationend !== undefined
  51746. ) {
  51747. animationProp = 'WebkitAnimation';
  51748. animationEndEvent = 'webkitAnimationEnd';
  51749. }
  51750. }
  51751. // binding to window is necessary to make hot reload work in IE in strict mode
  51752. var raf = inBrowser
  51753. ? window.requestAnimationFrame
  51754. ? window.requestAnimationFrame.bind(window)
  51755. : setTimeout
  51756. : /* istanbul ignore next */ function (fn) { return fn(); };
  51757. function nextFrame (fn) {
  51758. raf(function () {
  51759. raf(fn);
  51760. });
  51761. }
  51762. function addTransitionClass (el, cls) {
  51763. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  51764. if (transitionClasses.indexOf(cls) < 0) {
  51765. transitionClasses.push(cls);
  51766. addClass(el, cls);
  51767. }
  51768. }
  51769. function removeTransitionClass (el, cls) {
  51770. if (el._transitionClasses) {
  51771. remove(el._transitionClasses, cls);
  51772. }
  51773. removeClass(el, cls);
  51774. }
  51775. function whenTransitionEnds (
  51776. el,
  51777. expectedType,
  51778. cb
  51779. ) {
  51780. var ref = getTransitionInfo(el, expectedType);
  51781. var type = ref.type;
  51782. var timeout = ref.timeout;
  51783. var propCount = ref.propCount;
  51784. if (!type) { return cb() }
  51785. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  51786. var ended = 0;
  51787. var end = function () {
  51788. el.removeEventListener(event, onEnd);
  51789. cb();
  51790. };
  51791. var onEnd = function (e) {
  51792. if (e.target === el) {
  51793. if (++ended >= propCount) {
  51794. end();
  51795. }
  51796. }
  51797. };
  51798. setTimeout(function () {
  51799. if (ended < propCount) {
  51800. end();
  51801. }
  51802. }, timeout + 1);
  51803. el.addEventListener(event, onEnd);
  51804. }
  51805. var transformRE = /\b(transform|all)(,|$)/;
  51806. function getTransitionInfo (el, expectedType) {
  51807. var styles = window.getComputedStyle(el);
  51808. // JSDOM may return undefined for transition properties
  51809. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  51810. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  51811. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  51812. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  51813. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  51814. var animationTimeout = getTimeout(animationDelays, animationDurations);
  51815. var type;
  51816. var timeout = 0;
  51817. var propCount = 0;
  51818. /* istanbul ignore if */
  51819. if (expectedType === TRANSITION) {
  51820. if (transitionTimeout > 0) {
  51821. type = TRANSITION;
  51822. timeout = transitionTimeout;
  51823. propCount = transitionDurations.length;
  51824. }
  51825. } else if (expectedType === ANIMATION) {
  51826. if (animationTimeout > 0) {
  51827. type = ANIMATION;
  51828. timeout = animationTimeout;
  51829. propCount = animationDurations.length;
  51830. }
  51831. } else {
  51832. timeout = Math.max(transitionTimeout, animationTimeout);
  51833. type = timeout > 0
  51834. ? transitionTimeout > animationTimeout
  51835. ? TRANSITION
  51836. : ANIMATION
  51837. : null;
  51838. propCount = type
  51839. ? type === TRANSITION
  51840. ? transitionDurations.length
  51841. : animationDurations.length
  51842. : 0;
  51843. }
  51844. var hasTransform =
  51845. type === TRANSITION &&
  51846. transformRE.test(styles[transitionProp + 'Property']);
  51847. return {
  51848. type: type,
  51849. timeout: timeout,
  51850. propCount: propCount,
  51851. hasTransform: hasTransform
  51852. }
  51853. }
  51854. function getTimeout (delays, durations) {
  51855. /* istanbul ignore next */
  51856. while (delays.length < durations.length) {
  51857. delays = delays.concat(delays);
  51858. }
  51859. return Math.max.apply(null, durations.map(function (d, i) {
  51860. return toMs(d) + toMs(delays[i])
  51861. }))
  51862. }
  51863. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  51864. // in a locale-dependent way, using a comma instead of a dot.
  51865. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  51866. // as a floor function) causing unexpected behaviors
  51867. function toMs (s) {
  51868. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  51869. }
  51870. /* */
  51871. function enter (vnode, toggleDisplay) {
  51872. var el = vnode.elm;
  51873. // call leave callback now
  51874. if (isDef(el._leaveCb)) {
  51875. el._leaveCb.cancelled = true;
  51876. el._leaveCb();
  51877. }
  51878. var data = resolveTransition(vnode.data.transition);
  51879. if (isUndef(data)) {
  51880. return
  51881. }
  51882. /* istanbul ignore if */
  51883. if (isDef(el._enterCb) || el.nodeType !== 1) {
  51884. return
  51885. }
  51886. var css = data.css;
  51887. var type = data.type;
  51888. var enterClass = data.enterClass;
  51889. var enterToClass = data.enterToClass;
  51890. var enterActiveClass = data.enterActiveClass;
  51891. var appearClass = data.appearClass;
  51892. var appearToClass = data.appearToClass;
  51893. var appearActiveClass = data.appearActiveClass;
  51894. var beforeEnter = data.beforeEnter;
  51895. var enter = data.enter;
  51896. var afterEnter = data.afterEnter;
  51897. var enterCancelled = data.enterCancelled;
  51898. var beforeAppear = data.beforeAppear;
  51899. var appear = data.appear;
  51900. var afterAppear = data.afterAppear;
  51901. var appearCancelled = data.appearCancelled;
  51902. var duration = data.duration;
  51903. // activeInstance will always be the <transition> component managing this
  51904. // transition. One edge case to check is when the <transition> is placed
  51905. // as the root node of a child component. In that case we need to check
  51906. // <transition>'s parent for appear check.
  51907. var context = activeInstance;
  51908. var transitionNode = activeInstance.$vnode;
  51909. while (transitionNode && transitionNode.parent) {
  51910. context = transitionNode.context;
  51911. transitionNode = transitionNode.parent;
  51912. }
  51913. var isAppear = !context._isMounted || !vnode.isRootInsert;
  51914. if (isAppear && !appear && appear !== '') {
  51915. return
  51916. }
  51917. var startClass = isAppear && appearClass
  51918. ? appearClass
  51919. : enterClass;
  51920. var activeClass = isAppear && appearActiveClass
  51921. ? appearActiveClass
  51922. : enterActiveClass;
  51923. var toClass = isAppear && appearToClass
  51924. ? appearToClass
  51925. : enterToClass;
  51926. var beforeEnterHook = isAppear
  51927. ? (beforeAppear || beforeEnter)
  51928. : beforeEnter;
  51929. var enterHook = isAppear
  51930. ? (typeof appear === 'function' ? appear : enter)
  51931. : enter;
  51932. var afterEnterHook = isAppear
  51933. ? (afterAppear || afterEnter)
  51934. : afterEnter;
  51935. var enterCancelledHook = isAppear
  51936. ? (appearCancelled || enterCancelled)
  51937. : enterCancelled;
  51938. var explicitEnterDuration = toNumber(
  51939. isObject(duration)
  51940. ? duration.enter
  51941. : duration
  51942. );
  51943. if (explicitEnterDuration != null) {
  51944. checkDuration(explicitEnterDuration, 'enter', vnode);
  51945. }
  51946. var expectsCSS = css !== false && !isIE9;
  51947. var userWantsControl = getHookArgumentsLength(enterHook);
  51948. var cb = el._enterCb = once(function () {
  51949. if (expectsCSS) {
  51950. removeTransitionClass(el, toClass);
  51951. removeTransitionClass(el, activeClass);
  51952. }
  51953. if (cb.cancelled) {
  51954. if (expectsCSS) {
  51955. removeTransitionClass(el, startClass);
  51956. }
  51957. enterCancelledHook && enterCancelledHook(el);
  51958. } else {
  51959. afterEnterHook && afterEnterHook(el);
  51960. }
  51961. el._enterCb = null;
  51962. });
  51963. if (!vnode.data.show) {
  51964. // remove pending leave element on enter by injecting an insert hook
  51965. mergeVNodeHook(vnode, 'insert', function () {
  51966. var parent = el.parentNode;
  51967. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  51968. if (pendingNode &&
  51969. pendingNode.tag === vnode.tag &&
  51970. pendingNode.elm._leaveCb
  51971. ) {
  51972. pendingNode.elm._leaveCb();
  51973. }
  51974. enterHook && enterHook(el, cb);
  51975. });
  51976. }
  51977. // start enter transition
  51978. beforeEnterHook && beforeEnterHook(el);
  51979. if (expectsCSS) {
  51980. addTransitionClass(el, startClass);
  51981. addTransitionClass(el, activeClass);
  51982. nextFrame(function () {
  51983. removeTransitionClass(el, startClass);
  51984. if (!cb.cancelled) {
  51985. addTransitionClass(el, toClass);
  51986. if (!userWantsControl) {
  51987. if (isValidDuration(explicitEnterDuration)) {
  51988. setTimeout(cb, explicitEnterDuration);
  51989. } else {
  51990. whenTransitionEnds(el, type, cb);
  51991. }
  51992. }
  51993. }
  51994. });
  51995. }
  51996. if (vnode.data.show) {
  51997. toggleDisplay && toggleDisplay();
  51998. enterHook && enterHook(el, cb);
  51999. }
  52000. if (!expectsCSS && !userWantsControl) {
  52001. cb();
  52002. }
  52003. }
  52004. function leave (vnode, rm) {
  52005. var el = vnode.elm;
  52006. // call enter callback now
  52007. if (isDef(el._enterCb)) {
  52008. el._enterCb.cancelled = true;
  52009. el._enterCb();
  52010. }
  52011. var data = resolveTransition(vnode.data.transition);
  52012. if (isUndef(data) || el.nodeType !== 1) {
  52013. return rm()
  52014. }
  52015. /* istanbul ignore if */
  52016. if (isDef(el._leaveCb)) {
  52017. return
  52018. }
  52019. var css = data.css;
  52020. var type = data.type;
  52021. var leaveClass = data.leaveClass;
  52022. var leaveToClass = data.leaveToClass;
  52023. var leaveActiveClass = data.leaveActiveClass;
  52024. var beforeLeave = data.beforeLeave;
  52025. var leave = data.leave;
  52026. var afterLeave = data.afterLeave;
  52027. var leaveCancelled = data.leaveCancelled;
  52028. var delayLeave = data.delayLeave;
  52029. var duration = data.duration;
  52030. var expectsCSS = css !== false && !isIE9;
  52031. var userWantsControl = getHookArgumentsLength(leave);
  52032. var explicitLeaveDuration = toNumber(
  52033. isObject(duration)
  52034. ? duration.leave
  52035. : duration
  52036. );
  52037. if (isDef(explicitLeaveDuration)) {
  52038. checkDuration(explicitLeaveDuration, 'leave', vnode);
  52039. }
  52040. var cb = el._leaveCb = once(function () {
  52041. if (el.parentNode && el.parentNode._pending) {
  52042. el.parentNode._pending[vnode.key] = null;
  52043. }
  52044. if (expectsCSS) {
  52045. removeTransitionClass(el, leaveToClass);
  52046. removeTransitionClass(el, leaveActiveClass);
  52047. }
  52048. if (cb.cancelled) {
  52049. if (expectsCSS) {
  52050. removeTransitionClass(el, leaveClass);
  52051. }
  52052. leaveCancelled && leaveCancelled(el);
  52053. } else {
  52054. rm();
  52055. afterLeave && afterLeave(el);
  52056. }
  52057. el._leaveCb = null;
  52058. });
  52059. if (delayLeave) {
  52060. delayLeave(performLeave);
  52061. } else {
  52062. performLeave();
  52063. }
  52064. function performLeave () {
  52065. // the delayed leave may have already been cancelled
  52066. if (cb.cancelled) {
  52067. return
  52068. }
  52069. // record leaving element
  52070. if (!vnode.data.show && el.parentNode) {
  52071. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  52072. }
  52073. beforeLeave && beforeLeave(el);
  52074. if (expectsCSS) {
  52075. addTransitionClass(el, leaveClass);
  52076. addTransitionClass(el, leaveActiveClass);
  52077. nextFrame(function () {
  52078. removeTransitionClass(el, leaveClass);
  52079. if (!cb.cancelled) {
  52080. addTransitionClass(el, leaveToClass);
  52081. if (!userWantsControl) {
  52082. if (isValidDuration(explicitLeaveDuration)) {
  52083. setTimeout(cb, explicitLeaveDuration);
  52084. } else {
  52085. whenTransitionEnds(el, type, cb);
  52086. }
  52087. }
  52088. }
  52089. });
  52090. }
  52091. leave && leave(el, cb);
  52092. if (!expectsCSS && !userWantsControl) {
  52093. cb();
  52094. }
  52095. }
  52096. }
  52097. // only used in dev mode
  52098. function checkDuration (val, name, vnode) {
  52099. if (typeof val !== 'number') {
  52100. warn(
  52101. "<transition> explicit " + name + " duration is not a valid number - " +
  52102. "got " + (JSON.stringify(val)) + ".",
  52103. vnode.context
  52104. );
  52105. } else if (isNaN(val)) {
  52106. warn(
  52107. "<transition> explicit " + name + " duration is NaN - " +
  52108. 'the duration expression might be incorrect.',
  52109. vnode.context
  52110. );
  52111. }
  52112. }
  52113. function isValidDuration (val) {
  52114. return typeof val === 'number' && !isNaN(val)
  52115. }
  52116. /**
  52117. * Normalize a transition hook's argument length. The hook may be:
  52118. * - a merged hook (invoker) with the original in .fns
  52119. * - a wrapped component method (check ._length)
  52120. * - a plain function (.length)
  52121. */
  52122. function getHookArgumentsLength (fn) {
  52123. if (isUndef(fn)) {
  52124. return false
  52125. }
  52126. var invokerFns = fn.fns;
  52127. if (isDef(invokerFns)) {
  52128. // invoker
  52129. return getHookArgumentsLength(
  52130. Array.isArray(invokerFns)
  52131. ? invokerFns[0]
  52132. : invokerFns
  52133. )
  52134. } else {
  52135. return (fn._length || fn.length) > 1
  52136. }
  52137. }
  52138. function _enter (_, vnode) {
  52139. if (vnode.data.show !== true) {
  52140. enter(vnode);
  52141. }
  52142. }
  52143. var transition = inBrowser ? {
  52144. create: _enter,
  52145. activate: _enter,
  52146. remove: function remove$$1 (vnode, rm) {
  52147. /* istanbul ignore else */
  52148. if (vnode.data.show !== true) {
  52149. leave(vnode, rm);
  52150. } else {
  52151. rm();
  52152. }
  52153. }
  52154. } : {};
  52155. var platformModules = [
  52156. attrs,
  52157. klass,
  52158. events,
  52159. domProps,
  52160. style,
  52161. transition
  52162. ];
  52163. /* */
  52164. // the directive module should be applied last, after all
  52165. // built-in modules have been applied.
  52166. var modules = platformModules.concat(baseModules);
  52167. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  52168. /**
  52169. * Not type checking this file because flow doesn't like attaching
  52170. * properties to Elements.
  52171. */
  52172. /* istanbul ignore if */
  52173. if (isIE9) {
  52174. // http://www.matts411.com/post/internet-explorer-9-oninput/
  52175. document.addEventListener('selectionchange', function () {
  52176. var el = document.activeElement;
  52177. if (el && el.vmodel) {
  52178. trigger(el, 'input');
  52179. }
  52180. });
  52181. }
  52182. var directive = {
  52183. inserted: function inserted (el, binding, vnode, oldVnode) {
  52184. if (vnode.tag === 'select') {
  52185. // #6903
  52186. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  52187. mergeVNodeHook(vnode, 'postpatch', function () {
  52188. directive.componentUpdated(el, binding, vnode);
  52189. });
  52190. } else {
  52191. setSelected(el, binding, vnode.context);
  52192. }
  52193. el._vOptions = [].map.call(el.options, getValue);
  52194. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  52195. el._vModifiers = binding.modifiers;
  52196. if (!binding.modifiers.lazy) {
  52197. el.addEventListener('compositionstart', onCompositionStart);
  52198. el.addEventListener('compositionend', onCompositionEnd);
  52199. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  52200. // switching focus before confirming composition choice
  52201. // this also fixes the issue where some browsers e.g. iOS Chrome
  52202. // fires "change" instead of "input" on autocomplete.
  52203. el.addEventListener('change', onCompositionEnd);
  52204. /* istanbul ignore if */
  52205. if (isIE9) {
  52206. el.vmodel = true;
  52207. }
  52208. }
  52209. }
  52210. },
  52211. componentUpdated: function componentUpdated (el, binding, vnode) {
  52212. if (vnode.tag === 'select') {
  52213. setSelected(el, binding, vnode.context);
  52214. // in case the options rendered by v-for have changed,
  52215. // it's possible that the value is out-of-sync with the rendered options.
  52216. // detect such cases and filter out values that no longer has a matching
  52217. // option in the DOM.
  52218. var prevOptions = el._vOptions;
  52219. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  52220. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  52221. // trigger change event if
  52222. // no matching option found for at least one value
  52223. var needReset = el.multiple
  52224. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  52225. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  52226. if (needReset) {
  52227. trigger(el, 'change');
  52228. }
  52229. }
  52230. }
  52231. }
  52232. };
  52233. function setSelected (el, binding, vm) {
  52234. actuallySetSelected(el, binding, vm);
  52235. /* istanbul ignore if */
  52236. if (isIE || isEdge) {
  52237. setTimeout(function () {
  52238. actuallySetSelected(el, binding, vm);
  52239. }, 0);
  52240. }
  52241. }
  52242. function actuallySetSelected (el, binding, vm) {
  52243. var value = binding.value;
  52244. var isMultiple = el.multiple;
  52245. if (isMultiple && !Array.isArray(value)) {
  52246. warn(
  52247. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  52248. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  52249. vm
  52250. );
  52251. return
  52252. }
  52253. var selected, option;
  52254. for (var i = 0, l = el.options.length; i < l; i++) {
  52255. option = el.options[i];
  52256. if (isMultiple) {
  52257. selected = looseIndexOf(value, getValue(option)) > -1;
  52258. if (option.selected !== selected) {
  52259. option.selected = selected;
  52260. }
  52261. } else {
  52262. if (looseEqual(getValue(option), value)) {
  52263. if (el.selectedIndex !== i) {
  52264. el.selectedIndex = i;
  52265. }
  52266. return
  52267. }
  52268. }
  52269. }
  52270. if (!isMultiple) {
  52271. el.selectedIndex = -1;
  52272. }
  52273. }
  52274. function hasNoMatchingOption (value, options) {
  52275. return options.every(function (o) { return !looseEqual(o, value); })
  52276. }
  52277. function getValue (option) {
  52278. return '_value' in option
  52279. ? option._value
  52280. : option.value
  52281. }
  52282. function onCompositionStart (e) {
  52283. e.target.composing = true;
  52284. }
  52285. function onCompositionEnd (e) {
  52286. // prevent triggering an input event for no reason
  52287. if (!e.target.composing) { return }
  52288. e.target.composing = false;
  52289. trigger(e.target, 'input');
  52290. }
  52291. function trigger (el, type) {
  52292. var e = document.createEvent('HTMLEvents');
  52293. e.initEvent(type, true, true);
  52294. el.dispatchEvent(e);
  52295. }
  52296. /* */
  52297. // recursively search for possible transition defined inside the component root
  52298. function locateNode (vnode) {
  52299. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  52300. ? locateNode(vnode.componentInstance._vnode)
  52301. : vnode
  52302. }
  52303. var show = {
  52304. bind: function bind (el, ref, vnode) {
  52305. var value = ref.value;
  52306. vnode = locateNode(vnode);
  52307. var transition$$1 = vnode.data && vnode.data.transition;
  52308. var originalDisplay = el.__vOriginalDisplay =
  52309. el.style.display === 'none' ? '' : el.style.display;
  52310. if (value && transition$$1) {
  52311. vnode.data.show = true;
  52312. enter(vnode, function () {
  52313. el.style.display = originalDisplay;
  52314. });
  52315. } else {
  52316. el.style.display = value ? originalDisplay : 'none';
  52317. }
  52318. },
  52319. update: function update (el, ref, vnode) {
  52320. var value = ref.value;
  52321. var oldValue = ref.oldValue;
  52322. /* istanbul ignore if */
  52323. if (!value === !oldValue) { return }
  52324. vnode = locateNode(vnode);
  52325. var transition$$1 = vnode.data && vnode.data.transition;
  52326. if (transition$$1) {
  52327. vnode.data.show = true;
  52328. if (value) {
  52329. enter(vnode, function () {
  52330. el.style.display = el.__vOriginalDisplay;
  52331. });
  52332. } else {
  52333. leave(vnode, function () {
  52334. el.style.display = 'none';
  52335. });
  52336. }
  52337. } else {
  52338. el.style.display = value ? el.__vOriginalDisplay : 'none';
  52339. }
  52340. },
  52341. unbind: function unbind (
  52342. el,
  52343. binding,
  52344. vnode,
  52345. oldVnode,
  52346. isDestroy
  52347. ) {
  52348. if (!isDestroy) {
  52349. el.style.display = el.__vOriginalDisplay;
  52350. }
  52351. }
  52352. };
  52353. var platformDirectives = {
  52354. model: directive,
  52355. show: show
  52356. };
  52357. /* */
  52358. var transitionProps = {
  52359. name: String,
  52360. appear: Boolean,
  52361. css: Boolean,
  52362. mode: String,
  52363. type: String,
  52364. enterClass: String,
  52365. leaveClass: String,
  52366. enterToClass: String,
  52367. leaveToClass: String,
  52368. enterActiveClass: String,
  52369. leaveActiveClass: String,
  52370. appearClass: String,
  52371. appearActiveClass: String,
  52372. appearToClass: String,
  52373. duration: [Number, String, Object]
  52374. };
  52375. // in case the child is also an abstract component, e.g. <keep-alive>
  52376. // we want to recursively retrieve the real component to be rendered
  52377. function getRealChild (vnode) {
  52378. var compOptions = vnode && vnode.componentOptions;
  52379. if (compOptions && compOptions.Ctor.options.abstract) {
  52380. return getRealChild(getFirstComponentChild(compOptions.children))
  52381. } else {
  52382. return vnode
  52383. }
  52384. }
  52385. function extractTransitionData (comp) {
  52386. var data = {};
  52387. var options = comp.$options;
  52388. // props
  52389. for (var key in options.propsData) {
  52390. data[key] = comp[key];
  52391. }
  52392. // events.
  52393. // extract listeners and pass them directly to the transition methods
  52394. var listeners = options._parentListeners;
  52395. for (var key$1 in listeners) {
  52396. data[camelize(key$1)] = listeners[key$1];
  52397. }
  52398. return data
  52399. }
  52400. function placeholder (h, rawChild) {
  52401. if (/\d-keep-alive$/.test(rawChild.tag)) {
  52402. return h('keep-alive', {
  52403. props: rawChild.componentOptions.propsData
  52404. })
  52405. }
  52406. }
  52407. function hasParentTransition (vnode) {
  52408. while ((vnode = vnode.parent)) {
  52409. if (vnode.data.transition) {
  52410. return true
  52411. }
  52412. }
  52413. }
  52414. function isSameChild (child, oldChild) {
  52415. return oldChild.key === child.key && oldChild.tag === child.tag
  52416. }
  52417. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  52418. var isVShowDirective = function (d) { return d.name === 'show'; };
  52419. var Transition = {
  52420. name: 'transition',
  52421. props: transitionProps,
  52422. abstract: true,
  52423. render: function render (h) {
  52424. var this$1 = this;
  52425. var children = this.$slots.default;
  52426. if (!children) {
  52427. return
  52428. }
  52429. // filter out text nodes (possible whitespaces)
  52430. children = children.filter(isNotTextNode);
  52431. /* istanbul ignore if */
  52432. if (!children.length) {
  52433. return
  52434. }
  52435. // warn multiple elements
  52436. if (children.length > 1) {
  52437. warn(
  52438. '<transition> can only be used on a single element. Use ' +
  52439. '<transition-group> for lists.',
  52440. this.$parent
  52441. );
  52442. }
  52443. var mode = this.mode;
  52444. // warn invalid mode
  52445. if (mode && mode !== 'in-out' && mode !== 'out-in'
  52446. ) {
  52447. warn(
  52448. 'invalid <transition> mode: ' + mode,
  52449. this.$parent
  52450. );
  52451. }
  52452. var rawChild = children[0];
  52453. // if this is a component root node and the component's
  52454. // parent container node also has transition, skip.
  52455. if (hasParentTransition(this.$vnode)) {
  52456. return rawChild
  52457. }
  52458. // apply transition data to child
  52459. // use getRealChild() to ignore abstract components e.g. keep-alive
  52460. var child = getRealChild(rawChild);
  52461. /* istanbul ignore if */
  52462. if (!child) {
  52463. return rawChild
  52464. }
  52465. if (this._leaving) {
  52466. return placeholder(h, rawChild)
  52467. }
  52468. // ensure a key that is unique to the vnode type and to this transition
  52469. // component instance. This key will be used to remove pending leaving nodes
  52470. // during entering.
  52471. var id = "__transition-" + (this._uid) + "-";
  52472. child.key = child.key == null
  52473. ? child.isComment
  52474. ? id + 'comment'
  52475. : id + child.tag
  52476. : isPrimitive(child.key)
  52477. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  52478. : child.key;
  52479. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  52480. var oldRawChild = this._vnode;
  52481. var oldChild = getRealChild(oldRawChild);
  52482. // mark v-show
  52483. // so that the transition module can hand over the control to the directive
  52484. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  52485. child.data.show = true;
  52486. }
  52487. if (
  52488. oldChild &&
  52489. oldChild.data &&
  52490. !isSameChild(child, oldChild) &&
  52491. !isAsyncPlaceholder(oldChild) &&
  52492. // #6687 component root is a comment node
  52493. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  52494. ) {
  52495. // replace old child transition data with fresh one
  52496. // important for dynamic transitions!
  52497. var oldData = oldChild.data.transition = extend({}, data);
  52498. // handle transition mode
  52499. if (mode === 'out-in') {
  52500. // return placeholder node and queue update when leave finishes
  52501. this._leaving = true;
  52502. mergeVNodeHook(oldData, 'afterLeave', function () {
  52503. this$1._leaving = false;
  52504. this$1.$forceUpdate();
  52505. });
  52506. return placeholder(h, rawChild)
  52507. } else if (mode === 'in-out') {
  52508. if (isAsyncPlaceholder(child)) {
  52509. return oldRawChild
  52510. }
  52511. var delayedLeave;
  52512. var performLeave = function () { delayedLeave(); };
  52513. mergeVNodeHook(data, 'afterEnter', performLeave);
  52514. mergeVNodeHook(data, 'enterCancelled', performLeave);
  52515. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  52516. }
  52517. }
  52518. return rawChild
  52519. }
  52520. };
  52521. /* */
  52522. var props = extend({
  52523. tag: String,
  52524. moveClass: String
  52525. }, transitionProps);
  52526. delete props.mode;
  52527. var TransitionGroup = {
  52528. props: props,
  52529. beforeMount: function beforeMount () {
  52530. var this$1 = this;
  52531. var update = this._update;
  52532. this._update = function (vnode, hydrating) {
  52533. var restoreActiveInstance = setActiveInstance(this$1);
  52534. // force removing pass
  52535. this$1.__patch__(
  52536. this$1._vnode,
  52537. this$1.kept,
  52538. false, // hydrating
  52539. true // removeOnly (!important, avoids unnecessary moves)
  52540. );
  52541. this$1._vnode = this$1.kept;
  52542. restoreActiveInstance();
  52543. update.call(this$1, vnode, hydrating);
  52544. };
  52545. },
  52546. render: function render (h) {
  52547. var tag = this.tag || this.$vnode.data.tag || 'span';
  52548. var map = Object.create(null);
  52549. var prevChildren = this.prevChildren = this.children;
  52550. var rawChildren = this.$slots.default || [];
  52551. var children = this.children = [];
  52552. var transitionData = extractTransitionData(this);
  52553. for (var i = 0; i < rawChildren.length; i++) {
  52554. var c = rawChildren[i];
  52555. if (c.tag) {
  52556. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  52557. children.push(c);
  52558. map[c.key] = c
  52559. ;(c.data || (c.data = {})).transition = transitionData;
  52560. } else {
  52561. var opts = c.componentOptions;
  52562. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  52563. warn(("<transition-group> children must be keyed: <" + name + ">"));
  52564. }
  52565. }
  52566. }
  52567. if (prevChildren) {
  52568. var kept = [];
  52569. var removed = [];
  52570. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  52571. var c$1 = prevChildren[i$1];
  52572. c$1.data.transition = transitionData;
  52573. c$1.data.pos = c$1.elm.getBoundingClientRect();
  52574. if (map[c$1.key]) {
  52575. kept.push(c$1);
  52576. } else {
  52577. removed.push(c$1);
  52578. }
  52579. }
  52580. this.kept = h(tag, null, kept);
  52581. this.removed = removed;
  52582. }
  52583. return h(tag, null, children)
  52584. },
  52585. updated: function updated () {
  52586. var children = this.prevChildren;
  52587. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  52588. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  52589. return
  52590. }
  52591. // we divide the work into three loops to avoid mixing DOM reads and writes
  52592. // in each iteration - which helps prevent layout thrashing.
  52593. children.forEach(callPendingCbs);
  52594. children.forEach(recordPosition);
  52595. children.forEach(applyTranslation);
  52596. // force reflow to put everything in position
  52597. // assign to this to avoid being removed in tree-shaking
  52598. // $flow-disable-line
  52599. this._reflow = document.body.offsetHeight;
  52600. children.forEach(function (c) {
  52601. if (c.data.moved) {
  52602. var el = c.elm;
  52603. var s = el.style;
  52604. addTransitionClass(el, moveClass);
  52605. s.transform = s.WebkitTransform = s.transitionDuration = '';
  52606. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  52607. if (e && e.target !== el) {
  52608. return
  52609. }
  52610. if (!e || /transform$/.test(e.propertyName)) {
  52611. el.removeEventListener(transitionEndEvent, cb);
  52612. el._moveCb = null;
  52613. removeTransitionClass(el, moveClass);
  52614. }
  52615. });
  52616. }
  52617. });
  52618. },
  52619. methods: {
  52620. hasMove: function hasMove (el, moveClass) {
  52621. /* istanbul ignore if */
  52622. if (!hasTransition) {
  52623. return false
  52624. }
  52625. /* istanbul ignore if */
  52626. if (this._hasMove) {
  52627. return this._hasMove
  52628. }
  52629. // Detect whether an element with the move class applied has
  52630. // CSS transitions. Since the element may be inside an entering
  52631. // transition at this very moment, we make a clone of it and remove
  52632. // all other transition classes applied to ensure only the move class
  52633. // is applied.
  52634. var clone = el.cloneNode();
  52635. if (el._transitionClasses) {
  52636. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  52637. }
  52638. addClass(clone, moveClass);
  52639. clone.style.display = 'none';
  52640. this.$el.appendChild(clone);
  52641. var info = getTransitionInfo(clone);
  52642. this.$el.removeChild(clone);
  52643. return (this._hasMove = info.hasTransform)
  52644. }
  52645. }
  52646. };
  52647. function callPendingCbs (c) {
  52648. /* istanbul ignore if */
  52649. if (c.elm._moveCb) {
  52650. c.elm._moveCb();
  52651. }
  52652. /* istanbul ignore if */
  52653. if (c.elm._enterCb) {
  52654. c.elm._enterCb();
  52655. }
  52656. }
  52657. function recordPosition (c) {
  52658. c.data.newPos = c.elm.getBoundingClientRect();
  52659. }
  52660. function applyTranslation (c) {
  52661. var oldPos = c.data.pos;
  52662. var newPos = c.data.newPos;
  52663. var dx = oldPos.left - newPos.left;
  52664. var dy = oldPos.top - newPos.top;
  52665. if (dx || dy) {
  52666. c.data.moved = true;
  52667. var s = c.elm.style;
  52668. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  52669. s.transitionDuration = '0s';
  52670. }
  52671. }
  52672. var platformComponents = {
  52673. Transition: Transition,
  52674. TransitionGroup: TransitionGroup
  52675. };
  52676. /* */
  52677. // install platform specific utils
  52678. Vue.config.mustUseProp = mustUseProp;
  52679. Vue.config.isReservedTag = isReservedTag;
  52680. Vue.config.isReservedAttr = isReservedAttr;
  52681. Vue.config.getTagNamespace = getTagNamespace;
  52682. Vue.config.isUnknownElement = isUnknownElement;
  52683. // install platform runtime directives & components
  52684. extend(Vue.options.directives, platformDirectives);
  52685. extend(Vue.options.components, platformComponents);
  52686. // install platform patch function
  52687. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  52688. // public mount method
  52689. Vue.prototype.$mount = function (
  52690. el,
  52691. hydrating
  52692. ) {
  52693. el = el && inBrowser ? query(el) : undefined;
  52694. return mountComponent(this, el, hydrating)
  52695. };
  52696. // devtools global hook
  52697. /* istanbul ignore next */
  52698. if (inBrowser) {
  52699. setTimeout(function () {
  52700. if (config.devtools) {
  52701. if (devtools) {
  52702. devtools.emit('init', Vue);
  52703. } else {
  52704. console[console.info ? 'info' : 'log'](
  52705. 'Download the Vue Devtools extension for a better development experience:\n' +
  52706. 'https://github.com/vuejs/vue-devtools'
  52707. );
  52708. }
  52709. }
  52710. if (config.productionTip !== false &&
  52711. typeof console !== 'undefined'
  52712. ) {
  52713. console[console.info ? 'info' : 'log'](
  52714. "You are running Vue in development mode.\n" +
  52715. "Make sure to turn on production mode when deploying for production.\n" +
  52716. "See more tips at https://vuejs.org/guide/deployment.html"
  52717. );
  52718. }
  52719. }, 0);
  52720. }
  52721. /* */
  52722. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  52723. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  52724. var buildRegex = cached(function (delimiters) {
  52725. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  52726. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  52727. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  52728. });
  52729. function parseText (
  52730. text,
  52731. delimiters
  52732. ) {
  52733. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  52734. if (!tagRE.test(text)) {
  52735. return
  52736. }
  52737. var tokens = [];
  52738. var rawTokens = [];
  52739. var lastIndex = tagRE.lastIndex = 0;
  52740. var match, index, tokenValue;
  52741. while ((match = tagRE.exec(text))) {
  52742. index = match.index;
  52743. // push text token
  52744. if (index > lastIndex) {
  52745. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  52746. tokens.push(JSON.stringify(tokenValue));
  52747. }
  52748. // tag token
  52749. var exp = parseFilters(match[1].trim());
  52750. tokens.push(("_s(" + exp + ")"));
  52751. rawTokens.push({ '@binding': exp });
  52752. lastIndex = index + match[0].length;
  52753. }
  52754. if (lastIndex < text.length) {
  52755. rawTokens.push(tokenValue = text.slice(lastIndex));
  52756. tokens.push(JSON.stringify(tokenValue));
  52757. }
  52758. return {
  52759. expression: tokens.join('+'),
  52760. tokens: rawTokens
  52761. }
  52762. }
  52763. /* */
  52764. function transformNode (el, options) {
  52765. var warn = options.warn || baseWarn;
  52766. var staticClass = getAndRemoveAttr(el, 'class');
  52767. if (staticClass) {
  52768. var res = parseText(staticClass, options.delimiters);
  52769. if (res) {
  52770. warn(
  52771. "class=\"" + staticClass + "\": " +
  52772. 'Interpolation inside attributes has been removed. ' +
  52773. 'Use v-bind or the colon shorthand instead. For example, ' +
  52774. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  52775. el.rawAttrsMap['class']
  52776. );
  52777. }
  52778. }
  52779. if (staticClass) {
  52780. el.staticClass = JSON.stringify(staticClass);
  52781. }
  52782. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  52783. if (classBinding) {
  52784. el.classBinding = classBinding;
  52785. }
  52786. }
  52787. function genData (el) {
  52788. var data = '';
  52789. if (el.staticClass) {
  52790. data += "staticClass:" + (el.staticClass) + ",";
  52791. }
  52792. if (el.classBinding) {
  52793. data += "class:" + (el.classBinding) + ",";
  52794. }
  52795. return data
  52796. }
  52797. var klass$1 = {
  52798. staticKeys: ['staticClass'],
  52799. transformNode: transformNode,
  52800. genData: genData
  52801. };
  52802. /* */
  52803. function transformNode$1 (el, options) {
  52804. var warn = options.warn || baseWarn;
  52805. var staticStyle = getAndRemoveAttr(el, 'style');
  52806. if (staticStyle) {
  52807. /* istanbul ignore if */
  52808. {
  52809. var res = parseText(staticStyle, options.delimiters);
  52810. if (res) {
  52811. warn(
  52812. "style=\"" + staticStyle + "\": " +
  52813. 'Interpolation inside attributes has been removed. ' +
  52814. 'Use v-bind or the colon shorthand instead. For example, ' +
  52815. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  52816. el.rawAttrsMap['style']
  52817. );
  52818. }
  52819. }
  52820. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  52821. }
  52822. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  52823. if (styleBinding) {
  52824. el.styleBinding = styleBinding;
  52825. }
  52826. }
  52827. function genData$1 (el) {
  52828. var data = '';
  52829. if (el.staticStyle) {
  52830. data += "staticStyle:" + (el.staticStyle) + ",";
  52831. }
  52832. if (el.styleBinding) {
  52833. data += "style:(" + (el.styleBinding) + "),";
  52834. }
  52835. return data
  52836. }
  52837. var style$1 = {
  52838. staticKeys: ['staticStyle'],
  52839. transformNode: transformNode$1,
  52840. genData: genData$1
  52841. };
  52842. /* */
  52843. var decoder;
  52844. var he = {
  52845. decode: function decode (html) {
  52846. decoder = decoder || document.createElement('div');
  52847. decoder.innerHTML = html;
  52848. return decoder.textContent
  52849. }
  52850. };
  52851. /* */
  52852. var isUnaryTag = makeMap(
  52853. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  52854. 'link,meta,param,source,track,wbr'
  52855. );
  52856. // Elements that you can, intentionally, leave open
  52857. // (and which close themselves)
  52858. var canBeLeftOpenTag = makeMap(
  52859. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  52860. );
  52861. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  52862. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  52863. var isNonPhrasingTag = makeMap(
  52864. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  52865. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  52866. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  52867. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  52868. 'title,tr,track'
  52869. );
  52870. /**
  52871. * Not type-checking this file because it's mostly vendor code.
  52872. */
  52873. // Regular Expressions for parsing tags and attributes
  52874. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52875. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52876. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  52877. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  52878. var startTagOpen = new RegExp(("^<" + qnameCapture));
  52879. var startTagClose = /^\s*(\/?)>/;
  52880. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  52881. var doctype = /^<!DOCTYPE [^>]+>/i;
  52882. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  52883. var comment = /^<!\--/;
  52884. var conditionalComment = /^<!\[/;
  52885. // Special Elements (can contain anything)
  52886. var isPlainTextElement = makeMap('script,style,textarea', true);
  52887. var reCache = {};
  52888. var decodingMap = {
  52889. '&lt;': '<',
  52890. '&gt;': '>',
  52891. '&quot;': '"',
  52892. '&amp;': '&',
  52893. '&#10;': '\n',
  52894. '&#9;': '\t',
  52895. '&#39;': "'"
  52896. };
  52897. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  52898. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  52899. // #5992
  52900. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  52901. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  52902. function decodeAttr (value, shouldDecodeNewlines) {
  52903. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  52904. return value.replace(re, function (match) { return decodingMap[match]; })
  52905. }
  52906. function parseHTML (html, options) {
  52907. var stack = [];
  52908. var expectHTML = options.expectHTML;
  52909. var isUnaryTag$$1 = options.isUnaryTag || no;
  52910. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  52911. var index = 0;
  52912. var last, lastTag;
  52913. while (html) {
  52914. last = html;
  52915. // Make sure we're not in a plaintext content element like script/style
  52916. if (!lastTag || !isPlainTextElement(lastTag)) {
  52917. var textEnd = html.indexOf('<');
  52918. if (textEnd === 0) {
  52919. // Comment:
  52920. if (comment.test(html)) {
  52921. var commentEnd = html.indexOf('-->');
  52922. if (commentEnd >= 0) {
  52923. if (options.shouldKeepComment) {
  52924. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  52925. }
  52926. advance(commentEnd + 3);
  52927. continue
  52928. }
  52929. }
  52930. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  52931. if (conditionalComment.test(html)) {
  52932. var conditionalEnd = html.indexOf(']>');
  52933. if (conditionalEnd >= 0) {
  52934. advance(conditionalEnd + 2);
  52935. continue
  52936. }
  52937. }
  52938. // Doctype:
  52939. var doctypeMatch = html.match(doctype);
  52940. if (doctypeMatch) {
  52941. advance(doctypeMatch[0].length);
  52942. continue
  52943. }
  52944. // End tag:
  52945. var endTagMatch = html.match(endTag);
  52946. if (endTagMatch) {
  52947. var curIndex = index;
  52948. advance(endTagMatch[0].length);
  52949. parseEndTag(endTagMatch[1], curIndex, index);
  52950. continue
  52951. }
  52952. // Start tag:
  52953. var startTagMatch = parseStartTag();
  52954. if (startTagMatch) {
  52955. handleStartTag(startTagMatch);
  52956. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  52957. advance(1);
  52958. }
  52959. continue
  52960. }
  52961. }
  52962. var text = (void 0), rest = (void 0), next = (void 0);
  52963. if (textEnd >= 0) {
  52964. rest = html.slice(textEnd);
  52965. while (
  52966. !endTag.test(rest) &&
  52967. !startTagOpen.test(rest) &&
  52968. !comment.test(rest) &&
  52969. !conditionalComment.test(rest)
  52970. ) {
  52971. // < in plain text, be forgiving and treat it as text
  52972. next = rest.indexOf('<', 1);
  52973. if (next < 0) { break }
  52974. textEnd += next;
  52975. rest = html.slice(textEnd);
  52976. }
  52977. text = html.substring(0, textEnd);
  52978. }
  52979. if (textEnd < 0) {
  52980. text = html;
  52981. }
  52982. if (text) {
  52983. advance(text.length);
  52984. }
  52985. if (options.chars && text) {
  52986. options.chars(text, index - text.length, index);
  52987. }
  52988. } else {
  52989. var endTagLength = 0;
  52990. var stackedTag = lastTag.toLowerCase();
  52991. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  52992. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  52993. endTagLength = endTag.length;
  52994. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  52995. text = text
  52996. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  52997. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  52998. }
  52999. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  53000. text = text.slice(1);
  53001. }
  53002. if (options.chars) {
  53003. options.chars(text);
  53004. }
  53005. return ''
  53006. });
  53007. index += html.length - rest$1.length;
  53008. html = rest$1;
  53009. parseEndTag(stackedTag, index - endTagLength, index);
  53010. }
  53011. if (html === last) {
  53012. options.chars && options.chars(html);
  53013. if (!stack.length && options.warn) {
  53014. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  53015. }
  53016. break
  53017. }
  53018. }
  53019. // Clean up any remaining tags
  53020. parseEndTag();
  53021. function advance (n) {
  53022. index += n;
  53023. html = html.substring(n);
  53024. }
  53025. function parseStartTag () {
  53026. var start = html.match(startTagOpen);
  53027. if (start) {
  53028. var match = {
  53029. tagName: start[1],
  53030. attrs: [],
  53031. start: index
  53032. };
  53033. advance(start[0].length);
  53034. var end, attr;
  53035. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  53036. attr.start = index;
  53037. advance(attr[0].length);
  53038. attr.end = index;
  53039. match.attrs.push(attr);
  53040. }
  53041. if (end) {
  53042. match.unarySlash = end[1];
  53043. advance(end[0].length);
  53044. match.end = index;
  53045. return match
  53046. }
  53047. }
  53048. }
  53049. function handleStartTag (match) {
  53050. var tagName = match.tagName;
  53051. var unarySlash = match.unarySlash;
  53052. if (expectHTML) {
  53053. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  53054. parseEndTag(lastTag);
  53055. }
  53056. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  53057. parseEndTag(tagName);
  53058. }
  53059. }
  53060. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  53061. var l = match.attrs.length;
  53062. var attrs = new Array(l);
  53063. for (var i = 0; i < l; i++) {
  53064. var args = match.attrs[i];
  53065. var value = args[3] || args[4] || args[5] || '';
  53066. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  53067. ? options.shouldDecodeNewlinesForHref
  53068. : options.shouldDecodeNewlines;
  53069. attrs[i] = {
  53070. name: args[1],
  53071. value: decodeAttr(value, shouldDecodeNewlines)
  53072. };
  53073. if (options.outputSourceRange) {
  53074. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  53075. attrs[i].end = args.end;
  53076. }
  53077. }
  53078. if (!unary) {
  53079. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  53080. lastTag = tagName;
  53081. }
  53082. if (options.start) {
  53083. options.start(tagName, attrs, unary, match.start, match.end);
  53084. }
  53085. }
  53086. function parseEndTag (tagName, start, end) {
  53087. var pos, lowerCasedTagName;
  53088. if (start == null) { start = index; }
  53089. if (end == null) { end = index; }
  53090. // Find the closest opened tag of the same type
  53091. if (tagName) {
  53092. lowerCasedTagName = tagName.toLowerCase();
  53093. for (pos = stack.length - 1; pos >= 0; pos--) {
  53094. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  53095. break
  53096. }
  53097. }
  53098. } else {
  53099. // If no tag name is provided, clean shop
  53100. pos = 0;
  53101. }
  53102. if (pos >= 0) {
  53103. // Close all the open elements, up the stack
  53104. for (var i = stack.length - 1; i >= pos; i--) {
  53105. if (i > pos || !tagName &&
  53106. options.warn
  53107. ) {
  53108. options.warn(
  53109. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  53110. { start: stack[i].start, end: stack[i].end }
  53111. );
  53112. }
  53113. if (options.end) {
  53114. options.end(stack[i].tag, start, end);
  53115. }
  53116. }
  53117. // Remove the open elements from the stack
  53118. stack.length = pos;
  53119. lastTag = pos && stack[pos - 1].tag;
  53120. } else if (lowerCasedTagName === 'br') {
  53121. if (options.start) {
  53122. options.start(tagName, [], true, start, end);
  53123. }
  53124. } else if (lowerCasedTagName === 'p') {
  53125. if (options.start) {
  53126. options.start(tagName, [], false, start, end);
  53127. }
  53128. if (options.end) {
  53129. options.end(tagName, start, end);
  53130. }
  53131. }
  53132. }
  53133. }
  53134. /* */
  53135. var onRE = /^@|^v-on:/;
  53136. var dirRE = /^v-|^@|^:|^#/;
  53137. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  53138. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  53139. var stripParensRE = /^\(|\)$/g;
  53140. var dynamicArgRE = /^\[.*\]$/;
  53141. var argRE = /:(.*)$/;
  53142. var bindRE = /^:|^\.|^v-bind:/;
  53143. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  53144. var slotRE = /^v-slot(:|$)|^#/;
  53145. var lineBreakRE = /[\r\n]/;
  53146. var whitespaceRE$1 = /\s+/g;
  53147. var invalidAttributeRE = /[\s"'<>\/=]/;
  53148. var decodeHTMLCached = cached(he.decode);
  53149. var emptySlotScopeToken = "_empty_";
  53150. // configurable state
  53151. var warn$2;
  53152. var delimiters;
  53153. var transforms;
  53154. var preTransforms;
  53155. var postTransforms;
  53156. var platformIsPreTag;
  53157. var platformMustUseProp;
  53158. var platformGetTagNamespace;
  53159. var maybeComponent;
  53160. function createASTElement (
  53161. tag,
  53162. attrs,
  53163. parent
  53164. ) {
  53165. return {
  53166. type: 1,
  53167. tag: tag,
  53168. attrsList: attrs,
  53169. attrsMap: makeAttrsMap(attrs),
  53170. rawAttrsMap: {},
  53171. parent: parent,
  53172. children: []
  53173. }
  53174. }
  53175. /**
  53176. * Convert HTML string to AST.
  53177. */
  53178. function parse (
  53179. template,
  53180. options
  53181. ) {
  53182. warn$2 = options.warn || baseWarn;
  53183. platformIsPreTag = options.isPreTag || no;
  53184. platformMustUseProp = options.mustUseProp || no;
  53185. platformGetTagNamespace = options.getTagNamespace || no;
  53186. var isReservedTag = options.isReservedTag || no;
  53187. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  53188. transforms = pluckModuleFunction(options.modules, 'transformNode');
  53189. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  53190. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  53191. delimiters = options.delimiters;
  53192. var stack = [];
  53193. var preserveWhitespace = options.preserveWhitespace !== false;
  53194. var whitespaceOption = options.whitespace;
  53195. var root;
  53196. var currentParent;
  53197. var inVPre = false;
  53198. var inPre = false;
  53199. var warned = false;
  53200. function warnOnce (msg, range) {
  53201. if (!warned) {
  53202. warned = true;
  53203. warn$2(msg, range);
  53204. }
  53205. }
  53206. function closeElement (element) {
  53207. trimEndingWhitespace(element);
  53208. if (!inVPre && !element.processed) {
  53209. element = processElement(element, options);
  53210. }
  53211. // tree management
  53212. if (!stack.length && element !== root) {
  53213. // allow root elements with v-if, v-else-if and v-else
  53214. if (root.if && (element.elseif || element.else)) {
  53215. {
  53216. checkRootConstraints(element);
  53217. }
  53218. addIfCondition(root, {
  53219. exp: element.elseif,
  53220. block: element
  53221. });
  53222. } else {
  53223. warnOnce(
  53224. "Component template should contain exactly one root element. " +
  53225. "If you are using v-if on multiple elements, " +
  53226. "use v-else-if to chain them instead.",
  53227. { start: element.start }
  53228. );
  53229. }
  53230. }
  53231. if (currentParent && !element.forbidden) {
  53232. if (element.elseif || element.else) {
  53233. processIfConditions(element, currentParent);
  53234. } else {
  53235. if (element.slotScope) {
  53236. // scoped slot
  53237. // keep it in the children list so that v-else(-if) conditions can
  53238. // find it as the prev node.
  53239. var name = element.slotTarget || '"default"'
  53240. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  53241. }
  53242. currentParent.children.push(element);
  53243. element.parent = currentParent;
  53244. }
  53245. }
  53246. // final children cleanup
  53247. // filter out scoped slots
  53248. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  53249. // remove trailing whitespace node again
  53250. trimEndingWhitespace(element);
  53251. // check pre state
  53252. if (element.pre) {
  53253. inVPre = false;
  53254. }
  53255. if (platformIsPreTag(element.tag)) {
  53256. inPre = false;
  53257. }
  53258. // apply post-transforms
  53259. for (var i = 0; i < postTransforms.length; i++) {
  53260. postTransforms[i](element, options);
  53261. }
  53262. }
  53263. function trimEndingWhitespace (el) {
  53264. // remove trailing whitespace node
  53265. if (!inPre) {
  53266. var lastNode;
  53267. while (
  53268. (lastNode = el.children[el.children.length - 1]) &&
  53269. lastNode.type === 3 &&
  53270. lastNode.text === ' '
  53271. ) {
  53272. el.children.pop();
  53273. }
  53274. }
  53275. }
  53276. function checkRootConstraints (el) {
  53277. if (el.tag === 'slot' || el.tag === 'template') {
  53278. warnOnce(
  53279. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  53280. 'contain multiple nodes.',
  53281. { start: el.start }
  53282. );
  53283. }
  53284. if (el.attrsMap.hasOwnProperty('v-for')) {
  53285. warnOnce(
  53286. 'Cannot use v-for on stateful component root element because ' +
  53287. 'it renders multiple elements.',
  53288. el.rawAttrsMap['v-for']
  53289. );
  53290. }
  53291. }
  53292. parseHTML(template, {
  53293. warn: warn$2,
  53294. expectHTML: options.expectHTML,
  53295. isUnaryTag: options.isUnaryTag,
  53296. canBeLeftOpenTag: options.canBeLeftOpenTag,
  53297. shouldDecodeNewlines: options.shouldDecodeNewlines,
  53298. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  53299. shouldKeepComment: options.comments,
  53300. outputSourceRange: options.outputSourceRange,
  53301. start: function start (tag, attrs, unary, start$1, end) {
  53302. // check namespace.
  53303. // inherit parent ns if there is one
  53304. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  53305. // handle IE svg bug
  53306. /* istanbul ignore if */
  53307. if (isIE && ns === 'svg') {
  53308. attrs = guardIESVGBug(attrs);
  53309. }
  53310. var element = createASTElement(tag, attrs, currentParent);
  53311. if (ns) {
  53312. element.ns = ns;
  53313. }
  53314. {
  53315. if (options.outputSourceRange) {
  53316. element.start = start$1;
  53317. element.end = end;
  53318. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  53319. cumulated[attr.name] = attr;
  53320. return cumulated
  53321. }, {});
  53322. }
  53323. attrs.forEach(function (attr) {
  53324. if (invalidAttributeRE.test(attr.name)) {
  53325. warn$2(
  53326. "Invalid dynamic argument expression: attribute names cannot contain " +
  53327. "spaces, quotes, <, >, / or =.",
  53328. {
  53329. start: attr.start + attr.name.indexOf("["),
  53330. end: attr.start + attr.name.length
  53331. }
  53332. );
  53333. }
  53334. });
  53335. }
  53336. if (isForbiddenTag(element) && !isServerRendering()) {
  53337. element.forbidden = true;
  53338. warn$2(
  53339. 'Templates should only be responsible for mapping the state to the ' +
  53340. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  53341. "<" + tag + ">" + ', as they will not be parsed.',
  53342. { start: element.start }
  53343. );
  53344. }
  53345. // apply pre-transforms
  53346. for (var i = 0; i < preTransforms.length; i++) {
  53347. element = preTransforms[i](element, options) || element;
  53348. }
  53349. if (!inVPre) {
  53350. processPre(element);
  53351. if (element.pre) {
  53352. inVPre = true;
  53353. }
  53354. }
  53355. if (platformIsPreTag(element.tag)) {
  53356. inPre = true;
  53357. }
  53358. if (inVPre) {
  53359. processRawAttrs(element);
  53360. } else if (!element.processed) {
  53361. // structural directives
  53362. processFor(element);
  53363. processIf(element);
  53364. processOnce(element);
  53365. }
  53366. if (!root) {
  53367. root = element;
  53368. {
  53369. checkRootConstraints(root);
  53370. }
  53371. }
  53372. if (!unary) {
  53373. currentParent = element;
  53374. stack.push(element);
  53375. } else {
  53376. closeElement(element);
  53377. }
  53378. },
  53379. end: function end (tag, start, end$1) {
  53380. var element = stack[stack.length - 1];
  53381. // pop stack
  53382. stack.length -= 1;
  53383. currentParent = stack[stack.length - 1];
  53384. if (options.outputSourceRange) {
  53385. element.end = end$1;
  53386. }
  53387. closeElement(element);
  53388. },
  53389. chars: function chars (text, start, end) {
  53390. if (!currentParent) {
  53391. {
  53392. if (text === template) {
  53393. warnOnce(
  53394. 'Component template requires a root element, rather than just text.',
  53395. { start: start }
  53396. );
  53397. } else if ((text = text.trim())) {
  53398. warnOnce(
  53399. ("text \"" + text + "\" outside root element will be ignored."),
  53400. { start: start }
  53401. );
  53402. }
  53403. }
  53404. return
  53405. }
  53406. // IE textarea placeholder bug
  53407. /* istanbul ignore if */
  53408. if (isIE &&
  53409. currentParent.tag === 'textarea' &&
  53410. currentParent.attrsMap.placeholder === text
  53411. ) {
  53412. return
  53413. }
  53414. var children = currentParent.children;
  53415. if (inPre || text.trim()) {
  53416. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  53417. } else if (!children.length) {
  53418. // remove the whitespace-only node right after an opening tag
  53419. text = '';
  53420. } else if (whitespaceOption) {
  53421. if (whitespaceOption === 'condense') {
  53422. // in condense mode, remove the whitespace node if it contains
  53423. // line break, otherwise condense to a single space
  53424. text = lineBreakRE.test(text) ? '' : ' ';
  53425. } else {
  53426. text = ' ';
  53427. }
  53428. } else {
  53429. text = preserveWhitespace ? ' ' : '';
  53430. }
  53431. if (text) {
  53432. if (!inPre && whitespaceOption === 'condense') {
  53433. // condense consecutive whitespaces into single space
  53434. text = text.replace(whitespaceRE$1, ' ');
  53435. }
  53436. var res;
  53437. var child;
  53438. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  53439. child = {
  53440. type: 2,
  53441. expression: res.expression,
  53442. tokens: res.tokens,
  53443. text: text
  53444. };
  53445. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  53446. child = {
  53447. type: 3,
  53448. text: text
  53449. };
  53450. }
  53451. if (child) {
  53452. if (options.outputSourceRange) {
  53453. child.start = start;
  53454. child.end = end;
  53455. }
  53456. children.push(child);
  53457. }
  53458. }
  53459. },
  53460. comment: function comment (text, start, end) {
  53461. // adding anyting as a sibling to the root node is forbidden
  53462. // comments should still be allowed, but ignored
  53463. if (currentParent) {
  53464. var child = {
  53465. type: 3,
  53466. text: text,
  53467. isComment: true
  53468. };
  53469. if (options.outputSourceRange) {
  53470. child.start = start;
  53471. child.end = end;
  53472. }
  53473. currentParent.children.push(child);
  53474. }
  53475. }
  53476. });
  53477. return root
  53478. }
  53479. function processPre (el) {
  53480. if (getAndRemoveAttr(el, 'v-pre') != null) {
  53481. el.pre = true;
  53482. }
  53483. }
  53484. function processRawAttrs (el) {
  53485. var list = el.attrsList;
  53486. var len = list.length;
  53487. if (len) {
  53488. var attrs = el.attrs = new Array(len);
  53489. for (var i = 0; i < len; i++) {
  53490. attrs[i] = {
  53491. name: list[i].name,
  53492. value: JSON.stringify(list[i].value)
  53493. };
  53494. if (list[i].start != null) {
  53495. attrs[i].start = list[i].start;
  53496. attrs[i].end = list[i].end;
  53497. }
  53498. }
  53499. } else if (!el.pre) {
  53500. // non root node in pre blocks with no attributes
  53501. el.plain = true;
  53502. }
  53503. }
  53504. function processElement (
  53505. element,
  53506. options
  53507. ) {
  53508. processKey(element);
  53509. // determine whether this is a plain element after
  53510. // removing structural attributes
  53511. element.plain = (
  53512. !element.key &&
  53513. !element.scopedSlots &&
  53514. !element.attrsList.length
  53515. );
  53516. processRef(element);
  53517. processSlotContent(element);
  53518. processSlotOutlet(element);
  53519. processComponent(element);
  53520. for (var i = 0; i < transforms.length; i++) {
  53521. element = transforms[i](element, options) || element;
  53522. }
  53523. processAttrs(element);
  53524. return element
  53525. }
  53526. function processKey (el) {
  53527. var exp = getBindingAttr(el, 'key');
  53528. if (exp) {
  53529. {
  53530. if (el.tag === 'template') {
  53531. warn$2(
  53532. "<template> cannot be keyed. Place the key on real elements instead.",
  53533. getRawBindingAttr(el, 'key')
  53534. );
  53535. }
  53536. if (el.for) {
  53537. var iterator = el.iterator2 || el.iterator1;
  53538. var parent = el.parent;
  53539. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  53540. warn$2(
  53541. "Do not use v-for index as key on <transition-group> children, " +
  53542. "this is the same as not using keys.",
  53543. getRawBindingAttr(el, 'key'),
  53544. true /* tip */
  53545. );
  53546. }
  53547. }
  53548. }
  53549. el.key = exp;
  53550. }
  53551. }
  53552. function processRef (el) {
  53553. var ref = getBindingAttr(el, 'ref');
  53554. if (ref) {
  53555. el.ref = ref;
  53556. el.refInFor = checkInFor(el);
  53557. }
  53558. }
  53559. function processFor (el) {
  53560. var exp;
  53561. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  53562. var res = parseFor(exp);
  53563. if (res) {
  53564. extend(el, res);
  53565. } else {
  53566. warn$2(
  53567. ("Invalid v-for expression: " + exp),
  53568. el.rawAttrsMap['v-for']
  53569. );
  53570. }
  53571. }
  53572. }
  53573. function parseFor (exp) {
  53574. var inMatch = exp.match(forAliasRE);
  53575. if (!inMatch) { return }
  53576. var res = {};
  53577. res.for = inMatch[2].trim();
  53578. var alias = inMatch[1].trim().replace(stripParensRE, '');
  53579. var iteratorMatch = alias.match(forIteratorRE);
  53580. if (iteratorMatch) {
  53581. res.alias = alias.replace(forIteratorRE, '').trim();
  53582. res.iterator1 = iteratorMatch[1].trim();
  53583. if (iteratorMatch[2]) {
  53584. res.iterator2 = iteratorMatch[2].trim();
  53585. }
  53586. } else {
  53587. res.alias = alias;
  53588. }
  53589. return res
  53590. }
  53591. function processIf (el) {
  53592. var exp = getAndRemoveAttr(el, 'v-if');
  53593. if (exp) {
  53594. el.if = exp;
  53595. addIfCondition(el, {
  53596. exp: exp,
  53597. block: el
  53598. });
  53599. } else {
  53600. if (getAndRemoveAttr(el, 'v-else') != null) {
  53601. el.else = true;
  53602. }
  53603. var elseif = getAndRemoveAttr(el, 'v-else-if');
  53604. if (elseif) {
  53605. el.elseif = elseif;
  53606. }
  53607. }
  53608. }
  53609. function processIfConditions (el, parent) {
  53610. var prev = findPrevElement(parent.children);
  53611. if (prev && prev.if) {
  53612. addIfCondition(prev, {
  53613. exp: el.elseif,
  53614. block: el
  53615. });
  53616. } else {
  53617. warn$2(
  53618. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  53619. "used on element <" + (el.tag) + "> without corresponding v-if.",
  53620. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  53621. );
  53622. }
  53623. }
  53624. function findPrevElement (children) {
  53625. var i = children.length;
  53626. while (i--) {
  53627. if (children[i].type === 1) {
  53628. return children[i]
  53629. } else {
  53630. if (children[i].text !== ' ') {
  53631. warn$2(
  53632. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  53633. "will be ignored.",
  53634. children[i]
  53635. );
  53636. }
  53637. children.pop();
  53638. }
  53639. }
  53640. }
  53641. function addIfCondition (el, condition) {
  53642. if (!el.ifConditions) {
  53643. el.ifConditions = [];
  53644. }
  53645. el.ifConditions.push(condition);
  53646. }
  53647. function processOnce (el) {
  53648. var once$$1 = getAndRemoveAttr(el, 'v-once');
  53649. if (once$$1 != null) {
  53650. el.once = true;
  53651. }
  53652. }
  53653. // handle content being passed to a component as slot,
  53654. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  53655. function processSlotContent (el) {
  53656. var slotScope;
  53657. if (el.tag === 'template') {
  53658. slotScope = getAndRemoveAttr(el, 'scope');
  53659. /* istanbul ignore if */
  53660. if (slotScope) {
  53661. warn$2(
  53662. "the \"scope\" attribute for scoped slots have been deprecated and " +
  53663. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  53664. "can also be used on plain elements in addition to <template> to " +
  53665. "denote scoped slots.",
  53666. el.rawAttrsMap['scope'],
  53667. true
  53668. );
  53669. }
  53670. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  53671. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  53672. /* istanbul ignore if */
  53673. if (el.attrsMap['v-for']) {
  53674. warn$2(
  53675. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  53676. "(v-for takes higher priority). Use a wrapper <template> for the " +
  53677. "scoped slot to make it clearer.",
  53678. el.rawAttrsMap['slot-scope'],
  53679. true
  53680. );
  53681. }
  53682. el.slotScope = slotScope;
  53683. }
  53684. // slot="xxx"
  53685. var slotTarget = getBindingAttr(el, 'slot');
  53686. if (slotTarget) {
  53687. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  53688. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  53689. // preserve slot as an attribute for native shadow DOM compat
  53690. // only for non-scoped slots.
  53691. if (el.tag !== 'template' && !el.slotScope) {
  53692. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  53693. }
  53694. }
  53695. // 2.6 v-slot syntax
  53696. {
  53697. if (el.tag === 'template') {
  53698. // v-slot on <template>
  53699. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  53700. if (slotBinding) {
  53701. {
  53702. if (el.slotTarget || el.slotScope) {
  53703. warn$2(
  53704. "Unexpected mixed usage of different slot syntaxes.",
  53705. el
  53706. );
  53707. }
  53708. if (el.parent && !maybeComponent(el.parent)) {
  53709. warn$2(
  53710. "<template v-slot> can only appear at the root level inside " +
  53711. "the receiving component",
  53712. el
  53713. );
  53714. }
  53715. }
  53716. var ref = getSlotName(slotBinding);
  53717. var name = ref.name;
  53718. var dynamic = ref.dynamic;
  53719. el.slotTarget = name;
  53720. el.slotTargetDynamic = dynamic;
  53721. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  53722. }
  53723. } else {
  53724. // v-slot on component, denotes default slot
  53725. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  53726. if (slotBinding$1) {
  53727. {
  53728. if (!maybeComponent(el)) {
  53729. warn$2(
  53730. "v-slot can only be used on components or <template>.",
  53731. slotBinding$1
  53732. );
  53733. }
  53734. if (el.slotScope || el.slotTarget) {
  53735. warn$2(
  53736. "Unexpected mixed usage of different slot syntaxes.",
  53737. el
  53738. );
  53739. }
  53740. if (el.scopedSlots) {
  53741. warn$2(
  53742. "To avoid scope ambiguity, the default slot should also use " +
  53743. "<template> syntax when there are other named slots.",
  53744. slotBinding$1
  53745. );
  53746. }
  53747. }
  53748. // add the component's children to its default slot
  53749. var slots = el.scopedSlots || (el.scopedSlots = {});
  53750. var ref$1 = getSlotName(slotBinding$1);
  53751. var name$1 = ref$1.name;
  53752. var dynamic$1 = ref$1.dynamic;
  53753. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  53754. slotContainer.slotTarget = name$1;
  53755. slotContainer.slotTargetDynamic = dynamic$1;
  53756. slotContainer.children = el.children.filter(function (c) {
  53757. if (!c.slotScope) {
  53758. c.parent = slotContainer;
  53759. return true
  53760. }
  53761. });
  53762. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  53763. // remove children as they are returned from scopedSlots now
  53764. el.children = [];
  53765. // mark el non-plain so data gets generated
  53766. el.plain = false;
  53767. }
  53768. }
  53769. }
  53770. }
  53771. function getSlotName (binding) {
  53772. var name = binding.name.replace(slotRE, '');
  53773. if (!name) {
  53774. if (binding.name[0] !== '#') {
  53775. name = 'default';
  53776. } else {
  53777. warn$2(
  53778. "v-slot shorthand syntax requires a slot name.",
  53779. binding
  53780. );
  53781. }
  53782. }
  53783. return dynamicArgRE.test(name)
  53784. // dynamic [name]
  53785. ? { name: name.slice(1, -1), dynamic: true }
  53786. // static name
  53787. : { name: ("\"" + name + "\""), dynamic: false }
  53788. }
  53789. // handle <slot/> outlets
  53790. function processSlotOutlet (el) {
  53791. if (el.tag === 'slot') {
  53792. el.slotName = getBindingAttr(el, 'name');
  53793. if (el.key) {
  53794. warn$2(
  53795. "`key` does not work on <slot> because slots are abstract outlets " +
  53796. "and can possibly expand into multiple elements. " +
  53797. "Use the key on a wrapping element instead.",
  53798. getRawBindingAttr(el, 'key')
  53799. );
  53800. }
  53801. }
  53802. }
  53803. function processComponent (el) {
  53804. var binding;
  53805. if ((binding = getBindingAttr(el, 'is'))) {
  53806. el.component = binding;
  53807. }
  53808. if (getAndRemoveAttr(el, 'inline-template') != null) {
  53809. el.inlineTemplate = true;
  53810. }
  53811. }
  53812. function processAttrs (el) {
  53813. var list = el.attrsList;
  53814. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  53815. for (i = 0, l = list.length; i < l; i++) {
  53816. name = rawName = list[i].name;
  53817. value = list[i].value;
  53818. if (dirRE.test(name)) {
  53819. // mark element as dynamic
  53820. el.hasBindings = true;
  53821. // modifiers
  53822. modifiers = parseModifiers(name.replace(dirRE, ''));
  53823. // support .foo shorthand syntax for the .prop modifier
  53824. if (modifiers) {
  53825. name = name.replace(modifierRE, '');
  53826. }
  53827. if (bindRE.test(name)) { // v-bind
  53828. name = name.replace(bindRE, '');
  53829. value = parseFilters(value);
  53830. isDynamic = dynamicArgRE.test(name);
  53831. if (isDynamic) {
  53832. name = name.slice(1, -1);
  53833. }
  53834. if (
  53835. value.trim().length === 0
  53836. ) {
  53837. warn$2(
  53838. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  53839. );
  53840. }
  53841. if (modifiers) {
  53842. if (modifiers.prop && !isDynamic) {
  53843. name = camelize(name);
  53844. if (name === 'innerHtml') { name = 'innerHTML'; }
  53845. }
  53846. if (modifiers.camel && !isDynamic) {
  53847. name = camelize(name);
  53848. }
  53849. if (modifiers.sync) {
  53850. syncGen = genAssignmentCode(value, "$event");
  53851. if (!isDynamic) {
  53852. addHandler(
  53853. el,
  53854. ("update:" + (camelize(name))),
  53855. syncGen,
  53856. null,
  53857. false,
  53858. warn$2,
  53859. list[i]
  53860. );
  53861. if (hyphenate(name) !== camelize(name)) {
  53862. addHandler(
  53863. el,
  53864. ("update:" + (hyphenate(name))),
  53865. syncGen,
  53866. null,
  53867. false,
  53868. warn$2,
  53869. list[i]
  53870. );
  53871. }
  53872. } else {
  53873. // handler w/ dynamic event name
  53874. addHandler(
  53875. el,
  53876. ("\"update:\"+(" + name + ")"),
  53877. syncGen,
  53878. null,
  53879. false,
  53880. warn$2,
  53881. list[i],
  53882. true // dynamic
  53883. );
  53884. }
  53885. }
  53886. }
  53887. if ((modifiers && modifiers.prop) || (
  53888. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  53889. )) {
  53890. addProp(el, name, value, list[i], isDynamic);
  53891. } else {
  53892. addAttr(el, name, value, list[i], isDynamic);
  53893. }
  53894. } else if (onRE.test(name)) { // v-on
  53895. name = name.replace(onRE, '');
  53896. isDynamic = dynamicArgRE.test(name);
  53897. if (isDynamic) {
  53898. name = name.slice(1, -1);
  53899. }
  53900. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  53901. } else { // normal directives
  53902. name = name.replace(dirRE, '');
  53903. // parse arg
  53904. var argMatch = name.match(argRE);
  53905. var arg = argMatch && argMatch[1];
  53906. isDynamic = false;
  53907. if (arg) {
  53908. name = name.slice(0, -(arg.length + 1));
  53909. if (dynamicArgRE.test(arg)) {
  53910. arg = arg.slice(1, -1);
  53911. isDynamic = true;
  53912. }
  53913. }
  53914. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  53915. if (name === 'model') {
  53916. checkForAliasModel(el, value);
  53917. }
  53918. }
  53919. } else {
  53920. // literal attribute
  53921. {
  53922. var res = parseText(value, delimiters);
  53923. if (res) {
  53924. warn$2(
  53925. name + "=\"" + value + "\": " +
  53926. 'Interpolation inside attributes has been removed. ' +
  53927. 'Use v-bind or the colon shorthand instead. For example, ' +
  53928. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  53929. list[i]
  53930. );
  53931. }
  53932. }
  53933. addAttr(el, name, JSON.stringify(value), list[i]);
  53934. // #6887 firefox doesn't update muted state if set via attribute
  53935. // even immediately after element creation
  53936. if (!el.component &&
  53937. name === 'muted' &&
  53938. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  53939. addProp(el, name, 'true', list[i]);
  53940. }
  53941. }
  53942. }
  53943. }
  53944. function checkInFor (el) {
  53945. var parent = el;
  53946. while (parent) {
  53947. if (parent.for !== undefined) {
  53948. return true
  53949. }
  53950. parent = parent.parent;
  53951. }
  53952. return false
  53953. }
  53954. function parseModifiers (name) {
  53955. var match = name.match(modifierRE);
  53956. if (match) {
  53957. var ret = {};
  53958. match.forEach(function (m) { ret[m.slice(1)] = true; });
  53959. return ret
  53960. }
  53961. }
  53962. function makeAttrsMap (attrs) {
  53963. var map = {};
  53964. for (var i = 0, l = attrs.length; i < l; i++) {
  53965. if (
  53966. map[attrs[i].name] && !isIE && !isEdge
  53967. ) {
  53968. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  53969. }
  53970. map[attrs[i].name] = attrs[i].value;
  53971. }
  53972. return map
  53973. }
  53974. // for script (e.g. type="x/template") or style, do not decode content
  53975. function isTextTag (el) {
  53976. return el.tag === 'script' || el.tag === 'style'
  53977. }
  53978. function isForbiddenTag (el) {
  53979. return (
  53980. el.tag === 'style' ||
  53981. (el.tag === 'script' && (
  53982. !el.attrsMap.type ||
  53983. el.attrsMap.type === 'text/javascript'
  53984. ))
  53985. )
  53986. }
  53987. var ieNSBug = /^xmlns:NS\d+/;
  53988. var ieNSPrefix = /^NS\d+:/;
  53989. /* istanbul ignore next */
  53990. function guardIESVGBug (attrs) {
  53991. var res = [];
  53992. for (var i = 0; i < attrs.length; i++) {
  53993. var attr = attrs[i];
  53994. if (!ieNSBug.test(attr.name)) {
  53995. attr.name = attr.name.replace(ieNSPrefix, '');
  53996. res.push(attr);
  53997. }
  53998. }
  53999. return res
  54000. }
  54001. function checkForAliasModel (el, value) {
  54002. var _el = el;
  54003. while (_el) {
  54004. if (_el.for && _el.alias === value) {
  54005. warn$2(
  54006. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  54007. "You are binding v-model directly to a v-for iteration alias. " +
  54008. "This will not be able to modify the v-for source array because " +
  54009. "writing to the alias is like modifying a function local variable. " +
  54010. "Consider using an array of objects and use v-model on an object property instead.",
  54011. el.rawAttrsMap['v-model']
  54012. );
  54013. }
  54014. _el = _el.parent;
  54015. }
  54016. }
  54017. /* */
  54018. function preTransformNode (el, options) {
  54019. if (el.tag === 'input') {
  54020. var map = el.attrsMap;
  54021. if (!map['v-model']) {
  54022. return
  54023. }
  54024. var typeBinding;
  54025. if (map[':type'] || map['v-bind:type']) {
  54026. typeBinding = getBindingAttr(el, 'type');
  54027. }
  54028. if (!map.type && !typeBinding && map['v-bind']) {
  54029. typeBinding = "(" + (map['v-bind']) + ").type";
  54030. }
  54031. if (typeBinding) {
  54032. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  54033. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  54034. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  54035. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  54036. // 1. checkbox
  54037. var branch0 = cloneASTElement(el);
  54038. // process for on the main node
  54039. processFor(branch0);
  54040. addRawAttr(branch0, 'type', 'checkbox');
  54041. processElement(branch0, options);
  54042. branch0.processed = true; // prevent it from double-processed
  54043. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  54044. addIfCondition(branch0, {
  54045. exp: branch0.if,
  54046. block: branch0
  54047. });
  54048. // 2. add radio else-if condition
  54049. var branch1 = cloneASTElement(el);
  54050. getAndRemoveAttr(branch1, 'v-for', true);
  54051. addRawAttr(branch1, 'type', 'radio');
  54052. processElement(branch1, options);
  54053. addIfCondition(branch0, {
  54054. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  54055. block: branch1
  54056. });
  54057. // 3. other
  54058. var branch2 = cloneASTElement(el);
  54059. getAndRemoveAttr(branch2, 'v-for', true);
  54060. addRawAttr(branch2, ':type', typeBinding);
  54061. processElement(branch2, options);
  54062. addIfCondition(branch0, {
  54063. exp: ifCondition,
  54064. block: branch2
  54065. });
  54066. if (hasElse) {
  54067. branch0.else = true;
  54068. } else if (elseIfCondition) {
  54069. branch0.elseif = elseIfCondition;
  54070. }
  54071. return branch0
  54072. }
  54073. }
  54074. }
  54075. function cloneASTElement (el) {
  54076. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  54077. }
  54078. var model$1 = {
  54079. preTransformNode: preTransformNode
  54080. };
  54081. var modules$1 = [
  54082. klass$1,
  54083. style$1,
  54084. model$1
  54085. ];
  54086. /* */
  54087. function text (el, dir) {
  54088. if (dir.value) {
  54089. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  54090. }
  54091. }
  54092. /* */
  54093. function html (el, dir) {
  54094. if (dir.value) {
  54095. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  54096. }
  54097. }
  54098. var directives$1 = {
  54099. model: model,
  54100. text: text,
  54101. html: html
  54102. };
  54103. /* */
  54104. var baseOptions = {
  54105. expectHTML: true,
  54106. modules: modules$1,
  54107. directives: directives$1,
  54108. isPreTag: isPreTag,
  54109. isUnaryTag: isUnaryTag,
  54110. mustUseProp: mustUseProp,
  54111. canBeLeftOpenTag: canBeLeftOpenTag,
  54112. isReservedTag: isReservedTag,
  54113. getTagNamespace: getTagNamespace,
  54114. staticKeys: genStaticKeys(modules$1)
  54115. };
  54116. /* */
  54117. var isStaticKey;
  54118. var isPlatformReservedTag;
  54119. var genStaticKeysCached = cached(genStaticKeys$1);
  54120. /**
  54121. * Goal of the optimizer: walk the generated template AST tree
  54122. * and detect sub-trees that are purely static, i.e. parts of
  54123. * the DOM that never needs to change.
  54124. *
  54125. * Once we detect these sub-trees, we can:
  54126. *
  54127. * 1. Hoist them into constants, so that we no longer need to
  54128. * create fresh nodes for them on each re-render;
  54129. * 2. Completely skip them in the patching process.
  54130. */
  54131. function optimize (root, options) {
  54132. if (!root) { return }
  54133. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  54134. isPlatformReservedTag = options.isReservedTag || no;
  54135. // first pass: mark all non-static nodes.
  54136. markStatic$1(root);
  54137. // second pass: mark static roots.
  54138. markStaticRoots(root, false);
  54139. }
  54140. function genStaticKeys$1 (keys) {
  54141. return makeMap(
  54142. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  54143. (keys ? ',' + keys : '')
  54144. )
  54145. }
  54146. function markStatic$1 (node) {
  54147. node.static = isStatic(node);
  54148. if (node.type === 1) {
  54149. // do not make component slot content static. this avoids
  54150. // 1. components not able to mutate slot nodes
  54151. // 2. static slot content fails for hot-reloading
  54152. if (
  54153. !isPlatformReservedTag(node.tag) &&
  54154. node.tag !== 'slot' &&
  54155. node.attrsMap['inline-template'] == null
  54156. ) {
  54157. return
  54158. }
  54159. for (var i = 0, l = node.children.length; i < l; i++) {
  54160. var child = node.children[i];
  54161. markStatic$1(child);
  54162. if (!child.static) {
  54163. node.static = false;
  54164. }
  54165. }
  54166. if (node.ifConditions) {
  54167. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  54168. var block = node.ifConditions[i$1].block;
  54169. markStatic$1(block);
  54170. if (!block.static) {
  54171. node.static = false;
  54172. }
  54173. }
  54174. }
  54175. }
  54176. }
  54177. function markStaticRoots (node, isInFor) {
  54178. if (node.type === 1) {
  54179. if (node.static || node.once) {
  54180. node.staticInFor = isInFor;
  54181. }
  54182. // For a node to qualify as a static root, it should have children that
  54183. // are not just static text. Otherwise the cost of hoisting out will
  54184. // outweigh the benefits and it's better off to just always render it fresh.
  54185. if (node.static && node.children.length && !(
  54186. node.children.length === 1 &&
  54187. node.children[0].type === 3
  54188. )) {
  54189. node.staticRoot = true;
  54190. return
  54191. } else {
  54192. node.staticRoot = false;
  54193. }
  54194. if (node.children) {
  54195. for (var i = 0, l = node.children.length; i < l; i++) {
  54196. markStaticRoots(node.children[i], isInFor || !!node.for);
  54197. }
  54198. }
  54199. if (node.ifConditions) {
  54200. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  54201. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  54202. }
  54203. }
  54204. }
  54205. }
  54206. function isStatic (node) {
  54207. if (node.type === 2) { // expression
  54208. return false
  54209. }
  54210. if (node.type === 3) { // text
  54211. return true
  54212. }
  54213. return !!(node.pre || (
  54214. !node.hasBindings && // no dynamic bindings
  54215. !node.if && !node.for && // not v-if or v-for or v-else
  54216. !isBuiltInTag(node.tag) && // not a built-in
  54217. isPlatformReservedTag(node.tag) && // not a component
  54218. !isDirectChildOfTemplateFor(node) &&
  54219. Object.keys(node).every(isStaticKey)
  54220. ))
  54221. }
  54222. function isDirectChildOfTemplateFor (node) {
  54223. while (node.parent) {
  54224. node = node.parent;
  54225. if (node.tag !== 'template') {
  54226. return false
  54227. }
  54228. if (node.for) {
  54229. return true
  54230. }
  54231. }
  54232. return false
  54233. }
  54234. /* */
  54235. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  54236. var fnInvokeRE = /\([^)]*?\);*$/;
  54237. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  54238. // KeyboardEvent.keyCode aliases
  54239. var keyCodes = {
  54240. esc: 27,
  54241. tab: 9,
  54242. enter: 13,
  54243. space: 32,
  54244. up: 38,
  54245. left: 37,
  54246. right: 39,
  54247. down: 40,
  54248. 'delete': [8, 46]
  54249. };
  54250. // KeyboardEvent.key aliases
  54251. var keyNames = {
  54252. // #7880: IE11 and Edge use `Esc` for Escape key name.
  54253. esc: ['Esc', 'Escape'],
  54254. tab: 'Tab',
  54255. enter: 'Enter',
  54256. // #9112: IE11 uses `Spacebar` for Space key name.
  54257. space: [' ', 'Spacebar'],
  54258. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  54259. up: ['Up', 'ArrowUp'],
  54260. left: ['Left', 'ArrowLeft'],
  54261. right: ['Right', 'ArrowRight'],
  54262. down: ['Down', 'ArrowDown'],
  54263. // #9112: IE11 uses `Del` for Delete key name.
  54264. 'delete': ['Backspace', 'Delete', 'Del']
  54265. };
  54266. // #4868: modifiers that prevent the execution of the listener
  54267. // need to explicitly return null so that we can determine whether to remove
  54268. // the listener for .once
  54269. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  54270. var modifierCode = {
  54271. stop: '$event.stopPropagation();',
  54272. prevent: '$event.preventDefault();',
  54273. self: genGuard("$event.target !== $event.currentTarget"),
  54274. ctrl: genGuard("!$event.ctrlKey"),
  54275. shift: genGuard("!$event.shiftKey"),
  54276. alt: genGuard("!$event.altKey"),
  54277. meta: genGuard("!$event.metaKey"),
  54278. left: genGuard("'button' in $event && $event.button !== 0"),
  54279. middle: genGuard("'button' in $event && $event.button !== 1"),
  54280. right: genGuard("'button' in $event && $event.button !== 2")
  54281. };
  54282. function genHandlers (
  54283. events,
  54284. isNative
  54285. ) {
  54286. var prefix = isNative ? 'nativeOn:' : 'on:';
  54287. var staticHandlers = "";
  54288. var dynamicHandlers = "";
  54289. for (var name in events) {
  54290. var handlerCode = genHandler(events[name]);
  54291. if (events[name] && events[name].dynamic) {
  54292. dynamicHandlers += name + "," + handlerCode + ",";
  54293. } else {
  54294. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  54295. }
  54296. }
  54297. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  54298. if (dynamicHandlers) {
  54299. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  54300. } else {
  54301. return prefix + staticHandlers
  54302. }
  54303. }
  54304. function genHandler (handler) {
  54305. if (!handler) {
  54306. return 'function(){}'
  54307. }
  54308. if (Array.isArray(handler)) {
  54309. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  54310. }
  54311. var isMethodPath = simplePathRE.test(handler.value);
  54312. var isFunctionExpression = fnExpRE.test(handler.value);
  54313. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  54314. if (!handler.modifiers) {
  54315. if (isMethodPath || isFunctionExpression) {
  54316. return handler.value
  54317. }
  54318. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  54319. } else {
  54320. var code = '';
  54321. var genModifierCode = '';
  54322. var keys = [];
  54323. for (var key in handler.modifiers) {
  54324. if (modifierCode[key]) {
  54325. genModifierCode += modifierCode[key];
  54326. // left/right
  54327. if (keyCodes[key]) {
  54328. keys.push(key);
  54329. }
  54330. } else if (key === 'exact') {
  54331. var modifiers = (handler.modifiers);
  54332. genModifierCode += genGuard(
  54333. ['ctrl', 'shift', 'alt', 'meta']
  54334. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  54335. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  54336. .join('||')
  54337. );
  54338. } else {
  54339. keys.push(key);
  54340. }
  54341. }
  54342. if (keys.length) {
  54343. code += genKeyFilter(keys);
  54344. }
  54345. // Make sure modifiers like prevent and stop get executed after key filtering
  54346. if (genModifierCode) {
  54347. code += genModifierCode;
  54348. }
  54349. var handlerCode = isMethodPath
  54350. ? ("return " + (handler.value) + "($event)")
  54351. : isFunctionExpression
  54352. ? ("return (" + (handler.value) + ")($event)")
  54353. : isFunctionInvocation
  54354. ? ("return " + (handler.value))
  54355. : handler.value;
  54356. return ("function($event){" + code + handlerCode + "}")
  54357. }
  54358. }
  54359. function genKeyFilter (keys) {
  54360. return (
  54361. // make sure the key filters only apply to KeyboardEvents
  54362. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  54363. // key events that do not have keyCode property...
  54364. "if(!$event.type.indexOf('key')&&" +
  54365. (keys.map(genFilterCode).join('&&')) + ")return null;"
  54366. )
  54367. }
  54368. function genFilterCode (key) {
  54369. var keyVal = parseInt(key, 10);
  54370. if (keyVal) {
  54371. return ("$event.keyCode!==" + keyVal)
  54372. }
  54373. var keyCode = keyCodes[key];
  54374. var keyName = keyNames[key];
  54375. return (
  54376. "_k($event.keyCode," +
  54377. (JSON.stringify(key)) + "," +
  54378. (JSON.stringify(keyCode)) + "," +
  54379. "$event.key," +
  54380. "" + (JSON.stringify(keyName)) +
  54381. ")"
  54382. )
  54383. }
  54384. /* */
  54385. function on (el, dir) {
  54386. if (dir.modifiers) {
  54387. warn("v-on without argument does not support modifiers.");
  54388. }
  54389. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  54390. }
  54391. /* */
  54392. function bind$1 (el, dir) {
  54393. el.wrapData = function (code) {
  54394. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  54395. };
  54396. }
  54397. /* */
  54398. var baseDirectives = {
  54399. on: on,
  54400. bind: bind$1,
  54401. cloak: noop
  54402. };
  54403. /* */
  54404. var CodegenState = function CodegenState (options) {
  54405. this.options = options;
  54406. this.warn = options.warn || baseWarn;
  54407. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  54408. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  54409. this.directives = extend(extend({}, baseDirectives), options.directives);
  54410. var isReservedTag = options.isReservedTag || no;
  54411. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  54412. this.onceId = 0;
  54413. this.staticRenderFns = [];
  54414. this.pre = false;
  54415. };
  54416. function generate (
  54417. ast,
  54418. options
  54419. ) {
  54420. var state = new CodegenState(options);
  54421. var code = ast ? genElement(ast, state) : '_c("div")';
  54422. return {
  54423. render: ("with(this){return " + code + "}"),
  54424. staticRenderFns: state.staticRenderFns
  54425. }
  54426. }
  54427. function genElement (el, state) {
  54428. if (el.parent) {
  54429. el.pre = el.pre || el.parent.pre;
  54430. }
  54431. if (el.staticRoot && !el.staticProcessed) {
  54432. return genStatic(el, state)
  54433. } else if (el.once && !el.onceProcessed) {
  54434. return genOnce(el, state)
  54435. } else if (el.for && !el.forProcessed) {
  54436. return genFor(el, state)
  54437. } else if (el.if && !el.ifProcessed) {
  54438. return genIf(el, state)
  54439. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  54440. return genChildren(el, state) || 'void 0'
  54441. } else if (el.tag === 'slot') {
  54442. return genSlot(el, state)
  54443. } else {
  54444. // component or element
  54445. var code;
  54446. if (el.component) {
  54447. code = genComponent(el.component, el, state);
  54448. } else {
  54449. var data;
  54450. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  54451. data = genData$2(el, state);
  54452. }
  54453. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54454. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  54455. }
  54456. // module transforms
  54457. for (var i = 0; i < state.transforms.length; i++) {
  54458. code = state.transforms[i](el, code);
  54459. }
  54460. return code
  54461. }
  54462. }
  54463. // hoist static sub-trees out
  54464. function genStatic (el, state) {
  54465. el.staticProcessed = true;
  54466. // Some elements (templates) need to behave differently inside of a v-pre
  54467. // node. All pre nodes are static roots, so we can use this as a location to
  54468. // wrap a state change and reset it upon exiting the pre node.
  54469. var originalPreState = state.pre;
  54470. if (el.pre) {
  54471. state.pre = el.pre;
  54472. }
  54473. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  54474. state.pre = originalPreState;
  54475. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  54476. }
  54477. // v-once
  54478. function genOnce (el, state) {
  54479. el.onceProcessed = true;
  54480. if (el.if && !el.ifProcessed) {
  54481. return genIf(el, state)
  54482. } else if (el.staticInFor) {
  54483. var key = '';
  54484. var parent = el.parent;
  54485. while (parent) {
  54486. if (parent.for) {
  54487. key = parent.key;
  54488. break
  54489. }
  54490. parent = parent.parent;
  54491. }
  54492. if (!key) {
  54493. state.warn(
  54494. "v-once can only be used inside v-for that is keyed. ",
  54495. el.rawAttrsMap['v-once']
  54496. );
  54497. return genElement(el, state)
  54498. }
  54499. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  54500. } else {
  54501. return genStatic(el, state)
  54502. }
  54503. }
  54504. function genIf (
  54505. el,
  54506. state,
  54507. altGen,
  54508. altEmpty
  54509. ) {
  54510. el.ifProcessed = true; // avoid recursion
  54511. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  54512. }
  54513. function genIfConditions (
  54514. conditions,
  54515. state,
  54516. altGen,
  54517. altEmpty
  54518. ) {
  54519. if (!conditions.length) {
  54520. return altEmpty || '_e()'
  54521. }
  54522. var condition = conditions.shift();
  54523. if (condition.exp) {
  54524. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  54525. } else {
  54526. return ("" + (genTernaryExp(condition.block)))
  54527. }
  54528. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  54529. function genTernaryExp (el) {
  54530. return altGen
  54531. ? altGen(el, state)
  54532. : el.once
  54533. ? genOnce(el, state)
  54534. : genElement(el, state)
  54535. }
  54536. }
  54537. function genFor (
  54538. el,
  54539. state,
  54540. altGen,
  54541. altHelper
  54542. ) {
  54543. var exp = el.for;
  54544. var alias = el.alias;
  54545. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  54546. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  54547. if (state.maybeComponent(el) &&
  54548. el.tag !== 'slot' &&
  54549. el.tag !== 'template' &&
  54550. !el.key
  54551. ) {
  54552. state.warn(
  54553. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  54554. "v-for should have explicit keys. " +
  54555. "See https://vuejs.org/guide/list.html#key for more info.",
  54556. el.rawAttrsMap['v-for'],
  54557. true /* tip */
  54558. );
  54559. }
  54560. el.forProcessed = true; // avoid recursion
  54561. return (altHelper || '_l') + "((" + exp + ")," +
  54562. "function(" + alias + iterator1 + iterator2 + "){" +
  54563. "return " + ((altGen || genElement)(el, state)) +
  54564. '})'
  54565. }
  54566. function genData$2 (el, state) {
  54567. var data = '{';
  54568. // directives first.
  54569. // directives may mutate the el's other properties before they are generated.
  54570. var dirs = genDirectives(el, state);
  54571. if (dirs) { data += dirs + ','; }
  54572. // key
  54573. if (el.key) {
  54574. data += "key:" + (el.key) + ",";
  54575. }
  54576. // ref
  54577. if (el.ref) {
  54578. data += "ref:" + (el.ref) + ",";
  54579. }
  54580. if (el.refInFor) {
  54581. data += "refInFor:true,";
  54582. }
  54583. // pre
  54584. if (el.pre) {
  54585. data += "pre:true,";
  54586. }
  54587. // record original tag name for components using "is" attribute
  54588. if (el.component) {
  54589. data += "tag:\"" + (el.tag) + "\",";
  54590. }
  54591. // module data generation functions
  54592. for (var i = 0; i < state.dataGenFns.length; i++) {
  54593. data += state.dataGenFns[i](el);
  54594. }
  54595. // attributes
  54596. if (el.attrs) {
  54597. data += "attrs:" + (genProps(el.attrs)) + ",";
  54598. }
  54599. // DOM props
  54600. if (el.props) {
  54601. data += "domProps:" + (genProps(el.props)) + ",";
  54602. }
  54603. // event handlers
  54604. if (el.events) {
  54605. data += (genHandlers(el.events, false)) + ",";
  54606. }
  54607. if (el.nativeEvents) {
  54608. data += (genHandlers(el.nativeEvents, true)) + ",";
  54609. }
  54610. // slot target
  54611. // only for non-scoped slots
  54612. if (el.slotTarget && !el.slotScope) {
  54613. data += "slot:" + (el.slotTarget) + ",";
  54614. }
  54615. // scoped slots
  54616. if (el.scopedSlots) {
  54617. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  54618. }
  54619. // component v-model
  54620. if (el.model) {
  54621. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  54622. }
  54623. // inline-template
  54624. if (el.inlineTemplate) {
  54625. var inlineTemplate = genInlineTemplate(el, state);
  54626. if (inlineTemplate) {
  54627. data += inlineTemplate + ",";
  54628. }
  54629. }
  54630. data = data.replace(/,$/, '') + '}';
  54631. // v-bind dynamic argument wrap
  54632. // v-bind with dynamic arguments must be applied using the same v-bind object
  54633. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  54634. if (el.dynamicAttrs) {
  54635. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  54636. }
  54637. // v-bind data wrap
  54638. if (el.wrapData) {
  54639. data = el.wrapData(data);
  54640. }
  54641. // v-on data wrap
  54642. if (el.wrapListeners) {
  54643. data = el.wrapListeners(data);
  54644. }
  54645. return data
  54646. }
  54647. function genDirectives (el, state) {
  54648. var dirs = el.directives;
  54649. if (!dirs) { return }
  54650. var res = 'directives:[';
  54651. var hasRuntime = false;
  54652. var i, l, dir, needRuntime;
  54653. for (i = 0, l = dirs.length; i < l; i++) {
  54654. dir = dirs[i];
  54655. needRuntime = true;
  54656. var gen = state.directives[dir.name];
  54657. if (gen) {
  54658. // compile-time directive that manipulates AST.
  54659. // returns true if it also needs a runtime counterpart.
  54660. needRuntime = !!gen(el, dir, state.warn);
  54661. }
  54662. if (needRuntime) {
  54663. hasRuntime = true;
  54664. 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))) : '') + "},";
  54665. }
  54666. }
  54667. if (hasRuntime) {
  54668. return res.slice(0, -1) + ']'
  54669. }
  54670. }
  54671. function genInlineTemplate (el, state) {
  54672. var ast = el.children[0];
  54673. if (el.children.length !== 1 || ast.type !== 1) {
  54674. state.warn(
  54675. 'Inline-template components must have exactly one child element.',
  54676. { start: el.start }
  54677. );
  54678. }
  54679. if (ast && ast.type === 1) {
  54680. var inlineRenderFns = generate(ast, state.options);
  54681. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  54682. }
  54683. }
  54684. function genScopedSlots (
  54685. el,
  54686. slots,
  54687. state
  54688. ) {
  54689. // by default scoped slots are considered "stable", this allows child
  54690. // components with only scoped slots to skip forced updates from parent.
  54691. // but in some cases we have to bail-out of this optimization
  54692. // for example if the slot contains dynamic names, has v-if or v-for on them...
  54693. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  54694. var slot = slots[key];
  54695. return (
  54696. slot.slotTargetDynamic ||
  54697. slot.if ||
  54698. slot.for ||
  54699. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  54700. )
  54701. });
  54702. // #9534: if a component with scoped slots is inside a conditional branch,
  54703. // it's possible for the same component to be reused but with different
  54704. // compiled slot content. To avoid that, we generate a unique key based on
  54705. // the generated code of all the slot contents.
  54706. var needsKey = !!el.if;
  54707. // OR when it is inside another scoped slot or v-for (the reactivity may be
  54708. // disconnected due to the intermediate scope variable)
  54709. // #9438, #9506
  54710. // TODO: this can be further optimized by properly analyzing in-scope bindings
  54711. // and skip force updating ones that do not actually use scope variables.
  54712. if (!needsForceUpdate) {
  54713. var parent = el.parent;
  54714. while (parent) {
  54715. if (
  54716. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  54717. parent.for
  54718. ) {
  54719. needsForceUpdate = true;
  54720. break
  54721. }
  54722. if (parent.if) {
  54723. needsKey = true;
  54724. }
  54725. parent = parent.parent;
  54726. }
  54727. }
  54728. var generatedSlots = Object.keys(slots)
  54729. .map(function (key) { return genScopedSlot(slots[key], state); })
  54730. .join(',');
  54731. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  54732. }
  54733. function hash(str) {
  54734. var hash = 5381;
  54735. var i = str.length;
  54736. while(i) {
  54737. hash = (hash * 33) ^ str.charCodeAt(--i);
  54738. }
  54739. return hash >>> 0
  54740. }
  54741. function containsSlotChild (el) {
  54742. if (el.type === 1) {
  54743. if (el.tag === 'slot') {
  54744. return true
  54745. }
  54746. return el.children.some(containsSlotChild)
  54747. }
  54748. return false
  54749. }
  54750. function genScopedSlot (
  54751. el,
  54752. state
  54753. ) {
  54754. var isLegacySyntax = el.attrsMap['slot-scope'];
  54755. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  54756. return genIf(el, state, genScopedSlot, "null")
  54757. }
  54758. if (el.for && !el.forProcessed) {
  54759. return genFor(el, state, genScopedSlot)
  54760. }
  54761. var slotScope = el.slotScope === emptySlotScopeToken
  54762. ? ""
  54763. : String(el.slotScope);
  54764. var fn = "function(" + slotScope + "){" +
  54765. "return " + (el.tag === 'template'
  54766. ? el.if && isLegacySyntax
  54767. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  54768. : genChildren(el, state) || 'undefined'
  54769. : genElement(el, state)) + "}";
  54770. // reverse proxy v-slot without scope on this.$slots
  54771. var reverseProxy = slotScope ? "" : ",proxy:true";
  54772. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  54773. }
  54774. function genChildren (
  54775. el,
  54776. state,
  54777. checkSkip,
  54778. altGenElement,
  54779. altGenNode
  54780. ) {
  54781. var children = el.children;
  54782. if (children.length) {
  54783. var el$1 = children[0];
  54784. // optimize single v-for
  54785. if (children.length === 1 &&
  54786. el$1.for &&
  54787. el$1.tag !== 'template' &&
  54788. el$1.tag !== 'slot'
  54789. ) {
  54790. var normalizationType = checkSkip
  54791. ? state.maybeComponent(el$1) ? ",1" : ",0"
  54792. : "";
  54793. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  54794. }
  54795. var normalizationType$1 = checkSkip
  54796. ? getNormalizationType(children, state.maybeComponent)
  54797. : 0;
  54798. var gen = altGenNode || genNode;
  54799. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  54800. }
  54801. }
  54802. // determine the normalization needed for the children array.
  54803. // 0: no normalization needed
  54804. // 1: simple normalization needed (possible 1-level deep nested array)
  54805. // 2: full normalization needed
  54806. function getNormalizationType (
  54807. children,
  54808. maybeComponent
  54809. ) {
  54810. var res = 0;
  54811. for (var i = 0; i < children.length; i++) {
  54812. var el = children[i];
  54813. if (el.type !== 1) {
  54814. continue
  54815. }
  54816. if (needsNormalization(el) ||
  54817. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  54818. res = 2;
  54819. break
  54820. }
  54821. if (maybeComponent(el) ||
  54822. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  54823. res = 1;
  54824. }
  54825. }
  54826. return res
  54827. }
  54828. function needsNormalization (el) {
  54829. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  54830. }
  54831. function genNode (node, state) {
  54832. if (node.type === 1) {
  54833. return genElement(node, state)
  54834. } else if (node.type === 3 && node.isComment) {
  54835. return genComment(node)
  54836. } else {
  54837. return genText(node)
  54838. }
  54839. }
  54840. function genText (text) {
  54841. return ("_v(" + (text.type === 2
  54842. ? text.expression // no need for () because already wrapped in _s()
  54843. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  54844. }
  54845. function genComment (comment) {
  54846. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  54847. }
  54848. function genSlot (el, state) {
  54849. var slotName = el.slotName || '"default"';
  54850. var children = genChildren(el, state);
  54851. var res = "_t(" + slotName + (children ? ("," + children) : '');
  54852. var attrs = el.attrs || el.dynamicAttrs
  54853. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  54854. // slot props are camelized
  54855. name: camelize(attr.name),
  54856. value: attr.value,
  54857. dynamic: attr.dynamic
  54858. }); }))
  54859. : null;
  54860. var bind$$1 = el.attrsMap['v-bind'];
  54861. if ((attrs || bind$$1) && !children) {
  54862. res += ",null";
  54863. }
  54864. if (attrs) {
  54865. res += "," + attrs;
  54866. }
  54867. if (bind$$1) {
  54868. res += (attrs ? '' : ',null') + "," + bind$$1;
  54869. }
  54870. return res + ')'
  54871. }
  54872. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  54873. function genComponent (
  54874. componentName,
  54875. el,
  54876. state
  54877. ) {
  54878. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54879. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  54880. }
  54881. function genProps (props) {
  54882. var staticProps = "";
  54883. var dynamicProps = "";
  54884. for (var i = 0; i < props.length; i++) {
  54885. var prop = props[i];
  54886. var value = transformSpecialNewlines(prop.value);
  54887. if (prop.dynamic) {
  54888. dynamicProps += (prop.name) + "," + value + ",";
  54889. } else {
  54890. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  54891. }
  54892. }
  54893. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  54894. if (dynamicProps) {
  54895. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  54896. } else {
  54897. return staticProps
  54898. }
  54899. }
  54900. // #3895, #4268
  54901. function transformSpecialNewlines (text) {
  54902. return text
  54903. .replace(/\u2028/g, '\\u2028')
  54904. .replace(/\u2029/g, '\\u2029')
  54905. }
  54906. /* */
  54907. // these keywords should not appear inside expressions, but operators like
  54908. // typeof, instanceof and in are allowed
  54909. var prohibitedKeywordRE = new RegExp('\\b' + (
  54910. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  54911. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  54912. 'extends,finally,continue,debugger,function,arguments'
  54913. ).split(',').join('\\b|\\b') + '\\b');
  54914. // these unary operators should not be used as property/method names
  54915. var unaryOperatorsRE = new RegExp('\\b' + (
  54916. 'delete,typeof,void'
  54917. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  54918. // strip strings in expressions
  54919. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  54920. // detect problematic expressions in a template
  54921. function detectErrors (ast, warn) {
  54922. if (ast) {
  54923. checkNode(ast, warn);
  54924. }
  54925. }
  54926. function checkNode (node, warn) {
  54927. if (node.type === 1) {
  54928. for (var name in node.attrsMap) {
  54929. if (dirRE.test(name)) {
  54930. var value = node.attrsMap[name];
  54931. if (value) {
  54932. var range = node.rawAttrsMap[name];
  54933. if (name === 'v-for') {
  54934. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  54935. } else if (name === 'v-slot' || name[0] === '#') {
  54936. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  54937. } else if (onRE.test(name)) {
  54938. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  54939. } else {
  54940. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  54941. }
  54942. }
  54943. }
  54944. }
  54945. if (node.children) {
  54946. for (var i = 0; i < node.children.length; i++) {
  54947. checkNode(node.children[i], warn);
  54948. }
  54949. }
  54950. } else if (node.type === 2) {
  54951. checkExpression(node.expression, node.text, warn, node);
  54952. }
  54953. }
  54954. function checkEvent (exp, text, warn, range) {
  54955. var stripped = exp.replace(stripStringRE, '');
  54956. var keywordMatch = stripped.match(unaryOperatorsRE);
  54957. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  54958. warn(
  54959. "avoid using JavaScript unary operator as property name: " +
  54960. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  54961. range
  54962. );
  54963. }
  54964. checkExpression(exp, text, warn, range);
  54965. }
  54966. function checkFor (node, text, warn, range) {
  54967. checkExpression(node.for || '', text, warn, range);
  54968. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  54969. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  54970. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  54971. }
  54972. function checkIdentifier (
  54973. ident,
  54974. type,
  54975. text,
  54976. warn,
  54977. range
  54978. ) {
  54979. if (typeof ident === 'string') {
  54980. try {
  54981. new Function(("var " + ident + "=_"));
  54982. } catch (e) {
  54983. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  54984. }
  54985. }
  54986. }
  54987. function checkExpression (exp, text, warn, range) {
  54988. try {
  54989. new Function(("return " + exp));
  54990. } catch (e) {
  54991. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  54992. if (keywordMatch) {
  54993. warn(
  54994. "avoid using JavaScript keyword as property name: " +
  54995. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  54996. range
  54997. );
  54998. } else {
  54999. warn(
  55000. "invalid expression: " + (e.message) + " in\n\n" +
  55001. " " + exp + "\n\n" +
  55002. " Raw expression: " + (text.trim()) + "\n",
  55003. range
  55004. );
  55005. }
  55006. }
  55007. }
  55008. function checkFunctionParameterExpression (exp, text, warn, range) {
  55009. try {
  55010. new Function(exp, '');
  55011. } catch (e) {
  55012. warn(
  55013. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  55014. " " + exp + "\n\n" +
  55015. " Raw expression: " + (text.trim()) + "\n",
  55016. range
  55017. );
  55018. }
  55019. }
  55020. /* */
  55021. var range = 2;
  55022. function generateCodeFrame (
  55023. source,
  55024. start,
  55025. end
  55026. ) {
  55027. if ( start === void 0 ) start = 0;
  55028. if ( end === void 0 ) end = source.length;
  55029. var lines = source.split(/\r?\n/);
  55030. var count = 0;
  55031. var res = [];
  55032. for (var i = 0; i < lines.length; i++) {
  55033. count += lines[i].length + 1;
  55034. if (count >= start) {
  55035. for (var j = i - range; j <= i + range || end > count; j++) {
  55036. if (j < 0 || j >= lines.length) { continue }
  55037. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  55038. var lineLength = lines[j].length;
  55039. if (j === i) {
  55040. // push underline
  55041. var pad = start - (count - lineLength) + 1;
  55042. var length = end > count ? lineLength - pad : end - start;
  55043. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  55044. } else if (j > i) {
  55045. if (end > count) {
  55046. var length$1 = Math.min(end - count, lineLength);
  55047. res.push(" | " + repeat$1("^", length$1));
  55048. }
  55049. count += lineLength + 1;
  55050. }
  55051. }
  55052. break
  55053. }
  55054. }
  55055. return res.join('\n')
  55056. }
  55057. function repeat$1 (str, n) {
  55058. var result = '';
  55059. if (n > 0) {
  55060. while (true) { // eslint-disable-line
  55061. if (n & 1) { result += str; }
  55062. n >>>= 1;
  55063. if (n <= 0) { break }
  55064. str += str;
  55065. }
  55066. }
  55067. return result
  55068. }
  55069. /* */
  55070. function createFunction (code, errors) {
  55071. try {
  55072. return new Function(code)
  55073. } catch (err) {
  55074. errors.push({ err: err, code: code });
  55075. return noop
  55076. }
  55077. }
  55078. function createCompileToFunctionFn (compile) {
  55079. var cache = Object.create(null);
  55080. return function compileToFunctions (
  55081. template,
  55082. options,
  55083. vm
  55084. ) {
  55085. options = extend({}, options);
  55086. var warn$$1 = options.warn || warn;
  55087. delete options.warn;
  55088. /* istanbul ignore if */
  55089. {
  55090. // detect possible CSP restriction
  55091. try {
  55092. new Function('return 1');
  55093. } catch (e) {
  55094. if (e.toString().match(/unsafe-eval|CSP/)) {
  55095. warn$$1(
  55096. 'It seems you are using the standalone build of Vue.js in an ' +
  55097. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  55098. 'The template compiler cannot work in this environment. Consider ' +
  55099. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  55100. 'templates into render functions.'
  55101. );
  55102. }
  55103. }
  55104. }
  55105. // check cache
  55106. var key = options.delimiters
  55107. ? String(options.delimiters) + template
  55108. : template;
  55109. if (cache[key]) {
  55110. return cache[key]
  55111. }
  55112. // compile
  55113. var compiled = compile(template, options);
  55114. // check compilation errors/tips
  55115. {
  55116. if (compiled.errors && compiled.errors.length) {
  55117. if (options.outputSourceRange) {
  55118. compiled.errors.forEach(function (e) {
  55119. warn$$1(
  55120. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  55121. generateCodeFrame(template, e.start, e.end),
  55122. vm
  55123. );
  55124. });
  55125. } else {
  55126. warn$$1(
  55127. "Error compiling template:\n\n" + template + "\n\n" +
  55128. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  55129. vm
  55130. );
  55131. }
  55132. }
  55133. if (compiled.tips && compiled.tips.length) {
  55134. if (options.outputSourceRange) {
  55135. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  55136. } else {
  55137. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  55138. }
  55139. }
  55140. }
  55141. // turn code into functions
  55142. var res = {};
  55143. var fnGenErrors = [];
  55144. res.render = createFunction(compiled.render, fnGenErrors);
  55145. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  55146. return createFunction(code, fnGenErrors)
  55147. });
  55148. // check function generation errors.
  55149. // this should only happen if there is a bug in the compiler itself.
  55150. // mostly for codegen development use
  55151. /* istanbul ignore if */
  55152. {
  55153. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  55154. warn$$1(
  55155. "Failed to generate render function:\n\n" +
  55156. fnGenErrors.map(function (ref) {
  55157. var err = ref.err;
  55158. var code = ref.code;
  55159. return ((err.toString()) + " in\n\n" + code + "\n");
  55160. }).join('\n'),
  55161. vm
  55162. );
  55163. }
  55164. }
  55165. return (cache[key] = res)
  55166. }
  55167. }
  55168. /* */
  55169. function createCompilerCreator (baseCompile) {
  55170. return function createCompiler (baseOptions) {
  55171. function compile (
  55172. template,
  55173. options
  55174. ) {
  55175. var finalOptions = Object.create(baseOptions);
  55176. var errors = [];
  55177. var tips = [];
  55178. var warn = function (msg, range, tip) {
  55179. (tip ? tips : errors).push(msg);
  55180. };
  55181. if (options) {
  55182. if (options.outputSourceRange) {
  55183. // $flow-disable-line
  55184. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  55185. warn = function (msg, range, tip) {
  55186. var data = { msg: msg };
  55187. if (range) {
  55188. if (range.start != null) {
  55189. data.start = range.start + leadingSpaceLength;
  55190. }
  55191. if (range.end != null) {
  55192. data.end = range.end + leadingSpaceLength;
  55193. }
  55194. }
  55195. (tip ? tips : errors).push(data);
  55196. };
  55197. }
  55198. // merge custom modules
  55199. if (options.modules) {
  55200. finalOptions.modules =
  55201. (baseOptions.modules || []).concat(options.modules);
  55202. }
  55203. // merge custom directives
  55204. if (options.directives) {
  55205. finalOptions.directives = extend(
  55206. Object.create(baseOptions.directives || null),
  55207. options.directives
  55208. );
  55209. }
  55210. // copy other options
  55211. for (var key in options) {
  55212. if (key !== 'modules' && key !== 'directives') {
  55213. finalOptions[key] = options[key];
  55214. }
  55215. }
  55216. }
  55217. finalOptions.warn = warn;
  55218. var compiled = baseCompile(template.trim(), finalOptions);
  55219. {
  55220. detectErrors(compiled.ast, warn);
  55221. }
  55222. compiled.errors = errors;
  55223. compiled.tips = tips;
  55224. return compiled
  55225. }
  55226. return {
  55227. compile: compile,
  55228. compileToFunctions: createCompileToFunctionFn(compile)
  55229. }
  55230. }
  55231. }
  55232. /* */
  55233. // `createCompilerCreator` allows creating compilers that use alternative
  55234. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  55235. // Here we just export a default compiler using the default parts.
  55236. var createCompiler = createCompilerCreator(function baseCompile (
  55237. template,
  55238. options
  55239. ) {
  55240. var ast = parse(template.trim(), options);
  55241. if (options.optimize !== false) {
  55242. optimize(ast, options);
  55243. }
  55244. var code = generate(ast, options);
  55245. return {
  55246. ast: ast,
  55247. render: code.render,
  55248. staticRenderFns: code.staticRenderFns
  55249. }
  55250. });
  55251. /* */
  55252. var ref$1 = createCompiler(baseOptions);
  55253. var compile = ref$1.compile;
  55254. var compileToFunctions = ref$1.compileToFunctions;
  55255. /* */
  55256. // check whether current browser encodes a char inside attribute values
  55257. var div;
  55258. function getShouldDecode (href) {
  55259. div = div || document.createElement('div');
  55260. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  55261. return div.innerHTML.indexOf('&#10;') > 0
  55262. }
  55263. // #3663: IE encodes newlines inside attribute values while other browsers don't
  55264. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  55265. // #6828: chrome encodes content in a[href]
  55266. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  55267. /* */
  55268. var idToTemplate = cached(function (id) {
  55269. var el = query(id);
  55270. return el && el.innerHTML
  55271. });
  55272. var mount = Vue.prototype.$mount;
  55273. Vue.prototype.$mount = function (
  55274. el,
  55275. hydrating
  55276. ) {
  55277. el = el && query(el);
  55278. /* istanbul ignore if */
  55279. if (el === document.body || el === document.documentElement) {
  55280. warn(
  55281. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  55282. );
  55283. return this
  55284. }
  55285. var options = this.$options;
  55286. // resolve template/el and convert to render function
  55287. if (!options.render) {
  55288. var template = options.template;
  55289. if (template) {
  55290. if (typeof template === 'string') {
  55291. if (template.charAt(0) === '#') {
  55292. template = idToTemplate(template);
  55293. /* istanbul ignore if */
  55294. if (!template) {
  55295. warn(
  55296. ("Template element not found or is empty: " + (options.template)),
  55297. this
  55298. );
  55299. }
  55300. }
  55301. } else if (template.nodeType) {
  55302. template = template.innerHTML;
  55303. } else {
  55304. {
  55305. warn('invalid template option:' + template, this);
  55306. }
  55307. return this
  55308. }
  55309. } else if (el) {
  55310. template = getOuterHTML(el);
  55311. }
  55312. if (template) {
  55313. /* istanbul ignore if */
  55314. if (config.performance && mark) {
  55315. mark('compile');
  55316. }
  55317. var ref = compileToFunctions(template, {
  55318. outputSourceRange: "development" !== 'production',
  55319. shouldDecodeNewlines: shouldDecodeNewlines,
  55320. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  55321. delimiters: options.delimiters,
  55322. comments: options.comments
  55323. }, this);
  55324. var render = ref.render;
  55325. var staticRenderFns = ref.staticRenderFns;
  55326. options.render = render;
  55327. options.staticRenderFns = staticRenderFns;
  55328. /* istanbul ignore if */
  55329. if (config.performance && mark) {
  55330. mark('compile end');
  55331. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  55332. }
  55333. }
  55334. }
  55335. return mount.call(this, el, hydrating)
  55336. };
  55337. /**
  55338. * Get outerHTML of elements, taking care
  55339. * of SVG elements in IE as well.
  55340. */
  55341. function getOuterHTML (el) {
  55342. if (el.outerHTML) {
  55343. return el.outerHTML
  55344. } else {
  55345. var container = document.createElement('div');
  55346. container.appendChild(el.cloneNode(true));
  55347. return container.innerHTML
  55348. }
  55349. }
  55350. Vue.compile = compileToFunctions;
  55351. module.exports = Vue;
  55352. /* 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))
  55353. /***/ }),
  55354. /***/ "./node_modules/vue/dist/vue.common.js":
  55355. /*!*********************************************!*\
  55356. !*** ./node_modules/vue/dist/vue.common.js ***!
  55357. \*********************************************/
  55358. /*! no static exports found */
  55359. /***/ (function(module, exports, __webpack_require__) {
  55360. if (false) {} else {
  55361. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  55362. }
  55363. /***/ }),
  55364. /***/ "./node_modules/webpack/buildin/global.js":
  55365. /*!***********************************!*\
  55366. !*** (webpack)/buildin/global.js ***!
  55367. \***********************************/
  55368. /*! no static exports found */
  55369. /***/ (function(module, exports) {
  55370. var g;
  55371. // This works in non-strict mode
  55372. g = (function() {
  55373. return this;
  55374. })();
  55375. try {
  55376. // This works if eval is allowed (see CSP)
  55377. g = g || new Function("return this")();
  55378. } catch (e) {
  55379. // This works if the window reference is available
  55380. if (typeof window === "object") g = window;
  55381. }
  55382. // g can still be undefined, but nothing to do about it...
  55383. // We return undefined, instead of nothing here, so it's
  55384. // easier to handle this case. if(!global) { ...}
  55385. module.exports = g;
  55386. /***/ }),
  55387. /***/ "./node_modules/webpack/buildin/module.js":
  55388. /*!***********************************!*\
  55389. !*** (webpack)/buildin/module.js ***!
  55390. \***********************************/
  55391. /*! no static exports found */
  55392. /***/ (function(module, exports) {
  55393. module.exports = function(module) {
  55394. if (!module.webpackPolyfill) {
  55395. module.deprecate = function() {};
  55396. module.paths = [];
  55397. // module.parent = undefined by default
  55398. if (!module.children) module.children = [];
  55399. Object.defineProperty(module, "loaded", {
  55400. enumerable: true,
  55401. get: function() {
  55402. return module.l;
  55403. }
  55404. });
  55405. Object.defineProperty(module, "id", {
  55406. enumerable: true,
  55407. get: function() {
  55408. return module.i;
  55409. }
  55410. });
  55411. module.webpackPolyfill = 1;
  55412. }
  55413. return module;
  55414. };
  55415. /***/ }),
  55416. /***/ "./resources/js/app.js":
  55417. /*!*****************************!*\
  55418. !*** ./resources/js/app.js ***!
  55419. \*****************************/
  55420. /*! no static exports found */
  55421. /***/ (function(module, exports, __webpack_require__) {
  55422. /**
  55423. * First we will load all of this project's JavaScript dependencies which
  55424. * includes Vue and other libraries. It is a great starting point when
  55425. * building robust, powerful web applications using Vue and Laravel.
  55426. */
  55427. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  55428. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  55429. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  55430. window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  55431. /**
  55432. * The following block of code may be used to automatically register your
  55433. * Vue components. It will recursively scan this directory for the Vue
  55434. * components and automatically register them with their "basename".
  55435. *
  55436. * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
  55437. */
  55438. // const files = require.context('./', true, /\.vue$/i)
  55439. // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
  55440. Vue.component('example-component', __webpack_require__(/*! ./components/ExampleComponent.vue */ "./resources/js/components/ExampleComponent.vue")["default"]);
  55441. Vue.component('woinfo', __webpack_require__(/*! ./components/woinfo.vue */ "./resources/js/components/woinfo.vue")["default"]);
  55442. Vue.component('assetinfo', __webpack_require__(/*! ./components/assetinfo.vue */ "./resources/js/components/assetinfo.vue")["default"]);
  55443. Vue.component('credential', __webpack_require__(/*! ./components/credential.vue */ "./resources/js/components/credential.vue")["default"]);
  55444. Vue.component('notes', __webpack_require__(/*! ./components/notes.vue */ "./resources/js/components/notes.vue")["default"]);
  55445. Vue.component('modal', __webpack_require__(/*! ./components/modal.vue */ "./resources/js/components/modal.vue")["default"]);
  55446. Vue.component('woinfo-edit-modal', __webpack_require__(/*! ./components/woinfo-edit-modal.vue */ "./resources/js/components/woinfo-edit-modal.vue")["default"]);
  55447. Vue.component('errorlist', __webpack_require__(/*! ./components/errorlist.vue */ "./resources/js/components/errorlist.vue")["default"]);
  55448. Vue.component('credential-form-modal', __webpack_require__(/*! ./components/credential-form-modal.vue */ "./resources/js/components/credential-form-modal.vue")["default"]);
  55449. Vue.component('autocomplete-custom-dropdown', __webpack_require__(/*! ./components/autocomplete-custom-dropdown.vue */ "./resources/js/components/autocomplete-custom-dropdown.vue")["default"]);
  55450. Vue.component('credential-list', __webpack_require__(/*! ./components/credential-list.vue */ "./resources/js/components/credential-list.vue")["default"]);
  55451. /**
  55452. * Next, we will create a fresh Vue application instance and attach it to
  55453. * the page. Then, you may begin adding components to this application
  55454. * or customize the JavaScript scaffolding to fit your unique needs.
  55455. */
  55456. var app = new Vue({
  55457. el: '#app'
  55458. });
  55459. $(function () {
  55460. $('[data-toggle="tooltip"]').tooltip();
  55461. });
  55462. var clipboard = new Clipboard('.btn-clip');
  55463. clipboard.on('success', function (e) {
  55464. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  55465. position: "right",
  55466. className: 'success'
  55467. });
  55468. e.clearSelection();
  55469. });
  55470. /***/ }),
  55471. /***/ "./resources/js/bootstrap.js":
  55472. /*!***********************************!*\
  55473. !*** ./resources/js/bootstrap.js ***!
  55474. \***********************************/
  55475. /*! no exports provided */
  55476. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55477. "use strict";
  55478. __webpack_require__.r(__webpack_exports__);
  55479. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  55480. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  55481. /**
  55482. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  55483. * for JavaScript based Bootstrap features such as modals and tabs. This
  55484. * code may be modified to fit the specific needs of your application.
  55485. */
  55486. try {
  55487. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  55488. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  55489. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  55490. } catch (e) {}
  55491. /**
  55492. * We'll load the axios HTTP library which allows us to easily issue requests
  55493. * to our Laravel back-end. This library automatically handles sending the
  55494. * CSRF token as a header based on the value of the "XSRF" token cookie.
  55495. */
  55496. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  55497. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  55498. /**
  55499. * Echo exposes an expressive API for subscribing to channels and listening
  55500. * for events that are broadcast by Laravel. Echo and event broadcasting
  55501. * allows your team to easily build robust real-time web applications.
  55502. */
  55503. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  55504. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  55505. broadcaster: 'pusher',
  55506. key: "upccrt",
  55507. authEndpoint: '/broadcasting/auth',
  55508. wsHost: window.location.hostname,
  55509. wsPort: 6001,
  55510. disableStats: true
  55511. });
  55512. /***/ }),
  55513. /***/ "./resources/js/components/ExampleComponent.vue":
  55514. /*!******************************************************!*\
  55515. !*** ./resources/js/components/ExampleComponent.vue ***!
  55516. \******************************************************/
  55517. /*! exports provided: default */
  55518. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55519. "use strict";
  55520. __webpack_require__.r(__webpack_exports__);
  55521. /* 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&");
  55522. /* 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&");
  55523. /* 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");
  55524. /* normalize component */
  55525. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55526. _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55527. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55528. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55529. false,
  55530. null,
  55531. null,
  55532. null
  55533. )
  55534. /* hot reload */
  55535. if (false) { var api; }
  55536. component.options.__file = "resources/js/components/ExampleComponent.vue"
  55537. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55538. /***/ }),
  55539. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  55540. /*!*******************************************************************************!*\
  55541. !*** ./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  55542. \*******************************************************************************/
  55543. /*! exports provided: default */
  55544. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55545. "use strict";
  55546. __webpack_require__.r(__webpack_exports__);
  55547. /* 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&");
  55548. /* 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"]);
  55549. /***/ }),
  55550. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  55551. /*!*************************************************************************************!*\
  55552. !*** ./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  55553. \*************************************************************************************/
  55554. /*! exports provided: render, staticRenderFns */
  55555. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55556. "use strict";
  55557. __webpack_require__.r(__webpack_exports__);
  55558. /* 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&");
  55559. /* 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"]; });
  55560. /* 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"]; });
  55561. /***/ }),
  55562. /***/ "./resources/js/components/assetinfo.vue":
  55563. /*!***********************************************!*\
  55564. !*** ./resources/js/components/assetinfo.vue ***!
  55565. \***********************************************/
  55566. /*! exports provided: default */
  55567. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55568. "use strict";
  55569. __webpack_require__.r(__webpack_exports__);
  55570. /* 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&");
  55571. /* 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&");
  55572. /* 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");
  55573. /* normalize component */
  55574. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55575. _assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55576. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["render"],
  55577. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55578. false,
  55579. null,
  55580. null,
  55581. null
  55582. )
  55583. /* hot reload */
  55584. if (false) { var api; }
  55585. component.options.__file = "resources/js/components/assetinfo.vue"
  55586. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55587. /***/ }),
  55588. /***/ "./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  55589. /*!************************************************************************!*\
  55590. !*** ./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  55591. \************************************************************************/
  55592. /*! exports provided: default */
  55593. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55594. "use strict";
  55595. __webpack_require__.r(__webpack_exports__);
  55596. /* 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&");
  55597. /* 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"]);
  55598. /***/ }),
  55599. /***/ "./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&":
  55600. /*!******************************************************************************!*\
  55601. !*** ./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3& ***!
  55602. \******************************************************************************/
  55603. /*! exports provided: render, staticRenderFns */
  55604. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55605. "use strict";
  55606. __webpack_require__.r(__webpack_exports__);
  55607. /* 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&");
  55608. /* 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"]; });
  55609. /* 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"]; });
  55610. /***/ }),
  55611. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue":
  55612. /*!******************************************************************!*\
  55613. !*** ./resources/js/components/autocomplete-custom-dropdown.vue ***!
  55614. \******************************************************************/
  55615. /*! exports provided: default */
  55616. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55617. "use strict";
  55618. __webpack_require__.r(__webpack_exports__);
  55619. /* 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&");
  55620. /* 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&");
  55621. /* 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");
  55622. /* normalize component */
  55623. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55624. _autocomplete_custom_dropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55625. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["render"],
  55626. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55627. false,
  55628. null,
  55629. null,
  55630. null
  55631. )
  55632. /* hot reload */
  55633. if (false) { var api; }
  55634. component.options.__file = "resources/js/components/autocomplete-custom-dropdown.vue"
  55635. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55636. /***/ }),
  55637. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&":
  55638. /*!*******************************************************************************************!*\
  55639. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js& ***!
  55640. \*******************************************************************************************/
  55641. /*! exports provided: default */
  55642. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55643. "use strict";
  55644. __webpack_require__.r(__webpack_exports__);
  55645. /* 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&");
  55646. /* 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"]);
  55647. /***/ }),
  55648. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a&":
  55649. /*!*************************************************************************************************!*\
  55650. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a& ***!
  55651. \*************************************************************************************************/
  55652. /*! exports provided: render, staticRenderFns */
  55653. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55654. "use strict";
  55655. __webpack_require__.r(__webpack_exports__);
  55656. /* 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&");
  55657. /* 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"]; });
  55658. /* 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"]; });
  55659. /***/ }),
  55660. /***/ "./resources/js/components/credential-form-modal.vue":
  55661. /*!***********************************************************!*\
  55662. !*** ./resources/js/components/credential-form-modal.vue ***!
  55663. \***********************************************************/
  55664. /*! exports provided: default */
  55665. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55666. "use strict";
  55667. __webpack_require__.r(__webpack_exports__);
  55668. /* 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&");
  55669. /* 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&");
  55670. /* 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");
  55671. /* normalize component */
  55672. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55673. _credential_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55674. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["render"],
  55675. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55676. false,
  55677. null,
  55678. null,
  55679. null
  55680. )
  55681. /* hot reload */
  55682. if (false) { var api; }
  55683. component.options.__file = "resources/js/components/credential-form-modal.vue"
  55684. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55685. /***/ }),
  55686. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&":
  55687. /*!************************************************************************************!*\
  55688. !*** ./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js& ***!
  55689. \************************************************************************************/
  55690. /*! exports provided: default */
  55691. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55692. "use strict";
  55693. __webpack_require__.r(__webpack_exports__);
  55694. /* 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&");
  55695. /* 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"]);
  55696. /***/ }),
  55697. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42&":
  55698. /*!******************************************************************************************!*\
  55699. !*** ./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42& ***!
  55700. \******************************************************************************************/
  55701. /*! exports provided: render, staticRenderFns */
  55702. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55703. "use strict";
  55704. __webpack_require__.r(__webpack_exports__);
  55705. /* 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&");
  55706. /* 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"]; });
  55707. /* 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"]; });
  55708. /***/ }),
  55709. /***/ "./resources/js/components/credential-list.vue":
  55710. /*!*****************************************************!*\
  55711. !*** ./resources/js/components/credential-list.vue ***!
  55712. \*****************************************************/
  55713. /*! exports provided: default */
  55714. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55715. "use strict";
  55716. __webpack_require__.r(__webpack_exports__);
  55717. /* 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&");
  55718. /* 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&");
  55719. /* 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");
  55720. /* normalize component */
  55721. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55722. _credential_list_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55723. _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55724. _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55725. false,
  55726. null,
  55727. null,
  55728. null
  55729. )
  55730. /* hot reload */
  55731. if (false) { var api; }
  55732. component.options.__file = "resources/js/components/credential-list.vue"
  55733. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55734. /***/ }),
  55735. /***/ "./resources/js/components/credential-list.vue?vue&type=script&lang=js&":
  55736. /*!******************************************************************************!*\
  55737. !*** ./resources/js/components/credential-list.vue?vue&type=script&lang=js& ***!
  55738. \******************************************************************************/
  55739. /*! exports provided: default */
  55740. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55741. "use strict";
  55742. __webpack_require__.r(__webpack_exports__);
  55743. /* 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&");
  55744. /* 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"]);
  55745. /***/ }),
  55746. /***/ "./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&":
  55747. /*!************************************************************************************!*\
  55748. !*** ./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e& ***!
  55749. \************************************************************************************/
  55750. /*! exports provided: render, staticRenderFns */
  55751. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55752. "use strict";
  55753. __webpack_require__.r(__webpack_exports__);
  55754. /* 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&");
  55755. /* 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"]; });
  55756. /* 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"]; });
  55757. /***/ }),
  55758. /***/ "./resources/js/components/credential.vue":
  55759. /*!************************************************!*\
  55760. !*** ./resources/js/components/credential.vue ***!
  55761. \************************************************/
  55762. /*! exports provided: default */
  55763. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55764. "use strict";
  55765. __webpack_require__.r(__webpack_exports__);
  55766. /* 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&");
  55767. /* 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&");
  55768. /* 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");
  55769. /* normalize component */
  55770. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55771. _credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55772. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["render"],
  55773. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55774. false,
  55775. null,
  55776. null,
  55777. null
  55778. )
  55779. /* hot reload */
  55780. if (false) { var api; }
  55781. component.options.__file = "resources/js/components/credential.vue"
  55782. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55783. /***/ }),
  55784. /***/ "./resources/js/components/credential.vue?vue&type=script&lang=js&":
  55785. /*!*************************************************************************!*\
  55786. !*** ./resources/js/components/credential.vue?vue&type=script&lang=js& ***!
  55787. \*************************************************************************/
  55788. /*! exports provided: default */
  55789. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55790. "use strict";
  55791. __webpack_require__.r(__webpack_exports__);
  55792. /* 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&");
  55793. /* 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"]);
  55794. /***/ }),
  55795. /***/ "./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&":
  55796. /*!*******************************************************************************!*\
  55797. !*** ./resources/js/components/credential.vue?vue&type=template&id=0f5cc562& ***!
  55798. \*******************************************************************************/
  55799. /*! exports provided: render, staticRenderFns */
  55800. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55801. "use strict";
  55802. __webpack_require__.r(__webpack_exports__);
  55803. /* 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&");
  55804. /* 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"]; });
  55805. /* 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"]; });
  55806. /***/ }),
  55807. /***/ "./resources/js/components/errorlist.vue":
  55808. /*!***********************************************!*\
  55809. !*** ./resources/js/components/errorlist.vue ***!
  55810. \***********************************************/
  55811. /*! exports provided: default */
  55812. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55813. "use strict";
  55814. __webpack_require__.r(__webpack_exports__);
  55815. /* 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&");
  55816. /* 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&");
  55817. /* 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");
  55818. /* normalize component */
  55819. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55820. _errorlist_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55821. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["render"],
  55822. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55823. false,
  55824. null,
  55825. null,
  55826. null
  55827. )
  55828. /* hot reload */
  55829. if (false) { var api; }
  55830. component.options.__file = "resources/js/components/errorlist.vue"
  55831. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55832. /***/ }),
  55833. /***/ "./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  55834. /*!************************************************************************!*\
  55835. !*** ./resources/js/components/errorlist.vue?vue&type=script&lang=js& ***!
  55836. \************************************************************************/
  55837. /*! exports provided: default */
  55838. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55839. "use strict";
  55840. __webpack_require__.r(__webpack_exports__);
  55841. /* 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&");
  55842. /* 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"]);
  55843. /***/ }),
  55844. /***/ "./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb&":
  55845. /*!******************************************************************************!*\
  55846. !*** ./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb& ***!
  55847. \******************************************************************************/
  55848. /*! exports provided: render, staticRenderFns */
  55849. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55850. "use strict";
  55851. __webpack_require__.r(__webpack_exports__);
  55852. /* 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&");
  55853. /* 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"]; });
  55854. /* 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"]; });
  55855. /***/ }),
  55856. /***/ "./resources/js/components/modal.vue":
  55857. /*!*******************************************!*\
  55858. !*** ./resources/js/components/modal.vue ***!
  55859. \*******************************************/
  55860. /*! exports provided: default */
  55861. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55862. "use strict";
  55863. __webpack_require__.r(__webpack_exports__);
  55864. /* 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&");
  55865. /* 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");
  55866. var script = {}
  55867. /* normalize component */
  55868. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  55869. script,
  55870. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["render"],
  55871. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55872. false,
  55873. null,
  55874. null,
  55875. null
  55876. )
  55877. /* hot reload */
  55878. if (false) { var api; }
  55879. component.options.__file = "resources/js/components/modal.vue"
  55880. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55881. /***/ }),
  55882. /***/ "./resources/js/components/modal.vue?vue&type=template&id=478d961c&":
  55883. /*!**************************************************************************!*\
  55884. !*** ./resources/js/components/modal.vue?vue&type=template&id=478d961c& ***!
  55885. \**************************************************************************/
  55886. /*! exports provided: render, staticRenderFns */
  55887. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55888. "use strict";
  55889. __webpack_require__.r(__webpack_exports__);
  55890. /* 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&");
  55891. /* 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"]; });
  55892. /* 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"]; });
  55893. /***/ }),
  55894. /***/ "./resources/js/components/notes.vue":
  55895. /*!*******************************************!*\
  55896. !*** ./resources/js/components/notes.vue ***!
  55897. \*******************************************/
  55898. /*! exports provided: default */
  55899. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55900. "use strict";
  55901. __webpack_require__.r(__webpack_exports__);
  55902. /* 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&");
  55903. /* 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&");
  55904. /* 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");
  55905. /* normalize component */
  55906. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55907. _notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55908. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["render"],
  55909. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55910. false,
  55911. null,
  55912. null,
  55913. null
  55914. )
  55915. /* hot reload */
  55916. if (false) { var api; }
  55917. component.options.__file = "resources/js/components/notes.vue"
  55918. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55919. /***/ }),
  55920. /***/ "./resources/js/components/notes.vue?vue&type=script&lang=js&":
  55921. /*!********************************************************************!*\
  55922. !*** ./resources/js/components/notes.vue?vue&type=script&lang=js& ***!
  55923. \********************************************************************/
  55924. /*! exports provided: default */
  55925. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55926. "use strict";
  55927. __webpack_require__.r(__webpack_exports__);
  55928. /* 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&");
  55929. /* 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"]);
  55930. /***/ }),
  55931. /***/ "./resources/js/components/notes.vue?vue&type=template&id=73d141f4&":
  55932. /*!**************************************************************************!*\
  55933. !*** ./resources/js/components/notes.vue?vue&type=template&id=73d141f4& ***!
  55934. \**************************************************************************/
  55935. /*! exports provided: render, staticRenderFns */
  55936. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55937. "use strict";
  55938. __webpack_require__.r(__webpack_exports__);
  55939. /* 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&");
  55940. /* 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"]; });
  55941. /* 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"]; });
  55942. /***/ }),
  55943. /***/ "./resources/js/components/woinfo-edit-modal.vue":
  55944. /*!*******************************************************!*\
  55945. !*** ./resources/js/components/woinfo-edit-modal.vue ***!
  55946. \*******************************************************/
  55947. /*! exports provided: default */
  55948. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55949. "use strict";
  55950. __webpack_require__.r(__webpack_exports__);
  55951. /* 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&");
  55952. /* 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&");
  55953. /* 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");
  55954. /* normalize component */
  55955. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55956. _woinfo_edit_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55957. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["render"],
  55958. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55959. false,
  55960. null,
  55961. null,
  55962. null
  55963. )
  55964. /* hot reload */
  55965. if (false) { var api; }
  55966. component.options.__file = "resources/js/components/woinfo-edit-modal.vue"
  55967. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55968. /***/ }),
  55969. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js&":
  55970. /*!********************************************************************************!*\
  55971. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js& ***!
  55972. \********************************************************************************/
  55973. /*! exports provided: default */
  55974. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55975. "use strict";
  55976. __webpack_require__.r(__webpack_exports__);
  55977. /* 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&");
  55978. /* 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"]);
  55979. /***/ }),
  55980. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4&":
  55981. /*!**************************************************************************************!*\
  55982. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4& ***!
  55983. \**************************************************************************************/
  55984. /*! exports provided: render, staticRenderFns */
  55985. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55986. "use strict";
  55987. __webpack_require__.r(__webpack_exports__);
  55988. /* 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&");
  55989. /* 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"]; });
  55990. /* 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"]; });
  55991. /***/ }),
  55992. /***/ "./resources/js/components/woinfo.vue":
  55993. /*!********************************************!*\
  55994. !*** ./resources/js/components/woinfo.vue ***!
  55995. \********************************************/
  55996. /*! exports provided: default */
  55997. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55998. "use strict";
  55999. __webpack_require__.r(__webpack_exports__);
  56000. /* 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&");
  56001. /* 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&");
  56002. /* 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");
  56003. /* normalize component */
  56004. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56005. _woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56006. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["render"],
  56007. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56008. false,
  56009. null,
  56010. null,
  56011. null
  56012. )
  56013. /* hot reload */
  56014. if (false) { var api; }
  56015. component.options.__file = "resources/js/components/woinfo.vue"
  56016. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56017. /***/ }),
  56018. /***/ "./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  56019. /*!*********************************************************************!*\
  56020. !*** ./resources/js/components/woinfo.vue?vue&type=script&lang=js& ***!
  56021. \*********************************************************************/
  56022. /*! exports provided: default */
  56023. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56024. "use strict";
  56025. __webpack_require__.r(__webpack_exports__);
  56026. /* 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&");
  56027. /* 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"]);
  56028. /***/ }),
  56029. /***/ "./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&":
  56030. /*!***************************************************************************!*\
  56031. !*** ./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de& ***!
  56032. \***************************************************************************/
  56033. /*! exports provided: render, staticRenderFns */
  56034. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56035. "use strict";
  56036. __webpack_require__.r(__webpack_exports__);
  56037. /* 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&");
  56038. /* 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"]; });
  56039. /* 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"]; });
  56040. /***/ }),
  56041. /***/ "./resources/js/mixins/dateMixin.js":
  56042. /*!******************************************!*\
  56043. !*** ./resources/js/mixins/dateMixin.js ***!
  56044. \******************************************/
  56045. /*! exports provided: default */
  56046. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56047. "use strict";
  56048. __webpack_require__.r(__webpack_exports__);
  56049. /* harmony default export */ __webpack_exports__["default"] = ({
  56050. methods: {
  56051. treatAsUTC: function treatAsUTC(date) {
  56052. var result = new Date(date);
  56053. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  56054. return result;
  56055. },
  56056. daysSinceToday: function daysSinceToday(date) {
  56057. var currentDate = new Date();
  56058. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  56059. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  56060. },
  56061. getHRDate: function getHRDate(dateString) {
  56062. var date = new Date(dateString);
  56063. return date.toLocaleString('default', {
  56064. month: 'short',
  56065. day: 'numeric',
  56066. year: 'numeric',
  56067. hour: 'numeric',
  56068. minute: 'numeric'
  56069. });
  56070. },
  56071. isZero: function isZero(dateString) {
  56072. return dateString === '0000-00-00 00:00:00';
  56073. }
  56074. }
  56075. });
  56076. /***/ }),
  56077. /***/ "./resources/js/notify.min.js":
  56078. /*!************************************!*\
  56079. !*** ./resources/js/notify.min.js ***!
  56080. \************************************/
  56081. /*! no static exports found */
  56082. /***/ (function(module, exports, __webpack_require__) {
  56083. 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); }
  56084. (function (e) {
  56085. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  56086. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  56087. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  56088. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  56089. })(function (e) {
  56090. function A(t, n, i) {
  56091. typeof i == "string" && (i = {
  56092. className: i
  56093. }), 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);
  56094. }
  56095. var t = [].indexOf || function (e) {
  56096. for (var t = 0, n = this.length; t < n; t++) {
  56097. if (t in this && this[t] === e) return t;
  56098. }
  56099. return -1;
  56100. },
  56101. n = "notify",
  56102. r = n + "js",
  56103. i = n + "!blank",
  56104. s = {
  56105. t: "top",
  56106. m: "middle",
  56107. b: "bottom",
  56108. l: "left",
  56109. c: "center",
  56110. r: "right"
  56111. },
  56112. o = ["l", "c", "r"],
  56113. u = ["t", "m", "b"],
  56114. a = ["t", "b", "l", "r"],
  56115. f = {
  56116. t: "b",
  56117. m: null,
  56118. b: "t",
  56119. l: "r",
  56120. c: null,
  56121. r: "l"
  56122. },
  56123. l = function l(t) {
  56124. var n;
  56125. return n = [], e.each(t.split(/\W+/), function (e, t) {
  56126. var r;
  56127. r = t.toLowerCase().charAt(0);
  56128. if (s[r]) return n.push(r);
  56129. }), n;
  56130. },
  56131. c = {},
  56132. h = {
  56133. name: "core",
  56134. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  56135. 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}"
  56136. },
  56137. p = {
  56138. "border-radius": ["-webkit-", "-moz-"]
  56139. },
  56140. d = function d(e) {
  56141. return c[e];
  56142. },
  56143. v = function v(e) {
  56144. if (!e) throw "Missing Style name";
  56145. c[e] && delete c[e];
  56146. },
  56147. m = function m(t, i) {
  56148. if (!t) throw "Missing Style name";
  56149. if (!i) throw "Missing Style definition";
  56150. if (!i.html) throw "Missing Style HTML";
  56151. var s = c[t];
  56152. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  56153. var o = "";
  56154. i.classes && e.each(i.classes, function (t, n) {
  56155. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  56156. return p[t] && e.each(p[t], function (e, r) {
  56157. return o += " " + r + t + ": " + n + ";\n";
  56158. }), o += " " + t + ": " + n + ";\n";
  56159. }), o += "}\n";
  56160. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  56161. var u = {},
  56162. a = e(i.html);
  56163. y("html", a, u), y("text", a, u), i.fields = u;
  56164. },
  56165. g = function g(t) {
  56166. var n, r, i;
  56167. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  56168. try {
  56169. r.html(t);
  56170. } catch (s) {
  56171. r[0].styleSheet.cssText = t;
  56172. }
  56173. return r;
  56174. },
  56175. y = function y(t, n, r) {
  56176. var s;
  56177. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  56178. var n;
  56179. n = e(this).attr(s), n || (n = i), r[n] = t;
  56180. });
  56181. },
  56182. b = function b(e, t) {
  56183. return e.is(t) ? e : e.find(t);
  56184. },
  56185. w = {
  56186. clickToHide: !0,
  56187. autoHide: !0,
  56188. autoHideDelay: 5e3,
  56189. arrowShow: !0,
  56190. arrowSize: 5,
  56191. breakNewLines: !0,
  56192. elementPosition: "bottom",
  56193. globalPosition: "top right",
  56194. style: "bootstrap",
  56195. className: "error",
  56196. showAnimation: "slideDown",
  56197. showDuration: 400,
  56198. hideAnimation: "slideUp",
  56199. hideDuration: 200,
  56200. gap: 5
  56201. },
  56202. E = function E(t, n) {
  56203. var r;
  56204. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  56205. },
  56206. S = function S(t) {
  56207. return e.extend(w, t);
  56208. },
  56209. x = function x(t) {
  56210. return e("<" + t + "></" + t + ">");
  56211. },
  56212. T = {},
  56213. N = function N(t) {
  56214. var n;
  56215. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  56216. return e(r).attr("name") === t.attr("name");
  56217. }), t = n.first()), t;
  56218. },
  56219. C = function C(e, t, n) {
  56220. var r, i;
  56221. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  56222. if (isNaN(n)) return;
  56223. 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;
  56224. },
  56225. k = function k(e, t, n) {
  56226. if (e === "l" || e === "t") return 0;
  56227. if (e === "c" || e === "m") return n / 2 - t / 2;
  56228. if (e === "r" || e === "b") return n - t;
  56229. throw "Invalid alignment";
  56230. },
  56231. L = function L(e) {
  56232. return L.e = L.e || x("div"), L.e.text(e).html();
  56233. };
  56234. A.prototype.loadHTML = function () {
  56235. var t;
  56236. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  56237. }, A.prototype.show = function (e, t) {
  56238. var n, r, i, s, o;
  56239. r = function (n) {
  56240. return function () {
  56241. !e && !n.elem && n.destroy();
  56242. if (t) return t();
  56243. };
  56244. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  56245. 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 {
  56246. if (!!o || !!e) return r();
  56247. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  56248. }
  56249. return n.push(r), i[s].apply(i, n);
  56250. }, A.prototype.setGlobalPosition = function () {
  56251. var t = this.getPosition(),
  56252. n = t[0],
  56253. i = t[1],
  56254. o = s[n],
  56255. u = s[i],
  56256. a = n + "|" + i,
  56257. f = T[a];
  56258. if (!f || !document.body.contains(f[0])) {
  56259. f = T[a] = x("div");
  56260. var l = {};
  56261. 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);
  56262. }
  56263. return f.prepend(this.wrapper);
  56264. }, A.prototype.setElementPosition = function () {
  56265. 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;
  56266. 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"];
  56267. for (w = 0, S = B.length; w < S; w++) {
  56268. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  56269. }
  56270. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  56271. if (!this.options.arrowShow) this.arrow.hide();else {
  56272. 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";
  56273. for (E = 0, x = a.length; E < x; E++) {
  56274. D = a[E], P = s[D];
  56275. if (D === L) continue;
  56276. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  56277. }
  56278. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  56279. }
  56280. 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);
  56281. if (r) return this.arrow.removeAttr("style").css(r);
  56282. }, A.prototype.getPosition = function () {
  56283. var e, n, r, i, s, f, c, h;
  56284. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  56285. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  56286. 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";
  56287. return e.length === 2 && (e[2] = e[1]), e;
  56288. }, A.prototype.getStyle = function (e) {
  56289. var t;
  56290. e || (e = this.options.style), e || (e = "default"), t = c[e];
  56291. if (!t) throw "Missing style: " + e;
  56292. return t;
  56293. }, A.prototype.updateClasses = function () {
  56294. var t, n;
  56295. 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) {
  56296. return r + "-" + n.name + "-" + e;
  56297. }).join(" "), this.userContainer.attr("class", t);
  56298. }, A.prototype.run = function (t, n) {
  56299. var r, s, o, u, a;
  56300. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  56301. if (this.container && !t) {
  56302. this.show(!1);
  56303. return;
  56304. }
  56305. if (!this.container && !t) return;
  56306. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  56307. for (o in s) {
  56308. r = s[o], u = this.userFields[o];
  56309. if (!u) continue;
  56310. 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);
  56311. }
  56312. 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));
  56313. }, A.prototype.destroy = function () {
  56314. this.wrapper.data(r, null), this.wrapper.remove();
  56315. }, e[n] = function (t, r, i) {
  56316. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  56317. }, e.fn[n] = function (t, n) {
  56318. return e(this).each(function () {
  56319. var i = N(e(this)).data(r);
  56320. i && i.destroy();
  56321. var s = new A(e(this), t, n);
  56322. }), this;
  56323. }, e.extend(e[n], {
  56324. defaults: S,
  56325. addStyle: m,
  56326. removeStyle: v,
  56327. pluginOptions: w,
  56328. getStyle: d,
  56329. insertCSS: g
  56330. }), m("bootstrap", {
  56331. html: "<div>\n<span data-notify-text></span>\n</div>",
  56332. classes: {
  56333. base: {
  56334. "font-weight": "bold",
  56335. padding: "8px 15px 8px 14px",
  56336. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  56337. "background-color": "#fcf8e3",
  56338. border: "1px solid #fbeed5",
  56339. "border-radius": "4px",
  56340. "white-space": "nowrap",
  56341. "padding-left": "25px",
  56342. "background-repeat": "no-repeat",
  56343. "background-position": "3px 7px"
  56344. },
  56345. error: {
  56346. color: "#B94A48",
  56347. "background-color": "#F2DEDE",
  56348. "border-color": "#EED3D7",
  56349. "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=)"
  56350. },
  56351. success: {
  56352. color: "#468847",
  56353. "background-color": "#DFF0D8",
  56354. "border-color": "#D6E9C6",
  56355. "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==)"
  56356. },
  56357. info: {
  56358. color: "#3A87AD",
  56359. "background-color": "#D9EDF7",
  56360. "border-color": "#BCE8F1",
  56361. "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=)"
  56362. },
  56363. warn: {
  56364. color: "#C09853",
  56365. "background-color": "#FCF8E3",
  56366. "border-color": "#FBEED5",
  56367. "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)"
  56368. }
  56369. }
  56370. }), e(function () {
  56371. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  56372. e(this).trigger("notify-hide");
  56373. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  56374. var n = e(this).data(r);
  56375. n && n.show(!1);
  56376. });
  56377. });
  56378. });
  56379. /***/ }),
  56380. /***/ "./resources/sass/app.scss":
  56381. /*!*********************************!*\
  56382. !*** ./resources/sass/app.scss ***!
  56383. \*********************************/
  56384. /*! no static exports found */
  56385. /***/ (function(module, exports) {
  56386. // removed by extract-text-webpack-plugin
  56387. /***/ }),
  56388. /***/ 0:
  56389. /*!*************************************************************!*\
  56390. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  56391. \*************************************************************/
  56392. /*! no static exports found */
  56393. /***/ (function(module, exports, __webpack_require__) {
  56394. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  56395. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  56396. /***/ })
  56397. /******/ });