app.js 1.8 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785
  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.pcid === deletedCred['pcid'];
  2004. });
  2005. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2006. _this.deleteCred(index);
  2007. }).listen('CredentialAdded', function (e) {
  2008. _this.credentials.unshift(e.credential);
  2009. });
  2010. }
  2011. if (this.groupid) {
  2012. Echo.channel('credlist.groupid.' + this.groupid).listen('CredentialDeleted', function (e) {
  2013. var deletedCred = e.credential;
  2014. var index = _this.credentials.findIndex(function (credential) {
  2015. return credential.groupid === deletedCred['groupid'];
  2016. });
  2017. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2018. _this.deleteCred(index);
  2019. }).listen('CredentialAdded', function (e) {
  2020. _this.credentials.unshift(e.credential);
  2021. });
  2022. }
  2023. }
  2024. });
  2025. /***/ }),
  2026. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=script&lang=js&":
  2027. /*!*********************************************************************************************************************************************************************!*\
  2028. !*** ./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& ***!
  2029. \*********************************************************************************************************************************************************************/
  2030. /*! exports provided: default */
  2031. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2032. "use strict";
  2033. __webpack_require__.r(__webpack_exports__);
  2034. //
  2035. //
  2036. //
  2037. //
  2038. //
  2039. //
  2040. //
  2041. //
  2042. //
  2043. //
  2044. //
  2045. //
  2046. //
  2047. //
  2048. //
  2049. //
  2050. //
  2051. //
  2052. //
  2053. //
  2054. //
  2055. //
  2056. //
  2057. //
  2058. //
  2059. //
  2060. //
  2061. //
  2062. //
  2063. //
  2064. //
  2065. //
  2066. //
  2067. //
  2068. //
  2069. //
  2070. //
  2071. //
  2072. //
  2073. //
  2074. //
  2075. //
  2076. //
  2077. /* harmony default export */ __webpack_exports__["default"] = ({
  2078. props: ['credential', 'descriptions'],
  2079. data: function data() {
  2080. return {
  2081. data: this.credential,
  2082. creddescList: this.descriptions
  2083. };
  2084. },
  2085. mounted: function mounted() {
  2086. var _this = this;
  2087. Echo.channel('credential.' + this.data.credid).listen('CredentialUpdated', function (e) {
  2088. _this.data = e.credential;
  2089. });
  2090. },
  2091. methods: {
  2092. deleteCredential: function deleteCredential() {
  2093. var _this2 = this;
  2094. axios["delete"]('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  2095. $('#credential' + _this2.data.credid + 'deleteModal').modal('hide');
  2096. })["catch"](function (error) {
  2097. console.error(error);
  2098. });
  2099. }
  2100. }
  2101. });
  2102. /***/ }),
  2103. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  2104. /*!********************************************************************************************************************************************************************!*\
  2105. !*** ./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& ***!
  2106. \********************************************************************************************************************************************************************/
  2107. /*! exports provided: default */
  2108. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2109. "use strict";
  2110. __webpack_require__.r(__webpack_exports__);
  2111. //
  2112. //
  2113. //
  2114. //
  2115. //
  2116. /* harmony default export */ __webpack_exports__["default"] = ({
  2117. props: ['errors'],
  2118. data: function data() {
  2119. return {
  2120. errorList: this.errors
  2121. };
  2122. },
  2123. watch: {
  2124. errors: function errors(newErrors) {
  2125. this.errorList = newErrors;
  2126. }
  2127. }
  2128. });
  2129. /***/ }),
  2130. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=script&lang=js&":
  2131. /*!****************************************************************************************************************************************************************!*\
  2132. !*** ./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& ***!
  2133. \****************************************************************************************************************************************************************/
  2134. /*! exports provided: default */
  2135. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2136. "use strict";
  2137. __webpack_require__.r(__webpack_exports__);
  2138. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2139. //
  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. /* harmony default export */ __webpack_exports__["default"] = ({
  2179. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2180. props: ['initialnotes', 'authusername'],
  2181. data: function data() {
  2182. return {
  2183. notes: Object.values(this.initialnotes)
  2184. };
  2185. },
  2186. methods: {
  2187. userChanged: function userChanged(index) {
  2188. if (index === 0) {
  2189. return false;
  2190. } else {
  2191. return this.notes[index].noteuser !== this.notes[index - 1].noteuser;
  2192. }
  2193. }
  2194. }
  2195. });
  2196. /***/ }),
  2197. /***/ "./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&":
  2198. /*!****************************************************************************************************************************************************************************!*\
  2199. !*** ./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& ***!
  2200. \****************************************************************************************************************************************************************************/
  2201. /*! exports provided: default */
  2202. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2203. "use strict";
  2204. __webpack_require__.r(__webpack_exports__);
  2205. //
  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. /* harmony default export */ __webpack_exports__["default"] = ({
  2239. props: ['populateWith', 'storeList', 'modalId'],
  2240. data: function data() {
  2241. return {
  2242. // Copies object from prop, so it doesn't mutate the object
  2243. // from the parent component. Parent component will be updated via
  2244. // Websocket if updateWorkOrder is successful.
  2245. data: JSON.parse(JSON.stringify(this.populateWith)),
  2246. id: this.modalId,
  2247. store: {},
  2248. errors: []
  2249. };
  2250. },
  2251. mounted: function mounted() {
  2252. this.store = {
  2253. 'id': this.data.storeid,
  2254. 'name': this.storeList[this.data.storeid]
  2255. };
  2256. },
  2257. methods: {
  2258. updateWorkOrder: function updateWorkOrder() {
  2259. var _this = this;
  2260. this.data.storeid = this.store.id;
  2261. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {
  2262. $('#workordereditModal').modal('hide');
  2263. })["catch"](function (error) {
  2264. _this.errors = JSON.parse(error.response.request.response).errors;
  2265. });
  2266. }
  2267. }
  2268. });
  2269. /***/ }),
  2270. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  2271. /*!*****************************************************************************************************************************************************************!*\
  2272. !*** ./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& ***!
  2273. \*****************************************************************************************************************************************************************/
  2274. /*! exports provided: default */
  2275. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2276. "use strict";
  2277. __webpack_require__.r(__webpack_exports__);
  2278. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2279. //
  2280. //
  2281. //
  2282. //
  2283. //
  2284. //
  2285. //
  2286. //
  2287. //
  2288. //
  2289. //
  2290. //
  2291. //
  2292. //
  2293. //
  2294. //
  2295. //
  2296. //
  2297. //
  2298. //
  2299. /* harmony default export */ __webpack_exports__["default"] = ({
  2300. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2301. props: ['workOrder', 'stores'],
  2302. data: function data() {
  2303. return {
  2304. data: JSON.parse(this.workOrder)
  2305. };
  2306. },
  2307. computed: {
  2308. storeList: function storeList() {
  2309. var list = {};
  2310. JSON.parse(this.stores).map(function (val) {
  2311. list[val.storeid] = val.storesname;
  2312. });
  2313. return list;
  2314. }
  2315. },
  2316. mounted: function mounted() {
  2317. var _this = this;
  2318. Echo.channel('work-order.' + this.data.woid).listen('WorkOrderUpdated', function (e) {
  2319. _this.data = e.data;
  2320. });
  2321. }
  2322. });
  2323. /***/ }),
  2324. /***/ "./node_modules/base64-js/index.js":
  2325. /*!*****************************************!*\
  2326. !*** ./node_modules/base64-js/index.js ***!
  2327. \*****************************************/
  2328. /*! no static exports found */
  2329. /***/ (function(module, exports, __webpack_require__) {
  2330. "use strict";
  2331. exports.byteLength = byteLength
  2332. exports.toByteArray = toByteArray
  2333. exports.fromByteArray = fromByteArray
  2334. var lookup = []
  2335. var revLookup = []
  2336. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  2337. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  2338. for (var i = 0, len = code.length; i < len; ++i) {
  2339. lookup[i] = code[i]
  2340. revLookup[code.charCodeAt(i)] = i
  2341. }
  2342. // Support decoding URL-safe base64 strings, as Node.js does.
  2343. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  2344. revLookup['-'.charCodeAt(0)] = 62
  2345. revLookup['_'.charCodeAt(0)] = 63
  2346. function getLens (b64) {
  2347. var len = b64.length
  2348. if (len % 4 > 0) {
  2349. throw new Error('Invalid string. Length must be a multiple of 4')
  2350. }
  2351. // Trim off extra bytes after placeholder bytes are found
  2352. // See: https://github.com/beatgammit/base64-js/issues/42
  2353. var validLen = b64.indexOf('=')
  2354. if (validLen === -1) validLen = len
  2355. var placeHoldersLen = validLen === len
  2356. ? 0
  2357. : 4 - (validLen % 4)
  2358. return [validLen, placeHoldersLen]
  2359. }
  2360. // base64 is 4/3 + up to two characters of the original data
  2361. function byteLength (b64) {
  2362. var lens = getLens(b64)
  2363. var validLen = lens[0]
  2364. var placeHoldersLen = lens[1]
  2365. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2366. }
  2367. function _byteLength (b64, validLen, placeHoldersLen) {
  2368. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2369. }
  2370. function toByteArray (b64) {
  2371. var tmp
  2372. var lens = getLens(b64)
  2373. var validLen = lens[0]
  2374. var placeHoldersLen = lens[1]
  2375. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  2376. var curByte = 0
  2377. // if there are placeholders, only get up to the last complete 4 chars
  2378. var len = placeHoldersLen > 0
  2379. ? validLen - 4
  2380. : validLen
  2381. var i
  2382. for (i = 0; i < len; i += 4) {
  2383. tmp =
  2384. (revLookup[b64.charCodeAt(i)] << 18) |
  2385. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  2386. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  2387. revLookup[b64.charCodeAt(i + 3)]
  2388. arr[curByte++] = (tmp >> 16) & 0xFF
  2389. arr[curByte++] = (tmp >> 8) & 0xFF
  2390. arr[curByte++] = tmp & 0xFF
  2391. }
  2392. if (placeHoldersLen === 2) {
  2393. tmp =
  2394. (revLookup[b64.charCodeAt(i)] << 2) |
  2395. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  2396. arr[curByte++] = tmp & 0xFF
  2397. }
  2398. if (placeHoldersLen === 1) {
  2399. tmp =
  2400. (revLookup[b64.charCodeAt(i)] << 10) |
  2401. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  2402. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  2403. arr[curByte++] = (tmp >> 8) & 0xFF
  2404. arr[curByte++] = tmp & 0xFF
  2405. }
  2406. return arr
  2407. }
  2408. function tripletToBase64 (num) {
  2409. return lookup[num >> 18 & 0x3F] +
  2410. lookup[num >> 12 & 0x3F] +
  2411. lookup[num >> 6 & 0x3F] +
  2412. lookup[num & 0x3F]
  2413. }
  2414. function encodeChunk (uint8, start, end) {
  2415. var tmp
  2416. var output = []
  2417. for (var i = start; i < end; i += 3) {
  2418. tmp =
  2419. ((uint8[i] << 16) & 0xFF0000) +
  2420. ((uint8[i + 1] << 8) & 0xFF00) +
  2421. (uint8[i + 2] & 0xFF)
  2422. output.push(tripletToBase64(tmp))
  2423. }
  2424. return output.join('')
  2425. }
  2426. function fromByteArray (uint8) {
  2427. var tmp
  2428. var len = uint8.length
  2429. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  2430. var parts = []
  2431. var maxChunkLength = 16383 // must be multiple of 3
  2432. // go through the array every three bytes, we'll deal with trailing stuff later
  2433. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  2434. parts.push(encodeChunk(
  2435. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  2436. ))
  2437. }
  2438. // pad the end with zeros, but make sure to not forget the extra bytes
  2439. if (extraBytes === 1) {
  2440. tmp = uint8[len - 1]
  2441. parts.push(
  2442. lookup[tmp >> 2] +
  2443. lookup[(tmp << 4) & 0x3F] +
  2444. '=='
  2445. )
  2446. } else if (extraBytes === 2) {
  2447. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  2448. parts.push(
  2449. lookup[tmp >> 10] +
  2450. lookup[(tmp >> 4) & 0x3F] +
  2451. lookup[(tmp << 2) & 0x3F] +
  2452. '='
  2453. )
  2454. }
  2455. return parts.join('')
  2456. }
  2457. /***/ }),
  2458. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  2459. /*!*****************************************************!*\
  2460. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  2461. \*****************************************************/
  2462. /*! no static exports found */
  2463. /***/ (function(module, exports, __webpack_require__) {
  2464. /*!
  2465. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  2466. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  2467. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2468. */
  2469. (function (global, factory) {
  2470. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  2471. undefined;
  2472. }(this, (function (exports, $, Popper) { 'use strict';
  2473. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  2474. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  2475. function _defineProperties(target, props) {
  2476. for (var i = 0; i < props.length; i++) {
  2477. var descriptor = props[i];
  2478. descriptor.enumerable = descriptor.enumerable || false;
  2479. descriptor.configurable = true;
  2480. if ("value" in descriptor) descriptor.writable = true;
  2481. Object.defineProperty(target, descriptor.key, descriptor);
  2482. }
  2483. }
  2484. function _createClass(Constructor, protoProps, staticProps) {
  2485. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2486. if (staticProps) _defineProperties(Constructor, staticProps);
  2487. return Constructor;
  2488. }
  2489. function _defineProperty(obj, key, value) {
  2490. if (key in obj) {
  2491. Object.defineProperty(obj, key, {
  2492. value: value,
  2493. enumerable: true,
  2494. configurable: true,
  2495. writable: true
  2496. });
  2497. } else {
  2498. obj[key] = value;
  2499. }
  2500. return obj;
  2501. }
  2502. function ownKeys(object, enumerableOnly) {
  2503. var keys = Object.keys(object);
  2504. if (Object.getOwnPropertySymbols) {
  2505. var symbols = Object.getOwnPropertySymbols(object);
  2506. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2507. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2508. });
  2509. keys.push.apply(keys, symbols);
  2510. }
  2511. return keys;
  2512. }
  2513. function _objectSpread2(target) {
  2514. for (var i = 1; i < arguments.length; i++) {
  2515. var source = arguments[i] != null ? arguments[i] : {};
  2516. if (i % 2) {
  2517. ownKeys(Object(source), true).forEach(function (key) {
  2518. _defineProperty(target, key, source[key]);
  2519. });
  2520. } else if (Object.getOwnPropertyDescriptors) {
  2521. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2522. } else {
  2523. ownKeys(Object(source)).forEach(function (key) {
  2524. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2525. });
  2526. }
  2527. }
  2528. return target;
  2529. }
  2530. function _inheritsLoose(subClass, superClass) {
  2531. subClass.prototype = Object.create(superClass.prototype);
  2532. subClass.prototype.constructor = subClass;
  2533. subClass.__proto__ = superClass;
  2534. }
  2535. /**
  2536. * --------------------------------------------------------------------------
  2537. * Bootstrap (v4.4.1): util.js
  2538. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2539. * --------------------------------------------------------------------------
  2540. */
  2541. /**
  2542. * ------------------------------------------------------------------------
  2543. * Private TransitionEnd Helpers
  2544. * ------------------------------------------------------------------------
  2545. */
  2546. var TRANSITION_END = 'transitionend';
  2547. var MAX_UID = 1000000;
  2548. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  2549. function toType(obj) {
  2550. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  2551. }
  2552. function getSpecialTransitionEndEvent() {
  2553. return {
  2554. bindType: TRANSITION_END,
  2555. delegateType: TRANSITION_END,
  2556. handle: function handle(event) {
  2557. if ($(event.target).is(this)) {
  2558. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  2559. }
  2560. return undefined; // eslint-disable-line no-undefined
  2561. }
  2562. };
  2563. }
  2564. function transitionEndEmulator(duration) {
  2565. var _this = this;
  2566. var called = false;
  2567. $(this).one(Util.TRANSITION_END, function () {
  2568. called = true;
  2569. });
  2570. setTimeout(function () {
  2571. if (!called) {
  2572. Util.triggerTransitionEnd(_this);
  2573. }
  2574. }, duration);
  2575. return this;
  2576. }
  2577. function setTransitionEndSupport() {
  2578. $.fn.emulateTransitionEnd = transitionEndEmulator;
  2579. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  2580. }
  2581. /**
  2582. * --------------------------------------------------------------------------
  2583. * Public Util Api
  2584. * --------------------------------------------------------------------------
  2585. */
  2586. var Util = {
  2587. TRANSITION_END: 'bsTransitionEnd',
  2588. getUID: function getUID(prefix) {
  2589. do {
  2590. // eslint-disable-next-line no-bitwise
  2591. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  2592. } while (document.getElementById(prefix));
  2593. return prefix;
  2594. },
  2595. getSelectorFromElement: function getSelectorFromElement(element) {
  2596. var selector = element.getAttribute('data-target');
  2597. if (!selector || selector === '#') {
  2598. var hrefAttr = element.getAttribute('href');
  2599. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2600. }
  2601. try {
  2602. return document.querySelector(selector) ? selector : null;
  2603. } catch (err) {
  2604. return null;
  2605. }
  2606. },
  2607. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2608. if (!element) {
  2609. return 0;
  2610. } // Get transition-duration of the element
  2611. var transitionDuration = $(element).css('transition-duration');
  2612. var transitionDelay = $(element).css('transition-delay');
  2613. var floatTransitionDuration = parseFloat(transitionDuration);
  2614. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2615. if (!floatTransitionDuration && !floatTransitionDelay) {
  2616. return 0;
  2617. } // If multiple durations are defined, take the first
  2618. transitionDuration = transitionDuration.split(',')[0];
  2619. transitionDelay = transitionDelay.split(',')[0];
  2620. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2621. },
  2622. reflow: function reflow(element) {
  2623. return element.offsetHeight;
  2624. },
  2625. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2626. $(element).trigger(TRANSITION_END);
  2627. },
  2628. // TODO: Remove in v5
  2629. supportsTransitionEnd: function supportsTransitionEnd() {
  2630. return Boolean(TRANSITION_END);
  2631. },
  2632. isElement: function isElement(obj) {
  2633. return (obj[0] || obj).nodeType;
  2634. },
  2635. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2636. for (var property in configTypes) {
  2637. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2638. var expectedTypes = configTypes[property];
  2639. var value = config[property];
  2640. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2641. if (!new RegExp(expectedTypes).test(valueType)) {
  2642. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2643. }
  2644. }
  2645. }
  2646. },
  2647. findShadowRoot: function findShadowRoot(element) {
  2648. if (!document.documentElement.attachShadow) {
  2649. return null;
  2650. } // Can find the shadow root otherwise it'll return the document
  2651. if (typeof element.getRootNode === 'function') {
  2652. var root = element.getRootNode();
  2653. return root instanceof ShadowRoot ? root : null;
  2654. }
  2655. if (element instanceof ShadowRoot) {
  2656. return element;
  2657. } // when we don't find a shadow root
  2658. if (!element.parentNode) {
  2659. return null;
  2660. }
  2661. return Util.findShadowRoot(element.parentNode);
  2662. },
  2663. jQueryDetection: function jQueryDetection() {
  2664. if (typeof $ === 'undefined') {
  2665. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2666. }
  2667. var version = $.fn.jquery.split(' ')[0].split('.');
  2668. var minMajor = 1;
  2669. var ltMajor = 2;
  2670. var minMinor = 9;
  2671. var minPatch = 1;
  2672. var maxMajor = 4;
  2673. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2674. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2675. }
  2676. }
  2677. };
  2678. Util.jQueryDetection();
  2679. setTransitionEndSupport();
  2680. /**
  2681. * ------------------------------------------------------------------------
  2682. * Constants
  2683. * ------------------------------------------------------------------------
  2684. */
  2685. var NAME = 'alert';
  2686. var VERSION = '4.4.1';
  2687. var DATA_KEY = 'bs.alert';
  2688. var EVENT_KEY = "." + DATA_KEY;
  2689. var DATA_API_KEY = '.data-api';
  2690. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2691. var Selector = {
  2692. DISMISS: '[data-dismiss="alert"]'
  2693. };
  2694. var Event = {
  2695. CLOSE: "close" + EVENT_KEY,
  2696. CLOSED: "closed" + EVENT_KEY,
  2697. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  2698. };
  2699. var ClassName = {
  2700. ALERT: 'alert',
  2701. FADE: 'fade',
  2702. SHOW: 'show'
  2703. };
  2704. /**
  2705. * ------------------------------------------------------------------------
  2706. * Class Definition
  2707. * ------------------------------------------------------------------------
  2708. */
  2709. var Alert =
  2710. /*#__PURE__*/
  2711. function () {
  2712. function Alert(element) {
  2713. this._element = element;
  2714. } // Getters
  2715. var _proto = Alert.prototype;
  2716. // Public
  2717. _proto.close = function close(element) {
  2718. var rootElement = this._element;
  2719. if (element) {
  2720. rootElement = this._getRootElement(element);
  2721. }
  2722. var customEvent = this._triggerCloseEvent(rootElement);
  2723. if (customEvent.isDefaultPrevented()) {
  2724. return;
  2725. }
  2726. this._removeElement(rootElement);
  2727. };
  2728. _proto.dispose = function dispose() {
  2729. $.removeData(this._element, DATA_KEY);
  2730. this._element = null;
  2731. } // Private
  2732. ;
  2733. _proto._getRootElement = function _getRootElement(element) {
  2734. var selector = Util.getSelectorFromElement(element);
  2735. var parent = false;
  2736. if (selector) {
  2737. parent = document.querySelector(selector);
  2738. }
  2739. if (!parent) {
  2740. parent = $(element).closest("." + ClassName.ALERT)[0];
  2741. }
  2742. return parent;
  2743. };
  2744. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2745. var closeEvent = $.Event(Event.CLOSE);
  2746. $(element).trigger(closeEvent);
  2747. return closeEvent;
  2748. };
  2749. _proto._removeElement = function _removeElement(element) {
  2750. var _this = this;
  2751. $(element).removeClass(ClassName.SHOW);
  2752. if (!$(element).hasClass(ClassName.FADE)) {
  2753. this._destroyElement(element);
  2754. return;
  2755. }
  2756. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2757. $(element).one(Util.TRANSITION_END, function (event) {
  2758. return _this._destroyElement(element, event);
  2759. }).emulateTransitionEnd(transitionDuration);
  2760. };
  2761. _proto._destroyElement = function _destroyElement(element) {
  2762. $(element).detach().trigger(Event.CLOSED).remove();
  2763. } // Static
  2764. ;
  2765. Alert._jQueryInterface = function _jQueryInterface(config) {
  2766. return this.each(function () {
  2767. var $element = $(this);
  2768. var data = $element.data(DATA_KEY);
  2769. if (!data) {
  2770. data = new Alert(this);
  2771. $element.data(DATA_KEY, data);
  2772. }
  2773. if (config === 'close') {
  2774. data[config](this);
  2775. }
  2776. });
  2777. };
  2778. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2779. return function (event) {
  2780. if (event) {
  2781. event.preventDefault();
  2782. }
  2783. alertInstance.close(this);
  2784. };
  2785. };
  2786. _createClass(Alert, null, [{
  2787. key: "VERSION",
  2788. get: function get() {
  2789. return VERSION;
  2790. }
  2791. }]);
  2792. return Alert;
  2793. }();
  2794. /**
  2795. * ------------------------------------------------------------------------
  2796. * Data Api implementation
  2797. * ------------------------------------------------------------------------
  2798. */
  2799. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  2800. /**
  2801. * ------------------------------------------------------------------------
  2802. * jQuery
  2803. * ------------------------------------------------------------------------
  2804. */
  2805. $.fn[NAME] = Alert._jQueryInterface;
  2806. $.fn[NAME].Constructor = Alert;
  2807. $.fn[NAME].noConflict = function () {
  2808. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2809. return Alert._jQueryInterface;
  2810. };
  2811. /**
  2812. * ------------------------------------------------------------------------
  2813. * Constants
  2814. * ------------------------------------------------------------------------
  2815. */
  2816. var NAME$1 = 'button';
  2817. var VERSION$1 = '4.4.1';
  2818. var DATA_KEY$1 = 'bs.button';
  2819. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2820. var DATA_API_KEY$1 = '.data-api';
  2821. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2822. var ClassName$1 = {
  2823. ACTIVE: 'active',
  2824. BUTTON: 'btn',
  2825. FOCUS: 'focus'
  2826. };
  2827. var Selector$1 = {
  2828. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  2829. DATA_TOGGLES: '[data-toggle="buttons"]',
  2830. DATA_TOGGLE: '[data-toggle="button"]',
  2831. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  2832. INPUT: 'input:not([type="hidden"])',
  2833. ACTIVE: '.active',
  2834. BUTTON: '.btn'
  2835. };
  2836. var Event$1 = {
  2837. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  2838. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  2839. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  2840. };
  2841. /**
  2842. * ------------------------------------------------------------------------
  2843. * Class Definition
  2844. * ------------------------------------------------------------------------
  2845. */
  2846. var Button =
  2847. /*#__PURE__*/
  2848. function () {
  2849. function Button(element) {
  2850. this._element = element;
  2851. } // Getters
  2852. var _proto = Button.prototype;
  2853. // Public
  2854. _proto.toggle = function toggle() {
  2855. var triggerChangeEvent = true;
  2856. var addAriaPressed = true;
  2857. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2858. if (rootElement) {
  2859. var input = this._element.querySelector(Selector$1.INPUT);
  2860. if (input) {
  2861. if (input.type === 'radio') {
  2862. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2863. triggerChangeEvent = false;
  2864. } else {
  2865. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  2866. if (activeElement) {
  2867. $(activeElement).removeClass(ClassName$1.ACTIVE);
  2868. }
  2869. }
  2870. } else if (input.type === 'checkbox') {
  2871. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  2872. triggerChangeEvent = false;
  2873. }
  2874. } else {
  2875. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  2876. triggerChangeEvent = false;
  2877. }
  2878. if (triggerChangeEvent) {
  2879. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  2880. $(input).trigger('change');
  2881. }
  2882. input.focus();
  2883. addAriaPressed = false;
  2884. }
  2885. }
  2886. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  2887. if (addAriaPressed) {
  2888. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  2889. }
  2890. if (triggerChangeEvent) {
  2891. $(this._element).toggleClass(ClassName$1.ACTIVE);
  2892. }
  2893. }
  2894. };
  2895. _proto.dispose = function dispose() {
  2896. $.removeData(this._element, DATA_KEY$1);
  2897. this._element = null;
  2898. } // Static
  2899. ;
  2900. Button._jQueryInterface = function _jQueryInterface(config) {
  2901. return this.each(function () {
  2902. var data = $(this).data(DATA_KEY$1);
  2903. if (!data) {
  2904. data = new Button(this);
  2905. $(this).data(DATA_KEY$1, data);
  2906. }
  2907. if (config === 'toggle') {
  2908. data[config]();
  2909. }
  2910. });
  2911. };
  2912. _createClass(Button, null, [{
  2913. key: "VERSION",
  2914. get: function get() {
  2915. return VERSION$1;
  2916. }
  2917. }]);
  2918. return Button;
  2919. }();
  2920. /**
  2921. * ------------------------------------------------------------------------
  2922. * Data Api implementation
  2923. * ------------------------------------------------------------------------
  2924. */
  2925. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2926. var button = event.target;
  2927. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  2928. button = $(button).closest(Selector$1.BUTTON)[0];
  2929. }
  2930. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  2931. event.preventDefault(); // work around Firefox bug #1540995
  2932. } else {
  2933. var inputBtn = button.querySelector(Selector$1.INPUT);
  2934. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  2935. event.preventDefault(); // work around Firefox bug #1540995
  2936. return;
  2937. }
  2938. Button._jQueryInterface.call($(button), 'toggle');
  2939. }
  2940. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2941. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  2942. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  2943. });
  2944. $(window).on(Event$1.LOAD_DATA_API, function () {
  2945. // ensure correct active class is set to match the controls' actual values/states
  2946. // find all checkboxes/readio buttons inside data-toggle groups
  2947. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  2948. for (var i = 0, len = buttons.length; i < len; i++) {
  2949. var button = buttons[i];
  2950. var input = button.querySelector(Selector$1.INPUT);
  2951. if (input.checked || input.hasAttribute('checked')) {
  2952. button.classList.add(ClassName$1.ACTIVE);
  2953. } else {
  2954. button.classList.remove(ClassName$1.ACTIVE);
  2955. }
  2956. } // find all button toggles
  2957. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  2958. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  2959. var _button = buttons[_i];
  2960. if (_button.getAttribute('aria-pressed') === 'true') {
  2961. _button.classList.add(ClassName$1.ACTIVE);
  2962. } else {
  2963. _button.classList.remove(ClassName$1.ACTIVE);
  2964. }
  2965. }
  2966. });
  2967. /**
  2968. * ------------------------------------------------------------------------
  2969. * jQuery
  2970. * ------------------------------------------------------------------------
  2971. */
  2972. $.fn[NAME$1] = Button._jQueryInterface;
  2973. $.fn[NAME$1].Constructor = Button;
  2974. $.fn[NAME$1].noConflict = function () {
  2975. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  2976. return Button._jQueryInterface;
  2977. };
  2978. /**
  2979. * ------------------------------------------------------------------------
  2980. * Constants
  2981. * ------------------------------------------------------------------------
  2982. */
  2983. var NAME$2 = 'carousel';
  2984. var VERSION$2 = '4.4.1';
  2985. var DATA_KEY$2 = 'bs.carousel';
  2986. var EVENT_KEY$2 = "." + DATA_KEY$2;
  2987. var DATA_API_KEY$2 = '.data-api';
  2988. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  2989. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  2990. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  2991. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  2992. var SWIPE_THRESHOLD = 40;
  2993. var Default = {
  2994. interval: 5000,
  2995. keyboard: true,
  2996. slide: false,
  2997. pause: 'hover',
  2998. wrap: true,
  2999. touch: true
  3000. };
  3001. var DefaultType = {
  3002. interval: '(number|boolean)',
  3003. keyboard: 'boolean',
  3004. slide: '(boolean|string)',
  3005. pause: '(string|boolean)',
  3006. wrap: 'boolean',
  3007. touch: 'boolean'
  3008. };
  3009. var Direction = {
  3010. NEXT: 'next',
  3011. PREV: 'prev',
  3012. LEFT: 'left',
  3013. RIGHT: 'right'
  3014. };
  3015. var Event$2 = {
  3016. SLIDE: "slide" + EVENT_KEY$2,
  3017. SLID: "slid" + EVENT_KEY$2,
  3018. KEYDOWN: "keydown" + EVENT_KEY$2,
  3019. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  3020. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  3021. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  3022. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  3023. TOUCHEND: "touchend" + EVENT_KEY$2,
  3024. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  3025. POINTERUP: "pointerup" + EVENT_KEY$2,
  3026. DRAG_START: "dragstart" + EVENT_KEY$2,
  3027. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  3028. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  3029. };
  3030. var ClassName$2 = {
  3031. CAROUSEL: 'carousel',
  3032. ACTIVE: 'active',
  3033. SLIDE: 'slide',
  3034. RIGHT: 'carousel-item-right',
  3035. LEFT: 'carousel-item-left',
  3036. NEXT: 'carousel-item-next',
  3037. PREV: 'carousel-item-prev',
  3038. ITEM: 'carousel-item',
  3039. POINTER_EVENT: 'pointer-event'
  3040. };
  3041. var Selector$2 = {
  3042. ACTIVE: '.active',
  3043. ACTIVE_ITEM: '.active.carousel-item',
  3044. ITEM: '.carousel-item',
  3045. ITEM_IMG: '.carousel-item img',
  3046. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  3047. INDICATORS: '.carousel-indicators',
  3048. DATA_SLIDE: '[data-slide], [data-slide-to]',
  3049. DATA_RIDE: '[data-ride="carousel"]'
  3050. };
  3051. var PointerType = {
  3052. TOUCH: 'touch',
  3053. PEN: 'pen'
  3054. };
  3055. /**
  3056. * ------------------------------------------------------------------------
  3057. * Class Definition
  3058. * ------------------------------------------------------------------------
  3059. */
  3060. var Carousel =
  3061. /*#__PURE__*/
  3062. function () {
  3063. function Carousel(element, config) {
  3064. this._items = null;
  3065. this._interval = null;
  3066. this._activeElement = null;
  3067. this._isPaused = false;
  3068. this._isSliding = false;
  3069. this.touchTimeout = null;
  3070. this.touchStartX = 0;
  3071. this.touchDeltaX = 0;
  3072. this._config = this._getConfig(config);
  3073. this._element = element;
  3074. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  3075. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  3076. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  3077. this._addEventListeners();
  3078. } // Getters
  3079. var _proto = Carousel.prototype;
  3080. // Public
  3081. _proto.next = function next() {
  3082. if (!this._isSliding) {
  3083. this._slide(Direction.NEXT);
  3084. }
  3085. };
  3086. _proto.nextWhenVisible = function nextWhenVisible() {
  3087. // Don't call next when the page isn't visible
  3088. // or the carousel or its parent isn't visible
  3089. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  3090. this.next();
  3091. }
  3092. };
  3093. _proto.prev = function prev() {
  3094. if (!this._isSliding) {
  3095. this._slide(Direction.PREV);
  3096. }
  3097. };
  3098. _proto.pause = function pause(event) {
  3099. if (!event) {
  3100. this._isPaused = true;
  3101. }
  3102. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  3103. Util.triggerTransitionEnd(this._element);
  3104. this.cycle(true);
  3105. }
  3106. clearInterval(this._interval);
  3107. this._interval = null;
  3108. };
  3109. _proto.cycle = function cycle(event) {
  3110. if (!event) {
  3111. this._isPaused = false;
  3112. }
  3113. if (this._interval) {
  3114. clearInterval(this._interval);
  3115. this._interval = null;
  3116. }
  3117. if (this._config.interval && !this._isPaused) {
  3118. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  3119. }
  3120. };
  3121. _proto.to = function to(index) {
  3122. var _this = this;
  3123. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3124. var activeIndex = this._getItemIndex(this._activeElement);
  3125. if (index > this._items.length - 1 || index < 0) {
  3126. return;
  3127. }
  3128. if (this._isSliding) {
  3129. $(this._element).one(Event$2.SLID, function () {
  3130. return _this.to(index);
  3131. });
  3132. return;
  3133. }
  3134. if (activeIndex === index) {
  3135. this.pause();
  3136. this.cycle();
  3137. return;
  3138. }
  3139. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  3140. this._slide(direction, this._items[index]);
  3141. };
  3142. _proto.dispose = function dispose() {
  3143. $(this._element).off(EVENT_KEY$2);
  3144. $.removeData(this._element, DATA_KEY$2);
  3145. this._items = null;
  3146. this._config = null;
  3147. this._element = null;
  3148. this._interval = null;
  3149. this._isPaused = null;
  3150. this._isSliding = null;
  3151. this._activeElement = null;
  3152. this._indicatorsElement = null;
  3153. } // Private
  3154. ;
  3155. _proto._getConfig = function _getConfig(config) {
  3156. config = _objectSpread2({}, Default, {}, config);
  3157. Util.typeCheckConfig(NAME$2, config, DefaultType);
  3158. return config;
  3159. };
  3160. _proto._handleSwipe = function _handleSwipe() {
  3161. var absDeltax = Math.abs(this.touchDeltaX);
  3162. if (absDeltax <= SWIPE_THRESHOLD) {
  3163. return;
  3164. }
  3165. var direction = absDeltax / this.touchDeltaX;
  3166. this.touchDeltaX = 0; // swipe left
  3167. if (direction > 0) {
  3168. this.prev();
  3169. } // swipe right
  3170. if (direction < 0) {
  3171. this.next();
  3172. }
  3173. };
  3174. _proto._addEventListeners = function _addEventListeners() {
  3175. var _this2 = this;
  3176. if (this._config.keyboard) {
  3177. $(this._element).on(Event$2.KEYDOWN, function (event) {
  3178. return _this2._keydown(event);
  3179. });
  3180. }
  3181. if (this._config.pause === 'hover') {
  3182. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  3183. return _this2.pause(event);
  3184. }).on(Event$2.MOUSELEAVE, function (event) {
  3185. return _this2.cycle(event);
  3186. });
  3187. }
  3188. if (this._config.touch) {
  3189. this._addTouchEventListeners();
  3190. }
  3191. };
  3192. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  3193. var _this3 = this;
  3194. if (!this._touchSupported) {
  3195. return;
  3196. }
  3197. var start = function start(event) {
  3198. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3199. _this3.touchStartX = event.originalEvent.clientX;
  3200. } else if (!_this3._pointerEvent) {
  3201. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  3202. }
  3203. };
  3204. var move = function move(event) {
  3205. // ensure swiping with one touch and not pinching
  3206. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  3207. _this3.touchDeltaX = 0;
  3208. } else {
  3209. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  3210. }
  3211. };
  3212. var end = function end(event) {
  3213. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3214. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  3215. }
  3216. _this3._handleSwipe();
  3217. if (_this3._config.pause === 'hover') {
  3218. // If it's a touch-enabled device, mouseenter/leave are fired as
  3219. // part of the mouse compatibility events on first tap - the carousel
  3220. // would stop cycling until user tapped out of it;
  3221. // here, we listen for touchend, explicitly pause the carousel
  3222. // (as if it's the second time we tap on it, mouseenter compat event
  3223. // is NOT fired) and after a timeout (to allow for mouse compatibility
  3224. // events to fire) we explicitly restart cycling
  3225. _this3.pause();
  3226. if (_this3.touchTimeout) {
  3227. clearTimeout(_this3.touchTimeout);
  3228. }
  3229. _this3.touchTimeout = setTimeout(function (event) {
  3230. return _this3.cycle(event);
  3231. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  3232. }
  3233. };
  3234. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  3235. return e.preventDefault();
  3236. });
  3237. if (this._pointerEvent) {
  3238. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  3239. return start(event);
  3240. });
  3241. $(this._element).on(Event$2.POINTERUP, function (event) {
  3242. return end(event);
  3243. });
  3244. this._element.classList.add(ClassName$2.POINTER_EVENT);
  3245. } else {
  3246. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  3247. return start(event);
  3248. });
  3249. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  3250. return move(event);
  3251. });
  3252. $(this._element).on(Event$2.TOUCHEND, function (event) {
  3253. return end(event);
  3254. });
  3255. }
  3256. };
  3257. _proto._keydown = function _keydown(event) {
  3258. if (/input|textarea/i.test(event.target.tagName)) {
  3259. return;
  3260. }
  3261. switch (event.which) {
  3262. case ARROW_LEFT_KEYCODE:
  3263. event.preventDefault();
  3264. this.prev();
  3265. break;
  3266. case ARROW_RIGHT_KEYCODE:
  3267. event.preventDefault();
  3268. this.next();
  3269. break;
  3270. }
  3271. };
  3272. _proto._getItemIndex = function _getItemIndex(element) {
  3273. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  3274. return this._items.indexOf(element);
  3275. };
  3276. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  3277. var isNextDirection = direction === Direction.NEXT;
  3278. var isPrevDirection = direction === Direction.PREV;
  3279. var activeIndex = this._getItemIndex(activeElement);
  3280. var lastItemIndex = this._items.length - 1;
  3281. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  3282. if (isGoingToWrap && !this._config.wrap) {
  3283. return activeElement;
  3284. }
  3285. var delta = direction === Direction.PREV ? -1 : 1;
  3286. var itemIndex = (activeIndex + delta) % this._items.length;
  3287. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  3288. };
  3289. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  3290. var targetIndex = this._getItemIndex(relatedTarget);
  3291. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  3292. var slideEvent = $.Event(Event$2.SLIDE, {
  3293. relatedTarget: relatedTarget,
  3294. direction: eventDirectionName,
  3295. from: fromIndex,
  3296. to: targetIndex
  3297. });
  3298. $(this._element).trigger(slideEvent);
  3299. return slideEvent;
  3300. };
  3301. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  3302. if (this._indicatorsElement) {
  3303. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  3304. $(indicators).removeClass(ClassName$2.ACTIVE);
  3305. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  3306. if (nextIndicator) {
  3307. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  3308. }
  3309. }
  3310. };
  3311. _proto._slide = function _slide(direction, element) {
  3312. var _this4 = this;
  3313. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3314. var activeElementIndex = this._getItemIndex(activeElement);
  3315. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  3316. var nextElementIndex = this._getItemIndex(nextElement);
  3317. var isCycling = Boolean(this._interval);
  3318. var directionalClassName;
  3319. var orderClassName;
  3320. var eventDirectionName;
  3321. if (direction === Direction.NEXT) {
  3322. directionalClassName = ClassName$2.LEFT;
  3323. orderClassName = ClassName$2.NEXT;
  3324. eventDirectionName = Direction.LEFT;
  3325. } else {
  3326. directionalClassName = ClassName$2.RIGHT;
  3327. orderClassName = ClassName$2.PREV;
  3328. eventDirectionName = Direction.RIGHT;
  3329. }
  3330. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  3331. this._isSliding = false;
  3332. return;
  3333. }
  3334. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  3335. if (slideEvent.isDefaultPrevented()) {
  3336. return;
  3337. }
  3338. if (!activeElement || !nextElement) {
  3339. // Some weirdness is happening, so we bail
  3340. return;
  3341. }
  3342. this._isSliding = true;
  3343. if (isCycling) {
  3344. this.pause();
  3345. }
  3346. this._setActiveIndicatorElement(nextElement);
  3347. var slidEvent = $.Event(Event$2.SLID, {
  3348. relatedTarget: nextElement,
  3349. direction: eventDirectionName,
  3350. from: activeElementIndex,
  3351. to: nextElementIndex
  3352. });
  3353. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  3354. $(nextElement).addClass(orderClassName);
  3355. Util.reflow(nextElement);
  3356. $(activeElement).addClass(directionalClassName);
  3357. $(nextElement).addClass(directionalClassName);
  3358. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  3359. if (nextElementInterval) {
  3360. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  3361. this._config.interval = nextElementInterval;
  3362. } else {
  3363. this._config.interval = this._config.defaultInterval || this._config.interval;
  3364. }
  3365. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  3366. $(activeElement).one(Util.TRANSITION_END, function () {
  3367. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  3368. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  3369. _this4._isSliding = false;
  3370. setTimeout(function () {
  3371. return $(_this4._element).trigger(slidEvent);
  3372. }, 0);
  3373. }).emulateTransitionEnd(transitionDuration);
  3374. } else {
  3375. $(activeElement).removeClass(ClassName$2.ACTIVE);
  3376. $(nextElement).addClass(ClassName$2.ACTIVE);
  3377. this._isSliding = false;
  3378. $(this._element).trigger(slidEvent);
  3379. }
  3380. if (isCycling) {
  3381. this.cycle();
  3382. }
  3383. } // Static
  3384. ;
  3385. Carousel._jQueryInterface = function _jQueryInterface(config) {
  3386. return this.each(function () {
  3387. var data = $(this).data(DATA_KEY$2);
  3388. var _config = _objectSpread2({}, Default, {}, $(this).data());
  3389. if (typeof config === 'object') {
  3390. _config = _objectSpread2({}, _config, {}, config);
  3391. }
  3392. var action = typeof config === 'string' ? config : _config.slide;
  3393. if (!data) {
  3394. data = new Carousel(this, _config);
  3395. $(this).data(DATA_KEY$2, data);
  3396. }
  3397. if (typeof config === 'number') {
  3398. data.to(config);
  3399. } else if (typeof action === 'string') {
  3400. if (typeof data[action] === 'undefined') {
  3401. throw new TypeError("No method named \"" + action + "\"");
  3402. }
  3403. data[action]();
  3404. } else if (_config.interval && _config.ride) {
  3405. data.pause();
  3406. data.cycle();
  3407. }
  3408. });
  3409. };
  3410. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  3411. var selector = Util.getSelectorFromElement(this);
  3412. if (!selector) {
  3413. return;
  3414. }
  3415. var target = $(selector)[0];
  3416. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  3417. return;
  3418. }
  3419. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  3420. var slideIndex = this.getAttribute('data-slide-to');
  3421. if (slideIndex) {
  3422. config.interval = false;
  3423. }
  3424. Carousel._jQueryInterface.call($(target), config);
  3425. if (slideIndex) {
  3426. $(target).data(DATA_KEY$2).to(slideIndex);
  3427. }
  3428. event.preventDefault();
  3429. };
  3430. _createClass(Carousel, null, [{
  3431. key: "VERSION",
  3432. get: function get() {
  3433. return VERSION$2;
  3434. }
  3435. }, {
  3436. key: "Default",
  3437. get: function get() {
  3438. return Default;
  3439. }
  3440. }]);
  3441. return Carousel;
  3442. }();
  3443. /**
  3444. * ------------------------------------------------------------------------
  3445. * Data Api implementation
  3446. * ------------------------------------------------------------------------
  3447. */
  3448. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  3449. $(window).on(Event$2.LOAD_DATA_API, function () {
  3450. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  3451. for (var i = 0, len = carousels.length; i < len; i++) {
  3452. var $carousel = $(carousels[i]);
  3453. Carousel._jQueryInterface.call($carousel, $carousel.data());
  3454. }
  3455. });
  3456. /**
  3457. * ------------------------------------------------------------------------
  3458. * jQuery
  3459. * ------------------------------------------------------------------------
  3460. */
  3461. $.fn[NAME$2] = Carousel._jQueryInterface;
  3462. $.fn[NAME$2].Constructor = Carousel;
  3463. $.fn[NAME$2].noConflict = function () {
  3464. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  3465. return Carousel._jQueryInterface;
  3466. };
  3467. /**
  3468. * ------------------------------------------------------------------------
  3469. * Constants
  3470. * ------------------------------------------------------------------------
  3471. */
  3472. var NAME$3 = 'collapse';
  3473. var VERSION$3 = '4.4.1';
  3474. var DATA_KEY$3 = 'bs.collapse';
  3475. var EVENT_KEY$3 = "." + DATA_KEY$3;
  3476. var DATA_API_KEY$3 = '.data-api';
  3477. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  3478. var Default$1 = {
  3479. toggle: true,
  3480. parent: ''
  3481. };
  3482. var DefaultType$1 = {
  3483. toggle: 'boolean',
  3484. parent: '(string|element)'
  3485. };
  3486. var Event$3 = {
  3487. SHOW: "show" + EVENT_KEY$3,
  3488. SHOWN: "shown" + EVENT_KEY$3,
  3489. HIDE: "hide" + EVENT_KEY$3,
  3490. HIDDEN: "hidden" + EVENT_KEY$3,
  3491. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  3492. };
  3493. var ClassName$3 = {
  3494. SHOW: 'show',
  3495. COLLAPSE: 'collapse',
  3496. COLLAPSING: 'collapsing',
  3497. COLLAPSED: 'collapsed'
  3498. };
  3499. var Dimension = {
  3500. WIDTH: 'width',
  3501. HEIGHT: 'height'
  3502. };
  3503. var Selector$3 = {
  3504. ACTIVES: '.show, .collapsing',
  3505. DATA_TOGGLE: '[data-toggle="collapse"]'
  3506. };
  3507. /**
  3508. * ------------------------------------------------------------------------
  3509. * Class Definition
  3510. * ------------------------------------------------------------------------
  3511. */
  3512. var Collapse =
  3513. /*#__PURE__*/
  3514. function () {
  3515. function Collapse(element, config) {
  3516. this._isTransitioning = false;
  3517. this._element = element;
  3518. this._config = this._getConfig(config);
  3519. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  3520. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  3521. for (var i = 0, len = toggleList.length; i < len; i++) {
  3522. var elem = toggleList[i];
  3523. var selector = Util.getSelectorFromElement(elem);
  3524. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3525. return foundElem === element;
  3526. });
  3527. if (selector !== null && filterElement.length > 0) {
  3528. this._selector = selector;
  3529. this._triggerArray.push(elem);
  3530. }
  3531. }
  3532. this._parent = this._config.parent ? this._getParent() : null;
  3533. if (!this._config.parent) {
  3534. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3535. }
  3536. if (this._config.toggle) {
  3537. this.toggle();
  3538. }
  3539. } // Getters
  3540. var _proto = Collapse.prototype;
  3541. // Public
  3542. _proto.toggle = function toggle() {
  3543. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  3544. this.hide();
  3545. } else {
  3546. this.show();
  3547. }
  3548. };
  3549. _proto.show = function show() {
  3550. var _this = this;
  3551. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  3552. return;
  3553. }
  3554. var actives;
  3555. var activesData;
  3556. if (this._parent) {
  3557. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  3558. if (typeof _this._config.parent === 'string') {
  3559. return elem.getAttribute('data-parent') === _this._config.parent;
  3560. }
  3561. return elem.classList.contains(ClassName$3.COLLAPSE);
  3562. });
  3563. if (actives.length === 0) {
  3564. actives = null;
  3565. }
  3566. }
  3567. if (actives) {
  3568. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  3569. if (activesData && activesData._isTransitioning) {
  3570. return;
  3571. }
  3572. }
  3573. var startEvent = $.Event(Event$3.SHOW);
  3574. $(this._element).trigger(startEvent);
  3575. if (startEvent.isDefaultPrevented()) {
  3576. return;
  3577. }
  3578. if (actives) {
  3579. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  3580. if (!activesData) {
  3581. $(actives).data(DATA_KEY$3, null);
  3582. }
  3583. }
  3584. var dimension = this._getDimension();
  3585. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  3586. this._element.style[dimension] = 0;
  3587. if (this._triggerArray.length) {
  3588. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  3589. }
  3590. this.setTransitioning(true);
  3591. var complete = function complete() {
  3592. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  3593. _this._element.style[dimension] = '';
  3594. _this.setTransitioning(false);
  3595. $(_this._element).trigger(Event$3.SHOWN);
  3596. };
  3597. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3598. var scrollSize = "scroll" + capitalizedDimension;
  3599. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3600. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3601. this._element.style[dimension] = this._element[scrollSize] + "px";
  3602. };
  3603. _proto.hide = function hide() {
  3604. var _this2 = this;
  3605. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  3606. return;
  3607. }
  3608. var startEvent = $.Event(Event$3.HIDE);
  3609. $(this._element).trigger(startEvent);
  3610. if (startEvent.isDefaultPrevented()) {
  3611. return;
  3612. }
  3613. var dimension = this._getDimension();
  3614. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3615. Util.reflow(this._element);
  3616. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  3617. var triggerArrayLength = this._triggerArray.length;
  3618. if (triggerArrayLength > 0) {
  3619. for (var i = 0; i < triggerArrayLength; i++) {
  3620. var trigger = this._triggerArray[i];
  3621. var selector = Util.getSelectorFromElement(trigger);
  3622. if (selector !== null) {
  3623. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3624. if (!$elem.hasClass(ClassName$3.SHOW)) {
  3625. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  3626. }
  3627. }
  3628. }
  3629. }
  3630. this.setTransitioning(true);
  3631. var complete = function complete() {
  3632. _this2.setTransitioning(false);
  3633. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  3634. };
  3635. this._element.style[dimension] = '';
  3636. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3637. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3638. };
  3639. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3640. this._isTransitioning = isTransitioning;
  3641. };
  3642. _proto.dispose = function dispose() {
  3643. $.removeData(this._element, DATA_KEY$3);
  3644. this._config = null;
  3645. this._parent = null;
  3646. this._element = null;
  3647. this._triggerArray = null;
  3648. this._isTransitioning = null;
  3649. } // Private
  3650. ;
  3651. _proto._getConfig = function _getConfig(config) {
  3652. config = _objectSpread2({}, Default$1, {}, config);
  3653. config.toggle = Boolean(config.toggle); // Coerce string values
  3654. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3655. return config;
  3656. };
  3657. _proto._getDimension = function _getDimension() {
  3658. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  3659. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  3660. };
  3661. _proto._getParent = function _getParent() {
  3662. var _this3 = this;
  3663. var parent;
  3664. if (Util.isElement(this._config.parent)) {
  3665. parent = this._config.parent; // It's a jQuery object
  3666. if (typeof this._config.parent.jquery !== 'undefined') {
  3667. parent = this._config.parent[0];
  3668. }
  3669. } else {
  3670. parent = document.querySelector(this._config.parent);
  3671. }
  3672. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3673. var children = [].slice.call(parent.querySelectorAll(selector));
  3674. $(children).each(function (i, element) {
  3675. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3676. });
  3677. return parent;
  3678. };
  3679. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3680. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  3681. if (triggerArray.length) {
  3682. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3683. }
  3684. } // Static
  3685. ;
  3686. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3687. var selector = Util.getSelectorFromElement(element);
  3688. return selector ? document.querySelector(selector) : null;
  3689. };
  3690. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3691. return this.each(function () {
  3692. var $this = $(this);
  3693. var data = $this.data(DATA_KEY$3);
  3694. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  3695. if (!data && _config.toggle && /show|hide/.test(config)) {
  3696. _config.toggle = false;
  3697. }
  3698. if (!data) {
  3699. data = new Collapse(this, _config);
  3700. $this.data(DATA_KEY$3, data);
  3701. }
  3702. if (typeof config === 'string') {
  3703. if (typeof data[config] === 'undefined') {
  3704. throw new TypeError("No method named \"" + config + "\"");
  3705. }
  3706. data[config]();
  3707. }
  3708. });
  3709. };
  3710. _createClass(Collapse, null, [{
  3711. key: "VERSION",
  3712. get: function get() {
  3713. return VERSION$3;
  3714. }
  3715. }, {
  3716. key: "Default",
  3717. get: function get() {
  3718. return Default$1;
  3719. }
  3720. }]);
  3721. return Collapse;
  3722. }();
  3723. /**
  3724. * ------------------------------------------------------------------------
  3725. * Data Api implementation
  3726. * ------------------------------------------------------------------------
  3727. */
  3728. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  3729. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3730. if (event.currentTarget.tagName === 'A') {
  3731. event.preventDefault();
  3732. }
  3733. var $trigger = $(this);
  3734. var selector = Util.getSelectorFromElement(this);
  3735. var selectors = [].slice.call(document.querySelectorAll(selector));
  3736. $(selectors).each(function () {
  3737. var $target = $(this);
  3738. var data = $target.data(DATA_KEY$3);
  3739. var config = data ? 'toggle' : $trigger.data();
  3740. Collapse._jQueryInterface.call($target, config);
  3741. });
  3742. });
  3743. /**
  3744. * ------------------------------------------------------------------------
  3745. * jQuery
  3746. * ------------------------------------------------------------------------
  3747. */
  3748. $.fn[NAME$3] = Collapse._jQueryInterface;
  3749. $.fn[NAME$3].Constructor = Collapse;
  3750. $.fn[NAME$3].noConflict = function () {
  3751. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3752. return Collapse._jQueryInterface;
  3753. };
  3754. /**
  3755. * ------------------------------------------------------------------------
  3756. * Constants
  3757. * ------------------------------------------------------------------------
  3758. */
  3759. var NAME$4 = 'dropdown';
  3760. var VERSION$4 = '4.4.1';
  3761. var DATA_KEY$4 = 'bs.dropdown';
  3762. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3763. var DATA_API_KEY$4 = '.data-api';
  3764. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3765. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3766. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3767. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3768. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3769. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3770. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3771. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3772. var Event$4 = {
  3773. HIDE: "hide" + EVENT_KEY$4,
  3774. HIDDEN: "hidden" + EVENT_KEY$4,
  3775. SHOW: "show" + EVENT_KEY$4,
  3776. SHOWN: "shown" + EVENT_KEY$4,
  3777. CLICK: "click" + EVENT_KEY$4,
  3778. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3779. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3780. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3781. };
  3782. var ClassName$4 = {
  3783. DISABLED: 'disabled',
  3784. SHOW: 'show',
  3785. DROPUP: 'dropup',
  3786. DROPRIGHT: 'dropright',
  3787. DROPLEFT: 'dropleft',
  3788. MENURIGHT: 'dropdown-menu-right',
  3789. MENULEFT: 'dropdown-menu-left',
  3790. POSITION_STATIC: 'position-static'
  3791. };
  3792. var Selector$4 = {
  3793. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3794. FORM_CHILD: '.dropdown form',
  3795. MENU: '.dropdown-menu',
  3796. NAVBAR_NAV: '.navbar-nav',
  3797. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3798. };
  3799. var AttachmentMap = {
  3800. TOP: 'top-start',
  3801. TOPEND: 'top-end',
  3802. BOTTOM: 'bottom-start',
  3803. BOTTOMEND: 'bottom-end',
  3804. RIGHT: 'right-start',
  3805. RIGHTEND: 'right-end',
  3806. LEFT: 'left-start',
  3807. LEFTEND: 'left-end'
  3808. };
  3809. var Default$2 = {
  3810. offset: 0,
  3811. flip: true,
  3812. boundary: 'scrollParent',
  3813. reference: 'toggle',
  3814. display: 'dynamic',
  3815. popperConfig: null
  3816. };
  3817. var DefaultType$2 = {
  3818. offset: '(number|string|function)',
  3819. flip: 'boolean',
  3820. boundary: '(string|element)',
  3821. reference: '(string|element)',
  3822. display: 'string',
  3823. popperConfig: '(null|object)'
  3824. };
  3825. /**
  3826. * ------------------------------------------------------------------------
  3827. * Class Definition
  3828. * ------------------------------------------------------------------------
  3829. */
  3830. var Dropdown =
  3831. /*#__PURE__*/
  3832. function () {
  3833. function Dropdown(element, config) {
  3834. this._element = element;
  3835. this._popper = null;
  3836. this._config = this._getConfig(config);
  3837. this._menu = this._getMenuElement();
  3838. this._inNavbar = this._detectNavbar();
  3839. this._addEventListeners();
  3840. } // Getters
  3841. var _proto = Dropdown.prototype;
  3842. // Public
  3843. _proto.toggle = function toggle() {
  3844. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3845. return;
  3846. }
  3847. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3848. Dropdown._clearMenus();
  3849. if (isActive) {
  3850. return;
  3851. }
  3852. this.show(true);
  3853. };
  3854. _proto.show = function show(usePopper) {
  3855. if (usePopper === void 0) {
  3856. usePopper = false;
  3857. }
  3858. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3859. return;
  3860. }
  3861. var relatedTarget = {
  3862. relatedTarget: this._element
  3863. };
  3864. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3865. var parent = Dropdown._getParentFromElement(this._element);
  3866. $(parent).trigger(showEvent);
  3867. if (showEvent.isDefaultPrevented()) {
  3868. return;
  3869. } // Disable totally Popper.js for Dropdown in Navbar
  3870. if (!this._inNavbar && usePopper) {
  3871. /**
  3872. * Check for Popper dependency
  3873. * Popper - https://popper.js.org
  3874. */
  3875. if (typeof Popper === 'undefined') {
  3876. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3877. }
  3878. var referenceElement = this._element;
  3879. if (this._config.reference === 'parent') {
  3880. referenceElement = parent;
  3881. } else if (Util.isElement(this._config.reference)) {
  3882. referenceElement = this._config.reference; // Check if it's jQuery element
  3883. if (typeof this._config.reference.jquery !== 'undefined') {
  3884. referenceElement = this._config.reference[0];
  3885. }
  3886. } // If boundary is not `scrollParent`, then set position to `static`
  3887. // to allow the menu to "escape" the scroll parent's boundaries
  3888. // https://github.com/twbs/bootstrap/issues/24251
  3889. if (this._config.boundary !== 'scrollParent') {
  3890. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3891. }
  3892. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3893. } // If this is a touch-enabled device we add extra
  3894. // empty mouseover listeners to the body's immediate children;
  3895. // only needed because of broken event delegation on iOS
  3896. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3897. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  3898. $(document.body).children().on('mouseover', null, $.noop);
  3899. }
  3900. this._element.focus();
  3901. this._element.setAttribute('aria-expanded', true);
  3902. $(this._menu).toggleClass(ClassName$4.SHOW);
  3903. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3904. };
  3905. _proto.hide = function hide() {
  3906. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  3907. return;
  3908. }
  3909. var relatedTarget = {
  3910. relatedTarget: this._element
  3911. };
  3912. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3913. var parent = Dropdown._getParentFromElement(this._element);
  3914. $(parent).trigger(hideEvent);
  3915. if (hideEvent.isDefaultPrevented()) {
  3916. return;
  3917. }
  3918. if (this._popper) {
  3919. this._popper.destroy();
  3920. }
  3921. $(this._menu).toggleClass(ClassName$4.SHOW);
  3922. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3923. };
  3924. _proto.dispose = function dispose() {
  3925. $.removeData(this._element, DATA_KEY$4);
  3926. $(this._element).off(EVENT_KEY$4);
  3927. this._element = null;
  3928. this._menu = null;
  3929. if (this._popper !== null) {
  3930. this._popper.destroy();
  3931. this._popper = null;
  3932. }
  3933. };
  3934. _proto.update = function update() {
  3935. this._inNavbar = this._detectNavbar();
  3936. if (this._popper !== null) {
  3937. this._popper.scheduleUpdate();
  3938. }
  3939. } // Private
  3940. ;
  3941. _proto._addEventListeners = function _addEventListeners() {
  3942. var _this = this;
  3943. $(this._element).on(Event$4.CLICK, function (event) {
  3944. event.preventDefault();
  3945. event.stopPropagation();
  3946. _this.toggle();
  3947. });
  3948. };
  3949. _proto._getConfig = function _getConfig(config) {
  3950. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  3951. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3952. return config;
  3953. };
  3954. _proto._getMenuElement = function _getMenuElement() {
  3955. if (!this._menu) {
  3956. var parent = Dropdown._getParentFromElement(this._element);
  3957. if (parent) {
  3958. this._menu = parent.querySelector(Selector$4.MENU);
  3959. }
  3960. }
  3961. return this._menu;
  3962. };
  3963. _proto._getPlacement = function _getPlacement() {
  3964. var $parentDropdown = $(this._element.parentNode);
  3965. var placement = AttachmentMap.BOTTOM; // Handle dropup
  3966. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  3967. placement = AttachmentMap.TOP;
  3968. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3969. placement = AttachmentMap.TOPEND;
  3970. }
  3971. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  3972. placement = AttachmentMap.RIGHT;
  3973. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  3974. placement = AttachmentMap.LEFT;
  3975. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3976. placement = AttachmentMap.BOTTOMEND;
  3977. }
  3978. return placement;
  3979. };
  3980. _proto._detectNavbar = function _detectNavbar() {
  3981. return $(this._element).closest('.navbar').length > 0;
  3982. };
  3983. _proto._getOffset = function _getOffset() {
  3984. var _this2 = this;
  3985. var offset = {};
  3986. if (typeof this._config.offset === 'function') {
  3987. offset.fn = function (data) {
  3988. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  3989. return data;
  3990. };
  3991. } else {
  3992. offset.offset = this._config.offset;
  3993. }
  3994. return offset;
  3995. };
  3996. _proto._getPopperConfig = function _getPopperConfig() {
  3997. var popperConfig = {
  3998. placement: this._getPlacement(),
  3999. modifiers: {
  4000. offset: this._getOffset(),
  4001. flip: {
  4002. enabled: this._config.flip
  4003. },
  4004. preventOverflow: {
  4005. boundariesElement: this._config.boundary
  4006. }
  4007. }
  4008. }; // Disable Popper.js if we have a static display
  4009. if (this._config.display === 'static') {
  4010. popperConfig.modifiers.applyStyle = {
  4011. enabled: false
  4012. };
  4013. }
  4014. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  4015. } // Static
  4016. ;
  4017. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  4018. return this.each(function () {
  4019. var data = $(this).data(DATA_KEY$4);
  4020. var _config = typeof config === 'object' ? config : null;
  4021. if (!data) {
  4022. data = new Dropdown(this, _config);
  4023. $(this).data(DATA_KEY$4, data);
  4024. }
  4025. if (typeof config === 'string') {
  4026. if (typeof data[config] === 'undefined') {
  4027. throw new TypeError("No method named \"" + config + "\"");
  4028. }
  4029. data[config]();
  4030. }
  4031. });
  4032. };
  4033. Dropdown._clearMenus = function _clearMenus(event) {
  4034. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  4035. return;
  4036. }
  4037. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  4038. for (var i = 0, len = toggles.length; i < len; i++) {
  4039. var parent = Dropdown._getParentFromElement(toggles[i]);
  4040. var context = $(toggles[i]).data(DATA_KEY$4);
  4041. var relatedTarget = {
  4042. relatedTarget: toggles[i]
  4043. };
  4044. if (event && event.type === 'click') {
  4045. relatedTarget.clickEvent = event;
  4046. }
  4047. if (!context) {
  4048. continue;
  4049. }
  4050. var dropdownMenu = context._menu;
  4051. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  4052. continue;
  4053. }
  4054. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  4055. continue;
  4056. }
  4057. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4058. $(parent).trigger(hideEvent);
  4059. if (hideEvent.isDefaultPrevented()) {
  4060. continue;
  4061. } // If this is a touch-enabled device we remove the extra
  4062. // empty mouseover listeners we added for iOS support
  4063. if ('ontouchstart' in document.documentElement) {
  4064. $(document.body).children().off('mouseover', null, $.noop);
  4065. }
  4066. toggles[i].setAttribute('aria-expanded', 'false');
  4067. if (context._popper) {
  4068. context._popper.destroy();
  4069. }
  4070. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  4071. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4072. }
  4073. };
  4074. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  4075. var parent;
  4076. var selector = Util.getSelectorFromElement(element);
  4077. if (selector) {
  4078. parent = document.querySelector(selector);
  4079. }
  4080. return parent || element.parentNode;
  4081. } // eslint-disable-next-line complexity
  4082. ;
  4083. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  4084. // If not input/textarea:
  4085. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  4086. // If input/textarea:
  4087. // - If space key => not a dropdown command
  4088. // - If key is other than escape
  4089. // - If key is not up or down => not a dropdown command
  4090. // - If trigger inside the menu => not a dropdown command
  4091. 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)) {
  4092. return;
  4093. }
  4094. event.preventDefault();
  4095. event.stopPropagation();
  4096. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  4097. return;
  4098. }
  4099. var parent = Dropdown._getParentFromElement(this);
  4100. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  4101. if (!isActive && event.which === ESCAPE_KEYCODE) {
  4102. return;
  4103. }
  4104. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  4105. if (event.which === ESCAPE_KEYCODE) {
  4106. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  4107. $(toggle).trigger('focus');
  4108. }
  4109. $(this).trigger('click');
  4110. return;
  4111. }
  4112. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  4113. return $(item).is(':visible');
  4114. });
  4115. if (items.length === 0) {
  4116. return;
  4117. }
  4118. var index = items.indexOf(event.target);
  4119. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  4120. // Up
  4121. index--;
  4122. }
  4123. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  4124. // Down
  4125. index++;
  4126. }
  4127. if (index < 0) {
  4128. index = 0;
  4129. }
  4130. items[index].focus();
  4131. };
  4132. _createClass(Dropdown, null, [{
  4133. key: "VERSION",
  4134. get: function get() {
  4135. return VERSION$4;
  4136. }
  4137. }, {
  4138. key: "Default",
  4139. get: function get() {
  4140. return Default$2;
  4141. }
  4142. }, {
  4143. key: "DefaultType",
  4144. get: function get() {
  4145. return DefaultType$2;
  4146. }
  4147. }]);
  4148. return Dropdown;
  4149. }();
  4150. /**
  4151. * ------------------------------------------------------------------------
  4152. * Data Api implementation
  4153. * ------------------------------------------------------------------------
  4154. */
  4155. $(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) {
  4156. event.preventDefault();
  4157. event.stopPropagation();
  4158. Dropdown._jQueryInterface.call($(this), 'toggle');
  4159. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  4160. e.stopPropagation();
  4161. });
  4162. /**
  4163. * ------------------------------------------------------------------------
  4164. * jQuery
  4165. * ------------------------------------------------------------------------
  4166. */
  4167. $.fn[NAME$4] = Dropdown._jQueryInterface;
  4168. $.fn[NAME$4].Constructor = Dropdown;
  4169. $.fn[NAME$4].noConflict = function () {
  4170. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  4171. return Dropdown._jQueryInterface;
  4172. };
  4173. /**
  4174. * ------------------------------------------------------------------------
  4175. * Constants
  4176. * ------------------------------------------------------------------------
  4177. */
  4178. var NAME$5 = 'modal';
  4179. var VERSION$5 = '4.4.1';
  4180. var DATA_KEY$5 = 'bs.modal';
  4181. var EVENT_KEY$5 = "." + DATA_KEY$5;
  4182. var DATA_API_KEY$5 = '.data-api';
  4183. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  4184. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  4185. var Default$3 = {
  4186. backdrop: true,
  4187. keyboard: true,
  4188. focus: true,
  4189. show: true
  4190. };
  4191. var DefaultType$3 = {
  4192. backdrop: '(boolean|string)',
  4193. keyboard: 'boolean',
  4194. focus: 'boolean',
  4195. show: 'boolean'
  4196. };
  4197. var Event$5 = {
  4198. HIDE: "hide" + EVENT_KEY$5,
  4199. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  4200. HIDDEN: "hidden" + EVENT_KEY$5,
  4201. SHOW: "show" + EVENT_KEY$5,
  4202. SHOWN: "shown" + EVENT_KEY$5,
  4203. FOCUSIN: "focusin" + EVENT_KEY$5,
  4204. RESIZE: "resize" + EVENT_KEY$5,
  4205. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  4206. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  4207. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  4208. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  4209. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  4210. };
  4211. var ClassName$5 = {
  4212. SCROLLABLE: 'modal-dialog-scrollable',
  4213. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  4214. BACKDROP: 'modal-backdrop',
  4215. OPEN: 'modal-open',
  4216. FADE: 'fade',
  4217. SHOW: 'show',
  4218. STATIC: 'modal-static'
  4219. };
  4220. var Selector$5 = {
  4221. DIALOG: '.modal-dialog',
  4222. MODAL_BODY: '.modal-body',
  4223. DATA_TOGGLE: '[data-toggle="modal"]',
  4224. DATA_DISMISS: '[data-dismiss="modal"]',
  4225. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  4226. STICKY_CONTENT: '.sticky-top'
  4227. };
  4228. /**
  4229. * ------------------------------------------------------------------------
  4230. * Class Definition
  4231. * ------------------------------------------------------------------------
  4232. */
  4233. var Modal =
  4234. /*#__PURE__*/
  4235. function () {
  4236. function Modal(element, config) {
  4237. this._config = this._getConfig(config);
  4238. this._element = element;
  4239. this._dialog = element.querySelector(Selector$5.DIALOG);
  4240. this._backdrop = null;
  4241. this._isShown = false;
  4242. this._isBodyOverflowing = false;
  4243. this._ignoreBackdropClick = false;
  4244. this._isTransitioning = false;
  4245. this._scrollbarWidth = 0;
  4246. } // Getters
  4247. var _proto = Modal.prototype;
  4248. // Public
  4249. _proto.toggle = function toggle(relatedTarget) {
  4250. return this._isShown ? this.hide() : this.show(relatedTarget);
  4251. };
  4252. _proto.show = function show(relatedTarget) {
  4253. var _this = this;
  4254. if (this._isShown || this._isTransitioning) {
  4255. return;
  4256. }
  4257. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4258. this._isTransitioning = true;
  4259. }
  4260. var showEvent = $.Event(Event$5.SHOW, {
  4261. relatedTarget: relatedTarget
  4262. });
  4263. $(this._element).trigger(showEvent);
  4264. if (this._isShown || showEvent.isDefaultPrevented()) {
  4265. return;
  4266. }
  4267. this._isShown = true;
  4268. this._checkScrollbar();
  4269. this._setScrollbar();
  4270. this._adjustDialog();
  4271. this._setEscapeEvent();
  4272. this._setResizeEvent();
  4273. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  4274. return _this.hide(event);
  4275. });
  4276. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  4277. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  4278. if ($(event.target).is(_this._element)) {
  4279. _this._ignoreBackdropClick = true;
  4280. }
  4281. });
  4282. });
  4283. this._showBackdrop(function () {
  4284. return _this._showElement(relatedTarget);
  4285. });
  4286. };
  4287. _proto.hide = function hide(event) {
  4288. var _this2 = this;
  4289. if (event) {
  4290. event.preventDefault();
  4291. }
  4292. if (!this._isShown || this._isTransitioning) {
  4293. return;
  4294. }
  4295. var hideEvent = $.Event(Event$5.HIDE);
  4296. $(this._element).trigger(hideEvent);
  4297. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  4298. return;
  4299. }
  4300. this._isShown = false;
  4301. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4302. if (transition) {
  4303. this._isTransitioning = true;
  4304. }
  4305. this._setEscapeEvent();
  4306. this._setResizeEvent();
  4307. $(document).off(Event$5.FOCUSIN);
  4308. $(this._element).removeClass(ClassName$5.SHOW);
  4309. $(this._element).off(Event$5.CLICK_DISMISS);
  4310. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  4311. if (transition) {
  4312. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4313. $(this._element).one(Util.TRANSITION_END, function (event) {
  4314. return _this2._hideModal(event);
  4315. }).emulateTransitionEnd(transitionDuration);
  4316. } else {
  4317. this._hideModal();
  4318. }
  4319. };
  4320. _proto.dispose = function dispose() {
  4321. [window, this._element, this._dialog].forEach(function (htmlElement) {
  4322. return $(htmlElement).off(EVENT_KEY$5);
  4323. });
  4324. /**
  4325. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  4326. * Do not move `document` in `htmlElements` array
  4327. * It will remove `Event.CLICK_DATA_API` event that should remain
  4328. */
  4329. $(document).off(Event$5.FOCUSIN);
  4330. $.removeData(this._element, DATA_KEY$5);
  4331. this._config = null;
  4332. this._element = null;
  4333. this._dialog = null;
  4334. this._backdrop = null;
  4335. this._isShown = null;
  4336. this._isBodyOverflowing = null;
  4337. this._ignoreBackdropClick = null;
  4338. this._isTransitioning = null;
  4339. this._scrollbarWidth = null;
  4340. };
  4341. _proto.handleUpdate = function handleUpdate() {
  4342. this._adjustDialog();
  4343. } // Private
  4344. ;
  4345. _proto._getConfig = function _getConfig(config) {
  4346. config = _objectSpread2({}, Default$3, {}, config);
  4347. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  4348. return config;
  4349. };
  4350. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  4351. var _this3 = this;
  4352. if (this._config.backdrop === 'static') {
  4353. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  4354. $(this._element).trigger(hideEventPrevented);
  4355. if (hideEventPrevented.defaultPrevented) {
  4356. return;
  4357. }
  4358. this._element.classList.add(ClassName$5.STATIC);
  4359. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  4360. $(this._element).one(Util.TRANSITION_END, function () {
  4361. _this3._element.classList.remove(ClassName$5.STATIC);
  4362. }).emulateTransitionEnd(modalTransitionDuration);
  4363. this._element.focus();
  4364. } else {
  4365. this.hide();
  4366. }
  4367. };
  4368. _proto._showElement = function _showElement(relatedTarget) {
  4369. var _this4 = this;
  4370. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4371. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  4372. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  4373. // Don't move modal's DOM position
  4374. document.body.appendChild(this._element);
  4375. }
  4376. this._element.style.display = 'block';
  4377. this._element.removeAttribute('aria-hidden');
  4378. this._element.setAttribute('aria-modal', true);
  4379. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  4380. modalBody.scrollTop = 0;
  4381. } else {
  4382. this._element.scrollTop = 0;
  4383. }
  4384. if (transition) {
  4385. Util.reflow(this._element);
  4386. }
  4387. $(this._element).addClass(ClassName$5.SHOW);
  4388. if (this._config.focus) {
  4389. this._enforceFocus();
  4390. }
  4391. var shownEvent = $.Event(Event$5.SHOWN, {
  4392. relatedTarget: relatedTarget
  4393. });
  4394. var transitionComplete = function transitionComplete() {
  4395. if (_this4._config.focus) {
  4396. _this4._element.focus();
  4397. }
  4398. _this4._isTransitioning = false;
  4399. $(_this4._element).trigger(shownEvent);
  4400. };
  4401. if (transition) {
  4402. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  4403. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  4404. } else {
  4405. transitionComplete();
  4406. }
  4407. };
  4408. _proto._enforceFocus = function _enforceFocus() {
  4409. var _this5 = this;
  4410. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  4411. .on(Event$5.FOCUSIN, function (event) {
  4412. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  4413. _this5._element.focus();
  4414. }
  4415. });
  4416. };
  4417. _proto._setEscapeEvent = function _setEscapeEvent() {
  4418. var _this6 = this;
  4419. if (this._isShown && this._config.keyboard) {
  4420. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  4421. if (event.which === ESCAPE_KEYCODE$1) {
  4422. _this6._triggerBackdropTransition();
  4423. }
  4424. });
  4425. } else if (!this._isShown) {
  4426. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  4427. }
  4428. };
  4429. _proto._setResizeEvent = function _setResizeEvent() {
  4430. var _this7 = this;
  4431. if (this._isShown) {
  4432. $(window).on(Event$5.RESIZE, function (event) {
  4433. return _this7.handleUpdate(event);
  4434. });
  4435. } else {
  4436. $(window).off(Event$5.RESIZE);
  4437. }
  4438. };
  4439. _proto._hideModal = function _hideModal() {
  4440. var _this8 = this;
  4441. this._element.style.display = 'none';
  4442. this._element.setAttribute('aria-hidden', true);
  4443. this._element.removeAttribute('aria-modal');
  4444. this._isTransitioning = false;
  4445. this._showBackdrop(function () {
  4446. $(document.body).removeClass(ClassName$5.OPEN);
  4447. _this8._resetAdjustments();
  4448. _this8._resetScrollbar();
  4449. $(_this8._element).trigger(Event$5.HIDDEN);
  4450. });
  4451. };
  4452. _proto._removeBackdrop = function _removeBackdrop() {
  4453. if (this._backdrop) {
  4454. $(this._backdrop).remove();
  4455. this._backdrop = null;
  4456. }
  4457. };
  4458. _proto._showBackdrop = function _showBackdrop(callback) {
  4459. var _this9 = this;
  4460. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4461. if (this._isShown && this._config.backdrop) {
  4462. this._backdrop = document.createElement('div');
  4463. this._backdrop.className = ClassName$5.BACKDROP;
  4464. if (animate) {
  4465. this._backdrop.classList.add(animate);
  4466. }
  4467. $(this._backdrop).appendTo(document.body);
  4468. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4469. if (_this9._ignoreBackdropClick) {
  4470. _this9._ignoreBackdropClick = false;
  4471. return;
  4472. }
  4473. if (event.target !== event.currentTarget) {
  4474. return;
  4475. }
  4476. _this9._triggerBackdropTransition();
  4477. });
  4478. if (animate) {
  4479. Util.reflow(this._backdrop);
  4480. }
  4481. $(this._backdrop).addClass(ClassName$5.SHOW);
  4482. if (!callback) {
  4483. return;
  4484. }
  4485. if (!animate) {
  4486. callback();
  4487. return;
  4488. }
  4489. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4490. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4491. } else if (!this._isShown && this._backdrop) {
  4492. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4493. var callbackRemove = function callbackRemove() {
  4494. _this9._removeBackdrop();
  4495. if (callback) {
  4496. callback();
  4497. }
  4498. };
  4499. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4500. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4501. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4502. } else {
  4503. callbackRemove();
  4504. }
  4505. } else if (callback) {
  4506. callback();
  4507. }
  4508. } // ----------------------------------------------------------------------
  4509. // the following methods are used to handle overflowing modals
  4510. // todo (fat): these should probably be refactored out of modal.js
  4511. // ----------------------------------------------------------------------
  4512. ;
  4513. _proto._adjustDialog = function _adjustDialog() {
  4514. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4515. if (!this._isBodyOverflowing && isModalOverflowing) {
  4516. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4517. }
  4518. if (this._isBodyOverflowing && !isModalOverflowing) {
  4519. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4520. }
  4521. };
  4522. _proto._resetAdjustments = function _resetAdjustments() {
  4523. this._element.style.paddingLeft = '';
  4524. this._element.style.paddingRight = '';
  4525. };
  4526. _proto._checkScrollbar = function _checkScrollbar() {
  4527. var rect = document.body.getBoundingClientRect();
  4528. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4529. this._scrollbarWidth = this._getScrollbarWidth();
  4530. };
  4531. _proto._setScrollbar = function _setScrollbar() {
  4532. var _this10 = this;
  4533. if (this._isBodyOverflowing) {
  4534. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4535. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4536. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4537. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4538. $(fixedContent).each(function (index, element) {
  4539. var actualPadding = element.style.paddingRight;
  4540. var calculatedPadding = $(element).css('padding-right');
  4541. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4542. }); // Adjust sticky content margin
  4543. $(stickyContent).each(function (index, element) {
  4544. var actualMargin = element.style.marginRight;
  4545. var calculatedMargin = $(element).css('margin-right');
  4546. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4547. }); // Adjust body padding
  4548. var actualPadding = document.body.style.paddingRight;
  4549. var calculatedPadding = $(document.body).css('padding-right');
  4550. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4551. }
  4552. $(document.body).addClass(ClassName$5.OPEN);
  4553. };
  4554. _proto._resetScrollbar = function _resetScrollbar() {
  4555. // Restore fixed content padding
  4556. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4557. $(fixedContent).each(function (index, element) {
  4558. var padding = $(element).data('padding-right');
  4559. $(element).removeData('padding-right');
  4560. element.style.paddingRight = padding ? padding : '';
  4561. }); // Restore sticky content
  4562. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4563. $(elements).each(function (index, element) {
  4564. var margin = $(element).data('margin-right');
  4565. if (typeof margin !== 'undefined') {
  4566. $(element).css('margin-right', margin).removeData('margin-right');
  4567. }
  4568. }); // Restore body padding
  4569. var padding = $(document.body).data('padding-right');
  4570. $(document.body).removeData('padding-right');
  4571. document.body.style.paddingRight = padding ? padding : '';
  4572. };
  4573. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4574. // thx d.walsh
  4575. var scrollDiv = document.createElement('div');
  4576. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4577. document.body.appendChild(scrollDiv);
  4578. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4579. document.body.removeChild(scrollDiv);
  4580. return scrollbarWidth;
  4581. } // Static
  4582. ;
  4583. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4584. return this.each(function () {
  4585. var data = $(this).data(DATA_KEY$5);
  4586. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  4587. if (!data) {
  4588. data = new Modal(this, _config);
  4589. $(this).data(DATA_KEY$5, data);
  4590. }
  4591. if (typeof config === 'string') {
  4592. if (typeof data[config] === 'undefined') {
  4593. throw new TypeError("No method named \"" + config + "\"");
  4594. }
  4595. data[config](relatedTarget);
  4596. } else if (_config.show) {
  4597. data.show(relatedTarget);
  4598. }
  4599. });
  4600. };
  4601. _createClass(Modal, null, [{
  4602. key: "VERSION",
  4603. get: function get() {
  4604. return VERSION$5;
  4605. }
  4606. }, {
  4607. key: "Default",
  4608. get: function get() {
  4609. return Default$3;
  4610. }
  4611. }]);
  4612. return Modal;
  4613. }();
  4614. /**
  4615. * ------------------------------------------------------------------------
  4616. * Data Api implementation
  4617. * ------------------------------------------------------------------------
  4618. */
  4619. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4620. var _this11 = this;
  4621. var target;
  4622. var selector = Util.getSelectorFromElement(this);
  4623. if (selector) {
  4624. target = document.querySelector(selector);
  4625. }
  4626. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  4627. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4628. event.preventDefault();
  4629. }
  4630. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4631. if (showEvent.isDefaultPrevented()) {
  4632. // Only register focus restorer if modal will actually get shown
  4633. return;
  4634. }
  4635. $target.one(Event$5.HIDDEN, function () {
  4636. if ($(_this11).is(':visible')) {
  4637. _this11.focus();
  4638. }
  4639. });
  4640. });
  4641. Modal._jQueryInterface.call($(target), config, this);
  4642. });
  4643. /**
  4644. * ------------------------------------------------------------------------
  4645. * jQuery
  4646. * ------------------------------------------------------------------------
  4647. */
  4648. $.fn[NAME$5] = Modal._jQueryInterface;
  4649. $.fn[NAME$5].Constructor = Modal;
  4650. $.fn[NAME$5].noConflict = function () {
  4651. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4652. return Modal._jQueryInterface;
  4653. };
  4654. /**
  4655. * --------------------------------------------------------------------------
  4656. * Bootstrap (v4.4.1): tools/sanitizer.js
  4657. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4658. * --------------------------------------------------------------------------
  4659. */
  4660. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4661. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4662. var DefaultWhitelist = {
  4663. // Global attributes allowed on any supplied element below.
  4664. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4665. a: ['target', 'href', 'title', 'rel'],
  4666. area: [],
  4667. b: [],
  4668. br: [],
  4669. col: [],
  4670. code: [],
  4671. div: [],
  4672. em: [],
  4673. hr: [],
  4674. h1: [],
  4675. h2: [],
  4676. h3: [],
  4677. h4: [],
  4678. h5: [],
  4679. h6: [],
  4680. i: [],
  4681. img: ['src', 'alt', 'title', 'width', 'height'],
  4682. li: [],
  4683. ol: [],
  4684. p: [],
  4685. pre: [],
  4686. s: [],
  4687. small: [],
  4688. span: [],
  4689. sub: [],
  4690. sup: [],
  4691. strong: [],
  4692. u: [],
  4693. ul: []
  4694. };
  4695. /**
  4696. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4697. *
  4698. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4699. */
  4700. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4701. /**
  4702. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4703. *
  4704. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4705. */
  4706. 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;
  4707. function allowedAttribute(attr, allowedAttributeList) {
  4708. var attrName = attr.nodeName.toLowerCase();
  4709. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4710. if (uriAttrs.indexOf(attrName) !== -1) {
  4711. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4712. }
  4713. return true;
  4714. }
  4715. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4716. return attrRegex instanceof RegExp;
  4717. }); // Check if a regular expression validates the attribute.
  4718. for (var i = 0, l = regExp.length; i < l; i++) {
  4719. if (attrName.match(regExp[i])) {
  4720. return true;
  4721. }
  4722. }
  4723. return false;
  4724. }
  4725. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4726. if (unsafeHtml.length === 0) {
  4727. return unsafeHtml;
  4728. }
  4729. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4730. return sanitizeFn(unsafeHtml);
  4731. }
  4732. var domParser = new window.DOMParser();
  4733. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4734. var whitelistKeys = Object.keys(whiteList);
  4735. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4736. var _loop = function _loop(i, len) {
  4737. var el = elements[i];
  4738. var elName = el.nodeName.toLowerCase();
  4739. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4740. el.parentNode.removeChild(el);
  4741. return "continue";
  4742. }
  4743. var attributeList = [].slice.call(el.attributes);
  4744. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4745. attributeList.forEach(function (attr) {
  4746. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4747. el.removeAttribute(attr.nodeName);
  4748. }
  4749. });
  4750. };
  4751. for (var i = 0, len = elements.length; i < len; i++) {
  4752. var _ret = _loop(i);
  4753. if (_ret === "continue") continue;
  4754. }
  4755. return createdDocument.body.innerHTML;
  4756. }
  4757. /**
  4758. * ------------------------------------------------------------------------
  4759. * Constants
  4760. * ------------------------------------------------------------------------
  4761. */
  4762. var NAME$6 = 'tooltip';
  4763. var VERSION$6 = '4.4.1';
  4764. var DATA_KEY$6 = 'bs.tooltip';
  4765. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4766. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4767. var CLASS_PREFIX = 'bs-tooltip';
  4768. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4769. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4770. var DefaultType$4 = {
  4771. animation: 'boolean',
  4772. template: 'string',
  4773. title: '(string|element|function)',
  4774. trigger: 'string',
  4775. delay: '(number|object)',
  4776. html: 'boolean',
  4777. selector: '(string|boolean)',
  4778. placement: '(string|function)',
  4779. offset: '(number|string|function)',
  4780. container: '(string|element|boolean)',
  4781. fallbackPlacement: '(string|array)',
  4782. boundary: '(string|element)',
  4783. sanitize: 'boolean',
  4784. sanitizeFn: '(null|function)',
  4785. whiteList: 'object',
  4786. popperConfig: '(null|object)'
  4787. };
  4788. var AttachmentMap$1 = {
  4789. AUTO: 'auto',
  4790. TOP: 'top',
  4791. RIGHT: 'right',
  4792. BOTTOM: 'bottom',
  4793. LEFT: 'left'
  4794. };
  4795. var Default$4 = {
  4796. animation: true,
  4797. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4798. trigger: 'hover focus',
  4799. title: '',
  4800. delay: 0,
  4801. html: false,
  4802. selector: false,
  4803. placement: 'top',
  4804. offset: 0,
  4805. container: false,
  4806. fallbackPlacement: 'flip',
  4807. boundary: 'scrollParent',
  4808. sanitize: true,
  4809. sanitizeFn: null,
  4810. whiteList: DefaultWhitelist,
  4811. popperConfig: null
  4812. };
  4813. var HoverState = {
  4814. SHOW: 'show',
  4815. OUT: 'out'
  4816. };
  4817. var Event$6 = {
  4818. HIDE: "hide" + EVENT_KEY$6,
  4819. HIDDEN: "hidden" + EVENT_KEY$6,
  4820. SHOW: "show" + EVENT_KEY$6,
  4821. SHOWN: "shown" + EVENT_KEY$6,
  4822. INSERTED: "inserted" + EVENT_KEY$6,
  4823. CLICK: "click" + EVENT_KEY$6,
  4824. FOCUSIN: "focusin" + EVENT_KEY$6,
  4825. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4826. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4827. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4828. };
  4829. var ClassName$6 = {
  4830. FADE: 'fade',
  4831. SHOW: 'show'
  4832. };
  4833. var Selector$6 = {
  4834. TOOLTIP: '.tooltip',
  4835. TOOLTIP_INNER: '.tooltip-inner',
  4836. ARROW: '.arrow'
  4837. };
  4838. var Trigger = {
  4839. HOVER: 'hover',
  4840. FOCUS: 'focus',
  4841. CLICK: 'click',
  4842. MANUAL: 'manual'
  4843. };
  4844. /**
  4845. * ------------------------------------------------------------------------
  4846. * Class Definition
  4847. * ------------------------------------------------------------------------
  4848. */
  4849. var Tooltip =
  4850. /*#__PURE__*/
  4851. function () {
  4852. function Tooltip(element, config) {
  4853. if (typeof Popper === 'undefined') {
  4854. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4855. } // private
  4856. this._isEnabled = true;
  4857. this._timeout = 0;
  4858. this._hoverState = '';
  4859. this._activeTrigger = {};
  4860. this._popper = null; // Protected
  4861. this.element = element;
  4862. this.config = this._getConfig(config);
  4863. this.tip = null;
  4864. this._setListeners();
  4865. } // Getters
  4866. var _proto = Tooltip.prototype;
  4867. // Public
  4868. _proto.enable = function enable() {
  4869. this._isEnabled = true;
  4870. };
  4871. _proto.disable = function disable() {
  4872. this._isEnabled = false;
  4873. };
  4874. _proto.toggleEnabled = function toggleEnabled() {
  4875. this._isEnabled = !this._isEnabled;
  4876. };
  4877. _proto.toggle = function toggle(event) {
  4878. if (!this._isEnabled) {
  4879. return;
  4880. }
  4881. if (event) {
  4882. var dataKey = this.constructor.DATA_KEY;
  4883. var context = $(event.currentTarget).data(dataKey);
  4884. if (!context) {
  4885. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4886. $(event.currentTarget).data(dataKey, context);
  4887. }
  4888. context._activeTrigger.click = !context._activeTrigger.click;
  4889. if (context._isWithActiveTrigger()) {
  4890. context._enter(null, context);
  4891. } else {
  4892. context._leave(null, context);
  4893. }
  4894. } else {
  4895. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  4896. this._leave(null, this);
  4897. return;
  4898. }
  4899. this._enter(null, this);
  4900. }
  4901. };
  4902. _proto.dispose = function dispose() {
  4903. clearTimeout(this._timeout);
  4904. $.removeData(this.element, this.constructor.DATA_KEY);
  4905. $(this.element).off(this.constructor.EVENT_KEY);
  4906. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  4907. if (this.tip) {
  4908. $(this.tip).remove();
  4909. }
  4910. this._isEnabled = null;
  4911. this._timeout = null;
  4912. this._hoverState = null;
  4913. this._activeTrigger = null;
  4914. if (this._popper) {
  4915. this._popper.destroy();
  4916. }
  4917. this._popper = null;
  4918. this.element = null;
  4919. this.config = null;
  4920. this.tip = null;
  4921. };
  4922. _proto.show = function show() {
  4923. var _this = this;
  4924. if ($(this.element).css('display') === 'none') {
  4925. throw new Error('Please use show on visible elements');
  4926. }
  4927. var showEvent = $.Event(this.constructor.Event.SHOW);
  4928. if (this.isWithContent() && this._isEnabled) {
  4929. $(this.element).trigger(showEvent);
  4930. var shadowRoot = Util.findShadowRoot(this.element);
  4931. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  4932. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  4933. return;
  4934. }
  4935. var tip = this.getTipElement();
  4936. var tipId = Util.getUID(this.constructor.NAME);
  4937. tip.setAttribute('id', tipId);
  4938. this.element.setAttribute('aria-describedby', tipId);
  4939. this.setContent();
  4940. if (this.config.animation) {
  4941. $(tip).addClass(ClassName$6.FADE);
  4942. }
  4943. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  4944. var attachment = this._getAttachment(placement);
  4945. this.addAttachmentClass(attachment);
  4946. var container = this._getContainer();
  4947. $(tip).data(this.constructor.DATA_KEY, this);
  4948. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  4949. $(tip).appendTo(container);
  4950. }
  4951. $(this.element).trigger(this.constructor.Event.INSERTED);
  4952. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  4953. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  4954. // empty mouseover listeners to the body's immediate children;
  4955. // only needed because of broken event delegation on iOS
  4956. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4957. if ('ontouchstart' in document.documentElement) {
  4958. $(document.body).children().on('mouseover', null, $.noop);
  4959. }
  4960. var complete = function complete() {
  4961. if (_this.config.animation) {
  4962. _this._fixTransition();
  4963. }
  4964. var prevHoverState = _this._hoverState;
  4965. _this._hoverState = null;
  4966. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  4967. if (prevHoverState === HoverState.OUT) {
  4968. _this._leave(null, _this);
  4969. }
  4970. };
  4971. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4972. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  4973. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4974. } else {
  4975. complete();
  4976. }
  4977. }
  4978. };
  4979. _proto.hide = function hide(callback) {
  4980. var _this2 = this;
  4981. var tip = this.getTipElement();
  4982. var hideEvent = $.Event(this.constructor.Event.HIDE);
  4983. var complete = function complete() {
  4984. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  4985. tip.parentNode.removeChild(tip);
  4986. }
  4987. _this2._cleanTipClass();
  4988. _this2.element.removeAttribute('aria-describedby');
  4989. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  4990. if (_this2._popper !== null) {
  4991. _this2._popper.destroy();
  4992. }
  4993. if (callback) {
  4994. callback();
  4995. }
  4996. };
  4997. $(this.element).trigger(hideEvent);
  4998. if (hideEvent.isDefaultPrevented()) {
  4999. return;
  5000. }
  5001. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  5002. // empty mouseover listeners we added for iOS support
  5003. if ('ontouchstart' in document.documentElement) {
  5004. $(document.body).children().off('mouseover', null, $.noop);
  5005. }
  5006. this._activeTrigger[Trigger.CLICK] = false;
  5007. this._activeTrigger[Trigger.FOCUS] = false;
  5008. this._activeTrigger[Trigger.HOVER] = false;
  5009. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5010. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  5011. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5012. } else {
  5013. complete();
  5014. }
  5015. this._hoverState = '';
  5016. };
  5017. _proto.update = function update() {
  5018. if (this._popper !== null) {
  5019. this._popper.scheduleUpdate();
  5020. }
  5021. } // Protected
  5022. ;
  5023. _proto.isWithContent = function isWithContent() {
  5024. return Boolean(this.getTitle());
  5025. };
  5026. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5027. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  5028. };
  5029. _proto.getTipElement = function getTipElement() {
  5030. this.tip = this.tip || $(this.config.template)[0];
  5031. return this.tip;
  5032. };
  5033. _proto.setContent = function setContent() {
  5034. var tip = this.getTipElement();
  5035. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  5036. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  5037. };
  5038. _proto.setElementContent = function setElementContent($element, content) {
  5039. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  5040. // Content is a DOM node or a jQuery
  5041. if (this.config.html) {
  5042. if (!$(content).parent().is($element)) {
  5043. $element.empty().append(content);
  5044. }
  5045. } else {
  5046. $element.text($(content).text());
  5047. }
  5048. return;
  5049. }
  5050. if (this.config.html) {
  5051. if (this.config.sanitize) {
  5052. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  5053. }
  5054. $element.html(content);
  5055. } else {
  5056. $element.text(content);
  5057. }
  5058. };
  5059. _proto.getTitle = function getTitle() {
  5060. var title = this.element.getAttribute('data-original-title');
  5061. if (!title) {
  5062. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  5063. }
  5064. return title;
  5065. } // Private
  5066. ;
  5067. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  5068. var _this3 = this;
  5069. var defaultBsConfig = {
  5070. placement: attachment,
  5071. modifiers: {
  5072. offset: this._getOffset(),
  5073. flip: {
  5074. behavior: this.config.fallbackPlacement
  5075. },
  5076. arrow: {
  5077. element: Selector$6.ARROW
  5078. },
  5079. preventOverflow: {
  5080. boundariesElement: this.config.boundary
  5081. }
  5082. },
  5083. onCreate: function onCreate(data) {
  5084. if (data.originalPlacement !== data.placement) {
  5085. _this3._handlePopperPlacementChange(data);
  5086. }
  5087. },
  5088. onUpdate: function onUpdate(data) {
  5089. return _this3._handlePopperPlacementChange(data);
  5090. }
  5091. };
  5092. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  5093. };
  5094. _proto._getOffset = function _getOffset() {
  5095. var _this4 = this;
  5096. var offset = {};
  5097. if (typeof this.config.offset === 'function') {
  5098. offset.fn = function (data) {
  5099. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  5100. return data;
  5101. };
  5102. } else {
  5103. offset.offset = this.config.offset;
  5104. }
  5105. return offset;
  5106. };
  5107. _proto._getContainer = function _getContainer() {
  5108. if (this.config.container === false) {
  5109. return document.body;
  5110. }
  5111. if (Util.isElement(this.config.container)) {
  5112. return $(this.config.container);
  5113. }
  5114. return $(document).find(this.config.container);
  5115. };
  5116. _proto._getAttachment = function _getAttachment(placement) {
  5117. return AttachmentMap$1[placement.toUpperCase()];
  5118. };
  5119. _proto._setListeners = function _setListeners() {
  5120. var _this5 = this;
  5121. var triggers = this.config.trigger.split(' ');
  5122. triggers.forEach(function (trigger) {
  5123. if (trigger === 'click') {
  5124. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  5125. return _this5.toggle(event);
  5126. });
  5127. } else if (trigger !== Trigger.MANUAL) {
  5128. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  5129. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  5130. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  5131. return _this5._enter(event);
  5132. }).on(eventOut, _this5.config.selector, function (event) {
  5133. return _this5._leave(event);
  5134. });
  5135. }
  5136. });
  5137. this._hideModalHandler = function () {
  5138. if (_this5.element) {
  5139. _this5.hide();
  5140. }
  5141. };
  5142. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  5143. if (this.config.selector) {
  5144. this.config = _objectSpread2({}, this.config, {
  5145. trigger: 'manual',
  5146. selector: ''
  5147. });
  5148. } else {
  5149. this._fixTitle();
  5150. }
  5151. };
  5152. _proto._fixTitle = function _fixTitle() {
  5153. var titleType = typeof this.element.getAttribute('data-original-title');
  5154. if (this.element.getAttribute('title') || titleType !== 'string') {
  5155. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  5156. this.element.setAttribute('title', '');
  5157. }
  5158. };
  5159. _proto._enter = function _enter(event, context) {
  5160. var dataKey = this.constructor.DATA_KEY;
  5161. context = context || $(event.currentTarget).data(dataKey);
  5162. if (!context) {
  5163. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5164. $(event.currentTarget).data(dataKey, context);
  5165. }
  5166. if (event) {
  5167. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  5168. }
  5169. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  5170. context._hoverState = HoverState.SHOW;
  5171. return;
  5172. }
  5173. clearTimeout(context._timeout);
  5174. context._hoverState = HoverState.SHOW;
  5175. if (!context.config.delay || !context.config.delay.show) {
  5176. context.show();
  5177. return;
  5178. }
  5179. context._timeout = setTimeout(function () {
  5180. if (context._hoverState === HoverState.SHOW) {
  5181. context.show();
  5182. }
  5183. }, context.config.delay.show);
  5184. };
  5185. _proto._leave = function _leave(event, context) {
  5186. var dataKey = this.constructor.DATA_KEY;
  5187. context = context || $(event.currentTarget).data(dataKey);
  5188. if (!context) {
  5189. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5190. $(event.currentTarget).data(dataKey, context);
  5191. }
  5192. if (event) {
  5193. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  5194. }
  5195. if (context._isWithActiveTrigger()) {
  5196. return;
  5197. }
  5198. clearTimeout(context._timeout);
  5199. context._hoverState = HoverState.OUT;
  5200. if (!context.config.delay || !context.config.delay.hide) {
  5201. context.hide();
  5202. return;
  5203. }
  5204. context._timeout = setTimeout(function () {
  5205. if (context._hoverState === HoverState.OUT) {
  5206. context.hide();
  5207. }
  5208. }, context.config.delay.hide);
  5209. };
  5210. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  5211. for (var trigger in this._activeTrigger) {
  5212. if (this._activeTrigger[trigger]) {
  5213. return true;
  5214. }
  5215. }
  5216. return false;
  5217. };
  5218. _proto._getConfig = function _getConfig(config) {
  5219. var dataAttributes = $(this.element).data();
  5220. Object.keys(dataAttributes).forEach(function (dataAttr) {
  5221. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  5222. delete dataAttributes[dataAttr];
  5223. }
  5224. });
  5225. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  5226. if (typeof config.delay === 'number') {
  5227. config.delay = {
  5228. show: config.delay,
  5229. hide: config.delay
  5230. };
  5231. }
  5232. if (typeof config.title === 'number') {
  5233. config.title = config.title.toString();
  5234. }
  5235. if (typeof config.content === 'number') {
  5236. config.content = config.content.toString();
  5237. }
  5238. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  5239. if (config.sanitize) {
  5240. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  5241. }
  5242. return config;
  5243. };
  5244. _proto._getDelegateConfig = function _getDelegateConfig() {
  5245. var config = {};
  5246. if (this.config) {
  5247. for (var key in this.config) {
  5248. if (this.constructor.Default[key] !== this.config[key]) {
  5249. config[key] = this.config[key];
  5250. }
  5251. }
  5252. }
  5253. return config;
  5254. };
  5255. _proto._cleanTipClass = function _cleanTipClass() {
  5256. var $tip = $(this.getTipElement());
  5257. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  5258. if (tabClass !== null && tabClass.length) {
  5259. $tip.removeClass(tabClass.join(''));
  5260. }
  5261. };
  5262. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  5263. var popperInstance = popperData.instance;
  5264. this.tip = popperInstance.popper;
  5265. this._cleanTipClass();
  5266. this.addAttachmentClass(this._getAttachment(popperData.placement));
  5267. };
  5268. _proto._fixTransition = function _fixTransition() {
  5269. var tip = this.getTipElement();
  5270. var initConfigAnimation = this.config.animation;
  5271. if (tip.getAttribute('x-placement') !== null) {
  5272. return;
  5273. }
  5274. $(tip).removeClass(ClassName$6.FADE);
  5275. this.config.animation = false;
  5276. this.hide();
  5277. this.show();
  5278. this.config.animation = initConfigAnimation;
  5279. } // Static
  5280. ;
  5281. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  5282. return this.each(function () {
  5283. var data = $(this).data(DATA_KEY$6);
  5284. var _config = typeof config === 'object' && config;
  5285. if (!data && /dispose|hide/.test(config)) {
  5286. return;
  5287. }
  5288. if (!data) {
  5289. data = new Tooltip(this, _config);
  5290. $(this).data(DATA_KEY$6, data);
  5291. }
  5292. if (typeof config === 'string') {
  5293. if (typeof data[config] === 'undefined') {
  5294. throw new TypeError("No method named \"" + config + "\"");
  5295. }
  5296. data[config]();
  5297. }
  5298. });
  5299. };
  5300. _createClass(Tooltip, null, [{
  5301. key: "VERSION",
  5302. get: function get() {
  5303. return VERSION$6;
  5304. }
  5305. }, {
  5306. key: "Default",
  5307. get: function get() {
  5308. return Default$4;
  5309. }
  5310. }, {
  5311. key: "NAME",
  5312. get: function get() {
  5313. return NAME$6;
  5314. }
  5315. }, {
  5316. key: "DATA_KEY",
  5317. get: function get() {
  5318. return DATA_KEY$6;
  5319. }
  5320. }, {
  5321. key: "Event",
  5322. get: function get() {
  5323. return Event$6;
  5324. }
  5325. }, {
  5326. key: "EVENT_KEY",
  5327. get: function get() {
  5328. return EVENT_KEY$6;
  5329. }
  5330. }, {
  5331. key: "DefaultType",
  5332. get: function get() {
  5333. return DefaultType$4;
  5334. }
  5335. }]);
  5336. return Tooltip;
  5337. }();
  5338. /**
  5339. * ------------------------------------------------------------------------
  5340. * jQuery
  5341. * ------------------------------------------------------------------------
  5342. */
  5343. $.fn[NAME$6] = Tooltip._jQueryInterface;
  5344. $.fn[NAME$6].Constructor = Tooltip;
  5345. $.fn[NAME$6].noConflict = function () {
  5346. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  5347. return Tooltip._jQueryInterface;
  5348. };
  5349. /**
  5350. * ------------------------------------------------------------------------
  5351. * Constants
  5352. * ------------------------------------------------------------------------
  5353. */
  5354. var NAME$7 = 'popover';
  5355. var VERSION$7 = '4.4.1';
  5356. var DATA_KEY$7 = 'bs.popover';
  5357. var EVENT_KEY$7 = "." + DATA_KEY$7;
  5358. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  5359. var CLASS_PREFIX$1 = 'bs-popover';
  5360. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  5361. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  5362. placement: 'right',
  5363. trigger: 'click',
  5364. content: '',
  5365. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  5366. });
  5367. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  5368. content: '(string|element|function)'
  5369. });
  5370. var ClassName$7 = {
  5371. FADE: 'fade',
  5372. SHOW: 'show'
  5373. };
  5374. var Selector$7 = {
  5375. TITLE: '.popover-header',
  5376. CONTENT: '.popover-body'
  5377. };
  5378. var Event$7 = {
  5379. HIDE: "hide" + EVENT_KEY$7,
  5380. HIDDEN: "hidden" + EVENT_KEY$7,
  5381. SHOW: "show" + EVENT_KEY$7,
  5382. SHOWN: "shown" + EVENT_KEY$7,
  5383. INSERTED: "inserted" + EVENT_KEY$7,
  5384. CLICK: "click" + EVENT_KEY$7,
  5385. FOCUSIN: "focusin" + EVENT_KEY$7,
  5386. FOCUSOUT: "focusout" + EVENT_KEY$7,
  5387. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  5388. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  5389. };
  5390. /**
  5391. * ------------------------------------------------------------------------
  5392. * Class Definition
  5393. * ------------------------------------------------------------------------
  5394. */
  5395. var Popover =
  5396. /*#__PURE__*/
  5397. function (_Tooltip) {
  5398. _inheritsLoose(Popover, _Tooltip);
  5399. function Popover() {
  5400. return _Tooltip.apply(this, arguments) || this;
  5401. }
  5402. var _proto = Popover.prototype;
  5403. // Overrides
  5404. _proto.isWithContent = function isWithContent() {
  5405. return this.getTitle() || this._getContent();
  5406. };
  5407. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5408. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  5409. };
  5410. _proto.getTipElement = function getTipElement() {
  5411. this.tip = this.tip || $(this.config.template)[0];
  5412. return this.tip;
  5413. };
  5414. _proto.setContent = function setContent() {
  5415. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  5416. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  5417. var content = this._getContent();
  5418. if (typeof content === 'function') {
  5419. content = content.call(this.element);
  5420. }
  5421. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  5422. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  5423. } // Private
  5424. ;
  5425. _proto._getContent = function _getContent() {
  5426. return this.element.getAttribute('data-content') || this.config.content;
  5427. };
  5428. _proto._cleanTipClass = function _cleanTipClass() {
  5429. var $tip = $(this.getTipElement());
  5430. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  5431. if (tabClass !== null && tabClass.length > 0) {
  5432. $tip.removeClass(tabClass.join(''));
  5433. }
  5434. } // Static
  5435. ;
  5436. Popover._jQueryInterface = function _jQueryInterface(config) {
  5437. return this.each(function () {
  5438. var data = $(this).data(DATA_KEY$7);
  5439. var _config = typeof config === 'object' ? config : null;
  5440. if (!data && /dispose|hide/.test(config)) {
  5441. return;
  5442. }
  5443. if (!data) {
  5444. data = new Popover(this, _config);
  5445. $(this).data(DATA_KEY$7, data);
  5446. }
  5447. if (typeof config === 'string') {
  5448. if (typeof data[config] === 'undefined') {
  5449. throw new TypeError("No method named \"" + config + "\"");
  5450. }
  5451. data[config]();
  5452. }
  5453. });
  5454. };
  5455. _createClass(Popover, null, [{
  5456. key: "VERSION",
  5457. // Getters
  5458. get: function get() {
  5459. return VERSION$7;
  5460. }
  5461. }, {
  5462. key: "Default",
  5463. get: function get() {
  5464. return Default$5;
  5465. }
  5466. }, {
  5467. key: "NAME",
  5468. get: function get() {
  5469. return NAME$7;
  5470. }
  5471. }, {
  5472. key: "DATA_KEY",
  5473. get: function get() {
  5474. return DATA_KEY$7;
  5475. }
  5476. }, {
  5477. key: "Event",
  5478. get: function get() {
  5479. return Event$7;
  5480. }
  5481. }, {
  5482. key: "EVENT_KEY",
  5483. get: function get() {
  5484. return EVENT_KEY$7;
  5485. }
  5486. }, {
  5487. key: "DefaultType",
  5488. get: function get() {
  5489. return DefaultType$5;
  5490. }
  5491. }]);
  5492. return Popover;
  5493. }(Tooltip);
  5494. /**
  5495. * ------------------------------------------------------------------------
  5496. * jQuery
  5497. * ------------------------------------------------------------------------
  5498. */
  5499. $.fn[NAME$7] = Popover._jQueryInterface;
  5500. $.fn[NAME$7].Constructor = Popover;
  5501. $.fn[NAME$7].noConflict = function () {
  5502. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5503. return Popover._jQueryInterface;
  5504. };
  5505. /**
  5506. * ------------------------------------------------------------------------
  5507. * Constants
  5508. * ------------------------------------------------------------------------
  5509. */
  5510. var NAME$8 = 'scrollspy';
  5511. var VERSION$8 = '4.4.1';
  5512. var DATA_KEY$8 = 'bs.scrollspy';
  5513. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5514. var DATA_API_KEY$6 = '.data-api';
  5515. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5516. var Default$6 = {
  5517. offset: 10,
  5518. method: 'auto',
  5519. target: ''
  5520. };
  5521. var DefaultType$6 = {
  5522. offset: 'number',
  5523. method: 'string',
  5524. target: '(string|element)'
  5525. };
  5526. var Event$8 = {
  5527. ACTIVATE: "activate" + EVENT_KEY$8,
  5528. SCROLL: "scroll" + EVENT_KEY$8,
  5529. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5530. };
  5531. var ClassName$8 = {
  5532. DROPDOWN_ITEM: 'dropdown-item',
  5533. DROPDOWN_MENU: 'dropdown-menu',
  5534. ACTIVE: 'active'
  5535. };
  5536. var Selector$8 = {
  5537. DATA_SPY: '[data-spy="scroll"]',
  5538. ACTIVE: '.active',
  5539. NAV_LIST_GROUP: '.nav, .list-group',
  5540. NAV_LINKS: '.nav-link',
  5541. NAV_ITEMS: '.nav-item',
  5542. LIST_ITEMS: '.list-group-item',
  5543. DROPDOWN: '.dropdown',
  5544. DROPDOWN_ITEMS: '.dropdown-item',
  5545. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5546. };
  5547. var OffsetMethod = {
  5548. OFFSET: 'offset',
  5549. POSITION: 'position'
  5550. };
  5551. /**
  5552. * ------------------------------------------------------------------------
  5553. * Class Definition
  5554. * ------------------------------------------------------------------------
  5555. */
  5556. var ScrollSpy =
  5557. /*#__PURE__*/
  5558. function () {
  5559. function ScrollSpy(element, config) {
  5560. var _this = this;
  5561. this._element = element;
  5562. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5563. this._config = this._getConfig(config);
  5564. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5565. this._offsets = [];
  5566. this._targets = [];
  5567. this._activeTarget = null;
  5568. this._scrollHeight = 0;
  5569. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5570. return _this._process(event);
  5571. });
  5572. this.refresh();
  5573. this._process();
  5574. } // Getters
  5575. var _proto = ScrollSpy.prototype;
  5576. // Public
  5577. _proto.refresh = function refresh() {
  5578. var _this2 = this;
  5579. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5580. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5581. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5582. this._offsets = [];
  5583. this._targets = [];
  5584. this._scrollHeight = this._getScrollHeight();
  5585. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5586. targets.map(function (element) {
  5587. var target;
  5588. var targetSelector = Util.getSelectorFromElement(element);
  5589. if (targetSelector) {
  5590. target = document.querySelector(targetSelector);
  5591. }
  5592. if (target) {
  5593. var targetBCR = target.getBoundingClientRect();
  5594. if (targetBCR.width || targetBCR.height) {
  5595. // TODO (fat): remove sketch reliance on jQuery position/offset
  5596. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5597. }
  5598. }
  5599. return null;
  5600. }).filter(function (item) {
  5601. return item;
  5602. }).sort(function (a, b) {
  5603. return a[0] - b[0];
  5604. }).forEach(function (item) {
  5605. _this2._offsets.push(item[0]);
  5606. _this2._targets.push(item[1]);
  5607. });
  5608. };
  5609. _proto.dispose = function dispose() {
  5610. $.removeData(this._element, DATA_KEY$8);
  5611. $(this._scrollElement).off(EVENT_KEY$8);
  5612. this._element = null;
  5613. this._scrollElement = null;
  5614. this._config = null;
  5615. this._selector = null;
  5616. this._offsets = null;
  5617. this._targets = null;
  5618. this._activeTarget = null;
  5619. this._scrollHeight = null;
  5620. } // Private
  5621. ;
  5622. _proto._getConfig = function _getConfig(config) {
  5623. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  5624. if (typeof config.target !== 'string') {
  5625. var id = $(config.target).attr('id');
  5626. if (!id) {
  5627. id = Util.getUID(NAME$8);
  5628. $(config.target).attr('id', id);
  5629. }
  5630. config.target = "#" + id;
  5631. }
  5632. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5633. return config;
  5634. };
  5635. _proto._getScrollTop = function _getScrollTop() {
  5636. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5637. };
  5638. _proto._getScrollHeight = function _getScrollHeight() {
  5639. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5640. };
  5641. _proto._getOffsetHeight = function _getOffsetHeight() {
  5642. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5643. };
  5644. _proto._process = function _process() {
  5645. var scrollTop = this._getScrollTop() + this._config.offset;
  5646. var scrollHeight = this._getScrollHeight();
  5647. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5648. if (this._scrollHeight !== scrollHeight) {
  5649. this.refresh();
  5650. }
  5651. if (scrollTop >= maxScroll) {
  5652. var target = this._targets[this._targets.length - 1];
  5653. if (this._activeTarget !== target) {
  5654. this._activate(target);
  5655. }
  5656. return;
  5657. }
  5658. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5659. this._activeTarget = null;
  5660. this._clear();
  5661. return;
  5662. }
  5663. var offsetLength = this._offsets.length;
  5664. for (var i = offsetLength; i--;) {
  5665. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5666. if (isActiveTarget) {
  5667. this._activate(this._targets[i]);
  5668. }
  5669. }
  5670. };
  5671. _proto._activate = function _activate(target) {
  5672. this._activeTarget = target;
  5673. this._clear();
  5674. var queries = this._selector.split(',').map(function (selector) {
  5675. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5676. });
  5677. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5678. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5679. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5680. $link.addClass(ClassName$8.ACTIVE);
  5681. } else {
  5682. // Set triggered link as active
  5683. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5684. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5685. $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
  5686. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5687. }
  5688. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5689. relatedTarget: target
  5690. });
  5691. };
  5692. _proto._clear = function _clear() {
  5693. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5694. return node.classList.contains(ClassName$8.ACTIVE);
  5695. }).forEach(function (node) {
  5696. return node.classList.remove(ClassName$8.ACTIVE);
  5697. });
  5698. } // Static
  5699. ;
  5700. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5701. return this.each(function () {
  5702. var data = $(this).data(DATA_KEY$8);
  5703. var _config = typeof config === 'object' && config;
  5704. if (!data) {
  5705. data = new ScrollSpy(this, _config);
  5706. $(this).data(DATA_KEY$8, data);
  5707. }
  5708. if (typeof config === 'string') {
  5709. if (typeof data[config] === 'undefined') {
  5710. throw new TypeError("No method named \"" + config + "\"");
  5711. }
  5712. data[config]();
  5713. }
  5714. });
  5715. };
  5716. _createClass(ScrollSpy, null, [{
  5717. key: "VERSION",
  5718. get: function get() {
  5719. return VERSION$8;
  5720. }
  5721. }, {
  5722. key: "Default",
  5723. get: function get() {
  5724. return Default$6;
  5725. }
  5726. }]);
  5727. return ScrollSpy;
  5728. }();
  5729. /**
  5730. * ------------------------------------------------------------------------
  5731. * Data Api implementation
  5732. * ------------------------------------------------------------------------
  5733. */
  5734. $(window).on(Event$8.LOAD_DATA_API, function () {
  5735. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5736. var scrollSpysLength = scrollSpys.length;
  5737. for (var i = scrollSpysLength; i--;) {
  5738. var $spy = $(scrollSpys[i]);
  5739. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5740. }
  5741. });
  5742. /**
  5743. * ------------------------------------------------------------------------
  5744. * jQuery
  5745. * ------------------------------------------------------------------------
  5746. */
  5747. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5748. $.fn[NAME$8].Constructor = ScrollSpy;
  5749. $.fn[NAME$8].noConflict = function () {
  5750. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5751. return ScrollSpy._jQueryInterface;
  5752. };
  5753. /**
  5754. * ------------------------------------------------------------------------
  5755. * Constants
  5756. * ------------------------------------------------------------------------
  5757. */
  5758. var NAME$9 = 'tab';
  5759. var VERSION$9 = '4.4.1';
  5760. var DATA_KEY$9 = 'bs.tab';
  5761. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5762. var DATA_API_KEY$7 = '.data-api';
  5763. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5764. var Event$9 = {
  5765. HIDE: "hide" + EVENT_KEY$9,
  5766. HIDDEN: "hidden" + EVENT_KEY$9,
  5767. SHOW: "show" + EVENT_KEY$9,
  5768. SHOWN: "shown" + EVENT_KEY$9,
  5769. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5770. };
  5771. var ClassName$9 = {
  5772. DROPDOWN_MENU: 'dropdown-menu',
  5773. ACTIVE: 'active',
  5774. DISABLED: 'disabled',
  5775. FADE: 'fade',
  5776. SHOW: 'show'
  5777. };
  5778. var Selector$9 = {
  5779. DROPDOWN: '.dropdown',
  5780. NAV_LIST_GROUP: '.nav, .list-group',
  5781. ACTIVE: '.active',
  5782. ACTIVE_UL: '> li > .active',
  5783. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5784. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5785. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5786. };
  5787. /**
  5788. * ------------------------------------------------------------------------
  5789. * Class Definition
  5790. * ------------------------------------------------------------------------
  5791. */
  5792. var Tab =
  5793. /*#__PURE__*/
  5794. function () {
  5795. function Tab(element) {
  5796. this._element = element;
  5797. } // Getters
  5798. var _proto = Tab.prototype;
  5799. // Public
  5800. _proto.show = function show() {
  5801. var _this = this;
  5802. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5803. return;
  5804. }
  5805. var target;
  5806. var previous;
  5807. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5808. var selector = Util.getSelectorFromElement(this._element);
  5809. if (listElement) {
  5810. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5811. previous = $.makeArray($(listElement).find(itemSelector));
  5812. previous = previous[previous.length - 1];
  5813. }
  5814. var hideEvent = $.Event(Event$9.HIDE, {
  5815. relatedTarget: this._element
  5816. });
  5817. var showEvent = $.Event(Event$9.SHOW, {
  5818. relatedTarget: previous
  5819. });
  5820. if (previous) {
  5821. $(previous).trigger(hideEvent);
  5822. }
  5823. $(this._element).trigger(showEvent);
  5824. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5825. return;
  5826. }
  5827. if (selector) {
  5828. target = document.querySelector(selector);
  5829. }
  5830. this._activate(this._element, listElement);
  5831. var complete = function complete() {
  5832. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5833. relatedTarget: _this._element
  5834. });
  5835. var shownEvent = $.Event(Event$9.SHOWN, {
  5836. relatedTarget: previous
  5837. });
  5838. $(previous).trigger(hiddenEvent);
  5839. $(_this._element).trigger(shownEvent);
  5840. };
  5841. if (target) {
  5842. this._activate(target, target.parentNode, complete);
  5843. } else {
  5844. complete();
  5845. }
  5846. };
  5847. _proto.dispose = function dispose() {
  5848. $.removeData(this._element, DATA_KEY$9);
  5849. this._element = null;
  5850. } // Private
  5851. ;
  5852. _proto._activate = function _activate(element, container, callback) {
  5853. var _this2 = this;
  5854. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5855. var active = activeElements[0];
  5856. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5857. var complete = function complete() {
  5858. return _this2._transitionComplete(element, active, callback);
  5859. };
  5860. if (active && isTransitioning) {
  5861. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5862. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5863. } else {
  5864. complete();
  5865. }
  5866. };
  5867. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5868. if (active) {
  5869. $(active).removeClass(ClassName$9.ACTIVE);
  5870. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5871. if (dropdownChild) {
  5872. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5873. }
  5874. if (active.getAttribute('role') === 'tab') {
  5875. active.setAttribute('aria-selected', false);
  5876. }
  5877. }
  5878. $(element).addClass(ClassName$9.ACTIVE);
  5879. if (element.getAttribute('role') === 'tab') {
  5880. element.setAttribute('aria-selected', true);
  5881. }
  5882. Util.reflow(element);
  5883. if (element.classList.contains(ClassName$9.FADE)) {
  5884. element.classList.add(ClassName$9.SHOW);
  5885. }
  5886. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5887. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5888. if (dropdownElement) {
  5889. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5890. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5891. }
  5892. element.setAttribute('aria-expanded', true);
  5893. }
  5894. if (callback) {
  5895. callback();
  5896. }
  5897. } // Static
  5898. ;
  5899. Tab._jQueryInterface = function _jQueryInterface(config) {
  5900. return this.each(function () {
  5901. var $this = $(this);
  5902. var data = $this.data(DATA_KEY$9);
  5903. if (!data) {
  5904. data = new Tab(this);
  5905. $this.data(DATA_KEY$9, data);
  5906. }
  5907. if (typeof config === 'string') {
  5908. if (typeof data[config] === 'undefined') {
  5909. throw new TypeError("No method named \"" + config + "\"");
  5910. }
  5911. data[config]();
  5912. }
  5913. });
  5914. };
  5915. _createClass(Tab, null, [{
  5916. key: "VERSION",
  5917. get: function get() {
  5918. return VERSION$9;
  5919. }
  5920. }]);
  5921. return Tab;
  5922. }();
  5923. /**
  5924. * ------------------------------------------------------------------------
  5925. * Data Api implementation
  5926. * ------------------------------------------------------------------------
  5927. */
  5928. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  5929. event.preventDefault();
  5930. Tab._jQueryInterface.call($(this), 'show');
  5931. });
  5932. /**
  5933. * ------------------------------------------------------------------------
  5934. * jQuery
  5935. * ------------------------------------------------------------------------
  5936. */
  5937. $.fn[NAME$9] = Tab._jQueryInterface;
  5938. $.fn[NAME$9].Constructor = Tab;
  5939. $.fn[NAME$9].noConflict = function () {
  5940. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  5941. return Tab._jQueryInterface;
  5942. };
  5943. /**
  5944. * ------------------------------------------------------------------------
  5945. * Constants
  5946. * ------------------------------------------------------------------------
  5947. */
  5948. var NAME$a = 'toast';
  5949. var VERSION$a = '4.4.1';
  5950. var DATA_KEY$a = 'bs.toast';
  5951. var EVENT_KEY$a = "." + DATA_KEY$a;
  5952. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  5953. var Event$a = {
  5954. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  5955. HIDE: "hide" + EVENT_KEY$a,
  5956. HIDDEN: "hidden" + EVENT_KEY$a,
  5957. SHOW: "show" + EVENT_KEY$a,
  5958. SHOWN: "shown" + EVENT_KEY$a
  5959. };
  5960. var ClassName$a = {
  5961. FADE: 'fade',
  5962. HIDE: 'hide',
  5963. SHOW: 'show',
  5964. SHOWING: 'showing'
  5965. };
  5966. var DefaultType$7 = {
  5967. animation: 'boolean',
  5968. autohide: 'boolean',
  5969. delay: 'number'
  5970. };
  5971. var Default$7 = {
  5972. animation: true,
  5973. autohide: true,
  5974. delay: 500
  5975. };
  5976. var Selector$a = {
  5977. DATA_DISMISS: '[data-dismiss="toast"]'
  5978. };
  5979. /**
  5980. * ------------------------------------------------------------------------
  5981. * Class Definition
  5982. * ------------------------------------------------------------------------
  5983. */
  5984. var Toast =
  5985. /*#__PURE__*/
  5986. function () {
  5987. function Toast(element, config) {
  5988. this._element = element;
  5989. this._config = this._getConfig(config);
  5990. this._timeout = null;
  5991. this._setListeners();
  5992. } // Getters
  5993. var _proto = Toast.prototype;
  5994. // Public
  5995. _proto.show = function show() {
  5996. var _this = this;
  5997. var showEvent = $.Event(Event$a.SHOW);
  5998. $(this._element).trigger(showEvent);
  5999. if (showEvent.isDefaultPrevented()) {
  6000. return;
  6001. }
  6002. if (this._config.animation) {
  6003. this._element.classList.add(ClassName$a.FADE);
  6004. }
  6005. var complete = function complete() {
  6006. _this._element.classList.remove(ClassName$a.SHOWING);
  6007. _this._element.classList.add(ClassName$a.SHOW);
  6008. $(_this._element).trigger(Event$a.SHOWN);
  6009. if (_this._config.autohide) {
  6010. _this._timeout = setTimeout(function () {
  6011. _this.hide();
  6012. }, _this._config.delay);
  6013. }
  6014. };
  6015. this._element.classList.remove(ClassName$a.HIDE);
  6016. Util.reflow(this._element);
  6017. this._element.classList.add(ClassName$a.SHOWING);
  6018. if (this._config.animation) {
  6019. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6020. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6021. } else {
  6022. complete();
  6023. }
  6024. };
  6025. _proto.hide = function hide() {
  6026. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  6027. return;
  6028. }
  6029. var hideEvent = $.Event(Event$a.HIDE);
  6030. $(this._element).trigger(hideEvent);
  6031. if (hideEvent.isDefaultPrevented()) {
  6032. return;
  6033. }
  6034. this._close();
  6035. };
  6036. _proto.dispose = function dispose() {
  6037. clearTimeout(this._timeout);
  6038. this._timeout = null;
  6039. if (this._element.classList.contains(ClassName$a.SHOW)) {
  6040. this._element.classList.remove(ClassName$a.SHOW);
  6041. }
  6042. $(this._element).off(Event$a.CLICK_DISMISS);
  6043. $.removeData(this._element, DATA_KEY$a);
  6044. this._element = null;
  6045. this._config = null;
  6046. } // Private
  6047. ;
  6048. _proto._getConfig = function _getConfig(config) {
  6049. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  6050. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  6051. return config;
  6052. };
  6053. _proto._setListeners = function _setListeners() {
  6054. var _this2 = this;
  6055. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  6056. return _this2.hide();
  6057. });
  6058. };
  6059. _proto._close = function _close() {
  6060. var _this3 = this;
  6061. var complete = function complete() {
  6062. _this3._element.classList.add(ClassName$a.HIDE);
  6063. $(_this3._element).trigger(Event$a.HIDDEN);
  6064. };
  6065. this._element.classList.remove(ClassName$a.SHOW);
  6066. if (this._config.animation) {
  6067. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6068. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6069. } else {
  6070. complete();
  6071. }
  6072. } // Static
  6073. ;
  6074. Toast._jQueryInterface = function _jQueryInterface(config) {
  6075. return this.each(function () {
  6076. var $element = $(this);
  6077. var data = $element.data(DATA_KEY$a);
  6078. var _config = typeof config === 'object' && config;
  6079. if (!data) {
  6080. data = new Toast(this, _config);
  6081. $element.data(DATA_KEY$a, data);
  6082. }
  6083. if (typeof config === 'string') {
  6084. if (typeof data[config] === 'undefined') {
  6085. throw new TypeError("No method named \"" + config + "\"");
  6086. }
  6087. data[config](this);
  6088. }
  6089. });
  6090. };
  6091. _createClass(Toast, null, [{
  6092. key: "VERSION",
  6093. get: function get() {
  6094. return VERSION$a;
  6095. }
  6096. }, {
  6097. key: "DefaultType",
  6098. get: function get() {
  6099. return DefaultType$7;
  6100. }
  6101. }, {
  6102. key: "Default",
  6103. get: function get() {
  6104. return Default$7;
  6105. }
  6106. }]);
  6107. return Toast;
  6108. }();
  6109. /**
  6110. * ------------------------------------------------------------------------
  6111. * jQuery
  6112. * ------------------------------------------------------------------------
  6113. */
  6114. $.fn[NAME$a] = Toast._jQueryInterface;
  6115. $.fn[NAME$a].Constructor = Toast;
  6116. $.fn[NAME$a].noConflict = function () {
  6117. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  6118. return Toast._jQueryInterface;
  6119. };
  6120. exports.Alert = Alert;
  6121. exports.Button = Button;
  6122. exports.Carousel = Carousel;
  6123. exports.Collapse = Collapse;
  6124. exports.Dropdown = Dropdown;
  6125. exports.Modal = Modal;
  6126. exports.Popover = Popover;
  6127. exports.Scrollspy = ScrollSpy;
  6128. exports.Tab = Tab;
  6129. exports.Toast = Toast;
  6130. exports.Tooltip = Tooltip;
  6131. exports.Util = Util;
  6132. Object.defineProperty(exports, '__esModule', { value: true });
  6133. })));
  6134. //# sourceMappingURL=bootstrap.js.map
  6135. /***/ }),
  6136. /***/ "./node_modules/buffer/index.js":
  6137. /*!**************************************!*\
  6138. !*** ./node_modules/buffer/index.js ***!
  6139. \**************************************/
  6140. /*! no static exports found */
  6141. /***/ (function(module, exports, __webpack_require__) {
  6142. "use strict";
  6143. /* WEBPACK VAR INJECTION */(function(global) {/*!
  6144. * The buffer module from node.js, for the browser.
  6145. *
  6146. * @author Feross Aboukhadijeh <http://feross.org>
  6147. * @license MIT
  6148. */
  6149. /* eslint-disable no-proto */
  6150. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  6151. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  6152. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  6153. exports.Buffer = Buffer
  6154. exports.SlowBuffer = SlowBuffer
  6155. exports.INSPECT_MAX_BYTES = 50
  6156. /**
  6157. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  6158. * === true Use Uint8Array implementation (fastest)
  6159. * === false Use Object implementation (most compatible, even IE6)
  6160. *
  6161. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  6162. * Opera 11.6+, iOS 4.2+.
  6163. *
  6164. * Due to various browser bugs, sometimes the Object implementation will be used even
  6165. * when the browser supports typed arrays.
  6166. *
  6167. * Note:
  6168. *
  6169. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  6170. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  6171. *
  6172. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  6173. *
  6174. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  6175. * incorrect length in some situations.
  6176. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  6177. * get the Object implementation, which is slower but behaves correctly.
  6178. */
  6179. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  6180. ? global.TYPED_ARRAY_SUPPORT
  6181. : typedArraySupport()
  6182. /*
  6183. * Export kMaxLength after typed array support is determined.
  6184. */
  6185. exports.kMaxLength = kMaxLength()
  6186. function typedArraySupport () {
  6187. try {
  6188. var arr = new Uint8Array(1)
  6189. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  6190. return arr.foo() === 42 && // typed array instances can be augmented
  6191. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  6192. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  6193. } catch (e) {
  6194. return false
  6195. }
  6196. }
  6197. function kMaxLength () {
  6198. return Buffer.TYPED_ARRAY_SUPPORT
  6199. ? 0x7fffffff
  6200. : 0x3fffffff
  6201. }
  6202. function createBuffer (that, length) {
  6203. if (kMaxLength() < length) {
  6204. throw new RangeError('Invalid typed array length')
  6205. }
  6206. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6207. // Return an augmented `Uint8Array` instance, for best performance
  6208. that = new Uint8Array(length)
  6209. that.__proto__ = Buffer.prototype
  6210. } else {
  6211. // Fallback: Return an object instance of the Buffer class
  6212. if (that === null) {
  6213. that = new Buffer(length)
  6214. }
  6215. that.length = length
  6216. }
  6217. return that
  6218. }
  6219. /**
  6220. * The Buffer constructor returns instances of `Uint8Array` that have their
  6221. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  6222. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  6223. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  6224. * returns a single octet.
  6225. *
  6226. * The `Uint8Array` prototype remains unmodified.
  6227. */
  6228. function Buffer (arg, encodingOrOffset, length) {
  6229. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  6230. return new Buffer(arg, encodingOrOffset, length)
  6231. }
  6232. // Common case.
  6233. if (typeof arg === 'number') {
  6234. if (typeof encodingOrOffset === 'string') {
  6235. throw new Error(
  6236. 'If encoding is specified then the first argument must be a string'
  6237. )
  6238. }
  6239. return allocUnsafe(this, arg)
  6240. }
  6241. return from(this, arg, encodingOrOffset, length)
  6242. }
  6243. Buffer.poolSize = 8192 // not used by this implementation
  6244. // TODO: Legacy, not needed anymore. Remove in next major version.
  6245. Buffer._augment = function (arr) {
  6246. arr.__proto__ = Buffer.prototype
  6247. return arr
  6248. }
  6249. function from (that, value, encodingOrOffset, length) {
  6250. if (typeof value === 'number') {
  6251. throw new TypeError('"value" argument must not be a number')
  6252. }
  6253. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  6254. return fromArrayBuffer(that, value, encodingOrOffset, length)
  6255. }
  6256. if (typeof value === 'string') {
  6257. return fromString(that, value, encodingOrOffset)
  6258. }
  6259. return fromObject(that, value)
  6260. }
  6261. /**
  6262. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  6263. * if value is a number.
  6264. * Buffer.from(str[, encoding])
  6265. * Buffer.from(array)
  6266. * Buffer.from(buffer)
  6267. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  6268. **/
  6269. Buffer.from = function (value, encodingOrOffset, length) {
  6270. return from(null, value, encodingOrOffset, length)
  6271. }
  6272. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6273. Buffer.prototype.__proto__ = Uint8Array.prototype
  6274. Buffer.__proto__ = Uint8Array
  6275. if (typeof Symbol !== 'undefined' && Symbol.species &&
  6276. Buffer[Symbol.species] === Buffer) {
  6277. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  6278. Object.defineProperty(Buffer, Symbol.species, {
  6279. value: null,
  6280. configurable: true
  6281. })
  6282. }
  6283. }
  6284. function assertSize (size) {
  6285. if (typeof size !== 'number') {
  6286. throw new TypeError('"size" argument must be a number')
  6287. } else if (size < 0) {
  6288. throw new RangeError('"size" argument must not be negative')
  6289. }
  6290. }
  6291. function alloc (that, size, fill, encoding) {
  6292. assertSize(size)
  6293. if (size <= 0) {
  6294. return createBuffer(that, size)
  6295. }
  6296. if (fill !== undefined) {
  6297. // Only pay attention to encoding if it's a string. This
  6298. // prevents accidentally sending in a number that would
  6299. // be interpretted as a start offset.
  6300. return typeof encoding === 'string'
  6301. ? createBuffer(that, size).fill(fill, encoding)
  6302. : createBuffer(that, size).fill(fill)
  6303. }
  6304. return createBuffer(that, size)
  6305. }
  6306. /**
  6307. * Creates a new filled Buffer instance.
  6308. * alloc(size[, fill[, encoding]])
  6309. **/
  6310. Buffer.alloc = function (size, fill, encoding) {
  6311. return alloc(null, size, fill, encoding)
  6312. }
  6313. function allocUnsafe (that, size) {
  6314. assertSize(size)
  6315. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  6316. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  6317. for (var i = 0; i < size; ++i) {
  6318. that[i] = 0
  6319. }
  6320. }
  6321. return that
  6322. }
  6323. /**
  6324. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  6325. * */
  6326. Buffer.allocUnsafe = function (size) {
  6327. return allocUnsafe(null, size)
  6328. }
  6329. /**
  6330. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  6331. */
  6332. Buffer.allocUnsafeSlow = function (size) {
  6333. return allocUnsafe(null, size)
  6334. }
  6335. function fromString (that, string, encoding) {
  6336. if (typeof encoding !== 'string' || encoding === '') {
  6337. encoding = 'utf8'
  6338. }
  6339. if (!Buffer.isEncoding(encoding)) {
  6340. throw new TypeError('"encoding" must be a valid string encoding')
  6341. }
  6342. var length = byteLength(string, encoding) | 0
  6343. that = createBuffer(that, length)
  6344. var actual = that.write(string, encoding)
  6345. if (actual !== length) {
  6346. // Writing a hex string, for example, that contains invalid characters will
  6347. // cause everything after the first invalid character to be ignored. (e.g.
  6348. // 'abxxcd' will be treated as 'ab')
  6349. that = that.slice(0, actual)
  6350. }
  6351. return that
  6352. }
  6353. function fromArrayLike (that, array) {
  6354. var length = array.length < 0 ? 0 : checked(array.length) | 0
  6355. that = createBuffer(that, length)
  6356. for (var i = 0; i < length; i += 1) {
  6357. that[i] = array[i] & 255
  6358. }
  6359. return that
  6360. }
  6361. function fromArrayBuffer (that, array, byteOffset, length) {
  6362. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  6363. if (byteOffset < 0 || array.byteLength < byteOffset) {
  6364. throw new RangeError('\'offset\' is out of bounds')
  6365. }
  6366. if (array.byteLength < byteOffset + (length || 0)) {
  6367. throw new RangeError('\'length\' is out of bounds')
  6368. }
  6369. if (byteOffset === undefined && length === undefined) {
  6370. array = new Uint8Array(array)
  6371. } else if (length === undefined) {
  6372. array = new Uint8Array(array, byteOffset)
  6373. } else {
  6374. array = new Uint8Array(array, byteOffset, length)
  6375. }
  6376. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6377. // Return an augmented `Uint8Array` instance, for best performance
  6378. that = array
  6379. that.__proto__ = Buffer.prototype
  6380. } else {
  6381. // Fallback: Return an object instance of the Buffer class
  6382. that = fromArrayLike(that, array)
  6383. }
  6384. return that
  6385. }
  6386. function fromObject (that, obj) {
  6387. if (Buffer.isBuffer(obj)) {
  6388. var len = checked(obj.length) | 0
  6389. that = createBuffer(that, len)
  6390. if (that.length === 0) {
  6391. return that
  6392. }
  6393. obj.copy(that, 0, 0, len)
  6394. return that
  6395. }
  6396. if (obj) {
  6397. if ((typeof ArrayBuffer !== 'undefined' &&
  6398. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  6399. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  6400. return createBuffer(that, 0)
  6401. }
  6402. return fromArrayLike(that, obj)
  6403. }
  6404. if (obj.type === 'Buffer' && isArray(obj.data)) {
  6405. return fromArrayLike(that, obj.data)
  6406. }
  6407. }
  6408. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  6409. }
  6410. function checked (length) {
  6411. // Note: cannot use `length < kMaxLength()` here because that fails when
  6412. // length is NaN (which is otherwise coerced to zero.)
  6413. if (length >= kMaxLength()) {
  6414. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  6415. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  6416. }
  6417. return length | 0
  6418. }
  6419. function SlowBuffer (length) {
  6420. if (+length != length) { // eslint-disable-line eqeqeq
  6421. length = 0
  6422. }
  6423. return Buffer.alloc(+length)
  6424. }
  6425. Buffer.isBuffer = function isBuffer (b) {
  6426. return !!(b != null && b._isBuffer)
  6427. }
  6428. Buffer.compare = function compare (a, b) {
  6429. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  6430. throw new TypeError('Arguments must be Buffers')
  6431. }
  6432. if (a === b) return 0
  6433. var x = a.length
  6434. var y = b.length
  6435. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  6436. if (a[i] !== b[i]) {
  6437. x = a[i]
  6438. y = b[i]
  6439. break
  6440. }
  6441. }
  6442. if (x < y) return -1
  6443. if (y < x) return 1
  6444. return 0
  6445. }
  6446. Buffer.isEncoding = function isEncoding (encoding) {
  6447. switch (String(encoding).toLowerCase()) {
  6448. case 'hex':
  6449. case 'utf8':
  6450. case 'utf-8':
  6451. case 'ascii':
  6452. case 'latin1':
  6453. case 'binary':
  6454. case 'base64':
  6455. case 'ucs2':
  6456. case 'ucs-2':
  6457. case 'utf16le':
  6458. case 'utf-16le':
  6459. return true
  6460. default:
  6461. return false
  6462. }
  6463. }
  6464. Buffer.concat = function concat (list, length) {
  6465. if (!isArray(list)) {
  6466. throw new TypeError('"list" argument must be an Array of Buffers')
  6467. }
  6468. if (list.length === 0) {
  6469. return Buffer.alloc(0)
  6470. }
  6471. var i
  6472. if (length === undefined) {
  6473. length = 0
  6474. for (i = 0; i < list.length; ++i) {
  6475. length += list[i].length
  6476. }
  6477. }
  6478. var buffer = Buffer.allocUnsafe(length)
  6479. var pos = 0
  6480. for (i = 0; i < list.length; ++i) {
  6481. var buf = list[i]
  6482. if (!Buffer.isBuffer(buf)) {
  6483. throw new TypeError('"list" argument must be an Array of Buffers')
  6484. }
  6485. buf.copy(buffer, pos)
  6486. pos += buf.length
  6487. }
  6488. return buffer
  6489. }
  6490. function byteLength (string, encoding) {
  6491. if (Buffer.isBuffer(string)) {
  6492. return string.length
  6493. }
  6494. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  6495. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  6496. return string.byteLength
  6497. }
  6498. if (typeof string !== 'string') {
  6499. string = '' + string
  6500. }
  6501. var len = string.length
  6502. if (len === 0) return 0
  6503. // Use a for loop to avoid recursion
  6504. var loweredCase = false
  6505. for (;;) {
  6506. switch (encoding) {
  6507. case 'ascii':
  6508. case 'latin1':
  6509. case 'binary':
  6510. return len
  6511. case 'utf8':
  6512. case 'utf-8':
  6513. case undefined:
  6514. return utf8ToBytes(string).length
  6515. case 'ucs2':
  6516. case 'ucs-2':
  6517. case 'utf16le':
  6518. case 'utf-16le':
  6519. return len * 2
  6520. case 'hex':
  6521. return len >>> 1
  6522. case 'base64':
  6523. return base64ToBytes(string).length
  6524. default:
  6525. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  6526. encoding = ('' + encoding).toLowerCase()
  6527. loweredCase = true
  6528. }
  6529. }
  6530. }
  6531. Buffer.byteLength = byteLength
  6532. function slowToString (encoding, start, end) {
  6533. var loweredCase = false
  6534. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  6535. // property of a typed array.
  6536. // This behaves neither like String nor Uint8Array in that we set start/end
  6537. // to their upper/lower bounds if the value passed is out of range.
  6538. // undefined is handled specially as per ECMA-262 6th Edition,
  6539. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  6540. if (start === undefined || start < 0) {
  6541. start = 0
  6542. }
  6543. // Return early if start > this.length. Done here to prevent potential uint32
  6544. // coercion fail below.
  6545. if (start > this.length) {
  6546. return ''
  6547. }
  6548. if (end === undefined || end > this.length) {
  6549. end = this.length
  6550. }
  6551. if (end <= 0) {
  6552. return ''
  6553. }
  6554. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  6555. end >>>= 0
  6556. start >>>= 0
  6557. if (end <= start) {
  6558. return ''
  6559. }
  6560. if (!encoding) encoding = 'utf8'
  6561. while (true) {
  6562. switch (encoding) {
  6563. case 'hex':
  6564. return hexSlice(this, start, end)
  6565. case 'utf8':
  6566. case 'utf-8':
  6567. return utf8Slice(this, start, end)
  6568. case 'ascii':
  6569. return asciiSlice(this, start, end)
  6570. case 'latin1':
  6571. case 'binary':
  6572. return latin1Slice(this, start, end)
  6573. case 'base64':
  6574. return base64Slice(this, start, end)
  6575. case 'ucs2':
  6576. case 'ucs-2':
  6577. case 'utf16le':
  6578. case 'utf-16le':
  6579. return utf16leSlice(this, start, end)
  6580. default:
  6581. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6582. encoding = (encoding + '').toLowerCase()
  6583. loweredCase = true
  6584. }
  6585. }
  6586. }
  6587. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  6588. // Buffer instances.
  6589. Buffer.prototype._isBuffer = true
  6590. function swap (b, n, m) {
  6591. var i = b[n]
  6592. b[n] = b[m]
  6593. b[m] = i
  6594. }
  6595. Buffer.prototype.swap16 = function swap16 () {
  6596. var len = this.length
  6597. if (len % 2 !== 0) {
  6598. throw new RangeError('Buffer size must be a multiple of 16-bits')
  6599. }
  6600. for (var i = 0; i < len; i += 2) {
  6601. swap(this, i, i + 1)
  6602. }
  6603. return this
  6604. }
  6605. Buffer.prototype.swap32 = function swap32 () {
  6606. var len = this.length
  6607. if (len % 4 !== 0) {
  6608. throw new RangeError('Buffer size must be a multiple of 32-bits')
  6609. }
  6610. for (var i = 0; i < len; i += 4) {
  6611. swap(this, i, i + 3)
  6612. swap(this, i + 1, i + 2)
  6613. }
  6614. return this
  6615. }
  6616. Buffer.prototype.swap64 = function swap64 () {
  6617. var len = this.length
  6618. if (len % 8 !== 0) {
  6619. throw new RangeError('Buffer size must be a multiple of 64-bits')
  6620. }
  6621. for (var i = 0; i < len; i += 8) {
  6622. swap(this, i, i + 7)
  6623. swap(this, i + 1, i + 6)
  6624. swap(this, i + 2, i + 5)
  6625. swap(this, i + 3, i + 4)
  6626. }
  6627. return this
  6628. }
  6629. Buffer.prototype.toString = function toString () {
  6630. var length = this.length | 0
  6631. if (length === 0) return ''
  6632. if (arguments.length === 0) return utf8Slice(this, 0, length)
  6633. return slowToString.apply(this, arguments)
  6634. }
  6635. Buffer.prototype.equals = function equals (b) {
  6636. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  6637. if (this === b) return true
  6638. return Buffer.compare(this, b) === 0
  6639. }
  6640. Buffer.prototype.inspect = function inspect () {
  6641. var str = ''
  6642. var max = exports.INSPECT_MAX_BYTES
  6643. if (this.length > 0) {
  6644. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  6645. if (this.length > max) str += ' ... '
  6646. }
  6647. return '<Buffer ' + str + '>'
  6648. }
  6649. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  6650. if (!Buffer.isBuffer(target)) {
  6651. throw new TypeError('Argument must be a Buffer')
  6652. }
  6653. if (start === undefined) {
  6654. start = 0
  6655. }
  6656. if (end === undefined) {
  6657. end = target ? target.length : 0
  6658. }
  6659. if (thisStart === undefined) {
  6660. thisStart = 0
  6661. }
  6662. if (thisEnd === undefined) {
  6663. thisEnd = this.length
  6664. }
  6665. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  6666. throw new RangeError('out of range index')
  6667. }
  6668. if (thisStart >= thisEnd && start >= end) {
  6669. return 0
  6670. }
  6671. if (thisStart >= thisEnd) {
  6672. return -1
  6673. }
  6674. if (start >= end) {
  6675. return 1
  6676. }
  6677. start >>>= 0
  6678. end >>>= 0
  6679. thisStart >>>= 0
  6680. thisEnd >>>= 0
  6681. if (this === target) return 0
  6682. var x = thisEnd - thisStart
  6683. var y = end - start
  6684. var len = Math.min(x, y)
  6685. var thisCopy = this.slice(thisStart, thisEnd)
  6686. var targetCopy = target.slice(start, end)
  6687. for (var i = 0; i < len; ++i) {
  6688. if (thisCopy[i] !== targetCopy[i]) {
  6689. x = thisCopy[i]
  6690. y = targetCopy[i]
  6691. break
  6692. }
  6693. }
  6694. if (x < y) return -1
  6695. if (y < x) return 1
  6696. return 0
  6697. }
  6698. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  6699. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  6700. //
  6701. // Arguments:
  6702. // - buffer - a Buffer to search
  6703. // - val - a string, Buffer, or number
  6704. // - byteOffset - an index into `buffer`; will be clamped to an int32
  6705. // - encoding - an optional encoding, relevant is val is a string
  6706. // - dir - true for indexOf, false for lastIndexOf
  6707. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  6708. // Empty buffer means no match
  6709. if (buffer.length === 0) return -1
  6710. // Normalize byteOffset
  6711. if (typeof byteOffset === 'string') {
  6712. encoding = byteOffset
  6713. byteOffset = 0
  6714. } else if (byteOffset > 0x7fffffff) {
  6715. byteOffset = 0x7fffffff
  6716. } else if (byteOffset < -0x80000000) {
  6717. byteOffset = -0x80000000
  6718. }
  6719. byteOffset = +byteOffset // Coerce to Number.
  6720. if (isNaN(byteOffset)) {
  6721. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  6722. byteOffset = dir ? 0 : (buffer.length - 1)
  6723. }
  6724. // Normalize byteOffset: negative offsets start from the end of the buffer
  6725. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  6726. if (byteOffset >= buffer.length) {
  6727. if (dir) return -1
  6728. else byteOffset = buffer.length - 1
  6729. } else if (byteOffset < 0) {
  6730. if (dir) byteOffset = 0
  6731. else return -1
  6732. }
  6733. // Normalize val
  6734. if (typeof val === 'string') {
  6735. val = Buffer.from(val, encoding)
  6736. }
  6737. // Finally, search either indexOf (if dir is true) or lastIndexOf
  6738. if (Buffer.isBuffer(val)) {
  6739. // Special case: looking for empty string/buffer always fails
  6740. if (val.length === 0) {
  6741. return -1
  6742. }
  6743. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  6744. } else if (typeof val === 'number') {
  6745. val = val & 0xFF // Search for a byte value [0-255]
  6746. if (Buffer.TYPED_ARRAY_SUPPORT &&
  6747. typeof Uint8Array.prototype.indexOf === 'function') {
  6748. if (dir) {
  6749. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  6750. } else {
  6751. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  6752. }
  6753. }
  6754. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  6755. }
  6756. throw new TypeError('val must be string, number or Buffer')
  6757. }
  6758. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  6759. var indexSize = 1
  6760. var arrLength = arr.length
  6761. var valLength = val.length
  6762. if (encoding !== undefined) {
  6763. encoding = String(encoding).toLowerCase()
  6764. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  6765. encoding === 'utf16le' || encoding === 'utf-16le') {
  6766. if (arr.length < 2 || val.length < 2) {
  6767. return -1
  6768. }
  6769. indexSize = 2
  6770. arrLength /= 2
  6771. valLength /= 2
  6772. byteOffset /= 2
  6773. }
  6774. }
  6775. function read (buf, i) {
  6776. if (indexSize === 1) {
  6777. return buf[i]
  6778. } else {
  6779. return buf.readUInt16BE(i * indexSize)
  6780. }
  6781. }
  6782. var i
  6783. if (dir) {
  6784. var foundIndex = -1
  6785. for (i = byteOffset; i < arrLength; i++) {
  6786. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  6787. if (foundIndex === -1) foundIndex = i
  6788. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  6789. } else {
  6790. if (foundIndex !== -1) i -= i - foundIndex
  6791. foundIndex = -1
  6792. }
  6793. }
  6794. } else {
  6795. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  6796. for (i = byteOffset; i >= 0; i--) {
  6797. var found = true
  6798. for (var j = 0; j < valLength; j++) {
  6799. if (read(arr, i + j) !== read(val, j)) {
  6800. found = false
  6801. break
  6802. }
  6803. }
  6804. if (found) return i
  6805. }
  6806. }
  6807. return -1
  6808. }
  6809. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  6810. return this.indexOf(val, byteOffset, encoding) !== -1
  6811. }
  6812. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  6813. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  6814. }
  6815. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  6816. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  6817. }
  6818. function hexWrite (buf, string, offset, length) {
  6819. offset = Number(offset) || 0
  6820. var remaining = buf.length - offset
  6821. if (!length) {
  6822. length = remaining
  6823. } else {
  6824. length = Number(length)
  6825. if (length > remaining) {
  6826. length = remaining
  6827. }
  6828. }
  6829. // must be an even number of digits
  6830. var strLen = string.length
  6831. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  6832. if (length > strLen / 2) {
  6833. length = strLen / 2
  6834. }
  6835. for (var i = 0; i < length; ++i) {
  6836. var parsed = parseInt(string.substr(i * 2, 2), 16)
  6837. if (isNaN(parsed)) return i
  6838. buf[offset + i] = parsed
  6839. }
  6840. return i
  6841. }
  6842. function utf8Write (buf, string, offset, length) {
  6843. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  6844. }
  6845. function asciiWrite (buf, string, offset, length) {
  6846. return blitBuffer(asciiToBytes(string), buf, offset, length)
  6847. }
  6848. function latin1Write (buf, string, offset, length) {
  6849. return asciiWrite(buf, string, offset, length)
  6850. }
  6851. function base64Write (buf, string, offset, length) {
  6852. return blitBuffer(base64ToBytes(string), buf, offset, length)
  6853. }
  6854. function ucs2Write (buf, string, offset, length) {
  6855. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  6856. }
  6857. Buffer.prototype.write = function write (string, offset, length, encoding) {
  6858. // Buffer#write(string)
  6859. if (offset === undefined) {
  6860. encoding = 'utf8'
  6861. length = this.length
  6862. offset = 0
  6863. // Buffer#write(string, encoding)
  6864. } else if (length === undefined && typeof offset === 'string') {
  6865. encoding = offset
  6866. length = this.length
  6867. offset = 0
  6868. // Buffer#write(string, offset[, length][, encoding])
  6869. } else if (isFinite(offset)) {
  6870. offset = offset | 0
  6871. if (isFinite(length)) {
  6872. length = length | 0
  6873. if (encoding === undefined) encoding = 'utf8'
  6874. } else {
  6875. encoding = length
  6876. length = undefined
  6877. }
  6878. // legacy write(string, encoding, offset, length) - remove in v0.13
  6879. } else {
  6880. throw new Error(
  6881. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  6882. )
  6883. }
  6884. var remaining = this.length - offset
  6885. if (length === undefined || length > remaining) length = remaining
  6886. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  6887. throw new RangeError('Attempt to write outside buffer bounds')
  6888. }
  6889. if (!encoding) encoding = 'utf8'
  6890. var loweredCase = false
  6891. for (;;) {
  6892. switch (encoding) {
  6893. case 'hex':
  6894. return hexWrite(this, string, offset, length)
  6895. case 'utf8':
  6896. case 'utf-8':
  6897. return utf8Write(this, string, offset, length)
  6898. case 'ascii':
  6899. return asciiWrite(this, string, offset, length)
  6900. case 'latin1':
  6901. case 'binary':
  6902. return latin1Write(this, string, offset, length)
  6903. case 'base64':
  6904. // Warning: maxLength not taken into account in base64Write
  6905. return base64Write(this, string, offset, length)
  6906. case 'ucs2':
  6907. case 'ucs-2':
  6908. case 'utf16le':
  6909. case 'utf-16le':
  6910. return ucs2Write(this, string, offset, length)
  6911. default:
  6912. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6913. encoding = ('' + encoding).toLowerCase()
  6914. loweredCase = true
  6915. }
  6916. }
  6917. }
  6918. Buffer.prototype.toJSON = function toJSON () {
  6919. return {
  6920. type: 'Buffer',
  6921. data: Array.prototype.slice.call(this._arr || this, 0)
  6922. }
  6923. }
  6924. function base64Slice (buf, start, end) {
  6925. if (start === 0 && end === buf.length) {
  6926. return base64.fromByteArray(buf)
  6927. } else {
  6928. return base64.fromByteArray(buf.slice(start, end))
  6929. }
  6930. }
  6931. function utf8Slice (buf, start, end) {
  6932. end = Math.min(buf.length, end)
  6933. var res = []
  6934. var i = start
  6935. while (i < end) {
  6936. var firstByte = buf[i]
  6937. var codePoint = null
  6938. var bytesPerSequence = (firstByte > 0xEF) ? 4
  6939. : (firstByte > 0xDF) ? 3
  6940. : (firstByte > 0xBF) ? 2
  6941. : 1
  6942. if (i + bytesPerSequence <= end) {
  6943. var secondByte, thirdByte, fourthByte, tempCodePoint
  6944. switch (bytesPerSequence) {
  6945. case 1:
  6946. if (firstByte < 0x80) {
  6947. codePoint = firstByte
  6948. }
  6949. break
  6950. case 2:
  6951. secondByte = buf[i + 1]
  6952. if ((secondByte & 0xC0) === 0x80) {
  6953. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  6954. if (tempCodePoint > 0x7F) {
  6955. codePoint = tempCodePoint
  6956. }
  6957. }
  6958. break
  6959. case 3:
  6960. secondByte = buf[i + 1]
  6961. thirdByte = buf[i + 2]
  6962. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  6963. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  6964. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  6965. codePoint = tempCodePoint
  6966. }
  6967. }
  6968. break
  6969. case 4:
  6970. secondByte = buf[i + 1]
  6971. thirdByte = buf[i + 2]
  6972. fourthByte = buf[i + 3]
  6973. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  6974. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  6975. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  6976. codePoint = tempCodePoint
  6977. }
  6978. }
  6979. }
  6980. }
  6981. if (codePoint === null) {
  6982. // we did not generate a valid codePoint so insert a
  6983. // replacement char (U+FFFD) and advance only 1 byte
  6984. codePoint = 0xFFFD
  6985. bytesPerSequence = 1
  6986. } else if (codePoint > 0xFFFF) {
  6987. // encode to utf16 (surrogate pair dance)
  6988. codePoint -= 0x10000
  6989. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  6990. codePoint = 0xDC00 | codePoint & 0x3FF
  6991. }
  6992. res.push(codePoint)
  6993. i += bytesPerSequence
  6994. }
  6995. return decodeCodePointsArray(res)
  6996. }
  6997. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  6998. // the lowest limit is Chrome, with 0x10000 args.
  6999. // We go 1 magnitude less, for safety
  7000. var MAX_ARGUMENTS_LENGTH = 0x1000
  7001. function decodeCodePointsArray (codePoints) {
  7002. var len = codePoints.length
  7003. if (len <= MAX_ARGUMENTS_LENGTH) {
  7004. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  7005. }
  7006. // Decode in chunks to avoid "call stack size exceeded".
  7007. var res = ''
  7008. var i = 0
  7009. while (i < len) {
  7010. res += String.fromCharCode.apply(
  7011. String,
  7012. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  7013. )
  7014. }
  7015. return res
  7016. }
  7017. function asciiSlice (buf, start, end) {
  7018. var ret = ''
  7019. end = Math.min(buf.length, end)
  7020. for (var i = start; i < end; ++i) {
  7021. ret += String.fromCharCode(buf[i] & 0x7F)
  7022. }
  7023. return ret
  7024. }
  7025. function latin1Slice (buf, start, end) {
  7026. var ret = ''
  7027. end = Math.min(buf.length, end)
  7028. for (var i = start; i < end; ++i) {
  7029. ret += String.fromCharCode(buf[i])
  7030. }
  7031. return ret
  7032. }
  7033. function hexSlice (buf, start, end) {
  7034. var len = buf.length
  7035. if (!start || start < 0) start = 0
  7036. if (!end || end < 0 || end > len) end = len
  7037. var out = ''
  7038. for (var i = start; i < end; ++i) {
  7039. out += toHex(buf[i])
  7040. }
  7041. return out
  7042. }
  7043. function utf16leSlice (buf, start, end) {
  7044. var bytes = buf.slice(start, end)
  7045. var res = ''
  7046. for (var i = 0; i < bytes.length; i += 2) {
  7047. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  7048. }
  7049. return res
  7050. }
  7051. Buffer.prototype.slice = function slice (start, end) {
  7052. var len = this.length
  7053. start = ~~start
  7054. end = end === undefined ? len : ~~end
  7055. if (start < 0) {
  7056. start += len
  7057. if (start < 0) start = 0
  7058. } else if (start > len) {
  7059. start = len
  7060. }
  7061. if (end < 0) {
  7062. end += len
  7063. if (end < 0) end = 0
  7064. } else if (end > len) {
  7065. end = len
  7066. }
  7067. if (end < start) end = start
  7068. var newBuf
  7069. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7070. newBuf = this.subarray(start, end)
  7071. newBuf.__proto__ = Buffer.prototype
  7072. } else {
  7073. var sliceLen = end - start
  7074. newBuf = new Buffer(sliceLen, undefined)
  7075. for (var i = 0; i < sliceLen; ++i) {
  7076. newBuf[i] = this[i + start]
  7077. }
  7078. }
  7079. return newBuf
  7080. }
  7081. /*
  7082. * Need to make sure that buffer isn't trying to write out of bounds.
  7083. */
  7084. function checkOffset (offset, ext, length) {
  7085. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  7086. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  7087. }
  7088. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  7089. offset = offset | 0
  7090. byteLength = byteLength | 0
  7091. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7092. var val = this[offset]
  7093. var mul = 1
  7094. var i = 0
  7095. while (++i < byteLength && (mul *= 0x100)) {
  7096. val += this[offset + i] * mul
  7097. }
  7098. return val
  7099. }
  7100. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  7101. offset = offset | 0
  7102. byteLength = byteLength | 0
  7103. if (!noAssert) {
  7104. checkOffset(offset, byteLength, this.length)
  7105. }
  7106. var val = this[offset + --byteLength]
  7107. var mul = 1
  7108. while (byteLength > 0 && (mul *= 0x100)) {
  7109. val += this[offset + --byteLength] * mul
  7110. }
  7111. return val
  7112. }
  7113. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  7114. if (!noAssert) checkOffset(offset, 1, this.length)
  7115. return this[offset]
  7116. }
  7117. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  7118. if (!noAssert) checkOffset(offset, 2, this.length)
  7119. return this[offset] | (this[offset + 1] << 8)
  7120. }
  7121. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  7122. if (!noAssert) checkOffset(offset, 2, this.length)
  7123. return (this[offset] << 8) | this[offset + 1]
  7124. }
  7125. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  7126. if (!noAssert) checkOffset(offset, 4, this.length)
  7127. return ((this[offset]) |
  7128. (this[offset + 1] << 8) |
  7129. (this[offset + 2] << 16)) +
  7130. (this[offset + 3] * 0x1000000)
  7131. }
  7132. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  7133. if (!noAssert) checkOffset(offset, 4, this.length)
  7134. return (this[offset] * 0x1000000) +
  7135. ((this[offset + 1] << 16) |
  7136. (this[offset + 2] << 8) |
  7137. this[offset + 3])
  7138. }
  7139. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  7140. offset = offset | 0
  7141. byteLength = byteLength | 0
  7142. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7143. var val = this[offset]
  7144. var mul = 1
  7145. var i = 0
  7146. while (++i < byteLength && (mul *= 0x100)) {
  7147. val += this[offset + i] * mul
  7148. }
  7149. mul *= 0x80
  7150. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7151. return val
  7152. }
  7153. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  7154. offset = offset | 0
  7155. byteLength = byteLength | 0
  7156. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7157. var i = byteLength
  7158. var mul = 1
  7159. var val = this[offset + --i]
  7160. while (i > 0 && (mul *= 0x100)) {
  7161. val += this[offset + --i] * mul
  7162. }
  7163. mul *= 0x80
  7164. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7165. return val
  7166. }
  7167. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  7168. if (!noAssert) checkOffset(offset, 1, this.length)
  7169. if (!(this[offset] & 0x80)) return (this[offset])
  7170. return ((0xff - this[offset] + 1) * -1)
  7171. }
  7172. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  7173. if (!noAssert) checkOffset(offset, 2, this.length)
  7174. var val = this[offset] | (this[offset + 1] << 8)
  7175. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7176. }
  7177. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  7178. if (!noAssert) checkOffset(offset, 2, this.length)
  7179. var val = this[offset + 1] | (this[offset] << 8)
  7180. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7181. }
  7182. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  7183. if (!noAssert) checkOffset(offset, 4, this.length)
  7184. return (this[offset]) |
  7185. (this[offset + 1] << 8) |
  7186. (this[offset + 2] << 16) |
  7187. (this[offset + 3] << 24)
  7188. }
  7189. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  7190. if (!noAssert) checkOffset(offset, 4, this.length)
  7191. return (this[offset] << 24) |
  7192. (this[offset + 1] << 16) |
  7193. (this[offset + 2] << 8) |
  7194. (this[offset + 3])
  7195. }
  7196. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  7197. if (!noAssert) checkOffset(offset, 4, this.length)
  7198. return ieee754.read(this, offset, true, 23, 4)
  7199. }
  7200. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  7201. if (!noAssert) checkOffset(offset, 4, this.length)
  7202. return ieee754.read(this, offset, false, 23, 4)
  7203. }
  7204. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  7205. if (!noAssert) checkOffset(offset, 8, this.length)
  7206. return ieee754.read(this, offset, true, 52, 8)
  7207. }
  7208. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  7209. if (!noAssert) checkOffset(offset, 8, this.length)
  7210. return ieee754.read(this, offset, false, 52, 8)
  7211. }
  7212. function checkInt (buf, value, offset, ext, max, min) {
  7213. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  7214. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  7215. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7216. }
  7217. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  7218. value = +value
  7219. offset = offset | 0
  7220. byteLength = byteLength | 0
  7221. if (!noAssert) {
  7222. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7223. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7224. }
  7225. var mul = 1
  7226. var i = 0
  7227. this[offset] = value & 0xFF
  7228. while (++i < byteLength && (mul *= 0x100)) {
  7229. this[offset + i] = (value / mul) & 0xFF
  7230. }
  7231. return offset + byteLength
  7232. }
  7233. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  7234. value = +value
  7235. offset = offset | 0
  7236. byteLength = byteLength | 0
  7237. if (!noAssert) {
  7238. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7239. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7240. }
  7241. var i = byteLength - 1
  7242. var mul = 1
  7243. this[offset + i] = value & 0xFF
  7244. while (--i >= 0 && (mul *= 0x100)) {
  7245. this[offset + i] = (value / mul) & 0xFF
  7246. }
  7247. return offset + byteLength
  7248. }
  7249. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  7250. value = +value
  7251. offset = offset | 0
  7252. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  7253. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7254. this[offset] = (value & 0xff)
  7255. return offset + 1
  7256. }
  7257. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  7258. if (value < 0) value = 0xffff + value + 1
  7259. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  7260. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  7261. (littleEndian ? i : 1 - i) * 8
  7262. }
  7263. }
  7264. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  7265. value = +value
  7266. offset = offset | 0
  7267. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7268. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7269. this[offset] = (value & 0xff)
  7270. this[offset + 1] = (value >>> 8)
  7271. } else {
  7272. objectWriteUInt16(this, value, offset, true)
  7273. }
  7274. return offset + 2
  7275. }
  7276. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  7277. value = +value
  7278. offset = offset | 0
  7279. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7280. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7281. this[offset] = (value >>> 8)
  7282. this[offset + 1] = (value & 0xff)
  7283. } else {
  7284. objectWriteUInt16(this, value, offset, false)
  7285. }
  7286. return offset + 2
  7287. }
  7288. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  7289. if (value < 0) value = 0xffffffff + value + 1
  7290. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  7291. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  7292. }
  7293. }
  7294. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  7295. value = +value
  7296. offset = offset | 0
  7297. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7298. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7299. this[offset + 3] = (value >>> 24)
  7300. this[offset + 2] = (value >>> 16)
  7301. this[offset + 1] = (value >>> 8)
  7302. this[offset] = (value & 0xff)
  7303. } else {
  7304. objectWriteUInt32(this, value, offset, true)
  7305. }
  7306. return offset + 4
  7307. }
  7308. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  7309. value = +value
  7310. offset = offset | 0
  7311. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7312. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7313. this[offset] = (value >>> 24)
  7314. this[offset + 1] = (value >>> 16)
  7315. this[offset + 2] = (value >>> 8)
  7316. this[offset + 3] = (value & 0xff)
  7317. } else {
  7318. objectWriteUInt32(this, value, offset, false)
  7319. }
  7320. return offset + 4
  7321. }
  7322. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  7323. value = +value
  7324. offset = offset | 0
  7325. if (!noAssert) {
  7326. var limit = Math.pow(2, 8 * byteLength - 1)
  7327. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7328. }
  7329. var i = 0
  7330. var mul = 1
  7331. var sub = 0
  7332. this[offset] = value & 0xFF
  7333. while (++i < byteLength && (mul *= 0x100)) {
  7334. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  7335. sub = 1
  7336. }
  7337. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7338. }
  7339. return offset + byteLength
  7340. }
  7341. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  7342. value = +value
  7343. offset = offset | 0
  7344. if (!noAssert) {
  7345. var limit = Math.pow(2, 8 * byteLength - 1)
  7346. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7347. }
  7348. var i = byteLength - 1
  7349. var mul = 1
  7350. var sub = 0
  7351. this[offset + i] = value & 0xFF
  7352. while (--i >= 0 && (mul *= 0x100)) {
  7353. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  7354. sub = 1
  7355. }
  7356. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7357. }
  7358. return offset + byteLength
  7359. }
  7360. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  7361. value = +value
  7362. offset = offset | 0
  7363. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  7364. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7365. if (value < 0) value = 0xff + value + 1
  7366. this[offset] = (value & 0xff)
  7367. return offset + 1
  7368. }
  7369. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  7370. value = +value
  7371. offset = offset | 0
  7372. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7373. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7374. this[offset] = (value & 0xff)
  7375. this[offset + 1] = (value >>> 8)
  7376. } else {
  7377. objectWriteUInt16(this, value, offset, true)
  7378. }
  7379. return offset + 2
  7380. }
  7381. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  7382. value = +value
  7383. offset = offset | 0
  7384. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7385. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7386. this[offset] = (value >>> 8)
  7387. this[offset + 1] = (value & 0xff)
  7388. } else {
  7389. objectWriteUInt16(this, value, offset, false)
  7390. }
  7391. return offset + 2
  7392. }
  7393. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  7394. value = +value
  7395. offset = offset | 0
  7396. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7397. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7398. this[offset] = (value & 0xff)
  7399. this[offset + 1] = (value >>> 8)
  7400. this[offset + 2] = (value >>> 16)
  7401. this[offset + 3] = (value >>> 24)
  7402. } else {
  7403. objectWriteUInt32(this, value, offset, true)
  7404. }
  7405. return offset + 4
  7406. }
  7407. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  7408. value = +value
  7409. offset = offset | 0
  7410. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7411. if (value < 0) value = 0xffffffff + value + 1
  7412. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7413. this[offset] = (value >>> 24)
  7414. this[offset + 1] = (value >>> 16)
  7415. this[offset + 2] = (value >>> 8)
  7416. this[offset + 3] = (value & 0xff)
  7417. } else {
  7418. objectWriteUInt32(this, value, offset, false)
  7419. }
  7420. return offset + 4
  7421. }
  7422. function checkIEEE754 (buf, value, offset, ext, max, min) {
  7423. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7424. if (offset < 0) throw new RangeError('Index out of range')
  7425. }
  7426. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  7427. if (!noAssert) {
  7428. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  7429. }
  7430. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  7431. return offset + 4
  7432. }
  7433. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  7434. return writeFloat(this, value, offset, true, noAssert)
  7435. }
  7436. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  7437. return writeFloat(this, value, offset, false, noAssert)
  7438. }
  7439. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  7440. if (!noAssert) {
  7441. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  7442. }
  7443. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  7444. return offset + 8
  7445. }
  7446. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  7447. return writeDouble(this, value, offset, true, noAssert)
  7448. }
  7449. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  7450. return writeDouble(this, value, offset, false, noAssert)
  7451. }
  7452. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  7453. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  7454. if (!start) start = 0
  7455. if (!end && end !== 0) end = this.length
  7456. if (targetStart >= target.length) targetStart = target.length
  7457. if (!targetStart) targetStart = 0
  7458. if (end > 0 && end < start) end = start
  7459. // Copy 0 bytes; we're done
  7460. if (end === start) return 0
  7461. if (target.length === 0 || this.length === 0) return 0
  7462. // Fatal error conditions
  7463. if (targetStart < 0) {
  7464. throw new RangeError('targetStart out of bounds')
  7465. }
  7466. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  7467. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  7468. // Are we oob?
  7469. if (end > this.length) end = this.length
  7470. if (target.length - targetStart < end - start) {
  7471. end = target.length - targetStart + start
  7472. }
  7473. var len = end - start
  7474. var i
  7475. if (this === target && start < targetStart && targetStart < end) {
  7476. // descending copy from end
  7477. for (i = len - 1; i >= 0; --i) {
  7478. target[i + targetStart] = this[i + start]
  7479. }
  7480. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  7481. // ascending copy from start
  7482. for (i = 0; i < len; ++i) {
  7483. target[i + targetStart] = this[i + start]
  7484. }
  7485. } else {
  7486. Uint8Array.prototype.set.call(
  7487. target,
  7488. this.subarray(start, start + len),
  7489. targetStart
  7490. )
  7491. }
  7492. return len
  7493. }
  7494. // Usage:
  7495. // buffer.fill(number[, offset[, end]])
  7496. // buffer.fill(buffer[, offset[, end]])
  7497. // buffer.fill(string[, offset[, end]][, encoding])
  7498. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  7499. // Handle string cases:
  7500. if (typeof val === 'string') {
  7501. if (typeof start === 'string') {
  7502. encoding = start
  7503. start = 0
  7504. end = this.length
  7505. } else if (typeof end === 'string') {
  7506. encoding = end
  7507. end = this.length
  7508. }
  7509. if (val.length === 1) {
  7510. var code = val.charCodeAt(0)
  7511. if (code < 256) {
  7512. val = code
  7513. }
  7514. }
  7515. if (encoding !== undefined && typeof encoding !== 'string') {
  7516. throw new TypeError('encoding must be a string')
  7517. }
  7518. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  7519. throw new TypeError('Unknown encoding: ' + encoding)
  7520. }
  7521. } else if (typeof val === 'number') {
  7522. val = val & 255
  7523. }
  7524. // Invalid ranges are not set to a default, so can range check early.
  7525. if (start < 0 || this.length < start || this.length < end) {
  7526. throw new RangeError('Out of range index')
  7527. }
  7528. if (end <= start) {
  7529. return this
  7530. }
  7531. start = start >>> 0
  7532. end = end === undefined ? this.length : end >>> 0
  7533. if (!val) val = 0
  7534. var i
  7535. if (typeof val === 'number') {
  7536. for (i = start; i < end; ++i) {
  7537. this[i] = val
  7538. }
  7539. } else {
  7540. var bytes = Buffer.isBuffer(val)
  7541. ? val
  7542. : utf8ToBytes(new Buffer(val, encoding).toString())
  7543. var len = bytes.length
  7544. for (i = 0; i < end - start; ++i) {
  7545. this[i + start] = bytes[i % len]
  7546. }
  7547. }
  7548. return this
  7549. }
  7550. // HELPER FUNCTIONS
  7551. // ================
  7552. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  7553. function base64clean (str) {
  7554. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  7555. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  7556. // Node converts strings with length < 2 to ''
  7557. if (str.length < 2) return ''
  7558. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  7559. while (str.length % 4 !== 0) {
  7560. str = str + '='
  7561. }
  7562. return str
  7563. }
  7564. function stringtrim (str) {
  7565. if (str.trim) return str.trim()
  7566. return str.replace(/^\s+|\s+$/g, '')
  7567. }
  7568. function toHex (n) {
  7569. if (n < 16) return '0' + n.toString(16)
  7570. return n.toString(16)
  7571. }
  7572. function utf8ToBytes (string, units) {
  7573. units = units || Infinity
  7574. var codePoint
  7575. var length = string.length
  7576. var leadSurrogate = null
  7577. var bytes = []
  7578. for (var i = 0; i < length; ++i) {
  7579. codePoint = string.charCodeAt(i)
  7580. // is surrogate component
  7581. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  7582. // last char was a lead
  7583. if (!leadSurrogate) {
  7584. // no lead yet
  7585. if (codePoint > 0xDBFF) {
  7586. // unexpected trail
  7587. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7588. continue
  7589. } else if (i + 1 === length) {
  7590. // unpaired lead
  7591. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7592. continue
  7593. }
  7594. // valid lead
  7595. leadSurrogate = codePoint
  7596. continue
  7597. }
  7598. // 2 leads in a row
  7599. if (codePoint < 0xDC00) {
  7600. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7601. leadSurrogate = codePoint
  7602. continue
  7603. }
  7604. // valid surrogate pair
  7605. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  7606. } else if (leadSurrogate) {
  7607. // valid bmp char, but last char was a lead
  7608. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7609. }
  7610. leadSurrogate = null
  7611. // encode utf8
  7612. if (codePoint < 0x80) {
  7613. if ((units -= 1) < 0) break
  7614. bytes.push(codePoint)
  7615. } else if (codePoint < 0x800) {
  7616. if ((units -= 2) < 0) break
  7617. bytes.push(
  7618. codePoint >> 0x6 | 0xC0,
  7619. codePoint & 0x3F | 0x80
  7620. )
  7621. } else if (codePoint < 0x10000) {
  7622. if ((units -= 3) < 0) break
  7623. bytes.push(
  7624. codePoint >> 0xC | 0xE0,
  7625. codePoint >> 0x6 & 0x3F | 0x80,
  7626. codePoint & 0x3F | 0x80
  7627. )
  7628. } else if (codePoint < 0x110000) {
  7629. if ((units -= 4) < 0) break
  7630. bytes.push(
  7631. codePoint >> 0x12 | 0xF0,
  7632. codePoint >> 0xC & 0x3F | 0x80,
  7633. codePoint >> 0x6 & 0x3F | 0x80,
  7634. codePoint & 0x3F | 0x80
  7635. )
  7636. } else {
  7637. throw new Error('Invalid code point')
  7638. }
  7639. }
  7640. return bytes
  7641. }
  7642. function asciiToBytes (str) {
  7643. var byteArray = []
  7644. for (var i = 0; i < str.length; ++i) {
  7645. // Node's code seems to be doing this and not & 0x7F..
  7646. byteArray.push(str.charCodeAt(i) & 0xFF)
  7647. }
  7648. return byteArray
  7649. }
  7650. function utf16leToBytes (str, units) {
  7651. var c, hi, lo
  7652. var byteArray = []
  7653. for (var i = 0; i < str.length; ++i) {
  7654. if ((units -= 2) < 0) break
  7655. c = str.charCodeAt(i)
  7656. hi = c >> 8
  7657. lo = c % 256
  7658. byteArray.push(lo)
  7659. byteArray.push(hi)
  7660. }
  7661. return byteArray
  7662. }
  7663. function base64ToBytes (str) {
  7664. return base64.toByteArray(base64clean(str))
  7665. }
  7666. function blitBuffer (src, dst, offset, length) {
  7667. for (var i = 0; i < length; ++i) {
  7668. if ((i + offset >= dst.length) || (i >= src.length)) break
  7669. dst[i + offset] = src[i]
  7670. }
  7671. return i
  7672. }
  7673. function isnan (val) {
  7674. return val !== val // eslint-disable-line no-self-compare
  7675. }
  7676. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  7677. /***/ }),
  7678. /***/ "./node_modules/clipboard/dist/clipboard.js":
  7679. /*!**************************************************!*\
  7680. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  7681. \**************************************************/
  7682. /*! no static exports found */
  7683. /***/ (function(module, exports, __webpack_require__) {
  7684. /*!
  7685. * clipboard.js v2.0.4
  7686. * https://zenorocha.github.io/clipboard.js
  7687. *
  7688. * Licensed MIT © Zeno Rocha
  7689. */
  7690. (function webpackUniversalModuleDefinition(root, factory) {
  7691. if(true)
  7692. module.exports = factory();
  7693. else {}
  7694. })(this, function() {
  7695. return /******/ (function(modules) { // webpackBootstrap
  7696. /******/ // The module cache
  7697. /******/ var installedModules = {};
  7698. /******/
  7699. /******/ // The require function
  7700. /******/ function __webpack_require__(moduleId) {
  7701. /******/
  7702. /******/ // Check if module is in cache
  7703. /******/ if(installedModules[moduleId]) {
  7704. /******/ return installedModules[moduleId].exports;
  7705. /******/ }
  7706. /******/ // Create a new module (and put it into the cache)
  7707. /******/ var module = installedModules[moduleId] = {
  7708. /******/ i: moduleId,
  7709. /******/ l: false,
  7710. /******/ exports: {}
  7711. /******/ };
  7712. /******/
  7713. /******/ // Execute the module function
  7714. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7715. /******/
  7716. /******/ // Flag the module as loaded
  7717. /******/ module.l = true;
  7718. /******/
  7719. /******/ // Return the exports of the module
  7720. /******/ return module.exports;
  7721. /******/ }
  7722. /******/
  7723. /******/
  7724. /******/ // expose the modules object (__webpack_modules__)
  7725. /******/ __webpack_require__.m = modules;
  7726. /******/
  7727. /******/ // expose the module cache
  7728. /******/ __webpack_require__.c = installedModules;
  7729. /******/
  7730. /******/ // define getter function for harmony exports
  7731. /******/ __webpack_require__.d = function(exports, name, getter) {
  7732. /******/ if(!__webpack_require__.o(exports, name)) {
  7733. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  7734. /******/ }
  7735. /******/ };
  7736. /******/
  7737. /******/ // define __esModule on exports
  7738. /******/ __webpack_require__.r = function(exports) {
  7739. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  7740. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  7741. /******/ }
  7742. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  7743. /******/ };
  7744. /******/
  7745. /******/ // create a fake namespace object
  7746. /******/ // mode & 1: value is a module id, require it
  7747. /******/ // mode & 2: merge all properties of value into the ns
  7748. /******/ // mode & 4: return value when already ns object
  7749. /******/ // mode & 8|1: behave like require
  7750. /******/ __webpack_require__.t = function(value, mode) {
  7751. /******/ if(mode & 1) value = __webpack_require__(value);
  7752. /******/ if(mode & 8) return value;
  7753. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  7754. /******/ var ns = Object.create(null);
  7755. /******/ __webpack_require__.r(ns);
  7756. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  7757. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  7758. /******/ return ns;
  7759. /******/ };
  7760. /******/
  7761. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7762. /******/ __webpack_require__.n = function(module) {
  7763. /******/ var getter = module && module.__esModule ?
  7764. /******/ function getDefault() { return module['default']; } :
  7765. /******/ function getModuleExports() { return module; };
  7766. /******/ __webpack_require__.d(getter, 'a', getter);
  7767. /******/ return getter;
  7768. /******/ };
  7769. /******/
  7770. /******/ // Object.prototype.hasOwnProperty.call
  7771. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  7772. /******/
  7773. /******/ // __webpack_public_path__
  7774. /******/ __webpack_require__.p = "";
  7775. /******/
  7776. /******/
  7777. /******/ // Load entry module and return exports
  7778. /******/ return __webpack_require__(__webpack_require__.s = 0);
  7779. /******/ })
  7780. /************************************************************************/
  7781. /******/ ([
  7782. /* 0 */
  7783. /***/ (function(module, exports, __webpack_require__) {
  7784. "use strict";
  7785. 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; };
  7786. 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; }; }();
  7787. var _clipboardAction = __webpack_require__(1);
  7788. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  7789. var _tinyEmitter = __webpack_require__(3);
  7790. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  7791. var _goodListener = __webpack_require__(4);
  7792. var _goodListener2 = _interopRequireDefault(_goodListener);
  7793. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7794. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7795. 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; }
  7796. 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; }
  7797. /**
  7798. * Base class which takes one or more elements, adds event listeners to them,
  7799. * and instantiates a new `ClipboardAction` on each click.
  7800. */
  7801. var Clipboard = function (_Emitter) {
  7802. _inherits(Clipboard, _Emitter);
  7803. /**
  7804. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7805. * @param {Object} options
  7806. */
  7807. function Clipboard(trigger, options) {
  7808. _classCallCheck(this, Clipboard);
  7809. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  7810. _this.resolveOptions(options);
  7811. _this.listenClick(trigger);
  7812. return _this;
  7813. }
  7814. /**
  7815. * Defines if attributes would be resolved using internal setter functions
  7816. * or custom functions that were passed in the constructor.
  7817. * @param {Object} options
  7818. */
  7819. _createClass(Clipboard, [{
  7820. key: 'resolveOptions',
  7821. value: function resolveOptions() {
  7822. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7823. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  7824. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  7825. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  7826. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  7827. }
  7828. /**
  7829. * Adds a click event listener to the passed trigger.
  7830. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7831. */
  7832. }, {
  7833. key: 'listenClick',
  7834. value: function listenClick(trigger) {
  7835. var _this2 = this;
  7836. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  7837. return _this2.onClick(e);
  7838. });
  7839. }
  7840. /**
  7841. * Defines a new `ClipboardAction` on each click event.
  7842. * @param {Event} e
  7843. */
  7844. }, {
  7845. key: 'onClick',
  7846. value: function onClick(e) {
  7847. var trigger = e.delegateTarget || e.currentTarget;
  7848. if (this.clipboardAction) {
  7849. this.clipboardAction = null;
  7850. }
  7851. this.clipboardAction = new _clipboardAction2.default({
  7852. action: this.action(trigger),
  7853. target: this.target(trigger),
  7854. text: this.text(trigger),
  7855. container: this.container,
  7856. trigger: trigger,
  7857. emitter: this
  7858. });
  7859. }
  7860. /**
  7861. * Default `action` lookup function.
  7862. * @param {Element} trigger
  7863. */
  7864. }, {
  7865. key: 'defaultAction',
  7866. value: function defaultAction(trigger) {
  7867. return getAttributeValue('action', trigger);
  7868. }
  7869. /**
  7870. * Default `target` lookup function.
  7871. * @param {Element} trigger
  7872. */
  7873. }, {
  7874. key: 'defaultTarget',
  7875. value: function defaultTarget(trigger) {
  7876. var selector = getAttributeValue('target', trigger);
  7877. if (selector) {
  7878. return document.querySelector(selector);
  7879. }
  7880. }
  7881. /**
  7882. * Returns the support of the given action, or all actions if no action is
  7883. * given.
  7884. * @param {String} [action]
  7885. */
  7886. }, {
  7887. key: 'defaultText',
  7888. /**
  7889. * Default `text` lookup function.
  7890. * @param {Element} trigger
  7891. */
  7892. value: function defaultText(trigger) {
  7893. return getAttributeValue('text', trigger);
  7894. }
  7895. /**
  7896. * Destroy lifecycle.
  7897. */
  7898. }, {
  7899. key: 'destroy',
  7900. value: function destroy() {
  7901. this.listener.destroy();
  7902. if (this.clipboardAction) {
  7903. this.clipboardAction.destroy();
  7904. this.clipboardAction = null;
  7905. }
  7906. }
  7907. }], [{
  7908. key: 'isSupported',
  7909. value: function isSupported() {
  7910. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  7911. var actions = typeof action === 'string' ? [action] : action;
  7912. var support = !!document.queryCommandSupported;
  7913. actions.forEach(function (action) {
  7914. support = support && !!document.queryCommandSupported(action);
  7915. });
  7916. return support;
  7917. }
  7918. }]);
  7919. return Clipboard;
  7920. }(_tinyEmitter2.default);
  7921. /**
  7922. * Helper function to retrieve attribute value.
  7923. * @param {String} suffix
  7924. * @param {Element} element
  7925. */
  7926. function getAttributeValue(suffix, element) {
  7927. var attribute = 'data-clipboard-' + suffix;
  7928. if (!element.hasAttribute(attribute)) {
  7929. return;
  7930. }
  7931. return element.getAttribute(attribute);
  7932. }
  7933. module.exports = Clipboard;
  7934. /***/ }),
  7935. /* 1 */
  7936. /***/ (function(module, exports, __webpack_require__) {
  7937. "use strict";
  7938. 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; };
  7939. 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; }; }();
  7940. var _select = __webpack_require__(2);
  7941. var _select2 = _interopRequireDefault(_select);
  7942. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7943. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7944. /**
  7945. * Inner class which performs selection from either `text` or `target`
  7946. * properties and then executes copy or cut operations.
  7947. */
  7948. var ClipboardAction = function () {
  7949. /**
  7950. * @param {Object} options
  7951. */
  7952. function ClipboardAction(options) {
  7953. _classCallCheck(this, ClipboardAction);
  7954. this.resolveOptions(options);
  7955. this.initSelection();
  7956. }
  7957. /**
  7958. * Defines base properties passed from constructor.
  7959. * @param {Object} options
  7960. */
  7961. _createClass(ClipboardAction, [{
  7962. key: 'resolveOptions',
  7963. value: function resolveOptions() {
  7964. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7965. this.action = options.action;
  7966. this.container = options.container;
  7967. this.emitter = options.emitter;
  7968. this.target = options.target;
  7969. this.text = options.text;
  7970. this.trigger = options.trigger;
  7971. this.selectedText = '';
  7972. }
  7973. /**
  7974. * Decides which selection strategy is going to be applied based
  7975. * on the existence of `text` and `target` properties.
  7976. */
  7977. }, {
  7978. key: 'initSelection',
  7979. value: function initSelection() {
  7980. if (this.text) {
  7981. this.selectFake();
  7982. } else if (this.target) {
  7983. this.selectTarget();
  7984. }
  7985. }
  7986. /**
  7987. * Creates a fake textarea element, sets its value from `text` property,
  7988. * and makes a selection on it.
  7989. */
  7990. }, {
  7991. key: 'selectFake',
  7992. value: function selectFake() {
  7993. var _this = this;
  7994. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  7995. this.removeFake();
  7996. this.fakeHandlerCallback = function () {
  7997. return _this.removeFake();
  7998. };
  7999. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  8000. this.fakeElem = document.createElement('textarea');
  8001. // Prevent zooming on iOS
  8002. this.fakeElem.style.fontSize = '12pt';
  8003. // Reset box model
  8004. this.fakeElem.style.border = '0';
  8005. this.fakeElem.style.padding = '0';
  8006. this.fakeElem.style.margin = '0';
  8007. // Move element out of screen horizontally
  8008. this.fakeElem.style.position = 'absolute';
  8009. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  8010. // Move element to the same position vertically
  8011. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  8012. this.fakeElem.style.top = yPosition + 'px';
  8013. this.fakeElem.setAttribute('readonly', '');
  8014. this.fakeElem.value = this.text;
  8015. this.container.appendChild(this.fakeElem);
  8016. this.selectedText = (0, _select2.default)(this.fakeElem);
  8017. this.copyText();
  8018. }
  8019. /**
  8020. * Only removes the fake element after another click event, that way
  8021. * a user can hit `Ctrl+C` to copy because selection still exists.
  8022. */
  8023. }, {
  8024. key: 'removeFake',
  8025. value: function removeFake() {
  8026. if (this.fakeHandler) {
  8027. this.container.removeEventListener('click', this.fakeHandlerCallback);
  8028. this.fakeHandler = null;
  8029. this.fakeHandlerCallback = null;
  8030. }
  8031. if (this.fakeElem) {
  8032. this.container.removeChild(this.fakeElem);
  8033. this.fakeElem = null;
  8034. }
  8035. }
  8036. /**
  8037. * Selects the content from element passed on `target` property.
  8038. */
  8039. }, {
  8040. key: 'selectTarget',
  8041. value: function selectTarget() {
  8042. this.selectedText = (0, _select2.default)(this.target);
  8043. this.copyText();
  8044. }
  8045. /**
  8046. * Executes the copy operation based on the current selection.
  8047. */
  8048. }, {
  8049. key: 'copyText',
  8050. value: function copyText() {
  8051. var succeeded = void 0;
  8052. try {
  8053. succeeded = document.execCommand(this.action);
  8054. } catch (err) {
  8055. succeeded = false;
  8056. }
  8057. this.handleResult(succeeded);
  8058. }
  8059. /**
  8060. * Fires an event based on the copy operation result.
  8061. * @param {Boolean} succeeded
  8062. */
  8063. }, {
  8064. key: 'handleResult',
  8065. value: function handleResult(succeeded) {
  8066. this.emitter.emit(succeeded ? 'success' : 'error', {
  8067. action: this.action,
  8068. text: this.selectedText,
  8069. trigger: this.trigger,
  8070. clearSelection: this.clearSelection.bind(this)
  8071. });
  8072. }
  8073. /**
  8074. * Moves focus away from `target` and back to the trigger, removes current selection.
  8075. */
  8076. }, {
  8077. key: 'clearSelection',
  8078. value: function clearSelection() {
  8079. if (this.trigger) {
  8080. this.trigger.focus();
  8081. }
  8082. window.getSelection().removeAllRanges();
  8083. }
  8084. /**
  8085. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  8086. * @param {String} action
  8087. */
  8088. }, {
  8089. key: 'destroy',
  8090. /**
  8091. * Destroy lifecycle.
  8092. */
  8093. value: function destroy() {
  8094. this.removeFake();
  8095. }
  8096. }, {
  8097. key: 'action',
  8098. set: function set() {
  8099. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  8100. this._action = action;
  8101. if (this._action !== 'copy' && this._action !== 'cut') {
  8102. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  8103. }
  8104. }
  8105. /**
  8106. * Gets the `action` property.
  8107. * @return {String}
  8108. */
  8109. ,
  8110. get: function get() {
  8111. return this._action;
  8112. }
  8113. /**
  8114. * Sets the `target` property using an element
  8115. * that will be have its content copied.
  8116. * @param {Element} target
  8117. */
  8118. }, {
  8119. key: 'target',
  8120. set: function set(target) {
  8121. if (target !== undefined) {
  8122. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  8123. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  8124. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  8125. }
  8126. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  8127. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  8128. }
  8129. this._target = target;
  8130. } else {
  8131. throw new Error('Invalid "target" value, use a valid Element');
  8132. }
  8133. }
  8134. }
  8135. /**
  8136. * Gets the `target` property.
  8137. * @return {String|HTMLElement}
  8138. */
  8139. ,
  8140. get: function get() {
  8141. return this._target;
  8142. }
  8143. }]);
  8144. return ClipboardAction;
  8145. }();
  8146. module.exports = ClipboardAction;
  8147. /***/ }),
  8148. /* 2 */
  8149. /***/ (function(module, exports) {
  8150. function select(element) {
  8151. var selectedText;
  8152. if (element.nodeName === 'SELECT') {
  8153. element.focus();
  8154. selectedText = element.value;
  8155. }
  8156. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  8157. var isReadOnly = element.hasAttribute('readonly');
  8158. if (!isReadOnly) {
  8159. element.setAttribute('readonly', '');
  8160. }
  8161. element.select();
  8162. element.setSelectionRange(0, element.value.length);
  8163. if (!isReadOnly) {
  8164. element.removeAttribute('readonly');
  8165. }
  8166. selectedText = element.value;
  8167. }
  8168. else {
  8169. if (element.hasAttribute('contenteditable')) {
  8170. element.focus();
  8171. }
  8172. var selection = window.getSelection();
  8173. var range = document.createRange();
  8174. range.selectNodeContents(element);
  8175. selection.removeAllRanges();
  8176. selection.addRange(range);
  8177. selectedText = selection.toString();
  8178. }
  8179. return selectedText;
  8180. }
  8181. module.exports = select;
  8182. /***/ }),
  8183. /* 3 */
  8184. /***/ (function(module, exports) {
  8185. function E () {
  8186. // Keep this empty so it's easier to inherit from
  8187. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  8188. }
  8189. E.prototype = {
  8190. on: function (name, callback, ctx) {
  8191. var e = this.e || (this.e = {});
  8192. (e[name] || (e[name] = [])).push({
  8193. fn: callback,
  8194. ctx: ctx
  8195. });
  8196. return this;
  8197. },
  8198. once: function (name, callback, ctx) {
  8199. var self = this;
  8200. function listener () {
  8201. self.off(name, listener);
  8202. callback.apply(ctx, arguments);
  8203. };
  8204. listener._ = callback
  8205. return this.on(name, listener, ctx);
  8206. },
  8207. emit: function (name) {
  8208. var data = [].slice.call(arguments, 1);
  8209. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  8210. var i = 0;
  8211. var len = evtArr.length;
  8212. for (i; i < len; i++) {
  8213. evtArr[i].fn.apply(evtArr[i].ctx, data);
  8214. }
  8215. return this;
  8216. },
  8217. off: function (name, callback) {
  8218. var e = this.e || (this.e = {});
  8219. var evts = e[name];
  8220. var liveEvents = [];
  8221. if (evts && callback) {
  8222. for (var i = 0, len = evts.length; i < len; i++) {
  8223. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  8224. liveEvents.push(evts[i]);
  8225. }
  8226. }
  8227. // Remove event from queue to prevent memory leak
  8228. // Suggested by https://github.com/lazd
  8229. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  8230. (liveEvents.length)
  8231. ? e[name] = liveEvents
  8232. : delete e[name];
  8233. return this;
  8234. }
  8235. };
  8236. module.exports = E;
  8237. /***/ }),
  8238. /* 4 */
  8239. /***/ (function(module, exports, __webpack_require__) {
  8240. var is = __webpack_require__(5);
  8241. var delegate = __webpack_require__(6);
  8242. /**
  8243. * Validates all params and calls the right
  8244. * listener function based on its target type.
  8245. *
  8246. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  8247. * @param {String} type
  8248. * @param {Function} callback
  8249. * @return {Object}
  8250. */
  8251. function listen(target, type, callback) {
  8252. if (!target && !type && !callback) {
  8253. throw new Error('Missing required arguments');
  8254. }
  8255. if (!is.string(type)) {
  8256. throw new TypeError('Second argument must be a String');
  8257. }
  8258. if (!is.fn(callback)) {
  8259. throw new TypeError('Third argument must be a Function');
  8260. }
  8261. if (is.node(target)) {
  8262. return listenNode(target, type, callback);
  8263. }
  8264. else if (is.nodeList(target)) {
  8265. return listenNodeList(target, type, callback);
  8266. }
  8267. else if (is.string(target)) {
  8268. return listenSelector(target, type, callback);
  8269. }
  8270. else {
  8271. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  8272. }
  8273. }
  8274. /**
  8275. * Adds an event listener to a HTML element
  8276. * and returns a remove listener function.
  8277. *
  8278. * @param {HTMLElement} node
  8279. * @param {String} type
  8280. * @param {Function} callback
  8281. * @return {Object}
  8282. */
  8283. function listenNode(node, type, callback) {
  8284. node.addEventListener(type, callback);
  8285. return {
  8286. destroy: function() {
  8287. node.removeEventListener(type, callback);
  8288. }
  8289. }
  8290. }
  8291. /**
  8292. * Add an event listener to a list of HTML elements
  8293. * and returns a remove listener function.
  8294. *
  8295. * @param {NodeList|HTMLCollection} nodeList
  8296. * @param {String} type
  8297. * @param {Function} callback
  8298. * @return {Object}
  8299. */
  8300. function listenNodeList(nodeList, type, callback) {
  8301. Array.prototype.forEach.call(nodeList, function(node) {
  8302. node.addEventListener(type, callback);
  8303. });
  8304. return {
  8305. destroy: function() {
  8306. Array.prototype.forEach.call(nodeList, function(node) {
  8307. node.removeEventListener(type, callback);
  8308. });
  8309. }
  8310. }
  8311. }
  8312. /**
  8313. * Add an event listener to a selector
  8314. * and returns a remove listener function.
  8315. *
  8316. * @param {String} selector
  8317. * @param {String} type
  8318. * @param {Function} callback
  8319. * @return {Object}
  8320. */
  8321. function listenSelector(selector, type, callback) {
  8322. return delegate(document.body, selector, type, callback);
  8323. }
  8324. module.exports = listen;
  8325. /***/ }),
  8326. /* 5 */
  8327. /***/ (function(module, exports) {
  8328. /**
  8329. * Check if argument is a HTML element.
  8330. *
  8331. * @param {Object} value
  8332. * @return {Boolean}
  8333. */
  8334. exports.node = function(value) {
  8335. return value !== undefined
  8336. && value instanceof HTMLElement
  8337. && value.nodeType === 1;
  8338. };
  8339. /**
  8340. * Check if argument is a list of HTML elements.
  8341. *
  8342. * @param {Object} value
  8343. * @return {Boolean}
  8344. */
  8345. exports.nodeList = function(value) {
  8346. var type = Object.prototype.toString.call(value);
  8347. return value !== undefined
  8348. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  8349. && ('length' in value)
  8350. && (value.length === 0 || exports.node(value[0]));
  8351. };
  8352. /**
  8353. * Check if argument is a string.
  8354. *
  8355. * @param {Object} value
  8356. * @return {Boolean}
  8357. */
  8358. exports.string = function(value) {
  8359. return typeof value === 'string'
  8360. || value instanceof String;
  8361. };
  8362. /**
  8363. * Check if argument is a function.
  8364. *
  8365. * @param {Object} value
  8366. * @return {Boolean}
  8367. */
  8368. exports.fn = function(value) {
  8369. var type = Object.prototype.toString.call(value);
  8370. return type === '[object Function]';
  8371. };
  8372. /***/ }),
  8373. /* 6 */
  8374. /***/ (function(module, exports, __webpack_require__) {
  8375. var closest = __webpack_require__(7);
  8376. /**
  8377. * Delegates event to a selector.
  8378. *
  8379. * @param {Element} element
  8380. * @param {String} selector
  8381. * @param {String} type
  8382. * @param {Function} callback
  8383. * @param {Boolean} useCapture
  8384. * @return {Object}
  8385. */
  8386. function _delegate(element, selector, type, callback, useCapture) {
  8387. var listenerFn = listener.apply(this, arguments);
  8388. element.addEventListener(type, listenerFn, useCapture);
  8389. return {
  8390. destroy: function() {
  8391. element.removeEventListener(type, listenerFn, useCapture);
  8392. }
  8393. }
  8394. }
  8395. /**
  8396. * Delegates event to a selector.
  8397. *
  8398. * @param {Element|String|Array} [elements]
  8399. * @param {String} selector
  8400. * @param {String} type
  8401. * @param {Function} callback
  8402. * @param {Boolean} useCapture
  8403. * @return {Object}
  8404. */
  8405. function delegate(elements, selector, type, callback, useCapture) {
  8406. // Handle the regular Element usage
  8407. if (typeof elements.addEventListener === 'function') {
  8408. return _delegate.apply(null, arguments);
  8409. }
  8410. // Handle Element-less usage, it defaults to global delegation
  8411. if (typeof type === 'function') {
  8412. // Use `document` as the first parameter, then apply arguments
  8413. // This is a short way to .unshift `arguments` without running into deoptimizations
  8414. return _delegate.bind(null, document).apply(null, arguments);
  8415. }
  8416. // Handle Selector-based usage
  8417. if (typeof elements === 'string') {
  8418. elements = document.querySelectorAll(elements);
  8419. }
  8420. // Handle Array-like based usage
  8421. return Array.prototype.map.call(elements, function (element) {
  8422. return _delegate(element, selector, type, callback, useCapture);
  8423. });
  8424. }
  8425. /**
  8426. * Finds closest match and invokes callback.
  8427. *
  8428. * @param {Element} element
  8429. * @param {String} selector
  8430. * @param {String} type
  8431. * @param {Function} callback
  8432. * @return {Function}
  8433. */
  8434. function listener(element, selector, type, callback) {
  8435. return function(e) {
  8436. e.delegateTarget = closest(e.target, selector);
  8437. if (e.delegateTarget) {
  8438. callback.call(element, e);
  8439. }
  8440. }
  8441. }
  8442. module.exports = delegate;
  8443. /***/ }),
  8444. /* 7 */
  8445. /***/ (function(module, exports) {
  8446. var DOCUMENT_NODE_TYPE = 9;
  8447. /**
  8448. * A polyfill for Element.matches()
  8449. */
  8450. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  8451. var proto = Element.prototype;
  8452. proto.matches = proto.matchesSelector ||
  8453. proto.mozMatchesSelector ||
  8454. proto.msMatchesSelector ||
  8455. proto.oMatchesSelector ||
  8456. proto.webkitMatchesSelector;
  8457. }
  8458. /**
  8459. * Finds the closest parent that matches a selector.
  8460. *
  8461. * @param {Element} element
  8462. * @param {String} selector
  8463. * @return {Function}
  8464. */
  8465. function closest (element, selector) {
  8466. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  8467. if (typeof element.matches === 'function' &&
  8468. element.matches(selector)) {
  8469. return element;
  8470. }
  8471. element = element.parentNode;
  8472. }
  8473. }
  8474. module.exports = closest;
  8475. /***/ })
  8476. /******/ ]);
  8477. });
  8478. /***/ }),
  8479. /***/ "./node_modules/ieee754/index.js":
  8480. /*!***************************************!*\
  8481. !*** ./node_modules/ieee754/index.js ***!
  8482. \***************************************/
  8483. /*! no static exports found */
  8484. /***/ (function(module, exports) {
  8485. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  8486. var e, m
  8487. var eLen = (nBytes * 8) - mLen - 1
  8488. var eMax = (1 << eLen) - 1
  8489. var eBias = eMax >> 1
  8490. var nBits = -7
  8491. var i = isLE ? (nBytes - 1) : 0
  8492. var d = isLE ? -1 : 1
  8493. var s = buffer[offset + i]
  8494. i += d
  8495. e = s & ((1 << (-nBits)) - 1)
  8496. s >>= (-nBits)
  8497. nBits += eLen
  8498. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8499. m = e & ((1 << (-nBits)) - 1)
  8500. e >>= (-nBits)
  8501. nBits += mLen
  8502. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8503. if (e === 0) {
  8504. e = 1 - eBias
  8505. } else if (e === eMax) {
  8506. return m ? NaN : ((s ? -1 : 1) * Infinity)
  8507. } else {
  8508. m = m + Math.pow(2, mLen)
  8509. e = e - eBias
  8510. }
  8511. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  8512. }
  8513. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  8514. var e, m, c
  8515. var eLen = (nBytes * 8) - mLen - 1
  8516. var eMax = (1 << eLen) - 1
  8517. var eBias = eMax >> 1
  8518. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  8519. var i = isLE ? 0 : (nBytes - 1)
  8520. var d = isLE ? 1 : -1
  8521. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  8522. value = Math.abs(value)
  8523. if (isNaN(value) || value === Infinity) {
  8524. m = isNaN(value) ? 1 : 0
  8525. e = eMax
  8526. } else {
  8527. e = Math.floor(Math.log(value) / Math.LN2)
  8528. if (value * (c = Math.pow(2, -e)) < 1) {
  8529. e--
  8530. c *= 2
  8531. }
  8532. if (e + eBias >= 1) {
  8533. value += rt / c
  8534. } else {
  8535. value += rt * Math.pow(2, 1 - eBias)
  8536. }
  8537. if (value * c >= 2) {
  8538. e++
  8539. c /= 2
  8540. }
  8541. if (e + eBias >= eMax) {
  8542. m = 0
  8543. e = eMax
  8544. } else if (e + eBias >= 1) {
  8545. m = ((value * c) - 1) * Math.pow(2, mLen)
  8546. e = e + eBias
  8547. } else {
  8548. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  8549. e = 0
  8550. }
  8551. }
  8552. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  8553. e = (e << mLen) | m
  8554. eLen += mLen
  8555. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  8556. buffer[offset + i - d] |= s * 128
  8557. }
  8558. /***/ }),
  8559. /***/ "./node_modules/isarray/index.js":
  8560. /*!***************************************!*\
  8561. !*** ./node_modules/isarray/index.js ***!
  8562. \***************************************/
  8563. /*! no static exports found */
  8564. /***/ (function(module, exports) {
  8565. var toString = {}.toString;
  8566. module.exports = Array.isArray || function (arr) {
  8567. return toString.call(arr) == '[object Array]';
  8568. };
  8569. /***/ }),
  8570. /***/ "./node_modules/jquery/dist/jquery.js":
  8571. /*!********************************************!*\
  8572. !*** ./node_modules/jquery/dist/jquery.js ***!
  8573. \********************************************/
  8574. /*! no static exports found */
  8575. /***/ (function(module, exports, __webpack_require__) {
  8576. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  8577. * jQuery JavaScript Library v3.4.1
  8578. * https://jquery.com/
  8579. *
  8580. * Includes Sizzle.js
  8581. * https://sizzlejs.com/
  8582. *
  8583. * Copyright JS Foundation and other contributors
  8584. * Released under the MIT license
  8585. * https://jquery.org/license
  8586. *
  8587. * Date: 2019-05-01T21:04Z
  8588. */
  8589. ( function( global, factory ) {
  8590. "use strict";
  8591. if ( true && typeof module.exports === "object" ) {
  8592. // For CommonJS and CommonJS-like environments where a proper `window`
  8593. // is present, execute the factory and get jQuery.
  8594. // For environments that do not have a `window` with a `document`
  8595. // (such as Node.js), expose a factory as module.exports.
  8596. // This accentuates the need for the creation of a real `window`.
  8597. // e.g. var jQuery = require("jquery")(window);
  8598. // See ticket #14549 for more info.
  8599. module.exports = global.document ?
  8600. factory( global, true ) :
  8601. function( w ) {
  8602. if ( !w.document ) {
  8603. throw new Error( "jQuery requires a window with a document" );
  8604. }
  8605. return factory( w );
  8606. };
  8607. } else {
  8608. factory( global );
  8609. }
  8610. // Pass this if window is not defined yet
  8611. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  8612. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  8613. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  8614. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  8615. // enough that all such attempts are guarded in a try block.
  8616. "use strict";
  8617. var arr = [];
  8618. var document = window.document;
  8619. var getProto = Object.getPrototypeOf;
  8620. var slice = arr.slice;
  8621. var concat = arr.concat;
  8622. var push = arr.push;
  8623. var indexOf = arr.indexOf;
  8624. var class2type = {};
  8625. var toString = class2type.toString;
  8626. var hasOwn = class2type.hasOwnProperty;
  8627. var fnToString = hasOwn.toString;
  8628. var ObjectFunctionString = fnToString.call( Object );
  8629. var support = {};
  8630. var isFunction = function isFunction( obj ) {
  8631. // Support: Chrome <=57, Firefox <=52
  8632. // In some browsers, typeof returns "function" for HTML <object> elements
  8633. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  8634. // We don't want to classify *any* DOM node as a function.
  8635. return typeof obj === "function" && typeof obj.nodeType !== "number";
  8636. };
  8637. var isWindow = function isWindow( obj ) {
  8638. return obj != null && obj === obj.window;
  8639. };
  8640. var preservedScriptAttributes = {
  8641. type: true,
  8642. src: true,
  8643. nonce: true,
  8644. noModule: true
  8645. };
  8646. function DOMEval( code, node, doc ) {
  8647. doc = doc || document;
  8648. var i, val,
  8649. script = doc.createElement( "script" );
  8650. script.text = code;
  8651. if ( node ) {
  8652. for ( i in preservedScriptAttributes ) {
  8653. // Support: Firefox 64+, Edge 18+
  8654. // Some browsers don't support the "nonce" property on scripts.
  8655. // On the other hand, just using `getAttribute` is not enough as
  8656. // the `nonce` attribute is reset to an empty string whenever it
  8657. // becomes browsing-context connected.
  8658. // See https://github.com/whatwg/html/issues/2369
  8659. // See https://html.spec.whatwg.org/#nonce-attributes
  8660. // The `node.getAttribute` check was added for the sake of
  8661. // `jQuery.globalEval` so that it can fake a nonce-containing node
  8662. // via an object.
  8663. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  8664. if ( val ) {
  8665. script.setAttribute( i, val );
  8666. }
  8667. }
  8668. }
  8669. doc.head.appendChild( script ).parentNode.removeChild( script );
  8670. }
  8671. function toType( obj ) {
  8672. if ( obj == null ) {
  8673. return obj + "";
  8674. }
  8675. // Support: Android <=2.3 only (functionish RegExp)
  8676. return typeof obj === "object" || typeof obj === "function" ?
  8677. class2type[ toString.call( obj ) ] || "object" :
  8678. typeof obj;
  8679. }
  8680. /* global Symbol */
  8681. // Defining this global in .eslintrc.json would create a danger of using the global
  8682. // unguarded in another place, it seems safer to define global only for this module
  8683. var
  8684. version = "3.4.1",
  8685. // Define a local copy of jQuery
  8686. jQuery = function( selector, context ) {
  8687. // The jQuery object is actually just the init constructor 'enhanced'
  8688. // Need init if jQuery is called (just allow error to be thrown if not included)
  8689. return new jQuery.fn.init( selector, context );
  8690. },
  8691. // Support: Android <=4.0 only
  8692. // Make sure we trim BOM and NBSP
  8693. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  8694. jQuery.fn = jQuery.prototype = {
  8695. // The current version of jQuery being used
  8696. jquery: version,
  8697. constructor: jQuery,
  8698. // The default length of a jQuery object is 0
  8699. length: 0,
  8700. toArray: function() {
  8701. return slice.call( this );
  8702. },
  8703. // Get the Nth element in the matched element set OR
  8704. // Get the whole matched element set as a clean array
  8705. get: function( num ) {
  8706. // Return all the elements in a clean array
  8707. if ( num == null ) {
  8708. return slice.call( this );
  8709. }
  8710. // Return just the one element from the set
  8711. return num < 0 ? this[ num + this.length ] : this[ num ];
  8712. },
  8713. // Take an array of elements and push it onto the stack
  8714. // (returning the new matched element set)
  8715. pushStack: function( elems ) {
  8716. // Build a new jQuery matched element set
  8717. var ret = jQuery.merge( this.constructor(), elems );
  8718. // Add the old object onto the stack (as a reference)
  8719. ret.prevObject = this;
  8720. // Return the newly-formed element set
  8721. return ret;
  8722. },
  8723. // Execute a callback for every element in the matched set.
  8724. each: function( callback ) {
  8725. return jQuery.each( this, callback );
  8726. },
  8727. map: function( callback ) {
  8728. return this.pushStack( jQuery.map( this, function( elem, i ) {
  8729. return callback.call( elem, i, elem );
  8730. } ) );
  8731. },
  8732. slice: function() {
  8733. return this.pushStack( slice.apply( this, arguments ) );
  8734. },
  8735. first: function() {
  8736. return this.eq( 0 );
  8737. },
  8738. last: function() {
  8739. return this.eq( -1 );
  8740. },
  8741. eq: function( i ) {
  8742. var len = this.length,
  8743. j = +i + ( i < 0 ? len : 0 );
  8744. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  8745. },
  8746. end: function() {
  8747. return this.prevObject || this.constructor();
  8748. },
  8749. // For internal use only.
  8750. // Behaves like an Array's method, not like a jQuery method.
  8751. push: push,
  8752. sort: arr.sort,
  8753. splice: arr.splice
  8754. };
  8755. jQuery.extend = jQuery.fn.extend = function() {
  8756. var options, name, src, copy, copyIsArray, clone,
  8757. target = arguments[ 0 ] || {},
  8758. i = 1,
  8759. length = arguments.length,
  8760. deep = false;
  8761. // Handle a deep copy situation
  8762. if ( typeof target === "boolean" ) {
  8763. deep = target;
  8764. // Skip the boolean and the target
  8765. target = arguments[ i ] || {};
  8766. i++;
  8767. }
  8768. // Handle case when target is a string or something (possible in deep copy)
  8769. if ( typeof target !== "object" && !isFunction( target ) ) {
  8770. target = {};
  8771. }
  8772. // Extend jQuery itself if only one argument is passed
  8773. if ( i === length ) {
  8774. target = this;
  8775. i--;
  8776. }
  8777. for ( ; i < length; i++ ) {
  8778. // Only deal with non-null/undefined values
  8779. if ( ( options = arguments[ i ] ) != null ) {
  8780. // Extend the base object
  8781. for ( name in options ) {
  8782. copy = options[ name ];
  8783. // Prevent Object.prototype pollution
  8784. // Prevent never-ending loop
  8785. if ( name === "__proto__" || target === copy ) {
  8786. continue;
  8787. }
  8788. // Recurse if we're merging plain objects or arrays
  8789. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  8790. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  8791. src = target[ name ];
  8792. // Ensure proper type for the source value
  8793. if ( copyIsArray && !Array.isArray( src ) ) {
  8794. clone = [];
  8795. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  8796. clone = {};
  8797. } else {
  8798. clone = src;
  8799. }
  8800. copyIsArray = false;
  8801. // Never move original objects, clone them
  8802. target[ name ] = jQuery.extend( deep, clone, copy );
  8803. // Don't bring in undefined values
  8804. } else if ( copy !== undefined ) {
  8805. target[ name ] = copy;
  8806. }
  8807. }
  8808. }
  8809. }
  8810. // Return the modified object
  8811. return target;
  8812. };
  8813. jQuery.extend( {
  8814. // Unique for each copy of jQuery on the page
  8815. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  8816. // Assume jQuery is ready without the ready module
  8817. isReady: true,
  8818. error: function( msg ) {
  8819. throw new Error( msg );
  8820. },
  8821. noop: function() {},
  8822. isPlainObject: function( obj ) {
  8823. var proto, Ctor;
  8824. // Detect obvious negatives
  8825. // Use toString instead of jQuery.type to catch host objects
  8826. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  8827. return false;
  8828. }
  8829. proto = getProto( obj );
  8830. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  8831. if ( !proto ) {
  8832. return true;
  8833. }
  8834. // Objects with prototype are plain iff they were constructed by a global Object function
  8835. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  8836. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  8837. },
  8838. isEmptyObject: function( obj ) {
  8839. var name;
  8840. for ( name in obj ) {
  8841. return false;
  8842. }
  8843. return true;
  8844. },
  8845. // Evaluates a script in a global context
  8846. globalEval: function( code, options ) {
  8847. DOMEval( code, { nonce: options && options.nonce } );
  8848. },
  8849. each: function( obj, callback ) {
  8850. var length, i = 0;
  8851. if ( isArrayLike( obj ) ) {
  8852. length = obj.length;
  8853. for ( ; i < length; i++ ) {
  8854. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8855. break;
  8856. }
  8857. }
  8858. } else {
  8859. for ( i in obj ) {
  8860. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8861. break;
  8862. }
  8863. }
  8864. }
  8865. return obj;
  8866. },
  8867. // Support: Android <=4.0 only
  8868. trim: function( text ) {
  8869. return text == null ?
  8870. "" :
  8871. ( text + "" ).replace( rtrim, "" );
  8872. },
  8873. // results is for internal usage only
  8874. makeArray: function( arr, results ) {
  8875. var ret = results || [];
  8876. if ( arr != null ) {
  8877. if ( isArrayLike( Object( arr ) ) ) {
  8878. jQuery.merge( ret,
  8879. typeof arr === "string" ?
  8880. [ arr ] : arr
  8881. );
  8882. } else {
  8883. push.call( ret, arr );
  8884. }
  8885. }
  8886. return ret;
  8887. },
  8888. inArray: function( elem, arr, i ) {
  8889. return arr == null ? -1 : indexOf.call( arr, elem, i );
  8890. },
  8891. // Support: Android <=4.0 only, PhantomJS 1 only
  8892. // push.apply(_, arraylike) throws on ancient WebKit
  8893. merge: function( first, second ) {
  8894. var len = +second.length,
  8895. j = 0,
  8896. i = first.length;
  8897. for ( ; j < len; j++ ) {
  8898. first[ i++ ] = second[ j ];
  8899. }
  8900. first.length = i;
  8901. return first;
  8902. },
  8903. grep: function( elems, callback, invert ) {
  8904. var callbackInverse,
  8905. matches = [],
  8906. i = 0,
  8907. length = elems.length,
  8908. callbackExpect = !invert;
  8909. // Go through the array, only saving the items
  8910. // that pass the validator function
  8911. for ( ; i < length; i++ ) {
  8912. callbackInverse = !callback( elems[ i ], i );
  8913. if ( callbackInverse !== callbackExpect ) {
  8914. matches.push( elems[ i ] );
  8915. }
  8916. }
  8917. return matches;
  8918. },
  8919. // arg is for internal usage only
  8920. map: function( elems, callback, arg ) {
  8921. var length, value,
  8922. i = 0,
  8923. ret = [];
  8924. // Go through the array, translating each of the items to their new values
  8925. if ( isArrayLike( elems ) ) {
  8926. length = elems.length;
  8927. for ( ; i < length; i++ ) {
  8928. value = callback( elems[ i ], i, arg );
  8929. if ( value != null ) {
  8930. ret.push( value );
  8931. }
  8932. }
  8933. // Go through every key on the object,
  8934. } else {
  8935. for ( i in elems ) {
  8936. value = callback( elems[ i ], i, arg );
  8937. if ( value != null ) {
  8938. ret.push( value );
  8939. }
  8940. }
  8941. }
  8942. // Flatten any nested arrays
  8943. return concat.apply( [], ret );
  8944. },
  8945. // A global GUID counter for objects
  8946. guid: 1,
  8947. // jQuery.support is not used in Core but other projects attach their
  8948. // properties to it so it needs to exist.
  8949. support: support
  8950. } );
  8951. if ( typeof Symbol === "function" ) {
  8952. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  8953. }
  8954. // Populate the class2type map
  8955. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  8956. function( i, name ) {
  8957. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  8958. } );
  8959. function isArrayLike( obj ) {
  8960. // Support: real iOS 8.2 only (not reproducible in simulator)
  8961. // `in` check used to prevent JIT error (gh-2145)
  8962. // hasOwn isn't used here due to false negatives
  8963. // regarding Nodelist length in IE
  8964. var length = !!obj && "length" in obj && obj.length,
  8965. type = toType( obj );
  8966. if ( isFunction( obj ) || isWindow( obj ) ) {
  8967. return false;
  8968. }
  8969. return type === "array" || length === 0 ||
  8970. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  8971. }
  8972. var Sizzle =
  8973. /*!
  8974. * Sizzle CSS Selector Engine v2.3.4
  8975. * https://sizzlejs.com/
  8976. *
  8977. * Copyright JS Foundation and other contributors
  8978. * Released under the MIT license
  8979. * https://js.foundation/
  8980. *
  8981. * Date: 2019-04-08
  8982. */
  8983. (function( window ) {
  8984. var i,
  8985. support,
  8986. Expr,
  8987. getText,
  8988. isXML,
  8989. tokenize,
  8990. compile,
  8991. select,
  8992. outermostContext,
  8993. sortInput,
  8994. hasDuplicate,
  8995. // Local document vars
  8996. setDocument,
  8997. document,
  8998. docElem,
  8999. documentIsHTML,
  9000. rbuggyQSA,
  9001. rbuggyMatches,
  9002. matches,
  9003. contains,
  9004. // Instance-specific data
  9005. expando = "sizzle" + 1 * new Date(),
  9006. preferredDoc = window.document,
  9007. dirruns = 0,
  9008. done = 0,
  9009. classCache = createCache(),
  9010. tokenCache = createCache(),
  9011. compilerCache = createCache(),
  9012. nonnativeSelectorCache = createCache(),
  9013. sortOrder = function( a, b ) {
  9014. if ( a === b ) {
  9015. hasDuplicate = true;
  9016. }
  9017. return 0;
  9018. },
  9019. // Instance methods
  9020. hasOwn = ({}).hasOwnProperty,
  9021. arr = [],
  9022. pop = arr.pop,
  9023. push_native = arr.push,
  9024. push = arr.push,
  9025. slice = arr.slice,
  9026. // Use a stripped-down indexOf as it's faster than native
  9027. // https://jsperf.com/thor-indexof-vs-for/5
  9028. indexOf = function( list, elem ) {
  9029. var i = 0,
  9030. len = list.length;
  9031. for ( ; i < len; i++ ) {
  9032. if ( list[i] === elem ) {
  9033. return i;
  9034. }
  9035. }
  9036. return -1;
  9037. },
  9038. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  9039. // Regular expressions
  9040. // http://www.w3.org/TR/css3-selectors/#whitespace
  9041. whitespace = "[\\x20\\t\\r\\n\\f]",
  9042. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  9043. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  9044. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  9045. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  9046. // Operator (capture 2)
  9047. "*([*^$|!~]?=)" + whitespace +
  9048. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  9049. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  9050. "*\\]",
  9051. pseudos = ":(" + identifier + ")(?:\\((" +
  9052. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  9053. // 1. quoted (capture 3; capture 4 or capture 5)
  9054. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  9055. // 2. simple (capture 6)
  9056. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  9057. // 3. anything else (capture 2)
  9058. ".*" +
  9059. ")\\)|)",
  9060. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  9061. rwhitespace = new RegExp( whitespace + "+", "g" ),
  9062. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  9063. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  9064. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  9065. rdescend = new RegExp( whitespace + "|>" ),
  9066. rpseudo = new RegExp( pseudos ),
  9067. ridentifier = new RegExp( "^" + identifier + "$" ),
  9068. matchExpr = {
  9069. "ID": new RegExp( "^#(" + identifier + ")" ),
  9070. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  9071. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  9072. "ATTR": new RegExp( "^" + attributes ),
  9073. "PSEUDO": new RegExp( "^" + pseudos ),
  9074. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  9075. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  9076. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  9077. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  9078. // For use in libraries implementing .is()
  9079. // We use this for POS matching in `select`
  9080. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  9081. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  9082. },
  9083. rhtml = /HTML$/i,
  9084. rinputs = /^(?:input|select|textarea|button)$/i,
  9085. rheader = /^h\d$/i,
  9086. rnative = /^[^{]+\{\s*\[native \w/,
  9087. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  9088. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  9089. rsibling = /[+~]/,
  9090. // CSS escapes
  9091. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  9092. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  9093. funescape = function( _, escaped, escapedWhitespace ) {
  9094. var high = "0x" + escaped - 0x10000;
  9095. // NaN means non-codepoint
  9096. // Support: Firefox<24
  9097. // Workaround erroneous numeric interpretation of +"0x"
  9098. return high !== high || escapedWhitespace ?
  9099. escaped :
  9100. high < 0 ?
  9101. // BMP codepoint
  9102. String.fromCharCode( high + 0x10000 ) :
  9103. // Supplemental Plane codepoint (surrogate pair)
  9104. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  9105. },
  9106. // CSS string/identifier serialization
  9107. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  9108. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  9109. fcssescape = function( ch, asCodePoint ) {
  9110. if ( asCodePoint ) {
  9111. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  9112. if ( ch === "\0" ) {
  9113. return "\uFFFD";
  9114. }
  9115. // Control characters and (dependent upon position) numbers get escaped as code points
  9116. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  9117. }
  9118. // Other potentially-special ASCII characters get backslash-escaped
  9119. return "\\" + ch;
  9120. },
  9121. // Used for iframes
  9122. // See setDocument()
  9123. // Removing the function wrapper causes a "Permission Denied"
  9124. // error in IE
  9125. unloadHandler = function() {
  9126. setDocument();
  9127. },
  9128. inDisabledFieldset = addCombinator(
  9129. function( elem ) {
  9130. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  9131. },
  9132. { dir: "parentNode", next: "legend" }
  9133. );
  9134. // Optimize for push.apply( _, NodeList )
  9135. try {
  9136. push.apply(
  9137. (arr = slice.call( preferredDoc.childNodes )),
  9138. preferredDoc.childNodes
  9139. );
  9140. // Support: Android<4.0
  9141. // Detect silently failing push.apply
  9142. arr[ preferredDoc.childNodes.length ].nodeType;
  9143. } catch ( e ) {
  9144. push = { apply: arr.length ?
  9145. // Leverage slice if possible
  9146. function( target, els ) {
  9147. push_native.apply( target, slice.call(els) );
  9148. } :
  9149. // Support: IE<9
  9150. // Otherwise append directly
  9151. function( target, els ) {
  9152. var j = target.length,
  9153. i = 0;
  9154. // Can't trust NodeList.length
  9155. while ( (target[j++] = els[i++]) ) {}
  9156. target.length = j - 1;
  9157. }
  9158. };
  9159. }
  9160. function Sizzle( selector, context, results, seed ) {
  9161. var m, i, elem, nid, match, groups, newSelector,
  9162. newContext = context && context.ownerDocument,
  9163. // nodeType defaults to 9, since context defaults to document
  9164. nodeType = context ? context.nodeType : 9;
  9165. results = results || [];
  9166. // Return early from calls with invalid selector or context
  9167. if ( typeof selector !== "string" || !selector ||
  9168. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  9169. return results;
  9170. }
  9171. // Try to shortcut find operations (as opposed to filters) in HTML documents
  9172. if ( !seed ) {
  9173. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  9174. setDocument( context );
  9175. }
  9176. context = context || document;
  9177. if ( documentIsHTML ) {
  9178. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  9179. // (excepting DocumentFragment context, where the methods don't exist)
  9180. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  9181. // ID selector
  9182. if ( (m = match[1]) ) {
  9183. // Document context
  9184. if ( nodeType === 9 ) {
  9185. if ( (elem = context.getElementById( m )) ) {
  9186. // Support: IE, Opera, Webkit
  9187. // TODO: identify versions
  9188. // getElementById can match elements by name instead of ID
  9189. if ( elem.id === m ) {
  9190. results.push( elem );
  9191. return results;
  9192. }
  9193. } else {
  9194. return results;
  9195. }
  9196. // Element context
  9197. } else {
  9198. // Support: IE, Opera, Webkit
  9199. // TODO: identify versions
  9200. // getElementById can match elements by name instead of ID
  9201. if ( newContext && (elem = newContext.getElementById( m )) &&
  9202. contains( context, elem ) &&
  9203. elem.id === m ) {
  9204. results.push( elem );
  9205. return results;
  9206. }
  9207. }
  9208. // Type selector
  9209. } else if ( match[2] ) {
  9210. push.apply( results, context.getElementsByTagName( selector ) );
  9211. return results;
  9212. // Class selector
  9213. } else if ( (m = match[3]) && support.getElementsByClassName &&
  9214. context.getElementsByClassName ) {
  9215. push.apply( results, context.getElementsByClassName( m ) );
  9216. return results;
  9217. }
  9218. }
  9219. // Take advantage of querySelectorAll
  9220. if ( support.qsa &&
  9221. !nonnativeSelectorCache[ selector + " " ] &&
  9222. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  9223. // Support: IE 8 only
  9224. // Exclude object elements
  9225. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  9226. newSelector = selector;
  9227. newContext = context;
  9228. // qSA considers elements outside a scoping root when evaluating child or
  9229. // descendant combinators, which is not what we want.
  9230. // In such cases, we work around the behavior by prefixing every selector in the
  9231. // list with an ID selector referencing the scope context.
  9232. // Thanks to Andrew Dupont for this technique.
  9233. if ( nodeType === 1 && rdescend.test( selector ) ) {
  9234. // Capture the context ID, setting it first if necessary
  9235. if ( (nid = context.getAttribute( "id" )) ) {
  9236. nid = nid.replace( rcssescape, fcssescape );
  9237. } else {
  9238. context.setAttribute( "id", (nid = expando) );
  9239. }
  9240. // Prefix every selector in the list
  9241. groups = tokenize( selector );
  9242. i = groups.length;
  9243. while ( i-- ) {
  9244. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  9245. }
  9246. newSelector = groups.join( "," );
  9247. // Expand context for sibling selectors
  9248. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  9249. context;
  9250. }
  9251. try {
  9252. push.apply( results,
  9253. newContext.querySelectorAll( newSelector )
  9254. );
  9255. return results;
  9256. } catch ( qsaError ) {
  9257. nonnativeSelectorCache( selector, true );
  9258. } finally {
  9259. if ( nid === expando ) {
  9260. context.removeAttribute( "id" );
  9261. }
  9262. }
  9263. }
  9264. }
  9265. }
  9266. // All others
  9267. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  9268. }
  9269. /**
  9270. * Create key-value caches of limited size
  9271. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  9272. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  9273. * deleting the oldest entry
  9274. */
  9275. function createCache() {
  9276. var keys = [];
  9277. function cache( key, value ) {
  9278. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  9279. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  9280. // Only keep the most recent entries
  9281. delete cache[ keys.shift() ];
  9282. }
  9283. return (cache[ key + " " ] = value);
  9284. }
  9285. return cache;
  9286. }
  9287. /**
  9288. * Mark a function for special use by Sizzle
  9289. * @param {Function} fn The function to mark
  9290. */
  9291. function markFunction( fn ) {
  9292. fn[ expando ] = true;
  9293. return fn;
  9294. }
  9295. /**
  9296. * Support testing using an element
  9297. * @param {Function} fn Passed the created element and returns a boolean result
  9298. */
  9299. function assert( fn ) {
  9300. var el = document.createElement("fieldset");
  9301. try {
  9302. return !!fn( el );
  9303. } catch (e) {
  9304. return false;
  9305. } finally {
  9306. // Remove from its parent by default
  9307. if ( el.parentNode ) {
  9308. el.parentNode.removeChild( el );
  9309. }
  9310. // release memory in IE
  9311. el = null;
  9312. }
  9313. }
  9314. /**
  9315. * Adds the same handler for all of the specified attrs
  9316. * @param {String} attrs Pipe-separated list of attributes
  9317. * @param {Function} handler The method that will be applied
  9318. */
  9319. function addHandle( attrs, handler ) {
  9320. var arr = attrs.split("|"),
  9321. i = arr.length;
  9322. while ( i-- ) {
  9323. Expr.attrHandle[ arr[i] ] = handler;
  9324. }
  9325. }
  9326. /**
  9327. * Checks document order of two siblings
  9328. * @param {Element} a
  9329. * @param {Element} b
  9330. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  9331. */
  9332. function siblingCheck( a, b ) {
  9333. var cur = b && a,
  9334. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  9335. a.sourceIndex - b.sourceIndex;
  9336. // Use IE sourceIndex if available on both nodes
  9337. if ( diff ) {
  9338. return diff;
  9339. }
  9340. // Check if b follows a
  9341. if ( cur ) {
  9342. while ( (cur = cur.nextSibling) ) {
  9343. if ( cur === b ) {
  9344. return -1;
  9345. }
  9346. }
  9347. }
  9348. return a ? 1 : -1;
  9349. }
  9350. /**
  9351. * Returns a function to use in pseudos for input types
  9352. * @param {String} type
  9353. */
  9354. function createInputPseudo( type ) {
  9355. return function( elem ) {
  9356. var name = elem.nodeName.toLowerCase();
  9357. return name === "input" && elem.type === type;
  9358. };
  9359. }
  9360. /**
  9361. * Returns a function to use in pseudos for buttons
  9362. * @param {String} type
  9363. */
  9364. function createButtonPseudo( type ) {
  9365. return function( elem ) {
  9366. var name = elem.nodeName.toLowerCase();
  9367. return (name === "input" || name === "button") && elem.type === type;
  9368. };
  9369. }
  9370. /**
  9371. * Returns a function to use in pseudos for :enabled/:disabled
  9372. * @param {Boolean} disabled true for :disabled; false for :enabled
  9373. */
  9374. function createDisabledPseudo( disabled ) {
  9375. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  9376. return function( elem ) {
  9377. // Only certain elements can match :enabled or :disabled
  9378. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  9379. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  9380. if ( "form" in elem ) {
  9381. // Check for inherited disabledness on relevant non-disabled elements:
  9382. // * listed form-associated elements in a disabled fieldset
  9383. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  9384. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  9385. // * option elements in a disabled optgroup
  9386. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  9387. // All such elements have a "form" property.
  9388. if ( elem.parentNode && elem.disabled === false ) {
  9389. // Option elements defer to a parent optgroup if present
  9390. if ( "label" in elem ) {
  9391. if ( "label" in elem.parentNode ) {
  9392. return elem.parentNode.disabled === disabled;
  9393. } else {
  9394. return elem.disabled === disabled;
  9395. }
  9396. }
  9397. // Support: IE 6 - 11
  9398. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  9399. return elem.isDisabled === disabled ||
  9400. // Where there is no isDisabled, check manually
  9401. /* jshint -W018 */
  9402. elem.isDisabled !== !disabled &&
  9403. inDisabledFieldset( elem ) === disabled;
  9404. }
  9405. return elem.disabled === disabled;
  9406. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  9407. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  9408. // even exist on them, let alone have a boolean value.
  9409. } else if ( "label" in elem ) {
  9410. return elem.disabled === disabled;
  9411. }
  9412. // Remaining elements are neither :enabled nor :disabled
  9413. return false;
  9414. };
  9415. }
  9416. /**
  9417. * Returns a function to use in pseudos for positionals
  9418. * @param {Function} fn
  9419. */
  9420. function createPositionalPseudo( fn ) {
  9421. return markFunction(function( argument ) {
  9422. argument = +argument;
  9423. return markFunction(function( seed, matches ) {
  9424. var j,
  9425. matchIndexes = fn( [], seed.length, argument ),
  9426. i = matchIndexes.length;
  9427. // Match elements found at the specified indexes
  9428. while ( i-- ) {
  9429. if ( seed[ (j = matchIndexes[i]) ] ) {
  9430. seed[j] = !(matches[j] = seed[j]);
  9431. }
  9432. }
  9433. });
  9434. });
  9435. }
  9436. /**
  9437. * Checks a node for validity as a Sizzle context
  9438. * @param {Element|Object=} context
  9439. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  9440. */
  9441. function testContext( context ) {
  9442. return context && typeof context.getElementsByTagName !== "undefined" && context;
  9443. }
  9444. // Expose support vars for convenience
  9445. support = Sizzle.support = {};
  9446. /**
  9447. * Detects XML nodes
  9448. * @param {Element|Object} elem An element or a document
  9449. * @returns {Boolean} True iff elem is a non-HTML XML node
  9450. */
  9451. isXML = Sizzle.isXML = function( elem ) {
  9452. var namespace = elem.namespaceURI,
  9453. docElem = (elem.ownerDocument || elem).documentElement;
  9454. // Support: IE <=8
  9455. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  9456. // https://bugs.jquery.com/ticket/4833
  9457. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  9458. };
  9459. /**
  9460. * Sets document-related variables once based on the current document
  9461. * @param {Element|Object} [doc] An element or document object to use to set the document
  9462. * @returns {Object} Returns the current document
  9463. */
  9464. setDocument = Sizzle.setDocument = function( node ) {
  9465. var hasCompare, subWindow,
  9466. doc = node ? node.ownerDocument || node : preferredDoc;
  9467. // Return early if doc is invalid or already selected
  9468. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  9469. return document;
  9470. }
  9471. // Update global variables
  9472. document = doc;
  9473. docElem = document.documentElement;
  9474. documentIsHTML = !isXML( document );
  9475. // Support: IE 9-11, Edge
  9476. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  9477. if ( preferredDoc !== document &&
  9478. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  9479. // Support: IE 11, Edge
  9480. if ( subWindow.addEventListener ) {
  9481. subWindow.addEventListener( "unload", unloadHandler, false );
  9482. // Support: IE 9 - 10 only
  9483. } else if ( subWindow.attachEvent ) {
  9484. subWindow.attachEvent( "onunload", unloadHandler );
  9485. }
  9486. }
  9487. /* Attributes
  9488. ---------------------------------------------------------------------- */
  9489. // Support: IE<8
  9490. // Verify that getAttribute really returns attributes and not properties
  9491. // (excepting IE8 booleans)
  9492. support.attributes = assert(function( el ) {
  9493. el.className = "i";
  9494. return !el.getAttribute("className");
  9495. });
  9496. /* getElement(s)By*
  9497. ---------------------------------------------------------------------- */
  9498. // Check if getElementsByTagName("*") returns only elements
  9499. support.getElementsByTagName = assert(function( el ) {
  9500. el.appendChild( document.createComment("") );
  9501. return !el.getElementsByTagName("*").length;
  9502. });
  9503. // Support: IE<9
  9504. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  9505. // Support: IE<10
  9506. // Check if getElementById returns elements by name
  9507. // The broken getElementById methods don't pick up programmatically-set names,
  9508. // so use a roundabout getElementsByName test
  9509. support.getById = assert(function( el ) {
  9510. docElem.appendChild( el ).id = expando;
  9511. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  9512. });
  9513. // ID filter and find
  9514. if ( support.getById ) {
  9515. Expr.filter["ID"] = function( id ) {
  9516. var attrId = id.replace( runescape, funescape );
  9517. return function( elem ) {
  9518. return elem.getAttribute("id") === attrId;
  9519. };
  9520. };
  9521. Expr.find["ID"] = function( id, context ) {
  9522. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9523. var elem = context.getElementById( id );
  9524. return elem ? [ elem ] : [];
  9525. }
  9526. };
  9527. } else {
  9528. Expr.filter["ID"] = function( id ) {
  9529. var attrId = id.replace( runescape, funescape );
  9530. return function( elem ) {
  9531. var node = typeof elem.getAttributeNode !== "undefined" &&
  9532. elem.getAttributeNode("id");
  9533. return node && node.value === attrId;
  9534. };
  9535. };
  9536. // Support: IE 6 - 7 only
  9537. // getElementById is not reliable as a find shortcut
  9538. Expr.find["ID"] = function( id, context ) {
  9539. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9540. var node, i, elems,
  9541. elem = context.getElementById( id );
  9542. if ( elem ) {
  9543. // Verify the id attribute
  9544. node = elem.getAttributeNode("id");
  9545. if ( node && node.value === id ) {
  9546. return [ elem ];
  9547. }
  9548. // Fall back on getElementsByName
  9549. elems = context.getElementsByName( id );
  9550. i = 0;
  9551. while ( (elem = elems[i++]) ) {
  9552. node = elem.getAttributeNode("id");
  9553. if ( node && node.value === id ) {
  9554. return [ elem ];
  9555. }
  9556. }
  9557. }
  9558. return [];
  9559. }
  9560. };
  9561. }
  9562. // Tag
  9563. Expr.find["TAG"] = support.getElementsByTagName ?
  9564. function( tag, context ) {
  9565. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9566. return context.getElementsByTagName( tag );
  9567. // DocumentFragment nodes don't have gEBTN
  9568. } else if ( support.qsa ) {
  9569. return context.querySelectorAll( tag );
  9570. }
  9571. } :
  9572. function( tag, context ) {
  9573. var elem,
  9574. tmp = [],
  9575. i = 0,
  9576. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  9577. results = context.getElementsByTagName( tag );
  9578. // Filter out possible comments
  9579. if ( tag === "*" ) {
  9580. while ( (elem = results[i++]) ) {
  9581. if ( elem.nodeType === 1 ) {
  9582. tmp.push( elem );
  9583. }
  9584. }
  9585. return tmp;
  9586. }
  9587. return results;
  9588. };
  9589. // Class
  9590. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  9591. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  9592. return context.getElementsByClassName( className );
  9593. }
  9594. };
  9595. /* QSA/matchesSelector
  9596. ---------------------------------------------------------------------- */
  9597. // QSA and matchesSelector support
  9598. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  9599. rbuggyMatches = [];
  9600. // qSa(:focus) reports false when true (Chrome 21)
  9601. // We allow this because of a bug in IE8/9 that throws an error
  9602. // whenever `document.activeElement` is accessed on an iframe
  9603. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  9604. // See https://bugs.jquery.com/ticket/13378
  9605. rbuggyQSA = [];
  9606. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  9607. // Build QSA regex
  9608. // Regex strategy adopted from Diego Perini
  9609. assert(function( el ) {
  9610. // Select is set to empty string on purpose
  9611. // This is to test IE's treatment of not explicitly
  9612. // setting a boolean content attribute,
  9613. // since its presence should be enough
  9614. // https://bugs.jquery.com/ticket/12359
  9615. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  9616. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  9617. "<option selected=''></option></select>";
  9618. // Support: IE8, Opera 11-12.16
  9619. // Nothing should be selected when empty strings follow ^= or $= or *=
  9620. // The test attribute must be unknown in Opera but "safe" for WinRT
  9621. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  9622. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  9623. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  9624. }
  9625. // Support: IE8
  9626. // Boolean attributes and "value" are not treated correctly
  9627. if ( !el.querySelectorAll("[selected]").length ) {
  9628. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  9629. }
  9630. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  9631. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  9632. rbuggyQSA.push("~=");
  9633. }
  9634. // Webkit/Opera - :checked should return selected option elements
  9635. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9636. // IE8 throws error here and will not see later tests
  9637. if ( !el.querySelectorAll(":checked").length ) {
  9638. rbuggyQSA.push(":checked");
  9639. }
  9640. // Support: Safari 8+, iOS 8+
  9641. // https://bugs.webkit.org/show_bug.cgi?id=136851
  9642. // In-page `selector#id sibling-combinator selector` fails
  9643. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  9644. rbuggyQSA.push(".#.+[+~]");
  9645. }
  9646. });
  9647. assert(function( el ) {
  9648. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  9649. "<select disabled='disabled'><option/></select>";
  9650. // Support: Windows 8 Native Apps
  9651. // The type and name attributes are restricted during .innerHTML assignment
  9652. var input = document.createElement("input");
  9653. input.setAttribute( "type", "hidden" );
  9654. el.appendChild( input ).setAttribute( "name", "D" );
  9655. // Support: IE8
  9656. // Enforce case-sensitivity of name attribute
  9657. if ( el.querySelectorAll("[name=d]").length ) {
  9658. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  9659. }
  9660. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  9661. // IE8 throws error here and will not see later tests
  9662. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  9663. rbuggyQSA.push( ":enabled", ":disabled" );
  9664. }
  9665. // Support: IE9-11+
  9666. // IE's :disabled selector does not pick up the children of disabled fieldsets
  9667. docElem.appendChild( el ).disabled = true;
  9668. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  9669. rbuggyQSA.push( ":enabled", ":disabled" );
  9670. }
  9671. // Opera 10-11 does not throw on post-comma invalid pseudos
  9672. el.querySelectorAll("*,:x");
  9673. rbuggyQSA.push(",.*:");
  9674. });
  9675. }
  9676. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  9677. docElem.webkitMatchesSelector ||
  9678. docElem.mozMatchesSelector ||
  9679. docElem.oMatchesSelector ||
  9680. docElem.msMatchesSelector) )) ) {
  9681. assert(function( el ) {
  9682. // Check to see if it's possible to do matchesSelector
  9683. // on a disconnected node (IE 9)
  9684. support.disconnectedMatch = matches.call( el, "*" );
  9685. // This should fail with an exception
  9686. // Gecko does not error, returns false instead
  9687. matches.call( el, "[s!='']:x" );
  9688. rbuggyMatches.push( "!=", pseudos );
  9689. });
  9690. }
  9691. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  9692. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  9693. /* Contains
  9694. ---------------------------------------------------------------------- */
  9695. hasCompare = rnative.test( docElem.compareDocumentPosition );
  9696. // Element contains another
  9697. // Purposefully self-exclusive
  9698. // As in, an element does not contain itself
  9699. contains = hasCompare || rnative.test( docElem.contains ) ?
  9700. function( a, b ) {
  9701. var adown = a.nodeType === 9 ? a.documentElement : a,
  9702. bup = b && b.parentNode;
  9703. return a === bup || !!( bup && bup.nodeType === 1 && (
  9704. adown.contains ?
  9705. adown.contains( bup ) :
  9706. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  9707. ));
  9708. } :
  9709. function( a, b ) {
  9710. if ( b ) {
  9711. while ( (b = b.parentNode) ) {
  9712. if ( b === a ) {
  9713. return true;
  9714. }
  9715. }
  9716. }
  9717. return false;
  9718. };
  9719. /* Sorting
  9720. ---------------------------------------------------------------------- */
  9721. // Document order sorting
  9722. sortOrder = hasCompare ?
  9723. function( a, b ) {
  9724. // Flag for duplicate removal
  9725. if ( a === b ) {
  9726. hasDuplicate = true;
  9727. return 0;
  9728. }
  9729. // Sort on method existence if only one input has compareDocumentPosition
  9730. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  9731. if ( compare ) {
  9732. return compare;
  9733. }
  9734. // Calculate position if both inputs belong to the same document
  9735. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  9736. a.compareDocumentPosition( b ) :
  9737. // Otherwise we know they are disconnected
  9738. 1;
  9739. // Disconnected nodes
  9740. if ( compare & 1 ||
  9741. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  9742. // Choose the first element that is related to our preferred document
  9743. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  9744. return -1;
  9745. }
  9746. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  9747. return 1;
  9748. }
  9749. // Maintain original order
  9750. return sortInput ?
  9751. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9752. 0;
  9753. }
  9754. return compare & 4 ? -1 : 1;
  9755. } :
  9756. function( a, b ) {
  9757. // Exit early if the nodes are identical
  9758. if ( a === b ) {
  9759. hasDuplicate = true;
  9760. return 0;
  9761. }
  9762. var cur,
  9763. i = 0,
  9764. aup = a.parentNode,
  9765. bup = b.parentNode,
  9766. ap = [ a ],
  9767. bp = [ b ];
  9768. // Parentless nodes are either documents or disconnected
  9769. if ( !aup || !bup ) {
  9770. return a === document ? -1 :
  9771. b === document ? 1 :
  9772. aup ? -1 :
  9773. bup ? 1 :
  9774. sortInput ?
  9775. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9776. 0;
  9777. // If the nodes are siblings, we can do a quick check
  9778. } else if ( aup === bup ) {
  9779. return siblingCheck( a, b );
  9780. }
  9781. // Otherwise we need full lists of their ancestors for comparison
  9782. cur = a;
  9783. while ( (cur = cur.parentNode) ) {
  9784. ap.unshift( cur );
  9785. }
  9786. cur = b;
  9787. while ( (cur = cur.parentNode) ) {
  9788. bp.unshift( cur );
  9789. }
  9790. // Walk down the tree looking for a discrepancy
  9791. while ( ap[i] === bp[i] ) {
  9792. i++;
  9793. }
  9794. return i ?
  9795. // Do a sibling check if the nodes have a common ancestor
  9796. siblingCheck( ap[i], bp[i] ) :
  9797. // Otherwise nodes in our document sort first
  9798. ap[i] === preferredDoc ? -1 :
  9799. bp[i] === preferredDoc ? 1 :
  9800. 0;
  9801. };
  9802. return document;
  9803. };
  9804. Sizzle.matches = function( expr, elements ) {
  9805. return Sizzle( expr, null, null, elements );
  9806. };
  9807. Sizzle.matchesSelector = function( elem, expr ) {
  9808. // Set document vars if needed
  9809. if ( ( elem.ownerDocument || elem ) !== document ) {
  9810. setDocument( elem );
  9811. }
  9812. if ( support.matchesSelector && documentIsHTML &&
  9813. !nonnativeSelectorCache[ expr + " " ] &&
  9814. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  9815. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  9816. try {
  9817. var ret = matches.call( elem, expr );
  9818. // IE 9's matchesSelector returns false on disconnected nodes
  9819. if ( ret || support.disconnectedMatch ||
  9820. // As well, disconnected nodes are said to be in a document
  9821. // fragment in IE 9
  9822. elem.document && elem.document.nodeType !== 11 ) {
  9823. return ret;
  9824. }
  9825. } catch (e) {
  9826. nonnativeSelectorCache( expr, true );
  9827. }
  9828. }
  9829. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  9830. };
  9831. Sizzle.contains = function( context, elem ) {
  9832. // Set document vars if needed
  9833. if ( ( context.ownerDocument || context ) !== document ) {
  9834. setDocument( context );
  9835. }
  9836. return contains( context, elem );
  9837. };
  9838. Sizzle.attr = function( elem, name ) {
  9839. // Set document vars if needed
  9840. if ( ( elem.ownerDocument || elem ) !== document ) {
  9841. setDocument( elem );
  9842. }
  9843. var fn = Expr.attrHandle[ name.toLowerCase() ],
  9844. // Don't get fooled by Object.prototype properties (jQuery #13807)
  9845. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  9846. fn( elem, name, !documentIsHTML ) :
  9847. undefined;
  9848. return val !== undefined ?
  9849. val :
  9850. support.attributes || !documentIsHTML ?
  9851. elem.getAttribute( name ) :
  9852. (val = elem.getAttributeNode(name)) && val.specified ?
  9853. val.value :
  9854. null;
  9855. };
  9856. Sizzle.escape = function( sel ) {
  9857. return (sel + "").replace( rcssescape, fcssescape );
  9858. };
  9859. Sizzle.error = function( msg ) {
  9860. throw new Error( "Syntax error, unrecognized expression: " + msg );
  9861. };
  9862. /**
  9863. * Document sorting and removing duplicates
  9864. * @param {ArrayLike} results
  9865. */
  9866. Sizzle.uniqueSort = function( results ) {
  9867. var elem,
  9868. duplicates = [],
  9869. j = 0,
  9870. i = 0;
  9871. // Unless we *know* we can detect duplicates, assume their presence
  9872. hasDuplicate = !support.detectDuplicates;
  9873. sortInput = !support.sortStable && results.slice( 0 );
  9874. results.sort( sortOrder );
  9875. if ( hasDuplicate ) {
  9876. while ( (elem = results[i++]) ) {
  9877. if ( elem === results[ i ] ) {
  9878. j = duplicates.push( i );
  9879. }
  9880. }
  9881. while ( j-- ) {
  9882. results.splice( duplicates[ j ], 1 );
  9883. }
  9884. }
  9885. // Clear input after sorting to release objects
  9886. // See https://github.com/jquery/sizzle/pull/225
  9887. sortInput = null;
  9888. return results;
  9889. };
  9890. /**
  9891. * Utility function for retrieving the text value of an array of DOM nodes
  9892. * @param {Array|Element} elem
  9893. */
  9894. getText = Sizzle.getText = function( elem ) {
  9895. var node,
  9896. ret = "",
  9897. i = 0,
  9898. nodeType = elem.nodeType;
  9899. if ( !nodeType ) {
  9900. // If no nodeType, this is expected to be an array
  9901. while ( (node = elem[i++]) ) {
  9902. // Do not traverse comment nodes
  9903. ret += getText( node );
  9904. }
  9905. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  9906. // Use textContent for elements
  9907. // innerText usage removed for consistency of new lines (jQuery #11153)
  9908. if ( typeof elem.textContent === "string" ) {
  9909. return elem.textContent;
  9910. } else {
  9911. // Traverse its children
  9912. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9913. ret += getText( elem );
  9914. }
  9915. }
  9916. } else if ( nodeType === 3 || nodeType === 4 ) {
  9917. return elem.nodeValue;
  9918. }
  9919. // Do not include comment or processing instruction nodes
  9920. return ret;
  9921. };
  9922. Expr = Sizzle.selectors = {
  9923. // Can be adjusted by the user
  9924. cacheLength: 50,
  9925. createPseudo: markFunction,
  9926. match: matchExpr,
  9927. attrHandle: {},
  9928. find: {},
  9929. relative: {
  9930. ">": { dir: "parentNode", first: true },
  9931. " ": { dir: "parentNode" },
  9932. "+": { dir: "previousSibling", first: true },
  9933. "~": { dir: "previousSibling" }
  9934. },
  9935. preFilter: {
  9936. "ATTR": function( match ) {
  9937. match[1] = match[1].replace( runescape, funescape );
  9938. // Move the given value to match[3] whether quoted or unquoted
  9939. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  9940. if ( match[2] === "~=" ) {
  9941. match[3] = " " + match[3] + " ";
  9942. }
  9943. return match.slice( 0, 4 );
  9944. },
  9945. "CHILD": function( match ) {
  9946. /* matches from matchExpr["CHILD"]
  9947. 1 type (only|nth|...)
  9948. 2 what (child|of-type)
  9949. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  9950. 4 xn-component of xn+y argument ([+-]?\d*n|)
  9951. 5 sign of xn-component
  9952. 6 x of xn-component
  9953. 7 sign of y-component
  9954. 8 y of y-component
  9955. */
  9956. match[1] = match[1].toLowerCase();
  9957. if ( match[1].slice( 0, 3 ) === "nth" ) {
  9958. // nth-* requires argument
  9959. if ( !match[3] ) {
  9960. Sizzle.error( match[0] );
  9961. }
  9962. // numeric x and y parameters for Expr.filter.CHILD
  9963. // remember that false/true cast respectively to 0/1
  9964. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  9965. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  9966. // other types prohibit arguments
  9967. } else if ( match[3] ) {
  9968. Sizzle.error( match[0] );
  9969. }
  9970. return match;
  9971. },
  9972. "PSEUDO": function( match ) {
  9973. var excess,
  9974. unquoted = !match[6] && match[2];
  9975. if ( matchExpr["CHILD"].test( match[0] ) ) {
  9976. return null;
  9977. }
  9978. // Accept quoted arguments as-is
  9979. if ( match[3] ) {
  9980. match[2] = match[4] || match[5] || "";
  9981. // Strip excess characters from unquoted arguments
  9982. } else if ( unquoted && rpseudo.test( unquoted ) &&
  9983. // Get excess from tokenize (recursively)
  9984. (excess = tokenize( unquoted, true )) &&
  9985. // advance to the next closing parenthesis
  9986. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  9987. // excess is a negative index
  9988. match[0] = match[0].slice( 0, excess );
  9989. match[2] = unquoted.slice( 0, excess );
  9990. }
  9991. // Return only captures needed by the pseudo filter method (type and argument)
  9992. return match.slice( 0, 3 );
  9993. }
  9994. },
  9995. filter: {
  9996. "TAG": function( nodeNameSelector ) {
  9997. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  9998. return nodeNameSelector === "*" ?
  9999. function() { return true; } :
  10000. function( elem ) {
  10001. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  10002. };
  10003. },
  10004. "CLASS": function( className ) {
  10005. var pattern = classCache[ className + " " ];
  10006. return pattern ||
  10007. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  10008. classCache( className, function( elem ) {
  10009. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  10010. });
  10011. },
  10012. "ATTR": function( name, operator, check ) {
  10013. return function( elem ) {
  10014. var result = Sizzle.attr( elem, name );
  10015. if ( result == null ) {
  10016. return operator === "!=";
  10017. }
  10018. if ( !operator ) {
  10019. return true;
  10020. }
  10021. result += "";
  10022. return operator === "=" ? result === check :
  10023. operator === "!=" ? result !== check :
  10024. operator === "^=" ? check && result.indexOf( check ) === 0 :
  10025. operator === "*=" ? check && result.indexOf( check ) > -1 :
  10026. operator === "$=" ? check && result.slice( -check.length ) === check :
  10027. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  10028. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  10029. false;
  10030. };
  10031. },
  10032. "CHILD": function( type, what, argument, first, last ) {
  10033. var simple = type.slice( 0, 3 ) !== "nth",
  10034. forward = type.slice( -4 ) !== "last",
  10035. ofType = what === "of-type";
  10036. return first === 1 && last === 0 ?
  10037. // Shortcut for :nth-*(n)
  10038. function( elem ) {
  10039. return !!elem.parentNode;
  10040. } :
  10041. function( elem, context, xml ) {
  10042. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  10043. dir = simple !== forward ? "nextSibling" : "previousSibling",
  10044. parent = elem.parentNode,
  10045. name = ofType && elem.nodeName.toLowerCase(),
  10046. useCache = !xml && !ofType,
  10047. diff = false;
  10048. if ( parent ) {
  10049. // :(first|last|only)-(child|of-type)
  10050. if ( simple ) {
  10051. while ( dir ) {
  10052. node = elem;
  10053. while ( (node = node[ dir ]) ) {
  10054. if ( ofType ?
  10055. node.nodeName.toLowerCase() === name :
  10056. node.nodeType === 1 ) {
  10057. return false;
  10058. }
  10059. }
  10060. // Reverse direction for :only-* (if we haven't yet done so)
  10061. start = dir = type === "only" && !start && "nextSibling";
  10062. }
  10063. return true;
  10064. }
  10065. start = [ forward ? parent.firstChild : parent.lastChild ];
  10066. // non-xml :nth-child(...) stores cache data on `parent`
  10067. if ( forward && useCache ) {
  10068. // Seek `elem` from a previously-cached index
  10069. // ...in a gzip-friendly way
  10070. node = parent;
  10071. outerCache = node[ expando ] || (node[ expando ] = {});
  10072. // Support: IE <9 only
  10073. // Defend against cloned attroperties (jQuery gh-1709)
  10074. uniqueCache = outerCache[ node.uniqueID ] ||
  10075. (outerCache[ node.uniqueID ] = {});
  10076. cache = uniqueCache[ type ] || [];
  10077. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10078. diff = nodeIndex && cache[ 2 ];
  10079. node = nodeIndex && parent.childNodes[ nodeIndex ];
  10080. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10081. // Fallback to seeking `elem` from the start
  10082. (diff = nodeIndex = 0) || start.pop()) ) {
  10083. // When found, cache indexes on `parent` and break
  10084. if ( node.nodeType === 1 && ++diff && node === elem ) {
  10085. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  10086. break;
  10087. }
  10088. }
  10089. } else {
  10090. // Use previously-cached element index if available
  10091. if ( useCache ) {
  10092. // ...in a gzip-friendly way
  10093. node = elem;
  10094. outerCache = node[ expando ] || (node[ expando ] = {});
  10095. // Support: IE <9 only
  10096. // Defend against cloned attroperties (jQuery gh-1709)
  10097. uniqueCache = outerCache[ node.uniqueID ] ||
  10098. (outerCache[ node.uniqueID ] = {});
  10099. cache = uniqueCache[ type ] || [];
  10100. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10101. diff = nodeIndex;
  10102. }
  10103. // xml :nth-child(...)
  10104. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  10105. if ( diff === false ) {
  10106. // Use the same loop as above to seek `elem` from the start
  10107. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10108. (diff = nodeIndex = 0) || start.pop()) ) {
  10109. if ( ( ofType ?
  10110. node.nodeName.toLowerCase() === name :
  10111. node.nodeType === 1 ) &&
  10112. ++diff ) {
  10113. // Cache the index of each encountered element
  10114. if ( useCache ) {
  10115. outerCache = node[ expando ] || (node[ expando ] = {});
  10116. // Support: IE <9 only
  10117. // Defend against cloned attroperties (jQuery gh-1709)
  10118. uniqueCache = outerCache[ node.uniqueID ] ||
  10119. (outerCache[ node.uniqueID ] = {});
  10120. uniqueCache[ type ] = [ dirruns, diff ];
  10121. }
  10122. if ( node === elem ) {
  10123. break;
  10124. }
  10125. }
  10126. }
  10127. }
  10128. }
  10129. // Incorporate the offset, then check against cycle size
  10130. diff -= last;
  10131. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  10132. }
  10133. };
  10134. },
  10135. "PSEUDO": function( pseudo, argument ) {
  10136. // pseudo-class names are case-insensitive
  10137. // http://www.w3.org/TR/selectors/#pseudo-classes
  10138. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  10139. // Remember that setFilters inherits from pseudos
  10140. var args,
  10141. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  10142. Sizzle.error( "unsupported pseudo: " + pseudo );
  10143. // The user may use createPseudo to indicate that
  10144. // arguments are needed to create the filter function
  10145. // just as Sizzle does
  10146. if ( fn[ expando ] ) {
  10147. return fn( argument );
  10148. }
  10149. // But maintain support for old signatures
  10150. if ( fn.length > 1 ) {
  10151. args = [ pseudo, pseudo, "", argument ];
  10152. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  10153. markFunction(function( seed, matches ) {
  10154. var idx,
  10155. matched = fn( seed, argument ),
  10156. i = matched.length;
  10157. while ( i-- ) {
  10158. idx = indexOf( seed, matched[i] );
  10159. seed[ idx ] = !( matches[ idx ] = matched[i] );
  10160. }
  10161. }) :
  10162. function( elem ) {
  10163. return fn( elem, 0, args );
  10164. };
  10165. }
  10166. return fn;
  10167. }
  10168. },
  10169. pseudos: {
  10170. // Potentially complex pseudos
  10171. "not": markFunction(function( selector ) {
  10172. // Trim the selector passed to compile
  10173. // to avoid treating leading and trailing
  10174. // spaces as combinators
  10175. var input = [],
  10176. results = [],
  10177. matcher = compile( selector.replace( rtrim, "$1" ) );
  10178. return matcher[ expando ] ?
  10179. markFunction(function( seed, matches, context, xml ) {
  10180. var elem,
  10181. unmatched = matcher( seed, null, xml, [] ),
  10182. i = seed.length;
  10183. // Match elements unmatched by `matcher`
  10184. while ( i-- ) {
  10185. if ( (elem = unmatched[i]) ) {
  10186. seed[i] = !(matches[i] = elem);
  10187. }
  10188. }
  10189. }) :
  10190. function( elem, context, xml ) {
  10191. input[0] = elem;
  10192. matcher( input, null, xml, results );
  10193. // Don't keep the element (issue #299)
  10194. input[0] = null;
  10195. return !results.pop();
  10196. };
  10197. }),
  10198. "has": markFunction(function( selector ) {
  10199. return function( elem ) {
  10200. return Sizzle( selector, elem ).length > 0;
  10201. };
  10202. }),
  10203. "contains": markFunction(function( text ) {
  10204. text = text.replace( runescape, funescape );
  10205. return function( elem ) {
  10206. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  10207. };
  10208. }),
  10209. // "Whether an element is represented by a :lang() selector
  10210. // is based solely on the element's language value
  10211. // being equal to the identifier C,
  10212. // or beginning with the identifier C immediately followed by "-".
  10213. // The matching of C against the element's language value is performed case-insensitively.
  10214. // The identifier C does not have to be a valid language name."
  10215. // http://www.w3.org/TR/selectors/#lang-pseudo
  10216. "lang": markFunction( function( lang ) {
  10217. // lang value must be a valid identifier
  10218. if ( !ridentifier.test(lang || "") ) {
  10219. Sizzle.error( "unsupported lang: " + lang );
  10220. }
  10221. lang = lang.replace( runescape, funescape ).toLowerCase();
  10222. return function( elem ) {
  10223. var elemLang;
  10224. do {
  10225. if ( (elemLang = documentIsHTML ?
  10226. elem.lang :
  10227. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  10228. elemLang = elemLang.toLowerCase();
  10229. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  10230. }
  10231. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  10232. return false;
  10233. };
  10234. }),
  10235. // Miscellaneous
  10236. "target": function( elem ) {
  10237. var hash = window.location && window.location.hash;
  10238. return hash && hash.slice( 1 ) === elem.id;
  10239. },
  10240. "root": function( elem ) {
  10241. return elem === docElem;
  10242. },
  10243. "focus": function( elem ) {
  10244. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  10245. },
  10246. // Boolean properties
  10247. "enabled": createDisabledPseudo( false ),
  10248. "disabled": createDisabledPseudo( true ),
  10249. "checked": function( elem ) {
  10250. // In CSS3, :checked should return both checked and selected elements
  10251. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  10252. var nodeName = elem.nodeName.toLowerCase();
  10253. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  10254. },
  10255. "selected": function( elem ) {
  10256. // Accessing this property makes selected-by-default
  10257. // options in Safari work properly
  10258. if ( elem.parentNode ) {
  10259. elem.parentNode.selectedIndex;
  10260. }
  10261. return elem.selected === true;
  10262. },
  10263. // Contents
  10264. "empty": function( elem ) {
  10265. // http://www.w3.org/TR/selectors/#empty-pseudo
  10266. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  10267. // but not by others (comment: 8; processing instruction: 7; etc.)
  10268. // nodeType < 6 works because attributes (2) do not appear as children
  10269. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10270. if ( elem.nodeType < 6 ) {
  10271. return false;
  10272. }
  10273. }
  10274. return true;
  10275. },
  10276. "parent": function( elem ) {
  10277. return !Expr.pseudos["empty"]( elem );
  10278. },
  10279. // Element/input types
  10280. "header": function( elem ) {
  10281. return rheader.test( elem.nodeName );
  10282. },
  10283. "input": function( elem ) {
  10284. return rinputs.test( elem.nodeName );
  10285. },
  10286. "button": function( elem ) {
  10287. var name = elem.nodeName.toLowerCase();
  10288. return name === "input" && elem.type === "button" || name === "button";
  10289. },
  10290. "text": function( elem ) {
  10291. var attr;
  10292. return elem.nodeName.toLowerCase() === "input" &&
  10293. elem.type === "text" &&
  10294. // Support: IE<8
  10295. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  10296. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  10297. },
  10298. // Position-in-collection
  10299. "first": createPositionalPseudo(function() {
  10300. return [ 0 ];
  10301. }),
  10302. "last": createPositionalPseudo(function( matchIndexes, length ) {
  10303. return [ length - 1 ];
  10304. }),
  10305. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10306. return [ argument < 0 ? argument + length : argument ];
  10307. }),
  10308. "even": createPositionalPseudo(function( matchIndexes, length ) {
  10309. var i = 0;
  10310. for ( ; i < length; i += 2 ) {
  10311. matchIndexes.push( i );
  10312. }
  10313. return matchIndexes;
  10314. }),
  10315. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  10316. var i = 1;
  10317. for ( ; i < length; i += 2 ) {
  10318. matchIndexes.push( i );
  10319. }
  10320. return matchIndexes;
  10321. }),
  10322. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10323. var i = argument < 0 ?
  10324. argument + length :
  10325. argument > length ?
  10326. length :
  10327. argument;
  10328. for ( ; --i >= 0; ) {
  10329. matchIndexes.push( i );
  10330. }
  10331. return matchIndexes;
  10332. }),
  10333. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10334. var i = argument < 0 ? argument + length : argument;
  10335. for ( ; ++i < length; ) {
  10336. matchIndexes.push( i );
  10337. }
  10338. return matchIndexes;
  10339. })
  10340. }
  10341. };
  10342. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  10343. // Add button/input type pseudos
  10344. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  10345. Expr.pseudos[ i ] = createInputPseudo( i );
  10346. }
  10347. for ( i in { submit: true, reset: true } ) {
  10348. Expr.pseudos[ i ] = createButtonPseudo( i );
  10349. }
  10350. // Easy API for creating new setFilters
  10351. function setFilters() {}
  10352. setFilters.prototype = Expr.filters = Expr.pseudos;
  10353. Expr.setFilters = new setFilters();
  10354. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  10355. var matched, match, tokens, type,
  10356. soFar, groups, preFilters,
  10357. cached = tokenCache[ selector + " " ];
  10358. if ( cached ) {
  10359. return parseOnly ? 0 : cached.slice( 0 );
  10360. }
  10361. soFar = selector;
  10362. groups = [];
  10363. preFilters = Expr.preFilter;
  10364. while ( soFar ) {
  10365. // Comma and first run
  10366. if ( !matched || (match = rcomma.exec( soFar )) ) {
  10367. if ( match ) {
  10368. // Don't consume trailing commas as valid
  10369. soFar = soFar.slice( match[0].length ) || soFar;
  10370. }
  10371. groups.push( (tokens = []) );
  10372. }
  10373. matched = false;
  10374. // Combinators
  10375. if ( (match = rcombinators.exec( soFar )) ) {
  10376. matched = match.shift();
  10377. tokens.push({
  10378. value: matched,
  10379. // Cast descendant combinators to space
  10380. type: match[0].replace( rtrim, " " )
  10381. });
  10382. soFar = soFar.slice( matched.length );
  10383. }
  10384. // Filters
  10385. for ( type in Expr.filter ) {
  10386. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  10387. (match = preFilters[ type ]( match ))) ) {
  10388. matched = match.shift();
  10389. tokens.push({
  10390. value: matched,
  10391. type: type,
  10392. matches: match
  10393. });
  10394. soFar = soFar.slice( matched.length );
  10395. }
  10396. }
  10397. if ( !matched ) {
  10398. break;
  10399. }
  10400. }
  10401. // Return the length of the invalid excess
  10402. // if we're just parsing
  10403. // Otherwise, throw an error or return tokens
  10404. return parseOnly ?
  10405. soFar.length :
  10406. soFar ?
  10407. Sizzle.error( selector ) :
  10408. // Cache the tokens
  10409. tokenCache( selector, groups ).slice( 0 );
  10410. };
  10411. function toSelector( tokens ) {
  10412. var i = 0,
  10413. len = tokens.length,
  10414. selector = "";
  10415. for ( ; i < len; i++ ) {
  10416. selector += tokens[i].value;
  10417. }
  10418. return selector;
  10419. }
  10420. function addCombinator( matcher, combinator, base ) {
  10421. var dir = combinator.dir,
  10422. skip = combinator.next,
  10423. key = skip || dir,
  10424. checkNonElements = base && key === "parentNode",
  10425. doneName = done++;
  10426. return combinator.first ?
  10427. // Check against closest ancestor/preceding element
  10428. function( elem, context, xml ) {
  10429. while ( (elem = elem[ dir ]) ) {
  10430. if ( elem.nodeType === 1 || checkNonElements ) {
  10431. return matcher( elem, context, xml );
  10432. }
  10433. }
  10434. return false;
  10435. } :
  10436. // Check against all ancestor/preceding elements
  10437. function( elem, context, xml ) {
  10438. var oldCache, uniqueCache, outerCache,
  10439. newCache = [ dirruns, doneName ];
  10440. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  10441. if ( xml ) {
  10442. while ( (elem = elem[ dir ]) ) {
  10443. if ( elem.nodeType === 1 || checkNonElements ) {
  10444. if ( matcher( elem, context, xml ) ) {
  10445. return true;
  10446. }
  10447. }
  10448. }
  10449. } else {
  10450. while ( (elem = elem[ dir ]) ) {
  10451. if ( elem.nodeType === 1 || checkNonElements ) {
  10452. outerCache = elem[ expando ] || (elem[ expando ] = {});
  10453. // Support: IE <9 only
  10454. // Defend against cloned attroperties (jQuery gh-1709)
  10455. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  10456. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  10457. elem = elem[ dir ] || elem;
  10458. } else if ( (oldCache = uniqueCache[ key ]) &&
  10459. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  10460. // Assign to newCache so results back-propagate to previous elements
  10461. return (newCache[ 2 ] = oldCache[ 2 ]);
  10462. } else {
  10463. // Reuse newcache so results back-propagate to previous elements
  10464. uniqueCache[ key ] = newCache;
  10465. // A match means we're done; a fail means we have to keep checking
  10466. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  10467. return true;
  10468. }
  10469. }
  10470. }
  10471. }
  10472. }
  10473. return false;
  10474. };
  10475. }
  10476. function elementMatcher( matchers ) {
  10477. return matchers.length > 1 ?
  10478. function( elem, context, xml ) {
  10479. var i = matchers.length;
  10480. while ( i-- ) {
  10481. if ( !matchers[i]( elem, context, xml ) ) {
  10482. return false;
  10483. }
  10484. }
  10485. return true;
  10486. } :
  10487. matchers[0];
  10488. }
  10489. function multipleContexts( selector, contexts, results ) {
  10490. var i = 0,
  10491. len = contexts.length;
  10492. for ( ; i < len; i++ ) {
  10493. Sizzle( selector, contexts[i], results );
  10494. }
  10495. return results;
  10496. }
  10497. function condense( unmatched, map, filter, context, xml ) {
  10498. var elem,
  10499. newUnmatched = [],
  10500. i = 0,
  10501. len = unmatched.length,
  10502. mapped = map != null;
  10503. for ( ; i < len; i++ ) {
  10504. if ( (elem = unmatched[i]) ) {
  10505. if ( !filter || filter( elem, context, xml ) ) {
  10506. newUnmatched.push( elem );
  10507. if ( mapped ) {
  10508. map.push( i );
  10509. }
  10510. }
  10511. }
  10512. }
  10513. return newUnmatched;
  10514. }
  10515. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  10516. if ( postFilter && !postFilter[ expando ] ) {
  10517. postFilter = setMatcher( postFilter );
  10518. }
  10519. if ( postFinder && !postFinder[ expando ] ) {
  10520. postFinder = setMatcher( postFinder, postSelector );
  10521. }
  10522. return markFunction(function( seed, results, context, xml ) {
  10523. var temp, i, elem,
  10524. preMap = [],
  10525. postMap = [],
  10526. preexisting = results.length,
  10527. // Get initial elements from seed or context
  10528. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  10529. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  10530. matcherIn = preFilter && ( seed || !selector ) ?
  10531. condense( elems, preMap, preFilter, context, xml ) :
  10532. elems,
  10533. matcherOut = matcher ?
  10534. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  10535. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  10536. // ...intermediate processing is necessary
  10537. [] :
  10538. // ...otherwise use results directly
  10539. results :
  10540. matcherIn;
  10541. // Find primary matches
  10542. if ( matcher ) {
  10543. matcher( matcherIn, matcherOut, context, xml );
  10544. }
  10545. // Apply postFilter
  10546. if ( postFilter ) {
  10547. temp = condense( matcherOut, postMap );
  10548. postFilter( temp, [], context, xml );
  10549. // Un-match failing elements by moving them back to matcherIn
  10550. i = temp.length;
  10551. while ( i-- ) {
  10552. if ( (elem = temp[i]) ) {
  10553. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  10554. }
  10555. }
  10556. }
  10557. if ( seed ) {
  10558. if ( postFinder || preFilter ) {
  10559. if ( postFinder ) {
  10560. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  10561. temp = [];
  10562. i = matcherOut.length;
  10563. while ( i-- ) {
  10564. if ( (elem = matcherOut[i]) ) {
  10565. // Restore matcherIn since elem is not yet a final match
  10566. temp.push( (matcherIn[i] = elem) );
  10567. }
  10568. }
  10569. postFinder( null, (matcherOut = []), temp, xml );
  10570. }
  10571. // Move matched elements from seed to results to keep them synchronized
  10572. i = matcherOut.length;
  10573. while ( i-- ) {
  10574. if ( (elem = matcherOut[i]) &&
  10575. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  10576. seed[temp] = !(results[temp] = elem);
  10577. }
  10578. }
  10579. }
  10580. // Add elements to results, through postFinder if defined
  10581. } else {
  10582. matcherOut = condense(
  10583. matcherOut === results ?
  10584. matcherOut.splice( preexisting, matcherOut.length ) :
  10585. matcherOut
  10586. );
  10587. if ( postFinder ) {
  10588. postFinder( null, results, matcherOut, xml );
  10589. } else {
  10590. push.apply( results, matcherOut );
  10591. }
  10592. }
  10593. });
  10594. }
  10595. function matcherFromTokens( tokens ) {
  10596. var checkContext, matcher, j,
  10597. len = tokens.length,
  10598. leadingRelative = Expr.relative[ tokens[0].type ],
  10599. implicitRelative = leadingRelative || Expr.relative[" "],
  10600. i = leadingRelative ? 1 : 0,
  10601. // The foundational matcher ensures that elements are reachable from top-level context(s)
  10602. matchContext = addCombinator( function( elem ) {
  10603. return elem === checkContext;
  10604. }, implicitRelative, true ),
  10605. matchAnyContext = addCombinator( function( elem ) {
  10606. return indexOf( checkContext, elem ) > -1;
  10607. }, implicitRelative, true ),
  10608. matchers = [ function( elem, context, xml ) {
  10609. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  10610. (checkContext = context).nodeType ?
  10611. matchContext( elem, context, xml ) :
  10612. matchAnyContext( elem, context, xml ) );
  10613. // Avoid hanging onto element (issue #299)
  10614. checkContext = null;
  10615. return ret;
  10616. } ];
  10617. for ( ; i < len; i++ ) {
  10618. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  10619. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  10620. } else {
  10621. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  10622. // Return special upon seeing a positional matcher
  10623. if ( matcher[ expando ] ) {
  10624. // Find the next relative operator (if any) for proper handling
  10625. j = ++i;
  10626. for ( ; j < len; j++ ) {
  10627. if ( Expr.relative[ tokens[j].type ] ) {
  10628. break;
  10629. }
  10630. }
  10631. return setMatcher(
  10632. i > 1 && elementMatcher( matchers ),
  10633. i > 1 && toSelector(
  10634. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  10635. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  10636. ).replace( rtrim, "$1" ),
  10637. matcher,
  10638. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  10639. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  10640. j < len && toSelector( tokens )
  10641. );
  10642. }
  10643. matchers.push( matcher );
  10644. }
  10645. }
  10646. return elementMatcher( matchers );
  10647. }
  10648. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  10649. var bySet = setMatchers.length > 0,
  10650. byElement = elementMatchers.length > 0,
  10651. superMatcher = function( seed, context, xml, results, outermost ) {
  10652. var elem, j, matcher,
  10653. matchedCount = 0,
  10654. i = "0",
  10655. unmatched = seed && [],
  10656. setMatched = [],
  10657. contextBackup = outermostContext,
  10658. // We must always have either seed elements or outermost context
  10659. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  10660. // Use integer dirruns iff this is the outermost matcher
  10661. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  10662. len = elems.length;
  10663. if ( outermost ) {
  10664. outermostContext = context === document || context || outermost;
  10665. }
  10666. // Add elements passing elementMatchers directly to results
  10667. // Support: IE<9, Safari
  10668. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  10669. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  10670. if ( byElement && elem ) {
  10671. j = 0;
  10672. if ( !context && elem.ownerDocument !== document ) {
  10673. setDocument( elem );
  10674. xml = !documentIsHTML;
  10675. }
  10676. while ( (matcher = elementMatchers[j++]) ) {
  10677. if ( matcher( elem, context || document, xml) ) {
  10678. results.push( elem );
  10679. break;
  10680. }
  10681. }
  10682. if ( outermost ) {
  10683. dirruns = dirrunsUnique;
  10684. }
  10685. }
  10686. // Track unmatched elements for set filters
  10687. if ( bySet ) {
  10688. // They will have gone through all possible matchers
  10689. if ( (elem = !matcher && elem) ) {
  10690. matchedCount--;
  10691. }
  10692. // Lengthen the array for every element, matched or not
  10693. if ( seed ) {
  10694. unmatched.push( elem );
  10695. }
  10696. }
  10697. }
  10698. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  10699. // makes the latter nonnegative.
  10700. matchedCount += i;
  10701. // Apply set filters to unmatched elements
  10702. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  10703. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  10704. // no element matchers and no seed.
  10705. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  10706. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  10707. // numerically zero.
  10708. if ( bySet && i !== matchedCount ) {
  10709. j = 0;
  10710. while ( (matcher = setMatchers[j++]) ) {
  10711. matcher( unmatched, setMatched, context, xml );
  10712. }
  10713. if ( seed ) {
  10714. // Reintegrate element matches to eliminate the need for sorting
  10715. if ( matchedCount > 0 ) {
  10716. while ( i-- ) {
  10717. if ( !(unmatched[i] || setMatched[i]) ) {
  10718. setMatched[i] = pop.call( results );
  10719. }
  10720. }
  10721. }
  10722. // Discard index placeholder values to get only actual matches
  10723. setMatched = condense( setMatched );
  10724. }
  10725. // Add matches to results
  10726. push.apply( results, setMatched );
  10727. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  10728. if ( outermost && !seed && setMatched.length > 0 &&
  10729. ( matchedCount + setMatchers.length ) > 1 ) {
  10730. Sizzle.uniqueSort( results );
  10731. }
  10732. }
  10733. // Override manipulation of globals by nested matchers
  10734. if ( outermost ) {
  10735. dirruns = dirrunsUnique;
  10736. outermostContext = contextBackup;
  10737. }
  10738. return unmatched;
  10739. };
  10740. return bySet ?
  10741. markFunction( superMatcher ) :
  10742. superMatcher;
  10743. }
  10744. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  10745. var i,
  10746. setMatchers = [],
  10747. elementMatchers = [],
  10748. cached = compilerCache[ selector + " " ];
  10749. if ( !cached ) {
  10750. // Generate a function of recursive functions that can be used to check each element
  10751. if ( !match ) {
  10752. match = tokenize( selector );
  10753. }
  10754. i = match.length;
  10755. while ( i-- ) {
  10756. cached = matcherFromTokens( match[i] );
  10757. if ( cached[ expando ] ) {
  10758. setMatchers.push( cached );
  10759. } else {
  10760. elementMatchers.push( cached );
  10761. }
  10762. }
  10763. // Cache the compiled function
  10764. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  10765. // Save selector and tokenization
  10766. cached.selector = selector;
  10767. }
  10768. return cached;
  10769. };
  10770. /**
  10771. * A low-level selection function that works with Sizzle's compiled
  10772. * selector functions
  10773. * @param {String|Function} selector A selector or a pre-compiled
  10774. * selector function built with Sizzle.compile
  10775. * @param {Element} context
  10776. * @param {Array} [results]
  10777. * @param {Array} [seed] A set of elements to match against
  10778. */
  10779. select = Sizzle.select = function( selector, context, results, seed ) {
  10780. var i, tokens, token, type, find,
  10781. compiled = typeof selector === "function" && selector,
  10782. match = !seed && tokenize( (selector = compiled.selector || selector) );
  10783. results = results || [];
  10784. // Try to minimize operations if there is only one selector in the list and no seed
  10785. // (the latter of which guarantees us context)
  10786. if ( match.length === 1 ) {
  10787. // Reduce context if the leading compound selector is an ID
  10788. tokens = match[0] = match[0].slice( 0 );
  10789. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  10790. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  10791. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  10792. if ( !context ) {
  10793. return results;
  10794. // Precompiled matchers will still verify ancestry, so step up a level
  10795. } else if ( compiled ) {
  10796. context = context.parentNode;
  10797. }
  10798. selector = selector.slice( tokens.shift().value.length );
  10799. }
  10800. // Fetch a seed set for right-to-left matching
  10801. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  10802. while ( i-- ) {
  10803. token = tokens[i];
  10804. // Abort if we hit a combinator
  10805. if ( Expr.relative[ (type = token.type) ] ) {
  10806. break;
  10807. }
  10808. if ( (find = Expr.find[ type ]) ) {
  10809. // Search, expanding context for leading sibling combinators
  10810. if ( (seed = find(
  10811. token.matches[0].replace( runescape, funescape ),
  10812. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  10813. )) ) {
  10814. // If seed is empty or no tokens remain, we can return early
  10815. tokens.splice( i, 1 );
  10816. selector = seed.length && toSelector( tokens );
  10817. if ( !selector ) {
  10818. push.apply( results, seed );
  10819. return results;
  10820. }
  10821. break;
  10822. }
  10823. }
  10824. }
  10825. }
  10826. // Compile and execute a filtering function if one is not provided
  10827. // Provide `match` to avoid retokenization if we modified the selector above
  10828. ( compiled || compile( selector, match ) )(
  10829. seed,
  10830. context,
  10831. !documentIsHTML,
  10832. results,
  10833. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  10834. );
  10835. return results;
  10836. };
  10837. // One-time assignments
  10838. // Sort stability
  10839. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  10840. // Support: Chrome 14-35+
  10841. // Always assume duplicates if they aren't passed to the comparison function
  10842. support.detectDuplicates = !!hasDuplicate;
  10843. // Initialize against the default document
  10844. setDocument();
  10845. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  10846. // Detached nodes confoundingly follow *each other*
  10847. support.sortDetached = assert(function( el ) {
  10848. // Should return 1, but returns 4 (following)
  10849. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  10850. });
  10851. // Support: IE<8
  10852. // Prevent attribute/property "interpolation"
  10853. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  10854. if ( !assert(function( el ) {
  10855. el.innerHTML = "<a href='#'></a>";
  10856. return el.firstChild.getAttribute("href") === "#" ;
  10857. }) ) {
  10858. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  10859. if ( !isXML ) {
  10860. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  10861. }
  10862. });
  10863. }
  10864. // Support: IE<9
  10865. // Use defaultValue in place of getAttribute("value")
  10866. if ( !support.attributes || !assert(function( el ) {
  10867. el.innerHTML = "<input/>";
  10868. el.firstChild.setAttribute( "value", "" );
  10869. return el.firstChild.getAttribute( "value" ) === "";
  10870. }) ) {
  10871. addHandle( "value", function( elem, name, isXML ) {
  10872. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  10873. return elem.defaultValue;
  10874. }
  10875. });
  10876. }
  10877. // Support: IE<9
  10878. // Use getAttributeNode to fetch booleans when getAttribute lies
  10879. if ( !assert(function( el ) {
  10880. return el.getAttribute("disabled") == null;
  10881. }) ) {
  10882. addHandle( booleans, function( elem, name, isXML ) {
  10883. var val;
  10884. if ( !isXML ) {
  10885. return elem[ name ] === true ? name.toLowerCase() :
  10886. (val = elem.getAttributeNode( name )) && val.specified ?
  10887. val.value :
  10888. null;
  10889. }
  10890. });
  10891. }
  10892. return Sizzle;
  10893. })( window );
  10894. jQuery.find = Sizzle;
  10895. jQuery.expr = Sizzle.selectors;
  10896. // Deprecated
  10897. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  10898. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  10899. jQuery.text = Sizzle.getText;
  10900. jQuery.isXMLDoc = Sizzle.isXML;
  10901. jQuery.contains = Sizzle.contains;
  10902. jQuery.escapeSelector = Sizzle.escape;
  10903. var dir = function( elem, dir, until ) {
  10904. var matched = [],
  10905. truncate = until !== undefined;
  10906. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  10907. if ( elem.nodeType === 1 ) {
  10908. if ( truncate && jQuery( elem ).is( until ) ) {
  10909. break;
  10910. }
  10911. matched.push( elem );
  10912. }
  10913. }
  10914. return matched;
  10915. };
  10916. var siblings = function( n, elem ) {
  10917. var matched = [];
  10918. for ( ; n; n = n.nextSibling ) {
  10919. if ( n.nodeType === 1 && n !== elem ) {
  10920. matched.push( n );
  10921. }
  10922. }
  10923. return matched;
  10924. };
  10925. var rneedsContext = jQuery.expr.match.needsContext;
  10926. function nodeName( elem, name ) {
  10927. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  10928. };
  10929. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  10930. // Implement the identical functionality for filter and not
  10931. function winnow( elements, qualifier, not ) {
  10932. if ( isFunction( qualifier ) ) {
  10933. return jQuery.grep( elements, function( elem, i ) {
  10934. return !!qualifier.call( elem, i, elem ) !== not;
  10935. } );
  10936. }
  10937. // Single element
  10938. if ( qualifier.nodeType ) {
  10939. return jQuery.grep( elements, function( elem ) {
  10940. return ( elem === qualifier ) !== not;
  10941. } );
  10942. }
  10943. // Arraylike of elements (jQuery, arguments, Array)
  10944. if ( typeof qualifier !== "string" ) {
  10945. return jQuery.grep( elements, function( elem ) {
  10946. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  10947. } );
  10948. }
  10949. // Filtered directly for both simple and complex selectors
  10950. return jQuery.filter( qualifier, elements, not );
  10951. }
  10952. jQuery.filter = function( expr, elems, not ) {
  10953. var elem = elems[ 0 ];
  10954. if ( not ) {
  10955. expr = ":not(" + expr + ")";
  10956. }
  10957. if ( elems.length === 1 && elem.nodeType === 1 ) {
  10958. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  10959. }
  10960. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  10961. return elem.nodeType === 1;
  10962. } ) );
  10963. };
  10964. jQuery.fn.extend( {
  10965. find: function( selector ) {
  10966. var i, ret,
  10967. len = this.length,
  10968. self = this;
  10969. if ( typeof selector !== "string" ) {
  10970. return this.pushStack( jQuery( selector ).filter( function() {
  10971. for ( i = 0; i < len; i++ ) {
  10972. if ( jQuery.contains( self[ i ], this ) ) {
  10973. return true;
  10974. }
  10975. }
  10976. } ) );
  10977. }
  10978. ret = this.pushStack( [] );
  10979. for ( i = 0; i < len; i++ ) {
  10980. jQuery.find( selector, self[ i ], ret );
  10981. }
  10982. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  10983. },
  10984. filter: function( selector ) {
  10985. return this.pushStack( winnow( this, selector || [], false ) );
  10986. },
  10987. not: function( selector ) {
  10988. return this.pushStack( winnow( this, selector || [], true ) );
  10989. },
  10990. is: function( selector ) {
  10991. return !!winnow(
  10992. this,
  10993. // If this is a positional/relative selector, check membership in the returned set
  10994. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  10995. typeof selector === "string" && rneedsContext.test( selector ) ?
  10996. jQuery( selector ) :
  10997. selector || [],
  10998. false
  10999. ).length;
  11000. }
  11001. } );
  11002. // Initialize a jQuery object
  11003. // A central reference to the root jQuery(document)
  11004. var rootjQuery,
  11005. // A simple way to check for HTML strings
  11006. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  11007. // Strict HTML recognition (#11290: must start with <)
  11008. // Shortcut simple #id case for speed
  11009. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  11010. init = jQuery.fn.init = function( selector, context, root ) {
  11011. var match, elem;
  11012. // HANDLE: $(""), $(null), $(undefined), $(false)
  11013. if ( !selector ) {
  11014. return this;
  11015. }
  11016. // Method init() accepts an alternate rootjQuery
  11017. // so migrate can support jQuery.sub (gh-2101)
  11018. root = root || rootjQuery;
  11019. // Handle HTML strings
  11020. if ( typeof selector === "string" ) {
  11021. if ( selector[ 0 ] === "<" &&
  11022. selector[ selector.length - 1 ] === ">" &&
  11023. selector.length >= 3 ) {
  11024. // Assume that strings that start and end with <> are HTML and skip the regex check
  11025. match = [ null, selector, null ];
  11026. } else {
  11027. match = rquickExpr.exec( selector );
  11028. }
  11029. // Match html or make sure no context is specified for #id
  11030. if ( match && ( match[ 1 ] || !context ) ) {
  11031. // HANDLE: $(html) -> $(array)
  11032. if ( match[ 1 ] ) {
  11033. context = context instanceof jQuery ? context[ 0 ] : context;
  11034. // Option to run scripts is true for back-compat
  11035. // Intentionally let the error be thrown if parseHTML is not present
  11036. jQuery.merge( this, jQuery.parseHTML(
  11037. match[ 1 ],
  11038. context && context.nodeType ? context.ownerDocument || context : document,
  11039. true
  11040. ) );
  11041. // HANDLE: $(html, props)
  11042. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  11043. for ( match in context ) {
  11044. // Properties of context are called as methods if possible
  11045. if ( isFunction( this[ match ] ) ) {
  11046. this[ match ]( context[ match ] );
  11047. // ...and otherwise set as attributes
  11048. } else {
  11049. this.attr( match, context[ match ] );
  11050. }
  11051. }
  11052. }
  11053. return this;
  11054. // HANDLE: $(#id)
  11055. } else {
  11056. elem = document.getElementById( match[ 2 ] );
  11057. if ( elem ) {
  11058. // Inject the element directly into the jQuery object
  11059. this[ 0 ] = elem;
  11060. this.length = 1;
  11061. }
  11062. return this;
  11063. }
  11064. // HANDLE: $(expr, $(...))
  11065. } else if ( !context || context.jquery ) {
  11066. return ( context || root ).find( selector );
  11067. // HANDLE: $(expr, context)
  11068. // (which is just equivalent to: $(context).find(expr)
  11069. } else {
  11070. return this.constructor( context ).find( selector );
  11071. }
  11072. // HANDLE: $(DOMElement)
  11073. } else if ( selector.nodeType ) {
  11074. this[ 0 ] = selector;
  11075. this.length = 1;
  11076. return this;
  11077. // HANDLE: $(function)
  11078. // Shortcut for document ready
  11079. } else if ( isFunction( selector ) ) {
  11080. return root.ready !== undefined ?
  11081. root.ready( selector ) :
  11082. // Execute immediately if ready is not present
  11083. selector( jQuery );
  11084. }
  11085. return jQuery.makeArray( selector, this );
  11086. };
  11087. // Give the init function the jQuery prototype for later instantiation
  11088. init.prototype = jQuery.fn;
  11089. // Initialize central reference
  11090. rootjQuery = jQuery( document );
  11091. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  11092. // Methods guaranteed to produce a unique set when starting from a unique set
  11093. guaranteedUnique = {
  11094. children: true,
  11095. contents: true,
  11096. next: true,
  11097. prev: true
  11098. };
  11099. jQuery.fn.extend( {
  11100. has: function( target ) {
  11101. var targets = jQuery( target, this ),
  11102. l = targets.length;
  11103. return this.filter( function() {
  11104. var i = 0;
  11105. for ( ; i < l; i++ ) {
  11106. if ( jQuery.contains( this, targets[ i ] ) ) {
  11107. return true;
  11108. }
  11109. }
  11110. } );
  11111. },
  11112. closest: function( selectors, context ) {
  11113. var cur,
  11114. i = 0,
  11115. l = this.length,
  11116. matched = [],
  11117. targets = typeof selectors !== "string" && jQuery( selectors );
  11118. // Positional selectors never match, since there's no _selection_ context
  11119. if ( !rneedsContext.test( selectors ) ) {
  11120. for ( ; i < l; i++ ) {
  11121. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  11122. // Always skip document fragments
  11123. if ( cur.nodeType < 11 && ( targets ?
  11124. targets.index( cur ) > -1 :
  11125. // Don't pass non-elements to Sizzle
  11126. cur.nodeType === 1 &&
  11127. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  11128. matched.push( cur );
  11129. break;
  11130. }
  11131. }
  11132. }
  11133. }
  11134. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  11135. },
  11136. // Determine the position of an element within the set
  11137. index: function( elem ) {
  11138. // No argument, return index in parent
  11139. if ( !elem ) {
  11140. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  11141. }
  11142. // Index in selector
  11143. if ( typeof elem === "string" ) {
  11144. return indexOf.call( jQuery( elem ), this[ 0 ] );
  11145. }
  11146. // Locate the position of the desired element
  11147. return indexOf.call( this,
  11148. // If it receives a jQuery object, the first element is used
  11149. elem.jquery ? elem[ 0 ] : elem
  11150. );
  11151. },
  11152. add: function( selector, context ) {
  11153. return this.pushStack(
  11154. jQuery.uniqueSort(
  11155. jQuery.merge( this.get(), jQuery( selector, context ) )
  11156. )
  11157. );
  11158. },
  11159. addBack: function( selector ) {
  11160. return this.add( selector == null ?
  11161. this.prevObject : this.prevObject.filter( selector )
  11162. );
  11163. }
  11164. } );
  11165. function sibling( cur, dir ) {
  11166. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  11167. return cur;
  11168. }
  11169. jQuery.each( {
  11170. parent: function( elem ) {
  11171. var parent = elem.parentNode;
  11172. return parent && parent.nodeType !== 11 ? parent : null;
  11173. },
  11174. parents: function( elem ) {
  11175. return dir( elem, "parentNode" );
  11176. },
  11177. parentsUntil: function( elem, i, until ) {
  11178. return dir( elem, "parentNode", until );
  11179. },
  11180. next: function( elem ) {
  11181. return sibling( elem, "nextSibling" );
  11182. },
  11183. prev: function( elem ) {
  11184. return sibling( elem, "previousSibling" );
  11185. },
  11186. nextAll: function( elem ) {
  11187. return dir( elem, "nextSibling" );
  11188. },
  11189. prevAll: function( elem ) {
  11190. return dir( elem, "previousSibling" );
  11191. },
  11192. nextUntil: function( elem, i, until ) {
  11193. return dir( elem, "nextSibling", until );
  11194. },
  11195. prevUntil: function( elem, i, until ) {
  11196. return dir( elem, "previousSibling", until );
  11197. },
  11198. siblings: function( elem ) {
  11199. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  11200. },
  11201. children: function( elem ) {
  11202. return siblings( elem.firstChild );
  11203. },
  11204. contents: function( elem ) {
  11205. if ( typeof elem.contentDocument !== "undefined" ) {
  11206. return elem.contentDocument;
  11207. }
  11208. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  11209. // Treat the template element as a regular one in browsers that
  11210. // don't support it.
  11211. if ( nodeName( elem, "template" ) ) {
  11212. elem = elem.content || elem;
  11213. }
  11214. return jQuery.merge( [], elem.childNodes );
  11215. }
  11216. }, function( name, fn ) {
  11217. jQuery.fn[ name ] = function( until, selector ) {
  11218. var matched = jQuery.map( this, fn, until );
  11219. if ( name.slice( -5 ) !== "Until" ) {
  11220. selector = until;
  11221. }
  11222. if ( selector && typeof selector === "string" ) {
  11223. matched = jQuery.filter( selector, matched );
  11224. }
  11225. if ( this.length > 1 ) {
  11226. // Remove duplicates
  11227. if ( !guaranteedUnique[ name ] ) {
  11228. jQuery.uniqueSort( matched );
  11229. }
  11230. // Reverse order for parents* and prev-derivatives
  11231. if ( rparentsprev.test( name ) ) {
  11232. matched.reverse();
  11233. }
  11234. }
  11235. return this.pushStack( matched );
  11236. };
  11237. } );
  11238. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  11239. // Convert String-formatted options into Object-formatted ones
  11240. function createOptions( options ) {
  11241. var object = {};
  11242. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  11243. object[ flag ] = true;
  11244. } );
  11245. return object;
  11246. }
  11247. /*
  11248. * Create a callback list using the following parameters:
  11249. *
  11250. * options: an optional list of space-separated options that will change how
  11251. * the callback list behaves or a more traditional option object
  11252. *
  11253. * By default a callback list will act like an event callback list and can be
  11254. * "fired" multiple times.
  11255. *
  11256. * Possible options:
  11257. *
  11258. * once: will ensure the callback list can only be fired once (like a Deferred)
  11259. *
  11260. * memory: will keep track of previous values and will call any callback added
  11261. * after the list has been fired right away with the latest "memorized"
  11262. * values (like a Deferred)
  11263. *
  11264. * unique: will ensure a callback can only be added once (no duplicate in the list)
  11265. *
  11266. * stopOnFalse: interrupt callings when a callback returns false
  11267. *
  11268. */
  11269. jQuery.Callbacks = function( options ) {
  11270. // Convert options from String-formatted to Object-formatted if needed
  11271. // (we check in cache first)
  11272. options = typeof options === "string" ?
  11273. createOptions( options ) :
  11274. jQuery.extend( {}, options );
  11275. var // Flag to know if list is currently firing
  11276. firing,
  11277. // Last fire value for non-forgettable lists
  11278. memory,
  11279. // Flag to know if list was already fired
  11280. fired,
  11281. // Flag to prevent firing
  11282. locked,
  11283. // Actual callback list
  11284. list = [],
  11285. // Queue of execution data for repeatable lists
  11286. queue = [],
  11287. // Index of currently firing callback (modified by add/remove as needed)
  11288. firingIndex = -1,
  11289. // Fire callbacks
  11290. fire = function() {
  11291. // Enforce single-firing
  11292. locked = locked || options.once;
  11293. // Execute callbacks for all pending executions,
  11294. // respecting firingIndex overrides and runtime changes
  11295. fired = firing = true;
  11296. for ( ; queue.length; firingIndex = -1 ) {
  11297. memory = queue.shift();
  11298. while ( ++firingIndex < list.length ) {
  11299. // Run callback and check for early termination
  11300. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  11301. options.stopOnFalse ) {
  11302. // Jump to end and forget the data so .add doesn't re-fire
  11303. firingIndex = list.length;
  11304. memory = false;
  11305. }
  11306. }
  11307. }
  11308. // Forget the data if we're done with it
  11309. if ( !options.memory ) {
  11310. memory = false;
  11311. }
  11312. firing = false;
  11313. // Clean up if we're done firing for good
  11314. if ( locked ) {
  11315. // Keep an empty list if we have data for future add calls
  11316. if ( memory ) {
  11317. list = [];
  11318. // Otherwise, this object is spent
  11319. } else {
  11320. list = "";
  11321. }
  11322. }
  11323. },
  11324. // Actual Callbacks object
  11325. self = {
  11326. // Add a callback or a collection of callbacks to the list
  11327. add: function() {
  11328. if ( list ) {
  11329. // If we have memory from a past run, we should fire after adding
  11330. if ( memory && !firing ) {
  11331. firingIndex = list.length - 1;
  11332. queue.push( memory );
  11333. }
  11334. ( function add( args ) {
  11335. jQuery.each( args, function( _, arg ) {
  11336. if ( isFunction( arg ) ) {
  11337. if ( !options.unique || !self.has( arg ) ) {
  11338. list.push( arg );
  11339. }
  11340. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  11341. // Inspect recursively
  11342. add( arg );
  11343. }
  11344. } );
  11345. } )( arguments );
  11346. if ( memory && !firing ) {
  11347. fire();
  11348. }
  11349. }
  11350. return this;
  11351. },
  11352. // Remove a callback from the list
  11353. remove: function() {
  11354. jQuery.each( arguments, function( _, arg ) {
  11355. var index;
  11356. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  11357. list.splice( index, 1 );
  11358. // Handle firing indexes
  11359. if ( index <= firingIndex ) {
  11360. firingIndex--;
  11361. }
  11362. }
  11363. } );
  11364. return this;
  11365. },
  11366. // Check if a given callback is in the list.
  11367. // If no argument is given, return whether or not list has callbacks attached.
  11368. has: function( fn ) {
  11369. return fn ?
  11370. jQuery.inArray( fn, list ) > -1 :
  11371. list.length > 0;
  11372. },
  11373. // Remove all callbacks from the list
  11374. empty: function() {
  11375. if ( list ) {
  11376. list = [];
  11377. }
  11378. return this;
  11379. },
  11380. // Disable .fire and .add
  11381. // Abort any current/pending executions
  11382. // Clear all callbacks and values
  11383. disable: function() {
  11384. locked = queue = [];
  11385. list = memory = "";
  11386. return this;
  11387. },
  11388. disabled: function() {
  11389. return !list;
  11390. },
  11391. // Disable .fire
  11392. // Also disable .add unless we have memory (since it would have no effect)
  11393. // Abort any pending executions
  11394. lock: function() {
  11395. locked = queue = [];
  11396. if ( !memory && !firing ) {
  11397. list = memory = "";
  11398. }
  11399. return this;
  11400. },
  11401. locked: function() {
  11402. return !!locked;
  11403. },
  11404. // Call all callbacks with the given context and arguments
  11405. fireWith: function( context, args ) {
  11406. if ( !locked ) {
  11407. args = args || [];
  11408. args = [ context, args.slice ? args.slice() : args ];
  11409. queue.push( args );
  11410. if ( !firing ) {
  11411. fire();
  11412. }
  11413. }
  11414. return this;
  11415. },
  11416. // Call all the callbacks with the given arguments
  11417. fire: function() {
  11418. self.fireWith( this, arguments );
  11419. return this;
  11420. },
  11421. // To know if the callbacks have already been called at least once
  11422. fired: function() {
  11423. return !!fired;
  11424. }
  11425. };
  11426. return self;
  11427. };
  11428. function Identity( v ) {
  11429. return v;
  11430. }
  11431. function Thrower( ex ) {
  11432. throw ex;
  11433. }
  11434. function adoptValue( value, resolve, reject, noValue ) {
  11435. var method;
  11436. try {
  11437. // Check for promise aspect first to privilege synchronous behavior
  11438. if ( value && isFunction( ( method = value.promise ) ) ) {
  11439. method.call( value ).done( resolve ).fail( reject );
  11440. // Other thenables
  11441. } else if ( value && isFunction( ( method = value.then ) ) ) {
  11442. method.call( value, resolve, reject );
  11443. // Other non-thenables
  11444. } else {
  11445. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  11446. // * false: [ value ].slice( 0 ) => resolve( value )
  11447. // * true: [ value ].slice( 1 ) => resolve()
  11448. resolve.apply( undefined, [ value ].slice( noValue ) );
  11449. }
  11450. // For Promises/A+, convert exceptions into rejections
  11451. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  11452. // Deferred#then to conditionally suppress rejection.
  11453. } catch ( value ) {
  11454. // Support: Android 4.0 only
  11455. // Strict mode functions invoked without .call/.apply get global-object context
  11456. reject.apply( undefined, [ value ] );
  11457. }
  11458. }
  11459. jQuery.extend( {
  11460. Deferred: function( func ) {
  11461. var tuples = [
  11462. // action, add listener, callbacks,
  11463. // ... .then handlers, argument index, [final state]
  11464. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  11465. jQuery.Callbacks( "memory" ), 2 ],
  11466. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  11467. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  11468. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  11469. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  11470. ],
  11471. state = "pending",
  11472. promise = {
  11473. state: function() {
  11474. return state;
  11475. },
  11476. always: function() {
  11477. deferred.done( arguments ).fail( arguments );
  11478. return this;
  11479. },
  11480. "catch": function( fn ) {
  11481. return promise.then( null, fn );
  11482. },
  11483. // Keep pipe for back-compat
  11484. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  11485. var fns = arguments;
  11486. return jQuery.Deferred( function( newDefer ) {
  11487. jQuery.each( tuples, function( i, tuple ) {
  11488. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  11489. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  11490. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  11491. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  11492. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  11493. deferred[ tuple[ 1 ] ]( function() {
  11494. var returned = fn && fn.apply( this, arguments );
  11495. if ( returned && isFunction( returned.promise ) ) {
  11496. returned.promise()
  11497. .progress( newDefer.notify )
  11498. .done( newDefer.resolve )
  11499. .fail( newDefer.reject );
  11500. } else {
  11501. newDefer[ tuple[ 0 ] + "With" ](
  11502. this,
  11503. fn ? [ returned ] : arguments
  11504. );
  11505. }
  11506. } );
  11507. } );
  11508. fns = null;
  11509. } ).promise();
  11510. },
  11511. then: function( onFulfilled, onRejected, onProgress ) {
  11512. var maxDepth = 0;
  11513. function resolve( depth, deferred, handler, special ) {
  11514. return function() {
  11515. var that = this,
  11516. args = arguments,
  11517. mightThrow = function() {
  11518. var returned, then;
  11519. // Support: Promises/A+ section 2.3.3.3.3
  11520. // https://promisesaplus.com/#point-59
  11521. // Ignore double-resolution attempts
  11522. if ( depth < maxDepth ) {
  11523. return;
  11524. }
  11525. returned = handler.apply( that, args );
  11526. // Support: Promises/A+ section 2.3.1
  11527. // https://promisesaplus.com/#point-48
  11528. if ( returned === deferred.promise() ) {
  11529. throw new TypeError( "Thenable self-resolution" );
  11530. }
  11531. // Support: Promises/A+ sections 2.3.3.1, 3.5
  11532. // https://promisesaplus.com/#point-54
  11533. // https://promisesaplus.com/#point-75
  11534. // Retrieve `then` only once
  11535. then = returned &&
  11536. // Support: Promises/A+ section 2.3.4
  11537. // https://promisesaplus.com/#point-64
  11538. // Only check objects and functions for thenability
  11539. ( typeof returned === "object" ||
  11540. typeof returned === "function" ) &&
  11541. returned.then;
  11542. // Handle a returned thenable
  11543. if ( isFunction( then ) ) {
  11544. // Special processors (notify) just wait for resolution
  11545. if ( special ) {
  11546. then.call(
  11547. returned,
  11548. resolve( maxDepth, deferred, Identity, special ),
  11549. resolve( maxDepth, deferred, Thrower, special )
  11550. );
  11551. // Normal processors (resolve) also hook into progress
  11552. } else {
  11553. // ...and disregard older resolution values
  11554. maxDepth++;
  11555. then.call(
  11556. returned,
  11557. resolve( maxDepth, deferred, Identity, special ),
  11558. resolve( maxDepth, deferred, Thrower, special ),
  11559. resolve( maxDepth, deferred, Identity,
  11560. deferred.notifyWith )
  11561. );
  11562. }
  11563. // Handle all other returned values
  11564. } else {
  11565. // Only substitute handlers pass on context
  11566. // and multiple values (non-spec behavior)
  11567. if ( handler !== Identity ) {
  11568. that = undefined;
  11569. args = [ returned ];
  11570. }
  11571. // Process the value(s)
  11572. // Default process is resolve
  11573. ( special || deferred.resolveWith )( that, args );
  11574. }
  11575. },
  11576. // Only normal processors (resolve) catch and reject exceptions
  11577. process = special ?
  11578. mightThrow :
  11579. function() {
  11580. try {
  11581. mightThrow();
  11582. } catch ( e ) {
  11583. if ( jQuery.Deferred.exceptionHook ) {
  11584. jQuery.Deferred.exceptionHook( e,
  11585. process.stackTrace );
  11586. }
  11587. // Support: Promises/A+ section 2.3.3.3.4.1
  11588. // https://promisesaplus.com/#point-61
  11589. // Ignore post-resolution exceptions
  11590. if ( depth + 1 >= maxDepth ) {
  11591. // Only substitute handlers pass on context
  11592. // and multiple values (non-spec behavior)
  11593. if ( handler !== Thrower ) {
  11594. that = undefined;
  11595. args = [ e ];
  11596. }
  11597. deferred.rejectWith( that, args );
  11598. }
  11599. }
  11600. };
  11601. // Support: Promises/A+ section 2.3.3.3.1
  11602. // https://promisesaplus.com/#point-57
  11603. // Re-resolve promises immediately to dodge false rejection from
  11604. // subsequent errors
  11605. if ( depth ) {
  11606. process();
  11607. } else {
  11608. // Call an optional hook to record the stack, in case of exception
  11609. // since it's otherwise lost when execution goes async
  11610. if ( jQuery.Deferred.getStackHook ) {
  11611. process.stackTrace = jQuery.Deferred.getStackHook();
  11612. }
  11613. window.setTimeout( process );
  11614. }
  11615. };
  11616. }
  11617. return jQuery.Deferred( function( newDefer ) {
  11618. // progress_handlers.add( ... )
  11619. tuples[ 0 ][ 3 ].add(
  11620. resolve(
  11621. 0,
  11622. newDefer,
  11623. isFunction( onProgress ) ?
  11624. onProgress :
  11625. Identity,
  11626. newDefer.notifyWith
  11627. )
  11628. );
  11629. // fulfilled_handlers.add( ... )
  11630. tuples[ 1 ][ 3 ].add(
  11631. resolve(
  11632. 0,
  11633. newDefer,
  11634. isFunction( onFulfilled ) ?
  11635. onFulfilled :
  11636. Identity
  11637. )
  11638. );
  11639. // rejected_handlers.add( ... )
  11640. tuples[ 2 ][ 3 ].add(
  11641. resolve(
  11642. 0,
  11643. newDefer,
  11644. isFunction( onRejected ) ?
  11645. onRejected :
  11646. Thrower
  11647. )
  11648. );
  11649. } ).promise();
  11650. },
  11651. // Get a promise for this deferred
  11652. // If obj is provided, the promise aspect is added to the object
  11653. promise: function( obj ) {
  11654. return obj != null ? jQuery.extend( obj, promise ) : promise;
  11655. }
  11656. },
  11657. deferred = {};
  11658. // Add list-specific methods
  11659. jQuery.each( tuples, function( i, tuple ) {
  11660. var list = tuple[ 2 ],
  11661. stateString = tuple[ 5 ];
  11662. // promise.progress = list.add
  11663. // promise.done = list.add
  11664. // promise.fail = list.add
  11665. promise[ tuple[ 1 ] ] = list.add;
  11666. // Handle state
  11667. if ( stateString ) {
  11668. list.add(
  11669. function() {
  11670. // state = "resolved" (i.e., fulfilled)
  11671. // state = "rejected"
  11672. state = stateString;
  11673. },
  11674. // rejected_callbacks.disable
  11675. // fulfilled_callbacks.disable
  11676. tuples[ 3 - i ][ 2 ].disable,
  11677. // rejected_handlers.disable
  11678. // fulfilled_handlers.disable
  11679. tuples[ 3 - i ][ 3 ].disable,
  11680. // progress_callbacks.lock
  11681. tuples[ 0 ][ 2 ].lock,
  11682. // progress_handlers.lock
  11683. tuples[ 0 ][ 3 ].lock
  11684. );
  11685. }
  11686. // progress_handlers.fire
  11687. // fulfilled_handlers.fire
  11688. // rejected_handlers.fire
  11689. list.add( tuple[ 3 ].fire );
  11690. // deferred.notify = function() { deferred.notifyWith(...) }
  11691. // deferred.resolve = function() { deferred.resolveWith(...) }
  11692. // deferred.reject = function() { deferred.rejectWith(...) }
  11693. deferred[ tuple[ 0 ] ] = function() {
  11694. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  11695. return this;
  11696. };
  11697. // deferred.notifyWith = list.fireWith
  11698. // deferred.resolveWith = list.fireWith
  11699. // deferred.rejectWith = list.fireWith
  11700. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  11701. } );
  11702. // Make the deferred a promise
  11703. promise.promise( deferred );
  11704. // Call given func if any
  11705. if ( func ) {
  11706. func.call( deferred, deferred );
  11707. }
  11708. // All done!
  11709. return deferred;
  11710. },
  11711. // Deferred helper
  11712. when: function( singleValue ) {
  11713. var
  11714. // count of uncompleted subordinates
  11715. remaining = arguments.length,
  11716. // count of unprocessed arguments
  11717. i = remaining,
  11718. // subordinate fulfillment data
  11719. resolveContexts = Array( i ),
  11720. resolveValues = slice.call( arguments ),
  11721. // the master Deferred
  11722. master = jQuery.Deferred(),
  11723. // subordinate callback factory
  11724. updateFunc = function( i ) {
  11725. return function( value ) {
  11726. resolveContexts[ i ] = this;
  11727. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  11728. if ( !( --remaining ) ) {
  11729. master.resolveWith( resolveContexts, resolveValues );
  11730. }
  11731. };
  11732. };
  11733. // Single- and empty arguments are adopted like Promise.resolve
  11734. if ( remaining <= 1 ) {
  11735. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  11736. !remaining );
  11737. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  11738. if ( master.state() === "pending" ||
  11739. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  11740. return master.then();
  11741. }
  11742. }
  11743. // Multiple arguments are aggregated like Promise.all array elements
  11744. while ( i-- ) {
  11745. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  11746. }
  11747. return master.promise();
  11748. }
  11749. } );
  11750. // These usually indicate a programmer mistake during development,
  11751. // warn about them ASAP rather than swallowing them by default.
  11752. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  11753. jQuery.Deferred.exceptionHook = function( error, stack ) {
  11754. // Support: IE 8 - 9 only
  11755. // Console exists when dev tools are open, which can happen at any time
  11756. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  11757. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  11758. }
  11759. };
  11760. jQuery.readyException = function( error ) {
  11761. window.setTimeout( function() {
  11762. throw error;
  11763. } );
  11764. };
  11765. // The deferred used on DOM ready
  11766. var readyList = jQuery.Deferred();
  11767. jQuery.fn.ready = function( fn ) {
  11768. readyList
  11769. .then( fn )
  11770. // Wrap jQuery.readyException in a function so that the lookup
  11771. // happens at the time of error handling instead of callback
  11772. // registration.
  11773. .catch( function( error ) {
  11774. jQuery.readyException( error );
  11775. } );
  11776. return this;
  11777. };
  11778. jQuery.extend( {
  11779. // Is the DOM ready to be used? Set to true once it occurs.
  11780. isReady: false,
  11781. // A counter to track how many items to wait for before
  11782. // the ready event fires. See #6781
  11783. readyWait: 1,
  11784. // Handle when the DOM is ready
  11785. ready: function( wait ) {
  11786. // Abort if there are pending holds or we're already ready
  11787. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  11788. return;
  11789. }
  11790. // Remember that the DOM is ready
  11791. jQuery.isReady = true;
  11792. // If a normal DOM Ready event fired, decrement, and wait if need be
  11793. if ( wait !== true && --jQuery.readyWait > 0 ) {
  11794. return;
  11795. }
  11796. // If there are functions bound, to execute
  11797. readyList.resolveWith( document, [ jQuery ] );
  11798. }
  11799. } );
  11800. jQuery.ready.then = readyList.then;
  11801. // The ready event handler and self cleanup method
  11802. function completed() {
  11803. document.removeEventListener( "DOMContentLoaded", completed );
  11804. window.removeEventListener( "load", completed );
  11805. jQuery.ready();
  11806. }
  11807. // Catch cases where $(document).ready() is called
  11808. // after the browser event has already occurred.
  11809. // Support: IE <=9 - 10 only
  11810. // Older IE sometimes signals "interactive" too soon
  11811. if ( document.readyState === "complete" ||
  11812. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  11813. // Handle it asynchronously to allow scripts the opportunity to delay ready
  11814. window.setTimeout( jQuery.ready );
  11815. } else {
  11816. // Use the handy event callback
  11817. document.addEventListener( "DOMContentLoaded", completed );
  11818. // A fallback to window.onload, that will always work
  11819. window.addEventListener( "load", completed );
  11820. }
  11821. // Multifunctional method to get and set values of a collection
  11822. // The value/s can optionally be executed if it's a function
  11823. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  11824. var i = 0,
  11825. len = elems.length,
  11826. bulk = key == null;
  11827. // Sets many values
  11828. if ( toType( key ) === "object" ) {
  11829. chainable = true;
  11830. for ( i in key ) {
  11831. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  11832. }
  11833. // Sets one value
  11834. } else if ( value !== undefined ) {
  11835. chainable = true;
  11836. if ( !isFunction( value ) ) {
  11837. raw = true;
  11838. }
  11839. if ( bulk ) {
  11840. // Bulk operations run against the entire set
  11841. if ( raw ) {
  11842. fn.call( elems, value );
  11843. fn = null;
  11844. // ...except when executing function values
  11845. } else {
  11846. bulk = fn;
  11847. fn = function( elem, key, value ) {
  11848. return bulk.call( jQuery( elem ), value );
  11849. };
  11850. }
  11851. }
  11852. if ( fn ) {
  11853. for ( ; i < len; i++ ) {
  11854. fn(
  11855. elems[ i ], key, raw ?
  11856. value :
  11857. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  11858. );
  11859. }
  11860. }
  11861. }
  11862. if ( chainable ) {
  11863. return elems;
  11864. }
  11865. // Gets
  11866. if ( bulk ) {
  11867. return fn.call( elems );
  11868. }
  11869. return len ? fn( elems[ 0 ], key ) : emptyGet;
  11870. };
  11871. // Matches dashed string for camelizing
  11872. var rmsPrefix = /^-ms-/,
  11873. rdashAlpha = /-([a-z])/g;
  11874. // Used by camelCase as callback to replace()
  11875. function fcamelCase( all, letter ) {
  11876. return letter.toUpperCase();
  11877. }
  11878. // Convert dashed to camelCase; used by the css and data modules
  11879. // Support: IE <=9 - 11, Edge 12 - 15
  11880. // Microsoft forgot to hump their vendor prefix (#9572)
  11881. function camelCase( string ) {
  11882. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  11883. }
  11884. var acceptData = function( owner ) {
  11885. // Accepts only:
  11886. // - Node
  11887. // - Node.ELEMENT_NODE
  11888. // - Node.DOCUMENT_NODE
  11889. // - Object
  11890. // - Any
  11891. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  11892. };
  11893. function Data() {
  11894. this.expando = jQuery.expando + Data.uid++;
  11895. }
  11896. Data.uid = 1;
  11897. Data.prototype = {
  11898. cache: function( owner ) {
  11899. // Check if the owner object already has a cache
  11900. var value = owner[ this.expando ];
  11901. // If not, create one
  11902. if ( !value ) {
  11903. value = {};
  11904. // We can accept data for non-element nodes in modern browsers,
  11905. // but we should not, see #8335.
  11906. // Always return an empty object.
  11907. if ( acceptData( owner ) ) {
  11908. // If it is a node unlikely to be stringify-ed or looped over
  11909. // use plain assignment
  11910. if ( owner.nodeType ) {
  11911. owner[ this.expando ] = value;
  11912. // Otherwise secure it in a non-enumerable property
  11913. // configurable must be true to allow the property to be
  11914. // deleted when data is removed
  11915. } else {
  11916. Object.defineProperty( owner, this.expando, {
  11917. value: value,
  11918. configurable: true
  11919. } );
  11920. }
  11921. }
  11922. }
  11923. return value;
  11924. },
  11925. set: function( owner, data, value ) {
  11926. var prop,
  11927. cache = this.cache( owner );
  11928. // Handle: [ owner, key, value ] args
  11929. // Always use camelCase key (gh-2257)
  11930. if ( typeof data === "string" ) {
  11931. cache[ camelCase( data ) ] = value;
  11932. // Handle: [ owner, { properties } ] args
  11933. } else {
  11934. // Copy the properties one-by-one to the cache object
  11935. for ( prop in data ) {
  11936. cache[ camelCase( prop ) ] = data[ prop ];
  11937. }
  11938. }
  11939. return cache;
  11940. },
  11941. get: function( owner, key ) {
  11942. return key === undefined ?
  11943. this.cache( owner ) :
  11944. // Always use camelCase key (gh-2257)
  11945. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  11946. },
  11947. access: function( owner, key, value ) {
  11948. // In cases where either:
  11949. //
  11950. // 1. No key was specified
  11951. // 2. A string key was specified, but no value provided
  11952. //
  11953. // Take the "read" path and allow the get method to determine
  11954. // which value to return, respectively either:
  11955. //
  11956. // 1. The entire cache object
  11957. // 2. The data stored at the key
  11958. //
  11959. if ( key === undefined ||
  11960. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  11961. return this.get( owner, key );
  11962. }
  11963. // When the key is not a string, or both a key and value
  11964. // are specified, set or extend (existing objects) with either:
  11965. //
  11966. // 1. An object of properties
  11967. // 2. A key and value
  11968. //
  11969. this.set( owner, key, value );
  11970. // Since the "set" path can have two possible entry points
  11971. // return the expected data based on which path was taken[*]
  11972. return value !== undefined ? value : key;
  11973. },
  11974. remove: function( owner, key ) {
  11975. var i,
  11976. cache = owner[ this.expando ];
  11977. if ( cache === undefined ) {
  11978. return;
  11979. }
  11980. if ( key !== undefined ) {
  11981. // Support array or space separated string of keys
  11982. if ( Array.isArray( key ) ) {
  11983. // If key is an array of keys...
  11984. // We always set camelCase keys, so remove that.
  11985. key = key.map( camelCase );
  11986. } else {
  11987. key = camelCase( key );
  11988. // If a key with the spaces exists, use it.
  11989. // Otherwise, create an array by matching non-whitespace
  11990. key = key in cache ?
  11991. [ key ] :
  11992. ( key.match( rnothtmlwhite ) || [] );
  11993. }
  11994. i = key.length;
  11995. while ( i-- ) {
  11996. delete cache[ key[ i ] ];
  11997. }
  11998. }
  11999. // Remove the expando if there's no more data
  12000. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  12001. // Support: Chrome <=35 - 45
  12002. // Webkit & Blink performance suffers when deleting properties
  12003. // from DOM nodes, so set to undefined instead
  12004. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  12005. if ( owner.nodeType ) {
  12006. owner[ this.expando ] = undefined;
  12007. } else {
  12008. delete owner[ this.expando ];
  12009. }
  12010. }
  12011. },
  12012. hasData: function( owner ) {
  12013. var cache = owner[ this.expando ];
  12014. return cache !== undefined && !jQuery.isEmptyObject( cache );
  12015. }
  12016. };
  12017. var dataPriv = new Data();
  12018. var dataUser = new Data();
  12019. // Implementation Summary
  12020. //
  12021. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  12022. // 2. Improve the module's maintainability by reducing the storage
  12023. // paths to a single mechanism.
  12024. // 3. Use the same single mechanism to support "private" and "user" data.
  12025. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  12026. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  12027. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  12028. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  12029. rmultiDash = /[A-Z]/g;
  12030. function getData( data ) {
  12031. if ( data === "true" ) {
  12032. return true;
  12033. }
  12034. if ( data === "false" ) {
  12035. return false;
  12036. }
  12037. if ( data === "null" ) {
  12038. return null;
  12039. }
  12040. // Only convert to a number if it doesn't change the string
  12041. if ( data === +data + "" ) {
  12042. return +data;
  12043. }
  12044. if ( rbrace.test( data ) ) {
  12045. return JSON.parse( data );
  12046. }
  12047. return data;
  12048. }
  12049. function dataAttr( elem, key, data ) {
  12050. var name;
  12051. // If nothing was found internally, try to fetch any
  12052. // data from the HTML5 data-* attribute
  12053. if ( data === undefined && elem.nodeType === 1 ) {
  12054. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  12055. data = elem.getAttribute( name );
  12056. if ( typeof data === "string" ) {
  12057. try {
  12058. data = getData( data );
  12059. } catch ( e ) {}
  12060. // Make sure we set the data so it isn't changed later
  12061. dataUser.set( elem, key, data );
  12062. } else {
  12063. data = undefined;
  12064. }
  12065. }
  12066. return data;
  12067. }
  12068. jQuery.extend( {
  12069. hasData: function( elem ) {
  12070. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  12071. },
  12072. data: function( elem, name, data ) {
  12073. return dataUser.access( elem, name, data );
  12074. },
  12075. removeData: function( elem, name ) {
  12076. dataUser.remove( elem, name );
  12077. },
  12078. // TODO: Now that all calls to _data and _removeData have been replaced
  12079. // with direct calls to dataPriv methods, these can be deprecated.
  12080. _data: function( elem, name, data ) {
  12081. return dataPriv.access( elem, name, data );
  12082. },
  12083. _removeData: function( elem, name ) {
  12084. dataPriv.remove( elem, name );
  12085. }
  12086. } );
  12087. jQuery.fn.extend( {
  12088. data: function( key, value ) {
  12089. var i, name, data,
  12090. elem = this[ 0 ],
  12091. attrs = elem && elem.attributes;
  12092. // Gets all values
  12093. if ( key === undefined ) {
  12094. if ( this.length ) {
  12095. data = dataUser.get( elem );
  12096. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  12097. i = attrs.length;
  12098. while ( i-- ) {
  12099. // Support: IE 11 only
  12100. // The attrs elements can be null (#14894)
  12101. if ( attrs[ i ] ) {
  12102. name = attrs[ i ].name;
  12103. if ( name.indexOf( "data-" ) === 0 ) {
  12104. name = camelCase( name.slice( 5 ) );
  12105. dataAttr( elem, name, data[ name ] );
  12106. }
  12107. }
  12108. }
  12109. dataPriv.set( elem, "hasDataAttrs", true );
  12110. }
  12111. }
  12112. return data;
  12113. }
  12114. // Sets multiple values
  12115. if ( typeof key === "object" ) {
  12116. return this.each( function() {
  12117. dataUser.set( this, key );
  12118. } );
  12119. }
  12120. return access( this, function( value ) {
  12121. var data;
  12122. // The calling jQuery object (element matches) is not empty
  12123. // (and therefore has an element appears at this[ 0 ]) and the
  12124. // `value` parameter was not undefined. An empty jQuery object
  12125. // will result in `undefined` for elem = this[ 0 ] which will
  12126. // throw an exception if an attempt to read a data cache is made.
  12127. if ( elem && value === undefined ) {
  12128. // Attempt to get data from the cache
  12129. // The key will always be camelCased in Data
  12130. data = dataUser.get( elem, key );
  12131. if ( data !== undefined ) {
  12132. return data;
  12133. }
  12134. // Attempt to "discover" the data in
  12135. // HTML5 custom data-* attrs
  12136. data = dataAttr( elem, key );
  12137. if ( data !== undefined ) {
  12138. return data;
  12139. }
  12140. // We tried really hard, but the data doesn't exist.
  12141. return;
  12142. }
  12143. // Set the data...
  12144. this.each( function() {
  12145. // We always store the camelCased key
  12146. dataUser.set( this, key, value );
  12147. } );
  12148. }, null, value, arguments.length > 1, null, true );
  12149. },
  12150. removeData: function( key ) {
  12151. return this.each( function() {
  12152. dataUser.remove( this, key );
  12153. } );
  12154. }
  12155. } );
  12156. jQuery.extend( {
  12157. queue: function( elem, type, data ) {
  12158. var queue;
  12159. if ( elem ) {
  12160. type = ( type || "fx" ) + "queue";
  12161. queue = dataPriv.get( elem, type );
  12162. // Speed up dequeue by getting out quickly if this is just a lookup
  12163. if ( data ) {
  12164. if ( !queue || Array.isArray( data ) ) {
  12165. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  12166. } else {
  12167. queue.push( data );
  12168. }
  12169. }
  12170. return queue || [];
  12171. }
  12172. },
  12173. dequeue: function( elem, type ) {
  12174. type = type || "fx";
  12175. var queue = jQuery.queue( elem, type ),
  12176. startLength = queue.length,
  12177. fn = queue.shift(),
  12178. hooks = jQuery._queueHooks( elem, type ),
  12179. next = function() {
  12180. jQuery.dequeue( elem, type );
  12181. };
  12182. // If the fx queue is dequeued, always remove the progress sentinel
  12183. if ( fn === "inprogress" ) {
  12184. fn = queue.shift();
  12185. startLength--;
  12186. }
  12187. if ( fn ) {
  12188. // Add a progress sentinel to prevent the fx queue from being
  12189. // automatically dequeued
  12190. if ( type === "fx" ) {
  12191. queue.unshift( "inprogress" );
  12192. }
  12193. // Clear up the last queue stop function
  12194. delete hooks.stop;
  12195. fn.call( elem, next, hooks );
  12196. }
  12197. if ( !startLength && hooks ) {
  12198. hooks.empty.fire();
  12199. }
  12200. },
  12201. // Not public - generate a queueHooks object, or return the current one
  12202. _queueHooks: function( elem, type ) {
  12203. var key = type + "queueHooks";
  12204. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  12205. empty: jQuery.Callbacks( "once memory" ).add( function() {
  12206. dataPriv.remove( elem, [ type + "queue", key ] );
  12207. } )
  12208. } );
  12209. }
  12210. } );
  12211. jQuery.fn.extend( {
  12212. queue: function( type, data ) {
  12213. var setter = 2;
  12214. if ( typeof type !== "string" ) {
  12215. data = type;
  12216. type = "fx";
  12217. setter--;
  12218. }
  12219. if ( arguments.length < setter ) {
  12220. return jQuery.queue( this[ 0 ], type );
  12221. }
  12222. return data === undefined ?
  12223. this :
  12224. this.each( function() {
  12225. var queue = jQuery.queue( this, type, data );
  12226. // Ensure a hooks for this queue
  12227. jQuery._queueHooks( this, type );
  12228. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  12229. jQuery.dequeue( this, type );
  12230. }
  12231. } );
  12232. },
  12233. dequeue: function( type ) {
  12234. return this.each( function() {
  12235. jQuery.dequeue( this, type );
  12236. } );
  12237. },
  12238. clearQueue: function( type ) {
  12239. return this.queue( type || "fx", [] );
  12240. },
  12241. // Get a promise resolved when queues of a certain type
  12242. // are emptied (fx is the type by default)
  12243. promise: function( type, obj ) {
  12244. var tmp,
  12245. count = 1,
  12246. defer = jQuery.Deferred(),
  12247. elements = this,
  12248. i = this.length,
  12249. resolve = function() {
  12250. if ( !( --count ) ) {
  12251. defer.resolveWith( elements, [ elements ] );
  12252. }
  12253. };
  12254. if ( typeof type !== "string" ) {
  12255. obj = type;
  12256. type = undefined;
  12257. }
  12258. type = type || "fx";
  12259. while ( i-- ) {
  12260. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  12261. if ( tmp && tmp.empty ) {
  12262. count++;
  12263. tmp.empty.add( resolve );
  12264. }
  12265. }
  12266. resolve();
  12267. return defer.promise( obj );
  12268. }
  12269. } );
  12270. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  12271. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  12272. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  12273. var documentElement = document.documentElement;
  12274. var isAttached = function( elem ) {
  12275. return jQuery.contains( elem.ownerDocument, elem );
  12276. },
  12277. composed = { composed: true };
  12278. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  12279. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  12280. // Support: iOS 10.0-10.2 only
  12281. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  12282. // leading to errors. We need to check for `getRootNode`.
  12283. if ( documentElement.getRootNode ) {
  12284. isAttached = function( elem ) {
  12285. return jQuery.contains( elem.ownerDocument, elem ) ||
  12286. elem.getRootNode( composed ) === elem.ownerDocument;
  12287. };
  12288. }
  12289. var isHiddenWithinTree = function( elem, el ) {
  12290. // isHiddenWithinTree might be called from jQuery#filter function;
  12291. // in that case, element will be second argument
  12292. elem = el || elem;
  12293. // Inline style trumps all
  12294. return elem.style.display === "none" ||
  12295. elem.style.display === "" &&
  12296. // Otherwise, check computed style
  12297. // Support: Firefox <=43 - 45
  12298. // Disconnected elements can have computed display: none, so first confirm that elem is
  12299. // in the document.
  12300. isAttached( elem ) &&
  12301. jQuery.css( elem, "display" ) === "none";
  12302. };
  12303. var swap = function( elem, options, callback, args ) {
  12304. var ret, name,
  12305. old = {};
  12306. // Remember the old values, and insert the new ones
  12307. for ( name in options ) {
  12308. old[ name ] = elem.style[ name ];
  12309. elem.style[ name ] = options[ name ];
  12310. }
  12311. ret = callback.apply( elem, args || [] );
  12312. // Revert the old values
  12313. for ( name in options ) {
  12314. elem.style[ name ] = old[ name ];
  12315. }
  12316. return ret;
  12317. };
  12318. function adjustCSS( elem, prop, valueParts, tween ) {
  12319. var adjusted, scale,
  12320. maxIterations = 20,
  12321. currentValue = tween ?
  12322. function() {
  12323. return tween.cur();
  12324. } :
  12325. function() {
  12326. return jQuery.css( elem, prop, "" );
  12327. },
  12328. initial = currentValue(),
  12329. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  12330. // Starting value computation is required for potential unit mismatches
  12331. initialInUnit = elem.nodeType &&
  12332. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  12333. rcssNum.exec( jQuery.css( elem, prop ) );
  12334. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  12335. // Support: Firefox <=54
  12336. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  12337. initial = initial / 2;
  12338. // Trust units reported by jQuery.css
  12339. unit = unit || initialInUnit[ 3 ];
  12340. // Iteratively approximate from a nonzero starting point
  12341. initialInUnit = +initial || 1;
  12342. while ( maxIterations-- ) {
  12343. // Evaluate and update our best guess (doubling guesses that zero out).
  12344. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  12345. jQuery.style( elem, prop, initialInUnit + unit );
  12346. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  12347. maxIterations = 0;
  12348. }
  12349. initialInUnit = initialInUnit / scale;
  12350. }
  12351. initialInUnit = initialInUnit * 2;
  12352. jQuery.style( elem, prop, initialInUnit + unit );
  12353. // Make sure we update the tween properties later on
  12354. valueParts = valueParts || [];
  12355. }
  12356. if ( valueParts ) {
  12357. initialInUnit = +initialInUnit || +initial || 0;
  12358. // Apply relative offset (+=/-=) if specified
  12359. adjusted = valueParts[ 1 ] ?
  12360. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  12361. +valueParts[ 2 ];
  12362. if ( tween ) {
  12363. tween.unit = unit;
  12364. tween.start = initialInUnit;
  12365. tween.end = adjusted;
  12366. }
  12367. }
  12368. return adjusted;
  12369. }
  12370. var defaultDisplayMap = {};
  12371. function getDefaultDisplay( elem ) {
  12372. var temp,
  12373. doc = elem.ownerDocument,
  12374. nodeName = elem.nodeName,
  12375. display = defaultDisplayMap[ nodeName ];
  12376. if ( display ) {
  12377. return display;
  12378. }
  12379. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  12380. display = jQuery.css( temp, "display" );
  12381. temp.parentNode.removeChild( temp );
  12382. if ( display === "none" ) {
  12383. display = "block";
  12384. }
  12385. defaultDisplayMap[ nodeName ] = display;
  12386. return display;
  12387. }
  12388. function showHide( elements, show ) {
  12389. var display, elem,
  12390. values = [],
  12391. index = 0,
  12392. length = elements.length;
  12393. // Determine new display value for elements that need to change
  12394. for ( ; index < length; index++ ) {
  12395. elem = elements[ index ];
  12396. if ( !elem.style ) {
  12397. continue;
  12398. }
  12399. display = elem.style.display;
  12400. if ( show ) {
  12401. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  12402. // check is required in this first loop unless we have a nonempty display value (either
  12403. // inline or about-to-be-restored)
  12404. if ( display === "none" ) {
  12405. values[ index ] = dataPriv.get( elem, "display" ) || null;
  12406. if ( !values[ index ] ) {
  12407. elem.style.display = "";
  12408. }
  12409. }
  12410. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  12411. values[ index ] = getDefaultDisplay( elem );
  12412. }
  12413. } else {
  12414. if ( display !== "none" ) {
  12415. values[ index ] = "none";
  12416. // Remember what we're overwriting
  12417. dataPriv.set( elem, "display", display );
  12418. }
  12419. }
  12420. }
  12421. // Set the display of the elements in a second loop to avoid constant reflow
  12422. for ( index = 0; index < length; index++ ) {
  12423. if ( values[ index ] != null ) {
  12424. elements[ index ].style.display = values[ index ];
  12425. }
  12426. }
  12427. return elements;
  12428. }
  12429. jQuery.fn.extend( {
  12430. show: function() {
  12431. return showHide( this, true );
  12432. },
  12433. hide: function() {
  12434. return showHide( this );
  12435. },
  12436. toggle: function( state ) {
  12437. if ( typeof state === "boolean" ) {
  12438. return state ? this.show() : this.hide();
  12439. }
  12440. return this.each( function() {
  12441. if ( isHiddenWithinTree( this ) ) {
  12442. jQuery( this ).show();
  12443. } else {
  12444. jQuery( this ).hide();
  12445. }
  12446. } );
  12447. }
  12448. } );
  12449. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  12450. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  12451. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  12452. // We have to close these tags to support XHTML (#13200)
  12453. var wrapMap = {
  12454. // Support: IE <=9 only
  12455. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  12456. // XHTML parsers do not magically insert elements in the
  12457. // same way that tag soup parsers do. So we cannot shorten
  12458. // this by omitting <tbody> or other required elements.
  12459. thead: [ 1, "<table>", "</table>" ],
  12460. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  12461. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  12462. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  12463. _default: [ 0, "", "" ]
  12464. };
  12465. // Support: IE <=9 only
  12466. wrapMap.optgroup = wrapMap.option;
  12467. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  12468. wrapMap.th = wrapMap.td;
  12469. function getAll( context, tag ) {
  12470. // Support: IE <=9 - 11 only
  12471. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  12472. var ret;
  12473. if ( typeof context.getElementsByTagName !== "undefined" ) {
  12474. ret = context.getElementsByTagName( tag || "*" );
  12475. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  12476. ret = context.querySelectorAll( tag || "*" );
  12477. } else {
  12478. ret = [];
  12479. }
  12480. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  12481. return jQuery.merge( [ context ], ret );
  12482. }
  12483. return ret;
  12484. }
  12485. // Mark scripts as having already been evaluated
  12486. function setGlobalEval( elems, refElements ) {
  12487. var i = 0,
  12488. l = elems.length;
  12489. for ( ; i < l; i++ ) {
  12490. dataPriv.set(
  12491. elems[ i ],
  12492. "globalEval",
  12493. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  12494. );
  12495. }
  12496. }
  12497. var rhtml = /<|&#?\w+;/;
  12498. function buildFragment( elems, context, scripts, selection, ignored ) {
  12499. var elem, tmp, tag, wrap, attached, j,
  12500. fragment = context.createDocumentFragment(),
  12501. nodes = [],
  12502. i = 0,
  12503. l = elems.length;
  12504. for ( ; i < l; i++ ) {
  12505. elem = elems[ i ];
  12506. if ( elem || elem === 0 ) {
  12507. // Add nodes directly
  12508. if ( toType( elem ) === "object" ) {
  12509. // Support: Android <=4.0 only, PhantomJS 1 only
  12510. // push.apply(_, arraylike) throws on ancient WebKit
  12511. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  12512. // Convert non-html into a text node
  12513. } else if ( !rhtml.test( elem ) ) {
  12514. nodes.push( context.createTextNode( elem ) );
  12515. // Convert html into DOM nodes
  12516. } else {
  12517. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  12518. // Deserialize a standard representation
  12519. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  12520. wrap = wrapMap[ tag ] || wrapMap._default;
  12521. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  12522. // Descend through wrappers to the right content
  12523. j = wrap[ 0 ];
  12524. while ( j-- ) {
  12525. tmp = tmp.lastChild;
  12526. }
  12527. // Support: Android <=4.0 only, PhantomJS 1 only
  12528. // push.apply(_, arraylike) throws on ancient WebKit
  12529. jQuery.merge( nodes, tmp.childNodes );
  12530. // Remember the top-level container
  12531. tmp = fragment.firstChild;
  12532. // Ensure the created nodes are orphaned (#12392)
  12533. tmp.textContent = "";
  12534. }
  12535. }
  12536. }
  12537. // Remove wrapper from fragment
  12538. fragment.textContent = "";
  12539. i = 0;
  12540. while ( ( elem = nodes[ i++ ] ) ) {
  12541. // Skip elements already in the context collection (trac-4087)
  12542. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  12543. if ( ignored ) {
  12544. ignored.push( elem );
  12545. }
  12546. continue;
  12547. }
  12548. attached = isAttached( elem );
  12549. // Append to fragment
  12550. tmp = getAll( fragment.appendChild( elem ), "script" );
  12551. // Preserve script evaluation history
  12552. if ( attached ) {
  12553. setGlobalEval( tmp );
  12554. }
  12555. // Capture executables
  12556. if ( scripts ) {
  12557. j = 0;
  12558. while ( ( elem = tmp[ j++ ] ) ) {
  12559. if ( rscriptType.test( elem.type || "" ) ) {
  12560. scripts.push( elem );
  12561. }
  12562. }
  12563. }
  12564. }
  12565. return fragment;
  12566. }
  12567. ( function() {
  12568. var fragment = document.createDocumentFragment(),
  12569. div = fragment.appendChild( document.createElement( "div" ) ),
  12570. input = document.createElement( "input" );
  12571. // Support: Android 4.0 - 4.3 only
  12572. // Check state lost if the name is set (#11217)
  12573. // Support: Windows Web Apps (WWA)
  12574. // `name` and `type` must use .setAttribute for WWA (#14901)
  12575. input.setAttribute( "type", "radio" );
  12576. input.setAttribute( "checked", "checked" );
  12577. input.setAttribute( "name", "t" );
  12578. div.appendChild( input );
  12579. // Support: Android <=4.1 only
  12580. // Older WebKit doesn't clone checked state correctly in fragments
  12581. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  12582. // Support: IE <=11 only
  12583. // Make sure textarea (and checkbox) defaultValue is properly cloned
  12584. div.innerHTML = "<textarea>x</textarea>";
  12585. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  12586. } )();
  12587. var
  12588. rkeyEvent = /^key/,
  12589. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  12590. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  12591. function returnTrue() {
  12592. return true;
  12593. }
  12594. function returnFalse() {
  12595. return false;
  12596. }
  12597. // Support: IE <=9 - 11+
  12598. // focus() and blur() are asynchronous, except when they are no-op.
  12599. // So expect focus to be synchronous when the element is already active,
  12600. // and blur to be synchronous when the element is not already active.
  12601. // (focus and blur are always synchronous in other supported browsers,
  12602. // this just defines when we can count on it).
  12603. function expectSync( elem, type ) {
  12604. return ( elem === safeActiveElement() ) === ( type === "focus" );
  12605. }
  12606. // Support: IE <=9 only
  12607. // Accessing document.activeElement can throw unexpectedly
  12608. // https://bugs.jquery.com/ticket/13393
  12609. function safeActiveElement() {
  12610. try {
  12611. return document.activeElement;
  12612. } catch ( err ) { }
  12613. }
  12614. function on( elem, types, selector, data, fn, one ) {
  12615. var origFn, type;
  12616. // Types can be a map of types/handlers
  12617. if ( typeof types === "object" ) {
  12618. // ( types-Object, selector, data )
  12619. if ( typeof selector !== "string" ) {
  12620. // ( types-Object, data )
  12621. data = data || selector;
  12622. selector = undefined;
  12623. }
  12624. for ( type in types ) {
  12625. on( elem, type, selector, data, types[ type ], one );
  12626. }
  12627. return elem;
  12628. }
  12629. if ( data == null && fn == null ) {
  12630. // ( types, fn )
  12631. fn = selector;
  12632. data = selector = undefined;
  12633. } else if ( fn == null ) {
  12634. if ( typeof selector === "string" ) {
  12635. // ( types, selector, fn )
  12636. fn = data;
  12637. data = undefined;
  12638. } else {
  12639. // ( types, data, fn )
  12640. fn = data;
  12641. data = selector;
  12642. selector = undefined;
  12643. }
  12644. }
  12645. if ( fn === false ) {
  12646. fn = returnFalse;
  12647. } else if ( !fn ) {
  12648. return elem;
  12649. }
  12650. if ( one === 1 ) {
  12651. origFn = fn;
  12652. fn = function( event ) {
  12653. // Can use an empty set, since event contains the info
  12654. jQuery().off( event );
  12655. return origFn.apply( this, arguments );
  12656. };
  12657. // Use same guid so caller can remove using origFn
  12658. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  12659. }
  12660. return elem.each( function() {
  12661. jQuery.event.add( this, types, fn, data, selector );
  12662. } );
  12663. }
  12664. /*
  12665. * Helper functions for managing events -- not part of the public interface.
  12666. * Props to Dean Edwards' addEvent library for many of the ideas.
  12667. */
  12668. jQuery.event = {
  12669. global: {},
  12670. add: function( elem, types, handler, data, selector ) {
  12671. var handleObjIn, eventHandle, tmp,
  12672. events, t, handleObj,
  12673. special, handlers, type, namespaces, origType,
  12674. elemData = dataPriv.get( elem );
  12675. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  12676. if ( !elemData ) {
  12677. return;
  12678. }
  12679. // Caller can pass in an object of custom data in lieu of the handler
  12680. if ( handler.handler ) {
  12681. handleObjIn = handler;
  12682. handler = handleObjIn.handler;
  12683. selector = handleObjIn.selector;
  12684. }
  12685. // Ensure that invalid selectors throw exceptions at attach time
  12686. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  12687. if ( selector ) {
  12688. jQuery.find.matchesSelector( documentElement, selector );
  12689. }
  12690. // Make sure that the handler has a unique ID, used to find/remove it later
  12691. if ( !handler.guid ) {
  12692. handler.guid = jQuery.guid++;
  12693. }
  12694. // Init the element's event structure and main handler, if this is the first
  12695. if ( !( events = elemData.events ) ) {
  12696. events = elemData.events = {};
  12697. }
  12698. if ( !( eventHandle = elemData.handle ) ) {
  12699. eventHandle = elemData.handle = function( e ) {
  12700. // Discard the second event of a jQuery.event.trigger() and
  12701. // when an event is called after a page has unloaded
  12702. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  12703. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  12704. };
  12705. }
  12706. // Handle multiple events separated by a space
  12707. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12708. t = types.length;
  12709. while ( t-- ) {
  12710. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12711. type = origType = tmp[ 1 ];
  12712. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12713. // There *must* be a type, no attaching namespace-only handlers
  12714. if ( !type ) {
  12715. continue;
  12716. }
  12717. // If event changes its type, use the special event handlers for the changed type
  12718. special = jQuery.event.special[ type ] || {};
  12719. // If selector defined, determine special event api type, otherwise given type
  12720. type = ( selector ? special.delegateType : special.bindType ) || type;
  12721. // Update special based on newly reset type
  12722. special = jQuery.event.special[ type ] || {};
  12723. // handleObj is passed to all event handlers
  12724. handleObj = jQuery.extend( {
  12725. type: type,
  12726. origType: origType,
  12727. data: data,
  12728. handler: handler,
  12729. guid: handler.guid,
  12730. selector: selector,
  12731. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  12732. namespace: namespaces.join( "." )
  12733. }, handleObjIn );
  12734. // Init the event handler queue if we're the first
  12735. if ( !( handlers = events[ type ] ) ) {
  12736. handlers = events[ type ] = [];
  12737. handlers.delegateCount = 0;
  12738. // Only use addEventListener if the special events handler returns false
  12739. if ( !special.setup ||
  12740. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  12741. if ( elem.addEventListener ) {
  12742. elem.addEventListener( type, eventHandle );
  12743. }
  12744. }
  12745. }
  12746. if ( special.add ) {
  12747. special.add.call( elem, handleObj );
  12748. if ( !handleObj.handler.guid ) {
  12749. handleObj.handler.guid = handler.guid;
  12750. }
  12751. }
  12752. // Add to the element's handler list, delegates in front
  12753. if ( selector ) {
  12754. handlers.splice( handlers.delegateCount++, 0, handleObj );
  12755. } else {
  12756. handlers.push( handleObj );
  12757. }
  12758. // Keep track of which events have ever been used, for event optimization
  12759. jQuery.event.global[ type ] = true;
  12760. }
  12761. },
  12762. // Detach an event or set of events from an element
  12763. remove: function( elem, types, handler, selector, mappedTypes ) {
  12764. var j, origCount, tmp,
  12765. events, t, handleObj,
  12766. special, handlers, type, namespaces, origType,
  12767. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  12768. if ( !elemData || !( events = elemData.events ) ) {
  12769. return;
  12770. }
  12771. // Once for each type.namespace in types; type may be omitted
  12772. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12773. t = types.length;
  12774. while ( t-- ) {
  12775. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12776. type = origType = tmp[ 1 ];
  12777. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12778. // Unbind all events (on this namespace, if provided) for the element
  12779. if ( !type ) {
  12780. for ( type in events ) {
  12781. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  12782. }
  12783. continue;
  12784. }
  12785. special = jQuery.event.special[ type ] || {};
  12786. type = ( selector ? special.delegateType : special.bindType ) || type;
  12787. handlers = events[ type ] || [];
  12788. tmp = tmp[ 2 ] &&
  12789. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  12790. // Remove matching events
  12791. origCount = j = handlers.length;
  12792. while ( j-- ) {
  12793. handleObj = handlers[ j ];
  12794. if ( ( mappedTypes || origType === handleObj.origType ) &&
  12795. ( !handler || handler.guid === handleObj.guid ) &&
  12796. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  12797. ( !selector || selector === handleObj.selector ||
  12798. selector === "**" && handleObj.selector ) ) {
  12799. handlers.splice( j, 1 );
  12800. if ( handleObj.selector ) {
  12801. handlers.delegateCount--;
  12802. }
  12803. if ( special.remove ) {
  12804. special.remove.call( elem, handleObj );
  12805. }
  12806. }
  12807. }
  12808. // Remove generic event handler if we removed something and no more handlers exist
  12809. // (avoids potential for endless recursion during removal of special event handlers)
  12810. if ( origCount && !handlers.length ) {
  12811. if ( !special.teardown ||
  12812. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  12813. jQuery.removeEvent( elem, type, elemData.handle );
  12814. }
  12815. delete events[ type ];
  12816. }
  12817. }
  12818. // Remove data and the expando if it's no longer used
  12819. if ( jQuery.isEmptyObject( events ) ) {
  12820. dataPriv.remove( elem, "handle events" );
  12821. }
  12822. },
  12823. dispatch: function( nativeEvent ) {
  12824. // Make a writable jQuery.Event from the native event object
  12825. var event = jQuery.event.fix( nativeEvent );
  12826. var i, j, ret, matched, handleObj, handlerQueue,
  12827. args = new Array( arguments.length ),
  12828. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  12829. special = jQuery.event.special[ event.type ] || {};
  12830. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  12831. args[ 0 ] = event;
  12832. for ( i = 1; i < arguments.length; i++ ) {
  12833. args[ i ] = arguments[ i ];
  12834. }
  12835. event.delegateTarget = this;
  12836. // Call the preDispatch hook for the mapped type, and let it bail if desired
  12837. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  12838. return;
  12839. }
  12840. // Determine handlers
  12841. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  12842. // Run delegates first; they may want to stop propagation beneath us
  12843. i = 0;
  12844. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  12845. event.currentTarget = matched.elem;
  12846. j = 0;
  12847. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  12848. !event.isImmediatePropagationStopped() ) {
  12849. // If the event is namespaced, then each handler is only invoked if it is
  12850. // specially universal or its namespaces are a superset of the event's.
  12851. if ( !event.rnamespace || handleObj.namespace === false ||
  12852. event.rnamespace.test( handleObj.namespace ) ) {
  12853. event.handleObj = handleObj;
  12854. event.data = handleObj.data;
  12855. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  12856. handleObj.handler ).apply( matched.elem, args );
  12857. if ( ret !== undefined ) {
  12858. if ( ( event.result = ret ) === false ) {
  12859. event.preventDefault();
  12860. event.stopPropagation();
  12861. }
  12862. }
  12863. }
  12864. }
  12865. }
  12866. // Call the postDispatch hook for the mapped type
  12867. if ( special.postDispatch ) {
  12868. special.postDispatch.call( this, event );
  12869. }
  12870. return event.result;
  12871. },
  12872. handlers: function( event, handlers ) {
  12873. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  12874. handlerQueue = [],
  12875. delegateCount = handlers.delegateCount,
  12876. cur = event.target;
  12877. // Find delegate handlers
  12878. if ( delegateCount &&
  12879. // Support: IE <=9
  12880. // Black-hole SVG <use> instance trees (trac-13180)
  12881. cur.nodeType &&
  12882. // Support: Firefox <=42
  12883. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  12884. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  12885. // Support: IE 11 only
  12886. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  12887. !( event.type === "click" && event.button >= 1 ) ) {
  12888. for ( ; cur !== this; cur = cur.parentNode || this ) {
  12889. // Don't check non-elements (#13208)
  12890. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  12891. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  12892. matchedHandlers = [];
  12893. matchedSelectors = {};
  12894. for ( i = 0; i < delegateCount; i++ ) {
  12895. handleObj = handlers[ i ];
  12896. // Don't conflict with Object.prototype properties (#13203)
  12897. sel = handleObj.selector + " ";
  12898. if ( matchedSelectors[ sel ] === undefined ) {
  12899. matchedSelectors[ sel ] = handleObj.needsContext ?
  12900. jQuery( sel, this ).index( cur ) > -1 :
  12901. jQuery.find( sel, this, null, [ cur ] ).length;
  12902. }
  12903. if ( matchedSelectors[ sel ] ) {
  12904. matchedHandlers.push( handleObj );
  12905. }
  12906. }
  12907. if ( matchedHandlers.length ) {
  12908. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  12909. }
  12910. }
  12911. }
  12912. }
  12913. // Add the remaining (directly-bound) handlers
  12914. cur = this;
  12915. if ( delegateCount < handlers.length ) {
  12916. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  12917. }
  12918. return handlerQueue;
  12919. },
  12920. addProp: function( name, hook ) {
  12921. Object.defineProperty( jQuery.Event.prototype, name, {
  12922. enumerable: true,
  12923. configurable: true,
  12924. get: isFunction( hook ) ?
  12925. function() {
  12926. if ( this.originalEvent ) {
  12927. return hook( this.originalEvent );
  12928. }
  12929. } :
  12930. function() {
  12931. if ( this.originalEvent ) {
  12932. return this.originalEvent[ name ];
  12933. }
  12934. },
  12935. set: function( value ) {
  12936. Object.defineProperty( this, name, {
  12937. enumerable: true,
  12938. configurable: true,
  12939. writable: true,
  12940. value: value
  12941. } );
  12942. }
  12943. } );
  12944. },
  12945. fix: function( originalEvent ) {
  12946. return originalEvent[ jQuery.expando ] ?
  12947. originalEvent :
  12948. new jQuery.Event( originalEvent );
  12949. },
  12950. special: {
  12951. load: {
  12952. // Prevent triggered image.load events from bubbling to window.load
  12953. noBubble: true
  12954. },
  12955. click: {
  12956. // Utilize native event to ensure correct state for checkable inputs
  12957. setup: function( data ) {
  12958. // For mutual compressibility with _default, replace `this` access with a local var.
  12959. // `|| data` is dead code meant only to preserve the variable through minification.
  12960. var el = this || data;
  12961. // Claim the first handler
  12962. if ( rcheckableType.test( el.type ) &&
  12963. el.click && nodeName( el, "input" ) ) {
  12964. // dataPriv.set( el, "click", ... )
  12965. leverageNative( el, "click", returnTrue );
  12966. }
  12967. // Return false to allow normal processing in the caller
  12968. return false;
  12969. },
  12970. trigger: function( data ) {
  12971. // For mutual compressibility with _default, replace `this` access with a local var.
  12972. // `|| data` is dead code meant only to preserve the variable through minification.
  12973. var el = this || data;
  12974. // Force setup before triggering a click
  12975. if ( rcheckableType.test( el.type ) &&
  12976. el.click && nodeName( el, "input" ) ) {
  12977. leverageNative( el, "click" );
  12978. }
  12979. // Return non-false to allow normal event-path propagation
  12980. return true;
  12981. },
  12982. // For cross-browser consistency, suppress native .click() on links
  12983. // Also prevent it if we're currently inside a leveraged native-event stack
  12984. _default: function( event ) {
  12985. var target = event.target;
  12986. return rcheckableType.test( target.type ) &&
  12987. target.click && nodeName( target, "input" ) &&
  12988. dataPriv.get( target, "click" ) ||
  12989. nodeName( target, "a" );
  12990. }
  12991. },
  12992. beforeunload: {
  12993. postDispatch: function( event ) {
  12994. // Support: Firefox 20+
  12995. // Firefox doesn't alert if the returnValue field is not set.
  12996. if ( event.result !== undefined && event.originalEvent ) {
  12997. event.originalEvent.returnValue = event.result;
  12998. }
  12999. }
  13000. }
  13001. }
  13002. };
  13003. // Ensure the presence of an event listener that handles manually-triggered
  13004. // synthetic events by interrupting progress until reinvoked in response to
  13005. // *native* events that it fires directly, ensuring that state changes have
  13006. // already occurred before other listeners are invoked.
  13007. function leverageNative( el, type, expectSync ) {
  13008. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  13009. if ( !expectSync ) {
  13010. if ( dataPriv.get( el, type ) === undefined ) {
  13011. jQuery.event.add( el, type, returnTrue );
  13012. }
  13013. return;
  13014. }
  13015. // Register the controller as a special universal handler for all event namespaces
  13016. dataPriv.set( el, type, false );
  13017. jQuery.event.add( el, type, {
  13018. namespace: false,
  13019. handler: function( event ) {
  13020. var notAsync, result,
  13021. saved = dataPriv.get( this, type );
  13022. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  13023. // Interrupt processing of the outer synthetic .trigger()ed event
  13024. // Saved data should be false in such cases, but might be a leftover capture object
  13025. // from an async native handler (gh-4350)
  13026. if ( !saved.length ) {
  13027. // Store arguments for use when handling the inner native event
  13028. // There will always be at least one argument (an event object), so this array
  13029. // will not be confused with a leftover capture object.
  13030. saved = slice.call( arguments );
  13031. dataPriv.set( this, type, saved );
  13032. // Trigger the native event and capture its result
  13033. // Support: IE <=9 - 11+
  13034. // focus() and blur() are asynchronous
  13035. notAsync = expectSync( this, type );
  13036. this[ type ]();
  13037. result = dataPriv.get( this, type );
  13038. if ( saved !== result || notAsync ) {
  13039. dataPriv.set( this, type, false );
  13040. } else {
  13041. result = {};
  13042. }
  13043. if ( saved !== result ) {
  13044. // Cancel the outer synthetic event
  13045. event.stopImmediatePropagation();
  13046. event.preventDefault();
  13047. return result.value;
  13048. }
  13049. // If this is an inner synthetic event for an event with a bubbling surrogate
  13050. // (focus or blur), assume that the surrogate already propagated from triggering the
  13051. // native event and prevent that from happening again here.
  13052. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  13053. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  13054. // less bad than duplication.
  13055. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  13056. event.stopPropagation();
  13057. }
  13058. // If this is a native event triggered above, everything is now in order
  13059. // Fire an inner synthetic event with the original arguments
  13060. } else if ( saved.length ) {
  13061. // ...and capture the result
  13062. dataPriv.set( this, type, {
  13063. value: jQuery.event.trigger(
  13064. // Support: IE <=9 - 11+
  13065. // Extend with the prototype to reset the above stopImmediatePropagation()
  13066. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  13067. saved.slice( 1 ),
  13068. this
  13069. )
  13070. } );
  13071. // Abort handling of the native event
  13072. event.stopImmediatePropagation();
  13073. }
  13074. }
  13075. } );
  13076. }
  13077. jQuery.removeEvent = function( elem, type, handle ) {
  13078. // This "if" is needed for plain objects
  13079. if ( elem.removeEventListener ) {
  13080. elem.removeEventListener( type, handle );
  13081. }
  13082. };
  13083. jQuery.Event = function( src, props ) {
  13084. // Allow instantiation without the 'new' keyword
  13085. if ( !( this instanceof jQuery.Event ) ) {
  13086. return new jQuery.Event( src, props );
  13087. }
  13088. // Event object
  13089. if ( src && src.type ) {
  13090. this.originalEvent = src;
  13091. this.type = src.type;
  13092. // Events bubbling up the document may have been marked as prevented
  13093. // by a handler lower down the tree; reflect the correct value.
  13094. this.isDefaultPrevented = src.defaultPrevented ||
  13095. src.defaultPrevented === undefined &&
  13096. // Support: Android <=2.3 only
  13097. src.returnValue === false ?
  13098. returnTrue :
  13099. returnFalse;
  13100. // Create target properties
  13101. // Support: Safari <=6 - 7 only
  13102. // Target should not be a text node (#504, #13143)
  13103. this.target = ( src.target && src.target.nodeType === 3 ) ?
  13104. src.target.parentNode :
  13105. src.target;
  13106. this.currentTarget = src.currentTarget;
  13107. this.relatedTarget = src.relatedTarget;
  13108. // Event type
  13109. } else {
  13110. this.type = src;
  13111. }
  13112. // Put explicitly provided properties onto the event object
  13113. if ( props ) {
  13114. jQuery.extend( this, props );
  13115. }
  13116. // Create a timestamp if incoming event doesn't have one
  13117. this.timeStamp = src && src.timeStamp || Date.now();
  13118. // Mark it as fixed
  13119. this[ jQuery.expando ] = true;
  13120. };
  13121. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  13122. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  13123. jQuery.Event.prototype = {
  13124. constructor: jQuery.Event,
  13125. isDefaultPrevented: returnFalse,
  13126. isPropagationStopped: returnFalse,
  13127. isImmediatePropagationStopped: returnFalse,
  13128. isSimulated: false,
  13129. preventDefault: function() {
  13130. var e = this.originalEvent;
  13131. this.isDefaultPrevented = returnTrue;
  13132. if ( e && !this.isSimulated ) {
  13133. e.preventDefault();
  13134. }
  13135. },
  13136. stopPropagation: function() {
  13137. var e = this.originalEvent;
  13138. this.isPropagationStopped = returnTrue;
  13139. if ( e && !this.isSimulated ) {
  13140. e.stopPropagation();
  13141. }
  13142. },
  13143. stopImmediatePropagation: function() {
  13144. var e = this.originalEvent;
  13145. this.isImmediatePropagationStopped = returnTrue;
  13146. if ( e && !this.isSimulated ) {
  13147. e.stopImmediatePropagation();
  13148. }
  13149. this.stopPropagation();
  13150. }
  13151. };
  13152. // Includes all common event props including KeyEvent and MouseEvent specific props
  13153. jQuery.each( {
  13154. altKey: true,
  13155. bubbles: true,
  13156. cancelable: true,
  13157. changedTouches: true,
  13158. ctrlKey: true,
  13159. detail: true,
  13160. eventPhase: true,
  13161. metaKey: true,
  13162. pageX: true,
  13163. pageY: true,
  13164. shiftKey: true,
  13165. view: true,
  13166. "char": true,
  13167. code: true,
  13168. charCode: true,
  13169. key: true,
  13170. keyCode: true,
  13171. button: true,
  13172. buttons: true,
  13173. clientX: true,
  13174. clientY: true,
  13175. offsetX: true,
  13176. offsetY: true,
  13177. pointerId: true,
  13178. pointerType: true,
  13179. screenX: true,
  13180. screenY: true,
  13181. targetTouches: true,
  13182. toElement: true,
  13183. touches: true,
  13184. which: function( event ) {
  13185. var button = event.button;
  13186. // Add which for key events
  13187. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  13188. return event.charCode != null ? event.charCode : event.keyCode;
  13189. }
  13190. // Add which for click: 1 === left; 2 === middle; 3 === right
  13191. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  13192. if ( button & 1 ) {
  13193. return 1;
  13194. }
  13195. if ( button & 2 ) {
  13196. return 3;
  13197. }
  13198. if ( button & 4 ) {
  13199. return 2;
  13200. }
  13201. return 0;
  13202. }
  13203. return event.which;
  13204. }
  13205. }, jQuery.event.addProp );
  13206. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  13207. jQuery.event.special[ type ] = {
  13208. // Utilize native event if possible so blur/focus sequence is correct
  13209. setup: function() {
  13210. // Claim the first handler
  13211. // dataPriv.set( this, "focus", ... )
  13212. // dataPriv.set( this, "blur", ... )
  13213. leverageNative( this, type, expectSync );
  13214. // Return false to allow normal processing in the caller
  13215. return false;
  13216. },
  13217. trigger: function() {
  13218. // Force setup before trigger
  13219. leverageNative( this, type );
  13220. // Return non-false to allow normal event-path propagation
  13221. return true;
  13222. },
  13223. delegateType: delegateType
  13224. };
  13225. } );
  13226. // Create mouseenter/leave events using mouseover/out and event-time checks
  13227. // so that event delegation works in jQuery.
  13228. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  13229. //
  13230. // Support: Safari 7 only
  13231. // Safari sends mouseenter too often; see:
  13232. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  13233. // for the description of the bug (it existed in older Chrome versions as well).
  13234. jQuery.each( {
  13235. mouseenter: "mouseover",
  13236. mouseleave: "mouseout",
  13237. pointerenter: "pointerover",
  13238. pointerleave: "pointerout"
  13239. }, function( orig, fix ) {
  13240. jQuery.event.special[ orig ] = {
  13241. delegateType: fix,
  13242. bindType: fix,
  13243. handle: function( event ) {
  13244. var ret,
  13245. target = this,
  13246. related = event.relatedTarget,
  13247. handleObj = event.handleObj;
  13248. // For mouseenter/leave call the handler if related is outside the target.
  13249. // NB: No relatedTarget if the mouse left/entered the browser window
  13250. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  13251. event.type = handleObj.origType;
  13252. ret = handleObj.handler.apply( this, arguments );
  13253. event.type = fix;
  13254. }
  13255. return ret;
  13256. }
  13257. };
  13258. } );
  13259. jQuery.fn.extend( {
  13260. on: function( types, selector, data, fn ) {
  13261. return on( this, types, selector, data, fn );
  13262. },
  13263. one: function( types, selector, data, fn ) {
  13264. return on( this, types, selector, data, fn, 1 );
  13265. },
  13266. off: function( types, selector, fn ) {
  13267. var handleObj, type;
  13268. if ( types && types.preventDefault && types.handleObj ) {
  13269. // ( event ) dispatched jQuery.Event
  13270. handleObj = types.handleObj;
  13271. jQuery( types.delegateTarget ).off(
  13272. handleObj.namespace ?
  13273. handleObj.origType + "." + handleObj.namespace :
  13274. handleObj.origType,
  13275. handleObj.selector,
  13276. handleObj.handler
  13277. );
  13278. return this;
  13279. }
  13280. if ( typeof types === "object" ) {
  13281. // ( types-object [, selector] )
  13282. for ( type in types ) {
  13283. this.off( type, selector, types[ type ] );
  13284. }
  13285. return this;
  13286. }
  13287. if ( selector === false || typeof selector === "function" ) {
  13288. // ( types [, fn] )
  13289. fn = selector;
  13290. selector = undefined;
  13291. }
  13292. if ( fn === false ) {
  13293. fn = returnFalse;
  13294. }
  13295. return this.each( function() {
  13296. jQuery.event.remove( this, types, fn, selector );
  13297. } );
  13298. }
  13299. } );
  13300. var
  13301. /* eslint-disable max-len */
  13302. // See https://github.com/eslint/eslint/issues/3229
  13303. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  13304. /* eslint-enable */
  13305. // Support: IE <=10 - 11, Edge 12 - 13 only
  13306. // In IE/Edge using regex groups here causes severe slowdowns.
  13307. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  13308. rnoInnerhtml = /<script|<style|<link/i,
  13309. // checked="checked" or checked
  13310. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  13311. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  13312. // Prefer a tbody over its parent table for containing new rows
  13313. function manipulationTarget( elem, content ) {
  13314. if ( nodeName( elem, "table" ) &&
  13315. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  13316. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  13317. }
  13318. return elem;
  13319. }
  13320. // Replace/restore the type attribute of script elements for safe DOM manipulation
  13321. function disableScript( elem ) {
  13322. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  13323. return elem;
  13324. }
  13325. function restoreScript( elem ) {
  13326. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  13327. elem.type = elem.type.slice( 5 );
  13328. } else {
  13329. elem.removeAttribute( "type" );
  13330. }
  13331. return elem;
  13332. }
  13333. function cloneCopyEvent( src, dest ) {
  13334. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  13335. if ( dest.nodeType !== 1 ) {
  13336. return;
  13337. }
  13338. // 1. Copy private data: events, handlers, etc.
  13339. if ( dataPriv.hasData( src ) ) {
  13340. pdataOld = dataPriv.access( src );
  13341. pdataCur = dataPriv.set( dest, pdataOld );
  13342. events = pdataOld.events;
  13343. if ( events ) {
  13344. delete pdataCur.handle;
  13345. pdataCur.events = {};
  13346. for ( type in events ) {
  13347. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  13348. jQuery.event.add( dest, type, events[ type ][ i ] );
  13349. }
  13350. }
  13351. }
  13352. }
  13353. // 2. Copy user data
  13354. if ( dataUser.hasData( src ) ) {
  13355. udataOld = dataUser.access( src );
  13356. udataCur = jQuery.extend( {}, udataOld );
  13357. dataUser.set( dest, udataCur );
  13358. }
  13359. }
  13360. // Fix IE bugs, see support tests
  13361. function fixInput( src, dest ) {
  13362. var nodeName = dest.nodeName.toLowerCase();
  13363. // Fails to persist the checked state of a cloned checkbox or radio button.
  13364. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  13365. dest.checked = src.checked;
  13366. // Fails to return the selected option to the default selected state when cloning options
  13367. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  13368. dest.defaultValue = src.defaultValue;
  13369. }
  13370. }
  13371. function domManip( collection, args, callback, ignored ) {
  13372. // Flatten any nested arrays
  13373. args = concat.apply( [], args );
  13374. var fragment, first, scripts, hasScripts, node, doc,
  13375. i = 0,
  13376. l = collection.length,
  13377. iNoClone = l - 1,
  13378. value = args[ 0 ],
  13379. valueIsFunction = isFunction( value );
  13380. // We can't cloneNode fragments that contain checked, in WebKit
  13381. if ( valueIsFunction ||
  13382. ( l > 1 && typeof value === "string" &&
  13383. !support.checkClone && rchecked.test( value ) ) ) {
  13384. return collection.each( function( index ) {
  13385. var self = collection.eq( index );
  13386. if ( valueIsFunction ) {
  13387. args[ 0 ] = value.call( this, index, self.html() );
  13388. }
  13389. domManip( self, args, callback, ignored );
  13390. } );
  13391. }
  13392. if ( l ) {
  13393. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  13394. first = fragment.firstChild;
  13395. if ( fragment.childNodes.length === 1 ) {
  13396. fragment = first;
  13397. }
  13398. // Require either new content or an interest in ignored elements to invoke the callback
  13399. if ( first || ignored ) {
  13400. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  13401. hasScripts = scripts.length;
  13402. // Use the original fragment for the last item
  13403. // instead of the first because it can end up
  13404. // being emptied incorrectly in certain situations (#8070).
  13405. for ( ; i < l; i++ ) {
  13406. node = fragment;
  13407. if ( i !== iNoClone ) {
  13408. node = jQuery.clone( node, true, true );
  13409. // Keep references to cloned scripts for later restoration
  13410. if ( hasScripts ) {
  13411. // Support: Android <=4.0 only, PhantomJS 1 only
  13412. // push.apply(_, arraylike) throws on ancient WebKit
  13413. jQuery.merge( scripts, getAll( node, "script" ) );
  13414. }
  13415. }
  13416. callback.call( collection[ i ], node, i );
  13417. }
  13418. if ( hasScripts ) {
  13419. doc = scripts[ scripts.length - 1 ].ownerDocument;
  13420. // Reenable scripts
  13421. jQuery.map( scripts, restoreScript );
  13422. // Evaluate executable scripts on first document insertion
  13423. for ( i = 0; i < hasScripts; i++ ) {
  13424. node = scripts[ i ];
  13425. if ( rscriptType.test( node.type || "" ) &&
  13426. !dataPriv.access( node, "globalEval" ) &&
  13427. jQuery.contains( doc, node ) ) {
  13428. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  13429. // Optional AJAX dependency, but won't run scripts if not present
  13430. if ( jQuery._evalUrl && !node.noModule ) {
  13431. jQuery._evalUrl( node.src, {
  13432. nonce: node.nonce || node.getAttribute( "nonce" )
  13433. } );
  13434. }
  13435. } else {
  13436. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  13437. }
  13438. }
  13439. }
  13440. }
  13441. }
  13442. }
  13443. return collection;
  13444. }
  13445. function remove( elem, selector, keepData ) {
  13446. var node,
  13447. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  13448. i = 0;
  13449. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  13450. if ( !keepData && node.nodeType === 1 ) {
  13451. jQuery.cleanData( getAll( node ) );
  13452. }
  13453. if ( node.parentNode ) {
  13454. if ( keepData && isAttached( node ) ) {
  13455. setGlobalEval( getAll( node, "script" ) );
  13456. }
  13457. node.parentNode.removeChild( node );
  13458. }
  13459. }
  13460. return elem;
  13461. }
  13462. jQuery.extend( {
  13463. htmlPrefilter: function( html ) {
  13464. return html.replace( rxhtmlTag, "<$1></$2>" );
  13465. },
  13466. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  13467. var i, l, srcElements, destElements,
  13468. clone = elem.cloneNode( true ),
  13469. inPage = isAttached( elem );
  13470. // Fix IE cloning issues
  13471. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  13472. !jQuery.isXMLDoc( elem ) ) {
  13473. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  13474. destElements = getAll( clone );
  13475. srcElements = getAll( elem );
  13476. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13477. fixInput( srcElements[ i ], destElements[ i ] );
  13478. }
  13479. }
  13480. // Copy the events from the original to the clone
  13481. if ( dataAndEvents ) {
  13482. if ( deepDataAndEvents ) {
  13483. srcElements = srcElements || getAll( elem );
  13484. destElements = destElements || getAll( clone );
  13485. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13486. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  13487. }
  13488. } else {
  13489. cloneCopyEvent( elem, clone );
  13490. }
  13491. }
  13492. // Preserve script evaluation history
  13493. destElements = getAll( clone, "script" );
  13494. if ( destElements.length > 0 ) {
  13495. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  13496. }
  13497. // Return the cloned set
  13498. return clone;
  13499. },
  13500. cleanData: function( elems ) {
  13501. var data, elem, type,
  13502. special = jQuery.event.special,
  13503. i = 0;
  13504. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  13505. if ( acceptData( elem ) ) {
  13506. if ( ( data = elem[ dataPriv.expando ] ) ) {
  13507. if ( data.events ) {
  13508. for ( type in data.events ) {
  13509. if ( special[ type ] ) {
  13510. jQuery.event.remove( elem, type );
  13511. // This is a shortcut to avoid jQuery.event.remove's overhead
  13512. } else {
  13513. jQuery.removeEvent( elem, type, data.handle );
  13514. }
  13515. }
  13516. }
  13517. // Support: Chrome <=35 - 45+
  13518. // Assign undefined instead of using delete, see Data#remove
  13519. elem[ dataPriv.expando ] = undefined;
  13520. }
  13521. if ( elem[ dataUser.expando ] ) {
  13522. // Support: Chrome <=35 - 45+
  13523. // Assign undefined instead of using delete, see Data#remove
  13524. elem[ dataUser.expando ] = undefined;
  13525. }
  13526. }
  13527. }
  13528. }
  13529. } );
  13530. jQuery.fn.extend( {
  13531. detach: function( selector ) {
  13532. return remove( this, selector, true );
  13533. },
  13534. remove: function( selector ) {
  13535. return remove( this, selector );
  13536. },
  13537. text: function( value ) {
  13538. return access( this, function( value ) {
  13539. return value === undefined ?
  13540. jQuery.text( this ) :
  13541. this.empty().each( function() {
  13542. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13543. this.textContent = value;
  13544. }
  13545. } );
  13546. }, null, value, arguments.length );
  13547. },
  13548. append: function() {
  13549. return domManip( this, arguments, function( elem ) {
  13550. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13551. var target = manipulationTarget( this, elem );
  13552. target.appendChild( elem );
  13553. }
  13554. } );
  13555. },
  13556. prepend: function() {
  13557. return domManip( this, arguments, function( elem ) {
  13558. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13559. var target = manipulationTarget( this, elem );
  13560. target.insertBefore( elem, target.firstChild );
  13561. }
  13562. } );
  13563. },
  13564. before: function() {
  13565. return domManip( this, arguments, function( elem ) {
  13566. if ( this.parentNode ) {
  13567. this.parentNode.insertBefore( elem, this );
  13568. }
  13569. } );
  13570. },
  13571. after: function() {
  13572. return domManip( this, arguments, function( elem ) {
  13573. if ( this.parentNode ) {
  13574. this.parentNode.insertBefore( elem, this.nextSibling );
  13575. }
  13576. } );
  13577. },
  13578. empty: function() {
  13579. var elem,
  13580. i = 0;
  13581. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  13582. if ( elem.nodeType === 1 ) {
  13583. // Prevent memory leaks
  13584. jQuery.cleanData( getAll( elem, false ) );
  13585. // Remove any remaining nodes
  13586. elem.textContent = "";
  13587. }
  13588. }
  13589. return this;
  13590. },
  13591. clone: function( dataAndEvents, deepDataAndEvents ) {
  13592. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  13593. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  13594. return this.map( function() {
  13595. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  13596. } );
  13597. },
  13598. html: function( value ) {
  13599. return access( this, function( value ) {
  13600. var elem = this[ 0 ] || {},
  13601. i = 0,
  13602. l = this.length;
  13603. if ( value === undefined && elem.nodeType === 1 ) {
  13604. return elem.innerHTML;
  13605. }
  13606. // See if we can take a shortcut and just use innerHTML
  13607. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  13608. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  13609. value = jQuery.htmlPrefilter( value );
  13610. try {
  13611. for ( ; i < l; i++ ) {
  13612. elem = this[ i ] || {};
  13613. // Remove element nodes and prevent memory leaks
  13614. if ( elem.nodeType === 1 ) {
  13615. jQuery.cleanData( getAll( elem, false ) );
  13616. elem.innerHTML = value;
  13617. }
  13618. }
  13619. elem = 0;
  13620. // If using innerHTML throws an exception, use the fallback method
  13621. } catch ( e ) {}
  13622. }
  13623. if ( elem ) {
  13624. this.empty().append( value );
  13625. }
  13626. }, null, value, arguments.length );
  13627. },
  13628. replaceWith: function() {
  13629. var ignored = [];
  13630. // Make the changes, replacing each non-ignored context element with the new content
  13631. return domManip( this, arguments, function( elem ) {
  13632. var parent = this.parentNode;
  13633. if ( jQuery.inArray( this, ignored ) < 0 ) {
  13634. jQuery.cleanData( getAll( this ) );
  13635. if ( parent ) {
  13636. parent.replaceChild( elem, this );
  13637. }
  13638. }
  13639. // Force callback invocation
  13640. }, ignored );
  13641. }
  13642. } );
  13643. jQuery.each( {
  13644. appendTo: "append",
  13645. prependTo: "prepend",
  13646. insertBefore: "before",
  13647. insertAfter: "after",
  13648. replaceAll: "replaceWith"
  13649. }, function( name, original ) {
  13650. jQuery.fn[ name ] = function( selector ) {
  13651. var elems,
  13652. ret = [],
  13653. insert = jQuery( selector ),
  13654. last = insert.length - 1,
  13655. i = 0;
  13656. for ( ; i <= last; i++ ) {
  13657. elems = i === last ? this : this.clone( true );
  13658. jQuery( insert[ i ] )[ original ]( elems );
  13659. // Support: Android <=4.0 only, PhantomJS 1 only
  13660. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  13661. push.apply( ret, elems.get() );
  13662. }
  13663. return this.pushStack( ret );
  13664. };
  13665. } );
  13666. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  13667. var getStyles = function( elem ) {
  13668. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  13669. // IE throws on elements created in popups
  13670. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  13671. var view = elem.ownerDocument.defaultView;
  13672. if ( !view || !view.opener ) {
  13673. view = window;
  13674. }
  13675. return view.getComputedStyle( elem );
  13676. };
  13677. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  13678. ( function() {
  13679. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  13680. // so they're executed at the same time to save the second computation.
  13681. function computeStyleTests() {
  13682. // This is a singleton, we need to execute it only once
  13683. if ( !div ) {
  13684. return;
  13685. }
  13686. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  13687. "margin-top:1px;padding:0;border:0";
  13688. div.style.cssText =
  13689. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  13690. "margin:auto;border:1px;padding:1px;" +
  13691. "width:60%;top:1%";
  13692. documentElement.appendChild( container ).appendChild( div );
  13693. var divStyle = window.getComputedStyle( div );
  13694. pixelPositionVal = divStyle.top !== "1%";
  13695. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  13696. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  13697. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  13698. // Some styles come back with percentage values, even though they shouldn't
  13699. div.style.right = "60%";
  13700. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  13701. // Support: IE 9 - 11 only
  13702. // Detect misreporting of content dimensions for box-sizing:border-box elements
  13703. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  13704. // Support: IE 9 only
  13705. // Detect overflow:scroll screwiness (gh-3699)
  13706. // Support: Chrome <=64
  13707. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  13708. div.style.position = "absolute";
  13709. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  13710. documentElement.removeChild( container );
  13711. // Nullify the div so it wouldn't be stored in the memory and
  13712. // it will also be a sign that checks already performed
  13713. div = null;
  13714. }
  13715. function roundPixelMeasures( measure ) {
  13716. return Math.round( parseFloat( measure ) );
  13717. }
  13718. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  13719. reliableMarginLeftVal,
  13720. container = document.createElement( "div" ),
  13721. div = document.createElement( "div" );
  13722. // Finish early in limited (non-browser) environments
  13723. if ( !div.style ) {
  13724. return;
  13725. }
  13726. // Support: IE <=9 - 11 only
  13727. // Style of cloned element affects source element cloned (#8908)
  13728. div.style.backgroundClip = "content-box";
  13729. div.cloneNode( true ).style.backgroundClip = "";
  13730. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  13731. jQuery.extend( support, {
  13732. boxSizingReliable: function() {
  13733. computeStyleTests();
  13734. return boxSizingReliableVal;
  13735. },
  13736. pixelBoxStyles: function() {
  13737. computeStyleTests();
  13738. return pixelBoxStylesVal;
  13739. },
  13740. pixelPosition: function() {
  13741. computeStyleTests();
  13742. return pixelPositionVal;
  13743. },
  13744. reliableMarginLeft: function() {
  13745. computeStyleTests();
  13746. return reliableMarginLeftVal;
  13747. },
  13748. scrollboxSize: function() {
  13749. computeStyleTests();
  13750. return scrollboxSizeVal;
  13751. }
  13752. } );
  13753. } )();
  13754. function curCSS( elem, name, computed ) {
  13755. var width, minWidth, maxWidth, ret,
  13756. // Support: Firefox 51+
  13757. // Retrieving style before computed somehow
  13758. // fixes an issue with getting wrong values
  13759. // on detached elements
  13760. style = elem.style;
  13761. computed = computed || getStyles( elem );
  13762. // getPropertyValue is needed for:
  13763. // .css('filter') (IE 9 only, #12537)
  13764. // .css('--customProperty) (#3144)
  13765. if ( computed ) {
  13766. ret = computed.getPropertyValue( name ) || computed[ name ];
  13767. if ( ret === "" && !isAttached( elem ) ) {
  13768. ret = jQuery.style( elem, name );
  13769. }
  13770. // A tribute to the "awesome hack by Dean Edwards"
  13771. // Android Browser returns percentage for some values,
  13772. // but width seems to be reliably pixels.
  13773. // This is against the CSSOM draft spec:
  13774. // https://drafts.csswg.org/cssom/#resolved-values
  13775. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  13776. // Remember the original values
  13777. width = style.width;
  13778. minWidth = style.minWidth;
  13779. maxWidth = style.maxWidth;
  13780. // Put in the new values to get a computed value out
  13781. style.minWidth = style.maxWidth = style.width = ret;
  13782. ret = computed.width;
  13783. // Revert the changed values
  13784. style.width = width;
  13785. style.minWidth = minWidth;
  13786. style.maxWidth = maxWidth;
  13787. }
  13788. }
  13789. return ret !== undefined ?
  13790. // Support: IE <=9 - 11 only
  13791. // IE returns zIndex value as an integer.
  13792. ret + "" :
  13793. ret;
  13794. }
  13795. function addGetHookIf( conditionFn, hookFn ) {
  13796. // Define the hook, we'll check on the first run if it's really needed.
  13797. return {
  13798. get: function() {
  13799. if ( conditionFn() ) {
  13800. // Hook not needed (or it's not possible to use it due
  13801. // to missing dependency), remove it.
  13802. delete this.get;
  13803. return;
  13804. }
  13805. // Hook needed; redefine it so that the support test is not executed again.
  13806. return ( this.get = hookFn ).apply( this, arguments );
  13807. }
  13808. };
  13809. }
  13810. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  13811. emptyStyle = document.createElement( "div" ).style,
  13812. vendorProps = {};
  13813. // Return a vendor-prefixed property or undefined
  13814. function vendorPropName( name ) {
  13815. // Check for vendor prefixed names
  13816. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  13817. i = cssPrefixes.length;
  13818. while ( i-- ) {
  13819. name = cssPrefixes[ i ] + capName;
  13820. if ( name in emptyStyle ) {
  13821. return name;
  13822. }
  13823. }
  13824. }
  13825. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  13826. function finalPropName( name ) {
  13827. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  13828. if ( final ) {
  13829. return final;
  13830. }
  13831. if ( name in emptyStyle ) {
  13832. return name;
  13833. }
  13834. return vendorProps[ name ] = vendorPropName( name ) || name;
  13835. }
  13836. var
  13837. // Swappable if display is none or starts with table
  13838. // except "table", "table-cell", or "table-caption"
  13839. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  13840. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  13841. rcustomProp = /^--/,
  13842. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  13843. cssNormalTransform = {
  13844. letterSpacing: "0",
  13845. fontWeight: "400"
  13846. };
  13847. function setPositiveNumber( elem, value, subtract ) {
  13848. // Any relative (+/-) values have already been
  13849. // normalized at this point
  13850. var matches = rcssNum.exec( value );
  13851. return matches ?
  13852. // Guard against undefined "subtract", e.g., when used as in cssHooks
  13853. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  13854. value;
  13855. }
  13856. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  13857. var i = dimension === "width" ? 1 : 0,
  13858. extra = 0,
  13859. delta = 0;
  13860. // Adjustment may not be necessary
  13861. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  13862. return 0;
  13863. }
  13864. for ( ; i < 4; i += 2 ) {
  13865. // Both box models exclude margin
  13866. if ( box === "margin" ) {
  13867. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  13868. }
  13869. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  13870. if ( !isBorderBox ) {
  13871. // Add padding
  13872. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13873. // For "border" or "margin", add border
  13874. if ( box !== "padding" ) {
  13875. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13876. // But still keep track of it otherwise
  13877. } else {
  13878. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13879. }
  13880. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  13881. // "padding" or "margin"
  13882. } else {
  13883. // For "content", subtract padding
  13884. if ( box === "content" ) {
  13885. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13886. }
  13887. // For "content" or "padding", subtract border
  13888. if ( box !== "margin" ) {
  13889. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13890. }
  13891. }
  13892. }
  13893. // Account for positive content-box scroll gutter when requested by providing computedVal
  13894. if ( !isBorderBox && computedVal >= 0 ) {
  13895. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  13896. // Assuming integer scroll gutter, subtract the rest and round down
  13897. delta += Math.max( 0, Math.ceil(
  13898. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13899. computedVal -
  13900. delta -
  13901. extra -
  13902. 0.5
  13903. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  13904. // Use an explicit zero to avoid NaN (gh-3964)
  13905. ) ) || 0;
  13906. }
  13907. return delta;
  13908. }
  13909. function getWidthOrHeight( elem, dimension, extra ) {
  13910. // Start with computed style
  13911. var styles = getStyles( elem ),
  13912. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  13913. // Fake content-box until we know it's needed to know the true value.
  13914. boxSizingNeeded = !support.boxSizingReliable() || extra,
  13915. isBorderBox = boxSizingNeeded &&
  13916. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13917. valueIsBorderBox = isBorderBox,
  13918. val = curCSS( elem, dimension, styles ),
  13919. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  13920. // Support: Firefox <=54
  13921. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  13922. if ( rnumnonpx.test( val ) ) {
  13923. if ( !extra ) {
  13924. return val;
  13925. }
  13926. val = "auto";
  13927. }
  13928. // Fall back to offsetWidth/offsetHeight when value is "auto"
  13929. // This happens for inline elements with no explicit setting (gh-3571)
  13930. // Support: Android <=4.1 - 4.3 only
  13931. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  13932. // Support: IE 9-11 only
  13933. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  13934. // We use getClientRects() to check for hidden/disconnected.
  13935. // In those cases, the computed value can be trusted to be border-box
  13936. if ( ( !support.boxSizingReliable() && isBorderBox ||
  13937. val === "auto" ||
  13938. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  13939. elem.getClientRects().length ) {
  13940. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  13941. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  13942. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  13943. // retrieved value as a content box dimension.
  13944. valueIsBorderBox = offsetProp in elem;
  13945. if ( valueIsBorderBox ) {
  13946. val = elem[ offsetProp ];
  13947. }
  13948. }
  13949. // Normalize "" and auto
  13950. val = parseFloat( val ) || 0;
  13951. // Adjust for the element's box model
  13952. return ( val +
  13953. boxModelAdjustment(
  13954. elem,
  13955. dimension,
  13956. extra || ( isBorderBox ? "border" : "content" ),
  13957. valueIsBorderBox,
  13958. styles,
  13959. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  13960. val
  13961. )
  13962. ) + "px";
  13963. }
  13964. jQuery.extend( {
  13965. // Add in style property hooks for overriding the default
  13966. // behavior of getting and setting a style property
  13967. cssHooks: {
  13968. opacity: {
  13969. get: function( elem, computed ) {
  13970. if ( computed ) {
  13971. // We should always get a number back from opacity
  13972. var ret = curCSS( elem, "opacity" );
  13973. return ret === "" ? "1" : ret;
  13974. }
  13975. }
  13976. }
  13977. },
  13978. // Don't automatically add "px" to these possibly-unitless properties
  13979. cssNumber: {
  13980. "animationIterationCount": true,
  13981. "columnCount": true,
  13982. "fillOpacity": true,
  13983. "flexGrow": true,
  13984. "flexShrink": true,
  13985. "fontWeight": true,
  13986. "gridArea": true,
  13987. "gridColumn": true,
  13988. "gridColumnEnd": true,
  13989. "gridColumnStart": true,
  13990. "gridRow": true,
  13991. "gridRowEnd": true,
  13992. "gridRowStart": true,
  13993. "lineHeight": true,
  13994. "opacity": true,
  13995. "order": true,
  13996. "orphans": true,
  13997. "widows": true,
  13998. "zIndex": true,
  13999. "zoom": true
  14000. },
  14001. // Add in properties whose names you wish to fix before
  14002. // setting or getting the value
  14003. cssProps: {},
  14004. // Get and set the style property on a DOM Node
  14005. style: function( elem, name, value, extra ) {
  14006. // Don't set styles on text and comment nodes
  14007. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  14008. return;
  14009. }
  14010. // Make sure that we're working with the right name
  14011. var ret, type, hooks,
  14012. origName = camelCase( name ),
  14013. isCustomProp = rcustomProp.test( name ),
  14014. style = elem.style;
  14015. // Make sure that we're working with the right name. We don't
  14016. // want to query the value if it is a CSS custom property
  14017. // since they are user-defined.
  14018. if ( !isCustomProp ) {
  14019. name = finalPropName( origName );
  14020. }
  14021. // Gets hook for the prefixed version, then unprefixed version
  14022. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14023. // Check if we're setting a value
  14024. if ( value !== undefined ) {
  14025. type = typeof value;
  14026. // Convert "+=" or "-=" to relative numbers (#7345)
  14027. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  14028. value = adjustCSS( elem, name, ret );
  14029. // Fixes bug #9237
  14030. type = "number";
  14031. }
  14032. // Make sure that null and NaN values aren't set (#7116)
  14033. if ( value == null || value !== value ) {
  14034. return;
  14035. }
  14036. // If a number was passed in, add the unit (except for certain CSS properties)
  14037. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  14038. // "px" to a few hardcoded values.
  14039. if ( type === "number" && !isCustomProp ) {
  14040. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  14041. }
  14042. // background-* props affect original clone's values
  14043. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  14044. style[ name ] = "inherit";
  14045. }
  14046. // If a hook was provided, use that value, otherwise just set the specified value
  14047. if ( !hooks || !( "set" in hooks ) ||
  14048. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  14049. if ( isCustomProp ) {
  14050. style.setProperty( name, value );
  14051. } else {
  14052. style[ name ] = value;
  14053. }
  14054. }
  14055. } else {
  14056. // If a hook was provided get the non-computed value from there
  14057. if ( hooks && "get" in hooks &&
  14058. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  14059. return ret;
  14060. }
  14061. // Otherwise just get the value from the style object
  14062. return style[ name ];
  14063. }
  14064. },
  14065. css: function( elem, name, extra, styles ) {
  14066. var val, num, hooks,
  14067. origName = camelCase( name ),
  14068. isCustomProp = rcustomProp.test( name );
  14069. // Make sure that we're working with the right name. We don't
  14070. // want to modify the value if it is a CSS custom property
  14071. // since they are user-defined.
  14072. if ( !isCustomProp ) {
  14073. name = finalPropName( origName );
  14074. }
  14075. // Try prefixed name followed by the unprefixed name
  14076. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14077. // If a hook was provided get the computed value from there
  14078. if ( hooks && "get" in hooks ) {
  14079. val = hooks.get( elem, true, extra );
  14080. }
  14081. // Otherwise, if a way to get the computed value exists, use that
  14082. if ( val === undefined ) {
  14083. val = curCSS( elem, name, styles );
  14084. }
  14085. // Convert "normal" to computed value
  14086. if ( val === "normal" && name in cssNormalTransform ) {
  14087. val = cssNormalTransform[ name ];
  14088. }
  14089. // Make numeric if forced or a qualifier was provided and val looks numeric
  14090. if ( extra === "" || extra ) {
  14091. num = parseFloat( val );
  14092. return extra === true || isFinite( num ) ? num || 0 : val;
  14093. }
  14094. return val;
  14095. }
  14096. } );
  14097. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  14098. jQuery.cssHooks[ dimension ] = {
  14099. get: function( elem, computed, extra ) {
  14100. if ( computed ) {
  14101. // Certain elements can have dimension info if we invisibly show them
  14102. // but it must have a current display style that would benefit
  14103. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  14104. // Support: Safari 8+
  14105. // Table columns in Safari have non-zero offsetWidth & zero
  14106. // getBoundingClientRect().width unless display is changed.
  14107. // Support: IE <=11 only
  14108. // Running getBoundingClientRect on a disconnected node
  14109. // in IE throws an error.
  14110. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  14111. swap( elem, cssShow, function() {
  14112. return getWidthOrHeight( elem, dimension, extra );
  14113. } ) :
  14114. getWidthOrHeight( elem, dimension, extra );
  14115. }
  14116. },
  14117. set: function( elem, value, extra ) {
  14118. var matches,
  14119. styles = getStyles( elem ),
  14120. // Only read styles.position if the test has a chance to fail
  14121. // to avoid forcing a reflow.
  14122. scrollboxSizeBuggy = !support.scrollboxSize() &&
  14123. styles.position === "absolute",
  14124. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  14125. boxSizingNeeded = scrollboxSizeBuggy || extra,
  14126. isBorderBox = boxSizingNeeded &&
  14127. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14128. subtract = extra ?
  14129. boxModelAdjustment(
  14130. elem,
  14131. dimension,
  14132. extra,
  14133. isBorderBox,
  14134. styles
  14135. ) :
  14136. 0;
  14137. // Account for unreliable border-box dimensions by comparing offset* to computed and
  14138. // faking a content-box to get border and padding (gh-3699)
  14139. if ( isBorderBox && scrollboxSizeBuggy ) {
  14140. subtract -= Math.ceil(
  14141. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14142. parseFloat( styles[ dimension ] ) -
  14143. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  14144. 0.5
  14145. );
  14146. }
  14147. // Convert to pixels if value adjustment is needed
  14148. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  14149. ( matches[ 3 ] || "px" ) !== "px" ) {
  14150. elem.style[ dimension ] = value;
  14151. value = jQuery.css( elem, dimension );
  14152. }
  14153. return setPositiveNumber( elem, value, subtract );
  14154. }
  14155. };
  14156. } );
  14157. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  14158. function( elem, computed ) {
  14159. if ( computed ) {
  14160. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  14161. elem.getBoundingClientRect().left -
  14162. swap( elem, { marginLeft: 0 }, function() {
  14163. return elem.getBoundingClientRect().left;
  14164. } )
  14165. ) + "px";
  14166. }
  14167. }
  14168. );
  14169. // These hooks are used by animate to expand properties
  14170. jQuery.each( {
  14171. margin: "",
  14172. padding: "",
  14173. border: "Width"
  14174. }, function( prefix, suffix ) {
  14175. jQuery.cssHooks[ prefix + suffix ] = {
  14176. expand: function( value ) {
  14177. var i = 0,
  14178. expanded = {},
  14179. // Assumes a single number if not a string
  14180. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  14181. for ( ; i < 4; i++ ) {
  14182. expanded[ prefix + cssExpand[ i ] + suffix ] =
  14183. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  14184. }
  14185. return expanded;
  14186. }
  14187. };
  14188. if ( prefix !== "margin" ) {
  14189. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  14190. }
  14191. } );
  14192. jQuery.fn.extend( {
  14193. css: function( name, value ) {
  14194. return access( this, function( elem, name, value ) {
  14195. var styles, len,
  14196. map = {},
  14197. i = 0;
  14198. if ( Array.isArray( name ) ) {
  14199. styles = getStyles( elem );
  14200. len = name.length;
  14201. for ( ; i < len; i++ ) {
  14202. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  14203. }
  14204. return map;
  14205. }
  14206. return value !== undefined ?
  14207. jQuery.style( elem, name, value ) :
  14208. jQuery.css( elem, name );
  14209. }, name, value, arguments.length > 1 );
  14210. }
  14211. } );
  14212. function Tween( elem, options, prop, end, easing ) {
  14213. return new Tween.prototype.init( elem, options, prop, end, easing );
  14214. }
  14215. jQuery.Tween = Tween;
  14216. Tween.prototype = {
  14217. constructor: Tween,
  14218. init: function( elem, options, prop, end, easing, unit ) {
  14219. this.elem = elem;
  14220. this.prop = prop;
  14221. this.easing = easing || jQuery.easing._default;
  14222. this.options = options;
  14223. this.start = this.now = this.cur();
  14224. this.end = end;
  14225. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  14226. },
  14227. cur: function() {
  14228. var hooks = Tween.propHooks[ this.prop ];
  14229. return hooks && hooks.get ?
  14230. hooks.get( this ) :
  14231. Tween.propHooks._default.get( this );
  14232. },
  14233. run: function( percent ) {
  14234. var eased,
  14235. hooks = Tween.propHooks[ this.prop ];
  14236. if ( this.options.duration ) {
  14237. this.pos = eased = jQuery.easing[ this.easing ](
  14238. percent, this.options.duration * percent, 0, 1, this.options.duration
  14239. );
  14240. } else {
  14241. this.pos = eased = percent;
  14242. }
  14243. this.now = ( this.end - this.start ) * eased + this.start;
  14244. if ( this.options.step ) {
  14245. this.options.step.call( this.elem, this.now, this );
  14246. }
  14247. if ( hooks && hooks.set ) {
  14248. hooks.set( this );
  14249. } else {
  14250. Tween.propHooks._default.set( this );
  14251. }
  14252. return this;
  14253. }
  14254. };
  14255. Tween.prototype.init.prototype = Tween.prototype;
  14256. Tween.propHooks = {
  14257. _default: {
  14258. get: function( tween ) {
  14259. var result;
  14260. // Use a property on the element directly when it is not a DOM element,
  14261. // or when there is no matching style property that exists.
  14262. if ( tween.elem.nodeType !== 1 ||
  14263. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  14264. return tween.elem[ tween.prop ];
  14265. }
  14266. // Passing an empty string as a 3rd parameter to .css will automatically
  14267. // attempt a parseFloat and fallback to a string if the parse fails.
  14268. // Simple values such as "10px" are parsed to Float;
  14269. // complex values such as "rotate(1rad)" are returned as-is.
  14270. result = jQuery.css( tween.elem, tween.prop, "" );
  14271. // Empty strings, null, undefined and "auto" are converted to 0.
  14272. return !result || result === "auto" ? 0 : result;
  14273. },
  14274. set: function( tween ) {
  14275. // Use step hook for back compat.
  14276. // Use cssHook if its there.
  14277. // Use .style if available and use plain properties where available.
  14278. if ( jQuery.fx.step[ tween.prop ] ) {
  14279. jQuery.fx.step[ tween.prop ]( tween );
  14280. } else if ( tween.elem.nodeType === 1 && (
  14281. jQuery.cssHooks[ tween.prop ] ||
  14282. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  14283. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  14284. } else {
  14285. tween.elem[ tween.prop ] = tween.now;
  14286. }
  14287. }
  14288. }
  14289. };
  14290. // Support: IE <=9 only
  14291. // Panic based approach to setting things on disconnected nodes
  14292. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  14293. set: function( tween ) {
  14294. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  14295. tween.elem[ tween.prop ] = tween.now;
  14296. }
  14297. }
  14298. };
  14299. jQuery.easing = {
  14300. linear: function( p ) {
  14301. return p;
  14302. },
  14303. swing: function( p ) {
  14304. return 0.5 - Math.cos( p * Math.PI ) / 2;
  14305. },
  14306. _default: "swing"
  14307. };
  14308. jQuery.fx = Tween.prototype.init;
  14309. // Back compat <1.8 extension point
  14310. jQuery.fx.step = {};
  14311. var
  14312. fxNow, inProgress,
  14313. rfxtypes = /^(?:toggle|show|hide)$/,
  14314. rrun = /queueHooks$/;
  14315. function schedule() {
  14316. if ( inProgress ) {
  14317. if ( document.hidden === false && window.requestAnimationFrame ) {
  14318. window.requestAnimationFrame( schedule );
  14319. } else {
  14320. window.setTimeout( schedule, jQuery.fx.interval );
  14321. }
  14322. jQuery.fx.tick();
  14323. }
  14324. }
  14325. // Animations created synchronously will run synchronously
  14326. function createFxNow() {
  14327. window.setTimeout( function() {
  14328. fxNow = undefined;
  14329. } );
  14330. return ( fxNow = Date.now() );
  14331. }
  14332. // Generate parameters to create a standard animation
  14333. function genFx( type, includeWidth ) {
  14334. var which,
  14335. i = 0,
  14336. attrs = { height: type };
  14337. // If we include width, step value is 1 to do all cssExpand values,
  14338. // otherwise step value is 2 to skip over Left and Right
  14339. includeWidth = includeWidth ? 1 : 0;
  14340. for ( ; i < 4; i += 2 - includeWidth ) {
  14341. which = cssExpand[ i ];
  14342. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  14343. }
  14344. if ( includeWidth ) {
  14345. attrs.opacity = attrs.width = type;
  14346. }
  14347. return attrs;
  14348. }
  14349. function createTween( value, prop, animation ) {
  14350. var tween,
  14351. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  14352. index = 0,
  14353. length = collection.length;
  14354. for ( ; index < length; index++ ) {
  14355. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  14356. // We're done with this property
  14357. return tween;
  14358. }
  14359. }
  14360. }
  14361. function defaultPrefilter( elem, props, opts ) {
  14362. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  14363. isBox = "width" in props || "height" in props,
  14364. anim = this,
  14365. orig = {},
  14366. style = elem.style,
  14367. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  14368. dataShow = dataPriv.get( elem, "fxshow" );
  14369. // Queue-skipping animations hijack the fx hooks
  14370. if ( !opts.queue ) {
  14371. hooks = jQuery._queueHooks( elem, "fx" );
  14372. if ( hooks.unqueued == null ) {
  14373. hooks.unqueued = 0;
  14374. oldfire = hooks.empty.fire;
  14375. hooks.empty.fire = function() {
  14376. if ( !hooks.unqueued ) {
  14377. oldfire();
  14378. }
  14379. };
  14380. }
  14381. hooks.unqueued++;
  14382. anim.always( function() {
  14383. // Ensure the complete handler is called before this completes
  14384. anim.always( function() {
  14385. hooks.unqueued--;
  14386. if ( !jQuery.queue( elem, "fx" ).length ) {
  14387. hooks.empty.fire();
  14388. }
  14389. } );
  14390. } );
  14391. }
  14392. // Detect show/hide animations
  14393. for ( prop in props ) {
  14394. value = props[ prop ];
  14395. if ( rfxtypes.test( value ) ) {
  14396. delete props[ prop ];
  14397. toggle = toggle || value === "toggle";
  14398. if ( value === ( hidden ? "hide" : "show" ) ) {
  14399. // Pretend to be hidden if this is a "show" and
  14400. // there is still data from a stopped show/hide
  14401. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  14402. hidden = true;
  14403. // Ignore all other no-op show/hide data
  14404. } else {
  14405. continue;
  14406. }
  14407. }
  14408. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  14409. }
  14410. }
  14411. // Bail out if this is a no-op like .hide().hide()
  14412. propTween = !jQuery.isEmptyObject( props );
  14413. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  14414. return;
  14415. }
  14416. // Restrict "overflow" and "display" styles during box animations
  14417. if ( isBox && elem.nodeType === 1 ) {
  14418. // Support: IE <=9 - 11, Edge 12 - 15
  14419. // Record all 3 overflow attributes because IE does not infer the shorthand
  14420. // from identically-valued overflowX and overflowY and Edge just mirrors
  14421. // the overflowX value there.
  14422. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  14423. // Identify a display type, preferring old show/hide data over the CSS cascade
  14424. restoreDisplay = dataShow && dataShow.display;
  14425. if ( restoreDisplay == null ) {
  14426. restoreDisplay = dataPriv.get( elem, "display" );
  14427. }
  14428. display = jQuery.css( elem, "display" );
  14429. if ( display === "none" ) {
  14430. if ( restoreDisplay ) {
  14431. display = restoreDisplay;
  14432. } else {
  14433. // Get nonempty value(s) by temporarily forcing visibility
  14434. showHide( [ elem ], true );
  14435. restoreDisplay = elem.style.display || restoreDisplay;
  14436. display = jQuery.css( elem, "display" );
  14437. showHide( [ elem ] );
  14438. }
  14439. }
  14440. // Animate inline elements as inline-block
  14441. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  14442. if ( jQuery.css( elem, "float" ) === "none" ) {
  14443. // Restore the original display value at the end of pure show/hide animations
  14444. if ( !propTween ) {
  14445. anim.done( function() {
  14446. style.display = restoreDisplay;
  14447. } );
  14448. if ( restoreDisplay == null ) {
  14449. display = style.display;
  14450. restoreDisplay = display === "none" ? "" : display;
  14451. }
  14452. }
  14453. style.display = "inline-block";
  14454. }
  14455. }
  14456. }
  14457. if ( opts.overflow ) {
  14458. style.overflow = "hidden";
  14459. anim.always( function() {
  14460. style.overflow = opts.overflow[ 0 ];
  14461. style.overflowX = opts.overflow[ 1 ];
  14462. style.overflowY = opts.overflow[ 2 ];
  14463. } );
  14464. }
  14465. // Implement show/hide animations
  14466. propTween = false;
  14467. for ( prop in orig ) {
  14468. // General show/hide setup for this element animation
  14469. if ( !propTween ) {
  14470. if ( dataShow ) {
  14471. if ( "hidden" in dataShow ) {
  14472. hidden = dataShow.hidden;
  14473. }
  14474. } else {
  14475. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  14476. }
  14477. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  14478. if ( toggle ) {
  14479. dataShow.hidden = !hidden;
  14480. }
  14481. // Show elements before animating them
  14482. if ( hidden ) {
  14483. showHide( [ elem ], true );
  14484. }
  14485. /* eslint-disable no-loop-func */
  14486. anim.done( function() {
  14487. /* eslint-enable no-loop-func */
  14488. // The final step of a "hide" animation is actually hiding the element
  14489. if ( !hidden ) {
  14490. showHide( [ elem ] );
  14491. }
  14492. dataPriv.remove( elem, "fxshow" );
  14493. for ( prop in orig ) {
  14494. jQuery.style( elem, prop, orig[ prop ] );
  14495. }
  14496. } );
  14497. }
  14498. // Per-property setup
  14499. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  14500. if ( !( prop in dataShow ) ) {
  14501. dataShow[ prop ] = propTween.start;
  14502. if ( hidden ) {
  14503. propTween.end = propTween.start;
  14504. propTween.start = 0;
  14505. }
  14506. }
  14507. }
  14508. }
  14509. function propFilter( props, specialEasing ) {
  14510. var index, name, easing, value, hooks;
  14511. // camelCase, specialEasing and expand cssHook pass
  14512. for ( index in props ) {
  14513. name = camelCase( index );
  14514. easing = specialEasing[ name ];
  14515. value = props[ index ];
  14516. if ( Array.isArray( value ) ) {
  14517. easing = value[ 1 ];
  14518. value = props[ index ] = value[ 0 ];
  14519. }
  14520. if ( index !== name ) {
  14521. props[ name ] = value;
  14522. delete props[ index ];
  14523. }
  14524. hooks = jQuery.cssHooks[ name ];
  14525. if ( hooks && "expand" in hooks ) {
  14526. value = hooks.expand( value );
  14527. delete props[ name ];
  14528. // Not quite $.extend, this won't overwrite existing keys.
  14529. // Reusing 'index' because we have the correct "name"
  14530. for ( index in value ) {
  14531. if ( !( index in props ) ) {
  14532. props[ index ] = value[ index ];
  14533. specialEasing[ index ] = easing;
  14534. }
  14535. }
  14536. } else {
  14537. specialEasing[ name ] = easing;
  14538. }
  14539. }
  14540. }
  14541. function Animation( elem, properties, options ) {
  14542. var result,
  14543. stopped,
  14544. index = 0,
  14545. length = Animation.prefilters.length,
  14546. deferred = jQuery.Deferred().always( function() {
  14547. // Don't match elem in the :animated selector
  14548. delete tick.elem;
  14549. } ),
  14550. tick = function() {
  14551. if ( stopped ) {
  14552. return false;
  14553. }
  14554. var currentTime = fxNow || createFxNow(),
  14555. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  14556. // Support: Android 2.3 only
  14557. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  14558. temp = remaining / animation.duration || 0,
  14559. percent = 1 - temp,
  14560. index = 0,
  14561. length = animation.tweens.length;
  14562. for ( ; index < length; index++ ) {
  14563. animation.tweens[ index ].run( percent );
  14564. }
  14565. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  14566. // If there's more to do, yield
  14567. if ( percent < 1 && length ) {
  14568. return remaining;
  14569. }
  14570. // If this was an empty animation, synthesize a final progress notification
  14571. if ( !length ) {
  14572. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14573. }
  14574. // Resolve the animation and report its conclusion
  14575. deferred.resolveWith( elem, [ animation ] );
  14576. return false;
  14577. },
  14578. animation = deferred.promise( {
  14579. elem: elem,
  14580. props: jQuery.extend( {}, properties ),
  14581. opts: jQuery.extend( true, {
  14582. specialEasing: {},
  14583. easing: jQuery.easing._default
  14584. }, options ),
  14585. originalProperties: properties,
  14586. originalOptions: options,
  14587. startTime: fxNow || createFxNow(),
  14588. duration: options.duration,
  14589. tweens: [],
  14590. createTween: function( prop, end ) {
  14591. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  14592. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  14593. animation.tweens.push( tween );
  14594. return tween;
  14595. },
  14596. stop: function( gotoEnd ) {
  14597. var index = 0,
  14598. // If we are going to the end, we want to run all the tweens
  14599. // otherwise we skip this part
  14600. length = gotoEnd ? animation.tweens.length : 0;
  14601. if ( stopped ) {
  14602. return this;
  14603. }
  14604. stopped = true;
  14605. for ( ; index < length; index++ ) {
  14606. animation.tweens[ index ].run( 1 );
  14607. }
  14608. // Resolve when we played the last frame; otherwise, reject
  14609. if ( gotoEnd ) {
  14610. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14611. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  14612. } else {
  14613. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  14614. }
  14615. return this;
  14616. }
  14617. } ),
  14618. props = animation.props;
  14619. propFilter( props, animation.opts.specialEasing );
  14620. for ( ; index < length; index++ ) {
  14621. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  14622. if ( result ) {
  14623. if ( isFunction( result.stop ) ) {
  14624. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  14625. result.stop.bind( result );
  14626. }
  14627. return result;
  14628. }
  14629. }
  14630. jQuery.map( props, createTween, animation );
  14631. if ( isFunction( animation.opts.start ) ) {
  14632. animation.opts.start.call( elem, animation );
  14633. }
  14634. // Attach callbacks from options
  14635. animation
  14636. .progress( animation.opts.progress )
  14637. .done( animation.opts.done, animation.opts.complete )
  14638. .fail( animation.opts.fail )
  14639. .always( animation.opts.always );
  14640. jQuery.fx.timer(
  14641. jQuery.extend( tick, {
  14642. elem: elem,
  14643. anim: animation,
  14644. queue: animation.opts.queue
  14645. } )
  14646. );
  14647. return animation;
  14648. }
  14649. jQuery.Animation = jQuery.extend( Animation, {
  14650. tweeners: {
  14651. "*": [ function( prop, value ) {
  14652. var tween = this.createTween( prop, value );
  14653. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  14654. return tween;
  14655. } ]
  14656. },
  14657. tweener: function( props, callback ) {
  14658. if ( isFunction( props ) ) {
  14659. callback = props;
  14660. props = [ "*" ];
  14661. } else {
  14662. props = props.match( rnothtmlwhite );
  14663. }
  14664. var prop,
  14665. index = 0,
  14666. length = props.length;
  14667. for ( ; index < length; index++ ) {
  14668. prop = props[ index ];
  14669. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  14670. Animation.tweeners[ prop ].unshift( callback );
  14671. }
  14672. },
  14673. prefilters: [ defaultPrefilter ],
  14674. prefilter: function( callback, prepend ) {
  14675. if ( prepend ) {
  14676. Animation.prefilters.unshift( callback );
  14677. } else {
  14678. Animation.prefilters.push( callback );
  14679. }
  14680. }
  14681. } );
  14682. jQuery.speed = function( speed, easing, fn ) {
  14683. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  14684. complete: fn || !fn && easing ||
  14685. isFunction( speed ) && speed,
  14686. duration: speed,
  14687. easing: fn && easing || easing && !isFunction( easing ) && easing
  14688. };
  14689. // Go to the end state if fx are off
  14690. if ( jQuery.fx.off ) {
  14691. opt.duration = 0;
  14692. } else {
  14693. if ( typeof opt.duration !== "number" ) {
  14694. if ( opt.duration in jQuery.fx.speeds ) {
  14695. opt.duration = jQuery.fx.speeds[ opt.duration ];
  14696. } else {
  14697. opt.duration = jQuery.fx.speeds._default;
  14698. }
  14699. }
  14700. }
  14701. // Normalize opt.queue - true/undefined/null -> "fx"
  14702. if ( opt.queue == null || opt.queue === true ) {
  14703. opt.queue = "fx";
  14704. }
  14705. // Queueing
  14706. opt.old = opt.complete;
  14707. opt.complete = function() {
  14708. if ( isFunction( opt.old ) ) {
  14709. opt.old.call( this );
  14710. }
  14711. if ( opt.queue ) {
  14712. jQuery.dequeue( this, opt.queue );
  14713. }
  14714. };
  14715. return opt;
  14716. };
  14717. jQuery.fn.extend( {
  14718. fadeTo: function( speed, to, easing, callback ) {
  14719. // Show any hidden elements after setting opacity to 0
  14720. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  14721. // Animate to the value specified
  14722. .end().animate( { opacity: to }, speed, easing, callback );
  14723. },
  14724. animate: function( prop, speed, easing, callback ) {
  14725. var empty = jQuery.isEmptyObject( prop ),
  14726. optall = jQuery.speed( speed, easing, callback ),
  14727. doAnimation = function() {
  14728. // Operate on a copy of prop so per-property easing won't be lost
  14729. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  14730. // Empty animations, or finishing resolves immediately
  14731. if ( empty || dataPriv.get( this, "finish" ) ) {
  14732. anim.stop( true );
  14733. }
  14734. };
  14735. doAnimation.finish = doAnimation;
  14736. return empty || optall.queue === false ?
  14737. this.each( doAnimation ) :
  14738. this.queue( optall.queue, doAnimation );
  14739. },
  14740. stop: function( type, clearQueue, gotoEnd ) {
  14741. var stopQueue = function( hooks ) {
  14742. var stop = hooks.stop;
  14743. delete hooks.stop;
  14744. stop( gotoEnd );
  14745. };
  14746. if ( typeof type !== "string" ) {
  14747. gotoEnd = clearQueue;
  14748. clearQueue = type;
  14749. type = undefined;
  14750. }
  14751. if ( clearQueue && type !== false ) {
  14752. this.queue( type || "fx", [] );
  14753. }
  14754. return this.each( function() {
  14755. var dequeue = true,
  14756. index = type != null && type + "queueHooks",
  14757. timers = jQuery.timers,
  14758. data = dataPriv.get( this );
  14759. if ( index ) {
  14760. if ( data[ index ] && data[ index ].stop ) {
  14761. stopQueue( data[ index ] );
  14762. }
  14763. } else {
  14764. for ( index in data ) {
  14765. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  14766. stopQueue( data[ index ] );
  14767. }
  14768. }
  14769. }
  14770. for ( index = timers.length; index--; ) {
  14771. if ( timers[ index ].elem === this &&
  14772. ( type == null || timers[ index ].queue === type ) ) {
  14773. timers[ index ].anim.stop( gotoEnd );
  14774. dequeue = false;
  14775. timers.splice( index, 1 );
  14776. }
  14777. }
  14778. // Start the next in the queue if the last step wasn't forced.
  14779. // Timers currently will call their complete callbacks, which
  14780. // will dequeue but only if they were gotoEnd.
  14781. if ( dequeue || !gotoEnd ) {
  14782. jQuery.dequeue( this, type );
  14783. }
  14784. } );
  14785. },
  14786. finish: function( type ) {
  14787. if ( type !== false ) {
  14788. type = type || "fx";
  14789. }
  14790. return this.each( function() {
  14791. var index,
  14792. data = dataPriv.get( this ),
  14793. queue = data[ type + "queue" ],
  14794. hooks = data[ type + "queueHooks" ],
  14795. timers = jQuery.timers,
  14796. length = queue ? queue.length : 0;
  14797. // Enable finishing flag on private data
  14798. data.finish = true;
  14799. // Empty the queue first
  14800. jQuery.queue( this, type, [] );
  14801. if ( hooks && hooks.stop ) {
  14802. hooks.stop.call( this, true );
  14803. }
  14804. // Look for any active animations, and finish them
  14805. for ( index = timers.length; index--; ) {
  14806. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  14807. timers[ index ].anim.stop( true );
  14808. timers.splice( index, 1 );
  14809. }
  14810. }
  14811. // Look for any animations in the old queue and finish them
  14812. for ( index = 0; index < length; index++ ) {
  14813. if ( queue[ index ] && queue[ index ].finish ) {
  14814. queue[ index ].finish.call( this );
  14815. }
  14816. }
  14817. // Turn off finishing flag
  14818. delete data.finish;
  14819. } );
  14820. }
  14821. } );
  14822. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  14823. var cssFn = jQuery.fn[ name ];
  14824. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14825. return speed == null || typeof speed === "boolean" ?
  14826. cssFn.apply( this, arguments ) :
  14827. this.animate( genFx( name, true ), speed, easing, callback );
  14828. };
  14829. } );
  14830. // Generate shortcuts for custom animations
  14831. jQuery.each( {
  14832. slideDown: genFx( "show" ),
  14833. slideUp: genFx( "hide" ),
  14834. slideToggle: genFx( "toggle" ),
  14835. fadeIn: { opacity: "show" },
  14836. fadeOut: { opacity: "hide" },
  14837. fadeToggle: { opacity: "toggle" }
  14838. }, function( name, props ) {
  14839. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14840. return this.animate( props, speed, easing, callback );
  14841. };
  14842. } );
  14843. jQuery.timers = [];
  14844. jQuery.fx.tick = function() {
  14845. var timer,
  14846. i = 0,
  14847. timers = jQuery.timers;
  14848. fxNow = Date.now();
  14849. for ( ; i < timers.length; i++ ) {
  14850. timer = timers[ i ];
  14851. // Run the timer and safely remove it when done (allowing for external removal)
  14852. if ( !timer() && timers[ i ] === timer ) {
  14853. timers.splice( i--, 1 );
  14854. }
  14855. }
  14856. if ( !timers.length ) {
  14857. jQuery.fx.stop();
  14858. }
  14859. fxNow = undefined;
  14860. };
  14861. jQuery.fx.timer = function( timer ) {
  14862. jQuery.timers.push( timer );
  14863. jQuery.fx.start();
  14864. };
  14865. jQuery.fx.interval = 13;
  14866. jQuery.fx.start = function() {
  14867. if ( inProgress ) {
  14868. return;
  14869. }
  14870. inProgress = true;
  14871. schedule();
  14872. };
  14873. jQuery.fx.stop = function() {
  14874. inProgress = null;
  14875. };
  14876. jQuery.fx.speeds = {
  14877. slow: 600,
  14878. fast: 200,
  14879. // Default speed
  14880. _default: 400
  14881. };
  14882. // Based off of the plugin by Clint Helfers, with permission.
  14883. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  14884. jQuery.fn.delay = function( time, type ) {
  14885. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  14886. type = type || "fx";
  14887. return this.queue( type, function( next, hooks ) {
  14888. var timeout = window.setTimeout( next, time );
  14889. hooks.stop = function() {
  14890. window.clearTimeout( timeout );
  14891. };
  14892. } );
  14893. };
  14894. ( function() {
  14895. var input = document.createElement( "input" ),
  14896. select = document.createElement( "select" ),
  14897. opt = select.appendChild( document.createElement( "option" ) );
  14898. input.type = "checkbox";
  14899. // Support: Android <=4.3 only
  14900. // Default value for a checkbox should be "on"
  14901. support.checkOn = input.value !== "";
  14902. // Support: IE <=11 only
  14903. // Must access selectedIndex to make default options select
  14904. support.optSelected = opt.selected;
  14905. // Support: IE <=11 only
  14906. // An input loses its value after becoming a radio
  14907. input = document.createElement( "input" );
  14908. input.value = "t";
  14909. input.type = "radio";
  14910. support.radioValue = input.value === "t";
  14911. } )();
  14912. var boolHook,
  14913. attrHandle = jQuery.expr.attrHandle;
  14914. jQuery.fn.extend( {
  14915. attr: function( name, value ) {
  14916. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  14917. },
  14918. removeAttr: function( name ) {
  14919. return this.each( function() {
  14920. jQuery.removeAttr( this, name );
  14921. } );
  14922. }
  14923. } );
  14924. jQuery.extend( {
  14925. attr: function( elem, name, value ) {
  14926. var ret, hooks,
  14927. nType = elem.nodeType;
  14928. // Don't get/set attributes on text, comment and attribute nodes
  14929. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14930. return;
  14931. }
  14932. // Fallback to prop when attributes are not supported
  14933. if ( typeof elem.getAttribute === "undefined" ) {
  14934. return jQuery.prop( elem, name, value );
  14935. }
  14936. // Attribute hooks are determined by the lowercase version
  14937. // Grab necessary hook if one is defined
  14938. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14939. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  14940. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  14941. }
  14942. if ( value !== undefined ) {
  14943. if ( value === null ) {
  14944. jQuery.removeAttr( elem, name );
  14945. return;
  14946. }
  14947. if ( hooks && "set" in hooks &&
  14948. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14949. return ret;
  14950. }
  14951. elem.setAttribute( name, value + "" );
  14952. return value;
  14953. }
  14954. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  14955. return ret;
  14956. }
  14957. ret = jQuery.find.attr( elem, name );
  14958. // Non-existent attributes return null, we normalize to undefined
  14959. return ret == null ? undefined : ret;
  14960. },
  14961. attrHooks: {
  14962. type: {
  14963. set: function( elem, value ) {
  14964. if ( !support.radioValue && value === "radio" &&
  14965. nodeName( elem, "input" ) ) {
  14966. var val = elem.value;
  14967. elem.setAttribute( "type", value );
  14968. if ( val ) {
  14969. elem.value = val;
  14970. }
  14971. return value;
  14972. }
  14973. }
  14974. }
  14975. },
  14976. removeAttr: function( elem, value ) {
  14977. var name,
  14978. i = 0,
  14979. // Attribute names can contain non-HTML whitespace characters
  14980. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  14981. attrNames = value && value.match( rnothtmlwhite );
  14982. if ( attrNames && elem.nodeType === 1 ) {
  14983. while ( ( name = attrNames[ i++ ] ) ) {
  14984. elem.removeAttribute( name );
  14985. }
  14986. }
  14987. }
  14988. } );
  14989. // Hooks for boolean attributes
  14990. boolHook = {
  14991. set: function( elem, value, name ) {
  14992. if ( value === false ) {
  14993. // Remove boolean attributes when set to false
  14994. jQuery.removeAttr( elem, name );
  14995. } else {
  14996. elem.setAttribute( name, name );
  14997. }
  14998. return name;
  14999. }
  15000. };
  15001. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  15002. var getter = attrHandle[ name ] || jQuery.find.attr;
  15003. attrHandle[ name ] = function( elem, name, isXML ) {
  15004. var ret, handle,
  15005. lowercaseName = name.toLowerCase();
  15006. if ( !isXML ) {
  15007. // Avoid an infinite loop by temporarily removing this function from the getter
  15008. handle = attrHandle[ lowercaseName ];
  15009. attrHandle[ lowercaseName ] = ret;
  15010. ret = getter( elem, name, isXML ) != null ?
  15011. lowercaseName :
  15012. null;
  15013. attrHandle[ lowercaseName ] = handle;
  15014. }
  15015. return ret;
  15016. };
  15017. } );
  15018. var rfocusable = /^(?:input|select|textarea|button)$/i,
  15019. rclickable = /^(?:a|area)$/i;
  15020. jQuery.fn.extend( {
  15021. prop: function( name, value ) {
  15022. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  15023. },
  15024. removeProp: function( name ) {
  15025. return this.each( function() {
  15026. delete this[ jQuery.propFix[ name ] || name ];
  15027. } );
  15028. }
  15029. } );
  15030. jQuery.extend( {
  15031. prop: function( elem, name, value ) {
  15032. var ret, hooks,
  15033. nType = elem.nodeType;
  15034. // Don't get/set properties on text, comment and attribute nodes
  15035. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15036. return;
  15037. }
  15038. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15039. // Fix name and attach hooks
  15040. name = jQuery.propFix[ name ] || name;
  15041. hooks = jQuery.propHooks[ name ];
  15042. }
  15043. if ( value !== undefined ) {
  15044. if ( hooks && "set" in hooks &&
  15045. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15046. return ret;
  15047. }
  15048. return ( elem[ name ] = value );
  15049. }
  15050. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15051. return ret;
  15052. }
  15053. return elem[ name ];
  15054. },
  15055. propHooks: {
  15056. tabIndex: {
  15057. get: function( elem ) {
  15058. // Support: IE <=9 - 11 only
  15059. // elem.tabIndex doesn't always return the
  15060. // correct value when it hasn't been explicitly set
  15061. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  15062. // Use proper attribute retrieval(#12072)
  15063. var tabindex = jQuery.find.attr( elem, "tabindex" );
  15064. if ( tabindex ) {
  15065. return parseInt( tabindex, 10 );
  15066. }
  15067. if (
  15068. rfocusable.test( elem.nodeName ) ||
  15069. rclickable.test( elem.nodeName ) &&
  15070. elem.href
  15071. ) {
  15072. return 0;
  15073. }
  15074. return -1;
  15075. }
  15076. }
  15077. },
  15078. propFix: {
  15079. "for": "htmlFor",
  15080. "class": "className"
  15081. }
  15082. } );
  15083. // Support: IE <=11 only
  15084. // Accessing the selectedIndex property
  15085. // forces the browser to respect setting selected
  15086. // on the option
  15087. // The getter ensures a default option is selected
  15088. // when in an optgroup
  15089. // eslint rule "no-unused-expressions" is disabled for this code
  15090. // since it considers such accessions noop
  15091. if ( !support.optSelected ) {
  15092. jQuery.propHooks.selected = {
  15093. get: function( elem ) {
  15094. /* eslint no-unused-expressions: "off" */
  15095. var parent = elem.parentNode;
  15096. if ( parent && parent.parentNode ) {
  15097. parent.parentNode.selectedIndex;
  15098. }
  15099. return null;
  15100. },
  15101. set: function( elem ) {
  15102. /* eslint no-unused-expressions: "off" */
  15103. var parent = elem.parentNode;
  15104. if ( parent ) {
  15105. parent.selectedIndex;
  15106. if ( parent.parentNode ) {
  15107. parent.parentNode.selectedIndex;
  15108. }
  15109. }
  15110. }
  15111. };
  15112. }
  15113. jQuery.each( [
  15114. "tabIndex",
  15115. "readOnly",
  15116. "maxLength",
  15117. "cellSpacing",
  15118. "cellPadding",
  15119. "rowSpan",
  15120. "colSpan",
  15121. "useMap",
  15122. "frameBorder",
  15123. "contentEditable"
  15124. ], function() {
  15125. jQuery.propFix[ this.toLowerCase() ] = this;
  15126. } );
  15127. // Strip and collapse whitespace according to HTML spec
  15128. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  15129. function stripAndCollapse( value ) {
  15130. var tokens = value.match( rnothtmlwhite ) || [];
  15131. return tokens.join( " " );
  15132. }
  15133. function getClass( elem ) {
  15134. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  15135. }
  15136. function classesToArray( value ) {
  15137. if ( Array.isArray( value ) ) {
  15138. return value;
  15139. }
  15140. if ( typeof value === "string" ) {
  15141. return value.match( rnothtmlwhite ) || [];
  15142. }
  15143. return [];
  15144. }
  15145. jQuery.fn.extend( {
  15146. addClass: function( value ) {
  15147. var classes, elem, cur, curValue, clazz, j, finalValue,
  15148. i = 0;
  15149. if ( isFunction( value ) ) {
  15150. return this.each( function( j ) {
  15151. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  15152. } );
  15153. }
  15154. classes = classesToArray( value );
  15155. if ( classes.length ) {
  15156. while ( ( elem = this[ i++ ] ) ) {
  15157. curValue = getClass( elem );
  15158. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15159. if ( cur ) {
  15160. j = 0;
  15161. while ( ( clazz = classes[ j++ ] ) ) {
  15162. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  15163. cur += clazz + " ";
  15164. }
  15165. }
  15166. // Only assign if different to avoid unneeded rendering.
  15167. finalValue = stripAndCollapse( cur );
  15168. if ( curValue !== finalValue ) {
  15169. elem.setAttribute( "class", finalValue );
  15170. }
  15171. }
  15172. }
  15173. }
  15174. return this;
  15175. },
  15176. removeClass: function( value ) {
  15177. var classes, elem, cur, curValue, clazz, j, finalValue,
  15178. i = 0;
  15179. if ( isFunction( value ) ) {
  15180. return this.each( function( j ) {
  15181. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  15182. } );
  15183. }
  15184. if ( !arguments.length ) {
  15185. return this.attr( "class", "" );
  15186. }
  15187. classes = classesToArray( value );
  15188. if ( classes.length ) {
  15189. while ( ( elem = this[ i++ ] ) ) {
  15190. curValue = getClass( elem );
  15191. // This expression is here for better compressibility (see addClass)
  15192. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15193. if ( cur ) {
  15194. j = 0;
  15195. while ( ( clazz = classes[ j++ ] ) ) {
  15196. // Remove *all* instances
  15197. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  15198. cur = cur.replace( " " + clazz + " ", " " );
  15199. }
  15200. }
  15201. // Only assign if different to avoid unneeded rendering.
  15202. finalValue = stripAndCollapse( cur );
  15203. if ( curValue !== finalValue ) {
  15204. elem.setAttribute( "class", finalValue );
  15205. }
  15206. }
  15207. }
  15208. }
  15209. return this;
  15210. },
  15211. toggleClass: function( value, stateVal ) {
  15212. var type = typeof value,
  15213. isValidValue = type === "string" || Array.isArray( value );
  15214. if ( typeof stateVal === "boolean" && isValidValue ) {
  15215. return stateVal ? this.addClass( value ) : this.removeClass( value );
  15216. }
  15217. if ( isFunction( value ) ) {
  15218. return this.each( function( i ) {
  15219. jQuery( this ).toggleClass(
  15220. value.call( this, i, getClass( this ), stateVal ),
  15221. stateVal
  15222. );
  15223. } );
  15224. }
  15225. return this.each( function() {
  15226. var className, i, self, classNames;
  15227. if ( isValidValue ) {
  15228. // Toggle individual class names
  15229. i = 0;
  15230. self = jQuery( this );
  15231. classNames = classesToArray( value );
  15232. while ( ( className = classNames[ i++ ] ) ) {
  15233. // Check each className given, space separated list
  15234. if ( self.hasClass( className ) ) {
  15235. self.removeClass( className );
  15236. } else {
  15237. self.addClass( className );
  15238. }
  15239. }
  15240. // Toggle whole class name
  15241. } else if ( value === undefined || type === "boolean" ) {
  15242. className = getClass( this );
  15243. if ( className ) {
  15244. // Store className if set
  15245. dataPriv.set( this, "__className__", className );
  15246. }
  15247. // If the element has a class name or if we're passed `false`,
  15248. // then remove the whole classname (if there was one, the above saved it).
  15249. // Otherwise bring back whatever was previously saved (if anything),
  15250. // falling back to the empty string if nothing was stored.
  15251. if ( this.setAttribute ) {
  15252. this.setAttribute( "class",
  15253. className || value === false ?
  15254. "" :
  15255. dataPriv.get( this, "__className__" ) || ""
  15256. );
  15257. }
  15258. }
  15259. } );
  15260. },
  15261. hasClass: function( selector ) {
  15262. var className, elem,
  15263. i = 0;
  15264. className = " " + selector + " ";
  15265. while ( ( elem = this[ i++ ] ) ) {
  15266. if ( elem.nodeType === 1 &&
  15267. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  15268. return true;
  15269. }
  15270. }
  15271. return false;
  15272. }
  15273. } );
  15274. var rreturn = /\r/g;
  15275. jQuery.fn.extend( {
  15276. val: function( value ) {
  15277. var hooks, ret, valueIsFunction,
  15278. elem = this[ 0 ];
  15279. if ( !arguments.length ) {
  15280. if ( elem ) {
  15281. hooks = jQuery.valHooks[ elem.type ] ||
  15282. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  15283. if ( hooks &&
  15284. "get" in hooks &&
  15285. ( ret = hooks.get( elem, "value" ) ) !== undefined
  15286. ) {
  15287. return ret;
  15288. }
  15289. ret = elem.value;
  15290. // Handle most common string cases
  15291. if ( typeof ret === "string" ) {
  15292. return ret.replace( rreturn, "" );
  15293. }
  15294. // Handle cases where value is null/undef or number
  15295. return ret == null ? "" : ret;
  15296. }
  15297. return;
  15298. }
  15299. valueIsFunction = isFunction( value );
  15300. return this.each( function( i ) {
  15301. var val;
  15302. if ( this.nodeType !== 1 ) {
  15303. return;
  15304. }
  15305. if ( valueIsFunction ) {
  15306. val = value.call( this, i, jQuery( this ).val() );
  15307. } else {
  15308. val = value;
  15309. }
  15310. // Treat null/undefined as ""; convert numbers to string
  15311. if ( val == null ) {
  15312. val = "";
  15313. } else if ( typeof val === "number" ) {
  15314. val += "";
  15315. } else if ( Array.isArray( val ) ) {
  15316. val = jQuery.map( val, function( value ) {
  15317. return value == null ? "" : value + "";
  15318. } );
  15319. }
  15320. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  15321. // If set returns undefined, fall back to normal setting
  15322. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  15323. this.value = val;
  15324. }
  15325. } );
  15326. }
  15327. } );
  15328. jQuery.extend( {
  15329. valHooks: {
  15330. option: {
  15331. get: function( elem ) {
  15332. var val = jQuery.find.attr( elem, "value" );
  15333. return val != null ?
  15334. val :
  15335. // Support: IE <=10 - 11 only
  15336. // option.text throws exceptions (#14686, #14858)
  15337. // Strip and collapse whitespace
  15338. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  15339. stripAndCollapse( jQuery.text( elem ) );
  15340. }
  15341. },
  15342. select: {
  15343. get: function( elem ) {
  15344. var value, option, i,
  15345. options = elem.options,
  15346. index = elem.selectedIndex,
  15347. one = elem.type === "select-one",
  15348. values = one ? null : [],
  15349. max = one ? index + 1 : options.length;
  15350. if ( index < 0 ) {
  15351. i = max;
  15352. } else {
  15353. i = one ? index : 0;
  15354. }
  15355. // Loop through all the selected options
  15356. for ( ; i < max; i++ ) {
  15357. option = options[ i ];
  15358. // Support: IE <=9 only
  15359. // IE8-9 doesn't update selected after form reset (#2551)
  15360. if ( ( option.selected || i === index ) &&
  15361. // Don't return options that are disabled or in a disabled optgroup
  15362. !option.disabled &&
  15363. ( !option.parentNode.disabled ||
  15364. !nodeName( option.parentNode, "optgroup" ) ) ) {
  15365. // Get the specific value for the option
  15366. value = jQuery( option ).val();
  15367. // We don't need an array for one selects
  15368. if ( one ) {
  15369. return value;
  15370. }
  15371. // Multi-Selects return an array
  15372. values.push( value );
  15373. }
  15374. }
  15375. return values;
  15376. },
  15377. set: function( elem, value ) {
  15378. var optionSet, option,
  15379. options = elem.options,
  15380. values = jQuery.makeArray( value ),
  15381. i = options.length;
  15382. while ( i-- ) {
  15383. option = options[ i ];
  15384. /* eslint-disable no-cond-assign */
  15385. if ( option.selected =
  15386. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  15387. ) {
  15388. optionSet = true;
  15389. }
  15390. /* eslint-enable no-cond-assign */
  15391. }
  15392. // Force browsers to behave consistently when non-matching value is set
  15393. if ( !optionSet ) {
  15394. elem.selectedIndex = -1;
  15395. }
  15396. return values;
  15397. }
  15398. }
  15399. }
  15400. } );
  15401. // Radios and checkboxes getter/setter
  15402. jQuery.each( [ "radio", "checkbox" ], function() {
  15403. jQuery.valHooks[ this ] = {
  15404. set: function( elem, value ) {
  15405. if ( Array.isArray( value ) ) {
  15406. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  15407. }
  15408. }
  15409. };
  15410. if ( !support.checkOn ) {
  15411. jQuery.valHooks[ this ].get = function( elem ) {
  15412. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  15413. };
  15414. }
  15415. } );
  15416. // Return jQuery for attributes-only inclusion
  15417. support.focusin = "onfocusin" in window;
  15418. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  15419. stopPropagationCallback = function( e ) {
  15420. e.stopPropagation();
  15421. };
  15422. jQuery.extend( jQuery.event, {
  15423. trigger: function( event, data, elem, onlyHandlers ) {
  15424. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  15425. eventPath = [ elem || document ],
  15426. type = hasOwn.call( event, "type" ) ? event.type : event,
  15427. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  15428. cur = lastElement = tmp = elem = elem || document;
  15429. // Don't do events on text and comment nodes
  15430. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  15431. return;
  15432. }
  15433. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  15434. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  15435. return;
  15436. }
  15437. if ( type.indexOf( "." ) > -1 ) {
  15438. // Namespaced trigger; create a regexp to match event type in handle()
  15439. namespaces = type.split( "." );
  15440. type = namespaces.shift();
  15441. namespaces.sort();
  15442. }
  15443. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  15444. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  15445. event = event[ jQuery.expando ] ?
  15446. event :
  15447. new jQuery.Event( type, typeof event === "object" && event );
  15448. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  15449. event.isTrigger = onlyHandlers ? 2 : 3;
  15450. event.namespace = namespaces.join( "." );
  15451. event.rnamespace = event.namespace ?
  15452. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  15453. null;
  15454. // Clean up the event in case it is being reused
  15455. event.result = undefined;
  15456. if ( !event.target ) {
  15457. event.target = elem;
  15458. }
  15459. // Clone any incoming data and prepend the event, creating the handler arg list
  15460. data = data == null ?
  15461. [ event ] :
  15462. jQuery.makeArray( data, [ event ] );
  15463. // Allow special events to draw outside the lines
  15464. special = jQuery.event.special[ type ] || {};
  15465. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  15466. return;
  15467. }
  15468. // Determine event propagation path in advance, per W3C events spec (#9951)
  15469. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  15470. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  15471. bubbleType = special.delegateType || type;
  15472. if ( !rfocusMorph.test( bubbleType + type ) ) {
  15473. cur = cur.parentNode;
  15474. }
  15475. for ( ; cur; cur = cur.parentNode ) {
  15476. eventPath.push( cur );
  15477. tmp = cur;
  15478. }
  15479. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  15480. if ( tmp === ( elem.ownerDocument || document ) ) {
  15481. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  15482. }
  15483. }
  15484. // Fire handlers on the event path
  15485. i = 0;
  15486. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  15487. lastElement = cur;
  15488. event.type = i > 1 ?
  15489. bubbleType :
  15490. special.bindType || type;
  15491. // jQuery handler
  15492. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  15493. dataPriv.get( cur, "handle" );
  15494. if ( handle ) {
  15495. handle.apply( cur, data );
  15496. }
  15497. // Native handler
  15498. handle = ontype && cur[ ontype ];
  15499. if ( handle && handle.apply && acceptData( cur ) ) {
  15500. event.result = handle.apply( cur, data );
  15501. if ( event.result === false ) {
  15502. event.preventDefault();
  15503. }
  15504. }
  15505. }
  15506. event.type = type;
  15507. // If nobody prevented the default action, do it now
  15508. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  15509. if ( ( !special._default ||
  15510. special._default.apply( eventPath.pop(), data ) === false ) &&
  15511. acceptData( elem ) ) {
  15512. // Call a native DOM method on the target with the same name as the event.
  15513. // Don't do default actions on window, that's where global variables be (#6170)
  15514. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  15515. // Don't re-trigger an onFOO event when we call its FOO() method
  15516. tmp = elem[ ontype ];
  15517. if ( tmp ) {
  15518. elem[ ontype ] = null;
  15519. }
  15520. // Prevent re-triggering of the same event, since we already bubbled it above
  15521. jQuery.event.triggered = type;
  15522. if ( event.isPropagationStopped() ) {
  15523. lastElement.addEventListener( type, stopPropagationCallback );
  15524. }
  15525. elem[ type ]();
  15526. if ( event.isPropagationStopped() ) {
  15527. lastElement.removeEventListener( type, stopPropagationCallback );
  15528. }
  15529. jQuery.event.triggered = undefined;
  15530. if ( tmp ) {
  15531. elem[ ontype ] = tmp;
  15532. }
  15533. }
  15534. }
  15535. }
  15536. return event.result;
  15537. },
  15538. // Piggyback on a donor event to simulate a different one
  15539. // Used only for `focus(in | out)` events
  15540. simulate: function( type, elem, event ) {
  15541. var e = jQuery.extend(
  15542. new jQuery.Event(),
  15543. event,
  15544. {
  15545. type: type,
  15546. isSimulated: true
  15547. }
  15548. );
  15549. jQuery.event.trigger( e, null, elem );
  15550. }
  15551. } );
  15552. jQuery.fn.extend( {
  15553. trigger: function( type, data ) {
  15554. return this.each( function() {
  15555. jQuery.event.trigger( type, data, this );
  15556. } );
  15557. },
  15558. triggerHandler: function( type, data ) {
  15559. var elem = this[ 0 ];
  15560. if ( elem ) {
  15561. return jQuery.event.trigger( type, data, elem, true );
  15562. }
  15563. }
  15564. } );
  15565. // Support: Firefox <=44
  15566. // Firefox doesn't have focus(in | out) events
  15567. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  15568. //
  15569. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  15570. // focus(in | out) events fire after focus & blur events,
  15571. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  15572. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  15573. if ( !support.focusin ) {
  15574. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  15575. // Attach a single capturing handler on the document while someone wants focusin/focusout
  15576. var handler = function( event ) {
  15577. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  15578. };
  15579. jQuery.event.special[ fix ] = {
  15580. setup: function() {
  15581. var doc = this.ownerDocument || this,
  15582. attaches = dataPriv.access( doc, fix );
  15583. if ( !attaches ) {
  15584. doc.addEventListener( orig, handler, true );
  15585. }
  15586. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  15587. },
  15588. teardown: function() {
  15589. var doc = this.ownerDocument || this,
  15590. attaches = dataPriv.access( doc, fix ) - 1;
  15591. if ( !attaches ) {
  15592. doc.removeEventListener( orig, handler, true );
  15593. dataPriv.remove( doc, fix );
  15594. } else {
  15595. dataPriv.access( doc, fix, attaches );
  15596. }
  15597. }
  15598. };
  15599. } );
  15600. }
  15601. var location = window.location;
  15602. var nonce = Date.now();
  15603. var rquery = ( /\?/ );
  15604. // Cross-browser xml parsing
  15605. jQuery.parseXML = function( data ) {
  15606. var xml;
  15607. if ( !data || typeof data !== "string" ) {
  15608. return null;
  15609. }
  15610. // Support: IE 9 - 11 only
  15611. // IE throws on parseFromString with invalid input.
  15612. try {
  15613. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  15614. } catch ( e ) {
  15615. xml = undefined;
  15616. }
  15617. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  15618. jQuery.error( "Invalid XML: " + data );
  15619. }
  15620. return xml;
  15621. };
  15622. var
  15623. rbracket = /\[\]$/,
  15624. rCRLF = /\r?\n/g,
  15625. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  15626. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  15627. function buildParams( prefix, obj, traditional, add ) {
  15628. var name;
  15629. if ( Array.isArray( obj ) ) {
  15630. // Serialize array item.
  15631. jQuery.each( obj, function( i, v ) {
  15632. if ( traditional || rbracket.test( prefix ) ) {
  15633. // Treat each array item as a scalar.
  15634. add( prefix, v );
  15635. } else {
  15636. // Item is non-scalar (array or object), encode its numeric index.
  15637. buildParams(
  15638. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  15639. v,
  15640. traditional,
  15641. add
  15642. );
  15643. }
  15644. } );
  15645. } else if ( !traditional && toType( obj ) === "object" ) {
  15646. // Serialize object item.
  15647. for ( name in obj ) {
  15648. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  15649. }
  15650. } else {
  15651. // Serialize scalar item.
  15652. add( prefix, obj );
  15653. }
  15654. }
  15655. // Serialize an array of form elements or a set of
  15656. // key/values into a query string
  15657. jQuery.param = function( a, traditional ) {
  15658. var prefix,
  15659. s = [],
  15660. add = function( key, valueOrFunction ) {
  15661. // If value is a function, invoke it and use its return value
  15662. var value = isFunction( valueOrFunction ) ?
  15663. valueOrFunction() :
  15664. valueOrFunction;
  15665. s[ s.length ] = encodeURIComponent( key ) + "=" +
  15666. encodeURIComponent( value == null ? "" : value );
  15667. };
  15668. if ( a == null ) {
  15669. return "";
  15670. }
  15671. // If an array was passed in, assume that it is an array of form elements.
  15672. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  15673. // Serialize the form elements
  15674. jQuery.each( a, function() {
  15675. add( this.name, this.value );
  15676. } );
  15677. } else {
  15678. // If traditional, encode the "old" way (the way 1.3.2 or older
  15679. // did it), otherwise encode params recursively.
  15680. for ( prefix in a ) {
  15681. buildParams( prefix, a[ prefix ], traditional, add );
  15682. }
  15683. }
  15684. // Return the resulting serialization
  15685. return s.join( "&" );
  15686. };
  15687. jQuery.fn.extend( {
  15688. serialize: function() {
  15689. return jQuery.param( this.serializeArray() );
  15690. },
  15691. serializeArray: function() {
  15692. return this.map( function() {
  15693. // Can add propHook for "elements" to filter or add form elements
  15694. var elements = jQuery.prop( this, "elements" );
  15695. return elements ? jQuery.makeArray( elements ) : this;
  15696. } )
  15697. .filter( function() {
  15698. var type = this.type;
  15699. // Use .is( ":disabled" ) so that fieldset[disabled] works
  15700. return this.name && !jQuery( this ).is( ":disabled" ) &&
  15701. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  15702. ( this.checked || !rcheckableType.test( type ) );
  15703. } )
  15704. .map( function( i, elem ) {
  15705. var val = jQuery( this ).val();
  15706. if ( val == null ) {
  15707. return null;
  15708. }
  15709. if ( Array.isArray( val ) ) {
  15710. return jQuery.map( val, function( val ) {
  15711. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15712. } );
  15713. }
  15714. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15715. } ).get();
  15716. }
  15717. } );
  15718. var
  15719. r20 = /%20/g,
  15720. rhash = /#.*$/,
  15721. rantiCache = /([?&])_=[^&]*/,
  15722. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  15723. // #7653, #8125, #8152: local protocol detection
  15724. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  15725. rnoContent = /^(?:GET|HEAD)$/,
  15726. rprotocol = /^\/\//,
  15727. /* Prefilters
  15728. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  15729. * 2) These are called:
  15730. * - BEFORE asking for a transport
  15731. * - AFTER param serialization (s.data is a string if s.processData is true)
  15732. * 3) key is the dataType
  15733. * 4) the catchall symbol "*" can be used
  15734. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  15735. */
  15736. prefilters = {},
  15737. /* Transports bindings
  15738. * 1) key is the dataType
  15739. * 2) the catchall symbol "*" can be used
  15740. * 3) selection will start with transport dataType and THEN go to "*" if needed
  15741. */
  15742. transports = {},
  15743. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  15744. allTypes = "*/".concat( "*" ),
  15745. // Anchor tag for parsing the document origin
  15746. originAnchor = document.createElement( "a" );
  15747. originAnchor.href = location.href;
  15748. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  15749. function addToPrefiltersOrTransports( structure ) {
  15750. // dataTypeExpression is optional and defaults to "*"
  15751. return function( dataTypeExpression, func ) {
  15752. if ( typeof dataTypeExpression !== "string" ) {
  15753. func = dataTypeExpression;
  15754. dataTypeExpression = "*";
  15755. }
  15756. var dataType,
  15757. i = 0,
  15758. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  15759. if ( isFunction( func ) ) {
  15760. // For each dataType in the dataTypeExpression
  15761. while ( ( dataType = dataTypes[ i++ ] ) ) {
  15762. // Prepend if requested
  15763. if ( dataType[ 0 ] === "+" ) {
  15764. dataType = dataType.slice( 1 ) || "*";
  15765. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  15766. // Otherwise append
  15767. } else {
  15768. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  15769. }
  15770. }
  15771. }
  15772. };
  15773. }
  15774. // Base inspection function for prefilters and transports
  15775. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  15776. var inspected = {},
  15777. seekingTransport = ( structure === transports );
  15778. function inspect( dataType ) {
  15779. var selected;
  15780. inspected[ dataType ] = true;
  15781. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  15782. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  15783. if ( typeof dataTypeOrTransport === "string" &&
  15784. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  15785. options.dataTypes.unshift( dataTypeOrTransport );
  15786. inspect( dataTypeOrTransport );
  15787. return false;
  15788. } else if ( seekingTransport ) {
  15789. return !( selected = dataTypeOrTransport );
  15790. }
  15791. } );
  15792. return selected;
  15793. }
  15794. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  15795. }
  15796. // A special extend for ajax options
  15797. // that takes "flat" options (not to be deep extended)
  15798. // Fixes #9887
  15799. function ajaxExtend( target, src ) {
  15800. var key, deep,
  15801. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  15802. for ( key in src ) {
  15803. if ( src[ key ] !== undefined ) {
  15804. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  15805. }
  15806. }
  15807. if ( deep ) {
  15808. jQuery.extend( true, target, deep );
  15809. }
  15810. return target;
  15811. }
  15812. /* Handles responses to an ajax request:
  15813. * - finds the right dataType (mediates between content-type and expected dataType)
  15814. * - returns the corresponding response
  15815. */
  15816. function ajaxHandleResponses( s, jqXHR, responses ) {
  15817. var ct, type, finalDataType, firstDataType,
  15818. contents = s.contents,
  15819. dataTypes = s.dataTypes;
  15820. // Remove auto dataType and get content-type in the process
  15821. while ( dataTypes[ 0 ] === "*" ) {
  15822. dataTypes.shift();
  15823. if ( ct === undefined ) {
  15824. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  15825. }
  15826. }
  15827. // Check if we're dealing with a known content-type
  15828. if ( ct ) {
  15829. for ( type in contents ) {
  15830. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  15831. dataTypes.unshift( type );
  15832. break;
  15833. }
  15834. }
  15835. }
  15836. // Check to see if we have a response for the expected dataType
  15837. if ( dataTypes[ 0 ] in responses ) {
  15838. finalDataType = dataTypes[ 0 ];
  15839. } else {
  15840. // Try convertible dataTypes
  15841. for ( type in responses ) {
  15842. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  15843. finalDataType = type;
  15844. break;
  15845. }
  15846. if ( !firstDataType ) {
  15847. firstDataType = type;
  15848. }
  15849. }
  15850. // Or just use first one
  15851. finalDataType = finalDataType || firstDataType;
  15852. }
  15853. // If we found a dataType
  15854. // We add the dataType to the list if needed
  15855. // and return the corresponding response
  15856. if ( finalDataType ) {
  15857. if ( finalDataType !== dataTypes[ 0 ] ) {
  15858. dataTypes.unshift( finalDataType );
  15859. }
  15860. return responses[ finalDataType ];
  15861. }
  15862. }
  15863. /* Chain conversions given the request and the original response
  15864. * Also sets the responseXXX fields on the jqXHR instance
  15865. */
  15866. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  15867. var conv2, current, conv, tmp, prev,
  15868. converters = {},
  15869. // Work with a copy of dataTypes in case we need to modify it for conversion
  15870. dataTypes = s.dataTypes.slice();
  15871. // Create converters map with lowercased keys
  15872. if ( dataTypes[ 1 ] ) {
  15873. for ( conv in s.converters ) {
  15874. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  15875. }
  15876. }
  15877. current = dataTypes.shift();
  15878. // Convert to each sequential dataType
  15879. while ( current ) {
  15880. if ( s.responseFields[ current ] ) {
  15881. jqXHR[ s.responseFields[ current ] ] = response;
  15882. }
  15883. // Apply the dataFilter if provided
  15884. if ( !prev && isSuccess && s.dataFilter ) {
  15885. response = s.dataFilter( response, s.dataType );
  15886. }
  15887. prev = current;
  15888. current = dataTypes.shift();
  15889. if ( current ) {
  15890. // There's only work to do if current dataType is non-auto
  15891. if ( current === "*" ) {
  15892. current = prev;
  15893. // Convert response if prev dataType is non-auto and differs from current
  15894. } else if ( prev !== "*" && prev !== current ) {
  15895. // Seek a direct converter
  15896. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  15897. // If none found, seek a pair
  15898. if ( !conv ) {
  15899. for ( conv2 in converters ) {
  15900. // If conv2 outputs current
  15901. tmp = conv2.split( " " );
  15902. if ( tmp[ 1 ] === current ) {
  15903. // If prev can be converted to accepted input
  15904. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  15905. converters[ "* " + tmp[ 0 ] ];
  15906. if ( conv ) {
  15907. // Condense equivalence converters
  15908. if ( conv === true ) {
  15909. conv = converters[ conv2 ];
  15910. // Otherwise, insert the intermediate dataType
  15911. } else if ( converters[ conv2 ] !== true ) {
  15912. current = tmp[ 0 ];
  15913. dataTypes.unshift( tmp[ 1 ] );
  15914. }
  15915. break;
  15916. }
  15917. }
  15918. }
  15919. }
  15920. // Apply converter (if not an equivalence)
  15921. if ( conv !== true ) {
  15922. // Unless errors are allowed to bubble, catch and return them
  15923. if ( conv && s.throws ) {
  15924. response = conv( response );
  15925. } else {
  15926. try {
  15927. response = conv( response );
  15928. } catch ( e ) {
  15929. return {
  15930. state: "parsererror",
  15931. error: conv ? e : "No conversion from " + prev + " to " + current
  15932. };
  15933. }
  15934. }
  15935. }
  15936. }
  15937. }
  15938. }
  15939. return { state: "success", data: response };
  15940. }
  15941. jQuery.extend( {
  15942. // Counter for holding the number of active queries
  15943. active: 0,
  15944. // Last-Modified header cache for next request
  15945. lastModified: {},
  15946. etag: {},
  15947. ajaxSettings: {
  15948. url: location.href,
  15949. type: "GET",
  15950. isLocal: rlocalProtocol.test( location.protocol ),
  15951. global: true,
  15952. processData: true,
  15953. async: true,
  15954. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  15955. /*
  15956. timeout: 0,
  15957. data: null,
  15958. dataType: null,
  15959. username: null,
  15960. password: null,
  15961. cache: null,
  15962. throws: false,
  15963. traditional: false,
  15964. headers: {},
  15965. */
  15966. accepts: {
  15967. "*": allTypes,
  15968. text: "text/plain",
  15969. html: "text/html",
  15970. xml: "application/xml, text/xml",
  15971. json: "application/json, text/javascript"
  15972. },
  15973. contents: {
  15974. xml: /\bxml\b/,
  15975. html: /\bhtml/,
  15976. json: /\bjson\b/
  15977. },
  15978. responseFields: {
  15979. xml: "responseXML",
  15980. text: "responseText",
  15981. json: "responseJSON"
  15982. },
  15983. // Data converters
  15984. // Keys separate source (or catchall "*") and destination types with a single space
  15985. converters: {
  15986. // Convert anything to text
  15987. "* text": String,
  15988. // Text to html (true = no transformation)
  15989. "text html": true,
  15990. // Evaluate text as a json expression
  15991. "text json": JSON.parse,
  15992. // Parse text as xml
  15993. "text xml": jQuery.parseXML
  15994. },
  15995. // For options that shouldn't be deep extended:
  15996. // you can add your own custom options here if
  15997. // and when you create one that shouldn't be
  15998. // deep extended (see ajaxExtend)
  15999. flatOptions: {
  16000. url: true,
  16001. context: true
  16002. }
  16003. },
  16004. // Creates a full fledged settings object into target
  16005. // with both ajaxSettings and settings fields.
  16006. // If target is omitted, writes into ajaxSettings.
  16007. ajaxSetup: function( target, settings ) {
  16008. return settings ?
  16009. // Building a settings object
  16010. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  16011. // Extending ajaxSettings
  16012. ajaxExtend( jQuery.ajaxSettings, target );
  16013. },
  16014. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  16015. ajaxTransport: addToPrefiltersOrTransports( transports ),
  16016. // Main method
  16017. ajax: function( url, options ) {
  16018. // If url is an object, simulate pre-1.5 signature
  16019. if ( typeof url === "object" ) {
  16020. options = url;
  16021. url = undefined;
  16022. }
  16023. // Force options to be an object
  16024. options = options || {};
  16025. var transport,
  16026. // URL without anti-cache param
  16027. cacheURL,
  16028. // Response headers
  16029. responseHeadersString,
  16030. responseHeaders,
  16031. // timeout handle
  16032. timeoutTimer,
  16033. // Url cleanup var
  16034. urlAnchor,
  16035. // Request state (becomes false upon send and true upon completion)
  16036. completed,
  16037. // To know if global events are to be dispatched
  16038. fireGlobals,
  16039. // Loop variable
  16040. i,
  16041. // uncached part of the url
  16042. uncached,
  16043. // Create the final options object
  16044. s = jQuery.ajaxSetup( {}, options ),
  16045. // Callbacks context
  16046. callbackContext = s.context || s,
  16047. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  16048. globalEventContext = s.context &&
  16049. ( callbackContext.nodeType || callbackContext.jquery ) ?
  16050. jQuery( callbackContext ) :
  16051. jQuery.event,
  16052. // Deferreds
  16053. deferred = jQuery.Deferred(),
  16054. completeDeferred = jQuery.Callbacks( "once memory" ),
  16055. // Status-dependent callbacks
  16056. statusCode = s.statusCode || {},
  16057. // Headers (they are sent all at once)
  16058. requestHeaders = {},
  16059. requestHeadersNames = {},
  16060. // Default abort message
  16061. strAbort = "canceled",
  16062. // Fake xhr
  16063. jqXHR = {
  16064. readyState: 0,
  16065. // Builds headers hashtable if needed
  16066. getResponseHeader: function( key ) {
  16067. var match;
  16068. if ( completed ) {
  16069. if ( !responseHeaders ) {
  16070. responseHeaders = {};
  16071. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  16072. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  16073. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  16074. .concat( match[ 2 ] );
  16075. }
  16076. }
  16077. match = responseHeaders[ key.toLowerCase() + " " ];
  16078. }
  16079. return match == null ? null : match.join( ", " );
  16080. },
  16081. // Raw string
  16082. getAllResponseHeaders: function() {
  16083. return completed ? responseHeadersString : null;
  16084. },
  16085. // Caches the header
  16086. setRequestHeader: function( name, value ) {
  16087. if ( completed == null ) {
  16088. name = requestHeadersNames[ name.toLowerCase() ] =
  16089. requestHeadersNames[ name.toLowerCase() ] || name;
  16090. requestHeaders[ name ] = value;
  16091. }
  16092. return this;
  16093. },
  16094. // Overrides response content-type header
  16095. overrideMimeType: function( type ) {
  16096. if ( completed == null ) {
  16097. s.mimeType = type;
  16098. }
  16099. return this;
  16100. },
  16101. // Status-dependent callbacks
  16102. statusCode: function( map ) {
  16103. var code;
  16104. if ( map ) {
  16105. if ( completed ) {
  16106. // Execute the appropriate callbacks
  16107. jqXHR.always( map[ jqXHR.status ] );
  16108. } else {
  16109. // Lazy-add the new callbacks in a way that preserves old ones
  16110. for ( code in map ) {
  16111. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  16112. }
  16113. }
  16114. }
  16115. return this;
  16116. },
  16117. // Cancel the request
  16118. abort: function( statusText ) {
  16119. var finalText = statusText || strAbort;
  16120. if ( transport ) {
  16121. transport.abort( finalText );
  16122. }
  16123. done( 0, finalText );
  16124. return this;
  16125. }
  16126. };
  16127. // Attach deferreds
  16128. deferred.promise( jqXHR );
  16129. // Add protocol if not provided (prefilters might expect it)
  16130. // Handle falsy url in the settings object (#10093: consistency with old signature)
  16131. // We also use the url parameter if available
  16132. s.url = ( ( url || s.url || location.href ) + "" )
  16133. .replace( rprotocol, location.protocol + "//" );
  16134. // Alias method option to type as per ticket #12004
  16135. s.type = options.method || options.type || s.method || s.type;
  16136. // Extract dataTypes list
  16137. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  16138. // A cross-domain request is in order when the origin doesn't match the current origin.
  16139. if ( s.crossDomain == null ) {
  16140. urlAnchor = document.createElement( "a" );
  16141. // Support: IE <=8 - 11, Edge 12 - 15
  16142. // IE throws exception on accessing the href property if url is malformed,
  16143. // e.g. http://example.com:80x/
  16144. try {
  16145. urlAnchor.href = s.url;
  16146. // Support: IE <=8 - 11 only
  16147. // Anchor's host property isn't correctly set when s.url is relative
  16148. urlAnchor.href = urlAnchor.href;
  16149. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  16150. urlAnchor.protocol + "//" + urlAnchor.host;
  16151. } catch ( e ) {
  16152. // If there is an error parsing the URL, assume it is crossDomain,
  16153. // it can be rejected by the transport if it is invalid
  16154. s.crossDomain = true;
  16155. }
  16156. }
  16157. // Convert data if not already a string
  16158. if ( s.data && s.processData && typeof s.data !== "string" ) {
  16159. s.data = jQuery.param( s.data, s.traditional );
  16160. }
  16161. // Apply prefilters
  16162. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  16163. // If request was aborted inside a prefilter, stop there
  16164. if ( completed ) {
  16165. return jqXHR;
  16166. }
  16167. // We can fire global events as of now if asked to
  16168. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  16169. fireGlobals = jQuery.event && s.global;
  16170. // Watch for a new set of requests
  16171. if ( fireGlobals && jQuery.active++ === 0 ) {
  16172. jQuery.event.trigger( "ajaxStart" );
  16173. }
  16174. // Uppercase the type
  16175. s.type = s.type.toUpperCase();
  16176. // Determine if request has content
  16177. s.hasContent = !rnoContent.test( s.type );
  16178. // Save the URL in case we're toying with the If-Modified-Since
  16179. // and/or If-None-Match header later on
  16180. // Remove hash to simplify url manipulation
  16181. cacheURL = s.url.replace( rhash, "" );
  16182. // More options handling for requests with no content
  16183. if ( !s.hasContent ) {
  16184. // Remember the hash so we can put it back
  16185. uncached = s.url.slice( cacheURL.length );
  16186. // If data is available and should be processed, append data to url
  16187. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  16188. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  16189. // #9682: remove data so that it's not used in an eventual retry
  16190. delete s.data;
  16191. }
  16192. // Add or update anti-cache param if needed
  16193. if ( s.cache === false ) {
  16194. cacheURL = cacheURL.replace( rantiCache, "$1" );
  16195. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  16196. }
  16197. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  16198. s.url = cacheURL + uncached;
  16199. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  16200. } else if ( s.data && s.processData &&
  16201. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  16202. s.data = s.data.replace( r20, "+" );
  16203. }
  16204. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16205. if ( s.ifModified ) {
  16206. if ( jQuery.lastModified[ cacheURL ] ) {
  16207. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  16208. }
  16209. if ( jQuery.etag[ cacheURL ] ) {
  16210. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  16211. }
  16212. }
  16213. // Set the correct header, if data is being sent
  16214. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  16215. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  16216. }
  16217. // Set the Accepts header for the server, depending on the dataType
  16218. jqXHR.setRequestHeader(
  16219. "Accept",
  16220. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  16221. s.accepts[ s.dataTypes[ 0 ] ] +
  16222. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  16223. s.accepts[ "*" ]
  16224. );
  16225. // Check for headers option
  16226. for ( i in s.headers ) {
  16227. jqXHR.setRequestHeader( i, s.headers[ i ] );
  16228. }
  16229. // Allow custom headers/mimetypes and early abort
  16230. if ( s.beforeSend &&
  16231. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  16232. // Abort if not done already and return
  16233. return jqXHR.abort();
  16234. }
  16235. // Aborting is no longer a cancellation
  16236. strAbort = "abort";
  16237. // Install callbacks on deferreds
  16238. completeDeferred.add( s.complete );
  16239. jqXHR.done( s.success );
  16240. jqXHR.fail( s.error );
  16241. // Get transport
  16242. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  16243. // If no transport, we auto-abort
  16244. if ( !transport ) {
  16245. done( -1, "No Transport" );
  16246. } else {
  16247. jqXHR.readyState = 1;
  16248. // Send global event
  16249. if ( fireGlobals ) {
  16250. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  16251. }
  16252. // If request was aborted inside ajaxSend, stop there
  16253. if ( completed ) {
  16254. return jqXHR;
  16255. }
  16256. // Timeout
  16257. if ( s.async && s.timeout > 0 ) {
  16258. timeoutTimer = window.setTimeout( function() {
  16259. jqXHR.abort( "timeout" );
  16260. }, s.timeout );
  16261. }
  16262. try {
  16263. completed = false;
  16264. transport.send( requestHeaders, done );
  16265. } catch ( e ) {
  16266. // Rethrow post-completion exceptions
  16267. if ( completed ) {
  16268. throw e;
  16269. }
  16270. // Propagate others as results
  16271. done( -1, e );
  16272. }
  16273. }
  16274. // Callback for when everything is done
  16275. function done( status, nativeStatusText, responses, headers ) {
  16276. var isSuccess, success, error, response, modified,
  16277. statusText = nativeStatusText;
  16278. // Ignore repeat invocations
  16279. if ( completed ) {
  16280. return;
  16281. }
  16282. completed = true;
  16283. // Clear timeout if it exists
  16284. if ( timeoutTimer ) {
  16285. window.clearTimeout( timeoutTimer );
  16286. }
  16287. // Dereference transport for early garbage collection
  16288. // (no matter how long the jqXHR object will be used)
  16289. transport = undefined;
  16290. // Cache response headers
  16291. responseHeadersString = headers || "";
  16292. // Set readyState
  16293. jqXHR.readyState = status > 0 ? 4 : 0;
  16294. // Determine if successful
  16295. isSuccess = status >= 200 && status < 300 || status === 304;
  16296. // Get response data
  16297. if ( responses ) {
  16298. response = ajaxHandleResponses( s, jqXHR, responses );
  16299. }
  16300. // Convert no matter what (that way responseXXX fields are always set)
  16301. response = ajaxConvert( s, response, jqXHR, isSuccess );
  16302. // If successful, handle type chaining
  16303. if ( isSuccess ) {
  16304. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16305. if ( s.ifModified ) {
  16306. modified = jqXHR.getResponseHeader( "Last-Modified" );
  16307. if ( modified ) {
  16308. jQuery.lastModified[ cacheURL ] = modified;
  16309. }
  16310. modified = jqXHR.getResponseHeader( "etag" );
  16311. if ( modified ) {
  16312. jQuery.etag[ cacheURL ] = modified;
  16313. }
  16314. }
  16315. // if no content
  16316. if ( status === 204 || s.type === "HEAD" ) {
  16317. statusText = "nocontent";
  16318. // if not modified
  16319. } else if ( status === 304 ) {
  16320. statusText = "notmodified";
  16321. // If we have data, let's convert it
  16322. } else {
  16323. statusText = response.state;
  16324. success = response.data;
  16325. error = response.error;
  16326. isSuccess = !error;
  16327. }
  16328. } else {
  16329. // Extract error from statusText and normalize for non-aborts
  16330. error = statusText;
  16331. if ( status || !statusText ) {
  16332. statusText = "error";
  16333. if ( status < 0 ) {
  16334. status = 0;
  16335. }
  16336. }
  16337. }
  16338. // Set data for the fake xhr object
  16339. jqXHR.status = status;
  16340. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  16341. // Success/Error
  16342. if ( isSuccess ) {
  16343. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  16344. } else {
  16345. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  16346. }
  16347. // Status-dependent callbacks
  16348. jqXHR.statusCode( statusCode );
  16349. statusCode = undefined;
  16350. if ( fireGlobals ) {
  16351. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  16352. [ jqXHR, s, isSuccess ? success : error ] );
  16353. }
  16354. // Complete
  16355. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  16356. if ( fireGlobals ) {
  16357. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  16358. // Handle the global AJAX counter
  16359. if ( !( --jQuery.active ) ) {
  16360. jQuery.event.trigger( "ajaxStop" );
  16361. }
  16362. }
  16363. }
  16364. return jqXHR;
  16365. },
  16366. getJSON: function( url, data, callback ) {
  16367. return jQuery.get( url, data, callback, "json" );
  16368. },
  16369. getScript: function( url, callback ) {
  16370. return jQuery.get( url, undefined, callback, "script" );
  16371. }
  16372. } );
  16373. jQuery.each( [ "get", "post" ], function( i, method ) {
  16374. jQuery[ method ] = function( url, data, callback, type ) {
  16375. // Shift arguments if data argument was omitted
  16376. if ( isFunction( data ) ) {
  16377. type = type || callback;
  16378. callback = data;
  16379. data = undefined;
  16380. }
  16381. // The url can be an options object (which then must have .url)
  16382. return jQuery.ajax( jQuery.extend( {
  16383. url: url,
  16384. type: method,
  16385. dataType: type,
  16386. data: data,
  16387. success: callback
  16388. }, jQuery.isPlainObject( url ) && url ) );
  16389. };
  16390. } );
  16391. jQuery._evalUrl = function( url, options ) {
  16392. return jQuery.ajax( {
  16393. url: url,
  16394. // Make this explicit, since user can override this through ajaxSetup (#11264)
  16395. type: "GET",
  16396. dataType: "script",
  16397. cache: true,
  16398. async: false,
  16399. global: false,
  16400. // Only evaluate the response if it is successful (gh-4126)
  16401. // dataFilter is not invoked for failure responses, so using it instead
  16402. // of the default converter is kludgy but it works.
  16403. converters: {
  16404. "text script": function() {}
  16405. },
  16406. dataFilter: function( response ) {
  16407. jQuery.globalEval( response, options );
  16408. }
  16409. } );
  16410. };
  16411. jQuery.fn.extend( {
  16412. wrapAll: function( html ) {
  16413. var wrap;
  16414. if ( this[ 0 ] ) {
  16415. if ( isFunction( html ) ) {
  16416. html = html.call( this[ 0 ] );
  16417. }
  16418. // The elements to wrap the target around
  16419. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  16420. if ( this[ 0 ].parentNode ) {
  16421. wrap.insertBefore( this[ 0 ] );
  16422. }
  16423. wrap.map( function() {
  16424. var elem = this;
  16425. while ( elem.firstElementChild ) {
  16426. elem = elem.firstElementChild;
  16427. }
  16428. return elem;
  16429. } ).append( this );
  16430. }
  16431. return this;
  16432. },
  16433. wrapInner: function( html ) {
  16434. if ( isFunction( html ) ) {
  16435. return this.each( function( i ) {
  16436. jQuery( this ).wrapInner( html.call( this, i ) );
  16437. } );
  16438. }
  16439. return this.each( function() {
  16440. var self = jQuery( this ),
  16441. contents = self.contents();
  16442. if ( contents.length ) {
  16443. contents.wrapAll( html );
  16444. } else {
  16445. self.append( html );
  16446. }
  16447. } );
  16448. },
  16449. wrap: function( html ) {
  16450. var htmlIsFunction = isFunction( html );
  16451. return this.each( function( i ) {
  16452. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  16453. } );
  16454. },
  16455. unwrap: function( selector ) {
  16456. this.parent( selector ).not( "body" ).each( function() {
  16457. jQuery( this ).replaceWith( this.childNodes );
  16458. } );
  16459. return this;
  16460. }
  16461. } );
  16462. jQuery.expr.pseudos.hidden = function( elem ) {
  16463. return !jQuery.expr.pseudos.visible( elem );
  16464. };
  16465. jQuery.expr.pseudos.visible = function( elem ) {
  16466. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  16467. };
  16468. jQuery.ajaxSettings.xhr = function() {
  16469. try {
  16470. return new window.XMLHttpRequest();
  16471. } catch ( e ) {}
  16472. };
  16473. var xhrSuccessStatus = {
  16474. // File protocol always yields status code 0, assume 200
  16475. 0: 200,
  16476. // Support: IE <=9 only
  16477. // #1450: sometimes IE returns 1223 when it should be 204
  16478. 1223: 204
  16479. },
  16480. xhrSupported = jQuery.ajaxSettings.xhr();
  16481. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  16482. support.ajax = xhrSupported = !!xhrSupported;
  16483. jQuery.ajaxTransport( function( options ) {
  16484. var callback, errorCallback;
  16485. // Cross domain only allowed if supported through XMLHttpRequest
  16486. if ( support.cors || xhrSupported && !options.crossDomain ) {
  16487. return {
  16488. send: function( headers, complete ) {
  16489. var i,
  16490. xhr = options.xhr();
  16491. xhr.open(
  16492. options.type,
  16493. options.url,
  16494. options.async,
  16495. options.username,
  16496. options.password
  16497. );
  16498. // Apply custom fields if provided
  16499. if ( options.xhrFields ) {
  16500. for ( i in options.xhrFields ) {
  16501. xhr[ i ] = options.xhrFields[ i ];
  16502. }
  16503. }
  16504. // Override mime type if needed
  16505. if ( options.mimeType && xhr.overrideMimeType ) {
  16506. xhr.overrideMimeType( options.mimeType );
  16507. }
  16508. // X-Requested-With header
  16509. // For cross-domain requests, seeing as conditions for a preflight are
  16510. // akin to a jigsaw puzzle, we simply never set it to be sure.
  16511. // (it can always be set on a per-request basis or even using ajaxSetup)
  16512. // For same-domain requests, won't change header if already provided.
  16513. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  16514. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  16515. }
  16516. // Set headers
  16517. for ( i in headers ) {
  16518. xhr.setRequestHeader( i, headers[ i ] );
  16519. }
  16520. // Callback
  16521. callback = function( type ) {
  16522. return function() {
  16523. if ( callback ) {
  16524. callback = errorCallback = xhr.onload =
  16525. xhr.onerror = xhr.onabort = xhr.ontimeout =
  16526. xhr.onreadystatechange = null;
  16527. if ( type === "abort" ) {
  16528. xhr.abort();
  16529. } else if ( type === "error" ) {
  16530. // Support: IE <=9 only
  16531. // On a manual native abort, IE9 throws
  16532. // errors on any property access that is not readyState
  16533. if ( typeof xhr.status !== "number" ) {
  16534. complete( 0, "error" );
  16535. } else {
  16536. complete(
  16537. // File: protocol always yields status 0; see #8605, #14207
  16538. xhr.status,
  16539. xhr.statusText
  16540. );
  16541. }
  16542. } else {
  16543. complete(
  16544. xhrSuccessStatus[ xhr.status ] || xhr.status,
  16545. xhr.statusText,
  16546. // Support: IE <=9 only
  16547. // IE9 has no XHR2 but throws on binary (trac-11426)
  16548. // For XHR2 non-text, let the caller handle it (gh-2498)
  16549. ( xhr.responseType || "text" ) !== "text" ||
  16550. typeof xhr.responseText !== "string" ?
  16551. { binary: xhr.response } :
  16552. { text: xhr.responseText },
  16553. xhr.getAllResponseHeaders()
  16554. );
  16555. }
  16556. }
  16557. };
  16558. };
  16559. // Listen to events
  16560. xhr.onload = callback();
  16561. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  16562. // Support: IE 9 only
  16563. // Use onreadystatechange to replace onabort
  16564. // to handle uncaught aborts
  16565. if ( xhr.onabort !== undefined ) {
  16566. xhr.onabort = errorCallback;
  16567. } else {
  16568. xhr.onreadystatechange = function() {
  16569. // Check readyState before timeout as it changes
  16570. if ( xhr.readyState === 4 ) {
  16571. // Allow onerror to be called first,
  16572. // but that will not handle a native abort
  16573. // Also, save errorCallback to a variable
  16574. // as xhr.onerror cannot be accessed
  16575. window.setTimeout( function() {
  16576. if ( callback ) {
  16577. errorCallback();
  16578. }
  16579. } );
  16580. }
  16581. };
  16582. }
  16583. // Create the abort callback
  16584. callback = callback( "abort" );
  16585. try {
  16586. // Do send the request (this may raise an exception)
  16587. xhr.send( options.hasContent && options.data || null );
  16588. } catch ( e ) {
  16589. // #14683: Only rethrow if this hasn't been notified as an error yet
  16590. if ( callback ) {
  16591. throw e;
  16592. }
  16593. }
  16594. },
  16595. abort: function() {
  16596. if ( callback ) {
  16597. callback();
  16598. }
  16599. }
  16600. };
  16601. }
  16602. } );
  16603. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  16604. jQuery.ajaxPrefilter( function( s ) {
  16605. if ( s.crossDomain ) {
  16606. s.contents.script = false;
  16607. }
  16608. } );
  16609. // Install script dataType
  16610. jQuery.ajaxSetup( {
  16611. accepts: {
  16612. script: "text/javascript, application/javascript, " +
  16613. "application/ecmascript, application/x-ecmascript"
  16614. },
  16615. contents: {
  16616. script: /\b(?:java|ecma)script\b/
  16617. },
  16618. converters: {
  16619. "text script": function( text ) {
  16620. jQuery.globalEval( text );
  16621. return text;
  16622. }
  16623. }
  16624. } );
  16625. // Handle cache's special case and crossDomain
  16626. jQuery.ajaxPrefilter( "script", function( s ) {
  16627. if ( s.cache === undefined ) {
  16628. s.cache = false;
  16629. }
  16630. if ( s.crossDomain ) {
  16631. s.type = "GET";
  16632. }
  16633. } );
  16634. // Bind script tag hack transport
  16635. jQuery.ajaxTransport( "script", function( s ) {
  16636. // This transport only deals with cross domain or forced-by-attrs requests
  16637. if ( s.crossDomain || s.scriptAttrs ) {
  16638. var script, callback;
  16639. return {
  16640. send: function( _, complete ) {
  16641. script = jQuery( "<script>" )
  16642. .attr( s.scriptAttrs || {} )
  16643. .prop( { charset: s.scriptCharset, src: s.url } )
  16644. .on( "load error", callback = function( evt ) {
  16645. script.remove();
  16646. callback = null;
  16647. if ( evt ) {
  16648. complete( evt.type === "error" ? 404 : 200, evt.type );
  16649. }
  16650. } );
  16651. // Use native DOM manipulation to avoid our domManip AJAX trickery
  16652. document.head.appendChild( script[ 0 ] );
  16653. },
  16654. abort: function() {
  16655. if ( callback ) {
  16656. callback();
  16657. }
  16658. }
  16659. };
  16660. }
  16661. } );
  16662. var oldCallbacks = [],
  16663. rjsonp = /(=)\?(?=&|$)|\?\?/;
  16664. // Default jsonp settings
  16665. jQuery.ajaxSetup( {
  16666. jsonp: "callback",
  16667. jsonpCallback: function() {
  16668. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  16669. this[ callback ] = true;
  16670. return callback;
  16671. }
  16672. } );
  16673. // Detect, normalize options and install callbacks for jsonp requests
  16674. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  16675. var callbackName, overwritten, responseContainer,
  16676. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  16677. "url" :
  16678. typeof s.data === "string" &&
  16679. ( s.contentType || "" )
  16680. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  16681. rjsonp.test( s.data ) && "data"
  16682. );
  16683. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  16684. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  16685. // Get callback name, remembering preexisting value associated with it
  16686. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  16687. s.jsonpCallback() :
  16688. s.jsonpCallback;
  16689. // Insert callback into url or form data
  16690. if ( jsonProp ) {
  16691. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  16692. } else if ( s.jsonp !== false ) {
  16693. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  16694. }
  16695. // Use data converter to retrieve json after script execution
  16696. s.converters[ "script json" ] = function() {
  16697. if ( !responseContainer ) {
  16698. jQuery.error( callbackName + " was not called" );
  16699. }
  16700. return responseContainer[ 0 ];
  16701. };
  16702. // Force json dataType
  16703. s.dataTypes[ 0 ] = "json";
  16704. // Install callback
  16705. overwritten = window[ callbackName ];
  16706. window[ callbackName ] = function() {
  16707. responseContainer = arguments;
  16708. };
  16709. // Clean-up function (fires after converters)
  16710. jqXHR.always( function() {
  16711. // If previous value didn't exist - remove it
  16712. if ( overwritten === undefined ) {
  16713. jQuery( window ).removeProp( callbackName );
  16714. // Otherwise restore preexisting value
  16715. } else {
  16716. window[ callbackName ] = overwritten;
  16717. }
  16718. // Save back as free
  16719. if ( s[ callbackName ] ) {
  16720. // Make sure that re-using the options doesn't screw things around
  16721. s.jsonpCallback = originalSettings.jsonpCallback;
  16722. // Save the callback name for future use
  16723. oldCallbacks.push( callbackName );
  16724. }
  16725. // Call if it was a function and we have a response
  16726. if ( responseContainer && isFunction( overwritten ) ) {
  16727. overwritten( responseContainer[ 0 ] );
  16728. }
  16729. responseContainer = overwritten = undefined;
  16730. } );
  16731. // Delegate to script
  16732. return "script";
  16733. }
  16734. } );
  16735. // Support: Safari 8 only
  16736. // In Safari 8 documents created via document.implementation.createHTMLDocument
  16737. // collapse sibling forms: the second one becomes a child of the first one.
  16738. // Because of that, this security measure has to be disabled in Safari 8.
  16739. // https://bugs.webkit.org/show_bug.cgi?id=137337
  16740. support.createHTMLDocument = ( function() {
  16741. var body = document.implementation.createHTMLDocument( "" ).body;
  16742. body.innerHTML = "<form></form><form></form>";
  16743. return body.childNodes.length === 2;
  16744. } )();
  16745. // Argument "data" should be string of html
  16746. // context (optional): If specified, the fragment will be created in this context,
  16747. // defaults to document
  16748. // keepScripts (optional): If true, will include scripts passed in the html string
  16749. jQuery.parseHTML = function( data, context, keepScripts ) {
  16750. if ( typeof data !== "string" ) {
  16751. return [];
  16752. }
  16753. if ( typeof context === "boolean" ) {
  16754. keepScripts = context;
  16755. context = false;
  16756. }
  16757. var base, parsed, scripts;
  16758. if ( !context ) {
  16759. // Stop scripts or inline event handlers from being executed immediately
  16760. // by using document.implementation
  16761. if ( support.createHTMLDocument ) {
  16762. context = document.implementation.createHTMLDocument( "" );
  16763. // Set the base href for the created document
  16764. // so any parsed elements with URLs
  16765. // are based on the document's URL (gh-2965)
  16766. base = context.createElement( "base" );
  16767. base.href = document.location.href;
  16768. context.head.appendChild( base );
  16769. } else {
  16770. context = document;
  16771. }
  16772. }
  16773. parsed = rsingleTag.exec( data );
  16774. scripts = !keepScripts && [];
  16775. // Single tag
  16776. if ( parsed ) {
  16777. return [ context.createElement( parsed[ 1 ] ) ];
  16778. }
  16779. parsed = buildFragment( [ data ], context, scripts );
  16780. if ( scripts && scripts.length ) {
  16781. jQuery( scripts ).remove();
  16782. }
  16783. return jQuery.merge( [], parsed.childNodes );
  16784. };
  16785. /**
  16786. * Load a url into a page
  16787. */
  16788. jQuery.fn.load = function( url, params, callback ) {
  16789. var selector, type, response,
  16790. self = this,
  16791. off = url.indexOf( " " );
  16792. if ( off > -1 ) {
  16793. selector = stripAndCollapse( url.slice( off ) );
  16794. url = url.slice( 0, off );
  16795. }
  16796. // If it's a function
  16797. if ( isFunction( params ) ) {
  16798. // We assume that it's the callback
  16799. callback = params;
  16800. params = undefined;
  16801. // Otherwise, build a param string
  16802. } else if ( params && typeof params === "object" ) {
  16803. type = "POST";
  16804. }
  16805. // If we have elements to modify, make the request
  16806. if ( self.length > 0 ) {
  16807. jQuery.ajax( {
  16808. url: url,
  16809. // If "type" variable is undefined, then "GET" method will be used.
  16810. // Make value of this field explicit since
  16811. // user can override it through ajaxSetup method
  16812. type: type || "GET",
  16813. dataType: "html",
  16814. data: params
  16815. } ).done( function( responseText ) {
  16816. // Save response for use in complete callback
  16817. response = arguments;
  16818. self.html( selector ?
  16819. // If a selector was specified, locate the right elements in a dummy div
  16820. // Exclude scripts to avoid IE 'Permission Denied' errors
  16821. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  16822. // Otherwise use the full result
  16823. responseText );
  16824. // If the request succeeds, this function gets "data", "status", "jqXHR"
  16825. // but they are ignored because response was set above.
  16826. // If it fails, this function gets "jqXHR", "status", "error"
  16827. } ).always( callback && function( jqXHR, status ) {
  16828. self.each( function() {
  16829. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  16830. } );
  16831. } );
  16832. }
  16833. return this;
  16834. };
  16835. // Attach a bunch of functions for handling common AJAX events
  16836. jQuery.each( [
  16837. "ajaxStart",
  16838. "ajaxStop",
  16839. "ajaxComplete",
  16840. "ajaxError",
  16841. "ajaxSuccess",
  16842. "ajaxSend"
  16843. ], function( i, type ) {
  16844. jQuery.fn[ type ] = function( fn ) {
  16845. return this.on( type, fn );
  16846. };
  16847. } );
  16848. jQuery.expr.pseudos.animated = function( elem ) {
  16849. return jQuery.grep( jQuery.timers, function( fn ) {
  16850. return elem === fn.elem;
  16851. } ).length;
  16852. };
  16853. jQuery.offset = {
  16854. setOffset: function( elem, options, i ) {
  16855. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  16856. position = jQuery.css( elem, "position" ),
  16857. curElem = jQuery( elem ),
  16858. props = {};
  16859. // Set position first, in-case top/left are set even on static elem
  16860. if ( position === "static" ) {
  16861. elem.style.position = "relative";
  16862. }
  16863. curOffset = curElem.offset();
  16864. curCSSTop = jQuery.css( elem, "top" );
  16865. curCSSLeft = jQuery.css( elem, "left" );
  16866. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  16867. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  16868. // Need to be able to calculate position if either
  16869. // top or left is auto and position is either absolute or fixed
  16870. if ( calculatePosition ) {
  16871. curPosition = curElem.position();
  16872. curTop = curPosition.top;
  16873. curLeft = curPosition.left;
  16874. } else {
  16875. curTop = parseFloat( curCSSTop ) || 0;
  16876. curLeft = parseFloat( curCSSLeft ) || 0;
  16877. }
  16878. if ( isFunction( options ) ) {
  16879. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  16880. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  16881. }
  16882. if ( options.top != null ) {
  16883. props.top = ( options.top - curOffset.top ) + curTop;
  16884. }
  16885. if ( options.left != null ) {
  16886. props.left = ( options.left - curOffset.left ) + curLeft;
  16887. }
  16888. if ( "using" in options ) {
  16889. options.using.call( elem, props );
  16890. } else {
  16891. curElem.css( props );
  16892. }
  16893. }
  16894. };
  16895. jQuery.fn.extend( {
  16896. // offset() relates an element's border box to the document origin
  16897. offset: function( options ) {
  16898. // Preserve chaining for setter
  16899. if ( arguments.length ) {
  16900. return options === undefined ?
  16901. this :
  16902. this.each( function( i ) {
  16903. jQuery.offset.setOffset( this, options, i );
  16904. } );
  16905. }
  16906. var rect, win,
  16907. elem = this[ 0 ];
  16908. if ( !elem ) {
  16909. return;
  16910. }
  16911. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  16912. // Support: IE <=11 only
  16913. // Running getBoundingClientRect on a
  16914. // disconnected node in IE throws an error
  16915. if ( !elem.getClientRects().length ) {
  16916. return { top: 0, left: 0 };
  16917. }
  16918. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  16919. rect = elem.getBoundingClientRect();
  16920. win = elem.ownerDocument.defaultView;
  16921. return {
  16922. top: rect.top + win.pageYOffset,
  16923. left: rect.left + win.pageXOffset
  16924. };
  16925. },
  16926. // position() relates an element's margin box to its offset parent's padding box
  16927. // This corresponds to the behavior of CSS absolute positioning
  16928. position: function() {
  16929. if ( !this[ 0 ] ) {
  16930. return;
  16931. }
  16932. var offsetParent, offset, doc,
  16933. elem = this[ 0 ],
  16934. parentOffset = { top: 0, left: 0 };
  16935. // position:fixed elements are offset from the viewport, which itself always has zero offset
  16936. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  16937. // Assume position:fixed implies availability of getBoundingClientRect
  16938. offset = elem.getBoundingClientRect();
  16939. } else {
  16940. offset = this.offset();
  16941. // Account for the *real* offset parent, which can be the document or its root element
  16942. // when a statically positioned element is identified
  16943. doc = elem.ownerDocument;
  16944. offsetParent = elem.offsetParent || doc.documentElement;
  16945. while ( offsetParent &&
  16946. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  16947. jQuery.css( offsetParent, "position" ) === "static" ) {
  16948. offsetParent = offsetParent.parentNode;
  16949. }
  16950. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  16951. // Incorporate borders into its offset, since they are outside its content origin
  16952. parentOffset = jQuery( offsetParent ).offset();
  16953. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  16954. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  16955. }
  16956. }
  16957. // Subtract parent offsets and element margins
  16958. return {
  16959. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  16960. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  16961. };
  16962. },
  16963. // This method will return documentElement in the following cases:
  16964. // 1) For the element inside the iframe without offsetParent, this method will return
  16965. // documentElement of the parent window
  16966. // 2) For the hidden or detached element
  16967. // 3) For body or html element, i.e. in case of the html node - it will return itself
  16968. //
  16969. // but those exceptions were never presented as a real life use-cases
  16970. // and might be considered as more preferable results.
  16971. //
  16972. // This logic, however, is not guaranteed and can change at any point in the future
  16973. offsetParent: function() {
  16974. return this.map( function() {
  16975. var offsetParent = this.offsetParent;
  16976. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  16977. offsetParent = offsetParent.offsetParent;
  16978. }
  16979. return offsetParent || documentElement;
  16980. } );
  16981. }
  16982. } );
  16983. // Create scrollLeft and scrollTop methods
  16984. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  16985. var top = "pageYOffset" === prop;
  16986. jQuery.fn[ method ] = function( val ) {
  16987. return access( this, function( elem, method, val ) {
  16988. // Coalesce documents and windows
  16989. var win;
  16990. if ( isWindow( elem ) ) {
  16991. win = elem;
  16992. } else if ( elem.nodeType === 9 ) {
  16993. win = elem.defaultView;
  16994. }
  16995. if ( val === undefined ) {
  16996. return win ? win[ prop ] : elem[ method ];
  16997. }
  16998. if ( win ) {
  16999. win.scrollTo(
  17000. !top ? val : win.pageXOffset,
  17001. top ? val : win.pageYOffset
  17002. );
  17003. } else {
  17004. elem[ method ] = val;
  17005. }
  17006. }, method, val, arguments.length );
  17007. };
  17008. } );
  17009. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  17010. // Add the top/left cssHooks using jQuery.fn.position
  17011. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  17012. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  17013. // getComputedStyle returns percent when specified for top/left/bottom/right;
  17014. // rather than make the css module depend on the offset module, just check for it here
  17015. jQuery.each( [ "top", "left" ], function( i, prop ) {
  17016. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  17017. function( elem, computed ) {
  17018. if ( computed ) {
  17019. computed = curCSS( elem, prop );
  17020. // If curCSS returns percentage, fallback to offset
  17021. return rnumnonpx.test( computed ) ?
  17022. jQuery( elem ).position()[ prop ] + "px" :
  17023. computed;
  17024. }
  17025. }
  17026. );
  17027. } );
  17028. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  17029. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  17030. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  17031. function( defaultExtra, funcName ) {
  17032. // Margin is only for outerHeight, outerWidth
  17033. jQuery.fn[ funcName ] = function( margin, value ) {
  17034. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  17035. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  17036. return access( this, function( elem, type, value ) {
  17037. var doc;
  17038. if ( isWindow( elem ) ) {
  17039. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  17040. return funcName.indexOf( "outer" ) === 0 ?
  17041. elem[ "inner" + name ] :
  17042. elem.document.documentElement[ "client" + name ];
  17043. }
  17044. // Get document width or height
  17045. if ( elem.nodeType === 9 ) {
  17046. doc = elem.documentElement;
  17047. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  17048. // whichever is greatest
  17049. return Math.max(
  17050. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  17051. elem.body[ "offset" + name ], doc[ "offset" + name ],
  17052. doc[ "client" + name ]
  17053. );
  17054. }
  17055. return value === undefined ?
  17056. // Get width or height on the element, requesting but not forcing parseFloat
  17057. jQuery.css( elem, type, extra ) :
  17058. // Set width or height on the element
  17059. jQuery.style( elem, type, value, extra );
  17060. }, type, chainable ? margin : undefined, chainable );
  17061. };
  17062. } );
  17063. } );
  17064. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  17065. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  17066. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  17067. function( i, name ) {
  17068. // Handle event binding
  17069. jQuery.fn[ name ] = function( data, fn ) {
  17070. return arguments.length > 0 ?
  17071. this.on( name, null, data, fn ) :
  17072. this.trigger( name );
  17073. };
  17074. } );
  17075. jQuery.fn.extend( {
  17076. hover: function( fnOver, fnOut ) {
  17077. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  17078. }
  17079. } );
  17080. jQuery.fn.extend( {
  17081. bind: function( types, data, fn ) {
  17082. return this.on( types, null, data, fn );
  17083. },
  17084. unbind: function( types, fn ) {
  17085. return this.off( types, null, fn );
  17086. },
  17087. delegate: function( selector, types, data, fn ) {
  17088. return this.on( types, selector, data, fn );
  17089. },
  17090. undelegate: function( selector, types, fn ) {
  17091. // ( namespace ) or ( selector, types [, fn] )
  17092. return arguments.length === 1 ?
  17093. this.off( selector, "**" ) :
  17094. this.off( types, selector || "**", fn );
  17095. }
  17096. } );
  17097. // Bind a function to a context, optionally partially applying any
  17098. // arguments.
  17099. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  17100. // However, it is not slated for removal any time soon
  17101. jQuery.proxy = function( fn, context ) {
  17102. var tmp, args, proxy;
  17103. if ( typeof context === "string" ) {
  17104. tmp = fn[ context ];
  17105. context = fn;
  17106. fn = tmp;
  17107. }
  17108. // Quick check to determine if target is callable, in the spec
  17109. // this throws a TypeError, but we will just return undefined.
  17110. if ( !isFunction( fn ) ) {
  17111. return undefined;
  17112. }
  17113. // Simulated bind
  17114. args = slice.call( arguments, 2 );
  17115. proxy = function() {
  17116. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  17117. };
  17118. // Set the guid of unique handler to the same of original handler, so it can be removed
  17119. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  17120. return proxy;
  17121. };
  17122. jQuery.holdReady = function( hold ) {
  17123. if ( hold ) {
  17124. jQuery.readyWait++;
  17125. } else {
  17126. jQuery.ready( true );
  17127. }
  17128. };
  17129. jQuery.isArray = Array.isArray;
  17130. jQuery.parseJSON = JSON.parse;
  17131. jQuery.nodeName = nodeName;
  17132. jQuery.isFunction = isFunction;
  17133. jQuery.isWindow = isWindow;
  17134. jQuery.camelCase = camelCase;
  17135. jQuery.type = toType;
  17136. jQuery.now = Date.now;
  17137. jQuery.isNumeric = function( obj ) {
  17138. // As of jQuery 3.0, isNumeric is limited to
  17139. // strings and numbers (primitives or objects)
  17140. // that can be coerced to finite numbers (gh-2662)
  17141. var type = jQuery.type( obj );
  17142. return ( type === "number" || type === "string" ) &&
  17143. // parseFloat NaNs numeric-cast false positives ("")
  17144. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  17145. // subtraction forces infinities to NaN
  17146. !isNaN( obj - parseFloat( obj ) );
  17147. };
  17148. // Register as a named AMD module, since jQuery can be concatenated with other
  17149. // files that may use define, but not via a proper concatenation script that
  17150. // understands anonymous AMD modules. A named AMD is safest and most robust
  17151. // way to register. Lowercase jquery is used because AMD module names are
  17152. // derived from file names, and jQuery is normally delivered in a lowercase
  17153. // file name. Do this after creating the global so that if an AMD module wants
  17154. // to call noConflict to hide this version of jQuery, it will work.
  17155. // Note that for maximum portability, libraries that are not jQuery should
  17156. // declare themselves as anonymous modules, and avoid setting a global if an
  17157. // AMD loader is present. jQuery is a special case. For more information, see
  17158. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  17159. if ( true ) {
  17160. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  17161. return jQuery;
  17162. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  17163. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17164. }
  17165. var
  17166. // Map over jQuery in case of overwrite
  17167. _jQuery = window.jQuery,
  17168. // Map over the $ in case of overwrite
  17169. _$ = window.$;
  17170. jQuery.noConflict = function( deep ) {
  17171. if ( window.$ === jQuery ) {
  17172. window.$ = _$;
  17173. }
  17174. if ( deep && window.jQuery === jQuery ) {
  17175. window.jQuery = _jQuery;
  17176. }
  17177. return jQuery;
  17178. };
  17179. // Expose jQuery and $ identifiers, even in AMD
  17180. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  17181. // and CommonJS for browser emulators (#13566)
  17182. if ( !noGlobal ) {
  17183. window.jQuery = window.$ = jQuery;
  17184. }
  17185. return jQuery;
  17186. } );
  17187. /***/ }),
  17188. /***/ "./node_modules/laravel-echo/dist/echo.js":
  17189. /*!************************************************!*\
  17190. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  17191. \************************************************/
  17192. /*! exports provided: default */
  17193. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  17194. "use strict";
  17195. __webpack_require__.r(__webpack_exports__);
  17196. var classCallCheck = function (instance, Constructor) {
  17197. if (!(instance instanceof Constructor)) {
  17198. throw new TypeError("Cannot call a class as a function");
  17199. }
  17200. };
  17201. var createClass = function () {
  17202. function defineProperties(target, props) {
  17203. for (var i = 0; i < props.length; i++) {
  17204. var descriptor = props[i];
  17205. descriptor.enumerable = descriptor.enumerable || false;
  17206. descriptor.configurable = true;
  17207. if ("value" in descriptor) descriptor.writable = true;
  17208. Object.defineProperty(target, descriptor.key, descriptor);
  17209. }
  17210. }
  17211. return function (Constructor, protoProps, staticProps) {
  17212. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  17213. if (staticProps) defineProperties(Constructor, staticProps);
  17214. return Constructor;
  17215. };
  17216. }();
  17217. var _extends = Object.assign || function (target) {
  17218. for (var i = 1; i < arguments.length; i++) {
  17219. var source = arguments[i];
  17220. for (var key in source) {
  17221. if (Object.prototype.hasOwnProperty.call(source, key)) {
  17222. target[key] = source[key];
  17223. }
  17224. }
  17225. }
  17226. return target;
  17227. };
  17228. var inherits = function (subClass, superClass) {
  17229. if (typeof superClass !== "function" && superClass !== null) {
  17230. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  17231. }
  17232. subClass.prototype = Object.create(superClass && superClass.prototype, {
  17233. constructor: {
  17234. value: subClass,
  17235. enumerable: false,
  17236. writable: true,
  17237. configurable: true
  17238. }
  17239. });
  17240. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  17241. };
  17242. var possibleConstructorReturn = function (self, call) {
  17243. if (!self) {
  17244. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  17245. }
  17246. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  17247. };
  17248. var Connector = function () {
  17249. /**
  17250. * Create a new class instance.
  17251. */
  17252. function Connector(options) {
  17253. classCallCheck(this, Connector);
  17254. /**
  17255. * Default connector options.
  17256. */
  17257. this._defaultOptions = {
  17258. auth: {
  17259. headers: {}
  17260. },
  17261. authEndpoint: '/broadcasting/auth',
  17262. broadcaster: 'pusher',
  17263. csrfToken: null,
  17264. host: null,
  17265. key: null,
  17266. namespace: 'App.Events'
  17267. };
  17268. this.setOptions(options);
  17269. this.connect();
  17270. }
  17271. /**
  17272. * Merge the custom options with the defaults.
  17273. */
  17274. createClass(Connector, [{
  17275. key: 'setOptions',
  17276. value: function setOptions(options) {
  17277. this.options = _extends(this._defaultOptions, options);
  17278. if (this.csrfToken()) {
  17279. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  17280. }
  17281. return options;
  17282. }
  17283. /**
  17284. * Extract the CSRF token from the page.
  17285. */
  17286. }, {
  17287. key: 'csrfToken',
  17288. value: function csrfToken() {
  17289. var selector = void 0;
  17290. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  17291. return window['Laravel'].csrfToken;
  17292. } else if (this.options.csrfToken) {
  17293. return this.options.csrfToken;
  17294. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  17295. return selector.getAttribute('content');
  17296. }
  17297. return null;
  17298. }
  17299. }]);
  17300. return Connector;
  17301. }();
  17302. /**
  17303. * This class represents a basic channel.
  17304. */
  17305. var Channel = function () {
  17306. function Channel() {
  17307. classCallCheck(this, Channel);
  17308. }
  17309. createClass(Channel, [{
  17310. key: 'listenForWhisper',
  17311. /**
  17312. * Listen for a whisper event on the channel instance.
  17313. */
  17314. value: function listenForWhisper(event, callback) {
  17315. return this.listen('.client-' + event, callback);
  17316. }
  17317. /**
  17318. * Listen for an event on the channel instance.
  17319. */
  17320. }, {
  17321. key: 'notification',
  17322. value: function notification(callback) {
  17323. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  17324. }
  17325. /**
  17326. * Stop listening for a whispser event on the channel instance.
  17327. */
  17328. }, {
  17329. key: 'stopListeningForWhisper',
  17330. value: function stopListeningForWhisper(event) {
  17331. return this.stopListening('.client-' + event);
  17332. }
  17333. }]);
  17334. return Channel;
  17335. }();
  17336. /**
  17337. * Event name formatter
  17338. */
  17339. var EventFormatter = function () {
  17340. /**
  17341. * Create a new class instance.
  17342. */
  17343. function EventFormatter(namespace) {
  17344. classCallCheck(this, EventFormatter);
  17345. this.setNamespace(namespace);
  17346. }
  17347. /**
  17348. * Format the given event name.
  17349. */
  17350. createClass(EventFormatter, [{
  17351. key: 'format',
  17352. value: function format(event) {
  17353. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  17354. return event.substr(1);
  17355. } else if (this.namespace) {
  17356. event = this.namespace + '.' + event;
  17357. }
  17358. return event.replace(/\./g, '\\');
  17359. }
  17360. /**
  17361. * Set the event namespace.
  17362. */
  17363. }, {
  17364. key: 'setNamespace',
  17365. value: function setNamespace(value) {
  17366. this.namespace = value;
  17367. }
  17368. }]);
  17369. return EventFormatter;
  17370. }();
  17371. /**
  17372. * This class represents a Pusher channel.
  17373. */
  17374. var PusherChannel = function (_Channel) {
  17375. inherits(PusherChannel, _Channel);
  17376. /**
  17377. * Create a new class instance.
  17378. */
  17379. function PusherChannel(pusher, name, options) {
  17380. classCallCheck(this, PusherChannel);
  17381. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  17382. _this.name = name;
  17383. _this.pusher = pusher;
  17384. _this.options = options;
  17385. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17386. _this.subscribe();
  17387. return _this;
  17388. }
  17389. /**
  17390. * Subscribe to a Pusher channel.
  17391. */
  17392. createClass(PusherChannel, [{
  17393. key: 'subscribe',
  17394. value: function subscribe() {
  17395. this.subscription = this.pusher.subscribe(this.name);
  17396. }
  17397. /**
  17398. * Unsubscribe from a Pusher channel.
  17399. */
  17400. }, {
  17401. key: 'unsubscribe',
  17402. value: function unsubscribe() {
  17403. this.pusher.unsubscribe(this.name);
  17404. }
  17405. /**
  17406. * Listen for an event on the channel instance.
  17407. */
  17408. }, {
  17409. key: 'listen',
  17410. value: function listen(event, callback) {
  17411. this.on(this.eventFormatter.format(event), callback);
  17412. return this;
  17413. }
  17414. /**
  17415. * Stop listening for an event on the channel instance.
  17416. */
  17417. }, {
  17418. key: 'stopListening',
  17419. value: function stopListening(event) {
  17420. this.subscription.unbind(this.eventFormatter.format(event));
  17421. return this;
  17422. }
  17423. /**
  17424. * Bind a channel to an event.
  17425. */
  17426. }, {
  17427. key: 'on',
  17428. value: function on(event, callback) {
  17429. this.subscription.bind(event, callback);
  17430. return this;
  17431. }
  17432. }]);
  17433. return PusherChannel;
  17434. }(Channel);
  17435. /**
  17436. * This class represents a Pusher private channel.
  17437. */
  17438. var PusherPrivateChannel = function (_PusherChannel) {
  17439. inherits(PusherPrivateChannel, _PusherChannel);
  17440. function PusherPrivateChannel() {
  17441. classCallCheck(this, PusherPrivateChannel);
  17442. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  17443. }
  17444. createClass(PusherPrivateChannel, [{
  17445. key: 'whisper',
  17446. /**
  17447. * Trigger client event on the channel.
  17448. */
  17449. value: function whisper(eventName, data) {
  17450. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17451. return this;
  17452. }
  17453. }]);
  17454. return PusherPrivateChannel;
  17455. }(PusherChannel);
  17456. /**
  17457. * This class represents a Pusher presence channel.
  17458. */
  17459. var PusherPresenceChannel = function (_PusherChannel) {
  17460. inherits(PusherPresenceChannel, _PusherChannel);
  17461. function PusherPresenceChannel() {
  17462. classCallCheck(this, PusherPresenceChannel);
  17463. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  17464. }
  17465. createClass(PusherPresenceChannel, [{
  17466. key: 'here',
  17467. /**
  17468. * Register a callback to be called anytime the member list changes.
  17469. */
  17470. value: function here(callback) {
  17471. this.on('pusher:subscription_succeeded', function (data) {
  17472. callback(Object.keys(data.members).map(function (k) {
  17473. return data.members[k];
  17474. }));
  17475. });
  17476. return this;
  17477. }
  17478. /**
  17479. * Listen for someone joining the channel.
  17480. */
  17481. }, {
  17482. key: 'joining',
  17483. value: function joining(callback) {
  17484. this.on('pusher:member_added', function (member) {
  17485. callback(member.info);
  17486. });
  17487. return this;
  17488. }
  17489. /**
  17490. * Listen for someone leaving the channel.
  17491. */
  17492. }, {
  17493. key: 'leaving',
  17494. value: function leaving(callback) {
  17495. this.on('pusher:member_removed', function (member) {
  17496. callback(member.info);
  17497. });
  17498. return this;
  17499. }
  17500. /**
  17501. * Trigger client event on the channel.
  17502. */
  17503. }, {
  17504. key: 'whisper',
  17505. value: function whisper(eventName, data) {
  17506. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17507. return this;
  17508. }
  17509. }]);
  17510. return PusherPresenceChannel;
  17511. }(PusherChannel);
  17512. /**
  17513. * This class represents a Socket.io channel.
  17514. */
  17515. var SocketIoChannel = function (_Channel) {
  17516. inherits(SocketIoChannel, _Channel);
  17517. /**
  17518. * Create a new class instance.
  17519. */
  17520. function SocketIoChannel(socket, name, options) {
  17521. classCallCheck(this, SocketIoChannel);
  17522. /**
  17523. * The event callbacks applied to the channel.
  17524. */
  17525. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  17526. _this.events = {};
  17527. _this.name = name;
  17528. _this.socket = socket;
  17529. _this.options = options;
  17530. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17531. _this.subscribe();
  17532. _this.configureReconnector();
  17533. return _this;
  17534. }
  17535. /**
  17536. * Subscribe to a Socket.io channel.
  17537. */
  17538. createClass(SocketIoChannel, [{
  17539. key: 'subscribe',
  17540. value: function subscribe() {
  17541. this.socket.emit('subscribe', {
  17542. channel: this.name,
  17543. auth: this.options.auth || {}
  17544. });
  17545. }
  17546. /**
  17547. * Unsubscribe from channel and ubind event callbacks.
  17548. */
  17549. }, {
  17550. key: 'unsubscribe',
  17551. value: function unsubscribe() {
  17552. this.unbind();
  17553. this.socket.emit('unsubscribe', {
  17554. channel: this.name,
  17555. auth: this.options.auth || {}
  17556. });
  17557. }
  17558. /**
  17559. * Listen for an event on the channel instance.
  17560. */
  17561. }, {
  17562. key: 'listen',
  17563. value: function listen(event, callback) {
  17564. this.on(this.eventFormatter.format(event), callback);
  17565. return this;
  17566. }
  17567. /**
  17568. * Stop listening for an event on the channel instance.
  17569. */
  17570. }, {
  17571. key: 'stopListening',
  17572. value: function stopListening(event) {
  17573. var name = this.eventFormatter.format(event);
  17574. this.socket.removeListener(name);
  17575. delete this.events[name];
  17576. return this;
  17577. }
  17578. /**
  17579. * Bind the channel's socket to an event and store the callback.
  17580. */
  17581. }, {
  17582. key: 'on',
  17583. value: function on(event, callback) {
  17584. var _this2 = this;
  17585. var listener = function listener(channel, data) {
  17586. if (_this2.name == channel) {
  17587. callback(data);
  17588. }
  17589. };
  17590. this.socket.on(event, listener);
  17591. this.bind(event, listener);
  17592. }
  17593. /**
  17594. * Attach a 'reconnect' listener and bind the event.
  17595. */
  17596. }, {
  17597. key: 'configureReconnector',
  17598. value: function configureReconnector() {
  17599. var _this3 = this;
  17600. var listener = function listener() {
  17601. _this3.subscribe();
  17602. };
  17603. this.socket.on('reconnect', listener);
  17604. this.bind('reconnect', listener);
  17605. }
  17606. /**
  17607. * Bind the channel's socket to an event and store the callback.
  17608. */
  17609. }, {
  17610. key: 'bind',
  17611. value: function bind(event, callback) {
  17612. this.events[event] = this.events[event] || [];
  17613. this.events[event].push(callback);
  17614. }
  17615. /**
  17616. * Unbind the channel's socket from all stored event callbacks.
  17617. */
  17618. }, {
  17619. key: 'unbind',
  17620. value: function unbind() {
  17621. var _this4 = this;
  17622. Object.keys(this.events).forEach(function (event) {
  17623. _this4.events[event].forEach(function (callback) {
  17624. _this4.socket.removeListener(event, callback);
  17625. });
  17626. delete _this4.events[event];
  17627. });
  17628. }
  17629. }]);
  17630. return SocketIoChannel;
  17631. }(Channel);
  17632. /**
  17633. * This class represents a Socket.io presence channel.
  17634. */
  17635. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  17636. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  17637. function SocketIoPrivateChannel() {
  17638. classCallCheck(this, SocketIoPrivateChannel);
  17639. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  17640. }
  17641. createClass(SocketIoPrivateChannel, [{
  17642. key: 'whisper',
  17643. /**
  17644. * Trigger client event on the channel.
  17645. */
  17646. value: function whisper(eventName, data) {
  17647. this.socket.emit('client event', {
  17648. channel: this.name,
  17649. event: 'client-' + eventName,
  17650. data: data
  17651. });
  17652. return this;
  17653. }
  17654. }]);
  17655. return SocketIoPrivateChannel;
  17656. }(SocketIoChannel);
  17657. /**
  17658. * This class represents a Socket.io presence channel.
  17659. */
  17660. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  17661. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  17662. function SocketIoPresenceChannel() {
  17663. classCallCheck(this, SocketIoPresenceChannel);
  17664. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  17665. }
  17666. createClass(SocketIoPresenceChannel, [{
  17667. key: 'here',
  17668. /**
  17669. * Register a callback to be called anytime the member list changes.
  17670. */
  17671. value: function here(callback) {
  17672. this.on('presence:subscribed', function (members) {
  17673. callback(members.map(function (m) {
  17674. return m.user_info;
  17675. }));
  17676. });
  17677. return this;
  17678. }
  17679. /**
  17680. * Listen for someone joining the channel.
  17681. */
  17682. }, {
  17683. key: 'joining',
  17684. value: function joining(callback) {
  17685. this.on('presence:joining', function (member) {
  17686. return callback(member.user_info);
  17687. });
  17688. return this;
  17689. }
  17690. /**
  17691. * Listen for someone leaving the channel.
  17692. */
  17693. }, {
  17694. key: 'leaving',
  17695. value: function leaving(callback) {
  17696. this.on('presence:leaving', function (member) {
  17697. return callback(member.user_info);
  17698. });
  17699. return this;
  17700. }
  17701. }]);
  17702. return SocketIoPresenceChannel;
  17703. }(SocketIoPrivateChannel);
  17704. /**
  17705. * This class represents a null channel.
  17706. */
  17707. var NullChannel = function (_Channel) {
  17708. inherits(NullChannel, _Channel);
  17709. function NullChannel() {
  17710. classCallCheck(this, NullChannel);
  17711. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  17712. }
  17713. createClass(NullChannel, [{
  17714. key: 'subscribe',
  17715. /**
  17716. * Subscribe to a channel.
  17717. */
  17718. value: function subscribe() {}
  17719. //
  17720. /**
  17721. * Unsubscribe from a channel.
  17722. */
  17723. }, {
  17724. key: 'unsubscribe',
  17725. value: function unsubscribe() {}
  17726. //
  17727. /**
  17728. * Listen for an event on the channel instance.
  17729. */
  17730. }, {
  17731. key: 'listen',
  17732. value: function listen(event, callback) {
  17733. return this;
  17734. }
  17735. /**
  17736. * Stop listening for an event on the channel instance.
  17737. */
  17738. }, {
  17739. key: 'stopListening',
  17740. value: function stopListening(event) {
  17741. return this;
  17742. }
  17743. /**
  17744. * Bind a channel to an event.
  17745. */
  17746. }, {
  17747. key: 'on',
  17748. value: function on(event, callback) {
  17749. return this;
  17750. }
  17751. }]);
  17752. return NullChannel;
  17753. }(Channel);
  17754. /**
  17755. * This class represents a null private channel.
  17756. */
  17757. var NullPrivateChannel = function (_NullChannel) {
  17758. inherits(NullPrivateChannel, _NullChannel);
  17759. function NullPrivateChannel() {
  17760. classCallCheck(this, NullPrivateChannel);
  17761. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  17762. }
  17763. createClass(NullPrivateChannel, [{
  17764. key: 'whisper',
  17765. /**
  17766. * Trigger client event on the channel.
  17767. */
  17768. value: function whisper(eventName, data) {
  17769. return this;
  17770. }
  17771. }]);
  17772. return NullPrivateChannel;
  17773. }(NullChannel);
  17774. /**
  17775. * This class represents a null presence channel.
  17776. */
  17777. var NullPresenceChannel = function (_NullChannel) {
  17778. inherits(NullPresenceChannel, _NullChannel);
  17779. function NullPresenceChannel() {
  17780. classCallCheck(this, NullPresenceChannel);
  17781. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  17782. }
  17783. createClass(NullPresenceChannel, [{
  17784. key: 'here',
  17785. /**
  17786. * Register a callback to be called anytime the member list changes.
  17787. */
  17788. value: function here(callback) {
  17789. return this;
  17790. }
  17791. /**
  17792. * Listen for someone joining the channel.
  17793. */
  17794. }, {
  17795. key: 'joining',
  17796. value: function joining(callback) {
  17797. return this;
  17798. }
  17799. /**
  17800. * Listen for someone leaving the channel.
  17801. */
  17802. }, {
  17803. key: 'leaving',
  17804. value: function leaving(callback) {
  17805. return this;
  17806. }
  17807. /**
  17808. * Trigger client event on the channel.
  17809. */
  17810. }, {
  17811. key: 'whisper',
  17812. value: function whisper(eventName, data) {
  17813. return this;
  17814. }
  17815. }]);
  17816. return NullPresenceChannel;
  17817. }(NullChannel);
  17818. /**
  17819. * This class creates a connector to Pusher.
  17820. */
  17821. var PusherConnector = function (_Connector) {
  17822. inherits(PusherConnector, _Connector);
  17823. function PusherConnector() {
  17824. classCallCheck(this, PusherConnector);
  17825. /**
  17826. * All of the subscribed channel names.
  17827. */
  17828. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  17829. _this.channels = {};
  17830. return _this;
  17831. }
  17832. /**
  17833. * Create a fresh Pusher connection.
  17834. */
  17835. createClass(PusherConnector, [{
  17836. key: 'connect',
  17837. value: function connect() {
  17838. if (typeof this.options.client !== 'undefined') {
  17839. this.pusher = this.options.client;
  17840. } else {
  17841. this.pusher = new Pusher(this.options.key, this.options);
  17842. }
  17843. }
  17844. /**
  17845. * Listen for an event on a channel instance.
  17846. */
  17847. }, {
  17848. key: 'listen',
  17849. value: function listen(name, event, callback) {
  17850. return this.channel(name).listen(event, callback);
  17851. }
  17852. /**
  17853. * Get a channel instance by name.
  17854. */
  17855. }, {
  17856. key: 'channel',
  17857. value: function channel(name) {
  17858. if (!this.channels[name]) {
  17859. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  17860. }
  17861. return this.channels[name];
  17862. }
  17863. /**
  17864. * Get a private channel instance by name.
  17865. */
  17866. }, {
  17867. key: 'privateChannel',
  17868. value: function privateChannel(name) {
  17869. if (!this.channels['private-' + name]) {
  17870. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  17871. }
  17872. return this.channels['private-' + name];
  17873. }
  17874. /**
  17875. * Get a presence channel instance by name.
  17876. */
  17877. }, {
  17878. key: 'presenceChannel',
  17879. value: function presenceChannel(name) {
  17880. if (!this.channels['presence-' + name]) {
  17881. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  17882. }
  17883. return this.channels['presence-' + name];
  17884. }
  17885. /**
  17886. * Leave the given channel, as well as its private and presence variants.
  17887. */
  17888. }, {
  17889. key: 'leave',
  17890. value: function leave(name) {
  17891. var _this2 = this;
  17892. var channels = [name, 'private-' + name, 'presence-' + name];
  17893. channels.forEach(function (name, index) {
  17894. _this2.leaveChannel(name);
  17895. });
  17896. }
  17897. /**
  17898. * Leave the given channel.
  17899. */
  17900. }, {
  17901. key: 'leaveChannel',
  17902. value: function leaveChannel(name) {
  17903. if (this.channels[name]) {
  17904. this.channels[name].unsubscribe();
  17905. delete this.channels[name];
  17906. }
  17907. }
  17908. /**
  17909. * Get the socket ID for the connection.
  17910. */
  17911. }, {
  17912. key: 'socketId',
  17913. value: function socketId() {
  17914. return this.pusher.connection.socket_id;
  17915. }
  17916. /**
  17917. * Disconnect Pusher connection.
  17918. */
  17919. }, {
  17920. key: 'disconnect',
  17921. value: function disconnect() {
  17922. this.pusher.disconnect();
  17923. }
  17924. }]);
  17925. return PusherConnector;
  17926. }(Connector);
  17927. /**
  17928. * This class creates a connnector to a Socket.io server.
  17929. */
  17930. var SocketIoConnector = function (_Connector) {
  17931. inherits(SocketIoConnector, _Connector);
  17932. function SocketIoConnector() {
  17933. classCallCheck(this, SocketIoConnector);
  17934. /**
  17935. * All of the subscribed channel names.
  17936. */
  17937. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  17938. _this.channels = {};
  17939. return _this;
  17940. }
  17941. /**
  17942. * Create a fresh Socket.io connection.
  17943. */
  17944. createClass(SocketIoConnector, [{
  17945. key: 'connect',
  17946. value: function connect() {
  17947. var io = this.getSocketIO();
  17948. this.socket = io(this.options.host, this.options);
  17949. return this.socket;
  17950. }
  17951. /**
  17952. * Get socket.io module from global scope or options.
  17953. */
  17954. }, {
  17955. key: 'getSocketIO',
  17956. value: function getSocketIO() {
  17957. if (typeof this.options.client !== 'undefined') {
  17958. return this.options.client;
  17959. }
  17960. if (typeof io !== 'undefined') {
  17961. return io;
  17962. }
  17963. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  17964. }
  17965. /**
  17966. * Listen for an event on a channel instance.
  17967. */
  17968. }, {
  17969. key: 'listen',
  17970. value: function listen(name, event, callback) {
  17971. return this.channel(name).listen(event, callback);
  17972. }
  17973. /**
  17974. * Get a channel instance by name.
  17975. */
  17976. }, {
  17977. key: 'channel',
  17978. value: function channel(name) {
  17979. if (!this.channels[name]) {
  17980. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  17981. }
  17982. return this.channels[name];
  17983. }
  17984. /**
  17985. * Get a private channel instance by name.
  17986. */
  17987. }, {
  17988. key: 'privateChannel',
  17989. value: function privateChannel(name) {
  17990. if (!this.channels['private-' + name]) {
  17991. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  17992. }
  17993. return this.channels['private-' + name];
  17994. }
  17995. /**
  17996. * Get a presence channel instance by name.
  17997. */
  17998. }, {
  17999. key: 'presenceChannel',
  18000. value: function presenceChannel(name) {
  18001. if (!this.channels['presence-' + name]) {
  18002. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  18003. }
  18004. return this.channels['presence-' + name];
  18005. }
  18006. /**
  18007. * Leave the given channel, as well as its private and presence variants.
  18008. */
  18009. }, {
  18010. key: 'leave',
  18011. value: function leave(name) {
  18012. var _this2 = this;
  18013. var channels = [name, 'private-' + name, 'presence-' + name];
  18014. channels.forEach(function (name) {
  18015. _this2.leaveChannel(name);
  18016. });
  18017. }
  18018. /**
  18019. * Leave the given channel.
  18020. */
  18021. }, {
  18022. key: 'leaveChannel',
  18023. value: function leaveChannel(name) {
  18024. if (this.channels[name]) {
  18025. this.channels[name].unsubscribe();
  18026. delete this.channels[name];
  18027. }
  18028. }
  18029. /**
  18030. * Get the socket ID for the connection.
  18031. */
  18032. }, {
  18033. key: 'socketId',
  18034. value: function socketId() {
  18035. return this.socket.id;
  18036. }
  18037. /**
  18038. * Disconnect Socketio connection.
  18039. */
  18040. }, {
  18041. key: 'disconnect',
  18042. value: function disconnect() {
  18043. this.socket.disconnect();
  18044. }
  18045. }]);
  18046. return SocketIoConnector;
  18047. }(Connector);
  18048. /**
  18049. * This class creates a null connector.
  18050. */
  18051. var NullConnector = function (_Connector) {
  18052. inherits(NullConnector, _Connector);
  18053. function NullConnector() {
  18054. classCallCheck(this, NullConnector);
  18055. /**
  18056. * All of the subscribed channel names.
  18057. */
  18058. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  18059. _this.channels = {};
  18060. return _this;
  18061. }
  18062. /**
  18063. * Create a fresh connection.
  18064. */
  18065. createClass(NullConnector, [{
  18066. key: 'connect',
  18067. value: function connect() {}
  18068. //
  18069. /**
  18070. * Listen for an event on a channel instance.
  18071. */
  18072. }, {
  18073. key: 'listen',
  18074. value: function listen(name, event, callback) {
  18075. return new NullChannel();
  18076. }
  18077. /**
  18078. * Get a channel instance by name.
  18079. */
  18080. }, {
  18081. key: 'channel',
  18082. value: function channel(name) {
  18083. return new NullChannel();
  18084. }
  18085. /**
  18086. * Get a private channel instance by name.
  18087. */
  18088. }, {
  18089. key: 'privateChannel',
  18090. value: function privateChannel(name) {
  18091. return new NullPrivateChannel();
  18092. }
  18093. /**
  18094. * Get a presence channel instance by name.
  18095. */
  18096. }, {
  18097. key: 'presenceChannel',
  18098. value: function presenceChannel(name) {
  18099. return new NullPresenceChannel();
  18100. }
  18101. /**
  18102. * Leave the given channel, as well as its private and presence variants.
  18103. */
  18104. }, {
  18105. key: 'leave',
  18106. value: function leave(name) {}
  18107. //
  18108. /**
  18109. * Leave the given channel.
  18110. */
  18111. }, {
  18112. key: 'leaveChannel',
  18113. value: function leaveChannel(name) {}
  18114. //
  18115. /**
  18116. * Get the socket ID for the connection.
  18117. */
  18118. }, {
  18119. key: 'socketId',
  18120. value: function socketId() {
  18121. return 'fake-socket-id';
  18122. }
  18123. /**
  18124. * Disconnect the connection.
  18125. */
  18126. }, {
  18127. key: 'disconnect',
  18128. value: function disconnect() {
  18129. //
  18130. }
  18131. }]);
  18132. return NullConnector;
  18133. }(Connector);
  18134. /**
  18135. * This class is the primary API for interacting with broadcasting.
  18136. */
  18137. var Echo = function () {
  18138. /**
  18139. * Create a new class instance.
  18140. */
  18141. function Echo(options) {
  18142. classCallCheck(this, Echo);
  18143. this.options = options;
  18144. this.connect();
  18145. if (!this.options.withoutInterceptors) {
  18146. this.registerInterceptors();
  18147. }
  18148. }
  18149. /**
  18150. * Get a channel instance by name.
  18151. */
  18152. createClass(Echo, [{
  18153. key: 'channel',
  18154. value: function channel(_channel) {
  18155. return this.connector.channel(_channel);
  18156. }
  18157. /**
  18158. * Create a new connection.
  18159. */
  18160. }, {
  18161. key: 'connect',
  18162. value: function connect() {
  18163. if (this.options.broadcaster == 'pusher') {
  18164. this.connector = new PusherConnector(this.options);
  18165. } else if (this.options.broadcaster == 'socket.io') {
  18166. this.connector = new SocketIoConnector(this.options);
  18167. } else if (this.options.broadcaster == 'null') {
  18168. this.connector = new NullConnector(this.options);
  18169. } else if (typeof this.options.broadcaster == 'function') {
  18170. this.connector = new this.options.broadcaster(this.options);
  18171. }
  18172. }
  18173. /**
  18174. * Disconnect from the Echo server.
  18175. */
  18176. }, {
  18177. key: 'disconnect',
  18178. value: function disconnect() {
  18179. this.connector.disconnect();
  18180. }
  18181. /**
  18182. * Get a presence channel instance by name.
  18183. */
  18184. }, {
  18185. key: 'join',
  18186. value: function join(channel) {
  18187. return this.connector.presenceChannel(channel);
  18188. }
  18189. /**
  18190. * Leave the given channel, as well as its private and presence variants.
  18191. */
  18192. }, {
  18193. key: 'leave',
  18194. value: function leave(channel) {
  18195. this.connector.leave(channel);
  18196. }
  18197. /**
  18198. * Leave the given channel.
  18199. */
  18200. }, {
  18201. key: 'leaveChannel',
  18202. value: function leaveChannel(channel) {
  18203. this.connector.leaveChannel(channel);
  18204. }
  18205. /**
  18206. * Listen for an event on a channel instance.
  18207. */
  18208. }, {
  18209. key: 'listen',
  18210. value: function listen(channel, event, callback) {
  18211. return this.connector.listen(channel, event, callback);
  18212. }
  18213. /**
  18214. * Get a private channel instance by name.
  18215. */
  18216. }, {
  18217. key: 'private',
  18218. value: function _private(channel) {
  18219. return this.connector.privateChannel(channel);
  18220. }
  18221. /**
  18222. * Get the Socket ID for the connection.
  18223. */
  18224. }, {
  18225. key: 'socketId',
  18226. value: function socketId() {
  18227. return this.connector.socketId();
  18228. }
  18229. /**
  18230. * Register 3rd party request interceptiors. These are used to automatically
  18231. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  18232. */
  18233. }, {
  18234. key: 'registerInterceptors',
  18235. value: function registerInterceptors() {
  18236. if (typeof Vue === 'function' && Vue.http) {
  18237. this.registerVueRequestInterceptor();
  18238. }
  18239. if (typeof axios === 'function') {
  18240. this.registerAxiosRequestInterceptor();
  18241. }
  18242. if (typeof jQuery === 'function') {
  18243. this.registerjQueryAjaxSetup();
  18244. }
  18245. }
  18246. /**
  18247. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  18248. */
  18249. }, {
  18250. key: 'registerVueRequestInterceptor',
  18251. value: function registerVueRequestInterceptor() {
  18252. var _this = this;
  18253. Vue.http.interceptors.push(function (request, next) {
  18254. if (_this.socketId()) {
  18255. request.headers.set('X-Socket-ID', _this.socketId());
  18256. }
  18257. next();
  18258. });
  18259. }
  18260. /**
  18261. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  18262. */
  18263. }, {
  18264. key: 'registerAxiosRequestInterceptor',
  18265. value: function registerAxiosRequestInterceptor() {
  18266. var _this2 = this;
  18267. axios.interceptors.request.use(function (config) {
  18268. if (_this2.socketId()) {
  18269. config.headers['X-Socket-Id'] = _this2.socketId();
  18270. }
  18271. return config;
  18272. });
  18273. }
  18274. /**
  18275. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  18276. */
  18277. }, {
  18278. key: 'registerjQueryAjaxSetup',
  18279. value: function registerjQueryAjaxSetup() {
  18280. var _this3 = this;
  18281. if (typeof jQuery.ajax != 'undefined') {
  18282. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  18283. if (_this3.socketId()) {
  18284. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  18285. }
  18286. });
  18287. }
  18288. }
  18289. }]);
  18290. return Echo;
  18291. }();
  18292. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  18293. /***/ }),
  18294. /***/ "./node_modules/lodash/lodash.js":
  18295. /*!***************************************!*\
  18296. !*** ./node_modules/lodash/lodash.js ***!
  18297. \***************************************/
  18298. /*! no static exports found */
  18299. /***/ (function(module, exports, __webpack_require__) {
  18300. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  18301. * @license
  18302. * Lodash <https://lodash.com/>
  18303. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  18304. * Released under MIT license <https://lodash.com/license>
  18305. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  18306. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  18307. */
  18308. ;(function() {
  18309. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  18310. var undefined;
  18311. /** Used as the semantic version number. */
  18312. var VERSION = '4.17.15';
  18313. /** Used as the size to enable large array optimizations. */
  18314. var LARGE_ARRAY_SIZE = 200;
  18315. /** Error message constants. */
  18316. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  18317. FUNC_ERROR_TEXT = 'Expected a function';
  18318. /** Used to stand-in for `undefined` hash values. */
  18319. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  18320. /** Used as the maximum memoize cache size. */
  18321. var MAX_MEMOIZE_SIZE = 500;
  18322. /** Used as the internal argument placeholder. */
  18323. var PLACEHOLDER = '__lodash_placeholder__';
  18324. /** Used to compose bitmasks for cloning. */
  18325. var CLONE_DEEP_FLAG = 1,
  18326. CLONE_FLAT_FLAG = 2,
  18327. CLONE_SYMBOLS_FLAG = 4;
  18328. /** Used to compose bitmasks for value comparisons. */
  18329. var COMPARE_PARTIAL_FLAG = 1,
  18330. COMPARE_UNORDERED_FLAG = 2;
  18331. /** Used to compose bitmasks for function metadata. */
  18332. var WRAP_BIND_FLAG = 1,
  18333. WRAP_BIND_KEY_FLAG = 2,
  18334. WRAP_CURRY_BOUND_FLAG = 4,
  18335. WRAP_CURRY_FLAG = 8,
  18336. WRAP_CURRY_RIGHT_FLAG = 16,
  18337. WRAP_PARTIAL_FLAG = 32,
  18338. WRAP_PARTIAL_RIGHT_FLAG = 64,
  18339. WRAP_ARY_FLAG = 128,
  18340. WRAP_REARG_FLAG = 256,
  18341. WRAP_FLIP_FLAG = 512;
  18342. /** Used as default options for `_.truncate`. */
  18343. var DEFAULT_TRUNC_LENGTH = 30,
  18344. DEFAULT_TRUNC_OMISSION = '...';
  18345. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  18346. var HOT_COUNT = 800,
  18347. HOT_SPAN = 16;
  18348. /** Used to indicate the type of lazy iteratees. */
  18349. var LAZY_FILTER_FLAG = 1,
  18350. LAZY_MAP_FLAG = 2,
  18351. LAZY_WHILE_FLAG = 3;
  18352. /** Used as references for various `Number` constants. */
  18353. var INFINITY = 1 / 0,
  18354. MAX_SAFE_INTEGER = 9007199254740991,
  18355. MAX_INTEGER = 1.7976931348623157e+308,
  18356. NAN = 0 / 0;
  18357. /** Used as references for the maximum length and index of an array. */
  18358. var MAX_ARRAY_LENGTH = 4294967295,
  18359. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  18360. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  18361. /** Used to associate wrap methods with their bit flags. */
  18362. var wrapFlags = [
  18363. ['ary', WRAP_ARY_FLAG],
  18364. ['bind', WRAP_BIND_FLAG],
  18365. ['bindKey', WRAP_BIND_KEY_FLAG],
  18366. ['curry', WRAP_CURRY_FLAG],
  18367. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  18368. ['flip', WRAP_FLIP_FLAG],
  18369. ['partial', WRAP_PARTIAL_FLAG],
  18370. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  18371. ['rearg', WRAP_REARG_FLAG]
  18372. ];
  18373. /** `Object#toString` result references. */
  18374. var argsTag = '[object Arguments]',
  18375. arrayTag = '[object Array]',
  18376. asyncTag = '[object AsyncFunction]',
  18377. boolTag = '[object Boolean]',
  18378. dateTag = '[object Date]',
  18379. domExcTag = '[object DOMException]',
  18380. errorTag = '[object Error]',
  18381. funcTag = '[object Function]',
  18382. genTag = '[object GeneratorFunction]',
  18383. mapTag = '[object Map]',
  18384. numberTag = '[object Number]',
  18385. nullTag = '[object Null]',
  18386. objectTag = '[object Object]',
  18387. promiseTag = '[object Promise]',
  18388. proxyTag = '[object Proxy]',
  18389. regexpTag = '[object RegExp]',
  18390. setTag = '[object Set]',
  18391. stringTag = '[object String]',
  18392. symbolTag = '[object Symbol]',
  18393. undefinedTag = '[object Undefined]',
  18394. weakMapTag = '[object WeakMap]',
  18395. weakSetTag = '[object WeakSet]';
  18396. var arrayBufferTag = '[object ArrayBuffer]',
  18397. dataViewTag = '[object DataView]',
  18398. float32Tag = '[object Float32Array]',
  18399. float64Tag = '[object Float64Array]',
  18400. int8Tag = '[object Int8Array]',
  18401. int16Tag = '[object Int16Array]',
  18402. int32Tag = '[object Int32Array]',
  18403. uint8Tag = '[object Uint8Array]',
  18404. uint8ClampedTag = '[object Uint8ClampedArray]',
  18405. uint16Tag = '[object Uint16Array]',
  18406. uint32Tag = '[object Uint32Array]';
  18407. /** Used to match empty string literals in compiled template source. */
  18408. var reEmptyStringLeading = /\b__p \+= '';/g,
  18409. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  18410. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  18411. /** Used to match HTML entities and HTML characters. */
  18412. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  18413. reUnescapedHtml = /[&<>"']/g,
  18414. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  18415. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  18416. /** Used to match template delimiters. */
  18417. var reEscape = /<%-([\s\S]+?)%>/g,
  18418. reEvaluate = /<%([\s\S]+?)%>/g,
  18419. reInterpolate = /<%=([\s\S]+?)%>/g;
  18420. /** Used to match property names within property paths. */
  18421. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  18422. reIsPlainProp = /^\w*$/,
  18423. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  18424. /**
  18425. * Used to match `RegExp`
  18426. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  18427. */
  18428. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  18429. reHasRegExpChar = RegExp(reRegExpChar.source);
  18430. /** Used to match leading and trailing whitespace. */
  18431. var reTrim = /^\s+|\s+$/g,
  18432. reTrimStart = /^\s+/,
  18433. reTrimEnd = /\s+$/;
  18434. /** Used to match wrap detail comments. */
  18435. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  18436. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  18437. reSplitDetails = /,? & /;
  18438. /** Used to match words composed of alphanumeric characters. */
  18439. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  18440. /** Used to match backslashes in property paths. */
  18441. var reEscapeChar = /\\(\\)?/g;
  18442. /**
  18443. * Used to match
  18444. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  18445. */
  18446. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  18447. /** Used to match `RegExp` flags from their coerced string values. */
  18448. var reFlags = /\w*$/;
  18449. /** Used to detect bad signed hexadecimal string values. */
  18450. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  18451. /** Used to detect binary string values. */
  18452. var reIsBinary = /^0b[01]+$/i;
  18453. /** Used to detect host constructors (Safari). */
  18454. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  18455. /** Used to detect octal string values. */
  18456. var reIsOctal = /^0o[0-7]+$/i;
  18457. /** Used to detect unsigned integer values. */
  18458. var reIsUint = /^(?:0|[1-9]\d*)$/;
  18459. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  18460. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  18461. /** Used to ensure capturing order of template delimiters. */
  18462. var reNoMatch = /($^)/;
  18463. /** Used to match unescaped characters in compiled string literals. */
  18464. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  18465. /** Used to compose unicode character classes. */
  18466. var rsAstralRange = '\\ud800-\\udfff',
  18467. rsComboMarksRange = '\\u0300-\\u036f',
  18468. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  18469. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  18470. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  18471. rsDingbatRange = '\\u2700-\\u27bf',
  18472. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  18473. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  18474. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  18475. rsPunctuationRange = '\\u2000-\\u206f',
  18476. 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',
  18477. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  18478. rsVarRange = '\\ufe0e\\ufe0f',
  18479. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  18480. /** Used to compose unicode capture groups. */
  18481. var rsApos = "['\u2019]",
  18482. rsAstral = '[' + rsAstralRange + ']',
  18483. rsBreak = '[' + rsBreakRange + ']',
  18484. rsCombo = '[' + rsComboRange + ']',
  18485. rsDigits = '\\d+',
  18486. rsDingbat = '[' + rsDingbatRange + ']',
  18487. rsLower = '[' + rsLowerRange + ']',
  18488. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  18489. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  18490. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  18491. rsNonAstral = '[^' + rsAstralRange + ']',
  18492. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  18493. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  18494. rsUpper = '[' + rsUpperRange + ']',
  18495. rsZWJ = '\\u200d';
  18496. /** Used to compose unicode regexes. */
  18497. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  18498. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  18499. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  18500. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  18501. reOptMod = rsModifier + '?',
  18502. rsOptVar = '[' + rsVarRange + ']?',
  18503. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  18504. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  18505. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  18506. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  18507. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  18508. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  18509. /** Used to match apostrophes. */
  18510. var reApos = RegExp(rsApos, 'g');
  18511. /**
  18512. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  18513. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  18514. */
  18515. var reComboMark = RegExp(rsCombo, 'g');
  18516. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  18517. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  18518. /** Used to match complex or compound words. */
  18519. var reUnicodeWord = RegExp([
  18520. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  18521. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  18522. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  18523. rsUpper + '+' + rsOptContrUpper,
  18524. rsOrdUpper,
  18525. rsOrdLower,
  18526. rsDigits,
  18527. rsEmoji
  18528. ].join('|'), 'g');
  18529. /** 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/). */
  18530. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  18531. /** Used to detect strings that need a more robust regexp to match words. */
  18532. 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 ]/;
  18533. /** Used to assign default `context` object properties. */
  18534. var contextProps = [
  18535. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  18536. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  18537. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  18538. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  18539. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  18540. ];
  18541. /** Used to make template sourceURLs easier to identify. */
  18542. var templateCounter = -1;
  18543. /** Used to identify `toStringTag` values of typed arrays. */
  18544. var typedArrayTags = {};
  18545. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  18546. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  18547. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  18548. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  18549. typedArrayTags[uint32Tag] = true;
  18550. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  18551. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  18552. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  18553. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  18554. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  18555. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  18556. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  18557. typedArrayTags[weakMapTag] = false;
  18558. /** Used to identify `toStringTag` values supported by `_.clone`. */
  18559. var cloneableTags = {};
  18560. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  18561. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  18562. cloneableTags[boolTag] = cloneableTags[dateTag] =
  18563. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  18564. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  18565. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  18566. cloneableTags[numberTag] = cloneableTags[objectTag] =
  18567. cloneableTags[regexpTag] = cloneableTags[setTag] =
  18568. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  18569. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  18570. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  18571. cloneableTags[errorTag] = cloneableTags[funcTag] =
  18572. cloneableTags[weakMapTag] = false;
  18573. /** Used to map Latin Unicode letters to basic Latin letters. */
  18574. var deburredLetters = {
  18575. // Latin-1 Supplement block.
  18576. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  18577. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  18578. '\xc7': 'C', '\xe7': 'c',
  18579. '\xd0': 'D', '\xf0': 'd',
  18580. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  18581. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  18582. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  18583. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  18584. '\xd1': 'N', '\xf1': 'n',
  18585. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  18586. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  18587. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  18588. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  18589. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  18590. '\xc6': 'Ae', '\xe6': 'ae',
  18591. '\xde': 'Th', '\xfe': 'th',
  18592. '\xdf': 'ss',
  18593. // Latin Extended-A block.
  18594. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  18595. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  18596. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  18597. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  18598. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  18599. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  18600. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  18601. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  18602. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  18603. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  18604. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  18605. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  18606. '\u0134': 'J', '\u0135': 'j',
  18607. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  18608. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  18609. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  18610. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  18611. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  18612. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  18613. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  18614. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  18615. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  18616. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  18617. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  18618. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  18619. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  18620. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  18621. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  18622. '\u0174': 'W', '\u0175': 'w',
  18623. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  18624. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  18625. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  18626. '\u0132': 'IJ', '\u0133': 'ij',
  18627. '\u0152': 'Oe', '\u0153': 'oe',
  18628. '\u0149': "'n", '\u017f': 's'
  18629. };
  18630. /** Used to map characters to HTML entities. */
  18631. var htmlEscapes = {
  18632. '&': '&amp;',
  18633. '<': '&lt;',
  18634. '>': '&gt;',
  18635. '"': '&quot;',
  18636. "'": '&#39;'
  18637. };
  18638. /** Used to map HTML entities to characters. */
  18639. var htmlUnescapes = {
  18640. '&amp;': '&',
  18641. '&lt;': '<',
  18642. '&gt;': '>',
  18643. '&quot;': '"',
  18644. '&#39;': "'"
  18645. };
  18646. /** Used to escape characters for inclusion in compiled string literals. */
  18647. var stringEscapes = {
  18648. '\\': '\\',
  18649. "'": "'",
  18650. '\n': 'n',
  18651. '\r': 'r',
  18652. '\u2028': 'u2028',
  18653. '\u2029': 'u2029'
  18654. };
  18655. /** Built-in method references without a dependency on `root`. */
  18656. var freeParseFloat = parseFloat,
  18657. freeParseInt = parseInt;
  18658. /** Detect free variable `global` from Node.js. */
  18659. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  18660. /** Detect free variable `self`. */
  18661. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  18662. /** Used as a reference to the global object. */
  18663. var root = freeGlobal || freeSelf || Function('return this')();
  18664. /** Detect free variable `exports`. */
  18665. var freeExports = true && exports && !exports.nodeType && exports;
  18666. /** Detect free variable `module`. */
  18667. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  18668. /** Detect the popular CommonJS extension `module.exports`. */
  18669. var moduleExports = freeModule && freeModule.exports === freeExports;
  18670. /** Detect free variable `process` from Node.js. */
  18671. var freeProcess = moduleExports && freeGlobal.process;
  18672. /** Used to access faster Node.js helpers. */
  18673. var nodeUtil = (function() {
  18674. try {
  18675. // Use `util.types` for Node.js 10+.
  18676. var types = freeModule && freeModule.require && freeModule.require('util').types;
  18677. if (types) {
  18678. return types;
  18679. }
  18680. // Legacy `process.binding('util')` for Node.js < 10.
  18681. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  18682. } catch (e) {}
  18683. }());
  18684. /* Node.js helper references. */
  18685. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  18686. nodeIsDate = nodeUtil && nodeUtil.isDate,
  18687. nodeIsMap = nodeUtil && nodeUtil.isMap,
  18688. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  18689. nodeIsSet = nodeUtil && nodeUtil.isSet,
  18690. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  18691. /*--------------------------------------------------------------------------*/
  18692. /**
  18693. * A faster alternative to `Function#apply`, this function invokes `func`
  18694. * with the `this` binding of `thisArg` and the arguments of `args`.
  18695. *
  18696. * @private
  18697. * @param {Function} func The function to invoke.
  18698. * @param {*} thisArg The `this` binding of `func`.
  18699. * @param {Array} args The arguments to invoke `func` with.
  18700. * @returns {*} Returns the result of `func`.
  18701. */
  18702. function apply(func, thisArg, args) {
  18703. switch (args.length) {
  18704. case 0: return func.call(thisArg);
  18705. case 1: return func.call(thisArg, args[0]);
  18706. case 2: return func.call(thisArg, args[0], args[1]);
  18707. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  18708. }
  18709. return func.apply(thisArg, args);
  18710. }
  18711. /**
  18712. * A specialized version of `baseAggregator` for arrays.
  18713. *
  18714. * @private
  18715. * @param {Array} [array] The array to iterate over.
  18716. * @param {Function} setter The function to set `accumulator` values.
  18717. * @param {Function} iteratee The iteratee to transform keys.
  18718. * @param {Object} accumulator The initial aggregated object.
  18719. * @returns {Function} Returns `accumulator`.
  18720. */
  18721. function arrayAggregator(array, setter, iteratee, accumulator) {
  18722. var index = -1,
  18723. length = array == null ? 0 : array.length;
  18724. while (++index < length) {
  18725. var value = array[index];
  18726. setter(accumulator, value, iteratee(value), array);
  18727. }
  18728. return accumulator;
  18729. }
  18730. /**
  18731. * A specialized version of `_.forEach` for arrays without support for
  18732. * iteratee shorthands.
  18733. *
  18734. * @private
  18735. * @param {Array} [array] The array to iterate over.
  18736. * @param {Function} iteratee The function invoked per iteration.
  18737. * @returns {Array} Returns `array`.
  18738. */
  18739. function arrayEach(array, iteratee) {
  18740. var index = -1,
  18741. length = array == null ? 0 : array.length;
  18742. while (++index < length) {
  18743. if (iteratee(array[index], index, array) === false) {
  18744. break;
  18745. }
  18746. }
  18747. return array;
  18748. }
  18749. /**
  18750. * A specialized version of `_.forEachRight` for arrays without support for
  18751. * iteratee shorthands.
  18752. *
  18753. * @private
  18754. * @param {Array} [array] The array to iterate over.
  18755. * @param {Function} iteratee The function invoked per iteration.
  18756. * @returns {Array} Returns `array`.
  18757. */
  18758. function arrayEachRight(array, iteratee) {
  18759. var length = array == null ? 0 : array.length;
  18760. while (length--) {
  18761. if (iteratee(array[length], length, array) === false) {
  18762. break;
  18763. }
  18764. }
  18765. return array;
  18766. }
  18767. /**
  18768. * A specialized version of `_.every` for arrays without support for
  18769. * iteratee shorthands.
  18770. *
  18771. * @private
  18772. * @param {Array} [array] The array to iterate over.
  18773. * @param {Function} predicate The function invoked per iteration.
  18774. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  18775. * else `false`.
  18776. */
  18777. function arrayEvery(array, predicate) {
  18778. var index = -1,
  18779. length = array == null ? 0 : array.length;
  18780. while (++index < length) {
  18781. if (!predicate(array[index], index, array)) {
  18782. return false;
  18783. }
  18784. }
  18785. return true;
  18786. }
  18787. /**
  18788. * A specialized version of `_.filter` for arrays without support for
  18789. * iteratee shorthands.
  18790. *
  18791. * @private
  18792. * @param {Array} [array] The array to iterate over.
  18793. * @param {Function} predicate The function invoked per iteration.
  18794. * @returns {Array} Returns the new filtered array.
  18795. */
  18796. function arrayFilter(array, predicate) {
  18797. var index = -1,
  18798. length = array == null ? 0 : array.length,
  18799. resIndex = 0,
  18800. result = [];
  18801. while (++index < length) {
  18802. var value = array[index];
  18803. if (predicate(value, index, array)) {
  18804. result[resIndex++] = value;
  18805. }
  18806. }
  18807. return result;
  18808. }
  18809. /**
  18810. * A specialized version of `_.includes` for arrays without support for
  18811. * specifying an index to search from.
  18812. *
  18813. * @private
  18814. * @param {Array} [array] The array to inspect.
  18815. * @param {*} target The value to search for.
  18816. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18817. */
  18818. function arrayIncludes(array, value) {
  18819. var length = array == null ? 0 : array.length;
  18820. return !!length && baseIndexOf(array, value, 0) > -1;
  18821. }
  18822. /**
  18823. * This function is like `arrayIncludes` except that it accepts a comparator.
  18824. *
  18825. * @private
  18826. * @param {Array} [array] The array to inspect.
  18827. * @param {*} target The value to search for.
  18828. * @param {Function} comparator The comparator invoked per element.
  18829. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18830. */
  18831. function arrayIncludesWith(array, value, comparator) {
  18832. var index = -1,
  18833. length = array == null ? 0 : array.length;
  18834. while (++index < length) {
  18835. if (comparator(value, array[index])) {
  18836. return true;
  18837. }
  18838. }
  18839. return false;
  18840. }
  18841. /**
  18842. * A specialized version of `_.map` for arrays without support for iteratee
  18843. * shorthands.
  18844. *
  18845. * @private
  18846. * @param {Array} [array] The array to iterate over.
  18847. * @param {Function} iteratee The function invoked per iteration.
  18848. * @returns {Array} Returns the new mapped array.
  18849. */
  18850. function arrayMap(array, iteratee) {
  18851. var index = -1,
  18852. length = array == null ? 0 : array.length,
  18853. result = Array(length);
  18854. while (++index < length) {
  18855. result[index] = iteratee(array[index], index, array);
  18856. }
  18857. return result;
  18858. }
  18859. /**
  18860. * Appends the elements of `values` to `array`.
  18861. *
  18862. * @private
  18863. * @param {Array} array The array to modify.
  18864. * @param {Array} values The values to append.
  18865. * @returns {Array} Returns `array`.
  18866. */
  18867. function arrayPush(array, values) {
  18868. var index = -1,
  18869. length = values.length,
  18870. offset = array.length;
  18871. while (++index < length) {
  18872. array[offset + index] = values[index];
  18873. }
  18874. return array;
  18875. }
  18876. /**
  18877. * A specialized version of `_.reduce` for arrays without support for
  18878. * iteratee shorthands.
  18879. *
  18880. * @private
  18881. * @param {Array} [array] The array to iterate over.
  18882. * @param {Function} iteratee The function invoked per iteration.
  18883. * @param {*} [accumulator] The initial value.
  18884. * @param {boolean} [initAccum] Specify using the first element of `array` as
  18885. * the initial value.
  18886. * @returns {*} Returns the accumulated value.
  18887. */
  18888. function arrayReduce(array, iteratee, accumulator, initAccum) {
  18889. var index = -1,
  18890. length = array == null ? 0 : array.length;
  18891. if (initAccum && length) {
  18892. accumulator = array[++index];
  18893. }
  18894. while (++index < length) {
  18895. accumulator = iteratee(accumulator, array[index], index, array);
  18896. }
  18897. return accumulator;
  18898. }
  18899. /**
  18900. * A specialized version of `_.reduceRight` for arrays without support for
  18901. * iteratee shorthands.
  18902. *
  18903. * @private
  18904. * @param {Array} [array] The array to iterate over.
  18905. * @param {Function} iteratee The function invoked per iteration.
  18906. * @param {*} [accumulator] The initial value.
  18907. * @param {boolean} [initAccum] Specify using the last element of `array` as
  18908. * the initial value.
  18909. * @returns {*} Returns the accumulated value.
  18910. */
  18911. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  18912. var length = array == null ? 0 : array.length;
  18913. if (initAccum && length) {
  18914. accumulator = array[--length];
  18915. }
  18916. while (length--) {
  18917. accumulator = iteratee(accumulator, array[length], length, array);
  18918. }
  18919. return accumulator;
  18920. }
  18921. /**
  18922. * A specialized version of `_.some` for arrays without support for iteratee
  18923. * shorthands.
  18924. *
  18925. * @private
  18926. * @param {Array} [array] The array to iterate over.
  18927. * @param {Function} predicate The function invoked per iteration.
  18928. * @returns {boolean} Returns `true` if any element passes the predicate check,
  18929. * else `false`.
  18930. */
  18931. function arraySome(array, predicate) {
  18932. var index = -1,
  18933. length = array == null ? 0 : array.length;
  18934. while (++index < length) {
  18935. if (predicate(array[index], index, array)) {
  18936. return true;
  18937. }
  18938. }
  18939. return false;
  18940. }
  18941. /**
  18942. * Gets the size of an ASCII `string`.
  18943. *
  18944. * @private
  18945. * @param {string} string The string inspect.
  18946. * @returns {number} Returns the string size.
  18947. */
  18948. var asciiSize = baseProperty('length');
  18949. /**
  18950. * Converts an ASCII `string` to an array.
  18951. *
  18952. * @private
  18953. * @param {string} string The string to convert.
  18954. * @returns {Array} Returns the converted array.
  18955. */
  18956. function asciiToArray(string) {
  18957. return string.split('');
  18958. }
  18959. /**
  18960. * Splits an ASCII `string` into an array of its words.
  18961. *
  18962. * @private
  18963. * @param {string} The string to inspect.
  18964. * @returns {Array} Returns the words of `string`.
  18965. */
  18966. function asciiWords(string) {
  18967. return string.match(reAsciiWord) || [];
  18968. }
  18969. /**
  18970. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  18971. * without support for iteratee shorthands, which iterates over `collection`
  18972. * using `eachFunc`.
  18973. *
  18974. * @private
  18975. * @param {Array|Object} collection The collection to inspect.
  18976. * @param {Function} predicate The function invoked per iteration.
  18977. * @param {Function} eachFunc The function to iterate over `collection`.
  18978. * @returns {*} Returns the found element or its key, else `undefined`.
  18979. */
  18980. function baseFindKey(collection, predicate, eachFunc) {
  18981. var result;
  18982. eachFunc(collection, function(value, key, collection) {
  18983. if (predicate(value, key, collection)) {
  18984. result = key;
  18985. return false;
  18986. }
  18987. });
  18988. return result;
  18989. }
  18990. /**
  18991. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  18992. * support for iteratee shorthands.
  18993. *
  18994. * @private
  18995. * @param {Array} array The array to inspect.
  18996. * @param {Function} predicate The function invoked per iteration.
  18997. * @param {number} fromIndex The index to search from.
  18998. * @param {boolean} [fromRight] Specify iterating from right to left.
  18999. * @returns {number} Returns the index of the matched value, else `-1`.
  19000. */
  19001. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  19002. var length = array.length,
  19003. index = fromIndex + (fromRight ? 1 : -1);
  19004. while ((fromRight ? index-- : ++index < length)) {
  19005. if (predicate(array[index], index, array)) {
  19006. return index;
  19007. }
  19008. }
  19009. return -1;
  19010. }
  19011. /**
  19012. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  19013. *
  19014. * @private
  19015. * @param {Array} array The array to inspect.
  19016. * @param {*} value The value to search for.
  19017. * @param {number} fromIndex The index to search from.
  19018. * @returns {number} Returns the index of the matched value, else `-1`.
  19019. */
  19020. function baseIndexOf(array, value, fromIndex) {
  19021. return value === value
  19022. ? strictIndexOf(array, value, fromIndex)
  19023. : baseFindIndex(array, baseIsNaN, fromIndex);
  19024. }
  19025. /**
  19026. * This function is like `baseIndexOf` except that it accepts a comparator.
  19027. *
  19028. * @private
  19029. * @param {Array} array The array to inspect.
  19030. * @param {*} value The value to search for.
  19031. * @param {number} fromIndex The index to search from.
  19032. * @param {Function} comparator The comparator invoked per element.
  19033. * @returns {number} Returns the index of the matched value, else `-1`.
  19034. */
  19035. function baseIndexOfWith(array, value, fromIndex, comparator) {
  19036. var index = fromIndex - 1,
  19037. length = array.length;
  19038. while (++index < length) {
  19039. if (comparator(array[index], value)) {
  19040. return index;
  19041. }
  19042. }
  19043. return -1;
  19044. }
  19045. /**
  19046. * The base implementation of `_.isNaN` without support for number objects.
  19047. *
  19048. * @private
  19049. * @param {*} value The value to check.
  19050. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  19051. */
  19052. function baseIsNaN(value) {
  19053. return value !== value;
  19054. }
  19055. /**
  19056. * The base implementation of `_.mean` and `_.meanBy` without support for
  19057. * iteratee shorthands.
  19058. *
  19059. * @private
  19060. * @param {Array} array The array to iterate over.
  19061. * @param {Function} iteratee The function invoked per iteration.
  19062. * @returns {number} Returns the mean.
  19063. */
  19064. function baseMean(array, iteratee) {
  19065. var length = array == null ? 0 : array.length;
  19066. return length ? (baseSum(array, iteratee) / length) : NAN;
  19067. }
  19068. /**
  19069. * The base implementation of `_.property` without support for deep paths.
  19070. *
  19071. * @private
  19072. * @param {string} key The key of the property to get.
  19073. * @returns {Function} Returns the new accessor function.
  19074. */
  19075. function baseProperty(key) {
  19076. return function(object) {
  19077. return object == null ? undefined : object[key];
  19078. };
  19079. }
  19080. /**
  19081. * The base implementation of `_.propertyOf` without support for deep paths.
  19082. *
  19083. * @private
  19084. * @param {Object} object The object to query.
  19085. * @returns {Function} Returns the new accessor function.
  19086. */
  19087. function basePropertyOf(object) {
  19088. return function(key) {
  19089. return object == null ? undefined : object[key];
  19090. };
  19091. }
  19092. /**
  19093. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  19094. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  19095. *
  19096. * @private
  19097. * @param {Array|Object} collection The collection to iterate over.
  19098. * @param {Function} iteratee The function invoked per iteration.
  19099. * @param {*} accumulator The initial value.
  19100. * @param {boolean} initAccum Specify using the first or last element of
  19101. * `collection` as the initial value.
  19102. * @param {Function} eachFunc The function to iterate over `collection`.
  19103. * @returns {*} Returns the accumulated value.
  19104. */
  19105. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  19106. eachFunc(collection, function(value, index, collection) {
  19107. accumulator = initAccum
  19108. ? (initAccum = false, value)
  19109. : iteratee(accumulator, value, index, collection);
  19110. });
  19111. return accumulator;
  19112. }
  19113. /**
  19114. * The base implementation of `_.sortBy` which uses `comparer` to define the
  19115. * sort order of `array` and replaces criteria objects with their corresponding
  19116. * values.
  19117. *
  19118. * @private
  19119. * @param {Array} array The array to sort.
  19120. * @param {Function} comparer The function to define sort order.
  19121. * @returns {Array} Returns `array`.
  19122. */
  19123. function baseSortBy(array, comparer) {
  19124. var length = array.length;
  19125. array.sort(comparer);
  19126. while (length--) {
  19127. array[length] = array[length].value;
  19128. }
  19129. return array;
  19130. }
  19131. /**
  19132. * The base implementation of `_.sum` and `_.sumBy` without support for
  19133. * iteratee shorthands.
  19134. *
  19135. * @private
  19136. * @param {Array} array The array to iterate over.
  19137. * @param {Function} iteratee The function invoked per iteration.
  19138. * @returns {number} Returns the sum.
  19139. */
  19140. function baseSum(array, iteratee) {
  19141. var result,
  19142. index = -1,
  19143. length = array.length;
  19144. while (++index < length) {
  19145. var current = iteratee(array[index]);
  19146. if (current !== undefined) {
  19147. result = result === undefined ? current : (result + current);
  19148. }
  19149. }
  19150. return result;
  19151. }
  19152. /**
  19153. * The base implementation of `_.times` without support for iteratee shorthands
  19154. * or max array length checks.
  19155. *
  19156. * @private
  19157. * @param {number} n The number of times to invoke `iteratee`.
  19158. * @param {Function} iteratee The function invoked per iteration.
  19159. * @returns {Array} Returns the array of results.
  19160. */
  19161. function baseTimes(n, iteratee) {
  19162. var index = -1,
  19163. result = Array(n);
  19164. while (++index < n) {
  19165. result[index] = iteratee(index);
  19166. }
  19167. return result;
  19168. }
  19169. /**
  19170. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  19171. * of key-value pairs for `object` corresponding to the property names of `props`.
  19172. *
  19173. * @private
  19174. * @param {Object} object The object to query.
  19175. * @param {Array} props The property names to get values for.
  19176. * @returns {Object} Returns the key-value pairs.
  19177. */
  19178. function baseToPairs(object, props) {
  19179. return arrayMap(props, function(key) {
  19180. return [key, object[key]];
  19181. });
  19182. }
  19183. /**
  19184. * The base implementation of `_.unary` without support for storing metadata.
  19185. *
  19186. * @private
  19187. * @param {Function} func The function to cap arguments for.
  19188. * @returns {Function} Returns the new capped function.
  19189. */
  19190. function baseUnary(func) {
  19191. return function(value) {
  19192. return func(value);
  19193. };
  19194. }
  19195. /**
  19196. * The base implementation of `_.values` and `_.valuesIn` which creates an
  19197. * array of `object` property values corresponding to the property names
  19198. * of `props`.
  19199. *
  19200. * @private
  19201. * @param {Object} object The object to query.
  19202. * @param {Array} props The property names to get values for.
  19203. * @returns {Object} Returns the array of property values.
  19204. */
  19205. function baseValues(object, props) {
  19206. return arrayMap(props, function(key) {
  19207. return object[key];
  19208. });
  19209. }
  19210. /**
  19211. * Checks if a `cache` value for `key` exists.
  19212. *
  19213. * @private
  19214. * @param {Object} cache The cache to query.
  19215. * @param {string} key The key of the entry to check.
  19216. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19217. */
  19218. function cacheHas(cache, key) {
  19219. return cache.has(key);
  19220. }
  19221. /**
  19222. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  19223. * that is not found in the character symbols.
  19224. *
  19225. * @private
  19226. * @param {Array} strSymbols The string symbols to inspect.
  19227. * @param {Array} chrSymbols The character symbols to find.
  19228. * @returns {number} Returns the index of the first unmatched string symbol.
  19229. */
  19230. function charsStartIndex(strSymbols, chrSymbols) {
  19231. var index = -1,
  19232. length = strSymbols.length;
  19233. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19234. return index;
  19235. }
  19236. /**
  19237. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  19238. * that is not found in the character symbols.
  19239. *
  19240. * @private
  19241. * @param {Array} strSymbols The string symbols to inspect.
  19242. * @param {Array} chrSymbols The character symbols to find.
  19243. * @returns {number} Returns the index of the last unmatched string symbol.
  19244. */
  19245. function charsEndIndex(strSymbols, chrSymbols) {
  19246. var index = strSymbols.length;
  19247. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19248. return index;
  19249. }
  19250. /**
  19251. * Gets the number of `placeholder` occurrences in `array`.
  19252. *
  19253. * @private
  19254. * @param {Array} array The array to inspect.
  19255. * @param {*} placeholder The placeholder to search for.
  19256. * @returns {number} Returns the placeholder count.
  19257. */
  19258. function countHolders(array, placeholder) {
  19259. var length = array.length,
  19260. result = 0;
  19261. while (length--) {
  19262. if (array[length] === placeholder) {
  19263. ++result;
  19264. }
  19265. }
  19266. return result;
  19267. }
  19268. /**
  19269. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  19270. * letters to basic Latin letters.
  19271. *
  19272. * @private
  19273. * @param {string} letter The matched letter to deburr.
  19274. * @returns {string} Returns the deburred letter.
  19275. */
  19276. var deburrLetter = basePropertyOf(deburredLetters);
  19277. /**
  19278. * Used by `_.escape` to convert characters to HTML entities.
  19279. *
  19280. * @private
  19281. * @param {string} chr The matched character to escape.
  19282. * @returns {string} Returns the escaped character.
  19283. */
  19284. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  19285. /**
  19286. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  19287. *
  19288. * @private
  19289. * @param {string} chr The matched character to escape.
  19290. * @returns {string} Returns the escaped character.
  19291. */
  19292. function escapeStringChar(chr) {
  19293. return '\\' + stringEscapes[chr];
  19294. }
  19295. /**
  19296. * Gets the value at `key` of `object`.
  19297. *
  19298. * @private
  19299. * @param {Object} [object] The object to query.
  19300. * @param {string} key The key of the property to get.
  19301. * @returns {*} Returns the property value.
  19302. */
  19303. function getValue(object, key) {
  19304. return object == null ? undefined : object[key];
  19305. }
  19306. /**
  19307. * Checks if `string` contains Unicode symbols.
  19308. *
  19309. * @private
  19310. * @param {string} string The string to inspect.
  19311. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  19312. */
  19313. function hasUnicode(string) {
  19314. return reHasUnicode.test(string);
  19315. }
  19316. /**
  19317. * Checks if `string` contains a word composed of Unicode symbols.
  19318. *
  19319. * @private
  19320. * @param {string} string The string to inspect.
  19321. * @returns {boolean} Returns `true` if a word is found, else `false`.
  19322. */
  19323. function hasUnicodeWord(string) {
  19324. return reHasUnicodeWord.test(string);
  19325. }
  19326. /**
  19327. * Converts `iterator` to an array.
  19328. *
  19329. * @private
  19330. * @param {Object} iterator The iterator to convert.
  19331. * @returns {Array} Returns the converted array.
  19332. */
  19333. function iteratorToArray(iterator) {
  19334. var data,
  19335. result = [];
  19336. while (!(data = iterator.next()).done) {
  19337. result.push(data.value);
  19338. }
  19339. return result;
  19340. }
  19341. /**
  19342. * Converts `map` to its key-value pairs.
  19343. *
  19344. * @private
  19345. * @param {Object} map The map to convert.
  19346. * @returns {Array} Returns the key-value pairs.
  19347. */
  19348. function mapToArray(map) {
  19349. var index = -1,
  19350. result = Array(map.size);
  19351. map.forEach(function(value, key) {
  19352. result[++index] = [key, value];
  19353. });
  19354. return result;
  19355. }
  19356. /**
  19357. * Creates a unary function that invokes `func` with its argument transformed.
  19358. *
  19359. * @private
  19360. * @param {Function} func The function to wrap.
  19361. * @param {Function} transform The argument transform.
  19362. * @returns {Function} Returns the new function.
  19363. */
  19364. function overArg(func, transform) {
  19365. return function(arg) {
  19366. return func(transform(arg));
  19367. };
  19368. }
  19369. /**
  19370. * Replaces all `placeholder` elements in `array` with an internal placeholder
  19371. * and returns an array of their indexes.
  19372. *
  19373. * @private
  19374. * @param {Array} array The array to modify.
  19375. * @param {*} placeholder The placeholder to replace.
  19376. * @returns {Array} Returns the new array of placeholder indexes.
  19377. */
  19378. function replaceHolders(array, placeholder) {
  19379. var index = -1,
  19380. length = array.length,
  19381. resIndex = 0,
  19382. result = [];
  19383. while (++index < length) {
  19384. var value = array[index];
  19385. if (value === placeholder || value === PLACEHOLDER) {
  19386. array[index] = PLACEHOLDER;
  19387. result[resIndex++] = index;
  19388. }
  19389. }
  19390. return result;
  19391. }
  19392. /**
  19393. * Converts `set` to an array of its values.
  19394. *
  19395. * @private
  19396. * @param {Object} set The set to convert.
  19397. * @returns {Array} Returns the values.
  19398. */
  19399. function setToArray(set) {
  19400. var index = -1,
  19401. result = Array(set.size);
  19402. set.forEach(function(value) {
  19403. result[++index] = value;
  19404. });
  19405. return result;
  19406. }
  19407. /**
  19408. * Converts `set` to its value-value pairs.
  19409. *
  19410. * @private
  19411. * @param {Object} set The set to convert.
  19412. * @returns {Array} Returns the value-value pairs.
  19413. */
  19414. function setToPairs(set) {
  19415. var index = -1,
  19416. result = Array(set.size);
  19417. set.forEach(function(value) {
  19418. result[++index] = [value, value];
  19419. });
  19420. return result;
  19421. }
  19422. /**
  19423. * A specialized version of `_.indexOf` which performs strict equality
  19424. * comparisons of values, i.e. `===`.
  19425. *
  19426. * @private
  19427. * @param {Array} array The array to inspect.
  19428. * @param {*} value The value to search for.
  19429. * @param {number} fromIndex The index to search from.
  19430. * @returns {number} Returns the index of the matched value, else `-1`.
  19431. */
  19432. function strictIndexOf(array, value, fromIndex) {
  19433. var index = fromIndex - 1,
  19434. length = array.length;
  19435. while (++index < length) {
  19436. if (array[index] === value) {
  19437. return index;
  19438. }
  19439. }
  19440. return -1;
  19441. }
  19442. /**
  19443. * A specialized version of `_.lastIndexOf` which performs strict equality
  19444. * comparisons of values, i.e. `===`.
  19445. *
  19446. * @private
  19447. * @param {Array} array The array to inspect.
  19448. * @param {*} value The value to search for.
  19449. * @param {number} fromIndex The index to search from.
  19450. * @returns {number} Returns the index of the matched value, else `-1`.
  19451. */
  19452. function strictLastIndexOf(array, value, fromIndex) {
  19453. var index = fromIndex + 1;
  19454. while (index--) {
  19455. if (array[index] === value) {
  19456. return index;
  19457. }
  19458. }
  19459. return index;
  19460. }
  19461. /**
  19462. * Gets the number of symbols in `string`.
  19463. *
  19464. * @private
  19465. * @param {string} string The string to inspect.
  19466. * @returns {number} Returns the string size.
  19467. */
  19468. function stringSize(string) {
  19469. return hasUnicode(string)
  19470. ? unicodeSize(string)
  19471. : asciiSize(string);
  19472. }
  19473. /**
  19474. * Converts `string` to an array.
  19475. *
  19476. * @private
  19477. * @param {string} string The string to convert.
  19478. * @returns {Array} Returns the converted array.
  19479. */
  19480. function stringToArray(string) {
  19481. return hasUnicode(string)
  19482. ? unicodeToArray(string)
  19483. : asciiToArray(string);
  19484. }
  19485. /**
  19486. * Used by `_.unescape` to convert HTML entities to characters.
  19487. *
  19488. * @private
  19489. * @param {string} chr The matched character to unescape.
  19490. * @returns {string} Returns the unescaped character.
  19491. */
  19492. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  19493. /**
  19494. * Gets the size of a Unicode `string`.
  19495. *
  19496. * @private
  19497. * @param {string} string The string inspect.
  19498. * @returns {number} Returns the string size.
  19499. */
  19500. function unicodeSize(string) {
  19501. var result = reUnicode.lastIndex = 0;
  19502. while (reUnicode.test(string)) {
  19503. ++result;
  19504. }
  19505. return result;
  19506. }
  19507. /**
  19508. * Converts a Unicode `string` to an array.
  19509. *
  19510. * @private
  19511. * @param {string} string The string to convert.
  19512. * @returns {Array} Returns the converted array.
  19513. */
  19514. function unicodeToArray(string) {
  19515. return string.match(reUnicode) || [];
  19516. }
  19517. /**
  19518. * Splits a Unicode `string` into an array of its words.
  19519. *
  19520. * @private
  19521. * @param {string} The string to inspect.
  19522. * @returns {Array} Returns the words of `string`.
  19523. */
  19524. function unicodeWords(string) {
  19525. return string.match(reUnicodeWord) || [];
  19526. }
  19527. /*--------------------------------------------------------------------------*/
  19528. /**
  19529. * Create a new pristine `lodash` function using the `context` object.
  19530. *
  19531. * @static
  19532. * @memberOf _
  19533. * @since 1.1.0
  19534. * @category Util
  19535. * @param {Object} [context=root] The context object.
  19536. * @returns {Function} Returns a new `lodash` function.
  19537. * @example
  19538. *
  19539. * _.mixin({ 'foo': _.constant('foo') });
  19540. *
  19541. * var lodash = _.runInContext();
  19542. * lodash.mixin({ 'bar': lodash.constant('bar') });
  19543. *
  19544. * _.isFunction(_.foo);
  19545. * // => true
  19546. * _.isFunction(_.bar);
  19547. * // => false
  19548. *
  19549. * lodash.isFunction(lodash.foo);
  19550. * // => false
  19551. * lodash.isFunction(lodash.bar);
  19552. * // => true
  19553. *
  19554. * // Create a suped-up `defer` in Node.js.
  19555. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  19556. */
  19557. var runInContext = (function runInContext(context) {
  19558. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  19559. /** Built-in constructor references. */
  19560. var Array = context.Array,
  19561. Date = context.Date,
  19562. Error = context.Error,
  19563. Function = context.Function,
  19564. Math = context.Math,
  19565. Object = context.Object,
  19566. RegExp = context.RegExp,
  19567. String = context.String,
  19568. TypeError = context.TypeError;
  19569. /** Used for built-in method references. */
  19570. var arrayProto = Array.prototype,
  19571. funcProto = Function.prototype,
  19572. objectProto = Object.prototype;
  19573. /** Used to detect overreaching core-js shims. */
  19574. var coreJsData = context['__core-js_shared__'];
  19575. /** Used to resolve the decompiled source of functions. */
  19576. var funcToString = funcProto.toString;
  19577. /** Used to check objects for own properties. */
  19578. var hasOwnProperty = objectProto.hasOwnProperty;
  19579. /** Used to generate unique IDs. */
  19580. var idCounter = 0;
  19581. /** Used to detect methods masquerading as native. */
  19582. var maskSrcKey = (function() {
  19583. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  19584. return uid ? ('Symbol(src)_1.' + uid) : '';
  19585. }());
  19586. /**
  19587. * Used to resolve the
  19588. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  19589. * of values.
  19590. */
  19591. var nativeObjectToString = objectProto.toString;
  19592. /** Used to infer the `Object` constructor. */
  19593. var objectCtorString = funcToString.call(Object);
  19594. /** Used to restore the original `_` reference in `_.noConflict`. */
  19595. var oldDash = root._;
  19596. /** Used to detect if a method is native. */
  19597. var reIsNative = RegExp('^' +
  19598. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  19599. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  19600. );
  19601. /** Built-in value references. */
  19602. var Buffer = moduleExports ? context.Buffer : undefined,
  19603. Symbol = context.Symbol,
  19604. Uint8Array = context.Uint8Array,
  19605. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  19606. getPrototype = overArg(Object.getPrototypeOf, Object),
  19607. objectCreate = Object.create,
  19608. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  19609. splice = arrayProto.splice,
  19610. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  19611. symIterator = Symbol ? Symbol.iterator : undefined,
  19612. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  19613. var defineProperty = (function() {
  19614. try {
  19615. var func = getNative(Object, 'defineProperty');
  19616. func({}, '', {});
  19617. return func;
  19618. } catch (e) {}
  19619. }());
  19620. /** Mocked built-ins. */
  19621. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  19622. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  19623. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  19624. /* Built-in method references for those with the same name as other `lodash` methods. */
  19625. var nativeCeil = Math.ceil,
  19626. nativeFloor = Math.floor,
  19627. nativeGetSymbols = Object.getOwnPropertySymbols,
  19628. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  19629. nativeIsFinite = context.isFinite,
  19630. nativeJoin = arrayProto.join,
  19631. nativeKeys = overArg(Object.keys, Object),
  19632. nativeMax = Math.max,
  19633. nativeMin = Math.min,
  19634. nativeNow = Date.now,
  19635. nativeParseInt = context.parseInt,
  19636. nativeRandom = Math.random,
  19637. nativeReverse = arrayProto.reverse;
  19638. /* Built-in method references that are verified to be native. */
  19639. var DataView = getNative(context, 'DataView'),
  19640. Map = getNative(context, 'Map'),
  19641. Promise = getNative(context, 'Promise'),
  19642. Set = getNative(context, 'Set'),
  19643. WeakMap = getNative(context, 'WeakMap'),
  19644. nativeCreate = getNative(Object, 'create');
  19645. /** Used to store function metadata. */
  19646. var metaMap = WeakMap && new WeakMap;
  19647. /** Used to lookup unminified function names. */
  19648. var realNames = {};
  19649. /** Used to detect maps, sets, and weakmaps. */
  19650. var dataViewCtorString = toSource(DataView),
  19651. mapCtorString = toSource(Map),
  19652. promiseCtorString = toSource(Promise),
  19653. setCtorString = toSource(Set),
  19654. weakMapCtorString = toSource(WeakMap);
  19655. /** Used to convert symbols to primitives and strings. */
  19656. var symbolProto = Symbol ? Symbol.prototype : undefined,
  19657. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  19658. symbolToString = symbolProto ? symbolProto.toString : undefined;
  19659. /*------------------------------------------------------------------------*/
  19660. /**
  19661. * Creates a `lodash` object which wraps `value` to enable implicit method
  19662. * chain sequences. Methods that operate on and return arrays, collections,
  19663. * and functions can be chained together. Methods that retrieve a single value
  19664. * or may return a primitive value will automatically end the chain sequence
  19665. * and return the unwrapped value. Otherwise, the value must be unwrapped
  19666. * with `_#value`.
  19667. *
  19668. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  19669. * enabled using `_.chain`.
  19670. *
  19671. * The execution of chained methods is lazy, that is, it's deferred until
  19672. * `_#value` is implicitly or explicitly called.
  19673. *
  19674. * Lazy evaluation allows several methods to support shortcut fusion.
  19675. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  19676. * the creation of intermediate arrays and can greatly reduce the number of
  19677. * iteratee executions. Sections of a chain sequence qualify for shortcut
  19678. * fusion if the section is applied to an array and iteratees accept only
  19679. * one argument. The heuristic for whether a section qualifies for shortcut
  19680. * fusion is subject to change.
  19681. *
  19682. * Chaining is supported in custom builds as long as the `_#value` method is
  19683. * directly or indirectly included in the build.
  19684. *
  19685. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  19686. *
  19687. * The wrapper `Array` methods are:
  19688. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  19689. *
  19690. * The wrapper `String` methods are:
  19691. * `replace` and `split`
  19692. *
  19693. * The wrapper methods that support shortcut fusion are:
  19694. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  19695. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  19696. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  19697. *
  19698. * The chainable wrapper methods are:
  19699. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  19700. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  19701. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  19702. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  19703. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  19704. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  19705. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  19706. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  19707. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  19708. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  19709. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  19710. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  19711. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  19712. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  19713. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  19714. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  19715. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  19716. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  19717. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  19718. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  19719. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  19720. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  19721. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  19722. * `zipObject`, `zipObjectDeep`, and `zipWith`
  19723. *
  19724. * The wrapper methods that are **not** chainable by default are:
  19725. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  19726. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  19727. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  19728. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  19729. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  19730. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  19731. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  19732. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  19733. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  19734. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  19735. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  19736. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  19737. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  19738. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  19739. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  19740. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  19741. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  19742. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  19743. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  19744. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  19745. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  19746. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  19747. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  19748. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  19749. * `upperFirst`, `value`, and `words`
  19750. *
  19751. * @name _
  19752. * @constructor
  19753. * @category Seq
  19754. * @param {*} value The value to wrap in a `lodash` instance.
  19755. * @returns {Object} Returns the new `lodash` wrapper instance.
  19756. * @example
  19757. *
  19758. * function square(n) {
  19759. * return n * n;
  19760. * }
  19761. *
  19762. * var wrapped = _([1, 2, 3]);
  19763. *
  19764. * // Returns an unwrapped value.
  19765. * wrapped.reduce(_.add);
  19766. * // => 6
  19767. *
  19768. * // Returns a wrapped value.
  19769. * var squares = wrapped.map(square);
  19770. *
  19771. * _.isArray(squares);
  19772. * // => false
  19773. *
  19774. * _.isArray(squares.value());
  19775. * // => true
  19776. */
  19777. function lodash(value) {
  19778. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  19779. if (value instanceof LodashWrapper) {
  19780. return value;
  19781. }
  19782. if (hasOwnProperty.call(value, '__wrapped__')) {
  19783. return wrapperClone(value);
  19784. }
  19785. }
  19786. return new LodashWrapper(value);
  19787. }
  19788. /**
  19789. * The base implementation of `_.create` without support for assigning
  19790. * properties to the created object.
  19791. *
  19792. * @private
  19793. * @param {Object} proto The object to inherit from.
  19794. * @returns {Object} Returns the new object.
  19795. */
  19796. var baseCreate = (function() {
  19797. function object() {}
  19798. return function(proto) {
  19799. if (!isObject(proto)) {
  19800. return {};
  19801. }
  19802. if (objectCreate) {
  19803. return objectCreate(proto);
  19804. }
  19805. object.prototype = proto;
  19806. var result = new object;
  19807. object.prototype = undefined;
  19808. return result;
  19809. };
  19810. }());
  19811. /**
  19812. * The function whose prototype chain sequence wrappers inherit from.
  19813. *
  19814. * @private
  19815. */
  19816. function baseLodash() {
  19817. // No operation performed.
  19818. }
  19819. /**
  19820. * The base constructor for creating `lodash` wrapper objects.
  19821. *
  19822. * @private
  19823. * @param {*} value The value to wrap.
  19824. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  19825. */
  19826. function LodashWrapper(value, chainAll) {
  19827. this.__wrapped__ = value;
  19828. this.__actions__ = [];
  19829. this.__chain__ = !!chainAll;
  19830. this.__index__ = 0;
  19831. this.__values__ = undefined;
  19832. }
  19833. /**
  19834. * By default, the template delimiters used by lodash are like those in
  19835. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  19836. * following template settings to use alternative delimiters.
  19837. *
  19838. * @static
  19839. * @memberOf _
  19840. * @type {Object}
  19841. */
  19842. lodash.templateSettings = {
  19843. /**
  19844. * Used to detect `data` property values to be HTML-escaped.
  19845. *
  19846. * @memberOf _.templateSettings
  19847. * @type {RegExp}
  19848. */
  19849. 'escape': reEscape,
  19850. /**
  19851. * Used to detect code to be evaluated.
  19852. *
  19853. * @memberOf _.templateSettings
  19854. * @type {RegExp}
  19855. */
  19856. 'evaluate': reEvaluate,
  19857. /**
  19858. * Used to detect `data` property values to inject.
  19859. *
  19860. * @memberOf _.templateSettings
  19861. * @type {RegExp}
  19862. */
  19863. 'interpolate': reInterpolate,
  19864. /**
  19865. * Used to reference the data object in the template text.
  19866. *
  19867. * @memberOf _.templateSettings
  19868. * @type {string}
  19869. */
  19870. 'variable': '',
  19871. /**
  19872. * Used to import variables into the compiled template.
  19873. *
  19874. * @memberOf _.templateSettings
  19875. * @type {Object}
  19876. */
  19877. 'imports': {
  19878. /**
  19879. * A reference to the `lodash` function.
  19880. *
  19881. * @memberOf _.templateSettings.imports
  19882. * @type {Function}
  19883. */
  19884. '_': lodash
  19885. }
  19886. };
  19887. // Ensure wrappers are instances of `baseLodash`.
  19888. lodash.prototype = baseLodash.prototype;
  19889. lodash.prototype.constructor = lodash;
  19890. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  19891. LodashWrapper.prototype.constructor = LodashWrapper;
  19892. /*------------------------------------------------------------------------*/
  19893. /**
  19894. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  19895. *
  19896. * @private
  19897. * @constructor
  19898. * @param {*} value The value to wrap.
  19899. */
  19900. function LazyWrapper(value) {
  19901. this.__wrapped__ = value;
  19902. this.__actions__ = [];
  19903. this.__dir__ = 1;
  19904. this.__filtered__ = false;
  19905. this.__iteratees__ = [];
  19906. this.__takeCount__ = MAX_ARRAY_LENGTH;
  19907. this.__views__ = [];
  19908. }
  19909. /**
  19910. * Creates a clone of the lazy wrapper object.
  19911. *
  19912. * @private
  19913. * @name clone
  19914. * @memberOf LazyWrapper
  19915. * @returns {Object} Returns the cloned `LazyWrapper` object.
  19916. */
  19917. function lazyClone() {
  19918. var result = new LazyWrapper(this.__wrapped__);
  19919. result.__actions__ = copyArray(this.__actions__);
  19920. result.__dir__ = this.__dir__;
  19921. result.__filtered__ = this.__filtered__;
  19922. result.__iteratees__ = copyArray(this.__iteratees__);
  19923. result.__takeCount__ = this.__takeCount__;
  19924. result.__views__ = copyArray(this.__views__);
  19925. return result;
  19926. }
  19927. /**
  19928. * Reverses the direction of lazy iteration.
  19929. *
  19930. * @private
  19931. * @name reverse
  19932. * @memberOf LazyWrapper
  19933. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  19934. */
  19935. function lazyReverse() {
  19936. if (this.__filtered__) {
  19937. var result = new LazyWrapper(this);
  19938. result.__dir__ = -1;
  19939. result.__filtered__ = true;
  19940. } else {
  19941. result = this.clone();
  19942. result.__dir__ *= -1;
  19943. }
  19944. return result;
  19945. }
  19946. /**
  19947. * Extracts the unwrapped value from its lazy wrapper.
  19948. *
  19949. * @private
  19950. * @name value
  19951. * @memberOf LazyWrapper
  19952. * @returns {*} Returns the unwrapped value.
  19953. */
  19954. function lazyValue() {
  19955. var array = this.__wrapped__.value(),
  19956. dir = this.__dir__,
  19957. isArr = isArray(array),
  19958. isRight = dir < 0,
  19959. arrLength = isArr ? array.length : 0,
  19960. view = getView(0, arrLength, this.__views__),
  19961. start = view.start,
  19962. end = view.end,
  19963. length = end - start,
  19964. index = isRight ? end : (start - 1),
  19965. iteratees = this.__iteratees__,
  19966. iterLength = iteratees.length,
  19967. resIndex = 0,
  19968. takeCount = nativeMin(length, this.__takeCount__);
  19969. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  19970. return baseWrapperValue(array, this.__actions__);
  19971. }
  19972. var result = [];
  19973. outer:
  19974. while (length-- && resIndex < takeCount) {
  19975. index += dir;
  19976. var iterIndex = -1,
  19977. value = array[index];
  19978. while (++iterIndex < iterLength) {
  19979. var data = iteratees[iterIndex],
  19980. iteratee = data.iteratee,
  19981. type = data.type,
  19982. computed = iteratee(value);
  19983. if (type == LAZY_MAP_FLAG) {
  19984. value = computed;
  19985. } else if (!computed) {
  19986. if (type == LAZY_FILTER_FLAG) {
  19987. continue outer;
  19988. } else {
  19989. break outer;
  19990. }
  19991. }
  19992. }
  19993. result[resIndex++] = value;
  19994. }
  19995. return result;
  19996. }
  19997. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  19998. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  19999. LazyWrapper.prototype.constructor = LazyWrapper;
  20000. /*------------------------------------------------------------------------*/
  20001. /**
  20002. * Creates a hash object.
  20003. *
  20004. * @private
  20005. * @constructor
  20006. * @param {Array} [entries] The key-value pairs to cache.
  20007. */
  20008. function Hash(entries) {
  20009. var index = -1,
  20010. length = entries == null ? 0 : entries.length;
  20011. this.clear();
  20012. while (++index < length) {
  20013. var entry = entries[index];
  20014. this.set(entry[0], entry[1]);
  20015. }
  20016. }
  20017. /**
  20018. * Removes all key-value entries from the hash.
  20019. *
  20020. * @private
  20021. * @name clear
  20022. * @memberOf Hash
  20023. */
  20024. function hashClear() {
  20025. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  20026. this.size = 0;
  20027. }
  20028. /**
  20029. * Removes `key` and its value from the hash.
  20030. *
  20031. * @private
  20032. * @name delete
  20033. * @memberOf Hash
  20034. * @param {Object} hash The hash to modify.
  20035. * @param {string} key The key of the value to remove.
  20036. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20037. */
  20038. function hashDelete(key) {
  20039. var result = this.has(key) && delete this.__data__[key];
  20040. this.size -= result ? 1 : 0;
  20041. return result;
  20042. }
  20043. /**
  20044. * Gets the hash value for `key`.
  20045. *
  20046. * @private
  20047. * @name get
  20048. * @memberOf Hash
  20049. * @param {string} key The key of the value to get.
  20050. * @returns {*} Returns the entry value.
  20051. */
  20052. function hashGet(key) {
  20053. var data = this.__data__;
  20054. if (nativeCreate) {
  20055. var result = data[key];
  20056. return result === HASH_UNDEFINED ? undefined : result;
  20057. }
  20058. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  20059. }
  20060. /**
  20061. * Checks if a hash value for `key` exists.
  20062. *
  20063. * @private
  20064. * @name has
  20065. * @memberOf Hash
  20066. * @param {string} key The key of the entry to check.
  20067. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20068. */
  20069. function hashHas(key) {
  20070. var data = this.__data__;
  20071. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  20072. }
  20073. /**
  20074. * Sets the hash `key` to `value`.
  20075. *
  20076. * @private
  20077. * @name set
  20078. * @memberOf Hash
  20079. * @param {string} key The key of the value to set.
  20080. * @param {*} value The value to set.
  20081. * @returns {Object} Returns the hash instance.
  20082. */
  20083. function hashSet(key, value) {
  20084. var data = this.__data__;
  20085. this.size += this.has(key) ? 0 : 1;
  20086. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  20087. return this;
  20088. }
  20089. // Add methods to `Hash`.
  20090. Hash.prototype.clear = hashClear;
  20091. Hash.prototype['delete'] = hashDelete;
  20092. Hash.prototype.get = hashGet;
  20093. Hash.prototype.has = hashHas;
  20094. Hash.prototype.set = hashSet;
  20095. /*------------------------------------------------------------------------*/
  20096. /**
  20097. * Creates an list cache object.
  20098. *
  20099. * @private
  20100. * @constructor
  20101. * @param {Array} [entries] The key-value pairs to cache.
  20102. */
  20103. function ListCache(entries) {
  20104. var index = -1,
  20105. length = entries == null ? 0 : entries.length;
  20106. this.clear();
  20107. while (++index < length) {
  20108. var entry = entries[index];
  20109. this.set(entry[0], entry[1]);
  20110. }
  20111. }
  20112. /**
  20113. * Removes all key-value entries from the list cache.
  20114. *
  20115. * @private
  20116. * @name clear
  20117. * @memberOf ListCache
  20118. */
  20119. function listCacheClear() {
  20120. this.__data__ = [];
  20121. this.size = 0;
  20122. }
  20123. /**
  20124. * Removes `key` and its value from the list cache.
  20125. *
  20126. * @private
  20127. * @name delete
  20128. * @memberOf ListCache
  20129. * @param {string} key The key of the value to remove.
  20130. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20131. */
  20132. function listCacheDelete(key) {
  20133. var data = this.__data__,
  20134. index = assocIndexOf(data, key);
  20135. if (index < 0) {
  20136. return false;
  20137. }
  20138. var lastIndex = data.length - 1;
  20139. if (index == lastIndex) {
  20140. data.pop();
  20141. } else {
  20142. splice.call(data, index, 1);
  20143. }
  20144. --this.size;
  20145. return true;
  20146. }
  20147. /**
  20148. * Gets the list cache value for `key`.
  20149. *
  20150. * @private
  20151. * @name get
  20152. * @memberOf ListCache
  20153. * @param {string} key The key of the value to get.
  20154. * @returns {*} Returns the entry value.
  20155. */
  20156. function listCacheGet(key) {
  20157. var data = this.__data__,
  20158. index = assocIndexOf(data, key);
  20159. return index < 0 ? undefined : data[index][1];
  20160. }
  20161. /**
  20162. * Checks if a list cache value for `key` exists.
  20163. *
  20164. * @private
  20165. * @name has
  20166. * @memberOf ListCache
  20167. * @param {string} key The key of the entry to check.
  20168. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20169. */
  20170. function listCacheHas(key) {
  20171. return assocIndexOf(this.__data__, key) > -1;
  20172. }
  20173. /**
  20174. * Sets the list cache `key` to `value`.
  20175. *
  20176. * @private
  20177. * @name set
  20178. * @memberOf ListCache
  20179. * @param {string} key The key of the value to set.
  20180. * @param {*} value The value to set.
  20181. * @returns {Object} Returns the list cache instance.
  20182. */
  20183. function listCacheSet(key, value) {
  20184. var data = this.__data__,
  20185. index = assocIndexOf(data, key);
  20186. if (index < 0) {
  20187. ++this.size;
  20188. data.push([key, value]);
  20189. } else {
  20190. data[index][1] = value;
  20191. }
  20192. return this;
  20193. }
  20194. // Add methods to `ListCache`.
  20195. ListCache.prototype.clear = listCacheClear;
  20196. ListCache.prototype['delete'] = listCacheDelete;
  20197. ListCache.prototype.get = listCacheGet;
  20198. ListCache.prototype.has = listCacheHas;
  20199. ListCache.prototype.set = listCacheSet;
  20200. /*------------------------------------------------------------------------*/
  20201. /**
  20202. * Creates a map cache object to store key-value pairs.
  20203. *
  20204. * @private
  20205. * @constructor
  20206. * @param {Array} [entries] The key-value pairs to cache.
  20207. */
  20208. function MapCache(entries) {
  20209. var index = -1,
  20210. length = entries == null ? 0 : entries.length;
  20211. this.clear();
  20212. while (++index < length) {
  20213. var entry = entries[index];
  20214. this.set(entry[0], entry[1]);
  20215. }
  20216. }
  20217. /**
  20218. * Removes all key-value entries from the map.
  20219. *
  20220. * @private
  20221. * @name clear
  20222. * @memberOf MapCache
  20223. */
  20224. function mapCacheClear() {
  20225. this.size = 0;
  20226. this.__data__ = {
  20227. 'hash': new Hash,
  20228. 'map': new (Map || ListCache),
  20229. 'string': new Hash
  20230. };
  20231. }
  20232. /**
  20233. * Removes `key` and its value from the map.
  20234. *
  20235. * @private
  20236. * @name delete
  20237. * @memberOf MapCache
  20238. * @param {string} key The key of the value to remove.
  20239. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20240. */
  20241. function mapCacheDelete(key) {
  20242. var result = getMapData(this, key)['delete'](key);
  20243. this.size -= result ? 1 : 0;
  20244. return result;
  20245. }
  20246. /**
  20247. * Gets the map value for `key`.
  20248. *
  20249. * @private
  20250. * @name get
  20251. * @memberOf MapCache
  20252. * @param {string} key The key of the value to get.
  20253. * @returns {*} Returns the entry value.
  20254. */
  20255. function mapCacheGet(key) {
  20256. return getMapData(this, key).get(key);
  20257. }
  20258. /**
  20259. * Checks if a map value for `key` exists.
  20260. *
  20261. * @private
  20262. * @name has
  20263. * @memberOf MapCache
  20264. * @param {string} key The key of the entry to check.
  20265. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20266. */
  20267. function mapCacheHas(key) {
  20268. return getMapData(this, key).has(key);
  20269. }
  20270. /**
  20271. * Sets the map `key` to `value`.
  20272. *
  20273. * @private
  20274. * @name set
  20275. * @memberOf MapCache
  20276. * @param {string} key The key of the value to set.
  20277. * @param {*} value The value to set.
  20278. * @returns {Object} Returns the map cache instance.
  20279. */
  20280. function mapCacheSet(key, value) {
  20281. var data = getMapData(this, key),
  20282. size = data.size;
  20283. data.set(key, value);
  20284. this.size += data.size == size ? 0 : 1;
  20285. return this;
  20286. }
  20287. // Add methods to `MapCache`.
  20288. MapCache.prototype.clear = mapCacheClear;
  20289. MapCache.prototype['delete'] = mapCacheDelete;
  20290. MapCache.prototype.get = mapCacheGet;
  20291. MapCache.prototype.has = mapCacheHas;
  20292. MapCache.prototype.set = mapCacheSet;
  20293. /*------------------------------------------------------------------------*/
  20294. /**
  20295. *
  20296. * Creates an array cache object to store unique values.
  20297. *
  20298. * @private
  20299. * @constructor
  20300. * @param {Array} [values] The values to cache.
  20301. */
  20302. function SetCache(values) {
  20303. var index = -1,
  20304. length = values == null ? 0 : values.length;
  20305. this.__data__ = new MapCache;
  20306. while (++index < length) {
  20307. this.add(values[index]);
  20308. }
  20309. }
  20310. /**
  20311. * Adds `value` to the array cache.
  20312. *
  20313. * @private
  20314. * @name add
  20315. * @memberOf SetCache
  20316. * @alias push
  20317. * @param {*} value The value to cache.
  20318. * @returns {Object} Returns the cache instance.
  20319. */
  20320. function setCacheAdd(value) {
  20321. this.__data__.set(value, HASH_UNDEFINED);
  20322. return this;
  20323. }
  20324. /**
  20325. * Checks if `value` is in the array cache.
  20326. *
  20327. * @private
  20328. * @name has
  20329. * @memberOf SetCache
  20330. * @param {*} value The value to search for.
  20331. * @returns {number} Returns `true` if `value` is found, else `false`.
  20332. */
  20333. function setCacheHas(value) {
  20334. return this.__data__.has(value);
  20335. }
  20336. // Add methods to `SetCache`.
  20337. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  20338. SetCache.prototype.has = setCacheHas;
  20339. /*------------------------------------------------------------------------*/
  20340. /**
  20341. * Creates a stack cache object to store key-value pairs.
  20342. *
  20343. * @private
  20344. * @constructor
  20345. * @param {Array} [entries] The key-value pairs to cache.
  20346. */
  20347. function Stack(entries) {
  20348. var data = this.__data__ = new ListCache(entries);
  20349. this.size = data.size;
  20350. }
  20351. /**
  20352. * Removes all key-value entries from the stack.
  20353. *
  20354. * @private
  20355. * @name clear
  20356. * @memberOf Stack
  20357. */
  20358. function stackClear() {
  20359. this.__data__ = new ListCache;
  20360. this.size = 0;
  20361. }
  20362. /**
  20363. * Removes `key` and its value from the stack.
  20364. *
  20365. * @private
  20366. * @name delete
  20367. * @memberOf Stack
  20368. * @param {string} key The key of the value to remove.
  20369. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20370. */
  20371. function stackDelete(key) {
  20372. var data = this.__data__,
  20373. result = data['delete'](key);
  20374. this.size = data.size;
  20375. return result;
  20376. }
  20377. /**
  20378. * Gets the stack value for `key`.
  20379. *
  20380. * @private
  20381. * @name get
  20382. * @memberOf Stack
  20383. * @param {string} key The key of the value to get.
  20384. * @returns {*} Returns the entry value.
  20385. */
  20386. function stackGet(key) {
  20387. return this.__data__.get(key);
  20388. }
  20389. /**
  20390. * Checks if a stack value for `key` exists.
  20391. *
  20392. * @private
  20393. * @name has
  20394. * @memberOf Stack
  20395. * @param {string} key The key of the entry to check.
  20396. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20397. */
  20398. function stackHas(key) {
  20399. return this.__data__.has(key);
  20400. }
  20401. /**
  20402. * Sets the stack `key` to `value`.
  20403. *
  20404. * @private
  20405. * @name set
  20406. * @memberOf Stack
  20407. * @param {string} key The key of the value to set.
  20408. * @param {*} value The value to set.
  20409. * @returns {Object} Returns the stack cache instance.
  20410. */
  20411. function stackSet(key, value) {
  20412. var data = this.__data__;
  20413. if (data instanceof ListCache) {
  20414. var pairs = data.__data__;
  20415. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  20416. pairs.push([key, value]);
  20417. this.size = ++data.size;
  20418. return this;
  20419. }
  20420. data = this.__data__ = new MapCache(pairs);
  20421. }
  20422. data.set(key, value);
  20423. this.size = data.size;
  20424. return this;
  20425. }
  20426. // Add methods to `Stack`.
  20427. Stack.prototype.clear = stackClear;
  20428. Stack.prototype['delete'] = stackDelete;
  20429. Stack.prototype.get = stackGet;
  20430. Stack.prototype.has = stackHas;
  20431. Stack.prototype.set = stackSet;
  20432. /*------------------------------------------------------------------------*/
  20433. /**
  20434. * Creates an array of the enumerable property names of the array-like `value`.
  20435. *
  20436. * @private
  20437. * @param {*} value The value to query.
  20438. * @param {boolean} inherited Specify returning inherited property names.
  20439. * @returns {Array} Returns the array of property names.
  20440. */
  20441. function arrayLikeKeys(value, inherited) {
  20442. var isArr = isArray(value),
  20443. isArg = !isArr && isArguments(value),
  20444. isBuff = !isArr && !isArg && isBuffer(value),
  20445. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  20446. skipIndexes = isArr || isArg || isBuff || isType,
  20447. result = skipIndexes ? baseTimes(value.length, String) : [],
  20448. length = result.length;
  20449. for (var key in value) {
  20450. if ((inherited || hasOwnProperty.call(value, key)) &&
  20451. !(skipIndexes && (
  20452. // Safari 9 has enumerable `arguments.length` in strict mode.
  20453. key == 'length' ||
  20454. // Node.js 0.10 has enumerable non-index properties on buffers.
  20455. (isBuff && (key == 'offset' || key == 'parent')) ||
  20456. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  20457. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  20458. // Skip index properties.
  20459. isIndex(key, length)
  20460. ))) {
  20461. result.push(key);
  20462. }
  20463. }
  20464. return result;
  20465. }
  20466. /**
  20467. * A specialized version of `_.sample` for arrays.
  20468. *
  20469. * @private
  20470. * @param {Array} array The array to sample.
  20471. * @returns {*} Returns the random element.
  20472. */
  20473. function arraySample(array) {
  20474. var length = array.length;
  20475. return length ? array[baseRandom(0, length - 1)] : undefined;
  20476. }
  20477. /**
  20478. * A specialized version of `_.sampleSize` for arrays.
  20479. *
  20480. * @private
  20481. * @param {Array} array The array to sample.
  20482. * @param {number} n The number of elements to sample.
  20483. * @returns {Array} Returns the random elements.
  20484. */
  20485. function arraySampleSize(array, n) {
  20486. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  20487. }
  20488. /**
  20489. * A specialized version of `_.shuffle` for arrays.
  20490. *
  20491. * @private
  20492. * @param {Array} array The array to shuffle.
  20493. * @returns {Array} Returns the new shuffled array.
  20494. */
  20495. function arrayShuffle(array) {
  20496. return shuffleSelf(copyArray(array));
  20497. }
  20498. /**
  20499. * This function is like `assignValue` except that it doesn't assign
  20500. * `undefined` values.
  20501. *
  20502. * @private
  20503. * @param {Object} object The object to modify.
  20504. * @param {string} key The key of the property to assign.
  20505. * @param {*} value The value to assign.
  20506. */
  20507. function assignMergeValue(object, key, value) {
  20508. if ((value !== undefined && !eq(object[key], value)) ||
  20509. (value === undefined && !(key in object))) {
  20510. baseAssignValue(object, key, value);
  20511. }
  20512. }
  20513. /**
  20514. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  20515. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20516. * for equality comparisons.
  20517. *
  20518. * @private
  20519. * @param {Object} object The object to modify.
  20520. * @param {string} key The key of the property to assign.
  20521. * @param {*} value The value to assign.
  20522. */
  20523. function assignValue(object, key, value) {
  20524. var objValue = object[key];
  20525. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  20526. (value === undefined && !(key in object))) {
  20527. baseAssignValue(object, key, value);
  20528. }
  20529. }
  20530. /**
  20531. * Gets the index at which the `key` is found in `array` of key-value pairs.
  20532. *
  20533. * @private
  20534. * @param {Array} array The array to inspect.
  20535. * @param {*} key The key to search for.
  20536. * @returns {number} Returns the index of the matched value, else `-1`.
  20537. */
  20538. function assocIndexOf(array, key) {
  20539. var length = array.length;
  20540. while (length--) {
  20541. if (eq(array[length][0], key)) {
  20542. return length;
  20543. }
  20544. }
  20545. return -1;
  20546. }
  20547. /**
  20548. * Aggregates elements of `collection` on `accumulator` with keys transformed
  20549. * by `iteratee` and values set by `setter`.
  20550. *
  20551. * @private
  20552. * @param {Array|Object} collection The collection to iterate over.
  20553. * @param {Function} setter The function to set `accumulator` values.
  20554. * @param {Function} iteratee The iteratee to transform keys.
  20555. * @param {Object} accumulator The initial aggregated object.
  20556. * @returns {Function} Returns `accumulator`.
  20557. */
  20558. function baseAggregator(collection, setter, iteratee, accumulator) {
  20559. baseEach(collection, function(value, key, collection) {
  20560. setter(accumulator, value, iteratee(value), collection);
  20561. });
  20562. return accumulator;
  20563. }
  20564. /**
  20565. * The base implementation of `_.assign` without support for multiple sources
  20566. * or `customizer` functions.
  20567. *
  20568. * @private
  20569. * @param {Object} object The destination object.
  20570. * @param {Object} source The source object.
  20571. * @returns {Object} Returns `object`.
  20572. */
  20573. function baseAssign(object, source) {
  20574. return object && copyObject(source, keys(source), object);
  20575. }
  20576. /**
  20577. * The base implementation of `_.assignIn` without support for multiple sources
  20578. * or `customizer` functions.
  20579. *
  20580. * @private
  20581. * @param {Object} object The destination object.
  20582. * @param {Object} source The source object.
  20583. * @returns {Object} Returns `object`.
  20584. */
  20585. function baseAssignIn(object, source) {
  20586. return object && copyObject(source, keysIn(source), object);
  20587. }
  20588. /**
  20589. * The base implementation of `assignValue` and `assignMergeValue` without
  20590. * value checks.
  20591. *
  20592. * @private
  20593. * @param {Object} object The object to modify.
  20594. * @param {string} key The key of the property to assign.
  20595. * @param {*} value The value to assign.
  20596. */
  20597. function baseAssignValue(object, key, value) {
  20598. if (key == '__proto__' && defineProperty) {
  20599. defineProperty(object, key, {
  20600. 'configurable': true,
  20601. 'enumerable': true,
  20602. 'value': value,
  20603. 'writable': true
  20604. });
  20605. } else {
  20606. object[key] = value;
  20607. }
  20608. }
  20609. /**
  20610. * The base implementation of `_.at` without support for individual paths.
  20611. *
  20612. * @private
  20613. * @param {Object} object The object to iterate over.
  20614. * @param {string[]} paths The property paths to pick.
  20615. * @returns {Array} Returns the picked elements.
  20616. */
  20617. function baseAt(object, paths) {
  20618. var index = -1,
  20619. length = paths.length,
  20620. result = Array(length),
  20621. skip = object == null;
  20622. while (++index < length) {
  20623. result[index] = skip ? undefined : get(object, paths[index]);
  20624. }
  20625. return result;
  20626. }
  20627. /**
  20628. * The base implementation of `_.clamp` which doesn't coerce arguments.
  20629. *
  20630. * @private
  20631. * @param {number} number The number to clamp.
  20632. * @param {number} [lower] The lower bound.
  20633. * @param {number} upper The upper bound.
  20634. * @returns {number} Returns the clamped number.
  20635. */
  20636. function baseClamp(number, lower, upper) {
  20637. if (number === number) {
  20638. if (upper !== undefined) {
  20639. number = number <= upper ? number : upper;
  20640. }
  20641. if (lower !== undefined) {
  20642. number = number >= lower ? number : lower;
  20643. }
  20644. }
  20645. return number;
  20646. }
  20647. /**
  20648. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  20649. * traversed objects.
  20650. *
  20651. * @private
  20652. * @param {*} value The value to clone.
  20653. * @param {boolean} bitmask The bitmask flags.
  20654. * 1 - Deep clone
  20655. * 2 - Flatten inherited properties
  20656. * 4 - Clone symbols
  20657. * @param {Function} [customizer] The function to customize cloning.
  20658. * @param {string} [key] The key of `value`.
  20659. * @param {Object} [object] The parent object of `value`.
  20660. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  20661. * @returns {*} Returns the cloned value.
  20662. */
  20663. function baseClone(value, bitmask, customizer, key, object, stack) {
  20664. var result,
  20665. isDeep = bitmask & CLONE_DEEP_FLAG,
  20666. isFlat = bitmask & CLONE_FLAT_FLAG,
  20667. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  20668. if (customizer) {
  20669. result = object ? customizer(value, key, object, stack) : customizer(value);
  20670. }
  20671. if (result !== undefined) {
  20672. return result;
  20673. }
  20674. if (!isObject(value)) {
  20675. return value;
  20676. }
  20677. var isArr = isArray(value);
  20678. if (isArr) {
  20679. result = initCloneArray(value);
  20680. if (!isDeep) {
  20681. return copyArray(value, result);
  20682. }
  20683. } else {
  20684. var tag = getTag(value),
  20685. isFunc = tag == funcTag || tag == genTag;
  20686. if (isBuffer(value)) {
  20687. return cloneBuffer(value, isDeep);
  20688. }
  20689. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  20690. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  20691. if (!isDeep) {
  20692. return isFlat
  20693. ? copySymbolsIn(value, baseAssignIn(result, value))
  20694. : copySymbols(value, baseAssign(result, value));
  20695. }
  20696. } else {
  20697. if (!cloneableTags[tag]) {
  20698. return object ? value : {};
  20699. }
  20700. result = initCloneByTag(value, tag, isDeep);
  20701. }
  20702. }
  20703. // Check for circular references and return its corresponding clone.
  20704. stack || (stack = new Stack);
  20705. var stacked = stack.get(value);
  20706. if (stacked) {
  20707. return stacked;
  20708. }
  20709. stack.set(value, result);
  20710. if (isSet(value)) {
  20711. value.forEach(function(subValue) {
  20712. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  20713. });
  20714. } else if (isMap(value)) {
  20715. value.forEach(function(subValue, key) {
  20716. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20717. });
  20718. }
  20719. var keysFunc = isFull
  20720. ? (isFlat ? getAllKeysIn : getAllKeys)
  20721. : (isFlat ? keysIn : keys);
  20722. var props = isArr ? undefined : keysFunc(value);
  20723. arrayEach(props || value, function(subValue, key) {
  20724. if (props) {
  20725. key = subValue;
  20726. subValue = value[key];
  20727. }
  20728. // Recursively populate clone (susceptible to call stack limits).
  20729. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20730. });
  20731. return result;
  20732. }
  20733. /**
  20734. * The base implementation of `_.conforms` which doesn't clone `source`.
  20735. *
  20736. * @private
  20737. * @param {Object} source The object of property predicates to conform to.
  20738. * @returns {Function} Returns the new spec function.
  20739. */
  20740. function baseConforms(source) {
  20741. var props = keys(source);
  20742. return function(object) {
  20743. return baseConformsTo(object, source, props);
  20744. };
  20745. }
  20746. /**
  20747. * The base implementation of `_.conformsTo` which accepts `props` to check.
  20748. *
  20749. * @private
  20750. * @param {Object} object The object to inspect.
  20751. * @param {Object} source The object of property predicates to conform to.
  20752. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  20753. */
  20754. function baseConformsTo(object, source, props) {
  20755. var length = props.length;
  20756. if (object == null) {
  20757. return !length;
  20758. }
  20759. object = Object(object);
  20760. while (length--) {
  20761. var key = props[length],
  20762. predicate = source[key],
  20763. value = object[key];
  20764. if ((value === undefined && !(key in object)) || !predicate(value)) {
  20765. return false;
  20766. }
  20767. }
  20768. return true;
  20769. }
  20770. /**
  20771. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  20772. * to provide to `func`.
  20773. *
  20774. * @private
  20775. * @param {Function} func The function to delay.
  20776. * @param {number} wait The number of milliseconds to delay invocation.
  20777. * @param {Array} args The arguments to provide to `func`.
  20778. * @returns {number|Object} Returns the timer id or timeout object.
  20779. */
  20780. function baseDelay(func, wait, args) {
  20781. if (typeof func != 'function') {
  20782. throw new TypeError(FUNC_ERROR_TEXT);
  20783. }
  20784. return setTimeout(function() { func.apply(undefined, args); }, wait);
  20785. }
  20786. /**
  20787. * The base implementation of methods like `_.difference` without support
  20788. * for excluding multiple arrays or iteratee shorthands.
  20789. *
  20790. * @private
  20791. * @param {Array} array The array to inspect.
  20792. * @param {Array} values The values to exclude.
  20793. * @param {Function} [iteratee] The iteratee invoked per element.
  20794. * @param {Function} [comparator] The comparator invoked per element.
  20795. * @returns {Array} Returns the new array of filtered values.
  20796. */
  20797. function baseDifference(array, values, iteratee, comparator) {
  20798. var index = -1,
  20799. includes = arrayIncludes,
  20800. isCommon = true,
  20801. length = array.length,
  20802. result = [],
  20803. valuesLength = values.length;
  20804. if (!length) {
  20805. return result;
  20806. }
  20807. if (iteratee) {
  20808. values = arrayMap(values, baseUnary(iteratee));
  20809. }
  20810. if (comparator) {
  20811. includes = arrayIncludesWith;
  20812. isCommon = false;
  20813. }
  20814. else if (values.length >= LARGE_ARRAY_SIZE) {
  20815. includes = cacheHas;
  20816. isCommon = false;
  20817. values = new SetCache(values);
  20818. }
  20819. outer:
  20820. while (++index < length) {
  20821. var value = array[index],
  20822. computed = iteratee == null ? value : iteratee(value);
  20823. value = (comparator || value !== 0) ? value : 0;
  20824. if (isCommon && computed === computed) {
  20825. var valuesIndex = valuesLength;
  20826. while (valuesIndex--) {
  20827. if (values[valuesIndex] === computed) {
  20828. continue outer;
  20829. }
  20830. }
  20831. result.push(value);
  20832. }
  20833. else if (!includes(values, computed, comparator)) {
  20834. result.push(value);
  20835. }
  20836. }
  20837. return result;
  20838. }
  20839. /**
  20840. * The base implementation of `_.forEach` without support for iteratee shorthands.
  20841. *
  20842. * @private
  20843. * @param {Array|Object} collection The collection to iterate over.
  20844. * @param {Function} iteratee The function invoked per iteration.
  20845. * @returns {Array|Object} Returns `collection`.
  20846. */
  20847. var baseEach = createBaseEach(baseForOwn);
  20848. /**
  20849. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  20850. *
  20851. * @private
  20852. * @param {Array|Object} collection The collection to iterate over.
  20853. * @param {Function} iteratee The function invoked per iteration.
  20854. * @returns {Array|Object} Returns `collection`.
  20855. */
  20856. var baseEachRight = createBaseEach(baseForOwnRight, true);
  20857. /**
  20858. * The base implementation of `_.every` without support for iteratee shorthands.
  20859. *
  20860. * @private
  20861. * @param {Array|Object} collection The collection to iterate over.
  20862. * @param {Function} predicate The function invoked per iteration.
  20863. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  20864. * else `false`
  20865. */
  20866. function baseEvery(collection, predicate) {
  20867. var result = true;
  20868. baseEach(collection, function(value, index, collection) {
  20869. result = !!predicate(value, index, collection);
  20870. return result;
  20871. });
  20872. return result;
  20873. }
  20874. /**
  20875. * The base implementation of methods like `_.max` and `_.min` which accepts a
  20876. * `comparator` to determine the extremum value.
  20877. *
  20878. * @private
  20879. * @param {Array} array The array to iterate over.
  20880. * @param {Function} iteratee The iteratee invoked per iteration.
  20881. * @param {Function} comparator The comparator used to compare values.
  20882. * @returns {*} Returns the extremum value.
  20883. */
  20884. function baseExtremum(array, iteratee, comparator) {
  20885. var index = -1,
  20886. length = array.length;
  20887. while (++index < length) {
  20888. var value = array[index],
  20889. current = iteratee(value);
  20890. if (current != null && (computed === undefined
  20891. ? (current === current && !isSymbol(current))
  20892. : comparator(current, computed)
  20893. )) {
  20894. var computed = current,
  20895. result = value;
  20896. }
  20897. }
  20898. return result;
  20899. }
  20900. /**
  20901. * The base implementation of `_.fill` without an iteratee call guard.
  20902. *
  20903. * @private
  20904. * @param {Array} array The array to fill.
  20905. * @param {*} value The value to fill `array` with.
  20906. * @param {number} [start=0] The start position.
  20907. * @param {number} [end=array.length] The end position.
  20908. * @returns {Array} Returns `array`.
  20909. */
  20910. function baseFill(array, value, start, end) {
  20911. var length = array.length;
  20912. start = toInteger(start);
  20913. if (start < 0) {
  20914. start = -start > length ? 0 : (length + start);
  20915. }
  20916. end = (end === undefined || end > length) ? length : toInteger(end);
  20917. if (end < 0) {
  20918. end += length;
  20919. }
  20920. end = start > end ? 0 : toLength(end);
  20921. while (start < end) {
  20922. array[start++] = value;
  20923. }
  20924. return array;
  20925. }
  20926. /**
  20927. * The base implementation of `_.filter` without support for iteratee shorthands.
  20928. *
  20929. * @private
  20930. * @param {Array|Object} collection The collection to iterate over.
  20931. * @param {Function} predicate The function invoked per iteration.
  20932. * @returns {Array} Returns the new filtered array.
  20933. */
  20934. function baseFilter(collection, predicate) {
  20935. var result = [];
  20936. baseEach(collection, function(value, index, collection) {
  20937. if (predicate(value, index, collection)) {
  20938. result.push(value);
  20939. }
  20940. });
  20941. return result;
  20942. }
  20943. /**
  20944. * The base implementation of `_.flatten` with support for restricting flattening.
  20945. *
  20946. * @private
  20947. * @param {Array} array The array to flatten.
  20948. * @param {number} depth The maximum recursion depth.
  20949. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  20950. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  20951. * @param {Array} [result=[]] The initial result value.
  20952. * @returns {Array} Returns the new flattened array.
  20953. */
  20954. function baseFlatten(array, depth, predicate, isStrict, result) {
  20955. var index = -1,
  20956. length = array.length;
  20957. predicate || (predicate = isFlattenable);
  20958. result || (result = []);
  20959. while (++index < length) {
  20960. var value = array[index];
  20961. if (depth > 0 && predicate(value)) {
  20962. if (depth > 1) {
  20963. // Recursively flatten arrays (susceptible to call stack limits).
  20964. baseFlatten(value, depth - 1, predicate, isStrict, result);
  20965. } else {
  20966. arrayPush(result, value);
  20967. }
  20968. } else if (!isStrict) {
  20969. result[result.length] = value;
  20970. }
  20971. }
  20972. return result;
  20973. }
  20974. /**
  20975. * The base implementation of `baseForOwn` which iterates over `object`
  20976. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  20977. * Iteratee functions may exit iteration early by explicitly returning `false`.
  20978. *
  20979. * @private
  20980. * @param {Object} object The object to iterate over.
  20981. * @param {Function} iteratee The function invoked per iteration.
  20982. * @param {Function} keysFunc The function to get the keys of `object`.
  20983. * @returns {Object} Returns `object`.
  20984. */
  20985. var baseFor = createBaseFor();
  20986. /**
  20987. * This function is like `baseFor` except that it iterates over properties
  20988. * in the opposite order.
  20989. *
  20990. * @private
  20991. * @param {Object} object The object to iterate over.
  20992. * @param {Function} iteratee The function invoked per iteration.
  20993. * @param {Function} keysFunc The function to get the keys of `object`.
  20994. * @returns {Object} Returns `object`.
  20995. */
  20996. var baseForRight = createBaseFor(true);
  20997. /**
  20998. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  20999. *
  21000. * @private
  21001. * @param {Object} object The object to iterate over.
  21002. * @param {Function} iteratee The function invoked per iteration.
  21003. * @returns {Object} Returns `object`.
  21004. */
  21005. function baseForOwn(object, iteratee) {
  21006. return object && baseFor(object, iteratee, keys);
  21007. }
  21008. /**
  21009. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  21010. *
  21011. * @private
  21012. * @param {Object} object The object to iterate over.
  21013. * @param {Function} iteratee The function invoked per iteration.
  21014. * @returns {Object} Returns `object`.
  21015. */
  21016. function baseForOwnRight(object, iteratee) {
  21017. return object && baseForRight(object, iteratee, keys);
  21018. }
  21019. /**
  21020. * The base implementation of `_.functions` which creates an array of
  21021. * `object` function property names filtered from `props`.
  21022. *
  21023. * @private
  21024. * @param {Object} object The object to inspect.
  21025. * @param {Array} props The property names to filter.
  21026. * @returns {Array} Returns the function names.
  21027. */
  21028. function baseFunctions(object, props) {
  21029. return arrayFilter(props, function(key) {
  21030. return isFunction(object[key]);
  21031. });
  21032. }
  21033. /**
  21034. * The base implementation of `_.get` without support for default values.
  21035. *
  21036. * @private
  21037. * @param {Object} object The object to query.
  21038. * @param {Array|string} path The path of the property to get.
  21039. * @returns {*} Returns the resolved value.
  21040. */
  21041. function baseGet(object, path) {
  21042. path = castPath(path, object);
  21043. var index = 0,
  21044. length = path.length;
  21045. while (object != null && index < length) {
  21046. object = object[toKey(path[index++])];
  21047. }
  21048. return (index && index == length) ? object : undefined;
  21049. }
  21050. /**
  21051. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  21052. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  21053. * symbols of `object`.
  21054. *
  21055. * @private
  21056. * @param {Object} object The object to query.
  21057. * @param {Function} keysFunc The function to get the keys of `object`.
  21058. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  21059. * @returns {Array} Returns the array of property names and symbols.
  21060. */
  21061. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  21062. var result = keysFunc(object);
  21063. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  21064. }
  21065. /**
  21066. * The base implementation of `getTag` without fallbacks for buggy environments.
  21067. *
  21068. * @private
  21069. * @param {*} value The value to query.
  21070. * @returns {string} Returns the `toStringTag`.
  21071. */
  21072. function baseGetTag(value) {
  21073. if (value == null) {
  21074. return value === undefined ? undefinedTag : nullTag;
  21075. }
  21076. return (symToStringTag && symToStringTag in Object(value))
  21077. ? getRawTag(value)
  21078. : objectToString(value);
  21079. }
  21080. /**
  21081. * The base implementation of `_.gt` which doesn't coerce arguments.
  21082. *
  21083. * @private
  21084. * @param {*} value The value to compare.
  21085. * @param {*} other The other value to compare.
  21086. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  21087. * else `false`.
  21088. */
  21089. function baseGt(value, other) {
  21090. return value > other;
  21091. }
  21092. /**
  21093. * The base implementation of `_.has` without support for deep paths.
  21094. *
  21095. * @private
  21096. * @param {Object} [object] The object to query.
  21097. * @param {Array|string} key The key to check.
  21098. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21099. */
  21100. function baseHas(object, key) {
  21101. return object != null && hasOwnProperty.call(object, key);
  21102. }
  21103. /**
  21104. * The base implementation of `_.hasIn` without support for deep paths.
  21105. *
  21106. * @private
  21107. * @param {Object} [object] The object to query.
  21108. * @param {Array|string} key The key to check.
  21109. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21110. */
  21111. function baseHasIn(object, key) {
  21112. return object != null && key in Object(object);
  21113. }
  21114. /**
  21115. * The base implementation of `_.inRange` which doesn't coerce arguments.
  21116. *
  21117. * @private
  21118. * @param {number} number The number to check.
  21119. * @param {number} start The start of the range.
  21120. * @param {number} end The end of the range.
  21121. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  21122. */
  21123. function baseInRange(number, start, end) {
  21124. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  21125. }
  21126. /**
  21127. * The base implementation of methods like `_.intersection`, without support
  21128. * for iteratee shorthands, that accepts an array of arrays to inspect.
  21129. *
  21130. * @private
  21131. * @param {Array} arrays The arrays to inspect.
  21132. * @param {Function} [iteratee] The iteratee invoked per element.
  21133. * @param {Function} [comparator] The comparator invoked per element.
  21134. * @returns {Array} Returns the new array of shared values.
  21135. */
  21136. function baseIntersection(arrays, iteratee, comparator) {
  21137. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  21138. length = arrays[0].length,
  21139. othLength = arrays.length,
  21140. othIndex = othLength,
  21141. caches = Array(othLength),
  21142. maxLength = Infinity,
  21143. result = [];
  21144. while (othIndex--) {
  21145. var array = arrays[othIndex];
  21146. if (othIndex && iteratee) {
  21147. array = arrayMap(array, baseUnary(iteratee));
  21148. }
  21149. maxLength = nativeMin(array.length, maxLength);
  21150. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  21151. ? new SetCache(othIndex && array)
  21152. : undefined;
  21153. }
  21154. array = arrays[0];
  21155. var index = -1,
  21156. seen = caches[0];
  21157. outer:
  21158. while (++index < length && result.length < maxLength) {
  21159. var value = array[index],
  21160. computed = iteratee ? iteratee(value) : value;
  21161. value = (comparator || value !== 0) ? value : 0;
  21162. if (!(seen
  21163. ? cacheHas(seen, computed)
  21164. : includes(result, computed, comparator)
  21165. )) {
  21166. othIndex = othLength;
  21167. while (--othIndex) {
  21168. var cache = caches[othIndex];
  21169. if (!(cache
  21170. ? cacheHas(cache, computed)
  21171. : includes(arrays[othIndex], computed, comparator))
  21172. ) {
  21173. continue outer;
  21174. }
  21175. }
  21176. if (seen) {
  21177. seen.push(computed);
  21178. }
  21179. result.push(value);
  21180. }
  21181. }
  21182. return result;
  21183. }
  21184. /**
  21185. * The base implementation of `_.invert` and `_.invertBy` which inverts
  21186. * `object` with values transformed by `iteratee` and set by `setter`.
  21187. *
  21188. * @private
  21189. * @param {Object} object The object to iterate over.
  21190. * @param {Function} setter The function to set `accumulator` values.
  21191. * @param {Function} iteratee The iteratee to transform values.
  21192. * @param {Object} accumulator The initial inverted object.
  21193. * @returns {Function} Returns `accumulator`.
  21194. */
  21195. function baseInverter(object, setter, iteratee, accumulator) {
  21196. baseForOwn(object, function(value, key, object) {
  21197. setter(accumulator, iteratee(value), key, object);
  21198. });
  21199. return accumulator;
  21200. }
  21201. /**
  21202. * The base implementation of `_.invoke` without support for individual
  21203. * method arguments.
  21204. *
  21205. * @private
  21206. * @param {Object} object The object to query.
  21207. * @param {Array|string} path The path of the method to invoke.
  21208. * @param {Array} args The arguments to invoke the method with.
  21209. * @returns {*} Returns the result of the invoked method.
  21210. */
  21211. function baseInvoke(object, path, args) {
  21212. path = castPath(path, object);
  21213. object = parent(object, path);
  21214. var func = object == null ? object : object[toKey(last(path))];
  21215. return func == null ? undefined : apply(func, object, args);
  21216. }
  21217. /**
  21218. * The base implementation of `_.isArguments`.
  21219. *
  21220. * @private
  21221. * @param {*} value The value to check.
  21222. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  21223. */
  21224. function baseIsArguments(value) {
  21225. return isObjectLike(value) && baseGetTag(value) == argsTag;
  21226. }
  21227. /**
  21228. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  21229. *
  21230. * @private
  21231. * @param {*} value The value to check.
  21232. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  21233. */
  21234. function baseIsArrayBuffer(value) {
  21235. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  21236. }
  21237. /**
  21238. * The base implementation of `_.isDate` without Node.js optimizations.
  21239. *
  21240. * @private
  21241. * @param {*} value The value to check.
  21242. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  21243. */
  21244. function baseIsDate(value) {
  21245. return isObjectLike(value) && baseGetTag(value) == dateTag;
  21246. }
  21247. /**
  21248. * The base implementation of `_.isEqual` which supports partial comparisons
  21249. * and tracks traversed objects.
  21250. *
  21251. * @private
  21252. * @param {*} value The value to compare.
  21253. * @param {*} other The other value to compare.
  21254. * @param {boolean} bitmask The bitmask flags.
  21255. * 1 - Unordered comparison
  21256. * 2 - Partial comparison
  21257. * @param {Function} [customizer] The function to customize comparisons.
  21258. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  21259. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  21260. */
  21261. function baseIsEqual(value, other, bitmask, customizer, stack) {
  21262. if (value === other) {
  21263. return true;
  21264. }
  21265. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  21266. return value !== value && other !== other;
  21267. }
  21268. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  21269. }
  21270. /**
  21271. * A specialized version of `baseIsEqual` for arrays and objects which performs
  21272. * deep comparisons and tracks traversed objects enabling objects with circular
  21273. * references to be compared.
  21274. *
  21275. * @private
  21276. * @param {Object} object The object to compare.
  21277. * @param {Object} other The other object to compare.
  21278. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  21279. * @param {Function} customizer The function to customize comparisons.
  21280. * @param {Function} equalFunc The function to determine equivalents of values.
  21281. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  21282. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  21283. */
  21284. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  21285. var objIsArr = isArray(object),
  21286. othIsArr = isArray(other),
  21287. objTag = objIsArr ? arrayTag : getTag(object),
  21288. othTag = othIsArr ? arrayTag : getTag(other);
  21289. objTag = objTag == argsTag ? objectTag : objTag;
  21290. othTag = othTag == argsTag ? objectTag : othTag;
  21291. var objIsObj = objTag == objectTag,
  21292. othIsObj = othTag == objectTag,
  21293. isSameTag = objTag == othTag;
  21294. if (isSameTag && isBuffer(object)) {
  21295. if (!isBuffer(other)) {
  21296. return false;
  21297. }
  21298. objIsArr = true;
  21299. objIsObj = false;
  21300. }
  21301. if (isSameTag && !objIsObj) {
  21302. stack || (stack = new Stack);
  21303. return (objIsArr || isTypedArray(object))
  21304. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  21305. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  21306. }
  21307. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  21308. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  21309. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  21310. if (objIsWrapped || othIsWrapped) {
  21311. var objUnwrapped = objIsWrapped ? object.value() : object,
  21312. othUnwrapped = othIsWrapped ? other.value() : other;
  21313. stack || (stack = new Stack);
  21314. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  21315. }
  21316. }
  21317. if (!isSameTag) {
  21318. return false;
  21319. }
  21320. stack || (stack = new Stack);
  21321. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  21322. }
  21323. /**
  21324. * The base implementation of `_.isMap` without Node.js optimizations.
  21325. *
  21326. * @private
  21327. * @param {*} value The value to check.
  21328. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  21329. */
  21330. function baseIsMap(value) {
  21331. return isObjectLike(value) && getTag(value) == mapTag;
  21332. }
  21333. /**
  21334. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  21335. *
  21336. * @private
  21337. * @param {Object} object The object to inspect.
  21338. * @param {Object} source The object of property values to match.
  21339. * @param {Array} matchData The property names, values, and compare flags to match.
  21340. * @param {Function} [customizer] The function to customize comparisons.
  21341. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  21342. */
  21343. function baseIsMatch(object, source, matchData, customizer) {
  21344. var index = matchData.length,
  21345. length = index,
  21346. noCustomizer = !customizer;
  21347. if (object == null) {
  21348. return !length;
  21349. }
  21350. object = Object(object);
  21351. while (index--) {
  21352. var data = matchData[index];
  21353. if ((noCustomizer && data[2])
  21354. ? data[1] !== object[data[0]]
  21355. : !(data[0] in object)
  21356. ) {
  21357. return false;
  21358. }
  21359. }
  21360. while (++index < length) {
  21361. data = matchData[index];
  21362. var key = data[0],
  21363. objValue = object[key],
  21364. srcValue = data[1];
  21365. if (noCustomizer && data[2]) {
  21366. if (objValue === undefined && !(key in object)) {
  21367. return false;
  21368. }
  21369. } else {
  21370. var stack = new Stack;
  21371. if (customizer) {
  21372. var result = customizer(objValue, srcValue, key, object, source, stack);
  21373. }
  21374. if (!(result === undefined
  21375. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  21376. : result
  21377. )) {
  21378. return false;
  21379. }
  21380. }
  21381. }
  21382. return true;
  21383. }
  21384. /**
  21385. * The base implementation of `_.isNative` without bad shim checks.
  21386. *
  21387. * @private
  21388. * @param {*} value The value to check.
  21389. * @returns {boolean} Returns `true` if `value` is a native function,
  21390. * else `false`.
  21391. */
  21392. function baseIsNative(value) {
  21393. if (!isObject(value) || isMasked(value)) {
  21394. return false;
  21395. }
  21396. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  21397. return pattern.test(toSource(value));
  21398. }
  21399. /**
  21400. * The base implementation of `_.isRegExp` without Node.js optimizations.
  21401. *
  21402. * @private
  21403. * @param {*} value The value to check.
  21404. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  21405. */
  21406. function baseIsRegExp(value) {
  21407. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  21408. }
  21409. /**
  21410. * The base implementation of `_.isSet` without Node.js optimizations.
  21411. *
  21412. * @private
  21413. * @param {*} value The value to check.
  21414. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  21415. */
  21416. function baseIsSet(value) {
  21417. return isObjectLike(value) && getTag(value) == setTag;
  21418. }
  21419. /**
  21420. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  21421. *
  21422. * @private
  21423. * @param {*} value The value to check.
  21424. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  21425. */
  21426. function baseIsTypedArray(value) {
  21427. return isObjectLike(value) &&
  21428. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  21429. }
  21430. /**
  21431. * The base implementation of `_.iteratee`.
  21432. *
  21433. * @private
  21434. * @param {*} [value=_.identity] The value to convert to an iteratee.
  21435. * @returns {Function} Returns the iteratee.
  21436. */
  21437. function baseIteratee(value) {
  21438. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  21439. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  21440. if (typeof value == 'function') {
  21441. return value;
  21442. }
  21443. if (value == null) {
  21444. return identity;
  21445. }
  21446. if (typeof value == 'object') {
  21447. return isArray(value)
  21448. ? baseMatchesProperty(value[0], value[1])
  21449. : baseMatches(value);
  21450. }
  21451. return property(value);
  21452. }
  21453. /**
  21454. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  21455. *
  21456. * @private
  21457. * @param {Object} object The object to query.
  21458. * @returns {Array} Returns the array of property names.
  21459. */
  21460. function baseKeys(object) {
  21461. if (!isPrototype(object)) {
  21462. return nativeKeys(object);
  21463. }
  21464. var result = [];
  21465. for (var key in Object(object)) {
  21466. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  21467. result.push(key);
  21468. }
  21469. }
  21470. return result;
  21471. }
  21472. /**
  21473. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  21474. *
  21475. * @private
  21476. * @param {Object} object The object to query.
  21477. * @returns {Array} Returns the array of property names.
  21478. */
  21479. function baseKeysIn(object) {
  21480. if (!isObject(object)) {
  21481. return nativeKeysIn(object);
  21482. }
  21483. var isProto = isPrototype(object),
  21484. result = [];
  21485. for (var key in object) {
  21486. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  21487. result.push(key);
  21488. }
  21489. }
  21490. return result;
  21491. }
  21492. /**
  21493. * The base implementation of `_.lt` which doesn't coerce arguments.
  21494. *
  21495. * @private
  21496. * @param {*} value The value to compare.
  21497. * @param {*} other The other value to compare.
  21498. * @returns {boolean} Returns `true` if `value` is less than `other`,
  21499. * else `false`.
  21500. */
  21501. function baseLt(value, other) {
  21502. return value < other;
  21503. }
  21504. /**
  21505. * The base implementation of `_.map` without support for iteratee shorthands.
  21506. *
  21507. * @private
  21508. * @param {Array|Object} collection The collection to iterate over.
  21509. * @param {Function} iteratee The function invoked per iteration.
  21510. * @returns {Array} Returns the new mapped array.
  21511. */
  21512. function baseMap(collection, iteratee) {
  21513. var index = -1,
  21514. result = isArrayLike(collection) ? Array(collection.length) : [];
  21515. baseEach(collection, function(value, key, collection) {
  21516. result[++index] = iteratee(value, key, collection);
  21517. });
  21518. return result;
  21519. }
  21520. /**
  21521. * The base implementation of `_.matches` which doesn't clone `source`.
  21522. *
  21523. * @private
  21524. * @param {Object} source The object of property values to match.
  21525. * @returns {Function} Returns the new spec function.
  21526. */
  21527. function baseMatches(source) {
  21528. var matchData = getMatchData(source);
  21529. if (matchData.length == 1 && matchData[0][2]) {
  21530. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  21531. }
  21532. return function(object) {
  21533. return object === source || baseIsMatch(object, source, matchData);
  21534. };
  21535. }
  21536. /**
  21537. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  21538. *
  21539. * @private
  21540. * @param {string} path The path of the property to get.
  21541. * @param {*} srcValue The value to match.
  21542. * @returns {Function} Returns the new spec function.
  21543. */
  21544. function baseMatchesProperty(path, srcValue) {
  21545. if (isKey(path) && isStrictComparable(srcValue)) {
  21546. return matchesStrictComparable(toKey(path), srcValue);
  21547. }
  21548. return function(object) {
  21549. var objValue = get(object, path);
  21550. return (objValue === undefined && objValue === srcValue)
  21551. ? hasIn(object, path)
  21552. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  21553. };
  21554. }
  21555. /**
  21556. * The base implementation of `_.merge` without support for multiple sources.
  21557. *
  21558. * @private
  21559. * @param {Object} object The destination object.
  21560. * @param {Object} source The source object.
  21561. * @param {number} srcIndex The index of `source`.
  21562. * @param {Function} [customizer] The function to customize merged values.
  21563. * @param {Object} [stack] Tracks traversed source values and their merged
  21564. * counterparts.
  21565. */
  21566. function baseMerge(object, source, srcIndex, customizer, stack) {
  21567. if (object === source) {
  21568. return;
  21569. }
  21570. baseFor(source, function(srcValue, key) {
  21571. stack || (stack = new Stack);
  21572. if (isObject(srcValue)) {
  21573. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  21574. }
  21575. else {
  21576. var newValue = customizer
  21577. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  21578. : undefined;
  21579. if (newValue === undefined) {
  21580. newValue = srcValue;
  21581. }
  21582. assignMergeValue(object, key, newValue);
  21583. }
  21584. }, keysIn);
  21585. }
  21586. /**
  21587. * A specialized version of `baseMerge` for arrays and objects which performs
  21588. * deep merges and tracks traversed objects enabling objects with circular
  21589. * references to be merged.
  21590. *
  21591. * @private
  21592. * @param {Object} object The destination object.
  21593. * @param {Object} source The source object.
  21594. * @param {string} key The key of the value to merge.
  21595. * @param {number} srcIndex The index of `source`.
  21596. * @param {Function} mergeFunc The function to merge values.
  21597. * @param {Function} [customizer] The function to customize assigned values.
  21598. * @param {Object} [stack] Tracks traversed source values and their merged
  21599. * counterparts.
  21600. */
  21601. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  21602. var objValue = safeGet(object, key),
  21603. srcValue = safeGet(source, key),
  21604. stacked = stack.get(srcValue);
  21605. if (stacked) {
  21606. assignMergeValue(object, key, stacked);
  21607. return;
  21608. }
  21609. var newValue = customizer
  21610. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  21611. : undefined;
  21612. var isCommon = newValue === undefined;
  21613. if (isCommon) {
  21614. var isArr = isArray(srcValue),
  21615. isBuff = !isArr && isBuffer(srcValue),
  21616. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  21617. newValue = srcValue;
  21618. if (isArr || isBuff || isTyped) {
  21619. if (isArray(objValue)) {
  21620. newValue = objValue;
  21621. }
  21622. else if (isArrayLikeObject(objValue)) {
  21623. newValue = copyArray(objValue);
  21624. }
  21625. else if (isBuff) {
  21626. isCommon = false;
  21627. newValue = cloneBuffer(srcValue, true);
  21628. }
  21629. else if (isTyped) {
  21630. isCommon = false;
  21631. newValue = cloneTypedArray(srcValue, true);
  21632. }
  21633. else {
  21634. newValue = [];
  21635. }
  21636. }
  21637. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  21638. newValue = objValue;
  21639. if (isArguments(objValue)) {
  21640. newValue = toPlainObject(objValue);
  21641. }
  21642. else if (!isObject(objValue) || isFunction(objValue)) {
  21643. newValue = initCloneObject(srcValue);
  21644. }
  21645. }
  21646. else {
  21647. isCommon = false;
  21648. }
  21649. }
  21650. if (isCommon) {
  21651. // Recursively merge objects and arrays (susceptible to call stack limits).
  21652. stack.set(srcValue, newValue);
  21653. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  21654. stack['delete'](srcValue);
  21655. }
  21656. assignMergeValue(object, key, newValue);
  21657. }
  21658. /**
  21659. * The base implementation of `_.nth` which doesn't coerce arguments.
  21660. *
  21661. * @private
  21662. * @param {Array} array The array to query.
  21663. * @param {number} n The index of the element to return.
  21664. * @returns {*} Returns the nth element of `array`.
  21665. */
  21666. function baseNth(array, n) {
  21667. var length = array.length;
  21668. if (!length) {
  21669. return;
  21670. }
  21671. n += n < 0 ? length : 0;
  21672. return isIndex(n, length) ? array[n] : undefined;
  21673. }
  21674. /**
  21675. * The base implementation of `_.orderBy` without param guards.
  21676. *
  21677. * @private
  21678. * @param {Array|Object} collection The collection to iterate over.
  21679. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  21680. * @param {string[]} orders The sort orders of `iteratees`.
  21681. * @returns {Array} Returns the new sorted array.
  21682. */
  21683. function baseOrderBy(collection, iteratees, orders) {
  21684. var index = -1;
  21685. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  21686. var result = baseMap(collection, function(value, key, collection) {
  21687. var criteria = arrayMap(iteratees, function(iteratee) {
  21688. return iteratee(value);
  21689. });
  21690. return { 'criteria': criteria, 'index': ++index, 'value': value };
  21691. });
  21692. return baseSortBy(result, function(object, other) {
  21693. return compareMultiple(object, other, orders);
  21694. });
  21695. }
  21696. /**
  21697. * The base implementation of `_.pick` without support for individual
  21698. * property identifiers.
  21699. *
  21700. * @private
  21701. * @param {Object} object The source object.
  21702. * @param {string[]} paths The property paths to pick.
  21703. * @returns {Object} Returns the new object.
  21704. */
  21705. function basePick(object, paths) {
  21706. return basePickBy(object, paths, function(value, path) {
  21707. return hasIn(object, path);
  21708. });
  21709. }
  21710. /**
  21711. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  21712. *
  21713. * @private
  21714. * @param {Object} object The source object.
  21715. * @param {string[]} paths The property paths to pick.
  21716. * @param {Function} predicate The function invoked per property.
  21717. * @returns {Object} Returns the new object.
  21718. */
  21719. function basePickBy(object, paths, predicate) {
  21720. var index = -1,
  21721. length = paths.length,
  21722. result = {};
  21723. while (++index < length) {
  21724. var path = paths[index],
  21725. value = baseGet(object, path);
  21726. if (predicate(value, path)) {
  21727. baseSet(result, castPath(path, object), value);
  21728. }
  21729. }
  21730. return result;
  21731. }
  21732. /**
  21733. * A specialized version of `baseProperty` which supports deep paths.
  21734. *
  21735. * @private
  21736. * @param {Array|string} path The path of the property to get.
  21737. * @returns {Function} Returns the new accessor function.
  21738. */
  21739. function basePropertyDeep(path) {
  21740. return function(object) {
  21741. return baseGet(object, path);
  21742. };
  21743. }
  21744. /**
  21745. * The base implementation of `_.pullAllBy` without support for iteratee
  21746. * shorthands.
  21747. *
  21748. * @private
  21749. * @param {Array} array The array to modify.
  21750. * @param {Array} values The values to remove.
  21751. * @param {Function} [iteratee] The iteratee invoked per element.
  21752. * @param {Function} [comparator] The comparator invoked per element.
  21753. * @returns {Array} Returns `array`.
  21754. */
  21755. function basePullAll(array, values, iteratee, comparator) {
  21756. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  21757. index = -1,
  21758. length = values.length,
  21759. seen = array;
  21760. if (array === values) {
  21761. values = copyArray(values);
  21762. }
  21763. if (iteratee) {
  21764. seen = arrayMap(array, baseUnary(iteratee));
  21765. }
  21766. while (++index < length) {
  21767. var fromIndex = 0,
  21768. value = values[index],
  21769. computed = iteratee ? iteratee(value) : value;
  21770. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  21771. if (seen !== array) {
  21772. splice.call(seen, fromIndex, 1);
  21773. }
  21774. splice.call(array, fromIndex, 1);
  21775. }
  21776. }
  21777. return array;
  21778. }
  21779. /**
  21780. * The base implementation of `_.pullAt` without support for individual
  21781. * indexes or capturing the removed elements.
  21782. *
  21783. * @private
  21784. * @param {Array} array The array to modify.
  21785. * @param {number[]} indexes The indexes of elements to remove.
  21786. * @returns {Array} Returns `array`.
  21787. */
  21788. function basePullAt(array, indexes) {
  21789. var length = array ? indexes.length : 0,
  21790. lastIndex = length - 1;
  21791. while (length--) {
  21792. var index = indexes[length];
  21793. if (length == lastIndex || index !== previous) {
  21794. var previous = index;
  21795. if (isIndex(index)) {
  21796. splice.call(array, index, 1);
  21797. } else {
  21798. baseUnset(array, index);
  21799. }
  21800. }
  21801. }
  21802. return array;
  21803. }
  21804. /**
  21805. * The base implementation of `_.random` without support for returning
  21806. * floating-point numbers.
  21807. *
  21808. * @private
  21809. * @param {number} lower The lower bound.
  21810. * @param {number} upper The upper bound.
  21811. * @returns {number} Returns the random number.
  21812. */
  21813. function baseRandom(lower, upper) {
  21814. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  21815. }
  21816. /**
  21817. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  21818. * coerce arguments.
  21819. *
  21820. * @private
  21821. * @param {number} start The start of the range.
  21822. * @param {number} end The end of the range.
  21823. * @param {number} step The value to increment or decrement by.
  21824. * @param {boolean} [fromRight] Specify iterating from right to left.
  21825. * @returns {Array} Returns the range of numbers.
  21826. */
  21827. function baseRange(start, end, step, fromRight) {
  21828. var index = -1,
  21829. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  21830. result = Array(length);
  21831. while (length--) {
  21832. result[fromRight ? length : ++index] = start;
  21833. start += step;
  21834. }
  21835. return result;
  21836. }
  21837. /**
  21838. * The base implementation of `_.repeat` which doesn't coerce arguments.
  21839. *
  21840. * @private
  21841. * @param {string} string The string to repeat.
  21842. * @param {number} n The number of times to repeat the string.
  21843. * @returns {string} Returns the repeated string.
  21844. */
  21845. function baseRepeat(string, n) {
  21846. var result = '';
  21847. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  21848. return result;
  21849. }
  21850. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  21851. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  21852. do {
  21853. if (n % 2) {
  21854. result += string;
  21855. }
  21856. n = nativeFloor(n / 2);
  21857. if (n) {
  21858. string += string;
  21859. }
  21860. } while (n);
  21861. return result;
  21862. }
  21863. /**
  21864. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  21865. *
  21866. * @private
  21867. * @param {Function} func The function to apply a rest parameter to.
  21868. * @param {number} [start=func.length-1] The start position of the rest parameter.
  21869. * @returns {Function} Returns the new function.
  21870. */
  21871. function baseRest(func, start) {
  21872. return setToString(overRest(func, start, identity), func + '');
  21873. }
  21874. /**
  21875. * The base implementation of `_.sample`.
  21876. *
  21877. * @private
  21878. * @param {Array|Object} collection The collection to sample.
  21879. * @returns {*} Returns the random element.
  21880. */
  21881. function baseSample(collection) {
  21882. return arraySample(values(collection));
  21883. }
  21884. /**
  21885. * The base implementation of `_.sampleSize` without param guards.
  21886. *
  21887. * @private
  21888. * @param {Array|Object} collection The collection to sample.
  21889. * @param {number} n The number of elements to sample.
  21890. * @returns {Array} Returns the random elements.
  21891. */
  21892. function baseSampleSize(collection, n) {
  21893. var array = values(collection);
  21894. return shuffleSelf(array, baseClamp(n, 0, array.length));
  21895. }
  21896. /**
  21897. * The base implementation of `_.set`.
  21898. *
  21899. * @private
  21900. * @param {Object} object The object to modify.
  21901. * @param {Array|string} path The path of the property to set.
  21902. * @param {*} value The value to set.
  21903. * @param {Function} [customizer] The function to customize path creation.
  21904. * @returns {Object} Returns `object`.
  21905. */
  21906. function baseSet(object, path, value, customizer) {
  21907. if (!isObject(object)) {
  21908. return object;
  21909. }
  21910. path = castPath(path, object);
  21911. var index = -1,
  21912. length = path.length,
  21913. lastIndex = length - 1,
  21914. nested = object;
  21915. while (nested != null && ++index < length) {
  21916. var key = toKey(path[index]),
  21917. newValue = value;
  21918. if (index != lastIndex) {
  21919. var objValue = nested[key];
  21920. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  21921. if (newValue === undefined) {
  21922. newValue = isObject(objValue)
  21923. ? objValue
  21924. : (isIndex(path[index + 1]) ? [] : {});
  21925. }
  21926. }
  21927. assignValue(nested, key, newValue);
  21928. nested = nested[key];
  21929. }
  21930. return object;
  21931. }
  21932. /**
  21933. * The base implementation of `setData` without support for hot loop shorting.
  21934. *
  21935. * @private
  21936. * @param {Function} func The function to associate metadata with.
  21937. * @param {*} data The metadata.
  21938. * @returns {Function} Returns `func`.
  21939. */
  21940. var baseSetData = !metaMap ? identity : function(func, data) {
  21941. metaMap.set(func, data);
  21942. return func;
  21943. };
  21944. /**
  21945. * The base implementation of `setToString` without support for hot loop shorting.
  21946. *
  21947. * @private
  21948. * @param {Function} func The function to modify.
  21949. * @param {Function} string The `toString` result.
  21950. * @returns {Function} Returns `func`.
  21951. */
  21952. var baseSetToString = !defineProperty ? identity : function(func, string) {
  21953. return defineProperty(func, 'toString', {
  21954. 'configurable': true,
  21955. 'enumerable': false,
  21956. 'value': constant(string),
  21957. 'writable': true
  21958. });
  21959. };
  21960. /**
  21961. * The base implementation of `_.shuffle`.
  21962. *
  21963. * @private
  21964. * @param {Array|Object} collection The collection to shuffle.
  21965. * @returns {Array} Returns the new shuffled array.
  21966. */
  21967. function baseShuffle(collection) {
  21968. return shuffleSelf(values(collection));
  21969. }
  21970. /**
  21971. * The base implementation of `_.slice` without an iteratee call guard.
  21972. *
  21973. * @private
  21974. * @param {Array} array The array to slice.
  21975. * @param {number} [start=0] The start position.
  21976. * @param {number} [end=array.length] The end position.
  21977. * @returns {Array} Returns the slice of `array`.
  21978. */
  21979. function baseSlice(array, start, end) {
  21980. var index = -1,
  21981. length = array.length;
  21982. if (start < 0) {
  21983. start = -start > length ? 0 : (length + start);
  21984. }
  21985. end = end > length ? length : end;
  21986. if (end < 0) {
  21987. end += length;
  21988. }
  21989. length = start > end ? 0 : ((end - start) >>> 0);
  21990. start >>>= 0;
  21991. var result = Array(length);
  21992. while (++index < length) {
  21993. result[index] = array[index + start];
  21994. }
  21995. return result;
  21996. }
  21997. /**
  21998. * The base implementation of `_.some` without support for iteratee shorthands.
  21999. *
  22000. * @private
  22001. * @param {Array|Object} collection The collection to iterate over.
  22002. * @param {Function} predicate The function invoked per iteration.
  22003. * @returns {boolean} Returns `true` if any element passes the predicate check,
  22004. * else `false`.
  22005. */
  22006. function baseSome(collection, predicate) {
  22007. var result;
  22008. baseEach(collection, function(value, index, collection) {
  22009. result = predicate(value, index, collection);
  22010. return !result;
  22011. });
  22012. return !!result;
  22013. }
  22014. /**
  22015. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  22016. * performs a binary search of `array` to determine the index at which `value`
  22017. * should be inserted into `array` in order to maintain its sort order.
  22018. *
  22019. * @private
  22020. * @param {Array} array The sorted array to inspect.
  22021. * @param {*} value The value to evaluate.
  22022. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22023. * @returns {number} Returns the index at which `value` should be inserted
  22024. * into `array`.
  22025. */
  22026. function baseSortedIndex(array, value, retHighest) {
  22027. var low = 0,
  22028. high = array == null ? low : array.length;
  22029. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  22030. while (low < high) {
  22031. var mid = (low + high) >>> 1,
  22032. computed = array[mid];
  22033. if (computed !== null && !isSymbol(computed) &&
  22034. (retHighest ? (computed <= value) : (computed < value))) {
  22035. low = mid + 1;
  22036. } else {
  22037. high = mid;
  22038. }
  22039. }
  22040. return high;
  22041. }
  22042. return baseSortedIndexBy(array, value, identity, retHighest);
  22043. }
  22044. /**
  22045. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  22046. * which invokes `iteratee` for `value` and each element of `array` to compute
  22047. * their sort ranking. The iteratee is invoked with one argument; (value).
  22048. *
  22049. * @private
  22050. * @param {Array} array The sorted array to inspect.
  22051. * @param {*} value The value to evaluate.
  22052. * @param {Function} iteratee The iteratee invoked per element.
  22053. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22054. * @returns {number} Returns the index at which `value` should be inserted
  22055. * into `array`.
  22056. */
  22057. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  22058. value = iteratee(value);
  22059. var low = 0,
  22060. high = array == null ? 0 : array.length,
  22061. valIsNaN = value !== value,
  22062. valIsNull = value === null,
  22063. valIsSymbol = isSymbol(value),
  22064. valIsUndefined = value === undefined;
  22065. while (low < high) {
  22066. var mid = nativeFloor((low + high) / 2),
  22067. computed = iteratee(array[mid]),
  22068. othIsDefined = computed !== undefined,
  22069. othIsNull = computed === null,
  22070. othIsReflexive = computed === computed,
  22071. othIsSymbol = isSymbol(computed);
  22072. if (valIsNaN) {
  22073. var setLow = retHighest || othIsReflexive;
  22074. } else if (valIsUndefined) {
  22075. setLow = othIsReflexive && (retHighest || othIsDefined);
  22076. } else if (valIsNull) {
  22077. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  22078. } else if (valIsSymbol) {
  22079. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  22080. } else if (othIsNull || othIsSymbol) {
  22081. setLow = false;
  22082. } else {
  22083. setLow = retHighest ? (computed <= value) : (computed < value);
  22084. }
  22085. if (setLow) {
  22086. low = mid + 1;
  22087. } else {
  22088. high = mid;
  22089. }
  22090. }
  22091. return nativeMin(high, MAX_ARRAY_INDEX);
  22092. }
  22093. /**
  22094. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  22095. * support for iteratee shorthands.
  22096. *
  22097. * @private
  22098. * @param {Array} array The array to inspect.
  22099. * @param {Function} [iteratee] The iteratee invoked per element.
  22100. * @returns {Array} Returns the new duplicate free array.
  22101. */
  22102. function baseSortedUniq(array, iteratee) {
  22103. var index = -1,
  22104. length = array.length,
  22105. resIndex = 0,
  22106. result = [];
  22107. while (++index < length) {
  22108. var value = array[index],
  22109. computed = iteratee ? iteratee(value) : value;
  22110. if (!index || !eq(computed, seen)) {
  22111. var seen = computed;
  22112. result[resIndex++] = value === 0 ? 0 : value;
  22113. }
  22114. }
  22115. return result;
  22116. }
  22117. /**
  22118. * The base implementation of `_.toNumber` which doesn't ensure correct
  22119. * conversions of binary, hexadecimal, or octal string values.
  22120. *
  22121. * @private
  22122. * @param {*} value The value to process.
  22123. * @returns {number} Returns the number.
  22124. */
  22125. function baseToNumber(value) {
  22126. if (typeof value == 'number') {
  22127. return value;
  22128. }
  22129. if (isSymbol(value)) {
  22130. return NAN;
  22131. }
  22132. return +value;
  22133. }
  22134. /**
  22135. * The base implementation of `_.toString` which doesn't convert nullish
  22136. * values to empty strings.
  22137. *
  22138. * @private
  22139. * @param {*} value The value to process.
  22140. * @returns {string} Returns the string.
  22141. */
  22142. function baseToString(value) {
  22143. // Exit early for strings to avoid a performance hit in some environments.
  22144. if (typeof value == 'string') {
  22145. return value;
  22146. }
  22147. if (isArray(value)) {
  22148. // Recursively convert values (susceptible to call stack limits).
  22149. return arrayMap(value, baseToString) + '';
  22150. }
  22151. if (isSymbol(value)) {
  22152. return symbolToString ? symbolToString.call(value) : '';
  22153. }
  22154. var result = (value + '');
  22155. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  22156. }
  22157. /**
  22158. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  22159. *
  22160. * @private
  22161. * @param {Array} array The array to inspect.
  22162. * @param {Function} [iteratee] The iteratee invoked per element.
  22163. * @param {Function} [comparator] The comparator invoked per element.
  22164. * @returns {Array} Returns the new duplicate free array.
  22165. */
  22166. function baseUniq(array, iteratee, comparator) {
  22167. var index = -1,
  22168. includes = arrayIncludes,
  22169. length = array.length,
  22170. isCommon = true,
  22171. result = [],
  22172. seen = result;
  22173. if (comparator) {
  22174. isCommon = false;
  22175. includes = arrayIncludesWith;
  22176. }
  22177. else if (length >= LARGE_ARRAY_SIZE) {
  22178. var set = iteratee ? null : createSet(array);
  22179. if (set) {
  22180. return setToArray(set);
  22181. }
  22182. isCommon = false;
  22183. includes = cacheHas;
  22184. seen = new SetCache;
  22185. }
  22186. else {
  22187. seen = iteratee ? [] : result;
  22188. }
  22189. outer:
  22190. while (++index < length) {
  22191. var value = array[index],
  22192. computed = iteratee ? iteratee(value) : value;
  22193. value = (comparator || value !== 0) ? value : 0;
  22194. if (isCommon && computed === computed) {
  22195. var seenIndex = seen.length;
  22196. while (seenIndex--) {
  22197. if (seen[seenIndex] === computed) {
  22198. continue outer;
  22199. }
  22200. }
  22201. if (iteratee) {
  22202. seen.push(computed);
  22203. }
  22204. result.push(value);
  22205. }
  22206. else if (!includes(seen, computed, comparator)) {
  22207. if (seen !== result) {
  22208. seen.push(computed);
  22209. }
  22210. result.push(value);
  22211. }
  22212. }
  22213. return result;
  22214. }
  22215. /**
  22216. * The base implementation of `_.unset`.
  22217. *
  22218. * @private
  22219. * @param {Object} object The object to modify.
  22220. * @param {Array|string} path The property path to unset.
  22221. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  22222. */
  22223. function baseUnset(object, path) {
  22224. path = castPath(path, object);
  22225. object = parent(object, path);
  22226. return object == null || delete object[toKey(last(path))];
  22227. }
  22228. /**
  22229. * The base implementation of `_.update`.
  22230. *
  22231. * @private
  22232. * @param {Object} object The object to modify.
  22233. * @param {Array|string} path The path of the property to update.
  22234. * @param {Function} updater The function to produce the updated value.
  22235. * @param {Function} [customizer] The function to customize path creation.
  22236. * @returns {Object} Returns `object`.
  22237. */
  22238. function baseUpdate(object, path, updater, customizer) {
  22239. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  22240. }
  22241. /**
  22242. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  22243. * without support for iteratee shorthands.
  22244. *
  22245. * @private
  22246. * @param {Array} array The array to query.
  22247. * @param {Function} predicate The function invoked per iteration.
  22248. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  22249. * @param {boolean} [fromRight] Specify iterating from right to left.
  22250. * @returns {Array} Returns the slice of `array`.
  22251. */
  22252. function baseWhile(array, predicate, isDrop, fromRight) {
  22253. var length = array.length,
  22254. index = fromRight ? length : -1;
  22255. while ((fromRight ? index-- : ++index < length) &&
  22256. predicate(array[index], index, array)) {}
  22257. return isDrop
  22258. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  22259. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  22260. }
  22261. /**
  22262. * The base implementation of `wrapperValue` which returns the result of
  22263. * performing a sequence of actions on the unwrapped `value`, where each
  22264. * successive action is supplied the return value of the previous.
  22265. *
  22266. * @private
  22267. * @param {*} value The unwrapped value.
  22268. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  22269. * @returns {*} Returns the resolved value.
  22270. */
  22271. function baseWrapperValue(value, actions) {
  22272. var result = value;
  22273. if (result instanceof LazyWrapper) {
  22274. result = result.value();
  22275. }
  22276. return arrayReduce(actions, function(result, action) {
  22277. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  22278. }, result);
  22279. }
  22280. /**
  22281. * The base implementation of methods like `_.xor`, without support for
  22282. * iteratee shorthands, that accepts an array of arrays to inspect.
  22283. *
  22284. * @private
  22285. * @param {Array} arrays The arrays to inspect.
  22286. * @param {Function} [iteratee] The iteratee invoked per element.
  22287. * @param {Function} [comparator] The comparator invoked per element.
  22288. * @returns {Array} Returns the new array of values.
  22289. */
  22290. function baseXor(arrays, iteratee, comparator) {
  22291. var length = arrays.length;
  22292. if (length < 2) {
  22293. return length ? baseUniq(arrays[0]) : [];
  22294. }
  22295. var index = -1,
  22296. result = Array(length);
  22297. while (++index < length) {
  22298. var array = arrays[index],
  22299. othIndex = -1;
  22300. while (++othIndex < length) {
  22301. if (othIndex != index) {
  22302. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  22303. }
  22304. }
  22305. }
  22306. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  22307. }
  22308. /**
  22309. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  22310. *
  22311. * @private
  22312. * @param {Array} props The property identifiers.
  22313. * @param {Array} values The property values.
  22314. * @param {Function} assignFunc The function to assign values.
  22315. * @returns {Object} Returns the new object.
  22316. */
  22317. function baseZipObject(props, values, assignFunc) {
  22318. var index = -1,
  22319. length = props.length,
  22320. valsLength = values.length,
  22321. result = {};
  22322. while (++index < length) {
  22323. var value = index < valsLength ? values[index] : undefined;
  22324. assignFunc(result, props[index], value);
  22325. }
  22326. return result;
  22327. }
  22328. /**
  22329. * Casts `value` to an empty array if it's not an array like object.
  22330. *
  22331. * @private
  22332. * @param {*} value The value to inspect.
  22333. * @returns {Array|Object} Returns the cast array-like object.
  22334. */
  22335. function castArrayLikeObject(value) {
  22336. return isArrayLikeObject(value) ? value : [];
  22337. }
  22338. /**
  22339. * Casts `value` to `identity` if it's not a function.
  22340. *
  22341. * @private
  22342. * @param {*} value The value to inspect.
  22343. * @returns {Function} Returns cast function.
  22344. */
  22345. function castFunction(value) {
  22346. return typeof value == 'function' ? value : identity;
  22347. }
  22348. /**
  22349. * Casts `value` to a path array if it's not one.
  22350. *
  22351. * @private
  22352. * @param {*} value The value to inspect.
  22353. * @param {Object} [object] The object to query keys on.
  22354. * @returns {Array} Returns the cast property path array.
  22355. */
  22356. function castPath(value, object) {
  22357. if (isArray(value)) {
  22358. return value;
  22359. }
  22360. return isKey(value, object) ? [value] : stringToPath(toString(value));
  22361. }
  22362. /**
  22363. * A `baseRest` alias which can be replaced with `identity` by module
  22364. * replacement plugins.
  22365. *
  22366. * @private
  22367. * @type {Function}
  22368. * @param {Function} func The function to apply a rest parameter to.
  22369. * @returns {Function} Returns the new function.
  22370. */
  22371. var castRest = baseRest;
  22372. /**
  22373. * Casts `array` to a slice if it's needed.
  22374. *
  22375. * @private
  22376. * @param {Array} array The array to inspect.
  22377. * @param {number} start The start position.
  22378. * @param {number} [end=array.length] The end position.
  22379. * @returns {Array} Returns the cast slice.
  22380. */
  22381. function castSlice(array, start, end) {
  22382. var length = array.length;
  22383. end = end === undefined ? length : end;
  22384. return (!start && end >= length) ? array : baseSlice(array, start, end);
  22385. }
  22386. /**
  22387. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  22388. *
  22389. * @private
  22390. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  22391. */
  22392. var clearTimeout = ctxClearTimeout || function(id) {
  22393. return root.clearTimeout(id);
  22394. };
  22395. /**
  22396. * Creates a clone of `buffer`.
  22397. *
  22398. * @private
  22399. * @param {Buffer} buffer The buffer to clone.
  22400. * @param {boolean} [isDeep] Specify a deep clone.
  22401. * @returns {Buffer} Returns the cloned buffer.
  22402. */
  22403. function cloneBuffer(buffer, isDeep) {
  22404. if (isDeep) {
  22405. return buffer.slice();
  22406. }
  22407. var length = buffer.length,
  22408. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  22409. buffer.copy(result);
  22410. return result;
  22411. }
  22412. /**
  22413. * Creates a clone of `arrayBuffer`.
  22414. *
  22415. * @private
  22416. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  22417. * @returns {ArrayBuffer} Returns the cloned array buffer.
  22418. */
  22419. function cloneArrayBuffer(arrayBuffer) {
  22420. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  22421. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  22422. return result;
  22423. }
  22424. /**
  22425. * Creates a clone of `dataView`.
  22426. *
  22427. * @private
  22428. * @param {Object} dataView The data view to clone.
  22429. * @param {boolean} [isDeep] Specify a deep clone.
  22430. * @returns {Object} Returns the cloned data view.
  22431. */
  22432. function cloneDataView(dataView, isDeep) {
  22433. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  22434. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  22435. }
  22436. /**
  22437. * Creates a clone of `regexp`.
  22438. *
  22439. * @private
  22440. * @param {Object} regexp The regexp to clone.
  22441. * @returns {Object} Returns the cloned regexp.
  22442. */
  22443. function cloneRegExp(regexp) {
  22444. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  22445. result.lastIndex = regexp.lastIndex;
  22446. return result;
  22447. }
  22448. /**
  22449. * Creates a clone of the `symbol` object.
  22450. *
  22451. * @private
  22452. * @param {Object} symbol The symbol object to clone.
  22453. * @returns {Object} Returns the cloned symbol object.
  22454. */
  22455. function cloneSymbol(symbol) {
  22456. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  22457. }
  22458. /**
  22459. * Creates a clone of `typedArray`.
  22460. *
  22461. * @private
  22462. * @param {Object} typedArray The typed array to clone.
  22463. * @param {boolean} [isDeep] Specify a deep clone.
  22464. * @returns {Object} Returns the cloned typed array.
  22465. */
  22466. function cloneTypedArray(typedArray, isDeep) {
  22467. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  22468. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  22469. }
  22470. /**
  22471. * Compares values to sort them in ascending order.
  22472. *
  22473. * @private
  22474. * @param {*} value The value to compare.
  22475. * @param {*} other The other value to compare.
  22476. * @returns {number} Returns the sort order indicator for `value`.
  22477. */
  22478. function compareAscending(value, other) {
  22479. if (value !== other) {
  22480. var valIsDefined = value !== undefined,
  22481. valIsNull = value === null,
  22482. valIsReflexive = value === value,
  22483. valIsSymbol = isSymbol(value);
  22484. var othIsDefined = other !== undefined,
  22485. othIsNull = other === null,
  22486. othIsReflexive = other === other,
  22487. othIsSymbol = isSymbol(other);
  22488. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  22489. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  22490. (valIsNull && othIsDefined && othIsReflexive) ||
  22491. (!valIsDefined && othIsReflexive) ||
  22492. !valIsReflexive) {
  22493. return 1;
  22494. }
  22495. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  22496. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  22497. (othIsNull && valIsDefined && valIsReflexive) ||
  22498. (!othIsDefined && valIsReflexive) ||
  22499. !othIsReflexive) {
  22500. return -1;
  22501. }
  22502. }
  22503. return 0;
  22504. }
  22505. /**
  22506. * Used by `_.orderBy` to compare multiple properties of a value to another
  22507. * and stable sort them.
  22508. *
  22509. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  22510. * specify an order of "desc" for descending or "asc" for ascending sort order
  22511. * of corresponding values.
  22512. *
  22513. * @private
  22514. * @param {Object} object The object to compare.
  22515. * @param {Object} other The other object to compare.
  22516. * @param {boolean[]|string[]} orders The order to sort by for each property.
  22517. * @returns {number} Returns the sort order indicator for `object`.
  22518. */
  22519. function compareMultiple(object, other, orders) {
  22520. var index = -1,
  22521. objCriteria = object.criteria,
  22522. othCriteria = other.criteria,
  22523. length = objCriteria.length,
  22524. ordersLength = orders.length;
  22525. while (++index < length) {
  22526. var result = compareAscending(objCriteria[index], othCriteria[index]);
  22527. if (result) {
  22528. if (index >= ordersLength) {
  22529. return result;
  22530. }
  22531. var order = orders[index];
  22532. return result * (order == 'desc' ? -1 : 1);
  22533. }
  22534. }
  22535. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  22536. // that causes it, under certain circumstances, to provide the same value for
  22537. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  22538. // for more details.
  22539. //
  22540. // This also ensures a stable sort in V8 and other engines.
  22541. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  22542. return object.index - other.index;
  22543. }
  22544. /**
  22545. * Creates an array that is the composition of partially applied arguments,
  22546. * placeholders, and provided arguments into a single array of arguments.
  22547. *
  22548. * @private
  22549. * @param {Array} args The provided arguments.
  22550. * @param {Array} partials The arguments to prepend to those provided.
  22551. * @param {Array} holders The `partials` placeholder indexes.
  22552. * @params {boolean} [isCurried] Specify composing for a curried function.
  22553. * @returns {Array} Returns the new array of composed arguments.
  22554. */
  22555. function composeArgs(args, partials, holders, isCurried) {
  22556. var argsIndex = -1,
  22557. argsLength = args.length,
  22558. holdersLength = holders.length,
  22559. leftIndex = -1,
  22560. leftLength = partials.length,
  22561. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22562. result = Array(leftLength + rangeLength),
  22563. isUncurried = !isCurried;
  22564. while (++leftIndex < leftLength) {
  22565. result[leftIndex] = partials[leftIndex];
  22566. }
  22567. while (++argsIndex < holdersLength) {
  22568. if (isUncurried || argsIndex < argsLength) {
  22569. result[holders[argsIndex]] = args[argsIndex];
  22570. }
  22571. }
  22572. while (rangeLength--) {
  22573. result[leftIndex++] = args[argsIndex++];
  22574. }
  22575. return result;
  22576. }
  22577. /**
  22578. * This function is like `composeArgs` except that the arguments composition
  22579. * is tailored for `_.partialRight`.
  22580. *
  22581. * @private
  22582. * @param {Array} args The provided arguments.
  22583. * @param {Array} partials The arguments to append to those provided.
  22584. * @param {Array} holders The `partials` placeholder indexes.
  22585. * @params {boolean} [isCurried] Specify composing for a curried function.
  22586. * @returns {Array} Returns the new array of composed arguments.
  22587. */
  22588. function composeArgsRight(args, partials, holders, isCurried) {
  22589. var argsIndex = -1,
  22590. argsLength = args.length,
  22591. holdersIndex = -1,
  22592. holdersLength = holders.length,
  22593. rightIndex = -1,
  22594. rightLength = partials.length,
  22595. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22596. result = Array(rangeLength + rightLength),
  22597. isUncurried = !isCurried;
  22598. while (++argsIndex < rangeLength) {
  22599. result[argsIndex] = args[argsIndex];
  22600. }
  22601. var offset = argsIndex;
  22602. while (++rightIndex < rightLength) {
  22603. result[offset + rightIndex] = partials[rightIndex];
  22604. }
  22605. while (++holdersIndex < holdersLength) {
  22606. if (isUncurried || argsIndex < argsLength) {
  22607. result[offset + holders[holdersIndex]] = args[argsIndex++];
  22608. }
  22609. }
  22610. return result;
  22611. }
  22612. /**
  22613. * Copies the values of `source` to `array`.
  22614. *
  22615. * @private
  22616. * @param {Array} source The array to copy values from.
  22617. * @param {Array} [array=[]] The array to copy values to.
  22618. * @returns {Array} Returns `array`.
  22619. */
  22620. function copyArray(source, array) {
  22621. var index = -1,
  22622. length = source.length;
  22623. array || (array = Array(length));
  22624. while (++index < length) {
  22625. array[index] = source[index];
  22626. }
  22627. return array;
  22628. }
  22629. /**
  22630. * Copies properties of `source` to `object`.
  22631. *
  22632. * @private
  22633. * @param {Object} source The object to copy properties from.
  22634. * @param {Array} props The property identifiers to copy.
  22635. * @param {Object} [object={}] The object to copy properties to.
  22636. * @param {Function} [customizer] The function to customize copied values.
  22637. * @returns {Object} Returns `object`.
  22638. */
  22639. function copyObject(source, props, object, customizer) {
  22640. var isNew = !object;
  22641. object || (object = {});
  22642. var index = -1,
  22643. length = props.length;
  22644. while (++index < length) {
  22645. var key = props[index];
  22646. var newValue = customizer
  22647. ? customizer(object[key], source[key], key, object, source)
  22648. : undefined;
  22649. if (newValue === undefined) {
  22650. newValue = source[key];
  22651. }
  22652. if (isNew) {
  22653. baseAssignValue(object, key, newValue);
  22654. } else {
  22655. assignValue(object, key, newValue);
  22656. }
  22657. }
  22658. return object;
  22659. }
  22660. /**
  22661. * Copies own symbols of `source` to `object`.
  22662. *
  22663. * @private
  22664. * @param {Object} source The object to copy symbols from.
  22665. * @param {Object} [object={}] The object to copy symbols to.
  22666. * @returns {Object} Returns `object`.
  22667. */
  22668. function copySymbols(source, object) {
  22669. return copyObject(source, getSymbols(source), object);
  22670. }
  22671. /**
  22672. * Copies own and inherited symbols of `source` to `object`.
  22673. *
  22674. * @private
  22675. * @param {Object} source The object to copy symbols from.
  22676. * @param {Object} [object={}] The object to copy symbols to.
  22677. * @returns {Object} Returns `object`.
  22678. */
  22679. function copySymbolsIn(source, object) {
  22680. return copyObject(source, getSymbolsIn(source), object);
  22681. }
  22682. /**
  22683. * Creates a function like `_.groupBy`.
  22684. *
  22685. * @private
  22686. * @param {Function} setter The function to set accumulator values.
  22687. * @param {Function} [initializer] The accumulator object initializer.
  22688. * @returns {Function} Returns the new aggregator function.
  22689. */
  22690. function createAggregator(setter, initializer) {
  22691. return function(collection, iteratee) {
  22692. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  22693. accumulator = initializer ? initializer() : {};
  22694. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  22695. };
  22696. }
  22697. /**
  22698. * Creates a function like `_.assign`.
  22699. *
  22700. * @private
  22701. * @param {Function} assigner The function to assign values.
  22702. * @returns {Function} Returns the new assigner function.
  22703. */
  22704. function createAssigner(assigner) {
  22705. return baseRest(function(object, sources) {
  22706. var index = -1,
  22707. length = sources.length,
  22708. customizer = length > 1 ? sources[length - 1] : undefined,
  22709. guard = length > 2 ? sources[2] : undefined;
  22710. customizer = (assigner.length > 3 && typeof customizer == 'function')
  22711. ? (length--, customizer)
  22712. : undefined;
  22713. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  22714. customizer = length < 3 ? undefined : customizer;
  22715. length = 1;
  22716. }
  22717. object = Object(object);
  22718. while (++index < length) {
  22719. var source = sources[index];
  22720. if (source) {
  22721. assigner(object, source, index, customizer);
  22722. }
  22723. }
  22724. return object;
  22725. });
  22726. }
  22727. /**
  22728. * Creates a `baseEach` or `baseEachRight` function.
  22729. *
  22730. * @private
  22731. * @param {Function} eachFunc The function to iterate over a collection.
  22732. * @param {boolean} [fromRight] Specify iterating from right to left.
  22733. * @returns {Function} Returns the new base function.
  22734. */
  22735. function createBaseEach(eachFunc, fromRight) {
  22736. return function(collection, iteratee) {
  22737. if (collection == null) {
  22738. return collection;
  22739. }
  22740. if (!isArrayLike(collection)) {
  22741. return eachFunc(collection, iteratee);
  22742. }
  22743. var length = collection.length,
  22744. index = fromRight ? length : -1,
  22745. iterable = Object(collection);
  22746. while ((fromRight ? index-- : ++index < length)) {
  22747. if (iteratee(iterable[index], index, iterable) === false) {
  22748. break;
  22749. }
  22750. }
  22751. return collection;
  22752. };
  22753. }
  22754. /**
  22755. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  22756. *
  22757. * @private
  22758. * @param {boolean} [fromRight] Specify iterating from right to left.
  22759. * @returns {Function} Returns the new base function.
  22760. */
  22761. function createBaseFor(fromRight) {
  22762. return function(object, iteratee, keysFunc) {
  22763. var index = -1,
  22764. iterable = Object(object),
  22765. props = keysFunc(object),
  22766. length = props.length;
  22767. while (length--) {
  22768. var key = props[fromRight ? length : ++index];
  22769. if (iteratee(iterable[key], key, iterable) === false) {
  22770. break;
  22771. }
  22772. }
  22773. return object;
  22774. };
  22775. }
  22776. /**
  22777. * Creates a function that wraps `func` to invoke it with the optional `this`
  22778. * binding of `thisArg`.
  22779. *
  22780. * @private
  22781. * @param {Function} func The function to wrap.
  22782. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22783. * @param {*} [thisArg] The `this` binding of `func`.
  22784. * @returns {Function} Returns the new wrapped function.
  22785. */
  22786. function createBind(func, bitmask, thisArg) {
  22787. var isBind = bitmask & WRAP_BIND_FLAG,
  22788. Ctor = createCtor(func);
  22789. function wrapper() {
  22790. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22791. return fn.apply(isBind ? thisArg : this, arguments);
  22792. }
  22793. return wrapper;
  22794. }
  22795. /**
  22796. * Creates a function like `_.lowerFirst`.
  22797. *
  22798. * @private
  22799. * @param {string} methodName The name of the `String` case method to use.
  22800. * @returns {Function} Returns the new case function.
  22801. */
  22802. function createCaseFirst(methodName) {
  22803. return function(string) {
  22804. string = toString(string);
  22805. var strSymbols = hasUnicode(string)
  22806. ? stringToArray(string)
  22807. : undefined;
  22808. var chr = strSymbols
  22809. ? strSymbols[0]
  22810. : string.charAt(0);
  22811. var trailing = strSymbols
  22812. ? castSlice(strSymbols, 1).join('')
  22813. : string.slice(1);
  22814. return chr[methodName]() + trailing;
  22815. };
  22816. }
  22817. /**
  22818. * Creates a function like `_.camelCase`.
  22819. *
  22820. * @private
  22821. * @param {Function} callback The function to combine each word.
  22822. * @returns {Function} Returns the new compounder function.
  22823. */
  22824. function createCompounder(callback) {
  22825. return function(string) {
  22826. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  22827. };
  22828. }
  22829. /**
  22830. * Creates a function that produces an instance of `Ctor` regardless of
  22831. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  22832. *
  22833. * @private
  22834. * @param {Function} Ctor The constructor to wrap.
  22835. * @returns {Function} Returns the new wrapped function.
  22836. */
  22837. function createCtor(Ctor) {
  22838. return function() {
  22839. // Use a `switch` statement to work with class constructors. See
  22840. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  22841. // for more details.
  22842. var args = arguments;
  22843. switch (args.length) {
  22844. case 0: return new Ctor;
  22845. case 1: return new Ctor(args[0]);
  22846. case 2: return new Ctor(args[0], args[1]);
  22847. case 3: return new Ctor(args[0], args[1], args[2]);
  22848. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  22849. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  22850. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  22851. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  22852. }
  22853. var thisBinding = baseCreate(Ctor.prototype),
  22854. result = Ctor.apply(thisBinding, args);
  22855. // Mimic the constructor's `return` behavior.
  22856. // See https://es5.github.io/#x13.2.2 for more details.
  22857. return isObject(result) ? result : thisBinding;
  22858. };
  22859. }
  22860. /**
  22861. * Creates a function that wraps `func` to enable currying.
  22862. *
  22863. * @private
  22864. * @param {Function} func The function to wrap.
  22865. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22866. * @param {number} arity The arity of `func`.
  22867. * @returns {Function} Returns the new wrapped function.
  22868. */
  22869. function createCurry(func, bitmask, arity) {
  22870. var Ctor = createCtor(func);
  22871. function wrapper() {
  22872. var length = arguments.length,
  22873. args = Array(length),
  22874. index = length,
  22875. placeholder = getHolder(wrapper);
  22876. while (index--) {
  22877. args[index] = arguments[index];
  22878. }
  22879. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  22880. ? []
  22881. : replaceHolders(args, placeholder);
  22882. length -= holders.length;
  22883. if (length < arity) {
  22884. return createRecurry(
  22885. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  22886. args, holders, undefined, undefined, arity - length);
  22887. }
  22888. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22889. return apply(fn, this, args);
  22890. }
  22891. return wrapper;
  22892. }
  22893. /**
  22894. * Creates a `_.find` or `_.findLast` function.
  22895. *
  22896. * @private
  22897. * @param {Function} findIndexFunc The function to find the collection index.
  22898. * @returns {Function} Returns the new find function.
  22899. */
  22900. function createFind(findIndexFunc) {
  22901. return function(collection, predicate, fromIndex) {
  22902. var iterable = Object(collection);
  22903. if (!isArrayLike(collection)) {
  22904. var iteratee = getIteratee(predicate, 3);
  22905. collection = keys(collection);
  22906. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  22907. }
  22908. var index = findIndexFunc(collection, predicate, fromIndex);
  22909. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  22910. };
  22911. }
  22912. /**
  22913. * Creates a `_.flow` or `_.flowRight` function.
  22914. *
  22915. * @private
  22916. * @param {boolean} [fromRight] Specify iterating from right to left.
  22917. * @returns {Function} Returns the new flow function.
  22918. */
  22919. function createFlow(fromRight) {
  22920. return flatRest(function(funcs) {
  22921. var length = funcs.length,
  22922. index = length,
  22923. prereq = LodashWrapper.prototype.thru;
  22924. if (fromRight) {
  22925. funcs.reverse();
  22926. }
  22927. while (index--) {
  22928. var func = funcs[index];
  22929. if (typeof func != 'function') {
  22930. throw new TypeError(FUNC_ERROR_TEXT);
  22931. }
  22932. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  22933. var wrapper = new LodashWrapper([], true);
  22934. }
  22935. }
  22936. index = wrapper ? index : length;
  22937. while (++index < length) {
  22938. func = funcs[index];
  22939. var funcName = getFuncName(func),
  22940. data = funcName == 'wrapper' ? getData(func) : undefined;
  22941. if (data && isLaziable(data[0]) &&
  22942. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  22943. !data[4].length && data[9] == 1
  22944. ) {
  22945. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  22946. } else {
  22947. wrapper = (func.length == 1 && isLaziable(func))
  22948. ? wrapper[funcName]()
  22949. : wrapper.thru(func);
  22950. }
  22951. }
  22952. return function() {
  22953. var args = arguments,
  22954. value = args[0];
  22955. if (wrapper && args.length == 1 && isArray(value)) {
  22956. return wrapper.plant(value).value();
  22957. }
  22958. var index = 0,
  22959. result = length ? funcs[index].apply(this, args) : value;
  22960. while (++index < length) {
  22961. result = funcs[index].call(this, result);
  22962. }
  22963. return result;
  22964. };
  22965. });
  22966. }
  22967. /**
  22968. * Creates a function that wraps `func` to invoke it with optional `this`
  22969. * binding of `thisArg`, partial application, and currying.
  22970. *
  22971. * @private
  22972. * @param {Function|string} func The function or method name to wrap.
  22973. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22974. * @param {*} [thisArg] The `this` binding of `func`.
  22975. * @param {Array} [partials] The arguments to prepend to those provided to
  22976. * the new function.
  22977. * @param {Array} [holders] The `partials` placeholder indexes.
  22978. * @param {Array} [partialsRight] The arguments to append to those provided
  22979. * to the new function.
  22980. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  22981. * @param {Array} [argPos] The argument positions of the new function.
  22982. * @param {number} [ary] The arity cap of `func`.
  22983. * @param {number} [arity] The arity of `func`.
  22984. * @returns {Function} Returns the new wrapped function.
  22985. */
  22986. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  22987. var isAry = bitmask & WRAP_ARY_FLAG,
  22988. isBind = bitmask & WRAP_BIND_FLAG,
  22989. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  22990. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  22991. isFlip = bitmask & WRAP_FLIP_FLAG,
  22992. Ctor = isBindKey ? undefined : createCtor(func);
  22993. function wrapper() {
  22994. var length = arguments.length,
  22995. args = Array(length),
  22996. index = length;
  22997. while (index--) {
  22998. args[index] = arguments[index];
  22999. }
  23000. if (isCurried) {
  23001. var placeholder = getHolder(wrapper),
  23002. holdersCount = countHolders(args, placeholder);
  23003. }
  23004. if (partials) {
  23005. args = composeArgs(args, partials, holders, isCurried);
  23006. }
  23007. if (partialsRight) {
  23008. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  23009. }
  23010. length -= holdersCount;
  23011. if (isCurried && length < arity) {
  23012. var newHolders = replaceHolders(args, placeholder);
  23013. return createRecurry(
  23014. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  23015. args, newHolders, argPos, ary, arity - length
  23016. );
  23017. }
  23018. var thisBinding = isBind ? thisArg : this,
  23019. fn = isBindKey ? thisBinding[func] : func;
  23020. length = args.length;
  23021. if (argPos) {
  23022. args = reorder(args, argPos);
  23023. } else if (isFlip && length > 1) {
  23024. args.reverse();
  23025. }
  23026. if (isAry && ary < length) {
  23027. args.length = ary;
  23028. }
  23029. if (this && this !== root && this instanceof wrapper) {
  23030. fn = Ctor || createCtor(fn);
  23031. }
  23032. return fn.apply(thisBinding, args);
  23033. }
  23034. return wrapper;
  23035. }
  23036. /**
  23037. * Creates a function like `_.invertBy`.
  23038. *
  23039. * @private
  23040. * @param {Function} setter The function to set accumulator values.
  23041. * @param {Function} toIteratee The function to resolve iteratees.
  23042. * @returns {Function} Returns the new inverter function.
  23043. */
  23044. function createInverter(setter, toIteratee) {
  23045. return function(object, iteratee) {
  23046. return baseInverter(object, setter, toIteratee(iteratee), {});
  23047. };
  23048. }
  23049. /**
  23050. * Creates a function that performs a mathematical operation on two values.
  23051. *
  23052. * @private
  23053. * @param {Function} operator The function to perform the operation.
  23054. * @param {number} [defaultValue] The value used for `undefined` arguments.
  23055. * @returns {Function} Returns the new mathematical operation function.
  23056. */
  23057. function createMathOperation(operator, defaultValue) {
  23058. return function(value, other) {
  23059. var result;
  23060. if (value === undefined && other === undefined) {
  23061. return defaultValue;
  23062. }
  23063. if (value !== undefined) {
  23064. result = value;
  23065. }
  23066. if (other !== undefined) {
  23067. if (result === undefined) {
  23068. return other;
  23069. }
  23070. if (typeof value == 'string' || typeof other == 'string') {
  23071. value = baseToString(value);
  23072. other = baseToString(other);
  23073. } else {
  23074. value = baseToNumber(value);
  23075. other = baseToNumber(other);
  23076. }
  23077. result = operator(value, other);
  23078. }
  23079. return result;
  23080. };
  23081. }
  23082. /**
  23083. * Creates a function like `_.over`.
  23084. *
  23085. * @private
  23086. * @param {Function} arrayFunc The function to iterate over iteratees.
  23087. * @returns {Function} Returns the new over function.
  23088. */
  23089. function createOver(arrayFunc) {
  23090. return flatRest(function(iteratees) {
  23091. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  23092. return baseRest(function(args) {
  23093. var thisArg = this;
  23094. return arrayFunc(iteratees, function(iteratee) {
  23095. return apply(iteratee, thisArg, args);
  23096. });
  23097. });
  23098. });
  23099. }
  23100. /**
  23101. * Creates the padding for `string` based on `length`. The `chars` string
  23102. * is truncated if the number of characters exceeds `length`.
  23103. *
  23104. * @private
  23105. * @param {number} length The padding length.
  23106. * @param {string} [chars=' '] The string used as padding.
  23107. * @returns {string} Returns the padding for `string`.
  23108. */
  23109. function createPadding(length, chars) {
  23110. chars = chars === undefined ? ' ' : baseToString(chars);
  23111. var charsLength = chars.length;
  23112. if (charsLength < 2) {
  23113. return charsLength ? baseRepeat(chars, length) : chars;
  23114. }
  23115. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  23116. return hasUnicode(chars)
  23117. ? castSlice(stringToArray(result), 0, length).join('')
  23118. : result.slice(0, length);
  23119. }
  23120. /**
  23121. * Creates a function that wraps `func` to invoke it with the `this` binding
  23122. * of `thisArg` and `partials` prepended to the arguments it receives.
  23123. *
  23124. * @private
  23125. * @param {Function} func The function to wrap.
  23126. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23127. * @param {*} thisArg The `this` binding of `func`.
  23128. * @param {Array} partials The arguments to prepend to those provided to
  23129. * the new function.
  23130. * @returns {Function} Returns the new wrapped function.
  23131. */
  23132. function createPartial(func, bitmask, thisArg, partials) {
  23133. var isBind = bitmask & WRAP_BIND_FLAG,
  23134. Ctor = createCtor(func);
  23135. function wrapper() {
  23136. var argsIndex = -1,
  23137. argsLength = arguments.length,
  23138. leftIndex = -1,
  23139. leftLength = partials.length,
  23140. args = Array(leftLength + argsLength),
  23141. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23142. while (++leftIndex < leftLength) {
  23143. args[leftIndex] = partials[leftIndex];
  23144. }
  23145. while (argsLength--) {
  23146. args[leftIndex++] = arguments[++argsIndex];
  23147. }
  23148. return apply(fn, isBind ? thisArg : this, args);
  23149. }
  23150. return wrapper;
  23151. }
  23152. /**
  23153. * Creates a `_.range` or `_.rangeRight` function.
  23154. *
  23155. * @private
  23156. * @param {boolean} [fromRight] Specify iterating from right to left.
  23157. * @returns {Function} Returns the new range function.
  23158. */
  23159. function createRange(fromRight) {
  23160. return function(start, end, step) {
  23161. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  23162. end = step = undefined;
  23163. }
  23164. // Ensure the sign of `-0` is preserved.
  23165. start = toFinite(start);
  23166. if (end === undefined) {
  23167. end = start;
  23168. start = 0;
  23169. } else {
  23170. end = toFinite(end);
  23171. }
  23172. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  23173. return baseRange(start, end, step, fromRight);
  23174. };
  23175. }
  23176. /**
  23177. * Creates a function that performs a relational operation on two values.
  23178. *
  23179. * @private
  23180. * @param {Function} operator The function to perform the operation.
  23181. * @returns {Function} Returns the new relational operation function.
  23182. */
  23183. function createRelationalOperation(operator) {
  23184. return function(value, other) {
  23185. if (!(typeof value == 'string' && typeof other == 'string')) {
  23186. value = toNumber(value);
  23187. other = toNumber(other);
  23188. }
  23189. return operator(value, other);
  23190. };
  23191. }
  23192. /**
  23193. * Creates a function that wraps `func` to continue currying.
  23194. *
  23195. * @private
  23196. * @param {Function} func The function to wrap.
  23197. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23198. * @param {Function} wrapFunc The function to create the `func` wrapper.
  23199. * @param {*} placeholder The placeholder value.
  23200. * @param {*} [thisArg] The `this` binding of `func`.
  23201. * @param {Array} [partials] The arguments to prepend to those provided to
  23202. * the new function.
  23203. * @param {Array} [holders] The `partials` placeholder indexes.
  23204. * @param {Array} [argPos] The argument positions of the new function.
  23205. * @param {number} [ary] The arity cap of `func`.
  23206. * @param {number} [arity] The arity of `func`.
  23207. * @returns {Function} Returns the new wrapped function.
  23208. */
  23209. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  23210. var isCurry = bitmask & WRAP_CURRY_FLAG,
  23211. newHolders = isCurry ? holders : undefined,
  23212. newHoldersRight = isCurry ? undefined : holders,
  23213. newPartials = isCurry ? partials : undefined,
  23214. newPartialsRight = isCurry ? undefined : partials;
  23215. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  23216. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  23217. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  23218. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  23219. }
  23220. var newData = [
  23221. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  23222. newHoldersRight, argPos, ary, arity
  23223. ];
  23224. var result = wrapFunc.apply(undefined, newData);
  23225. if (isLaziable(func)) {
  23226. setData(result, newData);
  23227. }
  23228. result.placeholder = placeholder;
  23229. return setWrapToString(result, func, bitmask);
  23230. }
  23231. /**
  23232. * Creates a function like `_.round`.
  23233. *
  23234. * @private
  23235. * @param {string} methodName The name of the `Math` method to use when rounding.
  23236. * @returns {Function} Returns the new round function.
  23237. */
  23238. function createRound(methodName) {
  23239. var func = Math[methodName];
  23240. return function(number, precision) {
  23241. number = toNumber(number);
  23242. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  23243. if (precision && nativeIsFinite(number)) {
  23244. // Shift with exponential notation to avoid floating-point issues.
  23245. // See [MDN](https://mdn.io/round#Examples) for more details.
  23246. var pair = (toString(number) + 'e').split('e'),
  23247. value = func(pair[0] + 'e' + (+pair[1] + precision));
  23248. pair = (toString(value) + 'e').split('e');
  23249. return +(pair[0] + 'e' + (+pair[1] - precision));
  23250. }
  23251. return func(number);
  23252. };
  23253. }
  23254. /**
  23255. * Creates a set object of `values`.
  23256. *
  23257. * @private
  23258. * @param {Array} values The values to add to the set.
  23259. * @returns {Object} Returns the new set.
  23260. */
  23261. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  23262. return new Set(values);
  23263. };
  23264. /**
  23265. * Creates a `_.toPairs` or `_.toPairsIn` function.
  23266. *
  23267. * @private
  23268. * @param {Function} keysFunc The function to get the keys of a given object.
  23269. * @returns {Function} Returns the new pairs function.
  23270. */
  23271. function createToPairs(keysFunc) {
  23272. return function(object) {
  23273. var tag = getTag(object);
  23274. if (tag == mapTag) {
  23275. return mapToArray(object);
  23276. }
  23277. if (tag == setTag) {
  23278. return setToPairs(object);
  23279. }
  23280. return baseToPairs(object, keysFunc(object));
  23281. };
  23282. }
  23283. /**
  23284. * Creates a function that either curries or invokes `func` with optional
  23285. * `this` binding and partially applied arguments.
  23286. *
  23287. * @private
  23288. * @param {Function|string} func The function or method name to wrap.
  23289. * @param {number} bitmask The bitmask flags.
  23290. * 1 - `_.bind`
  23291. * 2 - `_.bindKey`
  23292. * 4 - `_.curry` or `_.curryRight` of a bound function
  23293. * 8 - `_.curry`
  23294. * 16 - `_.curryRight`
  23295. * 32 - `_.partial`
  23296. * 64 - `_.partialRight`
  23297. * 128 - `_.rearg`
  23298. * 256 - `_.ary`
  23299. * 512 - `_.flip`
  23300. * @param {*} [thisArg] The `this` binding of `func`.
  23301. * @param {Array} [partials] The arguments to be partially applied.
  23302. * @param {Array} [holders] The `partials` placeholder indexes.
  23303. * @param {Array} [argPos] The argument positions of the new function.
  23304. * @param {number} [ary] The arity cap of `func`.
  23305. * @param {number} [arity] The arity of `func`.
  23306. * @returns {Function} Returns the new wrapped function.
  23307. */
  23308. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  23309. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  23310. if (!isBindKey && typeof func != 'function') {
  23311. throw new TypeError(FUNC_ERROR_TEXT);
  23312. }
  23313. var length = partials ? partials.length : 0;
  23314. if (!length) {
  23315. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  23316. partials = holders = undefined;
  23317. }
  23318. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  23319. arity = arity === undefined ? arity : toInteger(arity);
  23320. length -= holders ? holders.length : 0;
  23321. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  23322. var partialsRight = partials,
  23323. holdersRight = holders;
  23324. partials = holders = undefined;
  23325. }
  23326. var data = isBindKey ? undefined : getData(func);
  23327. var newData = [
  23328. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  23329. argPos, ary, arity
  23330. ];
  23331. if (data) {
  23332. mergeData(newData, data);
  23333. }
  23334. func = newData[0];
  23335. bitmask = newData[1];
  23336. thisArg = newData[2];
  23337. partials = newData[3];
  23338. holders = newData[4];
  23339. arity = newData[9] = newData[9] === undefined
  23340. ? (isBindKey ? 0 : func.length)
  23341. : nativeMax(newData[9] - length, 0);
  23342. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  23343. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  23344. }
  23345. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  23346. var result = createBind(func, bitmask, thisArg);
  23347. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  23348. result = createCurry(func, bitmask, arity);
  23349. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  23350. result = createPartial(func, bitmask, thisArg, partials);
  23351. } else {
  23352. result = createHybrid.apply(undefined, newData);
  23353. }
  23354. var setter = data ? baseSetData : setData;
  23355. return setWrapToString(setter(result, newData), func, bitmask);
  23356. }
  23357. /**
  23358. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  23359. * of source objects to the destination object for all destination properties
  23360. * that resolve to `undefined`.
  23361. *
  23362. * @private
  23363. * @param {*} objValue The destination value.
  23364. * @param {*} srcValue The source value.
  23365. * @param {string} key The key of the property to assign.
  23366. * @param {Object} object The parent object of `objValue`.
  23367. * @returns {*} Returns the value to assign.
  23368. */
  23369. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  23370. if (objValue === undefined ||
  23371. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  23372. return srcValue;
  23373. }
  23374. return objValue;
  23375. }
  23376. /**
  23377. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  23378. * objects into destination objects that are passed thru.
  23379. *
  23380. * @private
  23381. * @param {*} objValue The destination value.
  23382. * @param {*} srcValue The source value.
  23383. * @param {string} key The key of the property to merge.
  23384. * @param {Object} object The parent object of `objValue`.
  23385. * @param {Object} source The parent object of `srcValue`.
  23386. * @param {Object} [stack] Tracks traversed source values and their merged
  23387. * counterparts.
  23388. * @returns {*} Returns the value to assign.
  23389. */
  23390. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  23391. if (isObject(objValue) && isObject(srcValue)) {
  23392. // Recursively merge objects and arrays (susceptible to call stack limits).
  23393. stack.set(srcValue, objValue);
  23394. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  23395. stack['delete'](srcValue);
  23396. }
  23397. return objValue;
  23398. }
  23399. /**
  23400. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  23401. * objects.
  23402. *
  23403. * @private
  23404. * @param {*} value The value to inspect.
  23405. * @param {string} key The key of the property to inspect.
  23406. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  23407. */
  23408. function customOmitClone(value) {
  23409. return isPlainObject(value) ? undefined : value;
  23410. }
  23411. /**
  23412. * A specialized version of `baseIsEqualDeep` for arrays with support for
  23413. * partial deep comparisons.
  23414. *
  23415. * @private
  23416. * @param {Array} array The array to compare.
  23417. * @param {Array} other The other array to compare.
  23418. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23419. * @param {Function} customizer The function to customize comparisons.
  23420. * @param {Function} equalFunc The function to determine equivalents of values.
  23421. * @param {Object} stack Tracks traversed `array` and `other` objects.
  23422. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  23423. */
  23424. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  23425. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23426. arrLength = array.length,
  23427. othLength = other.length;
  23428. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  23429. return false;
  23430. }
  23431. // Assume cyclic values are equal.
  23432. var stacked = stack.get(array);
  23433. if (stacked && stack.get(other)) {
  23434. return stacked == other;
  23435. }
  23436. var index = -1,
  23437. result = true,
  23438. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  23439. stack.set(array, other);
  23440. stack.set(other, array);
  23441. // Ignore non-index properties.
  23442. while (++index < arrLength) {
  23443. var arrValue = array[index],
  23444. othValue = other[index];
  23445. if (customizer) {
  23446. var compared = isPartial
  23447. ? customizer(othValue, arrValue, index, other, array, stack)
  23448. : customizer(arrValue, othValue, index, array, other, stack);
  23449. }
  23450. if (compared !== undefined) {
  23451. if (compared) {
  23452. continue;
  23453. }
  23454. result = false;
  23455. break;
  23456. }
  23457. // Recursively compare arrays (susceptible to call stack limits).
  23458. if (seen) {
  23459. if (!arraySome(other, function(othValue, othIndex) {
  23460. if (!cacheHas(seen, othIndex) &&
  23461. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  23462. return seen.push(othIndex);
  23463. }
  23464. })) {
  23465. result = false;
  23466. break;
  23467. }
  23468. } else if (!(
  23469. arrValue === othValue ||
  23470. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  23471. )) {
  23472. result = false;
  23473. break;
  23474. }
  23475. }
  23476. stack['delete'](array);
  23477. stack['delete'](other);
  23478. return result;
  23479. }
  23480. /**
  23481. * A specialized version of `baseIsEqualDeep` for comparing objects of
  23482. * the same `toStringTag`.
  23483. *
  23484. * **Note:** This function only supports comparing values with tags of
  23485. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  23486. *
  23487. * @private
  23488. * @param {Object} object The object to compare.
  23489. * @param {Object} other The other object to compare.
  23490. * @param {string} tag The `toStringTag` of the objects to compare.
  23491. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23492. * @param {Function} customizer The function to customize comparisons.
  23493. * @param {Function} equalFunc The function to determine equivalents of values.
  23494. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23495. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23496. */
  23497. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  23498. switch (tag) {
  23499. case dataViewTag:
  23500. if ((object.byteLength != other.byteLength) ||
  23501. (object.byteOffset != other.byteOffset)) {
  23502. return false;
  23503. }
  23504. object = object.buffer;
  23505. other = other.buffer;
  23506. case arrayBufferTag:
  23507. if ((object.byteLength != other.byteLength) ||
  23508. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  23509. return false;
  23510. }
  23511. return true;
  23512. case boolTag:
  23513. case dateTag:
  23514. case numberTag:
  23515. // Coerce booleans to `1` or `0` and dates to milliseconds.
  23516. // Invalid dates are coerced to `NaN`.
  23517. return eq(+object, +other);
  23518. case errorTag:
  23519. return object.name == other.name && object.message == other.message;
  23520. case regexpTag:
  23521. case stringTag:
  23522. // Coerce regexes to strings and treat strings, primitives and objects,
  23523. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  23524. // for more details.
  23525. return object == (other + '');
  23526. case mapTag:
  23527. var convert = mapToArray;
  23528. case setTag:
  23529. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  23530. convert || (convert = setToArray);
  23531. if (object.size != other.size && !isPartial) {
  23532. return false;
  23533. }
  23534. // Assume cyclic values are equal.
  23535. var stacked = stack.get(object);
  23536. if (stacked) {
  23537. return stacked == other;
  23538. }
  23539. bitmask |= COMPARE_UNORDERED_FLAG;
  23540. // Recursively compare objects (susceptible to call stack limits).
  23541. stack.set(object, other);
  23542. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  23543. stack['delete'](object);
  23544. return result;
  23545. case symbolTag:
  23546. if (symbolValueOf) {
  23547. return symbolValueOf.call(object) == symbolValueOf.call(other);
  23548. }
  23549. }
  23550. return false;
  23551. }
  23552. /**
  23553. * A specialized version of `baseIsEqualDeep` for objects with support for
  23554. * partial deep comparisons.
  23555. *
  23556. * @private
  23557. * @param {Object} object The object to compare.
  23558. * @param {Object} other The other object to compare.
  23559. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23560. * @param {Function} customizer The function to customize comparisons.
  23561. * @param {Function} equalFunc The function to determine equivalents of values.
  23562. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23563. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23564. */
  23565. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  23566. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23567. objProps = getAllKeys(object),
  23568. objLength = objProps.length,
  23569. othProps = getAllKeys(other),
  23570. othLength = othProps.length;
  23571. if (objLength != othLength && !isPartial) {
  23572. return false;
  23573. }
  23574. var index = objLength;
  23575. while (index--) {
  23576. var key = objProps[index];
  23577. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  23578. return false;
  23579. }
  23580. }
  23581. // Assume cyclic values are equal.
  23582. var stacked = stack.get(object);
  23583. if (stacked && stack.get(other)) {
  23584. return stacked == other;
  23585. }
  23586. var result = true;
  23587. stack.set(object, other);
  23588. stack.set(other, object);
  23589. var skipCtor = isPartial;
  23590. while (++index < objLength) {
  23591. key = objProps[index];
  23592. var objValue = object[key],
  23593. othValue = other[key];
  23594. if (customizer) {
  23595. var compared = isPartial
  23596. ? customizer(othValue, objValue, key, other, object, stack)
  23597. : customizer(objValue, othValue, key, object, other, stack);
  23598. }
  23599. // Recursively compare objects (susceptible to call stack limits).
  23600. if (!(compared === undefined
  23601. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  23602. : compared
  23603. )) {
  23604. result = false;
  23605. break;
  23606. }
  23607. skipCtor || (skipCtor = key == 'constructor');
  23608. }
  23609. if (result && !skipCtor) {
  23610. var objCtor = object.constructor,
  23611. othCtor = other.constructor;
  23612. // Non `Object` object instances with different constructors are not equal.
  23613. if (objCtor != othCtor &&
  23614. ('constructor' in object && 'constructor' in other) &&
  23615. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  23616. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  23617. result = false;
  23618. }
  23619. }
  23620. stack['delete'](object);
  23621. stack['delete'](other);
  23622. return result;
  23623. }
  23624. /**
  23625. * A specialized version of `baseRest` which flattens the rest array.
  23626. *
  23627. * @private
  23628. * @param {Function} func The function to apply a rest parameter to.
  23629. * @returns {Function} Returns the new function.
  23630. */
  23631. function flatRest(func) {
  23632. return setToString(overRest(func, undefined, flatten), func + '');
  23633. }
  23634. /**
  23635. * Creates an array of own enumerable property names and symbols of `object`.
  23636. *
  23637. * @private
  23638. * @param {Object} object The object to query.
  23639. * @returns {Array} Returns the array of property names and symbols.
  23640. */
  23641. function getAllKeys(object) {
  23642. return baseGetAllKeys(object, keys, getSymbols);
  23643. }
  23644. /**
  23645. * Creates an array of own and inherited enumerable property names and
  23646. * symbols of `object`.
  23647. *
  23648. * @private
  23649. * @param {Object} object The object to query.
  23650. * @returns {Array} Returns the array of property names and symbols.
  23651. */
  23652. function getAllKeysIn(object) {
  23653. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  23654. }
  23655. /**
  23656. * Gets metadata for `func`.
  23657. *
  23658. * @private
  23659. * @param {Function} func The function to query.
  23660. * @returns {*} Returns the metadata for `func`.
  23661. */
  23662. var getData = !metaMap ? noop : function(func) {
  23663. return metaMap.get(func);
  23664. };
  23665. /**
  23666. * Gets the name of `func`.
  23667. *
  23668. * @private
  23669. * @param {Function} func The function to query.
  23670. * @returns {string} Returns the function name.
  23671. */
  23672. function getFuncName(func) {
  23673. var result = (func.name + ''),
  23674. array = realNames[result],
  23675. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  23676. while (length--) {
  23677. var data = array[length],
  23678. otherFunc = data.func;
  23679. if (otherFunc == null || otherFunc == func) {
  23680. return data.name;
  23681. }
  23682. }
  23683. return result;
  23684. }
  23685. /**
  23686. * Gets the argument placeholder value for `func`.
  23687. *
  23688. * @private
  23689. * @param {Function} func The function to inspect.
  23690. * @returns {*} Returns the placeholder value.
  23691. */
  23692. function getHolder(func) {
  23693. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  23694. return object.placeholder;
  23695. }
  23696. /**
  23697. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  23698. * this function returns the custom method, otherwise it returns `baseIteratee`.
  23699. * If arguments are provided, the chosen function is invoked with them and
  23700. * its result is returned.
  23701. *
  23702. * @private
  23703. * @param {*} [value] The value to convert to an iteratee.
  23704. * @param {number} [arity] The arity of the created iteratee.
  23705. * @returns {Function} Returns the chosen function or its result.
  23706. */
  23707. function getIteratee() {
  23708. var result = lodash.iteratee || iteratee;
  23709. result = result === iteratee ? baseIteratee : result;
  23710. return arguments.length ? result(arguments[0], arguments[1]) : result;
  23711. }
  23712. /**
  23713. * Gets the data for `map`.
  23714. *
  23715. * @private
  23716. * @param {Object} map The map to query.
  23717. * @param {string} key The reference key.
  23718. * @returns {*} Returns the map data.
  23719. */
  23720. function getMapData(map, key) {
  23721. var data = map.__data__;
  23722. return isKeyable(key)
  23723. ? data[typeof key == 'string' ? 'string' : 'hash']
  23724. : data.map;
  23725. }
  23726. /**
  23727. * Gets the property names, values, and compare flags of `object`.
  23728. *
  23729. * @private
  23730. * @param {Object} object The object to query.
  23731. * @returns {Array} Returns the match data of `object`.
  23732. */
  23733. function getMatchData(object) {
  23734. var result = keys(object),
  23735. length = result.length;
  23736. while (length--) {
  23737. var key = result[length],
  23738. value = object[key];
  23739. result[length] = [key, value, isStrictComparable(value)];
  23740. }
  23741. return result;
  23742. }
  23743. /**
  23744. * Gets the native function at `key` of `object`.
  23745. *
  23746. * @private
  23747. * @param {Object} object The object to query.
  23748. * @param {string} key The key of the method to get.
  23749. * @returns {*} Returns the function if it's native, else `undefined`.
  23750. */
  23751. function getNative(object, key) {
  23752. var value = getValue(object, key);
  23753. return baseIsNative(value) ? value : undefined;
  23754. }
  23755. /**
  23756. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  23757. *
  23758. * @private
  23759. * @param {*} value The value to query.
  23760. * @returns {string} Returns the raw `toStringTag`.
  23761. */
  23762. function getRawTag(value) {
  23763. var isOwn = hasOwnProperty.call(value, symToStringTag),
  23764. tag = value[symToStringTag];
  23765. try {
  23766. value[symToStringTag] = undefined;
  23767. var unmasked = true;
  23768. } catch (e) {}
  23769. var result = nativeObjectToString.call(value);
  23770. if (unmasked) {
  23771. if (isOwn) {
  23772. value[symToStringTag] = tag;
  23773. } else {
  23774. delete value[symToStringTag];
  23775. }
  23776. }
  23777. return result;
  23778. }
  23779. /**
  23780. * Creates an array of the own enumerable symbols of `object`.
  23781. *
  23782. * @private
  23783. * @param {Object} object The object to query.
  23784. * @returns {Array} Returns the array of symbols.
  23785. */
  23786. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  23787. if (object == null) {
  23788. return [];
  23789. }
  23790. object = Object(object);
  23791. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  23792. return propertyIsEnumerable.call(object, symbol);
  23793. });
  23794. };
  23795. /**
  23796. * Creates an array of the own and inherited enumerable symbols of `object`.
  23797. *
  23798. * @private
  23799. * @param {Object} object The object to query.
  23800. * @returns {Array} Returns the array of symbols.
  23801. */
  23802. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  23803. var result = [];
  23804. while (object) {
  23805. arrayPush(result, getSymbols(object));
  23806. object = getPrototype(object);
  23807. }
  23808. return result;
  23809. };
  23810. /**
  23811. * Gets the `toStringTag` of `value`.
  23812. *
  23813. * @private
  23814. * @param {*} value The value to query.
  23815. * @returns {string} Returns the `toStringTag`.
  23816. */
  23817. var getTag = baseGetTag;
  23818. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  23819. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  23820. (Map && getTag(new Map) != mapTag) ||
  23821. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  23822. (Set && getTag(new Set) != setTag) ||
  23823. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  23824. getTag = function(value) {
  23825. var result = baseGetTag(value),
  23826. Ctor = result == objectTag ? value.constructor : undefined,
  23827. ctorString = Ctor ? toSource(Ctor) : '';
  23828. if (ctorString) {
  23829. switch (ctorString) {
  23830. case dataViewCtorString: return dataViewTag;
  23831. case mapCtorString: return mapTag;
  23832. case promiseCtorString: return promiseTag;
  23833. case setCtorString: return setTag;
  23834. case weakMapCtorString: return weakMapTag;
  23835. }
  23836. }
  23837. return result;
  23838. };
  23839. }
  23840. /**
  23841. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  23842. *
  23843. * @private
  23844. * @param {number} start The start of the view.
  23845. * @param {number} end The end of the view.
  23846. * @param {Array} transforms The transformations to apply to the view.
  23847. * @returns {Object} Returns an object containing the `start` and `end`
  23848. * positions of the view.
  23849. */
  23850. function getView(start, end, transforms) {
  23851. var index = -1,
  23852. length = transforms.length;
  23853. while (++index < length) {
  23854. var data = transforms[index],
  23855. size = data.size;
  23856. switch (data.type) {
  23857. case 'drop': start += size; break;
  23858. case 'dropRight': end -= size; break;
  23859. case 'take': end = nativeMin(end, start + size); break;
  23860. case 'takeRight': start = nativeMax(start, end - size); break;
  23861. }
  23862. }
  23863. return { 'start': start, 'end': end };
  23864. }
  23865. /**
  23866. * Extracts wrapper details from the `source` body comment.
  23867. *
  23868. * @private
  23869. * @param {string} source The source to inspect.
  23870. * @returns {Array} Returns the wrapper details.
  23871. */
  23872. function getWrapDetails(source) {
  23873. var match = source.match(reWrapDetails);
  23874. return match ? match[1].split(reSplitDetails) : [];
  23875. }
  23876. /**
  23877. * Checks if `path` exists on `object`.
  23878. *
  23879. * @private
  23880. * @param {Object} object The object to query.
  23881. * @param {Array|string} path The path to check.
  23882. * @param {Function} hasFunc The function to check properties.
  23883. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  23884. */
  23885. function hasPath(object, path, hasFunc) {
  23886. path = castPath(path, object);
  23887. var index = -1,
  23888. length = path.length,
  23889. result = false;
  23890. while (++index < length) {
  23891. var key = toKey(path[index]);
  23892. if (!(result = object != null && hasFunc(object, key))) {
  23893. break;
  23894. }
  23895. object = object[key];
  23896. }
  23897. if (result || ++index != length) {
  23898. return result;
  23899. }
  23900. length = object == null ? 0 : object.length;
  23901. return !!length && isLength(length) && isIndex(key, length) &&
  23902. (isArray(object) || isArguments(object));
  23903. }
  23904. /**
  23905. * Initializes an array clone.
  23906. *
  23907. * @private
  23908. * @param {Array} array The array to clone.
  23909. * @returns {Array} Returns the initialized clone.
  23910. */
  23911. function initCloneArray(array) {
  23912. var length = array.length,
  23913. result = new array.constructor(length);
  23914. // Add properties assigned by `RegExp#exec`.
  23915. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  23916. result.index = array.index;
  23917. result.input = array.input;
  23918. }
  23919. return result;
  23920. }
  23921. /**
  23922. * Initializes an object clone.
  23923. *
  23924. * @private
  23925. * @param {Object} object The object to clone.
  23926. * @returns {Object} Returns the initialized clone.
  23927. */
  23928. function initCloneObject(object) {
  23929. return (typeof object.constructor == 'function' && !isPrototype(object))
  23930. ? baseCreate(getPrototype(object))
  23931. : {};
  23932. }
  23933. /**
  23934. * Initializes an object clone based on its `toStringTag`.
  23935. *
  23936. * **Note:** This function only supports cloning values with tags of
  23937. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  23938. *
  23939. * @private
  23940. * @param {Object} object The object to clone.
  23941. * @param {string} tag The `toStringTag` of the object to clone.
  23942. * @param {boolean} [isDeep] Specify a deep clone.
  23943. * @returns {Object} Returns the initialized clone.
  23944. */
  23945. function initCloneByTag(object, tag, isDeep) {
  23946. var Ctor = object.constructor;
  23947. switch (tag) {
  23948. case arrayBufferTag:
  23949. return cloneArrayBuffer(object);
  23950. case boolTag:
  23951. case dateTag:
  23952. return new Ctor(+object);
  23953. case dataViewTag:
  23954. return cloneDataView(object, isDeep);
  23955. case float32Tag: case float64Tag:
  23956. case int8Tag: case int16Tag: case int32Tag:
  23957. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  23958. return cloneTypedArray(object, isDeep);
  23959. case mapTag:
  23960. return new Ctor;
  23961. case numberTag:
  23962. case stringTag:
  23963. return new Ctor(object);
  23964. case regexpTag:
  23965. return cloneRegExp(object);
  23966. case setTag:
  23967. return new Ctor;
  23968. case symbolTag:
  23969. return cloneSymbol(object);
  23970. }
  23971. }
  23972. /**
  23973. * Inserts wrapper `details` in a comment at the top of the `source` body.
  23974. *
  23975. * @private
  23976. * @param {string} source The source to modify.
  23977. * @returns {Array} details The details to insert.
  23978. * @returns {string} Returns the modified source.
  23979. */
  23980. function insertWrapDetails(source, details) {
  23981. var length = details.length;
  23982. if (!length) {
  23983. return source;
  23984. }
  23985. var lastIndex = length - 1;
  23986. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  23987. details = details.join(length > 2 ? ', ' : ' ');
  23988. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  23989. }
  23990. /**
  23991. * Checks if `value` is a flattenable `arguments` object or array.
  23992. *
  23993. * @private
  23994. * @param {*} value The value to check.
  23995. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  23996. */
  23997. function isFlattenable(value) {
  23998. return isArray(value) || isArguments(value) ||
  23999. !!(spreadableSymbol && value && value[spreadableSymbol]);
  24000. }
  24001. /**
  24002. * Checks if `value` is a valid array-like index.
  24003. *
  24004. * @private
  24005. * @param {*} value The value to check.
  24006. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  24007. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  24008. */
  24009. function isIndex(value, length) {
  24010. var type = typeof value;
  24011. length = length == null ? MAX_SAFE_INTEGER : length;
  24012. return !!length &&
  24013. (type == 'number' ||
  24014. (type != 'symbol' && reIsUint.test(value))) &&
  24015. (value > -1 && value % 1 == 0 && value < length);
  24016. }
  24017. /**
  24018. * Checks if the given arguments are from an iteratee call.
  24019. *
  24020. * @private
  24021. * @param {*} value The potential iteratee value argument.
  24022. * @param {*} index The potential iteratee index or key argument.
  24023. * @param {*} object The potential iteratee object argument.
  24024. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  24025. * else `false`.
  24026. */
  24027. function isIterateeCall(value, index, object) {
  24028. if (!isObject(object)) {
  24029. return false;
  24030. }
  24031. var type = typeof index;
  24032. if (type == 'number'
  24033. ? (isArrayLike(object) && isIndex(index, object.length))
  24034. : (type == 'string' && index in object)
  24035. ) {
  24036. return eq(object[index], value);
  24037. }
  24038. return false;
  24039. }
  24040. /**
  24041. * Checks if `value` is a property name and not a property path.
  24042. *
  24043. * @private
  24044. * @param {*} value The value to check.
  24045. * @param {Object} [object] The object to query keys on.
  24046. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  24047. */
  24048. function isKey(value, object) {
  24049. if (isArray(value)) {
  24050. return false;
  24051. }
  24052. var type = typeof value;
  24053. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  24054. value == null || isSymbol(value)) {
  24055. return true;
  24056. }
  24057. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  24058. (object != null && value in Object(object));
  24059. }
  24060. /**
  24061. * Checks if `value` is suitable for use as unique object key.
  24062. *
  24063. * @private
  24064. * @param {*} value The value to check.
  24065. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  24066. */
  24067. function isKeyable(value) {
  24068. var type = typeof value;
  24069. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  24070. ? (value !== '__proto__')
  24071. : (value === null);
  24072. }
  24073. /**
  24074. * Checks if `func` has a lazy counterpart.
  24075. *
  24076. * @private
  24077. * @param {Function} func The function to check.
  24078. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  24079. * else `false`.
  24080. */
  24081. function isLaziable(func) {
  24082. var funcName = getFuncName(func),
  24083. other = lodash[funcName];
  24084. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  24085. return false;
  24086. }
  24087. if (func === other) {
  24088. return true;
  24089. }
  24090. var data = getData(other);
  24091. return !!data && func === data[0];
  24092. }
  24093. /**
  24094. * Checks if `func` has its source masked.
  24095. *
  24096. * @private
  24097. * @param {Function} func The function to check.
  24098. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  24099. */
  24100. function isMasked(func) {
  24101. return !!maskSrcKey && (maskSrcKey in func);
  24102. }
  24103. /**
  24104. * Checks if `func` is capable of being masked.
  24105. *
  24106. * @private
  24107. * @param {*} value The value to check.
  24108. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  24109. */
  24110. var isMaskable = coreJsData ? isFunction : stubFalse;
  24111. /**
  24112. * Checks if `value` is likely a prototype object.
  24113. *
  24114. * @private
  24115. * @param {*} value The value to check.
  24116. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  24117. */
  24118. function isPrototype(value) {
  24119. var Ctor = value && value.constructor,
  24120. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  24121. return value === proto;
  24122. }
  24123. /**
  24124. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  24125. *
  24126. * @private
  24127. * @param {*} value The value to check.
  24128. * @returns {boolean} Returns `true` if `value` if suitable for strict
  24129. * equality comparisons, else `false`.
  24130. */
  24131. function isStrictComparable(value) {
  24132. return value === value && !isObject(value);
  24133. }
  24134. /**
  24135. * A specialized version of `matchesProperty` for source values suitable
  24136. * for strict equality comparisons, i.e. `===`.
  24137. *
  24138. * @private
  24139. * @param {string} key The key of the property to get.
  24140. * @param {*} srcValue The value to match.
  24141. * @returns {Function} Returns the new spec function.
  24142. */
  24143. function matchesStrictComparable(key, srcValue) {
  24144. return function(object) {
  24145. if (object == null) {
  24146. return false;
  24147. }
  24148. return object[key] === srcValue &&
  24149. (srcValue !== undefined || (key in Object(object)));
  24150. };
  24151. }
  24152. /**
  24153. * A specialized version of `_.memoize` which clears the memoized function's
  24154. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  24155. *
  24156. * @private
  24157. * @param {Function} func The function to have its output memoized.
  24158. * @returns {Function} Returns the new memoized function.
  24159. */
  24160. function memoizeCapped(func) {
  24161. var result = memoize(func, function(key) {
  24162. if (cache.size === MAX_MEMOIZE_SIZE) {
  24163. cache.clear();
  24164. }
  24165. return key;
  24166. });
  24167. var cache = result.cache;
  24168. return result;
  24169. }
  24170. /**
  24171. * Merges the function metadata of `source` into `data`.
  24172. *
  24173. * Merging metadata reduces the number of wrappers used to invoke a function.
  24174. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  24175. * may be applied regardless of execution order. Methods like `_.ary` and
  24176. * `_.rearg` modify function arguments, making the order in which they are
  24177. * executed important, preventing the merging of metadata. However, we make
  24178. * an exception for a safe combined case where curried functions have `_.ary`
  24179. * and or `_.rearg` applied.
  24180. *
  24181. * @private
  24182. * @param {Array} data The destination metadata.
  24183. * @param {Array} source The source metadata.
  24184. * @returns {Array} Returns `data`.
  24185. */
  24186. function mergeData(data, source) {
  24187. var bitmask = data[1],
  24188. srcBitmask = source[1],
  24189. newBitmask = bitmask | srcBitmask,
  24190. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  24191. var isCombo =
  24192. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  24193. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  24194. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  24195. // Exit early if metadata can't be merged.
  24196. if (!(isCommon || isCombo)) {
  24197. return data;
  24198. }
  24199. // Use source `thisArg` if available.
  24200. if (srcBitmask & WRAP_BIND_FLAG) {
  24201. data[2] = source[2];
  24202. // Set when currying a bound function.
  24203. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  24204. }
  24205. // Compose partial arguments.
  24206. var value = source[3];
  24207. if (value) {
  24208. var partials = data[3];
  24209. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  24210. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  24211. }
  24212. // Compose partial right arguments.
  24213. value = source[5];
  24214. if (value) {
  24215. partials = data[5];
  24216. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  24217. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  24218. }
  24219. // Use source `argPos` if available.
  24220. value = source[7];
  24221. if (value) {
  24222. data[7] = value;
  24223. }
  24224. // Use source `ary` if it's smaller.
  24225. if (srcBitmask & WRAP_ARY_FLAG) {
  24226. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  24227. }
  24228. // Use source `arity` if one is not provided.
  24229. if (data[9] == null) {
  24230. data[9] = source[9];
  24231. }
  24232. // Use source `func` and merge bitmasks.
  24233. data[0] = source[0];
  24234. data[1] = newBitmask;
  24235. return data;
  24236. }
  24237. /**
  24238. * This function is like
  24239. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  24240. * except that it includes inherited enumerable properties.
  24241. *
  24242. * @private
  24243. * @param {Object} object The object to query.
  24244. * @returns {Array} Returns the array of property names.
  24245. */
  24246. function nativeKeysIn(object) {
  24247. var result = [];
  24248. if (object != null) {
  24249. for (var key in Object(object)) {
  24250. result.push(key);
  24251. }
  24252. }
  24253. return result;
  24254. }
  24255. /**
  24256. * Converts `value` to a string using `Object.prototype.toString`.
  24257. *
  24258. * @private
  24259. * @param {*} value The value to convert.
  24260. * @returns {string} Returns the converted string.
  24261. */
  24262. function objectToString(value) {
  24263. return nativeObjectToString.call(value);
  24264. }
  24265. /**
  24266. * A specialized version of `baseRest` which transforms the rest array.
  24267. *
  24268. * @private
  24269. * @param {Function} func The function to apply a rest parameter to.
  24270. * @param {number} [start=func.length-1] The start position of the rest parameter.
  24271. * @param {Function} transform The rest array transform.
  24272. * @returns {Function} Returns the new function.
  24273. */
  24274. function overRest(func, start, transform) {
  24275. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  24276. return function() {
  24277. var args = arguments,
  24278. index = -1,
  24279. length = nativeMax(args.length - start, 0),
  24280. array = Array(length);
  24281. while (++index < length) {
  24282. array[index] = args[start + index];
  24283. }
  24284. index = -1;
  24285. var otherArgs = Array(start + 1);
  24286. while (++index < start) {
  24287. otherArgs[index] = args[index];
  24288. }
  24289. otherArgs[start] = transform(array);
  24290. return apply(func, this, otherArgs);
  24291. };
  24292. }
  24293. /**
  24294. * Gets the parent value at `path` of `object`.
  24295. *
  24296. * @private
  24297. * @param {Object} object The object to query.
  24298. * @param {Array} path The path to get the parent value of.
  24299. * @returns {*} Returns the parent value.
  24300. */
  24301. function parent(object, path) {
  24302. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  24303. }
  24304. /**
  24305. * Reorder `array` according to the specified indexes where the element at
  24306. * the first index is assigned as the first element, the element at
  24307. * the second index is assigned as the second element, and so on.
  24308. *
  24309. * @private
  24310. * @param {Array} array The array to reorder.
  24311. * @param {Array} indexes The arranged array indexes.
  24312. * @returns {Array} Returns `array`.
  24313. */
  24314. function reorder(array, indexes) {
  24315. var arrLength = array.length,
  24316. length = nativeMin(indexes.length, arrLength),
  24317. oldArray = copyArray(array);
  24318. while (length--) {
  24319. var index = indexes[length];
  24320. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  24321. }
  24322. return array;
  24323. }
  24324. /**
  24325. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  24326. *
  24327. * @private
  24328. * @param {Object} object The object to query.
  24329. * @param {string} key The key of the property to get.
  24330. * @returns {*} Returns the property value.
  24331. */
  24332. function safeGet(object, key) {
  24333. if (key === 'constructor' && typeof object[key] === 'function') {
  24334. return;
  24335. }
  24336. if (key == '__proto__') {
  24337. return;
  24338. }
  24339. return object[key];
  24340. }
  24341. /**
  24342. * Sets metadata for `func`.
  24343. *
  24344. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  24345. * period of time, it will trip its breaker and transition to an identity
  24346. * function to avoid garbage collection pauses in V8. See
  24347. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  24348. * for more details.
  24349. *
  24350. * @private
  24351. * @param {Function} func The function to associate metadata with.
  24352. * @param {*} data The metadata.
  24353. * @returns {Function} Returns `func`.
  24354. */
  24355. var setData = shortOut(baseSetData);
  24356. /**
  24357. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  24358. *
  24359. * @private
  24360. * @param {Function} func The function to delay.
  24361. * @param {number} wait The number of milliseconds to delay invocation.
  24362. * @returns {number|Object} Returns the timer id or timeout object.
  24363. */
  24364. var setTimeout = ctxSetTimeout || function(func, wait) {
  24365. return root.setTimeout(func, wait);
  24366. };
  24367. /**
  24368. * Sets the `toString` method of `func` to return `string`.
  24369. *
  24370. * @private
  24371. * @param {Function} func The function to modify.
  24372. * @param {Function} string The `toString` result.
  24373. * @returns {Function} Returns `func`.
  24374. */
  24375. var setToString = shortOut(baseSetToString);
  24376. /**
  24377. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  24378. * with wrapper details in a comment at the top of the source body.
  24379. *
  24380. * @private
  24381. * @param {Function} wrapper The function to modify.
  24382. * @param {Function} reference The reference function.
  24383. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24384. * @returns {Function} Returns `wrapper`.
  24385. */
  24386. function setWrapToString(wrapper, reference, bitmask) {
  24387. var source = (reference + '');
  24388. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  24389. }
  24390. /**
  24391. * Creates a function that'll short out and invoke `identity` instead
  24392. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  24393. * milliseconds.
  24394. *
  24395. * @private
  24396. * @param {Function} func The function to restrict.
  24397. * @returns {Function} Returns the new shortable function.
  24398. */
  24399. function shortOut(func) {
  24400. var count = 0,
  24401. lastCalled = 0;
  24402. return function() {
  24403. var stamp = nativeNow(),
  24404. remaining = HOT_SPAN - (stamp - lastCalled);
  24405. lastCalled = stamp;
  24406. if (remaining > 0) {
  24407. if (++count >= HOT_COUNT) {
  24408. return arguments[0];
  24409. }
  24410. } else {
  24411. count = 0;
  24412. }
  24413. return func.apply(undefined, arguments);
  24414. };
  24415. }
  24416. /**
  24417. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  24418. *
  24419. * @private
  24420. * @param {Array} array The array to shuffle.
  24421. * @param {number} [size=array.length] The size of `array`.
  24422. * @returns {Array} Returns `array`.
  24423. */
  24424. function shuffleSelf(array, size) {
  24425. var index = -1,
  24426. length = array.length,
  24427. lastIndex = length - 1;
  24428. size = size === undefined ? length : size;
  24429. while (++index < size) {
  24430. var rand = baseRandom(index, lastIndex),
  24431. value = array[rand];
  24432. array[rand] = array[index];
  24433. array[index] = value;
  24434. }
  24435. array.length = size;
  24436. return array;
  24437. }
  24438. /**
  24439. * Converts `string` to a property path array.
  24440. *
  24441. * @private
  24442. * @param {string} string The string to convert.
  24443. * @returns {Array} Returns the property path array.
  24444. */
  24445. var stringToPath = memoizeCapped(function(string) {
  24446. var result = [];
  24447. if (string.charCodeAt(0) === 46 /* . */) {
  24448. result.push('');
  24449. }
  24450. string.replace(rePropName, function(match, number, quote, subString) {
  24451. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  24452. });
  24453. return result;
  24454. });
  24455. /**
  24456. * Converts `value` to a string key if it's not a string or symbol.
  24457. *
  24458. * @private
  24459. * @param {*} value The value to inspect.
  24460. * @returns {string|symbol} Returns the key.
  24461. */
  24462. function toKey(value) {
  24463. if (typeof value == 'string' || isSymbol(value)) {
  24464. return value;
  24465. }
  24466. var result = (value + '');
  24467. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  24468. }
  24469. /**
  24470. * Converts `func` to its source code.
  24471. *
  24472. * @private
  24473. * @param {Function} func The function to convert.
  24474. * @returns {string} Returns the source code.
  24475. */
  24476. function toSource(func) {
  24477. if (func != null) {
  24478. try {
  24479. return funcToString.call(func);
  24480. } catch (e) {}
  24481. try {
  24482. return (func + '');
  24483. } catch (e) {}
  24484. }
  24485. return '';
  24486. }
  24487. /**
  24488. * Updates wrapper `details` based on `bitmask` flags.
  24489. *
  24490. * @private
  24491. * @returns {Array} details The details to modify.
  24492. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24493. * @returns {Array} Returns `details`.
  24494. */
  24495. function updateWrapDetails(details, bitmask) {
  24496. arrayEach(wrapFlags, function(pair) {
  24497. var value = '_.' + pair[0];
  24498. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  24499. details.push(value);
  24500. }
  24501. });
  24502. return details.sort();
  24503. }
  24504. /**
  24505. * Creates a clone of `wrapper`.
  24506. *
  24507. * @private
  24508. * @param {Object} wrapper The wrapper to clone.
  24509. * @returns {Object} Returns the cloned wrapper.
  24510. */
  24511. function wrapperClone(wrapper) {
  24512. if (wrapper instanceof LazyWrapper) {
  24513. return wrapper.clone();
  24514. }
  24515. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  24516. result.__actions__ = copyArray(wrapper.__actions__);
  24517. result.__index__ = wrapper.__index__;
  24518. result.__values__ = wrapper.__values__;
  24519. return result;
  24520. }
  24521. /*------------------------------------------------------------------------*/
  24522. /**
  24523. * Creates an array of elements split into groups the length of `size`.
  24524. * If `array` can't be split evenly, the final chunk will be the remaining
  24525. * elements.
  24526. *
  24527. * @static
  24528. * @memberOf _
  24529. * @since 3.0.0
  24530. * @category Array
  24531. * @param {Array} array The array to process.
  24532. * @param {number} [size=1] The length of each chunk
  24533. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24534. * @returns {Array} Returns the new array of chunks.
  24535. * @example
  24536. *
  24537. * _.chunk(['a', 'b', 'c', 'd'], 2);
  24538. * // => [['a', 'b'], ['c', 'd']]
  24539. *
  24540. * _.chunk(['a', 'b', 'c', 'd'], 3);
  24541. * // => [['a', 'b', 'c'], ['d']]
  24542. */
  24543. function chunk(array, size, guard) {
  24544. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  24545. size = 1;
  24546. } else {
  24547. size = nativeMax(toInteger(size), 0);
  24548. }
  24549. var length = array == null ? 0 : array.length;
  24550. if (!length || size < 1) {
  24551. return [];
  24552. }
  24553. var index = 0,
  24554. resIndex = 0,
  24555. result = Array(nativeCeil(length / size));
  24556. while (index < length) {
  24557. result[resIndex++] = baseSlice(array, index, (index += size));
  24558. }
  24559. return result;
  24560. }
  24561. /**
  24562. * Creates an array with all falsey values removed. The values `false`, `null`,
  24563. * `0`, `""`, `undefined`, and `NaN` are falsey.
  24564. *
  24565. * @static
  24566. * @memberOf _
  24567. * @since 0.1.0
  24568. * @category Array
  24569. * @param {Array} array The array to compact.
  24570. * @returns {Array} Returns the new array of filtered values.
  24571. * @example
  24572. *
  24573. * _.compact([0, 1, false, 2, '', 3]);
  24574. * // => [1, 2, 3]
  24575. */
  24576. function compact(array) {
  24577. var index = -1,
  24578. length = array == null ? 0 : array.length,
  24579. resIndex = 0,
  24580. result = [];
  24581. while (++index < length) {
  24582. var value = array[index];
  24583. if (value) {
  24584. result[resIndex++] = value;
  24585. }
  24586. }
  24587. return result;
  24588. }
  24589. /**
  24590. * Creates a new array concatenating `array` with any additional arrays
  24591. * and/or values.
  24592. *
  24593. * @static
  24594. * @memberOf _
  24595. * @since 4.0.0
  24596. * @category Array
  24597. * @param {Array} array The array to concatenate.
  24598. * @param {...*} [values] The values to concatenate.
  24599. * @returns {Array} Returns the new concatenated array.
  24600. * @example
  24601. *
  24602. * var array = [1];
  24603. * var other = _.concat(array, 2, [3], [[4]]);
  24604. *
  24605. * console.log(other);
  24606. * // => [1, 2, 3, [4]]
  24607. *
  24608. * console.log(array);
  24609. * // => [1]
  24610. */
  24611. function concat() {
  24612. var length = arguments.length;
  24613. if (!length) {
  24614. return [];
  24615. }
  24616. var args = Array(length - 1),
  24617. array = arguments[0],
  24618. index = length;
  24619. while (index--) {
  24620. args[index - 1] = arguments[index];
  24621. }
  24622. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  24623. }
  24624. /**
  24625. * Creates an array of `array` values not included in the other given arrays
  24626. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24627. * for equality comparisons. The order and references of result values are
  24628. * determined by the first array.
  24629. *
  24630. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  24631. *
  24632. * @static
  24633. * @memberOf _
  24634. * @since 0.1.0
  24635. * @category Array
  24636. * @param {Array} array The array to inspect.
  24637. * @param {...Array} [values] The values to exclude.
  24638. * @returns {Array} Returns the new array of filtered values.
  24639. * @see _.without, _.xor
  24640. * @example
  24641. *
  24642. * _.difference([2, 1], [2, 3]);
  24643. * // => [1]
  24644. */
  24645. var difference = baseRest(function(array, values) {
  24646. return isArrayLikeObject(array)
  24647. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  24648. : [];
  24649. });
  24650. /**
  24651. * This method is like `_.difference` except that it accepts `iteratee` which
  24652. * is invoked for each element of `array` and `values` to generate the criterion
  24653. * by which they're compared. The order and references of result values are
  24654. * determined by the first array. The iteratee is invoked with one argument:
  24655. * (value).
  24656. *
  24657. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  24658. *
  24659. * @static
  24660. * @memberOf _
  24661. * @since 4.0.0
  24662. * @category Array
  24663. * @param {Array} array The array to inspect.
  24664. * @param {...Array} [values] The values to exclude.
  24665. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24666. * @returns {Array} Returns the new array of filtered values.
  24667. * @example
  24668. *
  24669. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24670. * // => [1.2]
  24671. *
  24672. * // The `_.property` iteratee shorthand.
  24673. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  24674. * // => [{ 'x': 2 }]
  24675. */
  24676. var differenceBy = baseRest(function(array, values) {
  24677. var iteratee = last(values);
  24678. if (isArrayLikeObject(iteratee)) {
  24679. iteratee = undefined;
  24680. }
  24681. return isArrayLikeObject(array)
  24682. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  24683. : [];
  24684. });
  24685. /**
  24686. * This method is like `_.difference` except that it accepts `comparator`
  24687. * which is invoked to compare elements of `array` to `values`. The order and
  24688. * references of result values are determined by the first array. The comparator
  24689. * is invoked with two arguments: (arrVal, othVal).
  24690. *
  24691. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  24692. *
  24693. * @static
  24694. * @memberOf _
  24695. * @since 4.0.0
  24696. * @category Array
  24697. * @param {Array} array The array to inspect.
  24698. * @param {...Array} [values] The values to exclude.
  24699. * @param {Function} [comparator] The comparator invoked per element.
  24700. * @returns {Array} Returns the new array of filtered values.
  24701. * @example
  24702. *
  24703. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24704. *
  24705. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  24706. * // => [{ 'x': 2, 'y': 1 }]
  24707. */
  24708. var differenceWith = baseRest(function(array, values) {
  24709. var comparator = last(values);
  24710. if (isArrayLikeObject(comparator)) {
  24711. comparator = undefined;
  24712. }
  24713. return isArrayLikeObject(array)
  24714. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  24715. : [];
  24716. });
  24717. /**
  24718. * Creates a slice of `array` with `n` elements dropped from the beginning.
  24719. *
  24720. * @static
  24721. * @memberOf _
  24722. * @since 0.5.0
  24723. * @category Array
  24724. * @param {Array} array The array to query.
  24725. * @param {number} [n=1] The number of elements to drop.
  24726. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24727. * @returns {Array} Returns the slice of `array`.
  24728. * @example
  24729. *
  24730. * _.drop([1, 2, 3]);
  24731. * // => [2, 3]
  24732. *
  24733. * _.drop([1, 2, 3], 2);
  24734. * // => [3]
  24735. *
  24736. * _.drop([1, 2, 3], 5);
  24737. * // => []
  24738. *
  24739. * _.drop([1, 2, 3], 0);
  24740. * // => [1, 2, 3]
  24741. */
  24742. function drop(array, n, guard) {
  24743. var length = array == null ? 0 : array.length;
  24744. if (!length) {
  24745. return [];
  24746. }
  24747. n = (guard || n === undefined) ? 1 : toInteger(n);
  24748. return baseSlice(array, n < 0 ? 0 : n, length);
  24749. }
  24750. /**
  24751. * Creates a slice of `array` with `n` elements dropped from the end.
  24752. *
  24753. * @static
  24754. * @memberOf _
  24755. * @since 3.0.0
  24756. * @category Array
  24757. * @param {Array} array The array to query.
  24758. * @param {number} [n=1] The number of elements to drop.
  24759. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24760. * @returns {Array} Returns the slice of `array`.
  24761. * @example
  24762. *
  24763. * _.dropRight([1, 2, 3]);
  24764. * // => [1, 2]
  24765. *
  24766. * _.dropRight([1, 2, 3], 2);
  24767. * // => [1]
  24768. *
  24769. * _.dropRight([1, 2, 3], 5);
  24770. * // => []
  24771. *
  24772. * _.dropRight([1, 2, 3], 0);
  24773. * // => [1, 2, 3]
  24774. */
  24775. function dropRight(array, n, guard) {
  24776. var length = array == null ? 0 : array.length;
  24777. if (!length) {
  24778. return [];
  24779. }
  24780. n = (guard || n === undefined) ? 1 : toInteger(n);
  24781. n = length - n;
  24782. return baseSlice(array, 0, n < 0 ? 0 : n);
  24783. }
  24784. /**
  24785. * Creates a slice of `array` excluding elements dropped from the end.
  24786. * Elements are dropped until `predicate` returns falsey. The predicate is
  24787. * invoked with three arguments: (value, index, array).
  24788. *
  24789. * @static
  24790. * @memberOf _
  24791. * @since 3.0.0
  24792. * @category Array
  24793. * @param {Array} array The array to query.
  24794. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24795. * @returns {Array} Returns the slice of `array`.
  24796. * @example
  24797. *
  24798. * var users = [
  24799. * { 'user': 'barney', 'active': true },
  24800. * { 'user': 'fred', 'active': false },
  24801. * { 'user': 'pebbles', 'active': false }
  24802. * ];
  24803. *
  24804. * _.dropRightWhile(users, function(o) { return !o.active; });
  24805. * // => objects for ['barney']
  24806. *
  24807. * // The `_.matches` iteratee shorthand.
  24808. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  24809. * // => objects for ['barney', 'fred']
  24810. *
  24811. * // The `_.matchesProperty` iteratee shorthand.
  24812. * _.dropRightWhile(users, ['active', false]);
  24813. * // => objects for ['barney']
  24814. *
  24815. * // The `_.property` iteratee shorthand.
  24816. * _.dropRightWhile(users, 'active');
  24817. * // => objects for ['barney', 'fred', 'pebbles']
  24818. */
  24819. function dropRightWhile(array, predicate) {
  24820. return (array && array.length)
  24821. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  24822. : [];
  24823. }
  24824. /**
  24825. * Creates a slice of `array` excluding elements dropped from the beginning.
  24826. * Elements are dropped until `predicate` returns falsey. The predicate is
  24827. * invoked with three arguments: (value, index, array).
  24828. *
  24829. * @static
  24830. * @memberOf _
  24831. * @since 3.0.0
  24832. * @category Array
  24833. * @param {Array} array The array to query.
  24834. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24835. * @returns {Array} Returns the slice of `array`.
  24836. * @example
  24837. *
  24838. * var users = [
  24839. * { 'user': 'barney', 'active': false },
  24840. * { 'user': 'fred', 'active': false },
  24841. * { 'user': 'pebbles', 'active': true }
  24842. * ];
  24843. *
  24844. * _.dropWhile(users, function(o) { return !o.active; });
  24845. * // => objects for ['pebbles']
  24846. *
  24847. * // The `_.matches` iteratee shorthand.
  24848. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  24849. * // => objects for ['fred', 'pebbles']
  24850. *
  24851. * // The `_.matchesProperty` iteratee shorthand.
  24852. * _.dropWhile(users, ['active', false]);
  24853. * // => objects for ['pebbles']
  24854. *
  24855. * // The `_.property` iteratee shorthand.
  24856. * _.dropWhile(users, 'active');
  24857. * // => objects for ['barney', 'fred', 'pebbles']
  24858. */
  24859. function dropWhile(array, predicate) {
  24860. return (array && array.length)
  24861. ? baseWhile(array, getIteratee(predicate, 3), true)
  24862. : [];
  24863. }
  24864. /**
  24865. * Fills elements of `array` with `value` from `start` up to, but not
  24866. * including, `end`.
  24867. *
  24868. * **Note:** This method mutates `array`.
  24869. *
  24870. * @static
  24871. * @memberOf _
  24872. * @since 3.2.0
  24873. * @category Array
  24874. * @param {Array} array The array to fill.
  24875. * @param {*} value The value to fill `array` with.
  24876. * @param {number} [start=0] The start position.
  24877. * @param {number} [end=array.length] The end position.
  24878. * @returns {Array} Returns `array`.
  24879. * @example
  24880. *
  24881. * var array = [1, 2, 3];
  24882. *
  24883. * _.fill(array, 'a');
  24884. * console.log(array);
  24885. * // => ['a', 'a', 'a']
  24886. *
  24887. * _.fill(Array(3), 2);
  24888. * // => [2, 2, 2]
  24889. *
  24890. * _.fill([4, 6, 8, 10], '*', 1, 3);
  24891. * // => [4, '*', '*', 10]
  24892. */
  24893. function fill(array, value, start, end) {
  24894. var length = array == null ? 0 : array.length;
  24895. if (!length) {
  24896. return [];
  24897. }
  24898. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  24899. start = 0;
  24900. end = length;
  24901. }
  24902. return baseFill(array, value, start, end);
  24903. }
  24904. /**
  24905. * This method is like `_.find` except that it returns the index of the first
  24906. * element `predicate` returns truthy for instead of the element itself.
  24907. *
  24908. * @static
  24909. * @memberOf _
  24910. * @since 1.1.0
  24911. * @category Array
  24912. * @param {Array} array The array to inspect.
  24913. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24914. * @param {number} [fromIndex=0] The index to search from.
  24915. * @returns {number} Returns the index of the found element, else `-1`.
  24916. * @example
  24917. *
  24918. * var users = [
  24919. * { 'user': 'barney', 'active': false },
  24920. * { 'user': 'fred', 'active': false },
  24921. * { 'user': 'pebbles', 'active': true }
  24922. * ];
  24923. *
  24924. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  24925. * // => 0
  24926. *
  24927. * // The `_.matches` iteratee shorthand.
  24928. * _.findIndex(users, { 'user': 'fred', 'active': false });
  24929. * // => 1
  24930. *
  24931. * // The `_.matchesProperty` iteratee shorthand.
  24932. * _.findIndex(users, ['active', false]);
  24933. * // => 0
  24934. *
  24935. * // The `_.property` iteratee shorthand.
  24936. * _.findIndex(users, 'active');
  24937. * // => 2
  24938. */
  24939. function findIndex(array, predicate, fromIndex) {
  24940. var length = array == null ? 0 : array.length;
  24941. if (!length) {
  24942. return -1;
  24943. }
  24944. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  24945. if (index < 0) {
  24946. index = nativeMax(length + index, 0);
  24947. }
  24948. return baseFindIndex(array, getIteratee(predicate, 3), index);
  24949. }
  24950. /**
  24951. * This method is like `_.findIndex` except that it iterates over elements
  24952. * of `collection` from right to left.
  24953. *
  24954. * @static
  24955. * @memberOf _
  24956. * @since 2.0.0
  24957. * @category Array
  24958. * @param {Array} array The array to inspect.
  24959. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24960. * @param {number} [fromIndex=array.length-1] The index to search from.
  24961. * @returns {number} Returns the index of the found element, else `-1`.
  24962. * @example
  24963. *
  24964. * var users = [
  24965. * { 'user': 'barney', 'active': true },
  24966. * { 'user': 'fred', 'active': false },
  24967. * { 'user': 'pebbles', 'active': false }
  24968. * ];
  24969. *
  24970. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  24971. * // => 2
  24972. *
  24973. * // The `_.matches` iteratee shorthand.
  24974. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  24975. * // => 0
  24976. *
  24977. * // The `_.matchesProperty` iteratee shorthand.
  24978. * _.findLastIndex(users, ['active', false]);
  24979. * // => 2
  24980. *
  24981. * // The `_.property` iteratee shorthand.
  24982. * _.findLastIndex(users, 'active');
  24983. * // => 0
  24984. */
  24985. function findLastIndex(array, predicate, fromIndex) {
  24986. var length = array == null ? 0 : array.length;
  24987. if (!length) {
  24988. return -1;
  24989. }
  24990. var index = length - 1;
  24991. if (fromIndex !== undefined) {
  24992. index = toInteger(fromIndex);
  24993. index = fromIndex < 0
  24994. ? nativeMax(length + index, 0)
  24995. : nativeMin(index, length - 1);
  24996. }
  24997. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  24998. }
  24999. /**
  25000. * Flattens `array` a single level deep.
  25001. *
  25002. * @static
  25003. * @memberOf _
  25004. * @since 0.1.0
  25005. * @category Array
  25006. * @param {Array} array The array to flatten.
  25007. * @returns {Array} Returns the new flattened array.
  25008. * @example
  25009. *
  25010. * _.flatten([1, [2, [3, [4]], 5]]);
  25011. * // => [1, 2, [3, [4]], 5]
  25012. */
  25013. function flatten(array) {
  25014. var length = array == null ? 0 : array.length;
  25015. return length ? baseFlatten(array, 1) : [];
  25016. }
  25017. /**
  25018. * Recursively flattens `array`.
  25019. *
  25020. * @static
  25021. * @memberOf _
  25022. * @since 3.0.0
  25023. * @category Array
  25024. * @param {Array} array The array to flatten.
  25025. * @returns {Array} Returns the new flattened array.
  25026. * @example
  25027. *
  25028. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  25029. * // => [1, 2, 3, 4, 5]
  25030. */
  25031. function flattenDeep(array) {
  25032. var length = array == null ? 0 : array.length;
  25033. return length ? baseFlatten(array, INFINITY) : [];
  25034. }
  25035. /**
  25036. * Recursively flatten `array` up to `depth` times.
  25037. *
  25038. * @static
  25039. * @memberOf _
  25040. * @since 4.4.0
  25041. * @category Array
  25042. * @param {Array} array The array to flatten.
  25043. * @param {number} [depth=1] The maximum recursion depth.
  25044. * @returns {Array} Returns the new flattened array.
  25045. * @example
  25046. *
  25047. * var array = [1, [2, [3, [4]], 5]];
  25048. *
  25049. * _.flattenDepth(array, 1);
  25050. * // => [1, 2, [3, [4]], 5]
  25051. *
  25052. * _.flattenDepth(array, 2);
  25053. * // => [1, 2, 3, [4], 5]
  25054. */
  25055. function flattenDepth(array, depth) {
  25056. var length = array == null ? 0 : array.length;
  25057. if (!length) {
  25058. return [];
  25059. }
  25060. depth = depth === undefined ? 1 : toInteger(depth);
  25061. return baseFlatten(array, depth);
  25062. }
  25063. /**
  25064. * The inverse of `_.toPairs`; this method returns an object composed
  25065. * from key-value `pairs`.
  25066. *
  25067. * @static
  25068. * @memberOf _
  25069. * @since 4.0.0
  25070. * @category Array
  25071. * @param {Array} pairs The key-value pairs.
  25072. * @returns {Object} Returns the new object.
  25073. * @example
  25074. *
  25075. * _.fromPairs([['a', 1], ['b', 2]]);
  25076. * // => { 'a': 1, 'b': 2 }
  25077. */
  25078. function fromPairs(pairs) {
  25079. var index = -1,
  25080. length = pairs == null ? 0 : pairs.length,
  25081. result = {};
  25082. while (++index < length) {
  25083. var pair = pairs[index];
  25084. result[pair[0]] = pair[1];
  25085. }
  25086. return result;
  25087. }
  25088. /**
  25089. * Gets the first element of `array`.
  25090. *
  25091. * @static
  25092. * @memberOf _
  25093. * @since 0.1.0
  25094. * @alias first
  25095. * @category Array
  25096. * @param {Array} array The array to query.
  25097. * @returns {*} Returns the first element of `array`.
  25098. * @example
  25099. *
  25100. * _.head([1, 2, 3]);
  25101. * // => 1
  25102. *
  25103. * _.head([]);
  25104. * // => undefined
  25105. */
  25106. function head(array) {
  25107. return (array && array.length) ? array[0] : undefined;
  25108. }
  25109. /**
  25110. * Gets the index at which the first occurrence of `value` is found in `array`
  25111. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25112. * for equality comparisons. If `fromIndex` is negative, it's used as the
  25113. * offset from the end of `array`.
  25114. *
  25115. * @static
  25116. * @memberOf _
  25117. * @since 0.1.0
  25118. * @category Array
  25119. * @param {Array} array The array to inspect.
  25120. * @param {*} value The value to search for.
  25121. * @param {number} [fromIndex=0] The index to search from.
  25122. * @returns {number} Returns the index of the matched value, else `-1`.
  25123. * @example
  25124. *
  25125. * _.indexOf([1, 2, 1, 2], 2);
  25126. * // => 1
  25127. *
  25128. * // Search from the `fromIndex`.
  25129. * _.indexOf([1, 2, 1, 2], 2, 2);
  25130. * // => 3
  25131. */
  25132. function indexOf(array, value, fromIndex) {
  25133. var length = array == null ? 0 : array.length;
  25134. if (!length) {
  25135. return -1;
  25136. }
  25137. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25138. if (index < 0) {
  25139. index = nativeMax(length + index, 0);
  25140. }
  25141. return baseIndexOf(array, value, index);
  25142. }
  25143. /**
  25144. * Gets all but the last element of `array`.
  25145. *
  25146. * @static
  25147. * @memberOf _
  25148. * @since 0.1.0
  25149. * @category Array
  25150. * @param {Array} array The array to query.
  25151. * @returns {Array} Returns the slice of `array`.
  25152. * @example
  25153. *
  25154. * _.initial([1, 2, 3]);
  25155. * // => [1, 2]
  25156. */
  25157. function initial(array) {
  25158. var length = array == null ? 0 : array.length;
  25159. return length ? baseSlice(array, 0, -1) : [];
  25160. }
  25161. /**
  25162. * Creates an array of unique values that are included in all given arrays
  25163. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25164. * for equality comparisons. The order and references of result values are
  25165. * determined by the first array.
  25166. *
  25167. * @static
  25168. * @memberOf _
  25169. * @since 0.1.0
  25170. * @category Array
  25171. * @param {...Array} [arrays] The arrays to inspect.
  25172. * @returns {Array} Returns the new array of intersecting values.
  25173. * @example
  25174. *
  25175. * _.intersection([2, 1], [2, 3]);
  25176. * // => [2]
  25177. */
  25178. var intersection = baseRest(function(arrays) {
  25179. var mapped = arrayMap(arrays, castArrayLikeObject);
  25180. return (mapped.length && mapped[0] === arrays[0])
  25181. ? baseIntersection(mapped)
  25182. : [];
  25183. });
  25184. /**
  25185. * This method is like `_.intersection` except that it accepts `iteratee`
  25186. * which is invoked for each element of each `arrays` to generate the criterion
  25187. * by which they're compared. The order and references of result values are
  25188. * determined by the first array. The iteratee is invoked with one argument:
  25189. * (value).
  25190. *
  25191. * @static
  25192. * @memberOf _
  25193. * @since 4.0.0
  25194. * @category Array
  25195. * @param {...Array} [arrays] The arrays to inspect.
  25196. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25197. * @returns {Array} Returns the new array of intersecting values.
  25198. * @example
  25199. *
  25200. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25201. * // => [2.1]
  25202. *
  25203. * // The `_.property` iteratee shorthand.
  25204. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25205. * // => [{ 'x': 1 }]
  25206. */
  25207. var intersectionBy = baseRest(function(arrays) {
  25208. var iteratee = last(arrays),
  25209. mapped = arrayMap(arrays, castArrayLikeObject);
  25210. if (iteratee === last(mapped)) {
  25211. iteratee = undefined;
  25212. } else {
  25213. mapped.pop();
  25214. }
  25215. return (mapped.length && mapped[0] === arrays[0])
  25216. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  25217. : [];
  25218. });
  25219. /**
  25220. * This method is like `_.intersection` except that it accepts `comparator`
  25221. * which is invoked to compare elements of `arrays`. The order and references
  25222. * of result values are determined by the first array. The comparator is
  25223. * invoked with two arguments: (arrVal, othVal).
  25224. *
  25225. * @static
  25226. * @memberOf _
  25227. * @since 4.0.0
  25228. * @category Array
  25229. * @param {...Array} [arrays] The arrays to inspect.
  25230. * @param {Function} [comparator] The comparator invoked per element.
  25231. * @returns {Array} Returns the new array of intersecting values.
  25232. * @example
  25233. *
  25234. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25235. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25236. *
  25237. * _.intersectionWith(objects, others, _.isEqual);
  25238. * // => [{ 'x': 1, 'y': 2 }]
  25239. */
  25240. var intersectionWith = baseRest(function(arrays) {
  25241. var comparator = last(arrays),
  25242. mapped = arrayMap(arrays, castArrayLikeObject);
  25243. comparator = typeof comparator == 'function' ? comparator : undefined;
  25244. if (comparator) {
  25245. mapped.pop();
  25246. }
  25247. return (mapped.length && mapped[0] === arrays[0])
  25248. ? baseIntersection(mapped, undefined, comparator)
  25249. : [];
  25250. });
  25251. /**
  25252. * Converts all elements in `array` into a string separated by `separator`.
  25253. *
  25254. * @static
  25255. * @memberOf _
  25256. * @since 4.0.0
  25257. * @category Array
  25258. * @param {Array} array The array to convert.
  25259. * @param {string} [separator=','] The element separator.
  25260. * @returns {string} Returns the joined string.
  25261. * @example
  25262. *
  25263. * _.join(['a', 'b', 'c'], '~');
  25264. * // => 'a~b~c'
  25265. */
  25266. function join(array, separator) {
  25267. return array == null ? '' : nativeJoin.call(array, separator);
  25268. }
  25269. /**
  25270. * Gets the last element of `array`.
  25271. *
  25272. * @static
  25273. * @memberOf _
  25274. * @since 0.1.0
  25275. * @category Array
  25276. * @param {Array} array The array to query.
  25277. * @returns {*} Returns the last element of `array`.
  25278. * @example
  25279. *
  25280. * _.last([1, 2, 3]);
  25281. * // => 3
  25282. */
  25283. function last(array) {
  25284. var length = array == null ? 0 : array.length;
  25285. return length ? array[length - 1] : undefined;
  25286. }
  25287. /**
  25288. * This method is like `_.indexOf` except that it iterates over elements of
  25289. * `array` from right to left.
  25290. *
  25291. * @static
  25292. * @memberOf _
  25293. * @since 0.1.0
  25294. * @category Array
  25295. * @param {Array} array The array to inspect.
  25296. * @param {*} value The value to search for.
  25297. * @param {number} [fromIndex=array.length-1] The index to search from.
  25298. * @returns {number} Returns the index of the matched value, else `-1`.
  25299. * @example
  25300. *
  25301. * _.lastIndexOf([1, 2, 1, 2], 2);
  25302. * // => 3
  25303. *
  25304. * // Search from the `fromIndex`.
  25305. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  25306. * // => 1
  25307. */
  25308. function lastIndexOf(array, value, fromIndex) {
  25309. var length = array == null ? 0 : array.length;
  25310. if (!length) {
  25311. return -1;
  25312. }
  25313. var index = length;
  25314. if (fromIndex !== undefined) {
  25315. index = toInteger(fromIndex);
  25316. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  25317. }
  25318. return value === value
  25319. ? strictLastIndexOf(array, value, index)
  25320. : baseFindIndex(array, baseIsNaN, index, true);
  25321. }
  25322. /**
  25323. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  25324. * element from the end is returned.
  25325. *
  25326. * @static
  25327. * @memberOf _
  25328. * @since 4.11.0
  25329. * @category Array
  25330. * @param {Array} array The array to query.
  25331. * @param {number} [n=0] The index of the element to return.
  25332. * @returns {*} Returns the nth element of `array`.
  25333. * @example
  25334. *
  25335. * var array = ['a', 'b', 'c', 'd'];
  25336. *
  25337. * _.nth(array, 1);
  25338. * // => 'b'
  25339. *
  25340. * _.nth(array, -2);
  25341. * // => 'c';
  25342. */
  25343. function nth(array, n) {
  25344. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  25345. }
  25346. /**
  25347. * Removes all given values from `array` using
  25348. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25349. * for equality comparisons.
  25350. *
  25351. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  25352. * to remove elements from an array by predicate.
  25353. *
  25354. * @static
  25355. * @memberOf _
  25356. * @since 2.0.0
  25357. * @category Array
  25358. * @param {Array} array The array to modify.
  25359. * @param {...*} [values] The values to remove.
  25360. * @returns {Array} Returns `array`.
  25361. * @example
  25362. *
  25363. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25364. *
  25365. * _.pull(array, 'a', 'c');
  25366. * console.log(array);
  25367. * // => ['b', 'b']
  25368. */
  25369. var pull = baseRest(pullAll);
  25370. /**
  25371. * This method is like `_.pull` except that it accepts an array of values to remove.
  25372. *
  25373. * **Note:** Unlike `_.difference`, this method mutates `array`.
  25374. *
  25375. * @static
  25376. * @memberOf _
  25377. * @since 4.0.0
  25378. * @category Array
  25379. * @param {Array} array The array to modify.
  25380. * @param {Array} values The values to remove.
  25381. * @returns {Array} Returns `array`.
  25382. * @example
  25383. *
  25384. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25385. *
  25386. * _.pullAll(array, ['a', 'c']);
  25387. * console.log(array);
  25388. * // => ['b', 'b']
  25389. */
  25390. function pullAll(array, values) {
  25391. return (array && array.length && values && values.length)
  25392. ? basePullAll(array, values)
  25393. : array;
  25394. }
  25395. /**
  25396. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  25397. * invoked for each element of `array` and `values` to generate the criterion
  25398. * by which they're compared. The iteratee is invoked with one argument: (value).
  25399. *
  25400. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  25401. *
  25402. * @static
  25403. * @memberOf _
  25404. * @since 4.0.0
  25405. * @category Array
  25406. * @param {Array} array The array to modify.
  25407. * @param {Array} values The values to remove.
  25408. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25409. * @returns {Array} Returns `array`.
  25410. * @example
  25411. *
  25412. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  25413. *
  25414. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  25415. * console.log(array);
  25416. * // => [{ 'x': 2 }]
  25417. */
  25418. function pullAllBy(array, values, iteratee) {
  25419. return (array && array.length && values && values.length)
  25420. ? basePullAll(array, values, getIteratee(iteratee, 2))
  25421. : array;
  25422. }
  25423. /**
  25424. * This method is like `_.pullAll` except that it accepts `comparator` which
  25425. * is invoked to compare elements of `array` to `values`. The comparator is
  25426. * invoked with two arguments: (arrVal, othVal).
  25427. *
  25428. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  25429. *
  25430. * @static
  25431. * @memberOf _
  25432. * @since 4.6.0
  25433. * @category Array
  25434. * @param {Array} array The array to modify.
  25435. * @param {Array} values The values to remove.
  25436. * @param {Function} [comparator] The comparator invoked per element.
  25437. * @returns {Array} Returns `array`.
  25438. * @example
  25439. *
  25440. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  25441. *
  25442. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  25443. * console.log(array);
  25444. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  25445. */
  25446. function pullAllWith(array, values, comparator) {
  25447. return (array && array.length && values && values.length)
  25448. ? basePullAll(array, values, undefined, comparator)
  25449. : array;
  25450. }
  25451. /**
  25452. * Removes elements from `array` corresponding to `indexes` and returns an
  25453. * array of removed elements.
  25454. *
  25455. * **Note:** Unlike `_.at`, this method mutates `array`.
  25456. *
  25457. * @static
  25458. * @memberOf _
  25459. * @since 3.0.0
  25460. * @category Array
  25461. * @param {Array} array The array to modify.
  25462. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  25463. * @returns {Array} Returns the new array of removed elements.
  25464. * @example
  25465. *
  25466. * var array = ['a', 'b', 'c', 'd'];
  25467. * var pulled = _.pullAt(array, [1, 3]);
  25468. *
  25469. * console.log(array);
  25470. * // => ['a', 'c']
  25471. *
  25472. * console.log(pulled);
  25473. * // => ['b', 'd']
  25474. */
  25475. var pullAt = flatRest(function(array, indexes) {
  25476. var length = array == null ? 0 : array.length,
  25477. result = baseAt(array, indexes);
  25478. basePullAt(array, arrayMap(indexes, function(index) {
  25479. return isIndex(index, length) ? +index : index;
  25480. }).sort(compareAscending));
  25481. return result;
  25482. });
  25483. /**
  25484. * Removes all elements from `array` that `predicate` returns truthy for
  25485. * and returns an array of the removed elements. The predicate is invoked
  25486. * with three arguments: (value, index, array).
  25487. *
  25488. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  25489. * to pull elements from an array by value.
  25490. *
  25491. * @static
  25492. * @memberOf _
  25493. * @since 2.0.0
  25494. * @category Array
  25495. * @param {Array} array The array to modify.
  25496. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25497. * @returns {Array} Returns the new array of removed elements.
  25498. * @example
  25499. *
  25500. * var array = [1, 2, 3, 4];
  25501. * var evens = _.remove(array, function(n) {
  25502. * return n % 2 == 0;
  25503. * });
  25504. *
  25505. * console.log(array);
  25506. * // => [1, 3]
  25507. *
  25508. * console.log(evens);
  25509. * // => [2, 4]
  25510. */
  25511. function remove(array, predicate) {
  25512. var result = [];
  25513. if (!(array && array.length)) {
  25514. return result;
  25515. }
  25516. var index = -1,
  25517. indexes = [],
  25518. length = array.length;
  25519. predicate = getIteratee(predicate, 3);
  25520. while (++index < length) {
  25521. var value = array[index];
  25522. if (predicate(value, index, array)) {
  25523. result.push(value);
  25524. indexes.push(index);
  25525. }
  25526. }
  25527. basePullAt(array, indexes);
  25528. return result;
  25529. }
  25530. /**
  25531. * Reverses `array` so that the first element becomes the last, the second
  25532. * element becomes the second to last, and so on.
  25533. *
  25534. * **Note:** This method mutates `array` and is based on
  25535. * [`Array#reverse`](https://mdn.io/Array/reverse).
  25536. *
  25537. * @static
  25538. * @memberOf _
  25539. * @since 4.0.0
  25540. * @category Array
  25541. * @param {Array} array The array to modify.
  25542. * @returns {Array} Returns `array`.
  25543. * @example
  25544. *
  25545. * var array = [1, 2, 3];
  25546. *
  25547. * _.reverse(array);
  25548. * // => [3, 2, 1]
  25549. *
  25550. * console.log(array);
  25551. * // => [3, 2, 1]
  25552. */
  25553. function reverse(array) {
  25554. return array == null ? array : nativeReverse.call(array);
  25555. }
  25556. /**
  25557. * Creates a slice of `array` from `start` up to, but not including, `end`.
  25558. *
  25559. * **Note:** This method is used instead of
  25560. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  25561. * returned.
  25562. *
  25563. * @static
  25564. * @memberOf _
  25565. * @since 3.0.0
  25566. * @category Array
  25567. * @param {Array} array The array to slice.
  25568. * @param {number} [start=0] The start position.
  25569. * @param {number} [end=array.length] The end position.
  25570. * @returns {Array} Returns the slice of `array`.
  25571. */
  25572. function slice(array, start, end) {
  25573. var length = array == null ? 0 : array.length;
  25574. if (!length) {
  25575. return [];
  25576. }
  25577. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  25578. start = 0;
  25579. end = length;
  25580. }
  25581. else {
  25582. start = start == null ? 0 : toInteger(start);
  25583. end = end === undefined ? length : toInteger(end);
  25584. }
  25585. return baseSlice(array, start, end);
  25586. }
  25587. /**
  25588. * Uses a binary search to determine the lowest index at which `value`
  25589. * should be inserted into `array` in order to maintain its sort order.
  25590. *
  25591. * @static
  25592. * @memberOf _
  25593. * @since 0.1.0
  25594. * @category Array
  25595. * @param {Array} array The sorted array to inspect.
  25596. * @param {*} value The value to evaluate.
  25597. * @returns {number} Returns the index at which `value` should be inserted
  25598. * into `array`.
  25599. * @example
  25600. *
  25601. * _.sortedIndex([30, 50], 40);
  25602. * // => 1
  25603. */
  25604. function sortedIndex(array, value) {
  25605. return baseSortedIndex(array, value);
  25606. }
  25607. /**
  25608. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  25609. * which is invoked for `value` and each element of `array` to compute their
  25610. * sort ranking. The iteratee is invoked with one argument: (value).
  25611. *
  25612. * @static
  25613. * @memberOf _
  25614. * @since 4.0.0
  25615. * @category Array
  25616. * @param {Array} array The sorted array to inspect.
  25617. * @param {*} value The value to evaluate.
  25618. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25619. * @returns {number} Returns the index at which `value` should be inserted
  25620. * into `array`.
  25621. * @example
  25622. *
  25623. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25624. *
  25625. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25626. * // => 0
  25627. *
  25628. * // The `_.property` iteratee shorthand.
  25629. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  25630. * // => 0
  25631. */
  25632. function sortedIndexBy(array, value, iteratee) {
  25633. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  25634. }
  25635. /**
  25636. * This method is like `_.indexOf` except that it performs a binary
  25637. * search on a sorted `array`.
  25638. *
  25639. * @static
  25640. * @memberOf _
  25641. * @since 4.0.0
  25642. * @category Array
  25643. * @param {Array} array The array to inspect.
  25644. * @param {*} value The value to search for.
  25645. * @returns {number} Returns the index of the matched value, else `-1`.
  25646. * @example
  25647. *
  25648. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  25649. * // => 1
  25650. */
  25651. function sortedIndexOf(array, value) {
  25652. var length = array == null ? 0 : array.length;
  25653. if (length) {
  25654. var index = baseSortedIndex(array, value);
  25655. if (index < length && eq(array[index], value)) {
  25656. return index;
  25657. }
  25658. }
  25659. return -1;
  25660. }
  25661. /**
  25662. * This method is like `_.sortedIndex` except that it returns the highest
  25663. * index at which `value` should be inserted into `array` in order to
  25664. * maintain its sort order.
  25665. *
  25666. * @static
  25667. * @memberOf _
  25668. * @since 3.0.0
  25669. * @category Array
  25670. * @param {Array} array The sorted array to inspect.
  25671. * @param {*} value The value to evaluate.
  25672. * @returns {number} Returns the index at which `value` should be inserted
  25673. * into `array`.
  25674. * @example
  25675. *
  25676. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  25677. * // => 4
  25678. */
  25679. function sortedLastIndex(array, value) {
  25680. return baseSortedIndex(array, value, true);
  25681. }
  25682. /**
  25683. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  25684. * which is invoked for `value` and each element of `array` to compute their
  25685. * sort ranking. The iteratee is invoked with one argument: (value).
  25686. *
  25687. * @static
  25688. * @memberOf _
  25689. * @since 4.0.0
  25690. * @category Array
  25691. * @param {Array} array The sorted array to inspect.
  25692. * @param {*} value The value to evaluate.
  25693. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25694. * @returns {number} Returns the index at which `value` should be inserted
  25695. * into `array`.
  25696. * @example
  25697. *
  25698. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25699. *
  25700. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25701. * // => 1
  25702. *
  25703. * // The `_.property` iteratee shorthand.
  25704. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  25705. * // => 1
  25706. */
  25707. function sortedLastIndexBy(array, value, iteratee) {
  25708. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  25709. }
  25710. /**
  25711. * This method is like `_.lastIndexOf` except that it performs a binary
  25712. * search on a sorted `array`.
  25713. *
  25714. * @static
  25715. * @memberOf _
  25716. * @since 4.0.0
  25717. * @category Array
  25718. * @param {Array} array The array to inspect.
  25719. * @param {*} value The value to search for.
  25720. * @returns {number} Returns the index of the matched value, else `-1`.
  25721. * @example
  25722. *
  25723. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  25724. * // => 3
  25725. */
  25726. function sortedLastIndexOf(array, value) {
  25727. var length = array == null ? 0 : array.length;
  25728. if (length) {
  25729. var index = baseSortedIndex(array, value, true) - 1;
  25730. if (eq(array[index], value)) {
  25731. return index;
  25732. }
  25733. }
  25734. return -1;
  25735. }
  25736. /**
  25737. * This method is like `_.uniq` except that it's designed and optimized
  25738. * for sorted arrays.
  25739. *
  25740. * @static
  25741. * @memberOf _
  25742. * @since 4.0.0
  25743. * @category Array
  25744. * @param {Array} array The array to inspect.
  25745. * @returns {Array} Returns the new duplicate free array.
  25746. * @example
  25747. *
  25748. * _.sortedUniq([1, 1, 2]);
  25749. * // => [1, 2]
  25750. */
  25751. function sortedUniq(array) {
  25752. return (array && array.length)
  25753. ? baseSortedUniq(array)
  25754. : [];
  25755. }
  25756. /**
  25757. * This method is like `_.uniqBy` except that it's designed and optimized
  25758. * for sorted arrays.
  25759. *
  25760. * @static
  25761. * @memberOf _
  25762. * @since 4.0.0
  25763. * @category Array
  25764. * @param {Array} array The array to inspect.
  25765. * @param {Function} [iteratee] The iteratee invoked per element.
  25766. * @returns {Array} Returns the new duplicate free array.
  25767. * @example
  25768. *
  25769. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  25770. * // => [1.1, 2.3]
  25771. */
  25772. function sortedUniqBy(array, iteratee) {
  25773. return (array && array.length)
  25774. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  25775. : [];
  25776. }
  25777. /**
  25778. * Gets all but the first element of `array`.
  25779. *
  25780. * @static
  25781. * @memberOf _
  25782. * @since 4.0.0
  25783. * @category Array
  25784. * @param {Array} array The array to query.
  25785. * @returns {Array} Returns the slice of `array`.
  25786. * @example
  25787. *
  25788. * _.tail([1, 2, 3]);
  25789. * // => [2, 3]
  25790. */
  25791. function tail(array) {
  25792. var length = array == null ? 0 : array.length;
  25793. return length ? baseSlice(array, 1, length) : [];
  25794. }
  25795. /**
  25796. * Creates a slice of `array` with `n` elements taken from the beginning.
  25797. *
  25798. * @static
  25799. * @memberOf _
  25800. * @since 0.1.0
  25801. * @category Array
  25802. * @param {Array} array The array to query.
  25803. * @param {number} [n=1] The number of elements to take.
  25804. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25805. * @returns {Array} Returns the slice of `array`.
  25806. * @example
  25807. *
  25808. * _.take([1, 2, 3]);
  25809. * // => [1]
  25810. *
  25811. * _.take([1, 2, 3], 2);
  25812. * // => [1, 2]
  25813. *
  25814. * _.take([1, 2, 3], 5);
  25815. * // => [1, 2, 3]
  25816. *
  25817. * _.take([1, 2, 3], 0);
  25818. * // => []
  25819. */
  25820. function take(array, n, guard) {
  25821. if (!(array && array.length)) {
  25822. return [];
  25823. }
  25824. n = (guard || n === undefined) ? 1 : toInteger(n);
  25825. return baseSlice(array, 0, n < 0 ? 0 : n);
  25826. }
  25827. /**
  25828. * Creates a slice of `array` with `n` elements taken from the end.
  25829. *
  25830. * @static
  25831. * @memberOf _
  25832. * @since 3.0.0
  25833. * @category Array
  25834. * @param {Array} array The array to query.
  25835. * @param {number} [n=1] The number of elements to take.
  25836. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25837. * @returns {Array} Returns the slice of `array`.
  25838. * @example
  25839. *
  25840. * _.takeRight([1, 2, 3]);
  25841. * // => [3]
  25842. *
  25843. * _.takeRight([1, 2, 3], 2);
  25844. * // => [2, 3]
  25845. *
  25846. * _.takeRight([1, 2, 3], 5);
  25847. * // => [1, 2, 3]
  25848. *
  25849. * _.takeRight([1, 2, 3], 0);
  25850. * // => []
  25851. */
  25852. function takeRight(array, n, guard) {
  25853. var length = array == null ? 0 : array.length;
  25854. if (!length) {
  25855. return [];
  25856. }
  25857. n = (guard || n === undefined) ? 1 : toInteger(n);
  25858. n = length - n;
  25859. return baseSlice(array, n < 0 ? 0 : n, length);
  25860. }
  25861. /**
  25862. * Creates a slice of `array` with elements taken from the end. Elements are
  25863. * taken until `predicate` returns falsey. The predicate is invoked with
  25864. * three arguments: (value, index, array).
  25865. *
  25866. * @static
  25867. * @memberOf _
  25868. * @since 3.0.0
  25869. * @category Array
  25870. * @param {Array} array The array to query.
  25871. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25872. * @returns {Array} Returns the slice of `array`.
  25873. * @example
  25874. *
  25875. * var users = [
  25876. * { 'user': 'barney', 'active': true },
  25877. * { 'user': 'fred', 'active': false },
  25878. * { 'user': 'pebbles', 'active': false }
  25879. * ];
  25880. *
  25881. * _.takeRightWhile(users, function(o) { return !o.active; });
  25882. * // => objects for ['fred', 'pebbles']
  25883. *
  25884. * // The `_.matches` iteratee shorthand.
  25885. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  25886. * // => objects for ['pebbles']
  25887. *
  25888. * // The `_.matchesProperty` iteratee shorthand.
  25889. * _.takeRightWhile(users, ['active', false]);
  25890. * // => objects for ['fred', 'pebbles']
  25891. *
  25892. * // The `_.property` iteratee shorthand.
  25893. * _.takeRightWhile(users, 'active');
  25894. * // => []
  25895. */
  25896. function takeRightWhile(array, predicate) {
  25897. return (array && array.length)
  25898. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  25899. : [];
  25900. }
  25901. /**
  25902. * Creates a slice of `array` with elements taken from the beginning. Elements
  25903. * are taken until `predicate` returns falsey. The predicate is invoked with
  25904. * three arguments: (value, index, array).
  25905. *
  25906. * @static
  25907. * @memberOf _
  25908. * @since 3.0.0
  25909. * @category Array
  25910. * @param {Array} array The array to query.
  25911. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25912. * @returns {Array} Returns the slice of `array`.
  25913. * @example
  25914. *
  25915. * var users = [
  25916. * { 'user': 'barney', 'active': false },
  25917. * { 'user': 'fred', 'active': false },
  25918. * { 'user': 'pebbles', 'active': true }
  25919. * ];
  25920. *
  25921. * _.takeWhile(users, function(o) { return !o.active; });
  25922. * // => objects for ['barney', 'fred']
  25923. *
  25924. * // The `_.matches` iteratee shorthand.
  25925. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  25926. * // => objects for ['barney']
  25927. *
  25928. * // The `_.matchesProperty` iteratee shorthand.
  25929. * _.takeWhile(users, ['active', false]);
  25930. * // => objects for ['barney', 'fred']
  25931. *
  25932. * // The `_.property` iteratee shorthand.
  25933. * _.takeWhile(users, 'active');
  25934. * // => []
  25935. */
  25936. function takeWhile(array, predicate) {
  25937. return (array && array.length)
  25938. ? baseWhile(array, getIteratee(predicate, 3))
  25939. : [];
  25940. }
  25941. /**
  25942. * Creates an array of unique values, in order, from all given arrays using
  25943. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25944. * for equality comparisons.
  25945. *
  25946. * @static
  25947. * @memberOf _
  25948. * @since 0.1.0
  25949. * @category Array
  25950. * @param {...Array} [arrays] The arrays to inspect.
  25951. * @returns {Array} Returns the new array of combined values.
  25952. * @example
  25953. *
  25954. * _.union([2], [1, 2]);
  25955. * // => [2, 1]
  25956. */
  25957. var union = baseRest(function(arrays) {
  25958. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  25959. });
  25960. /**
  25961. * This method is like `_.union` except that it accepts `iteratee` which is
  25962. * invoked for each element of each `arrays` to generate the criterion by
  25963. * which uniqueness is computed. Result values are chosen from the first
  25964. * array in which the value occurs. The iteratee is invoked with one argument:
  25965. * (value).
  25966. *
  25967. * @static
  25968. * @memberOf _
  25969. * @since 4.0.0
  25970. * @category Array
  25971. * @param {...Array} [arrays] The arrays to inspect.
  25972. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25973. * @returns {Array} Returns the new array of combined values.
  25974. * @example
  25975. *
  25976. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  25977. * // => [2.1, 1.2]
  25978. *
  25979. * // The `_.property` iteratee shorthand.
  25980. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25981. * // => [{ 'x': 1 }, { 'x': 2 }]
  25982. */
  25983. var unionBy = baseRest(function(arrays) {
  25984. var iteratee = last(arrays);
  25985. if (isArrayLikeObject(iteratee)) {
  25986. iteratee = undefined;
  25987. }
  25988. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  25989. });
  25990. /**
  25991. * This method is like `_.union` except that it accepts `comparator` which
  25992. * is invoked to compare elements of `arrays`. Result values are chosen from
  25993. * the first array in which the value occurs. The comparator is invoked
  25994. * with two arguments: (arrVal, othVal).
  25995. *
  25996. * @static
  25997. * @memberOf _
  25998. * @since 4.0.0
  25999. * @category Array
  26000. * @param {...Array} [arrays] The arrays to inspect.
  26001. * @param {Function} [comparator] The comparator invoked per element.
  26002. * @returns {Array} Returns the new array of combined values.
  26003. * @example
  26004. *
  26005. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26006. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26007. *
  26008. * _.unionWith(objects, others, _.isEqual);
  26009. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26010. */
  26011. var unionWith = baseRest(function(arrays) {
  26012. var comparator = last(arrays);
  26013. comparator = typeof comparator == 'function' ? comparator : undefined;
  26014. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  26015. });
  26016. /**
  26017. * Creates a duplicate-free version of an array, using
  26018. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26019. * for equality comparisons, in which only the first occurrence of each element
  26020. * is kept. The order of result values is determined by the order they occur
  26021. * in the array.
  26022. *
  26023. * @static
  26024. * @memberOf _
  26025. * @since 0.1.0
  26026. * @category Array
  26027. * @param {Array} array The array to inspect.
  26028. * @returns {Array} Returns the new duplicate free array.
  26029. * @example
  26030. *
  26031. * _.uniq([2, 1, 2]);
  26032. * // => [2, 1]
  26033. */
  26034. function uniq(array) {
  26035. return (array && array.length) ? baseUniq(array) : [];
  26036. }
  26037. /**
  26038. * This method is like `_.uniq` except that it accepts `iteratee` which is
  26039. * invoked for each element in `array` to generate the criterion by which
  26040. * uniqueness is computed. The order of result values is determined by the
  26041. * order they occur in the array. The iteratee is invoked with one argument:
  26042. * (value).
  26043. *
  26044. * @static
  26045. * @memberOf _
  26046. * @since 4.0.0
  26047. * @category Array
  26048. * @param {Array} array The array to inspect.
  26049. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26050. * @returns {Array} Returns the new duplicate free array.
  26051. * @example
  26052. *
  26053. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  26054. * // => [2.1, 1.2]
  26055. *
  26056. * // The `_.property` iteratee shorthand.
  26057. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  26058. * // => [{ 'x': 1 }, { 'x': 2 }]
  26059. */
  26060. function uniqBy(array, iteratee) {
  26061. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  26062. }
  26063. /**
  26064. * This method is like `_.uniq` except that it accepts `comparator` which
  26065. * is invoked to compare elements of `array`. The order of result values is
  26066. * determined by the order they occur in the array.The comparator is invoked
  26067. * with two arguments: (arrVal, othVal).
  26068. *
  26069. * @static
  26070. * @memberOf _
  26071. * @since 4.0.0
  26072. * @category Array
  26073. * @param {Array} array The array to inspect.
  26074. * @param {Function} [comparator] The comparator invoked per element.
  26075. * @returns {Array} Returns the new duplicate free array.
  26076. * @example
  26077. *
  26078. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26079. *
  26080. * _.uniqWith(objects, _.isEqual);
  26081. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  26082. */
  26083. function uniqWith(array, comparator) {
  26084. comparator = typeof comparator == 'function' ? comparator : undefined;
  26085. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  26086. }
  26087. /**
  26088. * This method is like `_.zip` except that it accepts an array of grouped
  26089. * elements and creates an array regrouping the elements to their pre-zip
  26090. * configuration.
  26091. *
  26092. * @static
  26093. * @memberOf _
  26094. * @since 1.2.0
  26095. * @category Array
  26096. * @param {Array} array The array of grouped elements to process.
  26097. * @returns {Array} Returns the new array of regrouped elements.
  26098. * @example
  26099. *
  26100. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  26101. * // => [['a', 1, true], ['b', 2, false]]
  26102. *
  26103. * _.unzip(zipped);
  26104. * // => [['a', 'b'], [1, 2], [true, false]]
  26105. */
  26106. function unzip(array) {
  26107. if (!(array && array.length)) {
  26108. return [];
  26109. }
  26110. var length = 0;
  26111. array = arrayFilter(array, function(group) {
  26112. if (isArrayLikeObject(group)) {
  26113. length = nativeMax(group.length, length);
  26114. return true;
  26115. }
  26116. });
  26117. return baseTimes(length, function(index) {
  26118. return arrayMap(array, baseProperty(index));
  26119. });
  26120. }
  26121. /**
  26122. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  26123. * how regrouped values should be combined. The iteratee is invoked with the
  26124. * elements of each group: (...group).
  26125. *
  26126. * @static
  26127. * @memberOf _
  26128. * @since 3.8.0
  26129. * @category Array
  26130. * @param {Array} array The array of grouped elements to process.
  26131. * @param {Function} [iteratee=_.identity] The function to combine
  26132. * regrouped values.
  26133. * @returns {Array} Returns the new array of regrouped elements.
  26134. * @example
  26135. *
  26136. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  26137. * // => [[1, 10, 100], [2, 20, 200]]
  26138. *
  26139. * _.unzipWith(zipped, _.add);
  26140. * // => [3, 30, 300]
  26141. */
  26142. function unzipWith(array, iteratee) {
  26143. if (!(array && array.length)) {
  26144. return [];
  26145. }
  26146. var result = unzip(array);
  26147. if (iteratee == null) {
  26148. return result;
  26149. }
  26150. return arrayMap(result, function(group) {
  26151. return apply(iteratee, undefined, group);
  26152. });
  26153. }
  26154. /**
  26155. * Creates an array excluding all given values using
  26156. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26157. * for equality comparisons.
  26158. *
  26159. * **Note:** Unlike `_.pull`, this method returns a new array.
  26160. *
  26161. * @static
  26162. * @memberOf _
  26163. * @since 0.1.0
  26164. * @category Array
  26165. * @param {Array} array The array to inspect.
  26166. * @param {...*} [values] The values to exclude.
  26167. * @returns {Array} Returns the new array of filtered values.
  26168. * @see _.difference, _.xor
  26169. * @example
  26170. *
  26171. * _.without([2, 1, 2, 3], 1, 2);
  26172. * // => [3]
  26173. */
  26174. var without = baseRest(function(array, values) {
  26175. return isArrayLikeObject(array)
  26176. ? baseDifference(array, values)
  26177. : [];
  26178. });
  26179. /**
  26180. * Creates an array of unique values that is the
  26181. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  26182. * of the given arrays. The order of result values is determined by the order
  26183. * they occur in the arrays.
  26184. *
  26185. * @static
  26186. * @memberOf _
  26187. * @since 2.4.0
  26188. * @category Array
  26189. * @param {...Array} [arrays] The arrays to inspect.
  26190. * @returns {Array} Returns the new array of filtered values.
  26191. * @see _.difference, _.without
  26192. * @example
  26193. *
  26194. * _.xor([2, 1], [2, 3]);
  26195. * // => [1, 3]
  26196. */
  26197. var xor = baseRest(function(arrays) {
  26198. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  26199. });
  26200. /**
  26201. * This method is like `_.xor` except that it accepts `iteratee` which is
  26202. * invoked for each element of each `arrays` to generate the criterion by
  26203. * which by which they're compared. The order of result values is determined
  26204. * by the order they occur in the arrays. The iteratee is invoked with one
  26205. * argument: (value).
  26206. *
  26207. * @static
  26208. * @memberOf _
  26209. * @since 4.0.0
  26210. * @category Array
  26211. * @param {...Array} [arrays] The arrays to inspect.
  26212. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26213. * @returns {Array} Returns the new array of filtered values.
  26214. * @example
  26215. *
  26216. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  26217. * // => [1.2, 3.4]
  26218. *
  26219. * // The `_.property` iteratee shorthand.
  26220. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26221. * // => [{ 'x': 2 }]
  26222. */
  26223. var xorBy = baseRest(function(arrays) {
  26224. var iteratee = last(arrays);
  26225. if (isArrayLikeObject(iteratee)) {
  26226. iteratee = undefined;
  26227. }
  26228. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  26229. });
  26230. /**
  26231. * This method is like `_.xor` except that it accepts `comparator` which is
  26232. * invoked to compare elements of `arrays`. The order of result values is
  26233. * determined by the order they occur in the arrays. The comparator is invoked
  26234. * with two arguments: (arrVal, othVal).
  26235. *
  26236. * @static
  26237. * @memberOf _
  26238. * @since 4.0.0
  26239. * @category Array
  26240. * @param {...Array} [arrays] The arrays to inspect.
  26241. * @param {Function} [comparator] The comparator invoked per element.
  26242. * @returns {Array} Returns the new array of filtered values.
  26243. * @example
  26244. *
  26245. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26246. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26247. *
  26248. * _.xorWith(objects, others, _.isEqual);
  26249. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26250. */
  26251. var xorWith = baseRest(function(arrays) {
  26252. var comparator = last(arrays);
  26253. comparator = typeof comparator == 'function' ? comparator : undefined;
  26254. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  26255. });
  26256. /**
  26257. * Creates an array of grouped elements, the first of which contains the
  26258. * first elements of the given arrays, the second of which contains the
  26259. * second elements of the given arrays, and so on.
  26260. *
  26261. * @static
  26262. * @memberOf _
  26263. * @since 0.1.0
  26264. * @category Array
  26265. * @param {...Array} [arrays] The arrays to process.
  26266. * @returns {Array} Returns the new array of grouped elements.
  26267. * @example
  26268. *
  26269. * _.zip(['a', 'b'], [1, 2], [true, false]);
  26270. * // => [['a', 1, true], ['b', 2, false]]
  26271. */
  26272. var zip = baseRest(unzip);
  26273. /**
  26274. * This method is like `_.fromPairs` except that it accepts two arrays,
  26275. * one of property identifiers and one of corresponding values.
  26276. *
  26277. * @static
  26278. * @memberOf _
  26279. * @since 0.4.0
  26280. * @category Array
  26281. * @param {Array} [props=[]] The property identifiers.
  26282. * @param {Array} [values=[]] The property values.
  26283. * @returns {Object} Returns the new object.
  26284. * @example
  26285. *
  26286. * _.zipObject(['a', 'b'], [1, 2]);
  26287. * // => { 'a': 1, 'b': 2 }
  26288. */
  26289. function zipObject(props, values) {
  26290. return baseZipObject(props || [], values || [], assignValue);
  26291. }
  26292. /**
  26293. * This method is like `_.zipObject` except that it supports property paths.
  26294. *
  26295. * @static
  26296. * @memberOf _
  26297. * @since 4.1.0
  26298. * @category Array
  26299. * @param {Array} [props=[]] The property identifiers.
  26300. * @param {Array} [values=[]] The property values.
  26301. * @returns {Object} Returns the new object.
  26302. * @example
  26303. *
  26304. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  26305. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  26306. */
  26307. function zipObjectDeep(props, values) {
  26308. return baseZipObject(props || [], values || [], baseSet);
  26309. }
  26310. /**
  26311. * This method is like `_.zip` except that it accepts `iteratee` to specify
  26312. * how grouped values should be combined. The iteratee is invoked with the
  26313. * elements of each group: (...group).
  26314. *
  26315. * @static
  26316. * @memberOf _
  26317. * @since 3.8.0
  26318. * @category Array
  26319. * @param {...Array} [arrays] The arrays to process.
  26320. * @param {Function} [iteratee=_.identity] The function to combine
  26321. * grouped values.
  26322. * @returns {Array} Returns the new array of grouped elements.
  26323. * @example
  26324. *
  26325. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  26326. * return a + b + c;
  26327. * });
  26328. * // => [111, 222]
  26329. */
  26330. var zipWith = baseRest(function(arrays) {
  26331. var length = arrays.length,
  26332. iteratee = length > 1 ? arrays[length - 1] : undefined;
  26333. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  26334. return unzipWith(arrays, iteratee);
  26335. });
  26336. /*------------------------------------------------------------------------*/
  26337. /**
  26338. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  26339. * chain sequences enabled. The result of such sequences must be unwrapped
  26340. * with `_#value`.
  26341. *
  26342. * @static
  26343. * @memberOf _
  26344. * @since 1.3.0
  26345. * @category Seq
  26346. * @param {*} value The value to wrap.
  26347. * @returns {Object} Returns the new `lodash` wrapper instance.
  26348. * @example
  26349. *
  26350. * var users = [
  26351. * { 'user': 'barney', 'age': 36 },
  26352. * { 'user': 'fred', 'age': 40 },
  26353. * { 'user': 'pebbles', 'age': 1 }
  26354. * ];
  26355. *
  26356. * var youngest = _
  26357. * .chain(users)
  26358. * .sortBy('age')
  26359. * .map(function(o) {
  26360. * return o.user + ' is ' + o.age;
  26361. * })
  26362. * .head()
  26363. * .value();
  26364. * // => 'pebbles is 1'
  26365. */
  26366. function chain(value) {
  26367. var result = lodash(value);
  26368. result.__chain__ = true;
  26369. return result;
  26370. }
  26371. /**
  26372. * This method invokes `interceptor` and returns `value`. The interceptor
  26373. * is invoked with one argument; (value). The purpose of this method is to
  26374. * "tap into" a method chain sequence in order to modify intermediate results.
  26375. *
  26376. * @static
  26377. * @memberOf _
  26378. * @since 0.1.0
  26379. * @category Seq
  26380. * @param {*} value The value to provide to `interceptor`.
  26381. * @param {Function} interceptor The function to invoke.
  26382. * @returns {*} Returns `value`.
  26383. * @example
  26384. *
  26385. * _([1, 2, 3])
  26386. * .tap(function(array) {
  26387. * // Mutate input array.
  26388. * array.pop();
  26389. * })
  26390. * .reverse()
  26391. * .value();
  26392. * // => [2, 1]
  26393. */
  26394. function tap(value, interceptor) {
  26395. interceptor(value);
  26396. return value;
  26397. }
  26398. /**
  26399. * This method is like `_.tap` except that it returns the result of `interceptor`.
  26400. * The purpose of this method is to "pass thru" values replacing intermediate
  26401. * results in a method chain sequence.
  26402. *
  26403. * @static
  26404. * @memberOf _
  26405. * @since 3.0.0
  26406. * @category Seq
  26407. * @param {*} value The value to provide to `interceptor`.
  26408. * @param {Function} interceptor The function to invoke.
  26409. * @returns {*} Returns the result of `interceptor`.
  26410. * @example
  26411. *
  26412. * _(' abc ')
  26413. * .chain()
  26414. * .trim()
  26415. * .thru(function(value) {
  26416. * return [value];
  26417. * })
  26418. * .value();
  26419. * // => ['abc']
  26420. */
  26421. function thru(value, interceptor) {
  26422. return interceptor(value);
  26423. }
  26424. /**
  26425. * This method is the wrapper version of `_.at`.
  26426. *
  26427. * @name at
  26428. * @memberOf _
  26429. * @since 1.0.0
  26430. * @category Seq
  26431. * @param {...(string|string[])} [paths] The property paths to pick.
  26432. * @returns {Object} Returns the new `lodash` wrapper instance.
  26433. * @example
  26434. *
  26435. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  26436. *
  26437. * _(object).at(['a[0].b.c', 'a[1]']).value();
  26438. * // => [3, 4]
  26439. */
  26440. var wrapperAt = flatRest(function(paths) {
  26441. var length = paths.length,
  26442. start = length ? paths[0] : 0,
  26443. value = this.__wrapped__,
  26444. interceptor = function(object) { return baseAt(object, paths); };
  26445. if (length > 1 || this.__actions__.length ||
  26446. !(value instanceof LazyWrapper) || !isIndex(start)) {
  26447. return this.thru(interceptor);
  26448. }
  26449. value = value.slice(start, +start + (length ? 1 : 0));
  26450. value.__actions__.push({
  26451. 'func': thru,
  26452. 'args': [interceptor],
  26453. 'thisArg': undefined
  26454. });
  26455. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  26456. if (length && !array.length) {
  26457. array.push(undefined);
  26458. }
  26459. return array;
  26460. });
  26461. });
  26462. /**
  26463. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  26464. *
  26465. * @name chain
  26466. * @memberOf _
  26467. * @since 0.1.0
  26468. * @category Seq
  26469. * @returns {Object} Returns the new `lodash` wrapper instance.
  26470. * @example
  26471. *
  26472. * var users = [
  26473. * { 'user': 'barney', 'age': 36 },
  26474. * { 'user': 'fred', 'age': 40 }
  26475. * ];
  26476. *
  26477. * // A sequence without explicit chaining.
  26478. * _(users).head();
  26479. * // => { 'user': 'barney', 'age': 36 }
  26480. *
  26481. * // A sequence with explicit chaining.
  26482. * _(users)
  26483. * .chain()
  26484. * .head()
  26485. * .pick('user')
  26486. * .value();
  26487. * // => { 'user': 'barney' }
  26488. */
  26489. function wrapperChain() {
  26490. return chain(this);
  26491. }
  26492. /**
  26493. * Executes the chain sequence and returns the wrapped result.
  26494. *
  26495. * @name commit
  26496. * @memberOf _
  26497. * @since 3.2.0
  26498. * @category Seq
  26499. * @returns {Object} Returns the new `lodash` wrapper instance.
  26500. * @example
  26501. *
  26502. * var array = [1, 2];
  26503. * var wrapped = _(array).push(3);
  26504. *
  26505. * console.log(array);
  26506. * // => [1, 2]
  26507. *
  26508. * wrapped = wrapped.commit();
  26509. * console.log(array);
  26510. * // => [1, 2, 3]
  26511. *
  26512. * wrapped.last();
  26513. * // => 3
  26514. *
  26515. * console.log(array);
  26516. * // => [1, 2, 3]
  26517. */
  26518. function wrapperCommit() {
  26519. return new LodashWrapper(this.value(), this.__chain__);
  26520. }
  26521. /**
  26522. * Gets the next value on a wrapped object following the
  26523. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  26524. *
  26525. * @name next
  26526. * @memberOf _
  26527. * @since 4.0.0
  26528. * @category Seq
  26529. * @returns {Object} Returns the next iterator value.
  26530. * @example
  26531. *
  26532. * var wrapped = _([1, 2]);
  26533. *
  26534. * wrapped.next();
  26535. * // => { 'done': false, 'value': 1 }
  26536. *
  26537. * wrapped.next();
  26538. * // => { 'done': false, 'value': 2 }
  26539. *
  26540. * wrapped.next();
  26541. * // => { 'done': true, 'value': undefined }
  26542. */
  26543. function wrapperNext() {
  26544. if (this.__values__ === undefined) {
  26545. this.__values__ = toArray(this.value());
  26546. }
  26547. var done = this.__index__ >= this.__values__.length,
  26548. value = done ? undefined : this.__values__[this.__index__++];
  26549. return { 'done': done, 'value': value };
  26550. }
  26551. /**
  26552. * Enables the wrapper to be iterable.
  26553. *
  26554. * @name Symbol.iterator
  26555. * @memberOf _
  26556. * @since 4.0.0
  26557. * @category Seq
  26558. * @returns {Object} Returns the wrapper object.
  26559. * @example
  26560. *
  26561. * var wrapped = _([1, 2]);
  26562. *
  26563. * wrapped[Symbol.iterator]() === wrapped;
  26564. * // => true
  26565. *
  26566. * Array.from(wrapped);
  26567. * // => [1, 2]
  26568. */
  26569. function wrapperToIterator() {
  26570. return this;
  26571. }
  26572. /**
  26573. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  26574. *
  26575. * @name plant
  26576. * @memberOf _
  26577. * @since 3.2.0
  26578. * @category Seq
  26579. * @param {*} value The value to plant.
  26580. * @returns {Object} Returns the new `lodash` wrapper instance.
  26581. * @example
  26582. *
  26583. * function square(n) {
  26584. * return n * n;
  26585. * }
  26586. *
  26587. * var wrapped = _([1, 2]).map(square);
  26588. * var other = wrapped.plant([3, 4]);
  26589. *
  26590. * other.value();
  26591. * // => [9, 16]
  26592. *
  26593. * wrapped.value();
  26594. * // => [1, 4]
  26595. */
  26596. function wrapperPlant(value) {
  26597. var result,
  26598. parent = this;
  26599. while (parent instanceof baseLodash) {
  26600. var clone = wrapperClone(parent);
  26601. clone.__index__ = 0;
  26602. clone.__values__ = undefined;
  26603. if (result) {
  26604. previous.__wrapped__ = clone;
  26605. } else {
  26606. result = clone;
  26607. }
  26608. var previous = clone;
  26609. parent = parent.__wrapped__;
  26610. }
  26611. previous.__wrapped__ = value;
  26612. return result;
  26613. }
  26614. /**
  26615. * This method is the wrapper version of `_.reverse`.
  26616. *
  26617. * **Note:** This method mutates the wrapped array.
  26618. *
  26619. * @name reverse
  26620. * @memberOf _
  26621. * @since 0.1.0
  26622. * @category Seq
  26623. * @returns {Object} Returns the new `lodash` wrapper instance.
  26624. * @example
  26625. *
  26626. * var array = [1, 2, 3];
  26627. *
  26628. * _(array).reverse().value()
  26629. * // => [3, 2, 1]
  26630. *
  26631. * console.log(array);
  26632. * // => [3, 2, 1]
  26633. */
  26634. function wrapperReverse() {
  26635. var value = this.__wrapped__;
  26636. if (value instanceof LazyWrapper) {
  26637. var wrapped = value;
  26638. if (this.__actions__.length) {
  26639. wrapped = new LazyWrapper(this);
  26640. }
  26641. wrapped = wrapped.reverse();
  26642. wrapped.__actions__.push({
  26643. 'func': thru,
  26644. 'args': [reverse],
  26645. 'thisArg': undefined
  26646. });
  26647. return new LodashWrapper(wrapped, this.__chain__);
  26648. }
  26649. return this.thru(reverse);
  26650. }
  26651. /**
  26652. * Executes the chain sequence to resolve the unwrapped value.
  26653. *
  26654. * @name value
  26655. * @memberOf _
  26656. * @since 0.1.0
  26657. * @alias toJSON, valueOf
  26658. * @category Seq
  26659. * @returns {*} Returns the resolved unwrapped value.
  26660. * @example
  26661. *
  26662. * _([1, 2, 3]).value();
  26663. * // => [1, 2, 3]
  26664. */
  26665. function wrapperValue() {
  26666. return baseWrapperValue(this.__wrapped__, this.__actions__);
  26667. }
  26668. /*------------------------------------------------------------------------*/
  26669. /**
  26670. * Creates an object composed of keys generated from the results of running
  26671. * each element of `collection` thru `iteratee`. The corresponding value of
  26672. * each key is the number of times the key was returned by `iteratee`. The
  26673. * iteratee is invoked with one argument: (value).
  26674. *
  26675. * @static
  26676. * @memberOf _
  26677. * @since 0.5.0
  26678. * @category Collection
  26679. * @param {Array|Object} collection The collection to iterate over.
  26680. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26681. * @returns {Object} Returns the composed aggregate object.
  26682. * @example
  26683. *
  26684. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  26685. * // => { '4': 1, '6': 2 }
  26686. *
  26687. * // The `_.property` iteratee shorthand.
  26688. * _.countBy(['one', 'two', 'three'], 'length');
  26689. * // => { '3': 2, '5': 1 }
  26690. */
  26691. var countBy = createAggregator(function(result, value, key) {
  26692. if (hasOwnProperty.call(result, key)) {
  26693. ++result[key];
  26694. } else {
  26695. baseAssignValue(result, key, 1);
  26696. }
  26697. });
  26698. /**
  26699. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  26700. * Iteration is stopped once `predicate` returns falsey. The predicate is
  26701. * invoked with three arguments: (value, index|key, collection).
  26702. *
  26703. * **Note:** This method returns `true` for
  26704. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  26705. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  26706. * elements of empty collections.
  26707. *
  26708. * @static
  26709. * @memberOf _
  26710. * @since 0.1.0
  26711. * @category Collection
  26712. * @param {Array|Object} collection The collection to iterate over.
  26713. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26714. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26715. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  26716. * else `false`.
  26717. * @example
  26718. *
  26719. * _.every([true, 1, null, 'yes'], Boolean);
  26720. * // => false
  26721. *
  26722. * var users = [
  26723. * { 'user': 'barney', 'age': 36, 'active': false },
  26724. * { 'user': 'fred', 'age': 40, 'active': false }
  26725. * ];
  26726. *
  26727. * // The `_.matches` iteratee shorthand.
  26728. * _.every(users, { 'user': 'barney', 'active': false });
  26729. * // => false
  26730. *
  26731. * // The `_.matchesProperty` iteratee shorthand.
  26732. * _.every(users, ['active', false]);
  26733. * // => true
  26734. *
  26735. * // The `_.property` iteratee shorthand.
  26736. * _.every(users, 'active');
  26737. * // => false
  26738. */
  26739. function every(collection, predicate, guard) {
  26740. var func = isArray(collection) ? arrayEvery : baseEvery;
  26741. if (guard && isIterateeCall(collection, predicate, guard)) {
  26742. predicate = undefined;
  26743. }
  26744. return func(collection, getIteratee(predicate, 3));
  26745. }
  26746. /**
  26747. * Iterates over elements of `collection`, returning an array of all elements
  26748. * `predicate` returns truthy for. The predicate is invoked with three
  26749. * arguments: (value, index|key, collection).
  26750. *
  26751. * **Note:** Unlike `_.remove`, this method returns a new array.
  26752. *
  26753. * @static
  26754. * @memberOf _
  26755. * @since 0.1.0
  26756. * @category Collection
  26757. * @param {Array|Object} collection The collection to iterate over.
  26758. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26759. * @returns {Array} Returns the new filtered array.
  26760. * @see _.reject
  26761. * @example
  26762. *
  26763. * var users = [
  26764. * { 'user': 'barney', 'age': 36, 'active': true },
  26765. * { 'user': 'fred', 'age': 40, 'active': false }
  26766. * ];
  26767. *
  26768. * _.filter(users, function(o) { return !o.active; });
  26769. * // => objects for ['fred']
  26770. *
  26771. * // The `_.matches` iteratee shorthand.
  26772. * _.filter(users, { 'age': 36, 'active': true });
  26773. * // => objects for ['barney']
  26774. *
  26775. * // The `_.matchesProperty` iteratee shorthand.
  26776. * _.filter(users, ['active', false]);
  26777. * // => objects for ['fred']
  26778. *
  26779. * // The `_.property` iteratee shorthand.
  26780. * _.filter(users, 'active');
  26781. * // => objects for ['barney']
  26782. */
  26783. function filter(collection, predicate) {
  26784. var func = isArray(collection) ? arrayFilter : baseFilter;
  26785. return func(collection, getIteratee(predicate, 3));
  26786. }
  26787. /**
  26788. * Iterates over elements of `collection`, returning the first element
  26789. * `predicate` returns truthy for. The predicate is invoked with three
  26790. * arguments: (value, index|key, collection).
  26791. *
  26792. * @static
  26793. * @memberOf _
  26794. * @since 0.1.0
  26795. * @category Collection
  26796. * @param {Array|Object} collection The collection to inspect.
  26797. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26798. * @param {number} [fromIndex=0] The index to search from.
  26799. * @returns {*} Returns the matched element, else `undefined`.
  26800. * @example
  26801. *
  26802. * var users = [
  26803. * { 'user': 'barney', 'age': 36, 'active': true },
  26804. * { 'user': 'fred', 'age': 40, 'active': false },
  26805. * { 'user': 'pebbles', 'age': 1, 'active': true }
  26806. * ];
  26807. *
  26808. * _.find(users, function(o) { return o.age < 40; });
  26809. * // => object for 'barney'
  26810. *
  26811. * // The `_.matches` iteratee shorthand.
  26812. * _.find(users, { 'age': 1, 'active': true });
  26813. * // => object for 'pebbles'
  26814. *
  26815. * // The `_.matchesProperty` iteratee shorthand.
  26816. * _.find(users, ['active', false]);
  26817. * // => object for 'fred'
  26818. *
  26819. * // The `_.property` iteratee shorthand.
  26820. * _.find(users, 'active');
  26821. * // => object for 'barney'
  26822. */
  26823. var find = createFind(findIndex);
  26824. /**
  26825. * This method is like `_.find` except that it iterates over elements of
  26826. * `collection` from right to left.
  26827. *
  26828. * @static
  26829. * @memberOf _
  26830. * @since 2.0.0
  26831. * @category Collection
  26832. * @param {Array|Object} collection The collection to inspect.
  26833. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26834. * @param {number} [fromIndex=collection.length-1] The index to search from.
  26835. * @returns {*} Returns the matched element, else `undefined`.
  26836. * @example
  26837. *
  26838. * _.findLast([1, 2, 3, 4], function(n) {
  26839. * return n % 2 == 1;
  26840. * });
  26841. * // => 3
  26842. */
  26843. var findLast = createFind(findLastIndex);
  26844. /**
  26845. * Creates a flattened array of values by running each element in `collection`
  26846. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  26847. * with three arguments: (value, index|key, collection).
  26848. *
  26849. * @static
  26850. * @memberOf _
  26851. * @since 4.0.0
  26852. * @category Collection
  26853. * @param {Array|Object} collection The collection to iterate over.
  26854. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26855. * @returns {Array} Returns the new flattened array.
  26856. * @example
  26857. *
  26858. * function duplicate(n) {
  26859. * return [n, n];
  26860. * }
  26861. *
  26862. * _.flatMap([1, 2], duplicate);
  26863. * // => [1, 1, 2, 2]
  26864. */
  26865. function flatMap(collection, iteratee) {
  26866. return baseFlatten(map(collection, iteratee), 1);
  26867. }
  26868. /**
  26869. * This method is like `_.flatMap` except that it recursively flattens the
  26870. * mapped results.
  26871. *
  26872. * @static
  26873. * @memberOf _
  26874. * @since 4.7.0
  26875. * @category Collection
  26876. * @param {Array|Object} collection The collection to iterate over.
  26877. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26878. * @returns {Array} Returns the new flattened array.
  26879. * @example
  26880. *
  26881. * function duplicate(n) {
  26882. * return [[[n, n]]];
  26883. * }
  26884. *
  26885. * _.flatMapDeep([1, 2], duplicate);
  26886. * // => [1, 1, 2, 2]
  26887. */
  26888. function flatMapDeep(collection, iteratee) {
  26889. return baseFlatten(map(collection, iteratee), INFINITY);
  26890. }
  26891. /**
  26892. * This method is like `_.flatMap` except that it recursively flattens the
  26893. * mapped results up to `depth` times.
  26894. *
  26895. * @static
  26896. * @memberOf _
  26897. * @since 4.7.0
  26898. * @category Collection
  26899. * @param {Array|Object} collection The collection to iterate over.
  26900. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26901. * @param {number} [depth=1] The maximum recursion depth.
  26902. * @returns {Array} Returns the new flattened array.
  26903. * @example
  26904. *
  26905. * function duplicate(n) {
  26906. * return [[[n, n]]];
  26907. * }
  26908. *
  26909. * _.flatMapDepth([1, 2], duplicate, 2);
  26910. * // => [[1, 1], [2, 2]]
  26911. */
  26912. function flatMapDepth(collection, iteratee, depth) {
  26913. depth = depth === undefined ? 1 : toInteger(depth);
  26914. return baseFlatten(map(collection, iteratee), depth);
  26915. }
  26916. /**
  26917. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  26918. * The iteratee is invoked with three arguments: (value, index|key, collection).
  26919. * Iteratee functions may exit iteration early by explicitly returning `false`.
  26920. *
  26921. * **Note:** As with other "Collections" methods, objects with a "length"
  26922. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  26923. * or `_.forOwn` for object iteration.
  26924. *
  26925. * @static
  26926. * @memberOf _
  26927. * @since 0.1.0
  26928. * @alias each
  26929. * @category Collection
  26930. * @param {Array|Object} collection The collection to iterate over.
  26931. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26932. * @returns {Array|Object} Returns `collection`.
  26933. * @see _.forEachRight
  26934. * @example
  26935. *
  26936. * _.forEach([1, 2], function(value) {
  26937. * console.log(value);
  26938. * });
  26939. * // => Logs `1` then `2`.
  26940. *
  26941. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  26942. * console.log(key);
  26943. * });
  26944. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  26945. */
  26946. function forEach(collection, iteratee) {
  26947. var func = isArray(collection) ? arrayEach : baseEach;
  26948. return func(collection, getIteratee(iteratee, 3));
  26949. }
  26950. /**
  26951. * This method is like `_.forEach` except that it iterates over elements of
  26952. * `collection` from right to left.
  26953. *
  26954. * @static
  26955. * @memberOf _
  26956. * @since 2.0.0
  26957. * @alias eachRight
  26958. * @category Collection
  26959. * @param {Array|Object} collection The collection to iterate over.
  26960. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26961. * @returns {Array|Object} Returns `collection`.
  26962. * @see _.forEach
  26963. * @example
  26964. *
  26965. * _.forEachRight([1, 2], function(value) {
  26966. * console.log(value);
  26967. * });
  26968. * // => Logs `2` then `1`.
  26969. */
  26970. function forEachRight(collection, iteratee) {
  26971. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  26972. return func(collection, getIteratee(iteratee, 3));
  26973. }
  26974. /**
  26975. * Creates an object composed of keys generated from the results of running
  26976. * each element of `collection` thru `iteratee`. The order of grouped values
  26977. * is determined by the order they occur in `collection`. The corresponding
  26978. * value of each key is an array of elements responsible for generating the
  26979. * key. The iteratee is invoked with one argument: (value).
  26980. *
  26981. * @static
  26982. * @memberOf _
  26983. * @since 0.1.0
  26984. * @category Collection
  26985. * @param {Array|Object} collection The collection to iterate over.
  26986. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26987. * @returns {Object} Returns the composed aggregate object.
  26988. * @example
  26989. *
  26990. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  26991. * // => { '4': [4.2], '6': [6.1, 6.3] }
  26992. *
  26993. * // The `_.property` iteratee shorthand.
  26994. * _.groupBy(['one', 'two', 'three'], 'length');
  26995. * // => { '3': ['one', 'two'], '5': ['three'] }
  26996. */
  26997. var groupBy = createAggregator(function(result, value, key) {
  26998. if (hasOwnProperty.call(result, key)) {
  26999. result[key].push(value);
  27000. } else {
  27001. baseAssignValue(result, key, [value]);
  27002. }
  27003. });
  27004. /**
  27005. * Checks if `value` is in `collection`. If `collection` is a string, it's
  27006. * checked for a substring of `value`, otherwise
  27007. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27008. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  27009. * the offset from the end of `collection`.
  27010. *
  27011. * @static
  27012. * @memberOf _
  27013. * @since 0.1.0
  27014. * @category Collection
  27015. * @param {Array|Object|string} collection The collection to inspect.
  27016. * @param {*} value The value to search for.
  27017. * @param {number} [fromIndex=0] The index to search from.
  27018. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27019. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  27020. * @example
  27021. *
  27022. * _.includes([1, 2, 3], 1);
  27023. * // => true
  27024. *
  27025. * _.includes([1, 2, 3], 1, 2);
  27026. * // => false
  27027. *
  27028. * _.includes({ 'a': 1, 'b': 2 }, 1);
  27029. * // => true
  27030. *
  27031. * _.includes('abcd', 'bc');
  27032. * // => true
  27033. */
  27034. function includes(collection, value, fromIndex, guard) {
  27035. collection = isArrayLike(collection) ? collection : values(collection);
  27036. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  27037. var length = collection.length;
  27038. if (fromIndex < 0) {
  27039. fromIndex = nativeMax(length + fromIndex, 0);
  27040. }
  27041. return isString(collection)
  27042. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  27043. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  27044. }
  27045. /**
  27046. * Invokes the method at `path` of each element in `collection`, returning
  27047. * an array of the results of each invoked method. Any additional arguments
  27048. * are provided to each invoked method. If `path` is a function, it's invoked
  27049. * for, and `this` bound to, each element in `collection`.
  27050. *
  27051. * @static
  27052. * @memberOf _
  27053. * @since 4.0.0
  27054. * @category Collection
  27055. * @param {Array|Object} collection The collection to iterate over.
  27056. * @param {Array|Function|string} path The path of the method to invoke or
  27057. * the function invoked per iteration.
  27058. * @param {...*} [args] The arguments to invoke each method with.
  27059. * @returns {Array} Returns the array of results.
  27060. * @example
  27061. *
  27062. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  27063. * // => [[1, 5, 7], [1, 2, 3]]
  27064. *
  27065. * _.invokeMap([123, 456], String.prototype.split, '');
  27066. * // => [['1', '2', '3'], ['4', '5', '6']]
  27067. */
  27068. var invokeMap = baseRest(function(collection, path, args) {
  27069. var index = -1,
  27070. isFunc = typeof path == 'function',
  27071. result = isArrayLike(collection) ? Array(collection.length) : [];
  27072. baseEach(collection, function(value) {
  27073. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  27074. });
  27075. return result;
  27076. });
  27077. /**
  27078. * Creates an object composed of keys generated from the results of running
  27079. * each element of `collection` thru `iteratee`. The corresponding value of
  27080. * each key is the last element responsible for generating the key. The
  27081. * iteratee is invoked with one argument: (value).
  27082. *
  27083. * @static
  27084. * @memberOf _
  27085. * @since 4.0.0
  27086. * @category Collection
  27087. * @param {Array|Object} collection The collection to iterate over.
  27088. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27089. * @returns {Object} Returns the composed aggregate object.
  27090. * @example
  27091. *
  27092. * var array = [
  27093. * { 'dir': 'left', 'code': 97 },
  27094. * { 'dir': 'right', 'code': 100 }
  27095. * ];
  27096. *
  27097. * _.keyBy(array, function(o) {
  27098. * return String.fromCharCode(o.code);
  27099. * });
  27100. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  27101. *
  27102. * _.keyBy(array, 'dir');
  27103. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  27104. */
  27105. var keyBy = createAggregator(function(result, value, key) {
  27106. baseAssignValue(result, key, value);
  27107. });
  27108. /**
  27109. * Creates an array of values by running each element in `collection` thru
  27110. * `iteratee`. The iteratee is invoked with three arguments:
  27111. * (value, index|key, collection).
  27112. *
  27113. * Many lodash methods are guarded to work as iteratees for methods like
  27114. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  27115. *
  27116. * The guarded methods are:
  27117. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  27118. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  27119. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  27120. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  27121. *
  27122. * @static
  27123. * @memberOf _
  27124. * @since 0.1.0
  27125. * @category Collection
  27126. * @param {Array|Object} collection The collection to iterate over.
  27127. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27128. * @returns {Array} Returns the new mapped array.
  27129. * @example
  27130. *
  27131. * function square(n) {
  27132. * return n * n;
  27133. * }
  27134. *
  27135. * _.map([4, 8], square);
  27136. * // => [16, 64]
  27137. *
  27138. * _.map({ 'a': 4, 'b': 8 }, square);
  27139. * // => [16, 64] (iteration order is not guaranteed)
  27140. *
  27141. * var users = [
  27142. * { 'user': 'barney' },
  27143. * { 'user': 'fred' }
  27144. * ];
  27145. *
  27146. * // The `_.property` iteratee shorthand.
  27147. * _.map(users, 'user');
  27148. * // => ['barney', 'fred']
  27149. */
  27150. function map(collection, iteratee) {
  27151. var func = isArray(collection) ? arrayMap : baseMap;
  27152. return func(collection, getIteratee(iteratee, 3));
  27153. }
  27154. /**
  27155. * This method is like `_.sortBy` except that it allows specifying the sort
  27156. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  27157. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  27158. * descending or "asc" for ascending sort order of corresponding values.
  27159. *
  27160. * @static
  27161. * @memberOf _
  27162. * @since 4.0.0
  27163. * @category Collection
  27164. * @param {Array|Object} collection The collection to iterate over.
  27165. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  27166. * The iteratees to sort by.
  27167. * @param {string[]} [orders] The sort orders of `iteratees`.
  27168. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27169. * @returns {Array} Returns the new sorted array.
  27170. * @example
  27171. *
  27172. * var users = [
  27173. * { 'user': 'fred', 'age': 48 },
  27174. * { 'user': 'barney', 'age': 34 },
  27175. * { 'user': 'fred', 'age': 40 },
  27176. * { 'user': 'barney', 'age': 36 }
  27177. * ];
  27178. *
  27179. * // Sort by `user` in ascending order and by `age` in descending order.
  27180. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  27181. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27182. */
  27183. function orderBy(collection, iteratees, orders, guard) {
  27184. if (collection == null) {
  27185. return [];
  27186. }
  27187. if (!isArray(iteratees)) {
  27188. iteratees = iteratees == null ? [] : [iteratees];
  27189. }
  27190. orders = guard ? undefined : orders;
  27191. if (!isArray(orders)) {
  27192. orders = orders == null ? [] : [orders];
  27193. }
  27194. return baseOrderBy(collection, iteratees, orders);
  27195. }
  27196. /**
  27197. * Creates an array of elements split into two groups, the first of which
  27198. * contains elements `predicate` returns truthy for, the second of which
  27199. * contains elements `predicate` returns falsey for. The predicate is
  27200. * invoked with one argument: (value).
  27201. *
  27202. * @static
  27203. * @memberOf _
  27204. * @since 3.0.0
  27205. * @category Collection
  27206. * @param {Array|Object} collection The collection to iterate over.
  27207. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27208. * @returns {Array} Returns the array of grouped elements.
  27209. * @example
  27210. *
  27211. * var users = [
  27212. * { 'user': 'barney', 'age': 36, 'active': false },
  27213. * { 'user': 'fred', 'age': 40, 'active': true },
  27214. * { 'user': 'pebbles', 'age': 1, 'active': false }
  27215. * ];
  27216. *
  27217. * _.partition(users, function(o) { return o.active; });
  27218. * // => objects for [['fred'], ['barney', 'pebbles']]
  27219. *
  27220. * // The `_.matches` iteratee shorthand.
  27221. * _.partition(users, { 'age': 1, 'active': false });
  27222. * // => objects for [['pebbles'], ['barney', 'fred']]
  27223. *
  27224. * // The `_.matchesProperty` iteratee shorthand.
  27225. * _.partition(users, ['active', false]);
  27226. * // => objects for [['barney', 'pebbles'], ['fred']]
  27227. *
  27228. * // The `_.property` iteratee shorthand.
  27229. * _.partition(users, 'active');
  27230. * // => objects for [['fred'], ['barney', 'pebbles']]
  27231. */
  27232. var partition = createAggregator(function(result, value, key) {
  27233. result[key ? 0 : 1].push(value);
  27234. }, function() { return [[], []]; });
  27235. /**
  27236. * Reduces `collection` to a value which is the accumulated result of running
  27237. * each element in `collection` thru `iteratee`, where each successive
  27238. * invocation is supplied the return value of the previous. If `accumulator`
  27239. * is not given, the first element of `collection` is used as the initial
  27240. * value. The iteratee is invoked with four arguments:
  27241. * (accumulator, value, index|key, collection).
  27242. *
  27243. * Many lodash methods are guarded to work as iteratees for methods like
  27244. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  27245. *
  27246. * The guarded methods are:
  27247. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  27248. * and `sortBy`
  27249. *
  27250. * @static
  27251. * @memberOf _
  27252. * @since 0.1.0
  27253. * @category Collection
  27254. * @param {Array|Object} collection The collection to iterate over.
  27255. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27256. * @param {*} [accumulator] The initial value.
  27257. * @returns {*} Returns the accumulated value.
  27258. * @see _.reduceRight
  27259. * @example
  27260. *
  27261. * _.reduce([1, 2], function(sum, n) {
  27262. * return sum + n;
  27263. * }, 0);
  27264. * // => 3
  27265. *
  27266. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  27267. * (result[value] || (result[value] = [])).push(key);
  27268. * return result;
  27269. * }, {});
  27270. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  27271. */
  27272. function reduce(collection, iteratee, accumulator) {
  27273. var func = isArray(collection) ? arrayReduce : baseReduce,
  27274. initAccum = arguments.length < 3;
  27275. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  27276. }
  27277. /**
  27278. * This method is like `_.reduce` except that it iterates over elements of
  27279. * `collection` from right to left.
  27280. *
  27281. * @static
  27282. * @memberOf _
  27283. * @since 0.1.0
  27284. * @category Collection
  27285. * @param {Array|Object} collection The collection to iterate over.
  27286. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27287. * @param {*} [accumulator] The initial value.
  27288. * @returns {*} Returns the accumulated value.
  27289. * @see _.reduce
  27290. * @example
  27291. *
  27292. * var array = [[0, 1], [2, 3], [4, 5]];
  27293. *
  27294. * _.reduceRight(array, function(flattened, other) {
  27295. * return flattened.concat(other);
  27296. * }, []);
  27297. * // => [4, 5, 2, 3, 0, 1]
  27298. */
  27299. function reduceRight(collection, iteratee, accumulator) {
  27300. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  27301. initAccum = arguments.length < 3;
  27302. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  27303. }
  27304. /**
  27305. * The opposite of `_.filter`; this method returns the elements of `collection`
  27306. * that `predicate` does **not** return truthy for.
  27307. *
  27308. * @static
  27309. * @memberOf _
  27310. * @since 0.1.0
  27311. * @category Collection
  27312. * @param {Array|Object} collection The collection to iterate over.
  27313. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27314. * @returns {Array} Returns the new filtered array.
  27315. * @see _.filter
  27316. * @example
  27317. *
  27318. * var users = [
  27319. * { 'user': 'barney', 'age': 36, 'active': false },
  27320. * { 'user': 'fred', 'age': 40, 'active': true }
  27321. * ];
  27322. *
  27323. * _.reject(users, function(o) { return !o.active; });
  27324. * // => objects for ['fred']
  27325. *
  27326. * // The `_.matches` iteratee shorthand.
  27327. * _.reject(users, { 'age': 40, 'active': true });
  27328. * // => objects for ['barney']
  27329. *
  27330. * // The `_.matchesProperty` iteratee shorthand.
  27331. * _.reject(users, ['active', false]);
  27332. * // => objects for ['fred']
  27333. *
  27334. * // The `_.property` iteratee shorthand.
  27335. * _.reject(users, 'active');
  27336. * // => objects for ['barney']
  27337. */
  27338. function reject(collection, predicate) {
  27339. var func = isArray(collection) ? arrayFilter : baseFilter;
  27340. return func(collection, negate(getIteratee(predicate, 3)));
  27341. }
  27342. /**
  27343. * Gets a random element from `collection`.
  27344. *
  27345. * @static
  27346. * @memberOf _
  27347. * @since 2.0.0
  27348. * @category Collection
  27349. * @param {Array|Object} collection The collection to sample.
  27350. * @returns {*} Returns the random element.
  27351. * @example
  27352. *
  27353. * _.sample([1, 2, 3, 4]);
  27354. * // => 2
  27355. */
  27356. function sample(collection) {
  27357. var func = isArray(collection) ? arraySample : baseSample;
  27358. return func(collection);
  27359. }
  27360. /**
  27361. * Gets `n` random elements at unique keys from `collection` up to the
  27362. * size of `collection`.
  27363. *
  27364. * @static
  27365. * @memberOf _
  27366. * @since 4.0.0
  27367. * @category Collection
  27368. * @param {Array|Object} collection The collection to sample.
  27369. * @param {number} [n=1] The number of elements to sample.
  27370. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27371. * @returns {Array} Returns the random elements.
  27372. * @example
  27373. *
  27374. * _.sampleSize([1, 2, 3], 2);
  27375. * // => [3, 1]
  27376. *
  27377. * _.sampleSize([1, 2, 3], 4);
  27378. * // => [2, 3, 1]
  27379. */
  27380. function sampleSize(collection, n, guard) {
  27381. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  27382. n = 1;
  27383. } else {
  27384. n = toInteger(n);
  27385. }
  27386. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  27387. return func(collection, n);
  27388. }
  27389. /**
  27390. * Creates an array of shuffled values, using a version of the
  27391. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  27392. *
  27393. * @static
  27394. * @memberOf _
  27395. * @since 0.1.0
  27396. * @category Collection
  27397. * @param {Array|Object} collection The collection to shuffle.
  27398. * @returns {Array} Returns the new shuffled array.
  27399. * @example
  27400. *
  27401. * _.shuffle([1, 2, 3, 4]);
  27402. * // => [4, 1, 3, 2]
  27403. */
  27404. function shuffle(collection) {
  27405. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  27406. return func(collection);
  27407. }
  27408. /**
  27409. * Gets the size of `collection` by returning its length for array-like
  27410. * values or the number of own enumerable string keyed properties for objects.
  27411. *
  27412. * @static
  27413. * @memberOf _
  27414. * @since 0.1.0
  27415. * @category Collection
  27416. * @param {Array|Object|string} collection The collection to inspect.
  27417. * @returns {number} Returns the collection size.
  27418. * @example
  27419. *
  27420. * _.size([1, 2, 3]);
  27421. * // => 3
  27422. *
  27423. * _.size({ 'a': 1, 'b': 2 });
  27424. * // => 2
  27425. *
  27426. * _.size('pebbles');
  27427. * // => 7
  27428. */
  27429. function size(collection) {
  27430. if (collection == null) {
  27431. return 0;
  27432. }
  27433. if (isArrayLike(collection)) {
  27434. return isString(collection) ? stringSize(collection) : collection.length;
  27435. }
  27436. var tag = getTag(collection);
  27437. if (tag == mapTag || tag == setTag) {
  27438. return collection.size;
  27439. }
  27440. return baseKeys(collection).length;
  27441. }
  27442. /**
  27443. * Checks if `predicate` returns truthy for **any** element of `collection`.
  27444. * Iteration is stopped once `predicate` returns truthy. The predicate is
  27445. * invoked with three arguments: (value, index|key, collection).
  27446. *
  27447. * @static
  27448. * @memberOf _
  27449. * @since 0.1.0
  27450. * @category Collection
  27451. * @param {Array|Object} collection The collection to iterate over.
  27452. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27453. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27454. * @returns {boolean} Returns `true` if any element passes the predicate check,
  27455. * else `false`.
  27456. * @example
  27457. *
  27458. * _.some([null, 0, 'yes', false], Boolean);
  27459. * // => true
  27460. *
  27461. * var users = [
  27462. * { 'user': 'barney', 'active': true },
  27463. * { 'user': 'fred', 'active': false }
  27464. * ];
  27465. *
  27466. * // The `_.matches` iteratee shorthand.
  27467. * _.some(users, { 'user': 'barney', 'active': false });
  27468. * // => false
  27469. *
  27470. * // The `_.matchesProperty` iteratee shorthand.
  27471. * _.some(users, ['active', false]);
  27472. * // => true
  27473. *
  27474. * // The `_.property` iteratee shorthand.
  27475. * _.some(users, 'active');
  27476. * // => true
  27477. */
  27478. function some(collection, predicate, guard) {
  27479. var func = isArray(collection) ? arraySome : baseSome;
  27480. if (guard && isIterateeCall(collection, predicate, guard)) {
  27481. predicate = undefined;
  27482. }
  27483. return func(collection, getIteratee(predicate, 3));
  27484. }
  27485. /**
  27486. * Creates an array of elements, sorted in ascending order by the results of
  27487. * running each element in a collection thru each iteratee. This method
  27488. * performs a stable sort, that is, it preserves the original sort order of
  27489. * equal elements. The iteratees are invoked with one argument: (value).
  27490. *
  27491. * @static
  27492. * @memberOf _
  27493. * @since 0.1.0
  27494. * @category Collection
  27495. * @param {Array|Object} collection The collection to iterate over.
  27496. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  27497. * The iteratees to sort by.
  27498. * @returns {Array} Returns the new sorted array.
  27499. * @example
  27500. *
  27501. * var users = [
  27502. * { 'user': 'fred', 'age': 48 },
  27503. * { 'user': 'barney', 'age': 36 },
  27504. * { 'user': 'fred', 'age': 40 },
  27505. * { 'user': 'barney', 'age': 34 }
  27506. * ];
  27507. *
  27508. * _.sortBy(users, [function(o) { return o.user; }]);
  27509. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27510. *
  27511. * _.sortBy(users, ['user', 'age']);
  27512. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  27513. */
  27514. var sortBy = baseRest(function(collection, iteratees) {
  27515. if (collection == null) {
  27516. return [];
  27517. }
  27518. var length = iteratees.length;
  27519. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  27520. iteratees = [];
  27521. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  27522. iteratees = [iteratees[0]];
  27523. }
  27524. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  27525. });
  27526. /*------------------------------------------------------------------------*/
  27527. /**
  27528. * Gets the timestamp of the number of milliseconds that have elapsed since
  27529. * the Unix epoch (1 January 1970 00:00:00 UTC).
  27530. *
  27531. * @static
  27532. * @memberOf _
  27533. * @since 2.4.0
  27534. * @category Date
  27535. * @returns {number} Returns the timestamp.
  27536. * @example
  27537. *
  27538. * _.defer(function(stamp) {
  27539. * console.log(_.now() - stamp);
  27540. * }, _.now());
  27541. * // => Logs the number of milliseconds it took for the deferred invocation.
  27542. */
  27543. var now = ctxNow || function() {
  27544. return root.Date.now();
  27545. };
  27546. /*------------------------------------------------------------------------*/
  27547. /**
  27548. * The opposite of `_.before`; this method creates a function that invokes
  27549. * `func` once it's called `n` or more times.
  27550. *
  27551. * @static
  27552. * @memberOf _
  27553. * @since 0.1.0
  27554. * @category Function
  27555. * @param {number} n The number of calls before `func` is invoked.
  27556. * @param {Function} func The function to restrict.
  27557. * @returns {Function} Returns the new restricted function.
  27558. * @example
  27559. *
  27560. * var saves = ['profile', 'settings'];
  27561. *
  27562. * var done = _.after(saves.length, function() {
  27563. * console.log('done saving!');
  27564. * });
  27565. *
  27566. * _.forEach(saves, function(type) {
  27567. * asyncSave({ 'type': type, 'complete': done });
  27568. * });
  27569. * // => Logs 'done saving!' after the two async saves have completed.
  27570. */
  27571. function after(n, func) {
  27572. if (typeof func != 'function') {
  27573. throw new TypeError(FUNC_ERROR_TEXT);
  27574. }
  27575. n = toInteger(n);
  27576. return function() {
  27577. if (--n < 1) {
  27578. return func.apply(this, arguments);
  27579. }
  27580. };
  27581. }
  27582. /**
  27583. * Creates a function that invokes `func`, with up to `n` arguments,
  27584. * ignoring any additional arguments.
  27585. *
  27586. * @static
  27587. * @memberOf _
  27588. * @since 3.0.0
  27589. * @category Function
  27590. * @param {Function} func The function to cap arguments for.
  27591. * @param {number} [n=func.length] The arity cap.
  27592. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27593. * @returns {Function} Returns the new capped function.
  27594. * @example
  27595. *
  27596. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  27597. * // => [6, 8, 10]
  27598. */
  27599. function ary(func, n, guard) {
  27600. n = guard ? undefined : n;
  27601. n = (func && n == null) ? func.length : n;
  27602. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  27603. }
  27604. /**
  27605. * Creates a function that invokes `func`, with the `this` binding and arguments
  27606. * of the created function, while it's called less than `n` times. Subsequent
  27607. * calls to the created function return the result of the last `func` invocation.
  27608. *
  27609. * @static
  27610. * @memberOf _
  27611. * @since 3.0.0
  27612. * @category Function
  27613. * @param {number} n The number of calls at which `func` is no longer invoked.
  27614. * @param {Function} func The function to restrict.
  27615. * @returns {Function} Returns the new restricted function.
  27616. * @example
  27617. *
  27618. * jQuery(element).on('click', _.before(5, addContactToList));
  27619. * // => Allows adding up to 4 contacts to the list.
  27620. */
  27621. function before(n, func) {
  27622. var result;
  27623. if (typeof func != 'function') {
  27624. throw new TypeError(FUNC_ERROR_TEXT);
  27625. }
  27626. n = toInteger(n);
  27627. return function() {
  27628. if (--n > 0) {
  27629. result = func.apply(this, arguments);
  27630. }
  27631. if (n <= 1) {
  27632. func = undefined;
  27633. }
  27634. return result;
  27635. };
  27636. }
  27637. /**
  27638. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  27639. * and `partials` prepended to the arguments it receives.
  27640. *
  27641. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  27642. * may be used as a placeholder for partially applied arguments.
  27643. *
  27644. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  27645. * property of bound functions.
  27646. *
  27647. * @static
  27648. * @memberOf _
  27649. * @since 0.1.0
  27650. * @category Function
  27651. * @param {Function} func The function to bind.
  27652. * @param {*} thisArg The `this` binding of `func`.
  27653. * @param {...*} [partials] The arguments to be partially applied.
  27654. * @returns {Function} Returns the new bound function.
  27655. * @example
  27656. *
  27657. * function greet(greeting, punctuation) {
  27658. * return greeting + ' ' + this.user + punctuation;
  27659. * }
  27660. *
  27661. * var object = { 'user': 'fred' };
  27662. *
  27663. * var bound = _.bind(greet, object, 'hi');
  27664. * bound('!');
  27665. * // => 'hi fred!'
  27666. *
  27667. * // Bound with placeholders.
  27668. * var bound = _.bind(greet, object, _, '!');
  27669. * bound('hi');
  27670. * // => 'hi fred!'
  27671. */
  27672. var bind = baseRest(function(func, thisArg, partials) {
  27673. var bitmask = WRAP_BIND_FLAG;
  27674. if (partials.length) {
  27675. var holders = replaceHolders(partials, getHolder(bind));
  27676. bitmask |= WRAP_PARTIAL_FLAG;
  27677. }
  27678. return createWrap(func, bitmask, thisArg, partials, holders);
  27679. });
  27680. /**
  27681. * Creates a function that invokes the method at `object[key]` with `partials`
  27682. * prepended to the arguments it receives.
  27683. *
  27684. * This method differs from `_.bind` by allowing bound functions to reference
  27685. * methods that may be redefined or don't yet exist. See
  27686. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  27687. * for more details.
  27688. *
  27689. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  27690. * builds, may be used as a placeholder for partially applied arguments.
  27691. *
  27692. * @static
  27693. * @memberOf _
  27694. * @since 0.10.0
  27695. * @category Function
  27696. * @param {Object} object The object to invoke the method on.
  27697. * @param {string} key The key of the method.
  27698. * @param {...*} [partials] The arguments to be partially applied.
  27699. * @returns {Function} Returns the new bound function.
  27700. * @example
  27701. *
  27702. * var object = {
  27703. * 'user': 'fred',
  27704. * 'greet': function(greeting, punctuation) {
  27705. * return greeting + ' ' + this.user + punctuation;
  27706. * }
  27707. * };
  27708. *
  27709. * var bound = _.bindKey(object, 'greet', 'hi');
  27710. * bound('!');
  27711. * // => 'hi fred!'
  27712. *
  27713. * object.greet = function(greeting, punctuation) {
  27714. * return greeting + 'ya ' + this.user + punctuation;
  27715. * };
  27716. *
  27717. * bound('!');
  27718. * // => 'hiya fred!'
  27719. *
  27720. * // Bound with placeholders.
  27721. * var bound = _.bindKey(object, 'greet', _, '!');
  27722. * bound('hi');
  27723. * // => 'hiya fred!'
  27724. */
  27725. var bindKey = baseRest(function(object, key, partials) {
  27726. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  27727. if (partials.length) {
  27728. var holders = replaceHolders(partials, getHolder(bindKey));
  27729. bitmask |= WRAP_PARTIAL_FLAG;
  27730. }
  27731. return createWrap(key, bitmask, object, partials, holders);
  27732. });
  27733. /**
  27734. * Creates a function that accepts arguments of `func` and either invokes
  27735. * `func` returning its result, if at least `arity` number of arguments have
  27736. * been provided, or returns a function that accepts the remaining `func`
  27737. * arguments, and so on. The arity of `func` may be specified if `func.length`
  27738. * is not sufficient.
  27739. *
  27740. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  27741. * may be used as a placeholder for provided arguments.
  27742. *
  27743. * **Note:** This method doesn't set the "length" property of curried functions.
  27744. *
  27745. * @static
  27746. * @memberOf _
  27747. * @since 2.0.0
  27748. * @category Function
  27749. * @param {Function} func The function to curry.
  27750. * @param {number} [arity=func.length] The arity of `func`.
  27751. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27752. * @returns {Function} Returns the new curried function.
  27753. * @example
  27754. *
  27755. * var abc = function(a, b, c) {
  27756. * return [a, b, c];
  27757. * };
  27758. *
  27759. * var curried = _.curry(abc);
  27760. *
  27761. * curried(1)(2)(3);
  27762. * // => [1, 2, 3]
  27763. *
  27764. * curried(1, 2)(3);
  27765. * // => [1, 2, 3]
  27766. *
  27767. * curried(1, 2, 3);
  27768. * // => [1, 2, 3]
  27769. *
  27770. * // Curried with placeholders.
  27771. * curried(1)(_, 3)(2);
  27772. * // => [1, 2, 3]
  27773. */
  27774. function curry(func, arity, guard) {
  27775. arity = guard ? undefined : arity;
  27776. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27777. result.placeholder = curry.placeholder;
  27778. return result;
  27779. }
  27780. /**
  27781. * This method is like `_.curry` except that arguments are applied to `func`
  27782. * in the manner of `_.partialRight` instead of `_.partial`.
  27783. *
  27784. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  27785. * builds, may be used as a placeholder for provided arguments.
  27786. *
  27787. * **Note:** This method doesn't set the "length" property of curried functions.
  27788. *
  27789. * @static
  27790. * @memberOf _
  27791. * @since 3.0.0
  27792. * @category Function
  27793. * @param {Function} func The function to curry.
  27794. * @param {number} [arity=func.length] The arity of `func`.
  27795. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27796. * @returns {Function} Returns the new curried function.
  27797. * @example
  27798. *
  27799. * var abc = function(a, b, c) {
  27800. * return [a, b, c];
  27801. * };
  27802. *
  27803. * var curried = _.curryRight(abc);
  27804. *
  27805. * curried(3)(2)(1);
  27806. * // => [1, 2, 3]
  27807. *
  27808. * curried(2, 3)(1);
  27809. * // => [1, 2, 3]
  27810. *
  27811. * curried(1, 2, 3);
  27812. * // => [1, 2, 3]
  27813. *
  27814. * // Curried with placeholders.
  27815. * curried(3)(1, _)(2);
  27816. * // => [1, 2, 3]
  27817. */
  27818. function curryRight(func, arity, guard) {
  27819. arity = guard ? undefined : arity;
  27820. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27821. result.placeholder = curryRight.placeholder;
  27822. return result;
  27823. }
  27824. /**
  27825. * Creates a debounced function that delays invoking `func` until after `wait`
  27826. * milliseconds have elapsed since the last time the debounced function was
  27827. * invoked. The debounced function comes with a `cancel` method to cancel
  27828. * delayed `func` invocations and a `flush` method to immediately invoke them.
  27829. * Provide `options` to indicate whether `func` should be invoked on the
  27830. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  27831. * with the last arguments provided to the debounced function. Subsequent
  27832. * calls to the debounced function return the result of the last `func`
  27833. * invocation.
  27834. *
  27835. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27836. * invoked on the trailing edge of the timeout only if the debounced function
  27837. * is invoked more than once during the `wait` timeout.
  27838. *
  27839. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27840. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27841. *
  27842. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27843. * for details over the differences between `_.debounce` and `_.throttle`.
  27844. *
  27845. * @static
  27846. * @memberOf _
  27847. * @since 0.1.0
  27848. * @category Function
  27849. * @param {Function} func The function to debounce.
  27850. * @param {number} [wait=0] The number of milliseconds to delay.
  27851. * @param {Object} [options={}] The options object.
  27852. * @param {boolean} [options.leading=false]
  27853. * Specify invoking on the leading edge of the timeout.
  27854. * @param {number} [options.maxWait]
  27855. * The maximum time `func` is allowed to be delayed before it's invoked.
  27856. * @param {boolean} [options.trailing=true]
  27857. * Specify invoking on the trailing edge of the timeout.
  27858. * @returns {Function} Returns the new debounced function.
  27859. * @example
  27860. *
  27861. * // Avoid costly calculations while the window size is in flux.
  27862. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  27863. *
  27864. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  27865. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  27866. * 'leading': true,
  27867. * 'trailing': false
  27868. * }));
  27869. *
  27870. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  27871. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  27872. * var source = new EventSource('/stream');
  27873. * jQuery(source).on('message', debounced);
  27874. *
  27875. * // Cancel the trailing debounced invocation.
  27876. * jQuery(window).on('popstate', debounced.cancel);
  27877. */
  27878. function debounce(func, wait, options) {
  27879. var lastArgs,
  27880. lastThis,
  27881. maxWait,
  27882. result,
  27883. timerId,
  27884. lastCallTime,
  27885. lastInvokeTime = 0,
  27886. leading = false,
  27887. maxing = false,
  27888. trailing = true;
  27889. if (typeof func != 'function') {
  27890. throw new TypeError(FUNC_ERROR_TEXT);
  27891. }
  27892. wait = toNumber(wait) || 0;
  27893. if (isObject(options)) {
  27894. leading = !!options.leading;
  27895. maxing = 'maxWait' in options;
  27896. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  27897. trailing = 'trailing' in options ? !!options.trailing : trailing;
  27898. }
  27899. function invokeFunc(time) {
  27900. var args = lastArgs,
  27901. thisArg = lastThis;
  27902. lastArgs = lastThis = undefined;
  27903. lastInvokeTime = time;
  27904. result = func.apply(thisArg, args);
  27905. return result;
  27906. }
  27907. function leadingEdge(time) {
  27908. // Reset any `maxWait` timer.
  27909. lastInvokeTime = time;
  27910. // Start the timer for the trailing edge.
  27911. timerId = setTimeout(timerExpired, wait);
  27912. // Invoke the leading edge.
  27913. return leading ? invokeFunc(time) : result;
  27914. }
  27915. function remainingWait(time) {
  27916. var timeSinceLastCall = time - lastCallTime,
  27917. timeSinceLastInvoke = time - lastInvokeTime,
  27918. timeWaiting = wait - timeSinceLastCall;
  27919. return maxing
  27920. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  27921. : timeWaiting;
  27922. }
  27923. function shouldInvoke(time) {
  27924. var timeSinceLastCall = time - lastCallTime,
  27925. timeSinceLastInvoke = time - lastInvokeTime;
  27926. // Either this is the first call, activity has stopped and we're at the
  27927. // trailing edge, the system time has gone backwards and we're treating
  27928. // it as the trailing edge, or we've hit the `maxWait` limit.
  27929. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  27930. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  27931. }
  27932. function timerExpired() {
  27933. var time = now();
  27934. if (shouldInvoke(time)) {
  27935. return trailingEdge(time);
  27936. }
  27937. // Restart the timer.
  27938. timerId = setTimeout(timerExpired, remainingWait(time));
  27939. }
  27940. function trailingEdge(time) {
  27941. timerId = undefined;
  27942. // Only invoke if we have `lastArgs` which means `func` has been
  27943. // debounced at least once.
  27944. if (trailing && lastArgs) {
  27945. return invokeFunc(time);
  27946. }
  27947. lastArgs = lastThis = undefined;
  27948. return result;
  27949. }
  27950. function cancel() {
  27951. if (timerId !== undefined) {
  27952. clearTimeout(timerId);
  27953. }
  27954. lastInvokeTime = 0;
  27955. lastArgs = lastCallTime = lastThis = timerId = undefined;
  27956. }
  27957. function flush() {
  27958. return timerId === undefined ? result : trailingEdge(now());
  27959. }
  27960. function debounced() {
  27961. var time = now(),
  27962. isInvoking = shouldInvoke(time);
  27963. lastArgs = arguments;
  27964. lastThis = this;
  27965. lastCallTime = time;
  27966. if (isInvoking) {
  27967. if (timerId === undefined) {
  27968. return leadingEdge(lastCallTime);
  27969. }
  27970. if (maxing) {
  27971. // Handle invocations in a tight loop.
  27972. clearTimeout(timerId);
  27973. timerId = setTimeout(timerExpired, wait);
  27974. return invokeFunc(lastCallTime);
  27975. }
  27976. }
  27977. if (timerId === undefined) {
  27978. timerId = setTimeout(timerExpired, wait);
  27979. }
  27980. return result;
  27981. }
  27982. debounced.cancel = cancel;
  27983. debounced.flush = flush;
  27984. return debounced;
  27985. }
  27986. /**
  27987. * Defers invoking the `func` until the current call stack has cleared. Any
  27988. * additional arguments are provided to `func` when it's invoked.
  27989. *
  27990. * @static
  27991. * @memberOf _
  27992. * @since 0.1.0
  27993. * @category Function
  27994. * @param {Function} func The function to defer.
  27995. * @param {...*} [args] The arguments to invoke `func` with.
  27996. * @returns {number} Returns the timer id.
  27997. * @example
  27998. *
  27999. * _.defer(function(text) {
  28000. * console.log(text);
  28001. * }, 'deferred');
  28002. * // => Logs 'deferred' after one millisecond.
  28003. */
  28004. var defer = baseRest(function(func, args) {
  28005. return baseDelay(func, 1, args);
  28006. });
  28007. /**
  28008. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  28009. * provided to `func` when it's invoked.
  28010. *
  28011. * @static
  28012. * @memberOf _
  28013. * @since 0.1.0
  28014. * @category Function
  28015. * @param {Function} func The function to delay.
  28016. * @param {number} wait The number of milliseconds to delay invocation.
  28017. * @param {...*} [args] The arguments to invoke `func` with.
  28018. * @returns {number} Returns the timer id.
  28019. * @example
  28020. *
  28021. * _.delay(function(text) {
  28022. * console.log(text);
  28023. * }, 1000, 'later');
  28024. * // => Logs 'later' after one second.
  28025. */
  28026. var delay = baseRest(function(func, wait, args) {
  28027. return baseDelay(func, toNumber(wait) || 0, args);
  28028. });
  28029. /**
  28030. * Creates a function that invokes `func` with arguments reversed.
  28031. *
  28032. * @static
  28033. * @memberOf _
  28034. * @since 4.0.0
  28035. * @category Function
  28036. * @param {Function} func The function to flip arguments for.
  28037. * @returns {Function} Returns the new flipped function.
  28038. * @example
  28039. *
  28040. * var flipped = _.flip(function() {
  28041. * return _.toArray(arguments);
  28042. * });
  28043. *
  28044. * flipped('a', 'b', 'c', 'd');
  28045. * // => ['d', 'c', 'b', 'a']
  28046. */
  28047. function flip(func) {
  28048. return createWrap(func, WRAP_FLIP_FLAG);
  28049. }
  28050. /**
  28051. * Creates a function that memoizes the result of `func`. If `resolver` is
  28052. * provided, it determines the cache key for storing the result based on the
  28053. * arguments provided to the memoized function. By default, the first argument
  28054. * provided to the memoized function is used as the map cache key. The `func`
  28055. * is invoked with the `this` binding of the memoized function.
  28056. *
  28057. * **Note:** The cache is exposed as the `cache` property on the memoized
  28058. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  28059. * constructor with one whose instances implement the
  28060. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  28061. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  28062. *
  28063. * @static
  28064. * @memberOf _
  28065. * @since 0.1.0
  28066. * @category Function
  28067. * @param {Function} func The function to have its output memoized.
  28068. * @param {Function} [resolver] The function to resolve the cache key.
  28069. * @returns {Function} Returns the new memoized function.
  28070. * @example
  28071. *
  28072. * var object = { 'a': 1, 'b': 2 };
  28073. * var other = { 'c': 3, 'd': 4 };
  28074. *
  28075. * var values = _.memoize(_.values);
  28076. * values(object);
  28077. * // => [1, 2]
  28078. *
  28079. * values(other);
  28080. * // => [3, 4]
  28081. *
  28082. * object.a = 2;
  28083. * values(object);
  28084. * // => [1, 2]
  28085. *
  28086. * // Modify the result cache.
  28087. * values.cache.set(object, ['a', 'b']);
  28088. * values(object);
  28089. * // => ['a', 'b']
  28090. *
  28091. * // Replace `_.memoize.Cache`.
  28092. * _.memoize.Cache = WeakMap;
  28093. */
  28094. function memoize(func, resolver) {
  28095. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  28096. throw new TypeError(FUNC_ERROR_TEXT);
  28097. }
  28098. var memoized = function() {
  28099. var args = arguments,
  28100. key = resolver ? resolver.apply(this, args) : args[0],
  28101. cache = memoized.cache;
  28102. if (cache.has(key)) {
  28103. return cache.get(key);
  28104. }
  28105. var result = func.apply(this, args);
  28106. memoized.cache = cache.set(key, result) || cache;
  28107. return result;
  28108. };
  28109. memoized.cache = new (memoize.Cache || MapCache);
  28110. return memoized;
  28111. }
  28112. // Expose `MapCache`.
  28113. memoize.Cache = MapCache;
  28114. /**
  28115. * Creates a function that negates the result of the predicate `func`. The
  28116. * `func` predicate is invoked with the `this` binding and arguments of the
  28117. * created function.
  28118. *
  28119. * @static
  28120. * @memberOf _
  28121. * @since 3.0.0
  28122. * @category Function
  28123. * @param {Function} predicate The predicate to negate.
  28124. * @returns {Function} Returns the new negated function.
  28125. * @example
  28126. *
  28127. * function isEven(n) {
  28128. * return n % 2 == 0;
  28129. * }
  28130. *
  28131. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  28132. * // => [1, 3, 5]
  28133. */
  28134. function negate(predicate) {
  28135. if (typeof predicate != 'function') {
  28136. throw new TypeError(FUNC_ERROR_TEXT);
  28137. }
  28138. return function() {
  28139. var args = arguments;
  28140. switch (args.length) {
  28141. case 0: return !predicate.call(this);
  28142. case 1: return !predicate.call(this, args[0]);
  28143. case 2: return !predicate.call(this, args[0], args[1]);
  28144. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  28145. }
  28146. return !predicate.apply(this, args);
  28147. };
  28148. }
  28149. /**
  28150. * Creates a function that is restricted to invoking `func` once. Repeat calls
  28151. * to the function return the value of the first invocation. The `func` is
  28152. * invoked with the `this` binding and arguments of the created function.
  28153. *
  28154. * @static
  28155. * @memberOf _
  28156. * @since 0.1.0
  28157. * @category Function
  28158. * @param {Function} func The function to restrict.
  28159. * @returns {Function} Returns the new restricted function.
  28160. * @example
  28161. *
  28162. * var initialize = _.once(createApplication);
  28163. * initialize();
  28164. * initialize();
  28165. * // => `createApplication` is invoked once
  28166. */
  28167. function once(func) {
  28168. return before(2, func);
  28169. }
  28170. /**
  28171. * Creates a function that invokes `func` with its arguments transformed.
  28172. *
  28173. * @static
  28174. * @since 4.0.0
  28175. * @memberOf _
  28176. * @category Function
  28177. * @param {Function} func The function to wrap.
  28178. * @param {...(Function|Function[])} [transforms=[_.identity]]
  28179. * The argument transforms.
  28180. * @returns {Function} Returns the new function.
  28181. * @example
  28182. *
  28183. * function doubled(n) {
  28184. * return n * 2;
  28185. * }
  28186. *
  28187. * function square(n) {
  28188. * return n * n;
  28189. * }
  28190. *
  28191. * var func = _.overArgs(function(x, y) {
  28192. * return [x, y];
  28193. * }, [square, doubled]);
  28194. *
  28195. * func(9, 3);
  28196. * // => [81, 6]
  28197. *
  28198. * func(10, 5);
  28199. * // => [100, 10]
  28200. */
  28201. var overArgs = castRest(function(func, transforms) {
  28202. transforms = (transforms.length == 1 && isArray(transforms[0]))
  28203. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  28204. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  28205. var funcsLength = transforms.length;
  28206. return baseRest(function(args) {
  28207. var index = -1,
  28208. length = nativeMin(args.length, funcsLength);
  28209. while (++index < length) {
  28210. args[index] = transforms[index].call(this, args[index]);
  28211. }
  28212. return apply(func, this, args);
  28213. });
  28214. });
  28215. /**
  28216. * Creates a function that invokes `func` with `partials` prepended to the
  28217. * arguments it receives. This method is like `_.bind` except it does **not**
  28218. * alter the `this` binding.
  28219. *
  28220. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  28221. * builds, may be used as a placeholder for partially applied arguments.
  28222. *
  28223. * **Note:** This method doesn't set the "length" property of partially
  28224. * applied functions.
  28225. *
  28226. * @static
  28227. * @memberOf _
  28228. * @since 0.2.0
  28229. * @category Function
  28230. * @param {Function} func The function to partially apply arguments to.
  28231. * @param {...*} [partials] The arguments to be partially applied.
  28232. * @returns {Function} Returns the new partially applied function.
  28233. * @example
  28234. *
  28235. * function greet(greeting, name) {
  28236. * return greeting + ' ' + name;
  28237. * }
  28238. *
  28239. * var sayHelloTo = _.partial(greet, 'hello');
  28240. * sayHelloTo('fred');
  28241. * // => 'hello fred'
  28242. *
  28243. * // Partially applied with placeholders.
  28244. * var greetFred = _.partial(greet, _, 'fred');
  28245. * greetFred('hi');
  28246. * // => 'hi fred'
  28247. */
  28248. var partial = baseRest(function(func, partials) {
  28249. var holders = replaceHolders(partials, getHolder(partial));
  28250. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  28251. });
  28252. /**
  28253. * This method is like `_.partial` except that partially applied arguments
  28254. * are appended to the arguments it receives.
  28255. *
  28256. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  28257. * builds, may be used as a placeholder for partially applied arguments.
  28258. *
  28259. * **Note:** This method doesn't set the "length" property of partially
  28260. * applied functions.
  28261. *
  28262. * @static
  28263. * @memberOf _
  28264. * @since 1.0.0
  28265. * @category Function
  28266. * @param {Function} func The function to partially apply arguments to.
  28267. * @param {...*} [partials] The arguments to be partially applied.
  28268. * @returns {Function} Returns the new partially applied function.
  28269. * @example
  28270. *
  28271. * function greet(greeting, name) {
  28272. * return greeting + ' ' + name;
  28273. * }
  28274. *
  28275. * var greetFred = _.partialRight(greet, 'fred');
  28276. * greetFred('hi');
  28277. * // => 'hi fred'
  28278. *
  28279. * // Partially applied with placeholders.
  28280. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  28281. * sayHelloTo('fred');
  28282. * // => 'hello fred'
  28283. */
  28284. var partialRight = baseRest(function(func, partials) {
  28285. var holders = replaceHolders(partials, getHolder(partialRight));
  28286. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  28287. });
  28288. /**
  28289. * Creates a function that invokes `func` with arguments arranged according
  28290. * to the specified `indexes` where the argument value at the first index is
  28291. * provided as the first argument, the argument value at the second index is
  28292. * provided as the second argument, and so on.
  28293. *
  28294. * @static
  28295. * @memberOf _
  28296. * @since 3.0.0
  28297. * @category Function
  28298. * @param {Function} func The function to rearrange arguments for.
  28299. * @param {...(number|number[])} indexes The arranged argument indexes.
  28300. * @returns {Function} Returns the new function.
  28301. * @example
  28302. *
  28303. * var rearged = _.rearg(function(a, b, c) {
  28304. * return [a, b, c];
  28305. * }, [2, 0, 1]);
  28306. *
  28307. * rearged('b', 'c', 'a')
  28308. * // => ['a', 'b', 'c']
  28309. */
  28310. var rearg = flatRest(function(func, indexes) {
  28311. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  28312. });
  28313. /**
  28314. * Creates a function that invokes `func` with the `this` binding of the
  28315. * created function and arguments from `start` and beyond provided as
  28316. * an array.
  28317. *
  28318. * **Note:** This method is based on the
  28319. * [rest parameter](https://mdn.io/rest_parameters).
  28320. *
  28321. * @static
  28322. * @memberOf _
  28323. * @since 4.0.0
  28324. * @category Function
  28325. * @param {Function} func The function to apply a rest parameter to.
  28326. * @param {number} [start=func.length-1] The start position of the rest parameter.
  28327. * @returns {Function} Returns the new function.
  28328. * @example
  28329. *
  28330. * var say = _.rest(function(what, names) {
  28331. * return what + ' ' + _.initial(names).join(', ') +
  28332. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  28333. * });
  28334. *
  28335. * say('hello', 'fred', 'barney', 'pebbles');
  28336. * // => 'hello fred, barney, & pebbles'
  28337. */
  28338. function rest(func, start) {
  28339. if (typeof func != 'function') {
  28340. throw new TypeError(FUNC_ERROR_TEXT);
  28341. }
  28342. start = start === undefined ? start : toInteger(start);
  28343. return baseRest(func, start);
  28344. }
  28345. /**
  28346. * Creates a function that invokes `func` with the `this` binding of the
  28347. * create function and an array of arguments much like
  28348. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  28349. *
  28350. * **Note:** This method is based on the
  28351. * [spread operator](https://mdn.io/spread_operator).
  28352. *
  28353. * @static
  28354. * @memberOf _
  28355. * @since 3.2.0
  28356. * @category Function
  28357. * @param {Function} func The function to spread arguments over.
  28358. * @param {number} [start=0] The start position of the spread.
  28359. * @returns {Function} Returns the new function.
  28360. * @example
  28361. *
  28362. * var say = _.spread(function(who, what) {
  28363. * return who + ' says ' + what;
  28364. * });
  28365. *
  28366. * say(['fred', 'hello']);
  28367. * // => 'fred says hello'
  28368. *
  28369. * var numbers = Promise.all([
  28370. * Promise.resolve(40),
  28371. * Promise.resolve(36)
  28372. * ]);
  28373. *
  28374. * numbers.then(_.spread(function(x, y) {
  28375. * return x + y;
  28376. * }));
  28377. * // => a Promise of 76
  28378. */
  28379. function spread(func, start) {
  28380. if (typeof func != 'function') {
  28381. throw new TypeError(FUNC_ERROR_TEXT);
  28382. }
  28383. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  28384. return baseRest(function(args) {
  28385. var array = args[start],
  28386. otherArgs = castSlice(args, 0, start);
  28387. if (array) {
  28388. arrayPush(otherArgs, array);
  28389. }
  28390. return apply(func, this, otherArgs);
  28391. });
  28392. }
  28393. /**
  28394. * Creates a throttled function that only invokes `func` at most once per
  28395. * every `wait` milliseconds. The throttled function comes with a `cancel`
  28396. * method to cancel delayed `func` invocations and a `flush` method to
  28397. * immediately invoke them. Provide `options` to indicate whether `func`
  28398. * should be invoked on the leading and/or trailing edge of the `wait`
  28399. * timeout. The `func` is invoked with the last arguments provided to the
  28400. * throttled function. Subsequent calls to the throttled function return the
  28401. * result of the last `func` invocation.
  28402. *
  28403. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28404. * invoked on the trailing edge of the timeout only if the throttled function
  28405. * is invoked more than once during the `wait` timeout.
  28406. *
  28407. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28408. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28409. *
  28410. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28411. * for details over the differences between `_.throttle` and `_.debounce`.
  28412. *
  28413. * @static
  28414. * @memberOf _
  28415. * @since 0.1.0
  28416. * @category Function
  28417. * @param {Function} func The function to throttle.
  28418. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  28419. * @param {Object} [options={}] The options object.
  28420. * @param {boolean} [options.leading=true]
  28421. * Specify invoking on the leading edge of the timeout.
  28422. * @param {boolean} [options.trailing=true]
  28423. * Specify invoking on the trailing edge of the timeout.
  28424. * @returns {Function} Returns the new throttled function.
  28425. * @example
  28426. *
  28427. * // Avoid excessively updating the position while scrolling.
  28428. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  28429. *
  28430. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  28431. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  28432. * jQuery(element).on('click', throttled);
  28433. *
  28434. * // Cancel the trailing throttled invocation.
  28435. * jQuery(window).on('popstate', throttled.cancel);
  28436. */
  28437. function throttle(func, wait, options) {
  28438. var leading = true,
  28439. trailing = true;
  28440. if (typeof func != 'function') {
  28441. throw new TypeError(FUNC_ERROR_TEXT);
  28442. }
  28443. if (isObject(options)) {
  28444. leading = 'leading' in options ? !!options.leading : leading;
  28445. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28446. }
  28447. return debounce(func, wait, {
  28448. 'leading': leading,
  28449. 'maxWait': wait,
  28450. 'trailing': trailing
  28451. });
  28452. }
  28453. /**
  28454. * Creates a function that accepts up to one argument, ignoring any
  28455. * additional arguments.
  28456. *
  28457. * @static
  28458. * @memberOf _
  28459. * @since 4.0.0
  28460. * @category Function
  28461. * @param {Function} func The function to cap arguments for.
  28462. * @returns {Function} Returns the new capped function.
  28463. * @example
  28464. *
  28465. * _.map(['6', '8', '10'], _.unary(parseInt));
  28466. * // => [6, 8, 10]
  28467. */
  28468. function unary(func) {
  28469. return ary(func, 1);
  28470. }
  28471. /**
  28472. * Creates a function that provides `value` to `wrapper` as its first
  28473. * argument. Any additional arguments provided to the function are appended
  28474. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  28475. * binding of the created function.
  28476. *
  28477. * @static
  28478. * @memberOf _
  28479. * @since 0.1.0
  28480. * @category Function
  28481. * @param {*} value The value to wrap.
  28482. * @param {Function} [wrapper=identity] The wrapper function.
  28483. * @returns {Function} Returns the new function.
  28484. * @example
  28485. *
  28486. * var p = _.wrap(_.escape, function(func, text) {
  28487. * return '<p>' + func(text) + '</p>';
  28488. * });
  28489. *
  28490. * p('fred, barney, & pebbles');
  28491. * // => '<p>fred, barney, &amp; pebbles</p>'
  28492. */
  28493. function wrap(value, wrapper) {
  28494. return partial(castFunction(wrapper), value);
  28495. }
  28496. /*------------------------------------------------------------------------*/
  28497. /**
  28498. * Casts `value` as an array if it's not one.
  28499. *
  28500. * @static
  28501. * @memberOf _
  28502. * @since 4.4.0
  28503. * @category Lang
  28504. * @param {*} value The value to inspect.
  28505. * @returns {Array} Returns the cast array.
  28506. * @example
  28507. *
  28508. * _.castArray(1);
  28509. * // => [1]
  28510. *
  28511. * _.castArray({ 'a': 1 });
  28512. * // => [{ 'a': 1 }]
  28513. *
  28514. * _.castArray('abc');
  28515. * // => ['abc']
  28516. *
  28517. * _.castArray(null);
  28518. * // => [null]
  28519. *
  28520. * _.castArray(undefined);
  28521. * // => [undefined]
  28522. *
  28523. * _.castArray();
  28524. * // => []
  28525. *
  28526. * var array = [1, 2, 3];
  28527. * console.log(_.castArray(array) === array);
  28528. * // => true
  28529. */
  28530. function castArray() {
  28531. if (!arguments.length) {
  28532. return [];
  28533. }
  28534. var value = arguments[0];
  28535. return isArray(value) ? value : [value];
  28536. }
  28537. /**
  28538. * Creates a shallow clone of `value`.
  28539. *
  28540. * **Note:** This method is loosely based on the
  28541. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  28542. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  28543. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  28544. * arrays. The own enumerable properties of `arguments` objects are cloned
  28545. * as plain objects. An empty object is returned for uncloneable values such
  28546. * as error objects, functions, DOM nodes, and WeakMaps.
  28547. *
  28548. * @static
  28549. * @memberOf _
  28550. * @since 0.1.0
  28551. * @category Lang
  28552. * @param {*} value The value to clone.
  28553. * @returns {*} Returns the cloned value.
  28554. * @see _.cloneDeep
  28555. * @example
  28556. *
  28557. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28558. *
  28559. * var shallow = _.clone(objects);
  28560. * console.log(shallow[0] === objects[0]);
  28561. * // => true
  28562. */
  28563. function clone(value) {
  28564. return baseClone(value, CLONE_SYMBOLS_FLAG);
  28565. }
  28566. /**
  28567. * This method is like `_.clone` except that it accepts `customizer` which
  28568. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  28569. * cloning is handled by the method instead. The `customizer` is invoked with
  28570. * up to four arguments; (value [, index|key, object, stack]).
  28571. *
  28572. * @static
  28573. * @memberOf _
  28574. * @since 4.0.0
  28575. * @category Lang
  28576. * @param {*} value The value to clone.
  28577. * @param {Function} [customizer] The function to customize cloning.
  28578. * @returns {*} Returns the cloned value.
  28579. * @see _.cloneDeepWith
  28580. * @example
  28581. *
  28582. * function customizer(value) {
  28583. * if (_.isElement(value)) {
  28584. * return value.cloneNode(false);
  28585. * }
  28586. * }
  28587. *
  28588. * var el = _.cloneWith(document.body, customizer);
  28589. *
  28590. * console.log(el === document.body);
  28591. * // => false
  28592. * console.log(el.nodeName);
  28593. * // => 'BODY'
  28594. * console.log(el.childNodes.length);
  28595. * // => 0
  28596. */
  28597. function cloneWith(value, customizer) {
  28598. customizer = typeof customizer == 'function' ? customizer : undefined;
  28599. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  28600. }
  28601. /**
  28602. * This method is like `_.clone` except that it recursively clones `value`.
  28603. *
  28604. * @static
  28605. * @memberOf _
  28606. * @since 1.0.0
  28607. * @category Lang
  28608. * @param {*} value The value to recursively clone.
  28609. * @returns {*} Returns the deep cloned value.
  28610. * @see _.clone
  28611. * @example
  28612. *
  28613. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28614. *
  28615. * var deep = _.cloneDeep(objects);
  28616. * console.log(deep[0] === objects[0]);
  28617. * // => false
  28618. */
  28619. function cloneDeep(value) {
  28620. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  28621. }
  28622. /**
  28623. * This method is like `_.cloneWith` except that it recursively clones `value`.
  28624. *
  28625. * @static
  28626. * @memberOf _
  28627. * @since 4.0.0
  28628. * @category Lang
  28629. * @param {*} value The value to recursively clone.
  28630. * @param {Function} [customizer] The function to customize cloning.
  28631. * @returns {*} Returns the deep cloned value.
  28632. * @see _.cloneWith
  28633. * @example
  28634. *
  28635. * function customizer(value) {
  28636. * if (_.isElement(value)) {
  28637. * return value.cloneNode(true);
  28638. * }
  28639. * }
  28640. *
  28641. * var el = _.cloneDeepWith(document.body, customizer);
  28642. *
  28643. * console.log(el === document.body);
  28644. * // => false
  28645. * console.log(el.nodeName);
  28646. * // => 'BODY'
  28647. * console.log(el.childNodes.length);
  28648. * // => 20
  28649. */
  28650. function cloneDeepWith(value, customizer) {
  28651. customizer = typeof customizer == 'function' ? customizer : undefined;
  28652. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  28653. }
  28654. /**
  28655. * Checks if `object` conforms to `source` by invoking the predicate
  28656. * properties of `source` with the corresponding property values of `object`.
  28657. *
  28658. * **Note:** This method is equivalent to `_.conforms` when `source` is
  28659. * partially applied.
  28660. *
  28661. * @static
  28662. * @memberOf _
  28663. * @since 4.14.0
  28664. * @category Lang
  28665. * @param {Object} object The object to inspect.
  28666. * @param {Object} source The object of property predicates to conform to.
  28667. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  28668. * @example
  28669. *
  28670. * var object = { 'a': 1, 'b': 2 };
  28671. *
  28672. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  28673. * // => true
  28674. *
  28675. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  28676. * // => false
  28677. */
  28678. function conformsTo(object, source) {
  28679. return source == null || baseConformsTo(object, source, keys(source));
  28680. }
  28681. /**
  28682. * Performs a
  28683. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28684. * comparison between two values to determine if they are equivalent.
  28685. *
  28686. * @static
  28687. * @memberOf _
  28688. * @since 4.0.0
  28689. * @category Lang
  28690. * @param {*} value The value to compare.
  28691. * @param {*} other The other value to compare.
  28692. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28693. * @example
  28694. *
  28695. * var object = { 'a': 1 };
  28696. * var other = { 'a': 1 };
  28697. *
  28698. * _.eq(object, object);
  28699. * // => true
  28700. *
  28701. * _.eq(object, other);
  28702. * // => false
  28703. *
  28704. * _.eq('a', 'a');
  28705. * // => true
  28706. *
  28707. * _.eq('a', Object('a'));
  28708. * // => false
  28709. *
  28710. * _.eq(NaN, NaN);
  28711. * // => true
  28712. */
  28713. function eq(value, other) {
  28714. return value === other || (value !== value && other !== other);
  28715. }
  28716. /**
  28717. * Checks if `value` is greater than `other`.
  28718. *
  28719. * @static
  28720. * @memberOf _
  28721. * @since 3.9.0
  28722. * @category Lang
  28723. * @param {*} value The value to compare.
  28724. * @param {*} other The other value to compare.
  28725. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  28726. * else `false`.
  28727. * @see _.lt
  28728. * @example
  28729. *
  28730. * _.gt(3, 1);
  28731. * // => true
  28732. *
  28733. * _.gt(3, 3);
  28734. * // => false
  28735. *
  28736. * _.gt(1, 3);
  28737. * // => false
  28738. */
  28739. var gt = createRelationalOperation(baseGt);
  28740. /**
  28741. * Checks if `value` is greater than or equal to `other`.
  28742. *
  28743. * @static
  28744. * @memberOf _
  28745. * @since 3.9.0
  28746. * @category Lang
  28747. * @param {*} value The value to compare.
  28748. * @param {*} other The other value to compare.
  28749. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  28750. * `other`, else `false`.
  28751. * @see _.lte
  28752. * @example
  28753. *
  28754. * _.gte(3, 1);
  28755. * // => true
  28756. *
  28757. * _.gte(3, 3);
  28758. * // => true
  28759. *
  28760. * _.gte(1, 3);
  28761. * // => false
  28762. */
  28763. var gte = createRelationalOperation(function(value, other) {
  28764. return value >= other;
  28765. });
  28766. /**
  28767. * Checks if `value` is likely an `arguments` object.
  28768. *
  28769. * @static
  28770. * @memberOf _
  28771. * @since 0.1.0
  28772. * @category Lang
  28773. * @param {*} value The value to check.
  28774. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  28775. * else `false`.
  28776. * @example
  28777. *
  28778. * _.isArguments(function() { return arguments; }());
  28779. * // => true
  28780. *
  28781. * _.isArguments([1, 2, 3]);
  28782. * // => false
  28783. */
  28784. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  28785. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  28786. !propertyIsEnumerable.call(value, 'callee');
  28787. };
  28788. /**
  28789. * Checks if `value` is classified as an `Array` object.
  28790. *
  28791. * @static
  28792. * @memberOf _
  28793. * @since 0.1.0
  28794. * @category Lang
  28795. * @param {*} value The value to check.
  28796. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  28797. * @example
  28798. *
  28799. * _.isArray([1, 2, 3]);
  28800. * // => true
  28801. *
  28802. * _.isArray(document.body.children);
  28803. * // => false
  28804. *
  28805. * _.isArray('abc');
  28806. * // => false
  28807. *
  28808. * _.isArray(_.noop);
  28809. * // => false
  28810. */
  28811. var isArray = Array.isArray;
  28812. /**
  28813. * Checks if `value` is classified as an `ArrayBuffer` object.
  28814. *
  28815. * @static
  28816. * @memberOf _
  28817. * @since 4.3.0
  28818. * @category Lang
  28819. * @param {*} value The value to check.
  28820. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  28821. * @example
  28822. *
  28823. * _.isArrayBuffer(new ArrayBuffer(2));
  28824. * // => true
  28825. *
  28826. * _.isArrayBuffer(new Array(2));
  28827. * // => false
  28828. */
  28829. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  28830. /**
  28831. * Checks if `value` is array-like. A value is considered array-like if it's
  28832. * not a function and has a `value.length` that's an integer greater than or
  28833. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  28834. *
  28835. * @static
  28836. * @memberOf _
  28837. * @since 4.0.0
  28838. * @category Lang
  28839. * @param {*} value The value to check.
  28840. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  28841. * @example
  28842. *
  28843. * _.isArrayLike([1, 2, 3]);
  28844. * // => true
  28845. *
  28846. * _.isArrayLike(document.body.children);
  28847. * // => true
  28848. *
  28849. * _.isArrayLike('abc');
  28850. * // => true
  28851. *
  28852. * _.isArrayLike(_.noop);
  28853. * // => false
  28854. */
  28855. function isArrayLike(value) {
  28856. return value != null && isLength(value.length) && !isFunction(value);
  28857. }
  28858. /**
  28859. * This method is like `_.isArrayLike` except that it also checks if `value`
  28860. * is an object.
  28861. *
  28862. * @static
  28863. * @memberOf _
  28864. * @since 4.0.0
  28865. * @category Lang
  28866. * @param {*} value The value to check.
  28867. * @returns {boolean} Returns `true` if `value` is an array-like object,
  28868. * else `false`.
  28869. * @example
  28870. *
  28871. * _.isArrayLikeObject([1, 2, 3]);
  28872. * // => true
  28873. *
  28874. * _.isArrayLikeObject(document.body.children);
  28875. * // => true
  28876. *
  28877. * _.isArrayLikeObject('abc');
  28878. * // => false
  28879. *
  28880. * _.isArrayLikeObject(_.noop);
  28881. * // => false
  28882. */
  28883. function isArrayLikeObject(value) {
  28884. return isObjectLike(value) && isArrayLike(value);
  28885. }
  28886. /**
  28887. * Checks if `value` is classified as a boolean primitive or object.
  28888. *
  28889. * @static
  28890. * @memberOf _
  28891. * @since 0.1.0
  28892. * @category Lang
  28893. * @param {*} value The value to check.
  28894. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  28895. * @example
  28896. *
  28897. * _.isBoolean(false);
  28898. * // => true
  28899. *
  28900. * _.isBoolean(null);
  28901. * // => false
  28902. */
  28903. function isBoolean(value) {
  28904. return value === true || value === false ||
  28905. (isObjectLike(value) && baseGetTag(value) == boolTag);
  28906. }
  28907. /**
  28908. * Checks if `value` is a buffer.
  28909. *
  28910. * @static
  28911. * @memberOf _
  28912. * @since 4.3.0
  28913. * @category Lang
  28914. * @param {*} value The value to check.
  28915. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  28916. * @example
  28917. *
  28918. * _.isBuffer(new Buffer(2));
  28919. * // => true
  28920. *
  28921. * _.isBuffer(new Uint8Array(2));
  28922. * // => false
  28923. */
  28924. var isBuffer = nativeIsBuffer || stubFalse;
  28925. /**
  28926. * Checks if `value` is classified as a `Date` object.
  28927. *
  28928. * @static
  28929. * @memberOf _
  28930. * @since 0.1.0
  28931. * @category Lang
  28932. * @param {*} value The value to check.
  28933. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  28934. * @example
  28935. *
  28936. * _.isDate(new Date);
  28937. * // => true
  28938. *
  28939. * _.isDate('Mon April 23 2012');
  28940. * // => false
  28941. */
  28942. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  28943. /**
  28944. * Checks if `value` is likely a DOM element.
  28945. *
  28946. * @static
  28947. * @memberOf _
  28948. * @since 0.1.0
  28949. * @category Lang
  28950. * @param {*} value The value to check.
  28951. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  28952. * @example
  28953. *
  28954. * _.isElement(document.body);
  28955. * // => true
  28956. *
  28957. * _.isElement('<body>');
  28958. * // => false
  28959. */
  28960. function isElement(value) {
  28961. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  28962. }
  28963. /**
  28964. * Checks if `value` is an empty object, collection, map, or set.
  28965. *
  28966. * Objects are considered empty if they have no own enumerable string keyed
  28967. * properties.
  28968. *
  28969. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  28970. * jQuery-like collections are considered empty if they have a `length` of `0`.
  28971. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  28972. *
  28973. * @static
  28974. * @memberOf _
  28975. * @since 0.1.0
  28976. * @category Lang
  28977. * @param {*} value The value to check.
  28978. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  28979. * @example
  28980. *
  28981. * _.isEmpty(null);
  28982. * // => true
  28983. *
  28984. * _.isEmpty(true);
  28985. * // => true
  28986. *
  28987. * _.isEmpty(1);
  28988. * // => true
  28989. *
  28990. * _.isEmpty([1, 2, 3]);
  28991. * // => false
  28992. *
  28993. * _.isEmpty({ 'a': 1 });
  28994. * // => false
  28995. */
  28996. function isEmpty(value) {
  28997. if (value == null) {
  28998. return true;
  28999. }
  29000. if (isArrayLike(value) &&
  29001. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  29002. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  29003. return !value.length;
  29004. }
  29005. var tag = getTag(value);
  29006. if (tag == mapTag || tag == setTag) {
  29007. return !value.size;
  29008. }
  29009. if (isPrototype(value)) {
  29010. return !baseKeys(value).length;
  29011. }
  29012. for (var key in value) {
  29013. if (hasOwnProperty.call(value, key)) {
  29014. return false;
  29015. }
  29016. }
  29017. return true;
  29018. }
  29019. /**
  29020. * Performs a deep comparison between two values to determine if they are
  29021. * equivalent.
  29022. *
  29023. * **Note:** This method supports comparing arrays, array buffers, booleans,
  29024. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  29025. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  29026. * by their own, not inherited, enumerable properties. Functions and DOM
  29027. * nodes are compared by strict equality, i.e. `===`.
  29028. *
  29029. * @static
  29030. * @memberOf _
  29031. * @since 0.1.0
  29032. * @category Lang
  29033. * @param {*} value The value to compare.
  29034. * @param {*} other The other value to compare.
  29035. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29036. * @example
  29037. *
  29038. * var object = { 'a': 1 };
  29039. * var other = { 'a': 1 };
  29040. *
  29041. * _.isEqual(object, other);
  29042. * // => true
  29043. *
  29044. * object === other;
  29045. * // => false
  29046. */
  29047. function isEqual(value, other) {
  29048. return baseIsEqual(value, other);
  29049. }
  29050. /**
  29051. * This method is like `_.isEqual` except that it accepts `customizer` which
  29052. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29053. * are handled by the method instead. The `customizer` is invoked with up to
  29054. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  29055. *
  29056. * @static
  29057. * @memberOf _
  29058. * @since 4.0.0
  29059. * @category Lang
  29060. * @param {*} value The value to compare.
  29061. * @param {*} other The other value to compare.
  29062. * @param {Function} [customizer] The function to customize comparisons.
  29063. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29064. * @example
  29065. *
  29066. * function isGreeting(value) {
  29067. * return /^h(?:i|ello)$/.test(value);
  29068. * }
  29069. *
  29070. * function customizer(objValue, othValue) {
  29071. * if (isGreeting(objValue) && isGreeting(othValue)) {
  29072. * return true;
  29073. * }
  29074. * }
  29075. *
  29076. * var array = ['hello', 'goodbye'];
  29077. * var other = ['hi', 'goodbye'];
  29078. *
  29079. * _.isEqualWith(array, other, customizer);
  29080. * // => true
  29081. */
  29082. function isEqualWith(value, other, customizer) {
  29083. customizer = typeof customizer == 'function' ? customizer : undefined;
  29084. var result = customizer ? customizer(value, other) : undefined;
  29085. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  29086. }
  29087. /**
  29088. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  29089. * `SyntaxError`, `TypeError`, or `URIError` object.
  29090. *
  29091. * @static
  29092. * @memberOf _
  29093. * @since 3.0.0
  29094. * @category Lang
  29095. * @param {*} value The value to check.
  29096. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  29097. * @example
  29098. *
  29099. * _.isError(new Error);
  29100. * // => true
  29101. *
  29102. * _.isError(Error);
  29103. * // => false
  29104. */
  29105. function isError(value) {
  29106. if (!isObjectLike(value)) {
  29107. return false;
  29108. }
  29109. var tag = baseGetTag(value);
  29110. return tag == errorTag || tag == domExcTag ||
  29111. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  29112. }
  29113. /**
  29114. * Checks if `value` is a finite primitive number.
  29115. *
  29116. * **Note:** This method is based on
  29117. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  29118. *
  29119. * @static
  29120. * @memberOf _
  29121. * @since 0.1.0
  29122. * @category Lang
  29123. * @param {*} value The value to check.
  29124. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  29125. * @example
  29126. *
  29127. * _.isFinite(3);
  29128. * // => true
  29129. *
  29130. * _.isFinite(Number.MIN_VALUE);
  29131. * // => true
  29132. *
  29133. * _.isFinite(Infinity);
  29134. * // => false
  29135. *
  29136. * _.isFinite('3');
  29137. * // => false
  29138. */
  29139. function isFinite(value) {
  29140. return typeof value == 'number' && nativeIsFinite(value);
  29141. }
  29142. /**
  29143. * Checks if `value` is classified as a `Function` object.
  29144. *
  29145. * @static
  29146. * @memberOf _
  29147. * @since 0.1.0
  29148. * @category Lang
  29149. * @param {*} value The value to check.
  29150. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  29151. * @example
  29152. *
  29153. * _.isFunction(_);
  29154. * // => true
  29155. *
  29156. * _.isFunction(/abc/);
  29157. * // => false
  29158. */
  29159. function isFunction(value) {
  29160. if (!isObject(value)) {
  29161. return false;
  29162. }
  29163. // The use of `Object#toString` avoids issues with the `typeof` operator
  29164. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  29165. var tag = baseGetTag(value);
  29166. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  29167. }
  29168. /**
  29169. * Checks if `value` is an integer.
  29170. *
  29171. * **Note:** This method is based on
  29172. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  29173. *
  29174. * @static
  29175. * @memberOf _
  29176. * @since 4.0.0
  29177. * @category Lang
  29178. * @param {*} value The value to check.
  29179. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  29180. * @example
  29181. *
  29182. * _.isInteger(3);
  29183. * // => true
  29184. *
  29185. * _.isInteger(Number.MIN_VALUE);
  29186. * // => false
  29187. *
  29188. * _.isInteger(Infinity);
  29189. * // => false
  29190. *
  29191. * _.isInteger('3');
  29192. * // => false
  29193. */
  29194. function isInteger(value) {
  29195. return typeof value == 'number' && value == toInteger(value);
  29196. }
  29197. /**
  29198. * Checks if `value` is a valid array-like length.
  29199. *
  29200. * **Note:** This method is loosely based on
  29201. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29202. *
  29203. * @static
  29204. * @memberOf _
  29205. * @since 4.0.0
  29206. * @category Lang
  29207. * @param {*} value The value to check.
  29208. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  29209. * @example
  29210. *
  29211. * _.isLength(3);
  29212. * // => true
  29213. *
  29214. * _.isLength(Number.MIN_VALUE);
  29215. * // => false
  29216. *
  29217. * _.isLength(Infinity);
  29218. * // => false
  29219. *
  29220. * _.isLength('3');
  29221. * // => false
  29222. */
  29223. function isLength(value) {
  29224. return typeof value == 'number' &&
  29225. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  29226. }
  29227. /**
  29228. * Checks if `value` is the
  29229. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  29230. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  29231. *
  29232. * @static
  29233. * @memberOf _
  29234. * @since 0.1.0
  29235. * @category Lang
  29236. * @param {*} value The value to check.
  29237. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  29238. * @example
  29239. *
  29240. * _.isObject({});
  29241. * // => true
  29242. *
  29243. * _.isObject([1, 2, 3]);
  29244. * // => true
  29245. *
  29246. * _.isObject(_.noop);
  29247. * // => true
  29248. *
  29249. * _.isObject(null);
  29250. * // => false
  29251. */
  29252. function isObject(value) {
  29253. var type = typeof value;
  29254. return value != null && (type == 'object' || type == 'function');
  29255. }
  29256. /**
  29257. * Checks if `value` is object-like. A value is object-like if it's not `null`
  29258. * and has a `typeof` result of "object".
  29259. *
  29260. * @static
  29261. * @memberOf _
  29262. * @since 4.0.0
  29263. * @category Lang
  29264. * @param {*} value The value to check.
  29265. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  29266. * @example
  29267. *
  29268. * _.isObjectLike({});
  29269. * // => true
  29270. *
  29271. * _.isObjectLike([1, 2, 3]);
  29272. * // => true
  29273. *
  29274. * _.isObjectLike(_.noop);
  29275. * // => false
  29276. *
  29277. * _.isObjectLike(null);
  29278. * // => false
  29279. */
  29280. function isObjectLike(value) {
  29281. return value != null && typeof value == 'object';
  29282. }
  29283. /**
  29284. * Checks if `value` is classified as a `Map` object.
  29285. *
  29286. * @static
  29287. * @memberOf _
  29288. * @since 4.3.0
  29289. * @category Lang
  29290. * @param {*} value The value to check.
  29291. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  29292. * @example
  29293. *
  29294. * _.isMap(new Map);
  29295. * // => true
  29296. *
  29297. * _.isMap(new WeakMap);
  29298. * // => false
  29299. */
  29300. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  29301. /**
  29302. * Performs a partial deep comparison between `object` and `source` to
  29303. * determine if `object` contains equivalent property values.
  29304. *
  29305. * **Note:** This method is equivalent to `_.matches` when `source` is
  29306. * partially applied.
  29307. *
  29308. * Partial comparisons will match empty array and empty object `source`
  29309. * values against any array or object value, respectively. See `_.isEqual`
  29310. * for a list of supported value comparisons.
  29311. *
  29312. * @static
  29313. * @memberOf _
  29314. * @since 3.0.0
  29315. * @category Lang
  29316. * @param {Object} object The object to inspect.
  29317. * @param {Object} source The object of property values to match.
  29318. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29319. * @example
  29320. *
  29321. * var object = { 'a': 1, 'b': 2 };
  29322. *
  29323. * _.isMatch(object, { 'b': 2 });
  29324. * // => true
  29325. *
  29326. * _.isMatch(object, { 'b': 1 });
  29327. * // => false
  29328. */
  29329. function isMatch(object, source) {
  29330. return object === source || baseIsMatch(object, source, getMatchData(source));
  29331. }
  29332. /**
  29333. * This method is like `_.isMatch` except that it accepts `customizer` which
  29334. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29335. * are handled by the method instead. The `customizer` is invoked with five
  29336. * arguments: (objValue, srcValue, index|key, object, source).
  29337. *
  29338. * @static
  29339. * @memberOf _
  29340. * @since 4.0.0
  29341. * @category Lang
  29342. * @param {Object} object The object to inspect.
  29343. * @param {Object} source The object of property values to match.
  29344. * @param {Function} [customizer] The function to customize comparisons.
  29345. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29346. * @example
  29347. *
  29348. * function isGreeting(value) {
  29349. * return /^h(?:i|ello)$/.test(value);
  29350. * }
  29351. *
  29352. * function customizer(objValue, srcValue) {
  29353. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  29354. * return true;
  29355. * }
  29356. * }
  29357. *
  29358. * var object = { 'greeting': 'hello' };
  29359. * var source = { 'greeting': 'hi' };
  29360. *
  29361. * _.isMatchWith(object, source, customizer);
  29362. * // => true
  29363. */
  29364. function isMatchWith(object, source, customizer) {
  29365. customizer = typeof customizer == 'function' ? customizer : undefined;
  29366. return baseIsMatch(object, source, getMatchData(source), customizer);
  29367. }
  29368. /**
  29369. * Checks if `value` is `NaN`.
  29370. *
  29371. * **Note:** This method is based on
  29372. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  29373. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  29374. * `undefined` and other non-number values.
  29375. *
  29376. * @static
  29377. * @memberOf _
  29378. * @since 0.1.0
  29379. * @category Lang
  29380. * @param {*} value The value to check.
  29381. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  29382. * @example
  29383. *
  29384. * _.isNaN(NaN);
  29385. * // => true
  29386. *
  29387. * _.isNaN(new Number(NaN));
  29388. * // => true
  29389. *
  29390. * isNaN(undefined);
  29391. * // => true
  29392. *
  29393. * _.isNaN(undefined);
  29394. * // => false
  29395. */
  29396. function isNaN(value) {
  29397. // An `NaN` primitive is the only value that is not equal to itself.
  29398. // Perform the `toStringTag` check first to avoid errors with some
  29399. // ActiveX objects in IE.
  29400. return isNumber(value) && value != +value;
  29401. }
  29402. /**
  29403. * Checks if `value` is a pristine native function.
  29404. *
  29405. * **Note:** This method can't reliably detect native functions in the presence
  29406. * of the core-js package because core-js circumvents this kind of detection.
  29407. * Despite multiple requests, the core-js maintainer has made it clear: any
  29408. * attempt to fix the detection will be obstructed. As a result, we're left
  29409. * with little choice but to throw an error. Unfortunately, this also affects
  29410. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  29411. * which rely on core-js.
  29412. *
  29413. * @static
  29414. * @memberOf _
  29415. * @since 3.0.0
  29416. * @category Lang
  29417. * @param {*} value The value to check.
  29418. * @returns {boolean} Returns `true` if `value` is a native function,
  29419. * else `false`.
  29420. * @example
  29421. *
  29422. * _.isNative(Array.prototype.push);
  29423. * // => true
  29424. *
  29425. * _.isNative(_);
  29426. * // => false
  29427. */
  29428. function isNative(value) {
  29429. if (isMaskable(value)) {
  29430. throw new Error(CORE_ERROR_TEXT);
  29431. }
  29432. return baseIsNative(value);
  29433. }
  29434. /**
  29435. * Checks if `value` is `null`.
  29436. *
  29437. * @static
  29438. * @memberOf _
  29439. * @since 0.1.0
  29440. * @category Lang
  29441. * @param {*} value The value to check.
  29442. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  29443. * @example
  29444. *
  29445. * _.isNull(null);
  29446. * // => true
  29447. *
  29448. * _.isNull(void 0);
  29449. * // => false
  29450. */
  29451. function isNull(value) {
  29452. return value === null;
  29453. }
  29454. /**
  29455. * Checks if `value` is `null` or `undefined`.
  29456. *
  29457. * @static
  29458. * @memberOf _
  29459. * @since 4.0.0
  29460. * @category Lang
  29461. * @param {*} value The value to check.
  29462. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  29463. * @example
  29464. *
  29465. * _.isNil(null);
  29466. * // => true
  29467. *
  29468. * _.isNil(void 0);
  29469. * // => true
  29470. *
  29471. * _.isNil(NaN);
  29472. * // => false
  29473. */
  29474. function isNil(value) {
  29475. return value == null;
  29476. }
  29477. /**
  29478. * Checks if `value` is classified as a `Number` primitive or object.
  29479. *
  29480. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  29481. * classified as numbers, use the `_.isFinite` method.
  29482. *
  29483. * @static
  29484. * @memberOf _
  29485. * @since 0.1.0
  29486. * @category Lang
  29487. * @param {*} value The value to check.
  29488. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  29489. * @example
  29490. *
  29491. * _.isNumber(3);
  29492. * // => true
  29493. *
  29494. * _.isNumber(Number.MIN_VALUE);
  29495. * // => true
  29496. *
  29497. * _.isNumber(Infinity);
  29498. * // => true
  29499. *
  29500. * _.isNumber('3');
  29501. * // => false
  29502. */
  29503. function isNumber(value) {
  29504. return typeof value == 'number' ||
  29505. (isObjectLike(value) && baseGetTag(value) == numberTag);
  29506. }
  29507. /**
  29508. * Checks if `value` is a plain object, that is, an object created by the
  29509. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  29510. *
  29511. * @static
  29512. * @memberOf _
  29513. * @since 0.8.0
  29514. * @category Lang
  29515. * @param {*} value The value to check.
  29516. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  29517. * @example
  29518. *
  29519. * function Foo() {
  29520. * this.a = 1;
  29521. * }
  29522. *
  29523. * _.isPlainObject(new Foo);
  29524. * // => false
  29525. *
  29526. * _.isPlainObject([1, 2, 3]);
  29527. * // => false
  29528. *
  29529. * _.isPlainObject({ 'x': 0, 'y': 0 });
  29530. * // => true
  29531. *
  29532. * _.isPlainObject(Object.create(null));
  29533. * // => true
  29534. */
  29535. function isPlainObject(value) {
  29536. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  29537. return false;
  29538. }
  29539. var proto = getPrototype(value);
  29540. if (proto === null) {
  29541. return true;
  29542. }
  29543. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  29544. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  29545. funcToString.call(Ctor) == objectCtorString;
  29546. }
  29547. /**
  29548. * Checks if `value` is classified as a `RegExp` object.
  29549. *
  29550. * @static
  29551. * @memberOf _
  29552. * @since 0.1.0
  29553. * @category Lang
  29554. * @param {*} value The value to check.
  29555. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  29556. * @example
  29557. *
  29558. * _.isRegExp(/abc/);
  29559. * // => true
  29560. *
  29561. * _.isRegExp('/abc/');
  29562. * // => false
  29563. */
  29564. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  29565. /**
  29566. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  29567. * double precision number which isn't the result of a rounded unsafe integer.
  29568. *
  29569. * **Note:** This method is based on
  29570. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  29571. *
  29572. * @static
  29573. * @memberOf _
  29574. * @since 4.0.0
  29575. * @category Lang
  29576. * @param {*} value The value to check.
  29577. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  29578. * @example
  29579. *
  29580. * _.isSafeInteger(3);
  29581. * // => true
  29582. *
  29583. * _.isSafeInteger(Number.MIN_VALUE);
  29584. * // => false
  29585. *
  29586. * _.isSafeInteger(Infinity);
  29587. * // => false
  29588. *
  29589. * _.isSafeInteger('3');
  29590. * // => false
  29591. */
  29592. function isSafeInteger(value) {
  29593. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  29594. }
  29595. /**
  29596. * Checks if `value` is classified as a `Set` object.
  29597. *
  29598. * @static
  29599. * @memberOf _
  29600. * @since 4.3.0
  29601. * @category Lang
  29602. * @param {*} value The value to check.
  29603. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  29604. * @example
  29605. *
  29606. * _.isSet(new Set);
  29607. * // => true
  29608. *
  29609. * _.isSet(new WeakSet);
  29610. * // => false
  29611. */
  29612. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  29613. /**
  29614. * Checks if `value` is classified as a `String` primitive or object.
  29615. *
  29616. * @static
  29617. * @since 0.1.0
  29618. * @memberOf _
  29619. * @category Lang
  29620. * @param {*} value The value to check.
  29621. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  29622. * @example
  29623. *
  29624. * _.isString('abc');
  29625. * // => true
  29626. *
  29627. * _.isString(1);
  29628. * // => false
  29629. */
  29630. function isString(value) {
  29631. return typeof value == 'string' ||
  29632. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  29633. }
  29634. /**
  29635. * Checks if `value` is classified as a `Symbol` primitive or object.
  29636. *
  29637. * @static
  29638. * @memberOf _
  29639. * @since 4.0.0
  29640. * @category Lang
  29641. * @param {*} value The value to check.
  29642. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  29643. * @example
  29644. *
  29645. * _.isSymbol(Symbol.iterator);
  29646. * // => true
  29647. *
  29648. * _.isSymbol('abc');
  29649. * // => false
  29650. */
  29651. function isSymbol(value) {
  29652. return typeof value == 'symbol' ||
  29653. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  29654. }
  29655. /**
  29656. * Checks if `value` is classified as a typed array.
  29657. *
  29658. * @static
  29659. * @memberOf _
  29660. * @since 3.0.0
  29661. * @category Lang
  29662. * @param {*} value The value to check.
  29663. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  29664. * @example
  29665. *
  29666. * _.isTypedArray(new Uint8Array);
  29667. * // => true
  29668. *
  29669. * _.isTypedArray([]);
  29670. * // => false
  29671. */
  29672. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  29673. /**
  29674. * Checks if `value` is `undefined`.
  29675. *
  29676. * @static
  29677. * @since 0.1.0
  29678. * @memberOf _
  29679. * @category Lang
  29680. * @param {*} value The value to check.
  29681. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  29682. * @example
  29683. *
  29684. * _.isUndefined(void 0);
  29685. * // => true
  29686. *
  29687. * _.isUndefined(null);
  29688. * // => false
  29689. */
  29690. function isUndefined(value) {
  29691. return value === undefined;
  29692. }
  29693. /**
  29694. * Checks if `value` is classified as a `WeakMap` object.
  29695. *
  29696. * @static
  29697. * @memberOf _
  29698. * @since 4.3.0
  29699. * @category Lang
  29700. * @param {*} value The value to check.
  29701. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  29702. * @example
  29703. *
  29704. * _.isWeakMap(new WeakMap);
  29705. * // => true
  29706. *
  29707. * _.isWeakMap(new Map);
  29708. * // => false
  29709. */
  29710. function isWeakMap(value) {
  29711. return isObjectLike(value) && getTag(value) == weakMapTag;
  29712. }
  29713. /**
  29714. * Checks if `value` is classified as a `WeakSet` object.
  29715. *
  29716. * @static
  29717. * @memberOf _
  29718. * @since 4.3.0
  29719. * @category Lang
  29720. * @param {*} value The value to check.
  29721. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  29722. * @example
  29723. *
  29724. * _.isWeakSet(new WeakSet);
  29725. * // => true
  29726. *
  29727. * _.isWeakSet(new Set);
  29728. * // => false
  29729. */
  29730. function isWeakSet(value) {
  29731. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  29732. }
  29733. /**
  29734. * Checks if `value` is less than `other`.
  29735. *
  29736. * @static
  29737. * @memberOf _
  29738. * @since 3.9.0
  29739. * @category Lang
  29740. * @param {*} value The value to compare.
  29741. * @param {*} other The other value to compare.
  29742. * @returns {boolean} Returns `true` if `value` is less than `other`,
  29743. * else `false`.
  29744. * @see _.gt
  29745. * @example
  29746. *
  29747. * _.lt(1, 3);
  29748. * // => true
  29749. *
  29750. * _.lt(3, 3);
  29751. * // => false
  29752. *
  29753. * _.lt(3, 1);
  29754. * // => false
  29755. */
  29756. var lt = createRelationalOperation(baseLt);
  29757. /**
  29758. * Checks if `value` is less than or equal to `other`.
  29759. *
  29760. * @static
  29761. * @memberOf _
  29762. * @since 3.9.0
  29763. * @category Lang
  29764. * @param {*} value The value to compare.
  29765. * @param {*} other The other value to compare.
  29766. * @returns {boolean} Returns `true` if `value` is less than or equal to
  29767. * `other`, else `false`.
  29768. * @see _.gte
  29769. * @example
  29770. *
  29771. * _.lte(1, 3);
  29772. * // => true
  29773. *
  29774. * _.lte(3, 3);
  29775. * // => true
  29776. *
  29777. * _.lte(3, 1);
  29778. * // => false
  29779. */
  29780. var lte = createRelationalOperation(function(value, other) {
  29781. return value <= other;
  29782. });
  29783. /**
  29784. * Converts `value` to an array.
  29785. *
  29786. * @static
  29787. * @since 0.1.0
  29788. * @memberOf _
  29789. * @category Lang
  29790. * @param {*} value The value to convert.
  29791. * @returns {Array} Returns the converted array.
  29792. * @example
  29793. *
  29794. * _.toArray({ 'a': 1, 'b': 2 });
  29795. * // => [1, 2]
  29796. *
  29797. * _.toArray('abc');
  29798. * // => ['a', 'b', 'c']
  29799. *
  29800. * _.toArray(1);
  29801. * // => []
  29802. *
  29803. * _.toArray(null);
  29804. * // => []
  29805. */
  29806. function toArray(value) {
  29807. if (!value) {
  29808. return [];
  29809. }
  29810. if (isArrayLike(value)) {
  29811. return isString(value) ? stringToArray(value) : copyArray(value);
  29812. }
  29813. if (symIterator && value[symIterator]) {
  29814. return iteratorToArray(value[symIterator]());
  29815. }
  29816. var tag = getTag(value),
  29817. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  29818. return func(value);
  29819. }
  29820. /**
  29821. * Converts `value` to a finite number.
  29822. *
  29823. * @static
  29824. * @memberOf _
  29825. * @since 4.12.0
  29826. * @category Lang
  29827. * @param {*} value The value to convert.
  29828. * @returns {number} Returns the converted number.
  29829. * @example
  29830. *
  29831. * _.toFinite(3.2);
  29832. * // => 3.2
  29833. *
  29834. * _.toFinite(Number.MIN_VALUE);
  29835. * // => 5e-324
  29836. *
  29837. * _.toFinite(Infinity);
  29838. * // => 1.7976931348623157e+308
  29839. *
  29840. * _.toFinite('3.2');
  29841. * // => 3.2
  29842. */
  29843. function toFinite(value) {
  29844. if (!value) {
  29845. return value === 0 ? value : 0;
  29846. }
  29847. value = toNumber(value);
  29848. if (value === INFINITY || value === -INFINITY) {
  29849. var sign = (value < 0 ? -1 : 1);
  29850. return sign * MAX_INTEGER;
  29851. }
  29852. return value === value ? value : 0;
  29853. }
  29854. /**
  29855. * Converts `value` to an integer.
  29856. *
  29857. * **Note:** This method is loosely based on
  29858. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  29859. *
  29860. * @static
  29861. * @memberOf _
  29862. * @since 4.0.0
  29863. * @category Lang
  29864. * @param {*} value The value to convert.
  29865. * @returns {number} Returns the converted integer.
  29866. * @example
  29867. *
  29868. * _.toInteger(3.2);
  29869. * // => 3
  29870. *
  29871. * _.toInteger(Number.MIN_VALUE);
  29872. * // => 0
  29873. *
  29874. * _.toInteger(Infinity);
  29875. * // => 1.7976931348623157e+308
  29876. *
  29877. * _.toInteger('3.2');
  29878. * // => 3
  29879. */
  29880. function toInteger(value) {
  29881. var result = toFinite(value),
  29882. remainder = result % 1;
  29883. return result === result ? (remainder ? result - remainder : result) : 0;
  29884. }
  29885. /**
  29886. * Converts `value` to an integer suitable for use as the length of an
  29887. * array-like object.
  29888. *
  29889. * **Note:** This method is based on
  29890. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29891. *
  29892. * @static
  29893. * @memberOf _
  29894. * @since 4.0.0
  29895. * @category Lang
  29896. * @param {*} value The value to convert.
  29897. * @returns {number} Returns the converted integer.
  29898. * @example
  29899. *
  29900. * _.toLength(3.2);
  29901. * // => 3
  29902. *
  29903. * _.toLength(Number.MIN_VALUE);
  29904. * // => 0
  29905. *
  29906. * _.toLength(Infinity);
  29907. * // => 4294967295
  29908. *
  29909. * _.toLength('3.2');
  29910. * // => 3
  29911. */
  29912. function toLength(value) {
  29913. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  29914. }
  29915. /**
  29916. * Converts `value` to a number.
  29917. *
  29918. * @static
  29919. * @memberOf _
  29920. * @since 4.0.0
  29921. * @category Lang
  29922. * @param {*} value The value to process.
  29923. * @returns {number} Returns the number.
  29924. * @example
  29925. *
  29926. * _.toNumber(3.2);
  29927. * // => 3.2
  29928. *
  29929. * _.toNumber(Number.MIN_VALUE);
  29930. * // => 5e-324
  29931. *
  29932. * _.toNumber(Infinity);
  29933. * // => Infinity
  29934. *
  29935. * _.toNumber('3.2');
  29936. * // => 3.2
  29937. */
  29938. function toNumber(value) {
  29939. if (typeof value == 'number') {
  29940. return value;
  29941. }
  29942. if (isSymbol(value)) {
  29943. return NAN;
  29944. }
  29945. if (isObject(value)) {
  29946. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  29947. value = isObject(other) ? (other + '') : other;
  29948. }
  29949. if (typeof value != 'string') {
  29950. return value === 0 ? value : +value;
  29951. }
  29952. value = value.replace(reTrim, '');
  29953. var isBinary = reIsBinary.test(value);
  29954. return (isBinary || reIsOctal.test(value))
  29955. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  29956. : (reIsBadHex.test(value) ? NAN : +value);
  29957. }
  29958. /**
  29959. * Converts `value` to a plain object flattening inherited enumerable string
  29960. * keyed properties of `value` to own properties of the plain object.
  29961. *
  29962. * @static
  29963. * @memberOf _
  29964. * @since 3.0.0
  29965. * @category Lang
  29966. * @param {*} value The value to convert.
  29967. * @returns {Object} Returns the converted plain object.
  29968. * @example
  29969. *
  29970. * function Foo() {
  29971. * this.b = 2;
  29972. * }
  29973. *
  29974. * Foo.prototype.c = 3;
  29975. *
  29976. * _.assign({ 'a': 1 }, new Foo);
  29977. * // => { 'a': 1, 'b': 2 }
  29978. *
  29979. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  29980. * // => { 'a': 1, 'b': 2, 'c': 3 }
  29981. */
  29982. function toPlainObject(value) {
  29983. return copyObject(value, keysIn(value));
  29984. }
  29985. /**
  29986. * Converts `value` to a safe integer. A safe integer can be compared and
  29987. * represented correctly.
  29988. *
  29989. * @static
  29990. * @memberOf _
  29991. * @since 4.0.0
  29992. * @category Lang
  29993. * @param {*} value The value to convert.
  29994. * @returns {number} Returns the converted integer.
  29995. * @example
  29996. *
  29997. * _.toSafeInteger(3.2);
  29998. * // => 3
  29999. *
  30000. * _.toSafeInteger(Number.MIN_VALUE);
  30001. * // => 0
  30002. *
  30003. * _.toSafeInteger(Infinity);
  30004. * // => 9007199254740991
  30005. *
  30006. * _.toSafeInteger('3.2');
  30007. * // => 3
  30008. */
  30009. function toSafeInteger(value) {
  30010. return value
  30011. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  30012. : (value === 0 ? value : 0);
  30013. }
  30014. /**
  30015. * Converts `value` to a string. An empty string is returned for `null`
  30016. * and `undefined` values. The sign of `-0` is preserved.
  30017. *
  30018. * @static
  30019. * @memberOf _
  30020. * @since 4.0.0
  30021. * @category Lang
  30022. * @param {*} value The value to convert.
  30023. * @returns {string} Returns the converted string.
  30024. * @example
  30025. *
  30026. * _.toString(null);
  30027. * // => ''
  30028. *
  30029. * _.toString(-0);
  30030. * // => '-0'
  30031. *
  30032. * _.toString([1, 2, 3]);
  30033. * // => '1,2,3'
  30034. */
  30035. function toString(value) {
  30036. return value == null ? '' : baseToString(value);
  30037. }
  30038. /*------------------------------------------------------------------------*/
  30039. /**
  30040. * Assigns own enumerable string keyed properties of source objects to the
  30041. * destination object. Source objects are applied from left to right.
  30042. * Subsequent sources overwrite property assignments of previous sources.
  30043. *
  30044. * **Note:** This method mutates `object` and is loosely based on
  30045. * [`Object.assign`](https://mdn.io/Object/assign).
  30046. *
  30047. * @static
  30048. * @memberOf _
  30049. * @since 0.10.0
  30050. * @category Object
  30051. * @param {Object} object The destination object.
  30052. * @param {...Object} [sources] The source objects.
  30053. * @returns {Object} Returns `object`.
  30054. * @see _.assignIn
  30055. * @example
  30056. *
  30057. * function Foo() {
  30058. * this.a = 1;
  30059. * }
  30060. *
  30061. * function Bar() {
  30062. * this.c = 3;
  30063. * }
  30064. *
  30065. * Foo.prototype.b = 2;
  30066. * Bar.prototype.d = 4;
  30067. *
  30068. * _.assign({ 'a': 0 }, new Foo, new Bar);
  30069. * // => { 'a': 1, 'c': 3 }
  30070. */
  30071. var assign = createAssigner(function(object, source) {
  30072. if (isPrototype(source) || isArrayLike(source)) {
  30073. copyObject(source, keys(source), object);
  30074. return;
  30075. }
  30076. for (var key in source) {
  30077. if (hasOwnProperty.call(source, key)) {
  30078. assignValue(object, key, source[key]);
  30079. }
  30080. }
  30081. });
  30082. /**
  30083. * This method is like `_.assign` except that it iterates over own and
  30084. * inherited source properties.
  30085. *
  30086. * **Note:** This method mutates `object`.
  30087. *
  30088. * @static
  30089. * @memberOf _
  30090. * @since 4.0.0
  30091. * @alias extend
  30092. * @category Object
  30093. * @param {Object} object The destination object.
  30094. * @param {...Object} [sources] The source objects.
  30095. * @returns {Object} Returns `object`.
  30096. * @see _.assign
  30097. * @example
  30098. *
  30099. * function Foo() {
  30100. * this.a = 1;
  30101. * }
  30102. *
  30103. * function Bar() {
  30104. * this.c = 3;
  30105. * }
  30106. *
  30107. * Foo.prototype.b = 2;
  30108. * Bar.prototype.d = 4;
  30109. *
  30110. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  30111. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  30112. */
  30113. var assignIn = createAssigner(function(object, source) {
  30114. copyObject(source, keysIn(source), object);
  30115. });
  30116. /**
  30117. * This method is like `_.assignIn` except that it accepts `customizer`
  30118. * which is invoked to produce the assigned values. If `customizer` returns
  30119. * `undefined`, assignment is handled by the method instead. The `customizer`
  30120. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30121. *
  30122. * **Note:** This method mutates `object`.
  30123. *
  30124. * @static
  30125. * @memberOf _
  30126. * @since 4.0.0
  30127. * @alias extendWith
  30128. * @category Object
  30129. * @param {Object} object The destination object.
  30130. * @param {...Object} sources The source objects.
  30131. * @param {Function} [customizer] The function to customize assigned values.
  30132. * @returns {Object} Returns `object`.
  30133. * @see _.assignWith
  30134. * @example
  30135. *
  30136. * function customizer(objValue, srcValue) {
  30137. * return _.isUndefined(objValue) ? srcValue : objValue;
  30138. * }
  30139. *
  30140. * var defaults = _.partialRight(_.assignInWith, customizer);
  30141. *
  30142. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30143. * // => { 'a': 1, 'b': 2 }
  30144. */
  30145. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  30146. copyObject(source, keysIn(source), object, customizer);
  30147. });
  30148. /**
  30149. * This method is like `_.assign` except that it accepts `customizer`
  30150. * which is invoked to produce the assigned values. If `customizer` returns
  30151. * `undefined`, assignment is handled by the method instead. The `customizer`
  30152. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30153. *
  30154. * **Note:** This method mutates `object`.
  30155. *
  30156. * @static
  30157. * @memberOf _
  30158. * @since 4.0.0
  30159. * @category Object
  30160. * @param {Object} object The destination object.
  30161. * @param {...Object} sources The source objects.
  30162. * @param {Function} [customizer] The function to customize assigned values.
  30163. * @returns {Object} Returns `object`.
  30164. * @see _.assignInWith
  30165. * @example
  30166. *
  30167. * function customizer(objValue, srcValue) {
  30168. * return _.isUndefined(objValue) ? srcValue : objValue;
  30169. * }
  30170. *
  30171. * var defaults = _.partialRight(_.assignWith, customizer);
  30172. *
  30173. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30174. * // => { 'a': 1, 'b': 2 }
  30175. */
  30176. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  30177. copyObject(source, keys(source), object, customizer);
  30178. });
  30179. /**
  30180. * Creates an array of values corresponding to `paths` of `object`.
  30181. *
  30182. * @static
  30183. * @memberOf _
  30184. * @since 1.0.0
  30185. * @category Object
  30186. * @param {Object} object The object to iterate over.
  30187. * @param {...(string|string[])} [paths] The property paths to pick.
  30188. * @returns {Array} Returns the picked values.
  30189. * @example
  30190. *
  30191. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  30192. *
  30193. * _.at(object, ['a[0].b.c', 'a[1]']);
  30194. * // => [3, 4]
  30195. */
  30196. var at = flatRest(baseAt);
  30197. /**
  30198. * Creates an object that inherits from the `prototype` object. If a
  30199. * `properties` object is given, its own enumerable string keyed properties
  30200. * are assigned to the created object.
  30201. *
  30202. * @static
  30203. * @memberOf _
  30204. * @since 2.3.0
  30205. * @category Object
  30206. * @param {Object} prototype The object to inherit from.
  30207. * @param {Object} [properties] The properties to assign to the object.
  30208. * @returns {Object} Returns the new object.
  30209. * @example
  30210. *
  30211. * function Shape() {
  30212. * this.x = 0;
  30213. * this.y = 0;
  30214. * }
  30215. *
  30216. * function Circle() {
  30217. * Shape.call(this);
  30218. * }
  30219. *
  30220. * Circle.prototype = _.create(Shape.prototype, {
  30221. * 'constructor': Circle
  30222. * });
  30223. *
  30224. * var circle = new Circle;
  30225. * circle instanceof Circle;
  30226. * // => true
  30227. *
  30228. * circle instanceof Shape;
  30229. * // => true
  30230. */
  30231. function create(prototype, properties) {
  30232. var result = baseCreate(prototype);
  30233. return properties == null ? result : baseAssign(result, properties);
  30234. }
  30235. /**
  30236. * Assigns own and inherited enumerable string keyed properties of source
  30237. * objects to the destination object for all destination properties that
  30238. * resolve to `undefined`. Source objects are applied from left to right.
  30239. * Once a property is set, additional values of the same property are ignored.
  30240. *
  30241. * **Note:** This method mutates `object`.
  30242. *
  30243. * @static
  30244. * @since 0.1.0
  30245. * @memberOf _
  30246. * @category Object
  30247. * @param {Object} object The destination object.
  30248. * @param {...Object} [sources] The source objects.
  30249. * @returns {Object} Returns `object`.
  30250. * @see _.defaultsDeep
  30251. * @example
  30252. *
  30253. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30254. * // => { 'a': 1, 'b': 2 }
  30255. */
  30256. var defaults = baseRest(function(object, sources) {
  30257. object = Object(object);
  30258. var index = -1;
  30259. var length = sources.length;
  30260. var guard = length > 2 ? sources[2] : undefined;
  30261. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  30262. length = 1;
  30263. }
  30264. while (++index < length) {
  30265. var source = sources[index];
  30266. var props = keysIn(source);
  30267. var propsIndex = -1;
  30268. var propsLength = props.length;
  30269. while (++propsIndex < propsLength) {
  30270. var key = props[propsIndex];
  30271. var value = object[key];
  30272. if (value === undefined ||
  30273. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  30274. object[key] = source[key];
  30275. }
  30276. }
  30277. }
  30278. return object;
  30279. });
  30280. /**
  30281. * This method is like `_.defaults` except that it recursively assigns
  30282. * default properties.
  30283. *
  30284. * **Note:** This method mutates `object`.
  30285. *
  30286. * @static
  30287. * @memberOf _
  30288. * @since 3.10.0
  30289. * @category Object
  30290. * @param {Object} object The destination object.
  30291. * @param {...Object} [sources] The source objects.
  30292. * @returns {Object} Returns `object`.
  30293. * @see _.defaults
  30294. * @example
  30295. *
  30296. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  30297. * // => { 'a': { 'b': 2, 'c': 3 } }
  30298. */
  30299. var defaultsDeep = baseRest(function(args) {
  30300. args.push(undefined, customDefaultsMerge);
  30301. return apply(mergeWith, undefined, args);
  30302. });
  30303. /**
  30304. * This method is like `_.find` except that it returns the key of the first
  30305. * element `predicate` returns truthy for instead of the element itself.
  30306. *
  30307. * @static
  30308. * @memberOf _
  30309. * @since 1.1.0
  30310. * @category Object
  30311. * @param {Object} object The object to inspect.
  30312. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30313. * @returns {string|undefined} Returns the key of the matched element,
  30314. * else `undefined`.
  30315. * @example
  30316. *
  30317. * var users = {
  30318. * 'barney': { 'age': 36, 'active': true },
  30319. * 'fred': { 'age': 40, 'active': false },
  30320. * 'pebbles': { 'age': 1, 'active': true }
  30321. * };
  30322. *
  30323. * _.findKey(users, function(o) { return o.age < 40; });
  30324. * // => 'barney' (iteration order is not guaranteed)
  30325. *
  30326. * // The `_.matches` iteratee shorthand.
  30327. * _.findKey(users, { 'age': 1, 'active': true });
  30328. * // => 'pebbles'
  30329. *
  30330. * // The `_.matchesProperty` iteratee shorthand.
  30331. * _.findKey(users, ['active', false]);
  30332. * // => 'fred'
  30333. *
  30334. * // The `_.property` iteratee shorthand.
  30335. * _.findKey(users, 'active');
  30336. * // => 'barney'
  30337. */
  30338. function findKey(object, predicate) {
  30339. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  30340. }
  30341. /**
  30342. * This method is like `_.findKey` except that it iterates over elements of
  30343. * a collection in the opposite order.
  30344. *
  30345. * @static
  30346. * @memberOf _
  30347. * @since 2.0.0
  30348. * @category Object
  30349. * @param {Object} object The object to inspect.
  30350. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30351. * @returns {string|undefined} Returns the key of the matched element,
  30352. * else `undefined`.
  30353. * @example
  30354. *
  30355. * var users = {
  30356. * 'barney': { 'age': 36, 'active': true },
  30357. * 'fred': { 'age': 40, 'active': false },
  30358. * 'pebbles': { 'age': 1, 'active': true }
  30359. * };
  30360. *
  30361. * _.findLastKey(users, function(o) { return o.age < 40; });
  30362. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  30363. *
  30364. * // The `_.matches` iteratee shorthand.
  30365. * _.findLastKey(users, { 'age': 36, 'active': true });
  30366. * // => 'barney'
  30367. *
  30368. * // The `_.matchesProperty` iteratee shorthand.
  30369. * _.findLastKey(users, ['active', false]);
  30370. * // => 'fred'
  30371. *
  30372. * // The `_.property` iteratee shorthand.
  30373. * _.findLastKey(users, 'active');
  30374. * // => 'pebbles'
  30375. */
  30376. function findLastKey(object, predicate) {
  30377. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  30378. }
  30379. /**
  30380. * Iterates over own and inherited enumerable string keyed properties of an
  30381. * object and invokes `iteratee` for each property. The iteratee is invoked
  30382. * with three arguments: (value, key, object). Iteratee functions may exit
  30383. * iteration early by explicitly returning `false`.
  30384. *
  30385. * @static
  30386. * @memberOf _
  30387. * @since 0.3.0
  30388. * @category Object
  30389. * @param {Object} object The object to iterate over.
  30390. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30391. * @returns {Object} Returns `object`.
  30392. * @see _.forInRight
  30393. * @example
  30394. *
  30395. * function Foo() {
  30396. * this.a = 1;
  30397. * this.b = 2;
  30398. * }
  30399. *
  30400. * Foo.prototype.c = 3;
  30401. *
  30402. * _.forIn(new Foo, function(value, key) {
  30403. * console.log(key);
  30404. * });
  30405. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  30406. */
  30407. function forIn(object, iteratee) {
  30408. return object == null
  30409. ? object
  30410. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  30411. }
  30412. /**
  30413. * This method is like `_.forIn` except that it iterates over properties of
  30414. * `object` in the opposite order.
  30415. *
  30416. * @static
  30417. * @memberOf _
  30418. * @since 2.0.0
  30419. * @category Object
  30420. * @param {Object} object The object to iterate over.
  30421. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30422. * @returns {Object} Returns `object`.
  30423. * @see _.forIn
  30424. * @example
  30425. *
  30426. * function Foo() {
  30427. * this.a = 1;
  30428. * this.b = 2;
  30429. * }
  30430. *
  30431. * Foo.prototype.c = 3;
  30432. *
  30433. * _.forInRight(new Foo, function(value, key) {
  30434. * console.log(key);
  30435. * });
  30436. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  30437. */
  30438. function forInRight(object, iteratee) {
  30439. return object == null
  30440. ? object
  30441. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  30442. }
  30443. /**
  30444. * Iterates over own enumerable string keyed properties of an object and
  30445. * invokes `iteratee` for each property. The iteratee is invoked with three
  30446. * arguments: (value, key, object). Iteratee functions may exit iteration
  30447. * early by explicitly returning `false`.
  30448. *
  30449. * @static
  30450. * @memberOf _
  30451. * @since 0.3.0
  30452. * @category Object
  30453. * @param {Object} object The object to iterate over.
  30454. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30455. * @returns {Object} Returns `object`.
  30456. * @see _.forOwnRight
  30457. * @example
  30458. *
  30459. * function Foo() {
  30460. * this.a = 1;
  30461. * this.b = 2;
  30462. * }
  30463. *
  30464. * Foo.prototype.c = 3;
  30465. *
  30466. * _.forOwn(new Foo, function(value, key) {
  30467. * console.log(key);
  30468. * });
  30469. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  30470. */
  30471. function forOwn(object, iteratee) {
  30472. return object && baseForOwn(object, getIteratee(iteratee, 3));
  30473. }
  30474. /**
  30475. * This method is like `_.forOwn` except that it iterates over properties of
  30476. * `object` in the opposite order.
  30477. *
  30478. * @static
  30479. * @memberOf _
  30480. * @since 2.0.0
  30481. * @category Object
  30482. * @param {Object} object The object to iterate over.
  30483. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30484. * @returns {Object} Returns `object`.
  30485. * @see _.forOwn
  30486. * @example
  30487. *
  30488. * function Foo() {
  30489. * this.a = 1;
  30490. * this.b = 2;
  30491. * }
  30492. *
  30493. * Foo.prototype.c = 3;
  30494. *
  30495. * _.forOwnRight(new Foo, function(value, key) {
  30496. * console.log(key);
  30497. * });
  30498. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  30499. */
  30500. function forOwnRight(object, iteratee) {
  30501. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  30502. }
  30503. /**
  30504. * Creates an array of function property names from own enumerable properties
  30505. * of `object`.
  30506. *
  30507. * @static
  30508. * @since 0.1.0
  30509. * @memberOf _
  30510. * @category Object
  30511. * @param {Object} object The object to inspect.
  30512. * @returns {Array} Returns the function names.
  30513. * @see _.functionsIn
  30514. * @example
  30515. *
  30516. * function Foo() {
  30517. * this.a = _.constant('a');
  30518. * this.b = _.constant('b');
  30519. * }
  30520. *
  30521. * Foo.prototype.c = _.constant('c');
  30522. *
  30523. * _.functions(new Foo);
  30524. * // => ['a', 'b']
  30525. */
  30526. function functions(object) {
  30527. return object == null ? [] : baseFunctions(object, keys(object));
  30528. }
  30529. /**
  30530. * Creates an array of function property names from own and inherited
  30531. * enumerable properties of `object`.
  30532. *
  30533. * @static
  30534. * @memberOf _
  30535. * @since 4.0.0
  30536. * @category Object
  30537. * @param {Object} object The object to inspect.
  30538. * @returns {Array} Returns the function names.
  30539. * @see _.functions
  30540. * @example
  30541. *
  30542. * function Foo() {
  30543. * this.a = _.constant('a');
  30544. * this.b = _.constant('b');
  30545. * }
  30546. *
  30547. * Foo.prototype.c = _.constant('c');
  30548. *
  30549. * _.functionsIn(new Foo);
  30550. * // => ['a', 'b', 'c']
  30551. */
  30552. function functionsIn(object) {
  30553. return object == null ? [] : baseFunctions(object, keysIn(object));
  30554. }
  30555. /**
  30556. * Gets the value at `path` of `object`. If the resolved value is
  30557. * `undefined`, the `defaultValue` is returned in its place.
  30558. *
  30559. * @static
  30560. * @memberOf _
  30561. * @since 3.7.0
  30562. * @category Object
  30563. * @param {Object} object The object to query.
  30564. * @param {Array|string} path The path of the property to get.
  30565. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30566. * @returns {*} Returns the resolved value.
  30567. * @example
  30568. *
  30569. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30570. *
  30571. * _.get(object, 'a[0].b.c');
  30572. * // => 3
  30573. *
  30574. * _.get(object, ['a', '0', 'b', 'c']);
  30575. * // => 3
  30576. *
  30577. * _.get(object, 'a.b.c', 'default');
  30578. * // => 'default'
  30579. */
  30580. function get(object, path, defaultValue) {
  30581. var result = object == null ? undefined : baseGet(object, path);
  30582. return result === undefined ? defaultValue : result;
  30583. }
  30584. /**
  30585. * Checks if `path` is a direct property of `object`.
  30586. *
  30587. * @static
  30588. * @since 0.1.0
  30589. * @memberOf _
  30590. * @category Object
  30591. * @param {Object} object The object to query.
  30592. * @param {Array|string} path The path to check.
  30593. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30594. * @example
  30595. *
  30596. * var object = { 'a': { 'b': 2 } };
  30597. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  30598. *
  30599. * _.has(object, 'a');
  30600. * // => true
  30601. *
  30602. * _.has(object, 'a.b');
  30603. * // => true
  30604. *
  30605. * _.has(object, ['a', 'b']);
  30606. * // => true
  30607. *
  30608. * _.has(other, 'a');
  30609. * // => false
  30610. */
  30611. function has(object, path) {
  30612. return object != null && hasPath(object, path, baseHas);
  30613. }
  30614. /**
  30615. * Checks if `path` is a direct or inherited property of `object`.
  30616. *
  30617. * @static
  30618. * @memberOf _
  30619. * @since 4.0.0
  30620. * @category Object
  30621. * @param {Object} object The object to query.
  30622. * @param {Array|string} path The path to check.
  30623. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30624. * @example
  30625. *
  30626. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  30627. *
  30628. * _.hasIn(object, 'a');
  30629. * // => true
  30630. *
  30631. * _.hasIn(object, 'a.b');
  30632. * // => true
  30633. *
  30634. * _.hasIn(object, ['a', 'b']);
  30635. * // => true
  30636. *
  30637. * _.hasIn(object, 'b');
  30638. * // => false
  30639. */
  30640. function hasIn(object, path) {
  30641. return object != null && hasPath(object, path, baseHasIn);
  30642. }
  30643. /**
  30644. * Creates an object composed of the inverted keys and values of `object`.
  30645. * If `object` contains duplicate values, subsequent values overwrite
  30646. * property assignments of previous values.
  30647. *
  30648. * @static
  30649. * @memberOf _
  30650. * @since 0.7.0
  30651. * @category Object
  30652. * @param {Object} object The object to invert.
  30653. * @returns {Object} Returns the new inverted object.
  30654. * @example
  30655. *
  30656. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30657. *
  30658. * _.invert(object);
  30659. * // => { '1': 'c', '2': 'b' }
  30660. */
  30661. var invert = createInverter(function(result, value, key) {
  30662. if (value != null &&
  30663. typeof value.toString != 'function') {
  30664. value = nativeObjectToString.call(value);
  30665. }
  30666. result[value] = key;
  30667. }, constant(identity));
  30668. /**
  30669. * This method is like `_.invert` except that the inverted object is generated
  30670. * from the results of running each element of `object` thru `iteratee`. The
  30671. * corresponding inverted value of each inverted key is an array of keys
  30672. * responsible for generating the inverted value. The iteratee is invoked
  30673. * with one argument: (value).
  30674. *
  30675. * @static
  30676. * @memberOf _
  30677. * @since 4.1.0
  30678. * @category Object
  30679. * @param {Object} object The object to invert.
  30680. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  30681. * @returns {Object} Returns the new inverted object.
  30682. * @example
  30683. *
  30684. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30685. *
  30686. * _.invertBy(object);
  30687. * // => { '1': ['a', 'c'], '2': ['b'] }
  30688. *
  30689. * _.invertBy(object, function(value) {
  30690. * return 'group' + value;
  30691. * });
  30692. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  30693. */
  30694. var invertBy = createInverter(function(result, value, key) {
  30695. if (value != null &&
  30696. typeof value.toString != 'function') {
  30697. value = nativeObjectToString.call(value);
  30698. }
  30699. if (hasOwnProperty.call(result, value)) {
  30700. result[value].push(key);
  30701. } else {
  30702. result[value] = [key];
  30703. }
  30704. }, getIteratee);
  30705. /**
  30706. * Invokes the method at `path` of `object`.
  30707. *
  30708. * @static
  30709. * @memberOf _
  30710. * @since 4.0.0
  30711. * @category Object
  30712. * @param {Object} object The object to query.
  30713. * @param {Array|string} path The path of the method to invoke.
  30714. * @param {...*} [args] The arguments to invoke the method with.
  30715. * @returns {*} Returns the result of the invoked method.
  30716. * @example
  30717. *
  30718. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  30719. *
  30720. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  30721. * // => [2, 3]
  30722. */
  30723. var invoke = baseRest(baseInvoke);
  30724. /**
  30725. * Creates an array of the own enumerable property names of `object`.
  30726. *
  30727. * **Note:** Non-object values are coerced to objects. See the
  30728. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  30729. * for more details.
  30730. *
  30731. * @static
  30732. * @since 0.1.0
  30733. * @memberOf _
  30734. * @category Object
  30735. * @param {Object} object The object to query.
  30736. * @returns {Array} Returns the array of property names.
  30737. * @example
  30738. *
  30739. * function Foo() {
  30740. * this.a = 1;
  30741. * this.b = 2;
  30742. * }
  30743. *
  30744. * Foo.prototype.c = 3;
  30745. *
  30746. * _.keys(new Foo);
  30747. * // => ['a', 'b'] (iteration order is not guaranteed)
  30748. *
  30749. * _.keys('hi');
  30750. * // => ['0', '1']
  30751. */
  30752. function keys(object) {
  30753. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  30754. }
  30755. /**
  30756. * Creates an array of the own and inherited enumerable property names of `object`.
  30757. *
  30758. * **Note:** Non-object values are coerced to objects.
  30759. *
  30760. * @static
  30761. * @memberOf _
  30762. * @since 3.0.0
  30763. * @category Object
  30764. * @param {Object} object The object to query.
  30765. * @returns {Array} Returns the array of property names.
  30766. * @example
  30767. *
  30768. * function Foo() {
  30769. * this.a = 1;
  30770. * this.b = 2;
  30771. * }
  30772. *
  30773. * Foo.prototype.c = 3;
  30774. *
  30775. * _.keysIn(new Foo);
  30776. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  30777. */
  30778. function keysIn(object) {
  30779. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  30780. }
  30781. /**
  30782. * The opposite of `_.mapValues`; this method creates an object with the
  30783. * same values as `object` and keys generated by running each own enumerable
  30784. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  30785. * with three arguments: (value, key, object).
  30786. *
  30787. * @static
  30788. * @memberOf _
  30789. * @since 3.8.0
  30790. * @category Object
  30791. * @param {Object} object The object to iterate over.
  30792. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30793. * @returns {Object} Returns the new mapped object.
  30794. * @see _.mapValues
  30795. * @example
  30796. *
  30797. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  30798. * return key + value;
  30799. * });
  30800. * // => { 'a1': 1, 'b2': 2 }
  30801. */
  30802. function mapKeys(object, iteratee) {
  30803. var result = {};
  30804. iteratee = getIteratee(iteratee, 3);
  30805. baseForOwn(object, function(value, key, object) {
  30806. baseAssignValue(result, iteratee(value, key, object), value);
  30807. });
  30808. return result;
  30809. }
  30810. /**
  30811. * Creates an object with the same keys as `object` and values generated
  30812. * by running each own enumerable string keyed property of `object` thru
  30813. * `iteratee`. The iteratee is invoked with three arguments:
  30814. * (value, key, object).
  30815. *
  30816. * @static
  30817. * @memberOf _
  30818. * @since 2.4.0
  30819. * @category Object
  30820. * @param {Object} object The object to iterate over.
  30821. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30822. * @returns {Object} Returns the new mapped object.
  30823. * @see _.mapKeys
  30824. * @example
  30825. *
  30826. * var users = {
  30827. * 'fred': { 'user': 'fred', 'age': 40 },
  30828. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  30829. * };
  30830. *
  30831. * _.mapValues(users, function(o) { return o.age; });
  30832. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30833. *
  30834. * // The `_.property` iteratee shorthand.
  30835. * _.mapValues(users, 'age');
  30836. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30837. */
  30838. function mapValues(object, iteratee) {
  30839. var result = {};
  30840. iteratee = getIteratee(iteratee, 3);
  30841. baseForOwn(object, function(value, key, object) {
  30842. baseAssignValue(result, key, iteratee(value, key, object));
  30843. });
  30844. return result;
  30845. }
  30846. /**
  30847. * This method is like `_.assign` except that it recursively merges own and
  30848. * inherited enumerable string keyed properties of source objects into the
  30849. * destination object. Source properties that resolve to `undefined` are
  30850. * skipped if a destination value exists. Array and plain object properties
  30851. * are merged recursively. Other objects and value types are overridden by
  30852. * assignment. Source objects are applied from left to right. Subsequent
  30853. * sources overwrite property assignments of previous sources.
  30854. *
  30855. * **Note:** This method mutates `object`.
  30856. *
  30857. * @static
  30858. * @memberOf _
  30859. * @since 0.5.0
  30860. * @category Object
  30861. * @param {Object} object The destination object.
  30862. * @param {...Object} [sources] The source objects.
  30863. * @returns {Object} Returns `object`.
  30864. * @example
  30865. *
  30866. * var object = {
  30867. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  30868. * };
  30869. *
  30870. * var other = {
  30871. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  30872. * };
  30873. *
  30874. * _.merge(object, other);
  30875. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  30876. */
  30877. var merge = createAssigner(function(object, source, srcIndex) {
  30878. baseMerge(object, source, srcIndex);
  30879. });
  30880. /**
  30881. * This method is like `_.merge` except that it accepts `customizer` which
  30882. * is invoked to produce the merged values of the destination and source
  30883. * properties. If `customizer` returns `undefined`, merging is handled by the
  30884. * method instead. The `customizer` is invoked with six arguments:
  30885. * (objValue, srcValue, key, object, source, stack).
  30886. *
  30887. * **Note:** This method mutates `object`.
  30888. *
  30889. * @static
  30890. * @memberOf _
  30891. * @since 4.0.0
  30892. * @category Object
  30893. * @param {Object} object The destination object.
  30894. * @param {...Object} sources The source objects.
  30895. * @param {Function} customizer The function to customize assigned values.
  30896. * @returns {Object} Returns `object`.
  30897. * @example
  30898. *
  30899. * function customizer(objValue, srcValue) {
  30900. * if (_.isArray(objValue)) {
  30901. * return objValue.concat(srcValue);
  30902. * }
  30903. * }
  30904. *
  30905. * var object = { 'a': [1], 'b': [2] };
  30906. * var other = { 'a': [3], 'b': [4] };
  30907. *
  30908. * _.mergeWith(object, other, customizer);
  30909. * // => { 'a': [1, 3], 'b': [2, 4] }
  30910. */
  30911. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  30912. baseMerge(object, source, srcIndex, customizer);
  30913. });
  30914. /**
  30915. * The opposite of `_.pick`; this method creates an object composed of the
  30916. * own and inherited enumerable property paths of `object` that are not omitted.
  30917. *
  30918. * **Note:** This method is considerably slower than `_.pick`.
  30919. *
  30920. * @static
  30921. * @since 0.1.0
  30922. * @memberOf _
  30923. * @category Object
  30924. * @param {Object} object The source object.
  30925. * @param {...(string|string[])} [paths] The property paths to omit.
  30926. * @returns {Object} Returns the new object.
  30927. * @example
  30928. *
  30929. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30930. *
  30931. * _.omit(object, ['a', 'c']);
  30932. * // => { 'b': '2' }
  30933. */
  30934. var omit = flatRest(function(object, paths) {
  30935. var result = {};
  30936. if (object == null) {
  30937. return result;
  30938. }
  30939. var isDeep = false;
  30940. paths = arrayMap(paths, function(path) {
  30941. path = castPath(path, object);
  30942. isDeep || (isDeep = path.length > 1);
  30943. return path;
  30944. });
  30945. copyObject(object, getAllKeysIn(object), result);
  30946. if (isDeep) {
  30947. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  30948. }
  30949. var length = paths.length;
  30950. while (length--) {
  30951. baseUnset(result, paths[length]);
  30952. }
  30953. return result;
  30954. });
  30955. /**
  30956. * The opposite of `_.pickBy`; this method creates an object composed of
  30957. * the own and inherited enumerable string keyed properties of `object` that
  30958. * `predicate` doesn't return truthy for. The predicate is invoked with two
  30959. * arguments: (value, key).
  30960. *
  30961. * @static
  30962. * @memberOf _
  30963. * @since 4.0.0
  30964. * @category Object
  30965. * @param {Object} object The source object.
  30966. * @param {Function} [predicate=_.identity] The function invoked per property.
  30967. * @returns {Object} Returns the new object.
  30968. * @example
  30969. *
  30970. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30971. *
  30972. * _.omitBy(object, _.isNumber);
  30973. * // => { 'b': '2' }
  30974. */
  30975. function omitBy(object, predicate) {
  30976. return pickBy(object, negate(getIteratee(predicate)));
  30977. }
  30978. /**
  30979. * Creates an object composed of the picked `object` properties.
  30980. *
  30981. * @static
  30982. * @since 0.1.0
  30983. * @memberOf _
  30984. * @category Object
  30985. * @param {Object} object The source object.
  30986. * @param {...(string|string[])} [paths] The property paths to pick.
  30987. * @returns {Object} Returns the new object.
  30988. * @example
  30989. *
  30990. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30991. *
  30992. * _.pick(object, ['a', 'c']);
  30993. * // => { 'a': 1, 'c': 3 }
  30994. */
  30995. var pick = flatRest(function(object, paths) {
  30996. return object == null ? {} : basePick(object, paths);
  30997. });
  30998. /**
  30999. * Creates an object composed of the `object` properties `predicate` returns
  31000. * truthy for. The predicate is invoked with two arguments: (value, key).
  31001. *
  31002. * @static
  31003. * @memberOf _
  31004. * @since 4.0.0
  31005. * @category Object
  31006. * @param {Object} object The source object.
  31007. * @param {Function} [predicate=_.identity] The function invoked per property.
  31008. * @returns {Object} Returns the new object.
  31009. * @example
  31010. *
  31011. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31012. *
  31013. * _.pickBy(object, _.isNumber);
  31014. * // => { 'a': 1, 'c': 3 }
  31015. */
  31016. function pickBy(object, predicate) {
  31017. if (object == null) {
  31018. return {};
  31019. }
  31020. var props = arrayMap(getAllKeysIn(object), function(prop) {
  31021. return [prop];
  31022. });
  31023. predicate = getIteratee(predicate);
  31024. return basePickBy(object, props, function(value, path) {
  31025. return predicate(value, path[0]);
  31026. });
  31027. }
  31028. /**
  31029. * This method is like `_.get` except that if the resolved value is a
  31030. * function it's invoked with the `this` binding of its parent object and
  31031. * its result is returned.
  31032. *
  31033. * @static
  31034. * @since 0.1.0
  31035. * @memberOf _
  31036. * @category Object
  31037. * @param {Object} object The object to query.
  31038. * @param {Array|string} path The path of the property to resolve.
  31039. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31040. * @returns {*} Returns the resolved value.
  31041. * @example
  31042. *
  31043. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  31044. *
  31045. * _.result(object, 'a[0].b.c1');
  31046. * // => 3
  31047. *
  31048. * _.result(object, 'a[0].b.c2');
  31049. * // => 4
  31050. *
  31051. * _.result(object, 'a[0].b.c3', 'default');
  31052. * // => 'default'
  31053. *
  31054. * _.result(object, 'a[0].b.c3', _.constant('default'));
  31055. * // => 'default'
  31056. */
  31057. function result(object, path, defaultValue) {
  31058. path = castPath(path, object);
  31059. var index = -1,
  31060. length = path.length;
  31061. // Ensure the loop is entered when path is empty.
  31062. if (!length) {
  31063. length = 1;
  31064. object = undefined;
  31065. }
  31066. while (++index < length) {
  31067. var value = object == null ? undefined : object[toKey(path[index])];
  31068. if (value === undefined) {
  31069. index = length;
  31070. value = defaultValue;
  31071. }
  31072. object = isFunction(value) ? value.call(object) : value;
  31073. }
  31074. return object;
  31075. }
  31076. /**
  31077. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  31078. * it's created. Arrays are created for missing index properties while objects
  31079. * are created for all other missing properties. Use `_.setWith` to customize
  31080. * `path` creation.
  31081. *
  31082. * **Note:** This method mutates `object`.
  31083. *
  31084. * @static
  31085. * @memberOf _
  31086. * @since 3.7.0
  31087. * @category Object
  31088. * @param {Object} object The object to modify.
  31089. * @param {Array|string} path The path of the property to set.
  31090. * @param {*} value The value to set.
  31091. * @returns {Object} Returns `object`.
  31092. * @example
  31093. *
  31094. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31095. *
  31096. * _.set(object, 'a[0].b.c', 4);
  31097. * console.log(object.a[0].b.c);
  31098. * // => 4
  31099. *
  31100. * _.set(object, ['x', '0', 'y', 'z'], 5);
  31101. * console.log(object.x[0].y.z);
  31102. * // => 5
  31103. */
  31104. function set(object, path, value) {
  31105. return object == null ? object : baseSet(object, path, value);
  31106. }
  31107. /**
  31108. * This method is like `_.set` except that it accepts `customizer` which is
  31109. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31110. * path creation is handled by the method instead. The `customizer` is invoked
  31111. * with three arguments: (nsValue, key, nsObject).
  31112. *
  31113. * **Note:** This method mutates `object`.
  31114. *
  31115. * @static
  31116. * @memberOf _
  31117. * @since 4.0.0
  31118. * @category Object
  31119. * @param {Object} object The object to modify.
  31120. * @param {Array|string} path The path of the property to set.
  31121. * @param {*} value The value to set.
  31122. * @param {Function} [customizer] The function to customize assigned values.
  31123. * @returns {Object} Returns `object`.
  31124. * @example
  31125. *
  31126. * var object = {};
  31127. *
  31128. * _.setWith(object, '[0][1]', 'a', Object);
  31129. * // => { '0': { '1': 'a' } }
  31130. */
  31131. function setWith(object, path, value, customizer) {
  31132. customizer = typeof customizer == 'function' ? customizer : undefined;
  31133. return object == null ? object : baseSet(object, path, value, customizer);
  31134. }
  31135. /**
  31136. * Creates an array of own enumerable string keyed-value pairs for `object`
  31137. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  31138. * entries are returned.
  31139. *
  31140. * @static
  31141. * @memberOf _
  31142. * @since 4.0.0
  31143. * @alias entries
  31144. * @category Object
  31145. * @param {Object} object The object to query.
  31146. * @returns {Array} Returns the key-value pairs.
  31147. * @example
  31148. *
  31149. * function Foo() {
  31150. * this.a = 1;
  31151. * this.b = 2;
  31152. * }
  31153. *
  31154. * Foo.prototype.c = 3;
  31155. *
  31156. * _.toPairs(new Foo);
  31157. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  31158. */
  31159. var toPairs = createToPairs(keys);
  31160. /**
  31161. * Creates an array of own and inherited enumerable string keyed-value pairs
  31162. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  31163. * or set, its entries are returned.
  31164. *
  31165. * @static
  31166. * @memberOf _
  31167. * @since 4.0.0
  31168. * @alias entriesIn
  31169. * @category Object
  31170. * @param {Object} object The object to query.
  31171. * @returns {Array} Returns the key-value pairs.
  31172. * @example
  31173. *
  31174. * function Foo() {
  31175. * this.a = 1;
  31176. * this.b = 2;
  31177. * }
  31178. *
  31179. * Foo.prototype.c = 3;
  31180. *
  31181. * _.toPairsIn(new Foo);
  31182. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  31183. */
  31184. var toPairsIn = createToPairs(keysIn);
  31185. /**
  31186. * An alternative to `_.reduce`; this method transforms `object` to a new
  31187. * `accumulator` object which is the result of running each of its own
  31188. * enumerable string keyed properties thru `iteratee`, with each invocation
  31189. * potentially mutating the `accumulator` object. If `accumulator` is not
  31190. * provided, a new object with the same `[[Prototype]]` will be used. The
  31191. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  31192. * Iteratee functions may exit iteration early by explicitly returning `false`.
  31193. *
  31194. * @static
  31195. * @memberOf _
  31196. * @since 1.3.0
  31197. * @category Object
  31198. * @param {Object} object The object to iterate over.
  31199. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31200. * @param {*} [accumulator] The custom accumulator value.
  31201. * @returns {*} Returns the accumulated value.
  31202. * @example
  31203. *
  31204. * _.transform([2, 3, 4], function(result, n) {
  31205. * result.push(n *= n);
  31206. * return n % 2 == 0;
  31207. * }, []);
  31208. * // => [4, 9]
  31209. *
  31210. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  31211. * (result[value] || (result[value] = [])).push(key);
  31212. * }, {});
  31213. * // => { '1': ['a', 'c'], '2': ['b'] }
  31214. */
  31215. function transform(object, iteratee, accumulator) {
  31216. var isArr = isArray(object),
  31217. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  31218. iteratee = getIteratee(iteratee, 4);
  31219. if (accumulator == null) {
  31220. var Ctor = object && object.constructor;
  31221. if (isArrLike) {
  31222. accumulator = isArr ? new Ctor : [];
  31223. }
  31224. else if (isObject(object)) {
  31225. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  31226. }
  31227. else {
  31228. accumulator = {};
  31229. }
  31230. }
  31231. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  31232. return iteratee(accumulator, value, index, object);
  31233. });
  31234. return accumulator;
  31235. }
  31236. /**
  31237. * Removes the property at `path` of `object`.
  31238. *
  31239. * **Note:** This method mutates `object`.
  31240. *
  31241. * @static
  31242. * @memberOf _
  31243. * @since 4.0.0
  31244. * @category Object
  31245. * @param {Object} object The object to modify.
  31246. * @param {Array|string} path The path of the property to unset.
  31247. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  31248. * @example
  31249. *
  31250. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  31251. * _.unset(object, 'a[0].b.c');
  31252. * // => true
  31253. *
  31254. * console.log(object);
  31255. * // => { 'a': [{ 'b': {} }] };
  31256. *
  31257. * _.unset(object, ['a', '0', 'b', 'c']);
  31258. * // => true
  31259. *
  31260. * console.log(object);
  31261. * // => { 'a': [{ 'b': {} }] };
  31262. */
  31263. function unset(object, path) {
  31264. return object == null ? true : baseUnset(object, path);
  31265. }
  31266. /**
  31267. * This method is like `_.set` except that accepts `updater` to produce the
  31268. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  31269. * is invoked with one argument: (value).
  31270. *
  31271. * **Note:** This method mutates `object`.
  31272. *
  31273. * @static
  31274. * @memberOf _
  31275. * @since 4.6.0
  31276. * @category Object
  31277. * @param {Object} object The object to modify.
  31278. * @param {Array|string} path The path of the property to set.
  31279. * @param {Function} updater The function to produce the updated value.
  31280. * @returns {Object} Returns `object`.
  31281. * @example
  31282. *
  31283. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31284. *
  31285. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  31286. * console.log(object.a[0].b.c);
  31287. * // => 9
  31288. *
  31289. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  31290. * console.log(object.x[0].y.z);
  31291. * // => 0
  31292. */
  31293. function update(object, path, updater) {
  31294. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  31295. }
  31296. /**
  31297. * This method is like `_.update` except that it accepts `customizer` which is
  31298. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31299. * path creation is handled by the method instead. The `customizer` is invoked
  31300. * with three arguments: (nsValue, key, nsObject).
  31301. *
  31302. * **Note:** This method mutates `object`.
  31303. *
  31304. * @static
  31305. * @memberOf _
  31306. * @since 4.6.0
  31307. * @category Object
  31308. * @param {Object} object The object to modify.
  31309. * @param {Array|string} path The path of the property to set.
  31310. * @param {Function} updater The function to produce the updated value.
  31311. * @param {Function} [customizer] The function to customize assigned values.
  31312. * @returns {Object} Returns `object`.
  31313. * @example
  31314. *
  31315. * var object = {};
  31316. *
  31317. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  31318. * // => { '0': { '1': 'a' } }
  31319. */
  31320. function updateWith(object, path, updater, customizer) {
  31321. customizer = typeof customizer == 'function' ? customizer : undefined;
  31322. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  31323. }
  31324. /**
  31325. * Creates an array of the own enumerable string keyed property values of `object`.
  31326. *
  31327. * **Note:** Non-object values are coerced to objects.
  31328. *
  31329. * @static
  31330. * @since 0.1.0
  31331. * @memberOf _
  31332. * @category Object
  31333. * @param {Object} object The object to query.
  31334. * @returns {Array} Returns the array of property values.
  31335. * @example
  31336. *
  31337. * function Foo() {
  31338. * this.a = 1;
  31339. * this.b = 2;
  31340. * }
  31341. *
  31342. * Foo.prototype.c = 3;
  31343. *
  31344. * _.values(new Foo);
  31345. * // => [1, 2] (iteration order is not guaranteed)
  31346. *
  31347. * _.values('hi');
  31348. * // => ['h', 'i']
  31349. */
  31350. function values(object) {
  31351. return object == null ? [] : baseValues(object, keys(object));
  31352. }
  31353. /**
  31354. * Creates an array of the own and inherited enumerable string keyed property
  31355. * values of `object`.
  31356. *
  31357. * **Note:** Non-object values are coerced to objects.
  31358. *
  31359. * @static
  31360. * @memberOf _
  31361. * @since 3.0.0
  31362. * @category Object
  31363. * @param {Object} object The object to query.
  31364. * @returns {Array} Returns the array of property values.
  31365. * @example
  31366. *
  31367. * function Foo() {
  31368. * this.a = 1;
  31369. * this.b = 2;
  31370. * }
  31371. *
  31372. * Foo.prototype.c = 3;
  31373. *
  31374. * _.valuesIn(new Foo);
  31375. * // => [1, 2, 3] (iteration order is not guaranteed)
  31376. */
  31377. function valuesIn(object) {
  31378. return object == null ? [] : baseValues(object, keysIn(object));
  31379. }
  31380. /*------------------------------------------------------------------------*/
  31381. /**
  31382. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  31383. *
  31384. * @static
  31385. * @memberOf _
  31386. * @since 4.0.0
  31387. * @category Number
  31388. * @param {number} number The number to clamp.
  31389. * @param {number} [lower] The lower bound.
  31390. * @param {number} upper The upper bound.
  31391. * @returns {number} Returns the clamped number.
  31392. * @example
  31393. *
  31394. * _.clamp(-10, -5, 5);
  31395. * // => -5
  31396. *
  31397. * _.clamp(10, -5, 5);
  31398. * // => 5
  31399. */
  31400. function clamp(number, lower, upper) {
  31401. if (upper === undefined) {
  31402. upper = lower;
  31403. lower = undefined;
  31404. }
  31405. if (upper !== undefined) {
  31406. upper = toNumber(upper);
  31407. upper = upper === upper ? upper : 0;
  31408. }
  31409. if (lower !== undefined) {
  31410. lower = toNumber(lower);
  31411. lower = lower === lower ? lower : 0;
  31412. }
  31413. return baseClamp(toNumber(number), lower, upper);
  31414. }
  31415. /**
  31416. * Checks if `n` is between `start` and up to, but not including, `end`. If
  31417. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  31418. * If `start` is greater than `end` the params are swapped to support
  31419. * negative ranges.
  31420. *
  31421. * @static
  31422. * @memberOf _
  31423. * @since 3.3.0
  31424. * @category Number
  31425. * @param {number} number The number to check.
  31426. * @param {number} [start=0] The start of the range.
  31427. * @param {number} end The end of the range.
  31428. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  31429. * @see _.range, _.rangeRight
  31430. * @example
  31431. *
  31432. * _.inRange(3, 2, 4);
  31433. * // => true
  31434. *
  31435. * _.inRange(4, 8);
  31436. * // => true
  31437. *
  31438. * _.inRange(4, 2);
  31439. * // => false
  31440. *
  31441. * _.inRange(2, 2);
  31442. * // => false
  31443. *
  31444. * _.inRange(1.2, 2);
  31445. * // => true
  31446. *
  31447. * _.inRange(5.2, 4);
  31448. * // => false
  31449. *
  31450. * _.inRange(-3, -2, -6);
  31451. * // => true
  31452. */
  31453. function inRange(number, start, end) {
  31454. start = toFinite(start);
  31455. if (end === undefined) {
  31456. end = start;
  31457. start = 0;
  31458. } else {
  31459. end = toFinite(end);
  31460. }
  31461. number = toNumber(number);
  31462. return baseInRange(number, start, end);
  31463. }
  31464. /**
  31465. * Produces a random number between the inclusive `lower` and `upper` bounds.
  31466. * If only one argument is provided a number between `0` and the given number
  31467. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  31468. * floats, a floating-point number is returned instead of an integer.
  31469. *
  31470. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  31471. * floating-point values which can produce unexpected results.
  31472. *
  31473. * @static
  31474. * @memberOf _
  31475. * @since 0.7.0
  31476. * @category Number
  31477. * @param {number} [lower=0] The lower bound.
  31478. * @param {number} [upper=1] The upper bound.
  31479. * @param {boolean} [floating] Specify returning a floating-point number.
  31480. * @returns {number} Returns the random number.
  31481. * @example
  31482. *
  31483. * _.random(0, 5);
  31484. * // => an integer between 0 and 5
  31485. *
  31486. * _.random(5);
  31487. * // => also an integer between 0 and 5
  31488. *
  31489. * _.random(5, true);
  31490. * // => a floating-point number between 0 and 5
  31491. *
  31492. * _.random(1.2, 5.2);
  31493. * // => a floating-point number between 1.2 and 5.2
  31494. */
  31495. function random(lower, upper, floating) {
  31496. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  31497. upper = floating = undefined;
  31498. }
  31499. if (floating === undefined) {
  31500. if (typeof upper == 'boolean') {
  31501. floating = upper;
  31502. upper = undefined;
  31503. }
  31504. else if (typeof lower == 'boolean') {
  31505. floating = lower;
  31506. lower = undefined;
  31507. }
  31508. }
  31509. if (lower === undefined && upper === undefined) {
  31510. lower = 0;
  31511. upper = 1;
  31512. }
  31513. else {
  31514. lower = toFinite(lower);
  31515. if (upper === undefined) {
  31516. upper = lower;
  31517. lower = 0;
  31518. } else {
  31519. upper = toFinite(upper);
  31520. }
  31521. }
  31522. if (lower > upper) {
  31523. var temp = lower;
  31524. lower = upper;
  31525. upper = temp;
  31526. }
  31527. if (floating || lower % 1 || upper % 1) {
  31528. var rand = nativeRandom();
  31529. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  31530. }
  31531. return baseRandom(lower, upper);
  31532. }
  31533. /*------------------------------------------------------------------------*/
  31534. /**
  31535. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  31536. *
  31537. * @static
  31538. * @memberOf _
  31539. * @since 3.0.0
  31540. * @category String
  31541. * @param {string} [string=''] The string to convert.
  31542. * @returns {string} Returns the camel cased string.
  31543. * @example
  31544. *
  31545. * _.camelCase('Foo Bar');
  31546. * // => 'fooBar'
  31547. *
  31548. * _.camelCase('--foo-bar--');
  31549. * // => 'fooBar'
  31550. *
  31551. * _.camelCase('__FOO_BAR__');
  31552. * // => 'fooBar'
  31553. */
  31554. var camelCase = createCompounder(function(result, word, index) {
  31555. word = word.toLowerCase();
  31556. return result + (index ? capitalize(word) : word);
  31557. });
  31558. /**
  31559. * Converts the first character of `string` to upper case and the remaining
  31560. * to lower case.
  31561. *
  31562. * @static
  31563. * @memberOf _
  31564. * @since 3.0.0
  31565. * @category String
  31566. * @param {string} [string=''] The string to capitalize.
  31567. * @returns {string} Returns the capitalized string.
  31568. * @example
  31569. *
  31570. * _.capitalize('FRED');
  31571. * // => 'Fred'
  31572. */
  31573. function capitalize(string) {
  31574. return upperFirst(toString(string).toLowerCase());
  31575. }
  31576. /**
  31577. * Deburrs `string` by converting
  31578. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  31579. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  31580. * letters to basic Latin letters and removing
  31581. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  31582. *
  31583. * @static
  31584. * @memberOf _
  31585. * @since 3.0.0
  31586. * @category String
  31587. * @param {string} [string=''] The string to deburr.
  31588. * @returns {string} Returns the deburred string.
  31589. * @example
  31590. *
  31591. * _.deburr('déjà vu');
  31592. * // => 'deja vu'
  31593. */
  31594. function deburr(string) {
  31595. string = toString(string);
  31596. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  31597. }
  31598. /**
  31599. * Checks if `string` ends with the given target string.
  31600. *
  31601. * @static
  31602. * @memberOf _
  31603. * @since 3.0.0
  31604. * @category String
  31605. * @param {string} [string=''] The string to inspect.
  31606. * @param {string} [target] The string to search for.
  31607. * @param {number} [position=string.length] The position to search up to.
  31608. * @returns {boolean} Returns `true` if `string` ends with `target`,
  31609. * else `false`.
  31610. * @example
  31611. *
  31612. * _.endsWith('abc', 'c');
  31613. * // => true
  31614. *
  31615. * _.endsWith('abc', 'b');
  31616. * // => false
  31617. *
  31618. * _.endsWith('abc', 'b', 2);
  31619. * // => true
  31620. */
  31621. function endsWith(string, target, position) {
  31622. string = toString(string);
  31623. target = baseToString(target);
  31624. var length = string.length;
  31625. position = position === undefined
  31626. ? length
  31627. : baseClamp(toInteger(position), 0, length);
  31628. var end = position;
  31629. position -= target.length;
  31630. return position >= 0 && string.slice(position, end) == target;
  31631. }
  31632. /**
  31633. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  31634. * corresponding HTML entities.
  31635. *
  31636. * **Note:** No other characters are escaped. To escape additional
  31637. * characters use a third-party library like [_he_](https://mths.be/he).
  31638. *
  31639. * Though the ">" character is escaped for symmetry, characters like
  31640. * ">" and "/" don't need escaping in HTML and have no special meaning
  31641. * unless they're part of a tag or unquoted attribute value. See
  31642. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  31643. * (under "semi-related fun fact") for more details.
  31644. *
  31645. * When working with HTML you should always
  31646. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  31647. * XSS vectors.
  31648. *
  31649. * @static
  31650. * @since 0.1.0
  31651. * @memberOf _
  31652. * @category String
  31653. * @param {string} [string=''] The string to escape.
  31654. * @returns {string} Returns the escaped string.
  31655. * @example
  31656. *
  31657. * _.escape('fred, barney, & pebbles');
  31658. * // => 'fred, barney, &amp; pebbles'
  31659. */
  31660. function escape(string) {
  31661. string = toString(string);
  31662. return (string && reHasUnescapedHtml.test(string))
  31663. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  31664. : string;
  31665. }
  31666. /**
  31667. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  31668. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  31669. *
  31670. * @static
  31671. * @memberOf _
  31672. * @since 3.0.0
  31673. * @category String
  31674. * @param {string} [string=''] The string to escape.
  31675. * @returns {string} Returns the escaped string.
  31676. * @example
  31677. *
  31678. * _.escapeRegExp('[lodash](https://lodash.com/)');
  31679. * // => '\[lodash\]\(https://lodash\.com/\)'
  31680. */
  31681. function escapeRegExp(string) {
  31682. string = toString(string);
  31683. return (string && reHasRegExpChar.test(string))
  31684. ? string.replace(reRegExpChar, '\\$&')
  31685. : string;
  31686. }
  31687. /**
  31688. * Converts `string` to
  31689. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  31690. *
  31691. * @static
  31692. * @memberOf _
  31693. * @since 3.0.0
  31694. * @category String
  31695. * @param {string} [string=''] The string to convert.
  31696. * @returns {string} Returns the kebab cased string.
  31697. * @example
  31698. *
  31699. * _.kebabCase('Foo Bar');
  31700. * // => 'foo-bar'
  31701. *
  31702. * _.kebabCase('fooBar');
  31703. * // => 'foo-bar'
  31704. *
  31705. * _.kebabCase('__FOO_BAR__');
  31706. * // => 'foo-bar'
  31707. */
  31708. var kebabCase = createCompounder(function(result, word, index) {
  31709. return result + (index ? '-' : '') + word.toLowerCase();
  31710. });
  31711. /**
  31712. * Converts `string`, as space separated words, to lower case.
  31713. *
  31714. * @static
  31715. * @memberOf _
  31716. * @since 4.0.0
  31717. * @category String
  31718. * @param {string} [string=''] The string to convert.
  31719. * @returns {string} Returns the lower cased string.
  31720. * @example
  31721. *
  31722. * _.lowerCase('--Foo-Bar--');
  31723. * // => 'foo bar'
  31724. *
  31725. * _.lowerCase('fooBar');
  31726. * // => 'foo bar'
  31727. *
  31728. * _.lowerCase('__FOO_BAR__');
  31729. * // => 'foo bar'
  31730. */
  31731. var lowerCase = createCompounder(function(result, word, index) {
  31732. return result + (index ? ' ' : '') + word.toLowerCase();
  31733. });
  31734. /**
  31735. * Converts the first character of `string` to lower case.
  31736. *
  31737. * @static
  31738. * @memberOf _
  31739. * @since 4.0.0
  31740. * @category String
  31741. * @param {string} [string=''] The string to convert.
  31742. * @returns {string} Returns the converted string.
  31743. * @example
  31744. *
  31745. * _.lowerFirst('Fred');
  31746. * // => 'fred'
  31747. *
  31748. * _.lowerFirst('FRED');
  31749. * // => 'fRED'
  31750. */
  31751. var lowerFirst = createCaseFirst('toLowerCase');
  31752. /**
  31753. * Pads `string` on the left and right sides if it's shorter than `length`.
  31754. * Padding characters are truncated if they can't be evenly divided by `length`.
  31755. *
  31756. * @static
  31757. * @memberOf _
  31758. * @since 3.0.0
  31759. * @category String
  31760. * @param {string} [string=''] The string to pad.
  31761. * @param {number} [length=0] The padding length.
  31762. * @param {string} [chars=' '] The string used as padding.
  31763. * @returns {string} Returns the padded string.
  31764. * @example
  31765. *
  31766. * _.pad('abc', 8);
  31767. * // => ' abc '
  31768. *
  31769. * _.pad('abc', 8, '_-');
  31770. * // => '_-abc_-_'
  31771. *
  31772. * _.pad('abc', 3);
  31773. * // => 'abc'
  31774. */
  31775. function pad(string, length, chars) {
  31776. string = toString(string);
  31777. length = toInteger(length);
  31778. var strLength = length ? stringSize(string) : 0;
  31779. if (!length || strLength >= length) {
  31780. return string;
  31781. }
  31782. var mid = (length - strLength) / 2;
  31783. return (
  31784. createPadding(nativeFloor(mid), chars) +
  31785. string +
  31786. createPadding(nativeCeil(mid), chars)
  31787. );
  31788. }
  31789. /**
  31790. * Pads `string` on the right side if it's shorter than `length`. Padding
  31791. * characters are truncated if they exceed `length`.
  31792. *
  31793. * @static
  31794. * @memberOf _
  31795. * @since 4.0.0
  31796. * @category String
  31797. * @param {string} [string=''] The string to pad.
  31798. * @param {number} [length=0] The padding length.
  31799. * @param {string} [chars=' '] The string used as padding.
  31800. * @returns {string} Returns the padded string.
  31801. * @example
  31802. *
  31803. * _.padEnd('abc', 6);
  31804. * // => 'abc '
  31805. *
  31806. * _.padEnd('abc', 6, '_-');
  31807. * // => 'abc_-_'
  31808. *
  31809. * _.padEnd('abc', 3);
  31810. * // => 'abc'
  31811. */
  31812. function padEnd(string, length, chars) {
  31813. string = toString(string);
  31814. length = toInteger(length);
  31815. var strLength = length ? stringSize(string) : 0;
  31816. return (length && strLength < length)
  31817. ? (string + createPadding(length - strLength, chars))
  31818. : string;
  31819. }
  31820. /**
  31821. * Pads `string` on the left side if it's shorter than `length`. Padding
  31822. * characters are truncated if they exceed `length`.
  31823. *
  31824. * @static
  31825. * @memberOf _
  31826. * @since 4.0.0
  31827. * @category String
  31828. * @param {string} [string=''] The string to pad.
  31829. * @param {number} [length=0] The padding length.
  31830. * @param {string} [chars=' '] The string used as padding.
  31831. * @returns {string} Returns the padded string.
  31832. * @example
  31833. *
  31834. * _.padStart('abc', 6);
  31835. * // => ' abc'
  31836. *
  31837. * _.padStart('abc', 6, '_-');
  31838. * // => '_-_abc'
  31839. *
  31840. * _.padStart('abc', 3);
  31841. * // => 'abc'
  31842. */
  31843. function padStart(string, length, chars) {
  31844. string = toString(string);
  31845. length = toInteger(length);
  31846. var strLength = length ? stringSize(string) : 0;
  31847. return (length && strLength < length)
  31848. ? (createPadding(length - strLength, chars) + string)
  31849. : string;
  31850. }
  31851. /**
  31852. * Converts `string` to an integer of the specified radix. If `radix` is
  31853. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  31854. * hexadecimal, in which case a `radix` of `16` is used.
  31855. *
  31856. * **Note:** This method aligns with the
  31857. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  31858. *
  31859. * @static
  31860. * @memberOf _
  31861. * @since 1.1.0
  31862. * @category String
  31863. * @param {string} string The string to convert.
  31864. * @param {number} [radix=10] The radix to interpret `value` by.
  31865. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31866. * @returns {number} Returns the converted integer.
  31867. * @example
  31868. *
  31869. * _.parseInt('08');
  31870. * // => 8
  31871. *
  31872. * _.map(['6', '08', '10'], _.parseInt);
  31873. * // => [6, 8, 10]
  31874. */
  31875. function parseInt(string, radix, guard) {
  31876. if (guard || radix == null) {
  31877. radix = 0;
  31878. } else if (radix) {
  31879. radix = +radix;
  31880. }
  31881. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  31882. }
  31883. /**
  31884. * Repeats the given string `n` times.
  31885. *
  31886. * @static
  31887. * @memberOf _
  31888. * @since 3.0.0
  31889. * @category String
  31890. * @param {string} [string=''] The string to repeat.
  31891. * @param {number} [n=1] The number of times to repeat the string.
  31892. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31893. * @returns {string} Returns the repeated string.
  31894. * @example
  31895. *
  31896. * _.repeat('*', 3);
  31897. * // => '***'
  31898. *
  31899. * _.repeat('abc', 2);
  31900. * // => 'abcabc'
  31901. *
  31902. * _.repeat('abc', 0);
  31903. * // => ''
  31904. */
  31905. function repeat(string, n, guard) {
  31906. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  31907. n = 1;
  31908. } else {
  31909. n = toInteger(n);
  31910. }
  31911. return baseRepeat(toString(string), n);
  31912. }
  31913. /**
  31914. * Replaces matches for `pattern` in `string` with `replacement`.
  31915. *
  31916. * **Note:** This method is based on
  31917. * [`String#replace`](https://mdn.io/String/replace).
  31918. *
  31919. * @static
  31920. * @memberOf _
  31921. * @since 4.0.0
  31922. * @category String
  31923. * @param {string} [string=''] The string to modify.
  31924. * @param {RegExp|string} pattern The pattern to replace.
  31925. * @param {Function|string} replacement The match replacement.
  31926. * @returns {string} Returns the modified string.
  31927. * @example
  31928. *
  31929. * _.replace('Hi Fred', 'Fred', 'Barney');
  31930. * // => 'Hi Barney'
  31931. */
  31932. function replace() {
  31933. var args = arguments,
  31934. string = toString(args[0]);
  31935. return args.length < 3 ? string : string.replace(args[1], args[2]);
  31936. }
  31937. /**
  31938. * Converts `string` to
  31939. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  31940. *
  31941. * @static
  31942. * @memberOf _
  31943. * @since 3.0.0
  31944. * @category String
  31945. * @param {string} [string=''] The string to convert.
  31946. * @returns {string} Returns the snake cased string.
  31947. * @example
  31948. *
  31949. * _.snakeCase('Foo Bar');
  31950. * // => 'foo_bar'
  31951. *
  31952. * _.snakeCase('fooBar');
  31953. * // => 'foo_bar'
  31954. *
  31955. * _.snakeCase('--FOO-BAR--');
  31956. * // => 'foo_bar'
  31957. */
  31958. var snakeCase = createCompounder(function(result, word, index) {
  31959. return result + (index ? '_' : '') + word.toLowerCase();
  31960. });
  31961. /**
  31962. * Splits `string` by `separator`.
  31963. *
  31964. * **Note:** This method is based on
  31965. * [`String#split`](https://mdn.io/String/split).
  31966. *
  31967. * @static
  31968. * @memberOf _
  31969. * @since 4.0.0
  31970. * @category String
  31971. * @param {string} [string=''] The string to split.
  31972. * @param {RegExp|string} separator The separator pattern to split by.
  31973. * @param {number} [limit] The length to truncate results to.
  31974. * @returns {Array} Returns the string segments.
  31975. * @example
  31976. *
  31977. * _.split('a-b-c', '-', 2);
  31978. * // => ['a', 'b']
  31979. */
  31980. function split(string, separator, limit) {
  31981. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  31982. separator = limit = undefined;
  31983. }
  31984. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  31985. if (!limit) {
  31986. return [];
  31987. }
  31988. string = toString(string);
  31989. if (string && (
  31990. typeof separator == 'string' ||
  31991. (separator != null && !isRegExp(separator))
  31992. )) {
  31993. separator = baseToString(separator);
  31994. if (!separator && hasUnicode(string)) {
  31995. return castSlice(stringToArray(string), 0, limit);
  31996. }
  31997. }
  31998. return string.split(separator, limit);
  31999. }
  32000. /**
  32001. * Converts `string` to
  32002. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  32003. *
  32004. * @static
  32005. * @memberOf _
  32006. * @since 3.1.0
  32007. * @category String
  32008. * @param {string} [string=''] The string to convert.
  32009. * @returns {string} Returns the start cased string.
  32010. * @example
  32011. *
  32012. * _.startCase('--foo-bar--');
  32013. * // => 'Foo Bar'
  32014. *
  32015. * _.startCase('fooBar');
  32016. * // => 'Foo Bar'
  32017. *
  32018. * _.startCase('__FOO_BAR__');
  32019. * // => 'FOO BAR'
  32020. */
  32021. var startCase = createCompounder(function(result, word, index) {
  32022. return result + (index ? ' ' : '') + upperFirst(word);
  32023. });
  32024. /**
  32025. * Checks if `string` starts with the given target string.
  32026. *
  32027. * @static
  32028. * @memberOf _
  32029. * @since 3.0.0
  32030. * @category String
  32031. * @param {string} [string=''] The string to inspect.
  32032. * @param {string} [target] The string to search for.
  32033. * @param {number} [position=0] The position to search from.
  32034. * @returns {boolean} Returns `true` if `string` starts with `target`,
  32035. * else `false`.
  32036. * @example
  32037. *
  32038. * _.startsWith('abc', 'a');
  32039. * // => true
  32040. *
  32041. * _.startsWith('abc', 'b');
  32042. * // => false
  32043. *
  32044. * _.startsWith('abc', 'b', 1);
  32045. * // => true
  32046. */
  32047. function startsWith(string, target, position) {
  32048. string = toString(string);
  32049. position = position == null
  32050. ? 0
  32051. : baseClamp(toInteger(position), 0, string.length);
  32052. target = baseToString(target);
  32053. return string.slice(position, position + target.length) == target;
  32054. }
  32055. /**
  32056. * Creates a compiled template function that can interpolate data properties
  32057. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  32058. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  32059. * properties may be accessed as free variables in the template. If a setting
  32060. * object is given, it takes precedence over `_.templateSettings` values.
  32061. *
  32062. * **Note:** In the development build `_.template` utilizes
  32063. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  32064. * for easier debugging.
  32065. *
  32066. * For more information on precompiling templates see
  32067. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  32068. *
  32069. * For more information on Chrome extension sandboxes see
  32070. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  32071. *
  32072. * @static
  32073. * @since 0.1.0
  32074. * @memberOf _
  32075. * @category String
  32076. * @param {string} [string=''] The template string.
  32077. * @param {Object} [options={}] The options object.
  32078. * @param {RegExp} [options.escape=_.templateSettings.escape]
  32079. * The HTML "escape" delimiter.
  32080. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  32081. * The "evaluate" delimiter.
  32082. * @param {Object} [options.imports=_.templateSettings.imports]
  32083. * An object to import into the template as free variables.
  32084. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  32085. * The "interpolate" delimiter.
  32086. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  32087. * The sourceURL of the compiled template.
  32088. * @param {string} [options.variable='obj']
  32089. * The data object variable name.
  32090. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32091. * @returns {Function} Returns the compiled template function.
  32092. * @example
  32093. *
  32094. * // Use the "interpolate" delimiter to create a compiled template.
  32095. * var compiled = _.template('hello <%= user %>!');
  32096. * compiled({ 'user': 'fred' });
  32097. * // => 'hello fred!'
  32098. *
  32099. * // Use the HTML "escape" delimiter to escape data property values.
  32100. * var compiled = _.template('<b><%- value %></b>');
  32101. * compiled({ 'value': '<script>' });
  32102. * // => '<b>&lt;script&gt;</b>'
  32103. *
  32104. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  32105. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  32106. * compiled({ 'users': ['fred', 'barney'] });
  32107. * // => '<li>fred</li><li>barney</li>'
  32108. *
  32109. * // Use the internal `print` function in "evaluate" delimiters.
  32110. * var compiled = _.template('<% print("hello " + user); %>!');
  32111. * compiled({ 'user': 'barney' });
  32112. * // => 'hello barney!'
  32113. *
  32114. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  32115. * // Disable support by replacing the "interpolate" delimiter.
  32116. * var compiled = _.template('hello ${ user }!');
  32117. * compiled({ 'user': 'pebbles' });
  32118. * // => 'hello pebbles!'
  32119. *
  32120. * // Use backslashes to treat delimiters as plain text.
  32121. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  32122. * compiled({ 'value': 'ignored' });
  32123. * // => '<%- value %>'
  32124. *
  32125. * // Use the `imports` option to import `jQuery` as `jq`.
  32126. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  32127. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  32128. * compiled({ 'users': ['fred', 'barney'] });
  32129. * // => '<li>fred</li><li>barney</li>'
  32130. *
  32131. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  32132. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  32133. * compiled(data);
  32134. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  32135. *
  32136. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  32137. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  32138. * compiled.source;
  32139. * // => function(data) {
  32140. * // var __t, __p = '';
  32141. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  32142. * // return __p;
  32143. * // }
  32144. *
  32145. * // Use custom template delimiters.
  32146. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  32147. * var compiled = _.template('hello {{ user }}!');
  32148. * compiled({ 'user': 'mustache' });
  32149. * // => 'hello mustache!'
  32150. *
  32151. * // Use the `source` property to inline compiled templates for meaningful
  32152. * // line numbers in error messages and stack traces.
  32153. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  32154. * var JST = {\
  32155. * "main": ' + _.template(mainText).source + '\
  32156. * };\
  32157. * ');
  32158. */
  32159. function template(string, options, guard) {
  32160. // Based on John Resig's `tmpl` implementation
  32161. // (http://ejohn.org/blog/javascript-micro-templating/)
  32162. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  32163. var settings = lodash.templateSettings;
  32164. if (guard && isIterateeCall(string, options, guard)) {
  32165. options = undefined;
  32166. }
  32167. string = toString(string);
  32168. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  32169. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  32170. importsKeys = keys(imports),
  32171. importsValues = baseValues(imports, importsKeys);
  32172. var isEscaping,
  32173. isEvaluating,
  32174. index = 0,
  32175. interpolate = options.interpolate || reNoMatch,
  32176. source = "__p += '";
  32177. // Compile the regexp to match each delimiter.
  32178. var reDelimiters = RegExp(
  32179. (options.escape || reNoMatch).source + '|' +
  32180. interpolate.source + '|' +
  32181. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  32182. (options.evaluate || reNoMatch).source + '|$'
  32183. , 'g');
  32184. // Use a sourceURL for easier debugging.
  32185. // The sourceURL gets injected into the source that's eval-ed, so be careful
  32186. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  32187. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  32188. var sourceURL = '//# sourceURL=' +
  32189. (hasOwnProperty.call(options, 'sourceURL')
  32190. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  32191. : ('lodash.templateSources[' + (++templateCounter) + ']')
  32192. ) + '\n';
  32193. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  32194. interpolateValue || (interpolateValue = esTemplateValue);
  32195. // Escape characters that can't be included in string literals.
  32196. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  32197. // Replace delimiters with snippets.
  32198. if (escapeValue) {
  32199. isEscaping = true;
  32200. source += "' +\n__e(" + escapeValue + ") +\n'";
  32201. }
  32202. if (evaluateValue) {
  32203. isEvaluating = true;
  32204. source += "';\n" + evaluateValue + ";\n__p += '";
  32205. }
  32206. if (interpolateValue) {
  32207. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  32208. }
  32209. index = offset + match.length;
  32210. // The JS engine embedded in Adobe products needs `match` returned in
  32211. // order to produce the correct `offset` value.
  32212. return match;
  32213. });
  32214. source += "';\n";
  32215. // If `variable` is not specified wrap a with-statement around the generated
  32216. // code to add the data object to the top of the scope chain.
  32217. // Like with sourceURL, we take care to not check the option's prototype,
  32218. // as this configuration is a code injection vector.
  32219. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  32220. if (!variable) {
  32221. source = 'with (obj) {\n' + source + '\n}\n';
  32222. }
  32223. // Cleanup code by stripping empty strings.
  32224. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  32225. .replace(reEmptyStringMiddle, '$1')
  32226. .replace(reEmptyStringTrailing, '$1;');
  32227. // Frame code as the function body.
  32228. source = 'function(' + (variable || 'obj') + ') {\n' +
  32229. (variable
  32230. ? ''
  32231. : 'obj || (obj = {});\n'
  32232. ) +
  32233. "var __t, __p = ''" +
  32234. (isEscaping
  32235. ? ', __e = _.escape'
  32236. : ''
  32237. ) +
  32238. (isEvaluating
  32239. ? ', __j = Array.prototype.join;\n' +
  32240. "function print() { __p += __j.call(arguments, '') }\n"
  32241. : ';\n'
  32242. ) +
  32243. source +
  32244. 'return __p\n}';
  32245. var result = attempt(function() {
  32246. return Function(importsKeys, sourceURL + 'return ' + source)
  32247. .apply(undefined, importsValues);
  32248. });
  32249. // Provide the compiled function's source by its `toString` method or
  32250. // the `source` property as a convenience for inlining compiled templates.
  32251. result.source = source;
  32252. if (isError(result)) {
  32253. throw result;
  32254. }
  32255. return result;
  32256. }
  32257. /**
  32258. * Converts `string`, as a whole, to lower case just like
  32259. * [String#toLowerCase](https://mdn.io/toLowerCase).
  32260. *
  32261. * @static
  32262. * @memberOf _
  32263. * @since 4.0.0
  32264. * @category String
  32265. * @param {string} [string=''] The string to convert.
  32266. * @returns {string} Returns the lower cased string.
  32267. * @example
  32268. *
  32269. * _.toLower('--Foo-Bar--');
  32270. * // => '--foo-bar--'
  32271. *
  32272. * _.toLower('fooBar');
  32273. * // => 'foobar'
  32274. *
  32275. * _.toLower('__FOO_BAR__');
  32276. * // => '__foo_bar__'
  32277. */
  32278. function toLower(value) {
  32279. return toString(value).toLowerCase();
  32280. }
  32281. /**
  32282. * Converts `string`, as a whole, to upper case just like
  32283. * [String#toUpperCase](https://mdn.io/toUpperCase).
  32284. *
  32285. * @static
  32286. * @memberOf _
  32287. * @since 4.0.0
  32288. * @category String
  32289. * @param {string} [string=''] The string to convert.
  32290. * @returns {string} Returns the upper cased string.
  32291. * @example
  32292. *
  32293. * _.toUpper('--foo-bar--');
  32294. * // => '--FOO-BAR--'
  32295. *
  32296. * _.toUpper('fooBar');
  32297. * // => 'FOOBAR'
  32298. *
  32299. * _.toUpper('__foo_bar__');
  32300. * // => '__FOO_BAR__'
  32301. */
  32302. function toUpper(value) {
  32303. return toString(value).toUpperCase();
  32304. }
  32305. /**
  32306. * Removes leading and trailing whitespace or specified characters from `string`.
  32307. *
  32308. * @static
  32309. * @memberOf _
  32310. * @since 3.0.0
  32311. * @category String
  32312. * @param {string} [string=''] The string to trim.
  32313. * @param {string} [chars=whitespace] The characters to trim.
  32314. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32315. * @returns {string} Returns the trimmed string.
  32316. * @example
  32317. *
  32318. * _.trim(' abc ');
  32319. * // => 'abc'
  32320. *
  32321. * _.trim('-_-abc-_-', '_-');
  32322. * // => 'abc'
  32323. *
  32324. * _.map([' foo ', ' bar '], _.trim);
  32325. * // => ['foo', 'bar']
  32326. */
  32327. function trim(string, chars, guard) {
  32328. string = toString(string);
  32329. if (string && (guard || chars === undefined)) {
  32330. return string.replace(reTrim, '');
  32331. }
  32332. if (!string || !(chars = baseToString(chars))) {
  32333. return string;
  32334. }
  32335. var strSymbols = stringToArray(string),
  32336. chrSymbols = stringToArray(chars),
  32337. start = charsStartIndex(strSymbols, chrSymbols),
  32338. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  32339. return castSlice(strSymbols, start, end).join('');
  32340. }
  32341. /**
  32342. * Removes trailing whitespace or specified characters from `string`.
  32343. *
  32344. * @static
  32345. * @memberOf _
  32346. * @since 4.0.0
  32347. * @category String
  32348. * @param {string} [string=''] The string to trim.
  32349. * @param {string} [chars=whitespace] The characters to trim.
  32350. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32351. * @returns {string} Returns the trimmed string.
  32352. * @example
  32353. *
  32354. * _.trimEnd(' abc ');
  32355. * // => ' abc'
  32356. *
  32357. * _.trimEnd('-_-abc-_-', '_-');
  32358. * // => '-_-abc'
  32359. */
  32360. function trimEnd(string, chars, guard) {
  32361. string = toString(string);
  32362. if (string && (guard || chars === undefined)) {
  32363. return string.replace(reTrimEnd, '');
  32364. }
  32365. if (!string || !(chars = baseToString(chars))) {
  32366. return string;
  32367. }
  32368. var strSymbols = stringToArray(string),
  32369. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  32370. return castSlice(strSymbols, 0, end).join('');
  32371. }
  32372. /**
  32373. * Removes leading whitespace or specified characters from `string`.
  32374. *
  32375. * @static
  32376. * @memberOf _
  32377. * @since 4.0.0
  32378. * @category String
  32379. * @param {string} [string=''] The string to trim.
  32380. * @param {string} [chars=whitespace] The characters to trim.
  32381. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32382. * @returns {string} Returns the trimmed string.
  32383. * @example
  32384. *
  32385. * _.trimStart(' abc ');
  32386. * // => 'abc '
  32387. *
  32388. * _.trimStart('-_-abc-_-', '_-');
  32389. * // => 'abc-_-'
  32390. */
  32391. function trimStart(string, chars, guard) {
  32392. string = toString(string);
  32393. if (string && (guard || chars === undefined)) {
  32394. return string.replace(reTrimStart, '');
  32395. }
  32396. if (!string || !(chars = baseToString(chars))) {
  32397. return string;
  32398. }
  32399. var strSymbols = stringToArray(string),
  32400. start = charsStartIndex(strSymbols, stringToArray(chars));
  32401. return castSlice(strSymbols, start).join('');
  32402. }
  32403. /**
  32404. * Truncates `string` if it's longer than the given maximum string length.
  32405. * The last characters of the truncated string are replaced with the omission
  32406. * string which defaults to "...".
  32407. *
  32408. * @static
  32409. * @memberOf _
  32410. * @since 4.0.0
  32411. * @category String
  32412. * @param {string} [string=''] The string to truncate.
  32413. * @param {Object} [options={}] The options object.
  32414. * @param {number} [options.length=30] The maximum string length.
  32415. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  32416. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  32417. * @returns {string} Returns the truncated string.
  32418. * @example
  32419. *
  32420. * _.truncate('hi-diddly-ho there, neighborino');
  32421. * // => 'hi-diddly-ho there, neighbo...'
  32422. *
  32423. * _.truncate('hi-diddly-ho there, neighborino', {
  32424. * 'length': 24,
  32425. * 'separator': ' '
  32426. * });
  32427. * // => 'hi-diddly-ho there,...'
  32428. *
  32429. * _.truncate('hi-diddly-ho there, neighborino', {
  32430. * 'length': 24,
  32431. * 'separator': /,? +/
  32432. * });
  32433. * // => 'hi-diddly-ho there...'
  32434. *
  32435. * _.truncate('hi-diddly-ho there, neighborino', {
  32436. * 'omission': ' [...]'
  32437. * });
  32438. * // => 'hi-diddly-ho there, neig [...]'
  32439. */
  32440. function truncate(string, options) {
  32441. var length = DEFAULT_TRUNC_LENGTH,
  32442. omission = DEFAULT_TRUNC_OMISSION;
  32443. if (isObject(options)) {
  32444. var separator = 'separator' in options ? options.separator : separator;
  32445. length = 'length' in options ? toInteger(options.length) : length;
  32446. omission = 'omission' in options ? baseToString(options.omission) : omission;
  32447. }
  32448. string = toString(string);
  32449. var strLength = string.length;
  32450. if (hasUnicode(string)) {
  32451. var strSymbols = stringToArray(string);
  32452. strLength = strSymbols.length;
  32453. }
  32454. if (length >= strLength) {
  32455. return string;
  32456. }
  32457. var end = length - stringSize(omission);
  32458. if (end < 1) {
  32459. return omission;
  32460. }
  32461. var result = strSymbols
  32462. ? castSlice(strSymbols, 0, end).join('')
  32463. : string.slice(0, end);
  32464. if (separator === undefined) {
  32465. return result + omission;
  32466. }
  32467. if (strSymbols) {
  32468. end += (result.length - end);
  32469. }
  32470. if (isRegExp(separator)) {
  32471. if (string.slice(end).search(separator)) {
  32472. var match,
  32473. substring = result;
  32474. if (!separator.global) {
  32475. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  32476. }
  32477. separator.lastIndex = 0;
  32478. while ((match = separator.exec(substring))) {
  32479. var newEnd = match.index;
  32480. }
  32481. result = result.slice(0, newEnd === undefined ? end : newEnd);
  32482. }
  32483. } else if (string.indexOf(baseToString(separator), end) != end) {
  32484. var index = result.lastIndexOf(separator);
  32485. if (index > -1) {
  32486. result = result.slice(0, index);
  32487. }
  32488. }
  32489. return result + omission;
  32490. }
  32491. /**
  32492. * The inverse of `_.escape`; this method converts the HTML entities
  32493. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  32494. * their corresponding characters.
  32495. *
  32496. * **Note:** No other HTML entities are unescaped. To unescape additional
  32497. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  32498. *
  32499. * @static
  32500. * @memberOf _
  32501. * @since 0.6.0
  32502. * @category String
  32503. * @param {string} [string=''] The string to unescape.
  32504. * @returns {string} Returns the unescaped string.
  32505. * @example
  32506. *
  32507. * _.unescape('fred, barney, &amp; pebbles');
  32508. * // => 'fred, barney, & pebbles'
  32509. */
  32510. function unescape(string) {
  32511. string = toString(string);
  32512. return (string && reHasEscapedHtml.test(string))
  32513. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  32514. : string;
  32515. }
  32516. /**
  32517. * Converts `string`, as space separated words, to upper case.
  32518. *
  32519. * @static
  32520. * @memberOf _
  32521. * @since 4.0.0
  32522. * @category String
  32523. * @param {string} [string=''] The string to convert.
  32524. * @returns {string} Returns the upper cased string.
  32525. * @example
  32526. *
  32527. * _.upperCase('--foo-bar');
  32528. * // => 'FOO BAR'
  32529. *
  32530. * _.upperCase('fooBar');
  32531. * // => 'FOO BAR'
  32532. *
  32533. * _.upperCase('__foo_bar__');
  32534. * // => 'FOO BAR'
  32535. */
  32536. var upperCase = createCompounder(function(result, word, index) {
  32537. return result + (index ? ' ' : '') + word.toUpperCase();
  32538. });
  32539. /**
  32540. * Converts the first character of `string` to upper case.
  32541. *
  32542. * @static
  32543. * @memberOf _
  32544. * @since 4.0.0
  32545. * @category String
  32546. * @param {string} [string=''] The string to convert.
  32547. * @returns {string} Returns the converted string.
  32548. * @example
  32549. *
  32550. * _.upperFirst('fred');
  32551. * // => 'Fred'
  32552. *
  32553. * _.upperFirst('FRED');
  32554. * // => 'FRED'
  32555. */
  32556. var upperFirst = createCaseFirst('toUpperCase');
  32557. /**
  32558. * Splits `string` into an array of its words.
  32559. *
  32560. * @static
  32561. * @memberOf _
  32562. * @since 3.0.0
  32563. * @category String
  32564. * @param {string} [string=''] The string to inspect.
  32565. * @param {RegExp|string} [pattern] The pattern to match words.
  32566. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32567. * @returns {Array} Returns the words of `string`.
  32568. * @example
  32569. *
  32570. * _.words('fred, barney, & pebbles');
  32571. * // => ['fred', 'barney', 'pebbles']
  32572. *
  32573. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  32574. * // => ['fred', 'barney', '&', 'pebbles']
  32575. */
  32576. function words(string, pattern, guard) {
  32577. string = toString(string);
  32578. pattern = guard ? undefined : pattern;
  32579. if (pattern === undefined) {
  32580. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  32581. }
  32582. return string.match(pattern) || [];
  32583. }
  32584. /*------------------------------------------------------------------------*/
  32585. /**
  32586. * Attempts to invoke `func`, returning either the result or the caught error
  32587. * object. Any additional arguments are provided to `func` when it's invoked.
  32588. *
  32589. * @static
  32590. * @memberOf _
  32591. * @since 3.0.0
  32592. * @category Util
  32593. * @param {Function} func The function to attempt.
  32594. * @param {...*} [args] The arguments to invoke `func` with.
  32595. * @returns {*} Returns the `func` result or error object.
  32596. * @example
  32597. *
  32598. * // Avoid throwing errors for invalid selectors.
  32599. * var elements = _.attempt(function(selector) {
  32600. * return document.querySelectorAll(selector);
  32601. * }, '>_>');
  32602. *
  32603. * if (_.isError(elements)) {
  32604. * elements = [];
  32605. * }
  32606. */
  32607. var attempt = baseRest(function(func, args) {
  32608. try {
  32609. return apply(func, undefined, args);
  32610. } catch (e) {
  32611. return isError(e) ? e : new Error(e);
  32612. }
  32613. });
  32614. /**
  32615. * Binds methods of an object to the object itself, overwriting the existing
  32616. * method.
  32617. *
  32618. * **Note:** This method doesn't set the "length" property of bound functions.
  32619. *
  32620. * @static
  32621. * @since 0.1.0
  32622. * @memberOf _
  32623. * @category Util
  32624. * @param {Object} object The object to bind and assign the bound methods to.
  32625. * @param {...(string|string[])} methodNames The object method names to bind.
  32626. * @returns {Object} Returns `object`.
  32627. * @example
  32628. *
  32629. * var view = {
  32630. * 'label': 'docs',
  32631. * 'click': function() {
  32632. * console.log('clicked ' + this.label);
  32633. * }
  32634. * };
  32635. *
  32636. * _.bindAll(view, ['click']);
  32637. * jQuery(element).on('click', view.click);
  32638. * // => Logs 'clicked docs' when clicked.
  32639. */
  32640. var bindAll = flatRest(function(object, methodNames) {
  32641. arrayEach(methodNames, function(key) {
  32642. key = toKey(key);
  32643. baseAssignValue(object, key, bind(object[key], object));
  32644. });
  32645. return object;
  32646. });
  32647. /**
  32648. * Creates a function that iterates over `pairs` and invokes the corresponding
  32649. * function of the first predicate to return truthy. The predicate-function
  32650. * pairs are invoked with the `this` binding and arguments of the created
  32651. * function.
  32652. *
  32653. * @static
  32654. * @memberOf _
  32655. * @since 4.0.0
  32656. * @category Util
  32657. * @param {Array} pairs The predicate-function pairs.
  32658. * @returns {Function} Returns the new composite function.
  32659. * @example
  32660. *
  32661. * var func = _.cond([
  32662. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  32663. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  32664. * [_.stubTrue, _.constant('no match')]
  32665. * ]);
  32666. *
  32667. * func({ 'a': 1, 'b': 2 });
  32668. * // => 'matches A'
  32669. *
  32670. * func({ 'a': 0, 'b': 1 });
  32671. * // => 'matches B'
  32672. *
  32673. * func({ 'a': '1', 'b': '2' });
  32674. * // => 'no match'
  32675. */
  32676. function cond(pairs) {
  32677. var length = pairs == null ? 0 : pairs.length,
  32678. toIteratee = getIteratee();
  32679. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  32680. if (typeof pair[1] != 'function') {
  32681. throw new TypeError(FUNC_ERROR_TEXT);
  32682. }
  32683. return [toIteratee(pair[0]), pair[1]];
  32684. });
  32685. return baseRest(function(args) {
  32686. var index = -1;
  32687. while (++index < length) {
  32688. var pair = pairs[index];
  32689. if (apply(pair[0], this, args)) {
  32690. return apply(pair[1], this, args);
  32691. }
  32692. }
  32693. });
  32694. }
  32695. /**
  32696. * Creates a function that invokes the predicate properties of `source` with
  32697. * the corresponding property values of a given object, returning `true` if
  32698. * all predicates return truthy, else `false`.
  32699. *
  32700. * **Note:** The created function is equivalent to `_.conformsTo` with
  32701. * `source` partially applied.
  32702. *
  32703. * @static
  32704. * @memberOf _
  32705. * @since 4.0.0
  32706. * @category Util
  32707. * @param {Object} source The object of property predicates to conform to.
  32708. * @returns {Function} Returns the new spec function.
  32709. * @example
  32710. *
  32711. * var objects = [
  32712. * { 'a': 2, 'b': 1 },
  32713. * { 'a': 1, 'b': 2 }
  32714. * ];
  32715. *
  32716. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  32717. * // => [{ 'a': 1, 'b': 2 }]
  32718. */
  32719. function conforms(source) {
  32720. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  32721. }
  32722. /**
  32723. * Creates a function that returns `value`.
  32724. *
  32725. * @static
  32726. * @memberOf _
  32727. * @since 2.4.0
  32728. * @category Util
  32729. * @param {*} value The value to return from the new function.
  32730. * @returns {Function} Returns the new constant function.
  32731. * @example
  32732. *
  32733. * var objects = _.times(2, _.constant({ 'a': 1 }));
  32734. *
  32735. * console.log(objects);
  32736. * // => [{ 'a': 1 }, { 'a': 1 }]
  32737. *
  32738. * console.log(objects[0] === objects[1]);
  32739. * // => true
  32740. */
  32741. function constant(value) {
  32742. return function() {
  32743. return value;
  32744. };
  32745. }
  32746. /**
  32747. * Checks `value` to determine whether a default value should be returned in
  32748. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  32749. * or `undefined`.
  32750. *
  32751. * @static
  32752. * @memberOf _
  32753. * @since 4.14.0
  32754. * @category Util
  32755. * @param {*} value The value to check.
  32756. * @param {*} defaultValue The default value.
  32757. * @returns {*} Returns the resolved value.
  32758. * @example
  32759. *
  32760. * _.defaultTo(1, 10);
  32761. * // => 1
  32762. *
  32763. * _.defaultTo(undefined, 10);
  32764. * // => 10
  32765. */
  32766. function defaultTo(value, defaultValue) {
  32767. return (value == null || value !== value) ? defaultValue : value;
  32768. }
  32769. /**
  32770. * Creates a function that returns the result of invoking the given functions
  32771. * with the `this` binding of the created function, where each successive
  32772. * invocation is supplied the return value of the previous.
  32773. *
  32774. * @static
  32775. * @memberOf _
  32776. * @since 3.0.0
  32777. * @category Util
  32778. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32779. * @returns {Function} Returns the new composite function.
  32780. * @see _.flowRight
  32781. * @example
  32782. *
  32783. * function square(n) {
  32784. * return n * n;
  32785. * }
  32786. *
  32787. * var addSquare = _.flow([_.add, square]);
  32788. * addSquare(1, 2);
  32789. * // => 9
  32790. */
  32791. var flow = createFlow();
  32792. /**
  32793. * This method is like `_.flow` except that it creates a function that
  32794. * invokes the given functions from right to left.
  32795. *
  32796. * @static
  32797. * @since 3.0.0
  32798. * @memberOf _
  32799. * @category Util
  32800. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32801. * @returns {Function} Returns the new composite function.
  32802. * @see _.flow
  32803. * @example
  32804. *
  32805. * function square(n) {
  32806. * return n * n;
  32807. * }
  32808. *
  32809. * var addSquare = _.flowRight([square, _.add]);
  32810. * addSquare(1, 2);
  32811. * // => 9
  32812. */
  32813. var flowRight = createFlow(true);
  32814. /**
  32815. * This method returns the first argument it receives.
  32816. *
  32817. * @static
  32818. * @since 0.1.0
  32819. * @memberOf _
  32820. * @category Util
  32821. * @param {*} value Any value.
  32822. * @returns {*} Returns `value`.
  32823. * @example
  32824. *
  32825. * var object = { 'a': 1 };
  32826. *
  32827. * console.log(_.identity(object) === object);
  32828. * // => true
  32829. */
  32830. function identity(value) {
  32831. return value;
  32832. }
  32833. /**
  32834. * Creates a function that invokes `func` with the arguments of the created
  32835. * function. If `func` is a property name, the created function returns the
  32836. * property value for a given element. If `func` is an array or object, the
  32837. * created function returns `true` for elements that contain the equivalent
  32838. * source properties, otherwise it returns `false`.
  32839. *
  32840. * @static
  32841. * @since 4.0.0
  32842. * @memberOf _
  32843. * @category Util
  32844. * @param {*} [func=_.identity] The value to convert to a callback.
  32845. * @returns {Function} Returns the callback.
  32846. * @example
  32847. *
  32848. * var users = [
  32849. * { 'user': 'barney', 'age': 36, 'active': true },
  32850. * { 'user': 'fred', 'age': 40, 'active': false }
  32851. * ];
  32852. *
  32853. * // The `_.matches` iteratee shorthand.
  32854. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  32855. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  32856. *
  32857. * // The `_.matchesProperty` iteratee shorthand.
  32858. * _.filter(users, _.iteratee(['user', 'fred']));
  32859. * // => [{ 'user': 'fred', 'age': 40 }]
  32860. *
  32861. * // The `_.property` iteratee shorthand.
  32862. * _.map(users, _.iteratee('user'));
  32863. * // => ['barney', 'fred']
  32864. *
  32865. * // Create custom iteratee shorthands.
  32866. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  32867. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  32868. * return func.test(string);
  32869. * };
  32870. * });
  32871. *
  32872. * _.filter(['abc', 'def'], /ef/);
  32873. * // => ['def']
  32874. */
  32875. function iteratee(func) {
  32876. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  32877. }
  32878. /**
  32879. * Creates a function that performs a partial deep comparison between a given
  32880. * object and `source`, returning `true` if the given object has equivalent
  32881. * property values, else `false`.
  32882. *
  32883. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  32884. * partially applied.
  32885. *
  32886. * Partial comparisons will match empty array and empty object `source`
  32887. * values against any array or object value, respectively. See `_.isEqual`
  32888. * for a list of supported value comparisons.
  32889. *
  32890. * @static
  32891. * @memberOf _
  32892. * @since 3.0.0
  32893. * @category Util
  32894. * @param {Object} source The object of property values to match.
  32895. * @returns {Function} Returns the new spec function.
  32896. * @example
  32897. *
  32898. * var objects = [
  32899. * { 'a': 1, 'b': 2, 'c': 3 },
  32900. * { 'a': 4, 'b': 5, 'c': 6 }
  32901. * ];
  32902. *
  32903. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  32904. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  32905. */
  32906. function matches(source) {
  32907. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  32908. }
  32909. /**
  32910. * Creates a function that performs a partial deep comparison between the
  32911. * value at `path` of a given object to `srcValue`, returning `true` if the
  32912. * object value is equivalent, else `false`.
  32913. *
  32914. * **Note:** Partial comparisons will match empty array and empty object
  32915. * `srcValue` values against any array or object value, respectively. See
  32916. * `_.isEqual` for a list of supported value comparisons.
  32917. *
  32918. * @static
  32919. * @memberOf _
  32920. * @since 3.2.0
  32921. * @category Util
  32922. * @param {Array|string} path The path of the property to get.
  32923. * @param {*} srcValue The value to match.
  32924. * @returns {Function} Returns the new spec function.
  32925. * @example
  32926. *
  32927. * var objects = [
  32928. * { 'a': 1, 'b': 2, 'c': 3 },
  32929. * { 'a': 4, 'b': 5, 'c': 6 }
  32930. * ];
  32931. *
  32932. * _.find(objects, _.matchesProperty('a', 4));
  32933. * // => { 'a': 4, 'b': 5, 'c': 6 }
  32934. */
  32935. function matchesProperty(path, srcValue) {
  32936. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  32937. }
  32938. /**
  32939. * Creates a function that invokes the method at `path` of a given object.
  32940. * Any additional arguments are provided to the invoked method.
  32941. *
  32942. * @static
  32943. * @memberOf _
  32944. * @since 3.7.0
  32945. * @category Util
  32946. * @param {Array|string} path The path of the method to invoke.
  32947. * @param {...*} [args] The arguments to invoke the method with.
  32948. * @returns {Function} Returns the new invoker function.
  32949. * @example
  32950. *
  32951. * var objects = [
  32952. * { 'a': { 'b': _.constant(2) } },
  32953. * { 'a': { 'b': _.constant(1) } }
  32954. * ];
  32955. *
  32956. * _.map(objects, _.method('a.b'));
  32957. * // => [2, 1]
  32958. *
  32959. * _.map(objects, _.method(['a', 'b']));
  32960. * // => [2, 1]
  32961. */
  32962. var method = baseRest(function(path, args) {
  32963. return function(object) {
  32964. return baseInvoke(object, path, args);
  32965. };
  32966. });
  32967. /**
  32968. * The opposite of `_.method`; this method creates a function that invokes
  32969. * the method at a given path of `object`. Any additional arguments are
  32970. * provided to the invoked method.
  32971. *
  32972. * @static
  32973. * @memberOf _
  32974. * @since 3.7.0
  32975. * @category Util
  32976. * @param {Object} object The object to query.
  32977. * @param {...*} [args] The arguments to invoke the method with.
  32978. * @returns {Function} Returns the new invoker function.
  32979. * @example
  32980. *
  32981. * var array = _.times(3, _.constant),
  32982. * object = { 'a': array, 'b': array, 'c': array };
  32983. *
  32984. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  32985. * // => [2, 0]
  32986. *
  32987. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  32988. * // => [2, 0]
  32989. */
  32990. var methodOf = baseRest(function(object, args) {
  32991. return function(path) {
  32992. return baseInvoke(object, path, args);
  32993. };
  32994. });
  32995. /**
  32996. * Adds all own enumerable string keyed function properties of a source
  32997. * object to the destination object. If `object` is a function, then methods
  32998. * are added to its prototype as well.
  32999. *
  33000. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  33001. * avoid conflicts caused by modifying the original.
  33002. *
  33003. * @static
  33004. * @since 0.1.0
  33005. * @memberOf _
  33006. * @category Util
  33007. * @param {Function|Object} [object=lodash] The destination object.
  33008. * @param {Object} source The object of functions to add.
  33009. * @param {Object} [options={}] The options object.
  33010. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  33011. * @returns {Function|Object} Returns `object`.
  33012. * @example
  33013. *
  33014. * function vowels(string) {
  33015. * return _.filter(string, function(v) {
  33016. * return /[aeiou]/i.test(v);
  33017. * });
  33018. * }
  33019. *
  33020. * _.mixin({ 'vowels': vowels });
  33021. * _.vowels('fred');
  33022. * // => ['e']
  33023. *
  33024. * _('fred').vowels().value();
  33025. * // => ['e']
  33026. *
  33027. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  33028. * _('fred').vowels();
  33029. * // => ['e']
  33030. */
  33031. function mixin(object, source, options) {
  33032. var props = keys(source),
  33033. methodNames = baseFunctions(source, props);
  33034. if (options == null &&
  33035. !(isObject(source) && (methodNames.length || !props.length))) {
  33036. options = source;
  33037. source = object;
  33038. object = this;
  33039. methodNames = baseFunctions(source, keys(source));
  33040. }
  33041. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  33042. isFunc = isFunction(object);
  33043. arrayEach(methodNames, function(methodName) {
  33044. var func = source[methodName];
  33045. object[methodName] = func;
  33046. if (isFunc) {
  33047. object.prototype[methodName] = function() {
  33048. var chainAll = this.__chain__;
  33049. if (chain || chainAll) {
  33050. var result = object(this.__wrapped__),
  33051. actions = result.__actions__ = copyArray(this.__actions__);
  33052. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  33053. result.__chain__ = chainAll;
  33054. return result;
  33055. }
  33056. return func.apply(object, arrayPush([this.value()], arguments));
  33057. };
  33058. }
  33059. });
  33060. return object;
  33061. }
  33062. /**
  33063. * Reverts the `_` variable to its previous value and returns a reference to
  33064. * the `lodash` function.
  33065. *
  33066. * @static
  33067. * @since 0.1.0
  33068. * @memberOf _
  33069. * @category Util
  33070. * @returns {Function} Returns the `lodash` function.
  33071. * @example
  33072. *
  33073. * var lodash = _.noConflict();
  33074. */
  33075. function noConflict() {
  33076. if (root._ === this) {
  33077. root._ = oldDash;
  33078. }
  33079. return this;
  33080. }
  33081. /**
  33082. * This method returns `undefined`.
  33083. *
  33084. * @static
  33085. * @memberOf _
  33086. * @since 2.3.0
  33087. * @category Util
  33088. * @example
  33089. *
  33090. * _.times(2, _.noop);
  33091. * // => [undefined, undefined]
  33092. */
  33093. function noop() {
  33094. // No operation performed.
  33095. }
  33096. /**
  33097. * Creates a function that gets the argument at index `n`. If `n` is negative,
  33098. * the nth argument from the end is returned.
  33099. *
  33100. * @static
  33101. * @memberOf _
  33102. * @since 4.0.0
  33103. * @category Util
  33104. * @param {number} [n=0] The index of the argument to return.
  33105. * @returns {Function} Returns the new pass-thru function.
  33106. * @example
  33107. *
  33108. * var func = _.nthArg(1);
  33109. * func('a', 'b', 'c', 'd');
  33110. * // => 'b'
  33111. *
  33112. * var func = _.nthArg(-2);
  33113. * func('a', 'b', 'c', 'd');
  33114. * // => 'c'
  33115. */
  33116. function nthArg(n) {
  33117. n = toInteger(n);
  33118. return baseRest(function(args) {
  33119. return baseNth(args, n);
  33120. });
  33121. }
  33122. /**
  33123. * Creates a function that invokes `iteratees` with the arguments it receives
  33124. * and returns their results.
  33125. *
  33126. * @static
  33127. * @memberOf _
  33128. * @since 4.0.0
  33129. * @category Util
  33130. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  33131. * The iteratees to invoke.
  33132. * @returns {Function} Returns the new function.
  33133. * @example
  33134. *
  33135. * var func = _.over([Math.max, Math.min]);
  33136. *
  33137. * func(1, 2, 3, 4);
  33138. * // => [4, 1]
  33139. */
  33140. var over = createOver(arrayMap);
  33141. /**
  33142. * Creates a function that checks if **all** of the `predicates` return
  33143. * truthy when invoked with the arguments it receives.
  33144. *
  33145. * @static
  33146. * @memberOf _
  33147. * @since 4.0.0
  33148. * @category Util
  33149. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33150. * The predicates to check.
  33151. * @returns {Function} Returns the new function.
  33152. * @example
  33153. *
  33154. * var func = _.overEvery([Boolean, isFinite]);
  33155. *
  33156. * func('1');
  33157. * // => true
  33158. *
  33159. * func(null);
  33160. * // => false
  33161. *
  33162. * func(NaN);
  33163. * // => false
  33164. */
  33165. var overEvery = createOver(arrayEvery);
  33166. /**
  33167. * Creates a function that checks if **any** of the `predicates` return
  33168. * truthy when invoked with the arguments it receives.
  33169. *
  33170. * @static
  33171. * @memberOf _
  33172. * @since 4.0.0
  33173. * @category Util
  33174. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33175. * The predicates to check.
  33176. * @returns {Function} Returns the new function.
  33177. * @example
  33178. *
  33179. * var func = _.overSome([Boolean, isFinite]);
  33180. *
  33181. * func('1');
  33182. * // => true
  33183. *
  33184. * func(null);
  33185. * // => true
  33186. *
  33187. * func(NaN);
  33188. * // => false
  33189. */
  33190. var overSome = createOver(arraySome);
  33191. /**
  33192. * Creates a function that returns the value at `path` of a given object.
  33193. *
  33194. * @static
  33195. * @memberOf _
  33196. * @since 2.4.0
  33197. * @category Util
  33198. * @param {Array|string} path The path of the property to get.
  33199. * @returns {Function} Returns the new accessor function.
  33200. * @example
  33201. *
  33202. * var objects = [
  33203. * { 'a': { 'b': 2 } },
  33204. * { 'a': { 'b': 1 } }
  33205. * ];
  33206. *
  33207. * _.map(objects, _.property('a.b'));
  33208. * // => [2, 1]
  33209. *
  33210. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  33211. * // => [1, 2]
  33212. */
  33213. function property(path) {
  33214. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  33215. }
  33216. /**
  33217. * The opposite of `_.property`; this method creates a function that returns
  33218. * the value at a given path of `object`.
  33219. *
  33220. * @static
  33221. * @memberOf _
  33222. * @since 3.0.0
  33223. * @category Util
  33224. * @param {Object} object The object to query.
  33225. * @returns {Function} Returns the new accessor function.
  33226. * @example
  33227. *
  33228. * var array = [0, 1, 2],
  33229. * object = { 'a': array, 'b': array, 'c': array };
  33230. *
  33231. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  33232. * // => [2, 0]
  33233. *
  33234. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  33235. * // => [2, 0]
  33236. */
  33237. function propertyOf(object) {
  33238. return function(path) {
  33239. return object == null ? undefined : baseGet(object, path);
  33240. };
  33241. }
  33242. /**
  33243. * Creates an array of numbers (positive and/or negative) progressing from
  33244. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  33245. * `start` is specified without an `end` or `step`. If `end` is not specified,
  33246. * it's set to `start` with `start` then set to `0`.
  33247. *
  33248. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  33249. * floating-point values which can produce unexpected results.
  33250. *
  33251. * @static
  33252. * @since 0.1.0
  33253. * @memberOf _
  33254. * @category Util
  33255. * @param {number} [start=0] The start of the range.
  33256. * @param {number} end The end of the range.
  33257. * @param {number} [step=1] The value to increment or decrement by.
  33258. * @returns {Array} Returns the range of numbers.
  33259. * @see _.inRange, _.rangeRight
  33260. * @example
  33261. *
  33262. * _.range(4);
  33263. * // => [0, 1, 2, 3]
  33264. *
  33265. * _.range(-4);
  33266. * // => [0, -1, -2, -3]
  33267. *
  33268. * _.range(1, 5);
  33269. * // => [1, 2, 3, 4]
  33270. *
  33271. * _.range(0, 20, 5);
  33272. * // => [0, 5, 10, 15]
  33273. *
  33274. * _.range(0, -4, -1);
  33275. * // => [0, -1, -2, -3]
  33276. *
  33277. * _.range(1, 4, 0);
  33278. * // => [1, 1, 1]
  33279. *
  33280. * _.range(0);
  33281. * // => []
  33282. */
  33283. var range = createRange();
  33284. /**
  33285. * This method is like `_.range` except that it populates values in
  33286. * descending order.
  33287. *
  33288. * @static
  33289. * @memberOf _
  33290. * @since 4.0.0
  33291. * @category Util
  33292. * @param {number} [start=0] The start of the range.
  33293. * @param {number} end The end of the range.
  33294. * @param {number} [step=1] The value to increment or decrement by.
  33295. * @returns {Array} Returns the range of numbers.
  33296. * @see _.inRange, _.range
  33297. * @example
  33298. *
  33299. * _.rangeRight(4);
  33300. * // => [3, 2, 1, 0]
  33301. *
  33302. * _.rangeRight(-4);
  33303. * // => [-3, -2, -1, 0]
  33304. *
  33305. * _.rangeRight(1, 5);
  33306. * // => [4, 3, 2, 1]
  33307. *
  33308. * _.rangeRight(0, 20, 5);
  33309. * // => [15, 10, 5, 0]
  33310. *
  33311. * _.rangeRight(0, -4, -1);
  33312. * // => [-3, -2, -1, 0]
  33313. *
  33314. * _.rangeRight(1, 4, 0);
  33315. * // => [1, 1, 1]
  33316. *
  33317. * _.rangeRight(0);
  33318. * // => []
  33319. */
  33320. var rangeRight = createRange(true);
  33321. /**
  33322. * This method returns a new empty array.
  33323. *
  33324. * @static
  33325. * @memberOf _
  33326. * @since 4.13.0
  33327. * @category Util
  33328. * @returns {Array} Returns the new empty array.
  33329. * @example
  33330. *
  33331. * var arrays = _.times(2, _.stubArray);
  33332. *
  33333. * console.log(arrays);
  33334. * // => [[], []]
  33335. *
  33336. * console.log(arrays[0] === arrays[1]);
  33337. * // => false
  33338. */
  33339. function stubArray() {
  33340. return [];
  33341. }
  33342. /**
  33343. * This method returns `false`.
  33344. *
  33345. * @static
  33346. * @memberOf _
  33347. * @since 4.13.0
  33348. * @category Util
  33349. * @returns {boolean} Returns `false`.
  33350. * @example
  33351. *
  33352. * _.times(2, _.stubFalse);
  33353. * // => [false, false]
  33354. */
  33355. function stubFalse() {
  33356. return false;
  33357. }
  33358. /**
  33359. * This method returns a new empty object.
  33360. *
  33361. * @static
  33362. * @memberOf _
  33363. * @since 4.13.0
  33364. * @category Util
  33365. * @returns {Object} Returns the new empty object.
  33366. * @example
  33367. *
  33368. * var objects = _.times(2, _.stubObject);
  33369. *
  33370. * console.log(objects);
  33371. * // => [{}, {}]
  33372. *
  33373. * console.log(objects[0] === objects[1]);
  33374. * // => false
  33375. */
  33376. function stubObject() {
  33377. return {};
  33378. }
  33379. /**
  33380. * This method returns an empty string.
  33381. *
  33382. * @static
  33383. * @memberOf _
  33384. * @since 4.13.0
  33385. * @category Util
  33386. * @returns {string} Returns the empty string.
  33387. * @example
  33388. *
  33389. * _.times(2, _.stubString);
  33390. * // => ['', '']
  33391. */
  33392. function stubString() {
  33393. return '';
  33394. }
  33395. /**
  33396. * This method returns `true`.
  33397. *
  33398. * @static
  33399. * @memberOf _
  33400. * @since 4.13.0
  33401. * @category Util
  33402. * @returns {boolean} Returns `true`.
  33403. * @example
  33404. *
  33405. * _.times(2, _.stubTrue);
  33406. * // => [true, true]
  33407. */
  33408. function stubTrue() {
  33409. return true;
  33410. }
  33411. /**
  33412. * Invokes the iteratee `n` times, returning an array of the results of
  33413. * each invocation. The iteratee is invoked with one argument; (index).
  33414. *
  33415. * @static
  33416. * @since 0.1.0
  33417. * @memberOf _
  33418. * @category Util
  33419. * @param {number} n The number of times to invoke `iteratee`.
  33420. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33421. * @returns {Array} Returns the array of results.
  33422. * @example
  33423. *
  33424. * _.times(3, String);
  33425. * // => ['0', '1', '2']
  33426. *
  33427. * _.times(4, _.constant(0));
  33428. * // => [0, 0, 0, 0]
  33429. */
  33430. function times(n, iteratee) {
  33431. n = toInteger(n);
  33432. if (n < 1 || n > MAX_SAFE_INTEGER) {
  33433. return [];
  33434. }
  33435. var index = MAX_ARRAY_LENGTH,
  33436. length = nativeMin(n, MAX_ARRAY_LENGTH);
  33437. iteratee = getIteratee(iteratee);
  33438. n -= MAX_ARRAY_LENGTH;
  33439. var result = baseTimes(length, iteratee);
  33440. while (++index < n) {
  33441. iteratee(index);
  33442. }
  33443. return result;
  33444. }
  33445. /**
  33446. * Converts `value` to a property path array.
  33447. *
  33448. * @static
  33449. * @memberOf _
  33450. * @since 4.0.0
  33451. * @category Util
  33452. * @param {*} value The value to convert.
  33453. * @returns {Array} Returns the new property path array.
  33454. * @example
  33455. *
  33456. * _.toPath('a.b.c');
  33457. * // => ['a', 'b', 'c']
  33458. *
  33459. * _.toPath('a[0].b.c');
  33460. * // => ['a', '0', 'b', 'c']
  33461. */
  33462. function toPath(value) {
  33463. if (isArray(value)) {
  33464. return arrayMap(value, toKey);
  33465. }
  33466. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  33467. }
  33468. /**
  33469. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  33470. *
  33471. * @static
  33472. * @since 0.1.0
  33473. * @memberOf _
  33474. * @category Util
  33475. * @param {string} [prefix=''] The value to prefix the ID with.
  33476. * @returns {string} Returns the unique ID.
  33477. * @example
  33478. *
  33479. * _.uniqueId('contact_');
  33480. * // => 'contact_104'
  33481. *
  33482. * _.uniqueId();
  33483. * // => '105'
  33484. */
  33485. function uniqueId(prefix) {
  33486. var id = ++idCounter;
  33487. return toString(prefix) + id;
  33488. }
  33489. /*------------------------------------------------------------------------*/
  33490. /**
  33491. * Adds two numbers.
  33492. *
  33493. * @static
  33494. * @memberOf _
  33495. * @since 3.4.0
  33496. * @category Math
  33497. * @param {number} augend The first number in an addition.
  33498. * @param {number} addend The second number in an addition.
  33499. * @returns {number} Returns the total.
  33500. * @example
  33501. *
  33502. * _.add(6, 4);
  33503. * // => 10
  33504. */
  33505. var add = createMathOperation(function(augend, addend) {
  33506. return augend + addend;
  33507. }, 0);
  33508. /**
  33509. * Computes `number` rounded up to `precision`.
  33510. *
  33511. * @static
  33512. * @memberOf _
  33513. * @since 3.10.0
  33514. * @category Math
  33515. * @param {number} number The number to round up.
  33516. * @param {number} [precision=0] The precision to round up to.
  33517. * @returns {number} Returns the rounded up number.
  33518. * @example
  33519. *
  33520. * _.ceil(4.006);
  33521. * // => 5
  33522. *
  33523. * _.ceil(6.004, 2);
  33524. * // => 6.01
  33525. *
  33526. * _.ceil(6040, -2);
  33527. * // => 6100
  33528. */
  33529. var ceil = createRound('ceil');
  33530. /**
  33531. * Divide two numbers.
  33532. *
  33533. * @static
  33534. * @memberOf _
  33535. * @since 4.7.0
  33536. * @category Math
  33537. * @param {number} dividend The first number in a division.
  33538. * @param {number} divisor The second number in a division.
  33539. * @returns {number} Returns the quotient.
  33540. * @example
  33541. *
  33542. * _.divide(6, 4);
  33543. * // => 1.5
  33544. */
  33545. var divide = createMathOperation(function(dividend, divisor) {
  33546. return dividend / divisor;
  33547. }, 1);
  33548. /**
  33549. * Computes `number` rounded down to `precision`.
  33550. *
  33551. * @static
  33552. * @memberOf _
  33553. * @since 3.10.0
  33554. * @category Math
  33555. * @param {number} number The number to round down.
  33556. * @param {number} [precision=0] The precision to round down to.
  33557. * @returns {number} Returns the rounded down number.
  33558. * @example
  33559. *
  33560. * _.floor(4.006);
  33561. * // => 4
  33562. *
  33563. * _.floor(0.046, 2);
  33564. * // => 0.04
  33565. *
  33566. * _.floor(4060, -2);
  33567. * // => 4000
  33568. */
  33569. var floor = createRound('floor');
  33570. /**
  33571. * Computes the maximum value of `array`. If `array` is empty or falsey,
  33572. * `undefined` is returned.
  33573. *
  33574. * @static
  33575. * @since 0.1.0
  33576. * @memberOf _
  33577. * @category Math
  33578. * @param {Array} array The array to iterate over.
  33579. * @returns {*} Returns the maximum value.
  33580. * @example
  33581. *
  33582. * _.max([4, 2, 8, 6]);
  33583. * // => 8
  33584. *
  33585. * _.max([]);
  33586. * // => undefined
  33587. */
  33588. function max(array) {
  33589. return (array && array.length)
  33590. ? baseExtremum(array, identity, baseGt)
  33591. : undefined;
  33592. }
  33593. /**
  33594. * This method is like `_.max` except that it accepts `iteratee` which is
  33595. * invoked for each element in `array` to generate the criterion by which
  33596. * the value is ranked. The iteratee is invoked with one argument: (value).
  33597. *
  33598. * @static
  33599. * @memberOf _
  33600. * @since 4.0.0
  33601. * @category Math
  33602. * @param {Array} array The array to iterate over.
  33603. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33604. * @returns {*} Returns the maximum value.
  33605. * @example
  33606. *
  33607. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33608. *
  33609. * _.maxBy(objects, function(o) { return o.n; });
  33610. * // => { 'n': 2 }
  33611. *
  33612. * // The `_.property` iteratee shorthand.
  33613. * _.maxBy(objects, 'n');
  33614. * // => { 'n': 2 }
  33615. */
  33616. function maxBy(array, iteratee) {
  33617. return (array && array.length)
  33618. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  33619. : undefined;
  33620. }
  33621. /**
  33622. * Computes the mean of the values in `array`.
  33623. *
  33624. * @static
  33625. * @memberOf _
  33626. * @since 4.0.0
  33627. * @category Math
  33628. * @param {Array} array The array to iterate over.
  33629. * @returns {number} Returns the mean.
  33630. * @example
  33631. *
  33632. * _.mean([4, 2, 8, 6]);
  33633. * // => 5
  33634. */
  33635. function mean(array) {
  33636. return baseMean(array, identity);
  33637. }
  33638. /**
  33639. * This method is like `_.mean` except that it accepts `iteratee` which is
  33640. * invoked for each element in `array` to generate the value to be averaged.
  33641. * The iteratee is invoked with one argument: (value).
  33642. *
  33643. * @static
  33644. * @memberOf _
  33645. * @since 4.7.0
  33646. * @category Math
  33647. * @param {Array} array The array to iterate over.
  33648. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33649. * @returns {number} Returns the mean.
  33650. * @example
  33651. *
  33652. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33653. *
  33654. * _.meanBy(objects, function(o) { return o.n; });
  33655. * // => 5
  33656. *
  33657. * // The `_.property` iteratee shorthand.
  33658. * _.meanBy(objects, 'n');
  33659. * // => 5
  33660. */
  33661. function meanBy(array, iteratee) {
  33662. return baseMean(array, getIteratee(iteratee, 2));
  33663. }
  33664. /**
  33665. * Computes the minimum value of `array`. If `array` is empty or falsey,
  33666. * `undefined` is returned.
  33667. *
  33668. * @static
  33669. * @since 0.1.0
  33670. * @memberOf _
  33671. * @category Math
  33672. * @param {Array} array The array to iterate over.
  33673. * @returns {*} Returns the minimum value.
  33674. * @example
  33675. *
  33676. * _.min([4, 2, 8, 6]);
  33677. * // => 2
  33678. *
  33679. * _.min([]);
  33680. * // => undefined
  33681. */
  33682. function min(array) {
  33683. return (array && array.length)
  33684. ? baseExtremum(array, identity, baseLt)
  33685. : undefined;
  33686. }
  33687. /**
  33688. * This method is like `_.min` except that it accepts `iteratee` which is
  33689. * invoked for each element in `array` to generate the criterion by which
  33690. * the value is ranked. The iteratee is invoked with one argument: (value).
  33691. *
  33692. * @static
  33693. * @memberOf _
  33694. * @since 4.0.0
  33695. * @category Math
  33696. * @param {Array} array The array to iterate over.
  33697. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33698. * @returns {*} Returns the minimum value.
  33699. * @example
  33700. *
  33701. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33702. *
  33703. * _.minBy(objects, function(o) { return o.n; });
  33704. * // => { 'n': 1 }
  33705. *
  33706. * // The `_.property` iteratee shorthand.
  33707. * _.minBy(objects, 'n');
  33708. * // => { 'n': 1 }
  33709. */
  33710. function minBy(array, iteratee) {
  33711. return (array && array.length)
  33712. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  33713. : undefined;
  33714. }
  33715. /**
  33716. * Multiply two numbers.
  33717. *
  33718. * @static
  33719. * @memberOf _
  33720. * @since 4.7.0
  33721. * @category Math
  33722. * @param {number} multiplier The first number in a multiplication.
  33723. * @param {number} multiplicand The second number in a multiplication.
  33724. * @returns {number} Returns the product.
  33725. * @example
  33726. *
  33727. * _.multiply(6, 4);
  33728. * // => 24
  33729. */
  33730. var multiply = createMathOperation(function(multiplier, multiplicand) {
  33731. return multiplier * multiplicand;
  33732. }, 1);
  33733. /**
  33734. * Computes `number` rounded to `precision`.
  33735. *
  33736. * @static
  33737. * @memberOf _
  33738. * @since 3.10.0
  33739. * @category Math
  33740. * @param {number} number The number to round.
  33741. * @param {number} [precision=0] The precision to round to.
  33742. * @returns {number} Returns the rounded number.
  33743. * @example
  33744. *
  33745. * _.round(4.006);
  33746. * // => 4
  33747. *
  33748. * _.round(4.006, 2);
  33749. * // => 4.01
  33750. *
  33751. * _.round(4060, -2);
  33752. * // => 4100
  33753. */
  33754. var round = createRound('round');
  33755. /**
  33756. * Subtract two numbers.
  33757. *
  33758. * @static
  33759. * @memberOf _
  33760. * @since 4.0.0
  33761. * @category Math
  33762. * @param {number} minuend The first number in a subtraction.
  33763. * @param {number} subtrahend The second number in a subtraction.
  33764. * @returns {number} Returns the difference.
  33765. * @example
  33766. *
  33767. * _.subtract(6, 4);
  33768. * // => 2
  33769. */
  33770. var subtract = createMathOperation(function(minuend, subtrahend) {
  33771. return minuend - subtrahend;
  33772. }, 0);
  33773. /**
  33774. * Computes the sum of the values in `array`.
  33775. *
  33776. * @static
  33777. * @memberOf _
  33778. * @since 3.4.0
  33779. * @category Math
  33780. * @param {Array} array The array to iterate over.
  33781. * @returns {number} Returns the sum.
  33782. * @example
  33783. *
  33784. * _.sum([4, 2, 8, 6]);
  33785. * // => 20
  33786. */
  33787. function sum(array) {
  33788. return (array && array.length)
  33789. ? baseSum(array, identity)
  33790. : 0;
  33791. }
  33792. /**
  33793. * This method is like `_.sum` except that it accepts `iteratee` which is
  33794. * invoked for each element in `array` to generate the value to be summed.
  33795. * The iteratee is invoked with one argument: (value).
  33796. *
  33797. * @static
  33798. * @memberOf _
  33799. * @since 4.0.0
  33800. * @category Math
  33801. * @param {Array} array The array to iterate over.
  33802. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33803. * @returns {number} Returns the sum.
  33804. * @example
  33805. *
  33806. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33807. *
  33808. * _.sumBy(objects, function(o) { return o.n; });
  33809. * // => 20
  33810. *
  33811. * // The `_.property` iteratee shorthand.
  33812. * _.sumBy(objects, 'n');
  33813. * // => 20
  33814. */
  33815. function sumBy(array, iteratee) {
  33816. return (array && array.length)
  33817. ? baseSum(array, getIteratee(iteratee, 2))
  33818. : 0;
  33819. }
  33820. /*------------------------------------------------------------------------*/
  33821. // Add methods that return wrapped values in chain sequences.
  33822. lodash.after = after;
  33823. lodash.ary = ary;
  33824. lodash.assign = assign;
  33825. lodash.assignIn = assignIn;
  33826. lodash.assignInWith = assignInWith;
  33827. lodash.assignWith = assignWith;
  33828. lodash.at = at;
  33829. lodash.before = before;
  33830. lodash.bind = bind;
  33831. lodash.bindAll = bindAll;
  33832. lodash.bindKey = bindKey;
  33833. lodash.castArray = castArray;
  33834. lodash.chain = chain;
  33835. lodash.chunk = chunk;
  33836. lodash.compact = compact;
  33837. lodash.concat = concat;
  33838. lodash.cond = cond;
  33839. lodash.conforms = conforms;
  33840. lodash.constant = constant;
  33841. lodash.countBy = countBy;
  33842. lodash.create = create;
  33843. lodash.curry = curry;
  33844. lodash.curryRight = curryRight;
  33845. lodash.debounce = debounce;
  33846. lodash.defaults = defaults;
  33847. lodash.defaultsDeep = defaultsDeep;
  33848. lodash.defer = defer;
  33849. lodash.delay = delay;
  33850. lodash.difference = difference;
  33851. lodash.differenceBy = differenceBy;
  33852. lodash.differenceWith = differenceWith;
  33853. lodash.drop = drop;
  33854. lodash.dropRight = dropRight;
  33855. lodash.dropRightWhile = dropRightWhile;
  33856. lodash.dropWhile = dropWhile;
  33857. lodash.fill = fill;
  33858. lodash.filter = filter;
  33859. lodash.flatMap = flatMap;
  33860. lodash.flatMapDeep = flatMapDeep;
  33861. lodash.flatMapDepth = flatMapDepth;
  33862. lodash.flatten = flatten;
  33863. lodash.flattenDeep = flattenDeep;
  33864. lodash.flattenDepth = flattenDepth;
  33865. lodash.flip = flip;
  33866. lodash.flow = flow;
  33867. lodash.flowRight = flowRight;
  33868. lodash.fromPairs = fromPairs;
  33869. lodash.functions = functions;
  33870. lodash.functionsIn = functionsIn;
  33871. lodash.groupBy = groupBy;
  33872. lodash.initial = initial;
  33873. lodash.intersection = intersection;
  33874. lodash.intersectionBy = intersectionBy;
  33875. lodash.intersectionWith = intersectionWith;
  33876. lodash.invert = invert;
  33877. lodash.invertBy = invertBy;
  33878. lodash.invokeMap = invokeMap;
  33879. lodash.iteratee = iteratee;
  33880. lodash.keyBy = keyBy;
  33881. lodash.keys = keys;
  33882. lodash.keysIn = keysIn;
  33883. lodash.map = map;
  33884. lodash.mapKeys = mapKeys;
  33885. lodash.mapValues = mapValues;
  33886. lodash.matches = matches;
  33887. lodash.matchesProperty = matchesProperty;
  33888. lodash.memoize = memoize;
  33889. lodash.merge = merge;
  33890. lodash.mergeWith = mergeWith;
  33891. lodash.method = method;
  33892. lodash.methodOf = methodOf;
  33893. lodash.mixin = mixin;
  33894. lodash.negate = negate;
  33895. lodash.nthArg = nthArg;
  33896. lodash.omit = omit;
  33897. lodash.omitBy = omitBy;
  33898. lodash.once = once;
  33899. lodash.orderBy = orderBy;
  33900. lodash.over = over;
  33901. lodash.overArgs = overArgs;
  33902. lodash.overEvery = overEvery;
  33903. lodash.overSome = overSome;
  33904. lodash.partial = partial;
  33905. lodash.partialRight = partialRight;
  33906. lodash.partition = partition;
  33907. lodash.pick = pick;
  33908. lodash.pickBy = pickBy;
  33909. lodash.property = property;
  33910. lodash.propertyOf = propertyOf;
  33911. lodash.pull = pull;
  33912. lodash.pullAll = pullAll;
  33913. lodash.pullAllBy = pullAllBy;
  33914. lodash.pullAllWith = pullAllWith;
  33915. lodash.pullAt = pullAt;
  33916. lodash.range = range;
  33917. lodash.rangeRight = rangeRight;
  33918. lodash.rearg = rearg;
  33919. lodash.reject = reject;
  33920. lodash.remove = remove;
  33921. lodash.rest = rest;
  33922. lodash.reverse = reverse;
  33923. lodash.sampleSize = sampleSize;
  33924. lodash.set = set;
  33925. lodash.setWith = setWith;
  33926. lodash.shuffle = shuffle;
  33927. lodash.slice = slice;
  33928. lodash.sortBy = sortBy;
  33929. lodash.sortedUniq = sortedUniq;
  33930. lodash.sortedUniqBy = sortedUniqBy;
  33931. lodash.split = split;
  33932. lodash.spread = spread;
  33933. lodash.tail = tail;
  33934. lodash.take = take;
  33935. lodash.takeRight = takeRight;
  33936. lodash.takeRightWhile = takeRightWhile;
  33937. lodash.takeWhile = takeWhile;
  33938. lodash.tap = tap;
  33939. lodash.throttle = throttle;
  33940. lodash.thru = thru;
  33941. lodash.toArray = toArray;
  33942. lodash.toPairs = toPairs;
  33943. lodash.toPairsIn = toPairsIn;
  33944. lodash.toPath = toPath;
  33945. lodash.toPlainObject = toPlainObject;
  33946. lodash.transform = transform;
  33947. lodash.unary = unary;
  33948. lodash.union = union;
  33949. lodash.unionBy = unionBy;
  33950. lodash.unionWith = unionWith;
  33951. lodash.uniq = uniq;
  33952. lodash.uniqBy = uniqBy;
  33953. lodash.uniqWith = uniqWith;
  33954. lodash.unset = unset;
  33955. lodash.unzip = unzip;
  33956. lodash.unzipWith = unzipWith;
  33957. lodash.update = update;
  33958. lodash.updateWith = updateWith;
  33959. lodash.values = values;
  33960. lodash.valuesIn = valuesIn;
  33961. lodash.without = without;
  33962. lodash.words = words;
  33963. lodash.wrap = wrap;
  33964. lodash.xor = xor;
  33965. lodash.xorBy = xorBy;
  33966. lodash.xorWith = xorWith;
  33967. lodash.zip = zip;
  33968. lodash.zipObject = zipObject;
  33969. lodash.zipObjectDeep = zipObjectDeep;
  33970. lodash.zipWith = zipWith;
  33971. // Add aliases.
  33972. lodash.entries = toPairs;
  33973. lodash.entriesIn = toPairsIn;
  33974. lodash.extend = assignIn;
  33975. lodash.extendWith = assignInWith;
  33976. // Add methods to `lodash.prototype`.
  33977. mixin(lodash, lodash);
  33978. /*------------------------------------------------------------------------*/
  33979. // Add methods that return unwrapped values in chain sequences.
  33980. lodash.add = add;
  33981. lodash.attempt = attempt;
  33982. lodash.camelCase = camelCase;
  33983. lodash.capitalize = capitalize;
  33984. lodash.ceil = ceil;
  33985. lodash.clamp = clamp;
  33986. lodash.clone = clone;
  33987. lodash.cloneDeep = cloneDeep;
  33988. lodash.cloneDeepWith = cloneDeepWith;
  33989. lodash.cloneWith = cloneWith;
  33990. lodash.conformsTo = conformsTo;
  33991. lodash.deburr = deburr;
  33992. lodash.defaultTo = defaultTo;
  33993. lodash.divide = divide;
  33994. lodash.endsWith = endsWith;
  33995. lodash.eq = eq;
  33996. lodash.escape = escape;
  33997. lodash.escapeRegExp = escapeRegExp;
  33998. lodash.every = every;
  33999. lodash.find = find;
  34000. lodash.findIndex = findIndex;
  34001. lodash.findKey = findKey;
  34002. lodash.findLast = findLast;
  34003. lodash.findLastIndex = findLastIndex;
  34004. lodash.findLastKey = findLastKey;
  34005. lodash.floor = floor;
  34006. lodash.forEach = forEach;
  34007. lodash.forEachRight = forEachRight;
  34008. lodash.forIn = forIn;
  34009. lodash.forInRight = forInRight;
  34010. lodash.forOwn = forOwn;
  34011. lodash.forOwnRight = forOwnRight;
  34012. lodash.get = get;
  34013. lodash.gt = gt;
  34014. lodash.gte = gte;
  34015. lodash.has = has;
  34016. lodash.hasIn = hasIn;
  34017. lodash.head = head;
  34018. lodash.identity = identity;
  34019. lodash.includes = includes;
  34020. lodash.indexOf = indexOf;
  34021. lodash.inRange = inRange;
  34022. lodash.invoke = invoke;
  34023. lodash.isArguments = isArguments;
  34024. lodash.isArray = isArray;
  34025. lodash.isArrayBuffer = isArrayBuffer;
  34026. lodash.isArrayLike = isArrayLike;
  34027. lodash.isArrayLikeObject = isArrayLikeObject;
  34028. lodash.isBoolean = isBoolean;
  34029. lodash.isBuffer = isBuffer;
  34030. lodash.isDate = isDate;
  34031. lodash.isElement = isElement;
  34032. lodash.isEmpty = isEmpty;
  34033. lodash.isEqual = isEqual;
  34034. lodash.isEqualWith = isEqualWith;
  34035. lodash.isError = isError;
  34036. lodash.isFinite = isFinite;
  34037. lodash.isFunction = isFunction;
  34038. lodash.isInteger = isInteger;
  34039. lodash.isLength = isLength;
  34040. lodash.isMap = isMap;
  34041. lodash.isMatch = isMatch;
  34042. lodash.isMatchWith = isMatchWith;
  34043. lodash.isNaN = isNaN;
  34044. lodash.isNative = isNative;
  34045. lodash.isNil = isNil;
  34046. lodash.isNull = isNull;
  34047. lodash.isNumber = isNumber;
  34048. lodash.isObject = isObject;
  34049. lodash.isObjectLike = isObjectLike;
  34050. lodash.isPlainObject = isPlainObject;
  34051. lodash.isRegExp = isRegExp;
  34052. lodash.isSafeInteger = isSafeInteger;
  34053. lodash.isSet = isSet;
  34054. lodash.isString = isString;
  34055. lodash.isSymbol = isSymbol;
  34056. lodash.isTypedArray = isTypedArray;
  34057. lodash.isUndefined = isUndefined;
  34058. lodash.isWeakMap = isWeakMap;
  34059. lodash.isWeakSet = isWeakSet;
  34060. lodash.join = join;
  34061. lodash.kebabCase = kebabCase;
  34062. lodash.last = last;
  34063. lodash.lastIndexOf = lastIndexOf;
  34064. lodash.lowerCase = lowerCase;
  34065. lodash.lowerFirst = lowerFirst;
  34066. lodash.lt = lt;
  34067. lodash.lte = lte;
  34068. lodash.max = max;
  34069. lodash.maxBy = maxBy;
  34070. lodash.mean = mean;
  34071. lodash.meanBy = meanBy;
  34072. lodash.min = min;
  34073. lodash.minBy = minBy;
  34074. lodash.stubArray = stubArray;
  34075. lodash.stubFalse = stubFalse;
  34076. lodash.stubObject = stubObject;
  34077. lodash.stubString = stubString;
  34078. lodash.stubTrue = stubTrue;
  34079. lodash.multiply = multiply;
  34080. lodash.nth = nth;
  34081. lodash.noConflict = noConflict;
  34082. lodash.noop = noop;
  34083. lodash.now = now;
  34084. lodash.pad = pad;
  34085. lodash.padEnd = padEnd;
  34086. lodash.padStart = padStart;
  34087. lodash.parseInt = parseInt;
  34088. lodash.random = random;
  34089. lodash.reduce = reduce;
  34090. lodash.reduceRight = reduceRight;
  34091. lodash.repeat = repeat;
  34092. lodash.replace = replace;
  34093. lodash.result = result;
  34094. lodash.round = round;
  34095. lodash.runInContext = runInContext;
  34096. lodash.sample = sample;
  34097. lodash.size = size;
  34098. lodash.snakeCase = snakeCase;
  34099. lodash.some = some;
  34100. lodash.sortedIndex = sortedIndex;
  34101. lodash.sortedIndexBy = sortedIndexBy;
  34102. lodash.sortedIndexOf = sortedIndexOf;
  34103. lodash.sortedLastIndex = sortedLastIndex;
  34104. lodash.sortedLastIndexBy = sortedLastIndexBy;
  34105. lodash.sortedLastIndexOf = sortedLastIndexOf;
  34106. lodash.startCase = startCase;
  34107. lodash.startsWith = startsWith;
  34108. lodash.subtract = subtract;
  34109. lodash.sum = sum;
  34110. lodash.sumBy = sumBy;
  34111. lodash.template = template;
  34112. lodash.times = times;
  34113. lodash.toFinite = toFinite;
  34114. lodash.toInteger = toInteger;
  34115. lodash.toLength = toLength;
  34116. lodash.toLower = toLower;
  34117. lodash.toNumber = toNumber;
  34118. lodash.toSafeInteger = toSafeInteger;
  34119. lodash.toString = toString;
  34120. lodash.toUpper = toUpper;
  34121. lodash.trim = trim;
  34122. lodash.trimEnd = trimEnd;
  34123. lodash.trimStart = trimStart;
  34124. lodash.truncate = truncate;
  34125. lodash.unescape = unescape;
  34126. lodash.uniqueId = uniqueId;
  34127. lodash.upperCase = upperCase;
  34128. lodash.upperFirst = upperFirst;
  34129. // Add aliases.
  34130. lodash.each = forEach;
  34131. lodash.eachRight = forEachRight;
  34132. lodash.first = head;
  34133. mixin(lodash, (function() {
  34134. var source = {};
  34135. baseForOwn(lodash, function(func, methodName) {
  34136. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  34137. source[methodName] = func;
  34138. }
  34139. });
  34140. return source;
  34141. }()), { 'chain': false });
  34142. /*------------------------------------------------------------------------*/
  34143. /**
  34144. * The semantic version number.
  34145. *
  34146. * @static
  34147. * @memberOf _
  34148. * @type {string}
  34149. */
  34150. lodash.VERSION = VERSION;
  34151. // Assign default placeholders.
  34152. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  34153. lodash[methodName].placeholder = lodash;
  34154. });
  34155. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  34156. arrayEach(['drop', 'take'], function(methodName, index) {
  34157. LazyWrapper.prototype[methodName] = function(n) {
  34158. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  34159. var result = (this.__filtered__ && !index)
  34160. ? new LazyWrapper(this)
  34161. : this.clone();
  34162. if (result.__filtered__) {
  34163. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  34164. } else {
  34165. result.__views__.push({
  34166. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  34167. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  34168. });
  34169. }
  34170. return result;
  34171. };
  34172. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  34173. return this.reverse()[methodName](n).reverse();
  34174. };
  34175. });
  34176. // Add `LazyWrapper` methods that accept an `iteratee` value.
  34177. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  34178. var type = index + 1,
  34179. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  34180. LazyWrapper.prototype[methodName] = function(iteratee) {
  34181. var result = this.clone();
  34182. result.__iteratees__.push({
  34183. 'iteratee': getIteratee(iteratee, 3),
  34184. 'type': type
  34185. });
  34186. result.__filtered__ = result.__filtered__ || isFilter;
  34187. return result;
  34188. };
  34189. });
  34190. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  34191. arrayEach(['head', 'last'], function(methodName, index) {
  34192. var takeName = 'take' + (index ? 'Right' : '');
  34193. LazyWrapper.prototype[methodName] = function() {
  34194. return this[takeName](1).value()[0];
  34195. };
  34196. });
  34197. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  34198. arrayEach(['initial', 'tail'], function(methodName, index) {
  34199. var dropName = 'drop' + (index ? '' : 'Right');
  34200. LazyWrapper.prototype[methodName] = function() {
  34201. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  34202. };
  34203. });
  34204. LazyWrapper.prototype.compact = function() {
  34205. return this.filter(identity);
  34206. };
  34207. LazyWrapper.prototype.find = function(predicate) {
  34208. return this.filter(predicate).head();
  34209. };
  34210. LazyWrapper.prototype.findLast = function(predicate) {
  34211. return this.reverse().find(predicate);
  34212. };
  34213. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  34214. if (typeof path == 'function') {
  34215. return new LazyWrapper(this);
  34216. }
  34217. return this.map(function(value) {
  34218. return baseInvoke(value, path, args);
  34219. });
  34220. });
  34221. LazyWrapper.prototype.reject = function(predicate) {
  34222. return this.filter(negate(getIteratee(predicate)));
  34223. };
  34224. LazyWrapper.prototype.slice = function(start, end) {
  34225. start = toInteger(start);
  34226. var result = this;
  34227. if (result.__filtered__ && (start > 0 || end < 0)) {
  34228. return new LazyWrapper(result);
  34229. }
  34230. if (start < 0) {
  34231. result = result.takeRight(-start);
  34232. } else if (start) {
  34233. result = result.drop(start);
  34234. }
  34235. if (end !== undefined) {
  34236. end = toInteger(end);
  34237. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  34238. }
  34239. return result;
  34240. };
  34241. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  34242. return this.reverse().takeWhile(predicate).reverse();
  34243. };
  34244. LazyWrapper.prototype.toArray = function() {
  34245. return this.take(MAX_ARRAY_LENGTH);
  34246. };
  34247. // Add `LazyWrapper` methods to `lodash.prototype`.
  34248. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34249. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  34250. isTaker = /^(?:head|last)$/.test(methodName),
  34251. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  34252. retUnwrapped = isTaker || /^find/.test(methodName);
  34253. if (!lodashFunc) {
  34254. return;
  34255. }
  34256. lodash.prototype[methodName] = function() {
  34257. var value = this.__wrapped__,
  34258. args = isTaker ? [1] : arguments,
  34259. isLazy = value instanceof LazyWrapper,
  34260. iteratee = args[0],
  34261. useLazy = isLazy || isArray(value);
  34262. var interceptor = function(value) {
  34263. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  34264. return (isTaker && chainAll) ? result[0] : result;
  34265. };
  34266. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  34267. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  34268. isLazy = useLazy = false;
  34269. }
  34270. var chainAll = this.__chain__,
  34271. isHybrid = !!this.__actions__.length,
  34272. isUnwrapped = retUnwrapped && !chainAll,
  34273. onlyLazy = isLazy && !isHybrid;
  34274. if (!retUnwrapped && useLazy) {
  34275. value = onlyLazy ? value : new LazyWrapper(this);
  34276. var result = func.apply(value, args);
  34277. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  34278. return new LodashWrapper(result, chainAll);
  34279. }
  34280. if (isUnwrapped && onlyLazy) {
  34281. return func.apply(this, args);
  34282. }
  34283. result = this.thru(interceptor);
  34284. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  34285. };
  34286. });
  34287. // Add `Array` methods to `lodash.prototype`.
  34288. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  34289. var func = arrayProto[methodName],
  34290. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  34291. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  34292. lodash.prototype[methodName] = function() {
  34293. var args = arguments;
  34294. if (retUnwrapped && !this.__chain__) {
  34295. var value = this.value();
  34296. return func.apply(isArray(value) ? value : [], args);
  34297. }
  34298. return this[chainName](function(value) {
  34299. return func.apply(isArray(value) ? value : [], args);
  34300. });
  34301. };
  34302. });
  34303. // Map minified method names to their real names.
  34304. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34305. var lodashFunc = lodash[methodName];
  34306. if (lodashFunc) {
  34307. var key = lodashFunc.name + '';
  34308. if (!hasOwnProperty.call(realNames, key)) {
  34309. realNames[key] = [];
  34310. }
  34311. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  34312. }
  34313. });
  34314. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  34315. 'name': 'wrapper',
  34316. 'func': undefined
  34317. }];
  34318. // Add methods to `LazyWrapper`.
  34319. LazyWrapper.prototype.clone = lazyClone;
  34320. LazyWrapper.prototype.reverse = lazyReverse;
  34321. LazyWrapper.prototype.value = lazyValue;
  34322. // Add chain sequence methods to the `lodash` wrapper.
  34323. lodash.prototype.at = wrapperAt;
  34324. lodash.prototype.chain = wrapperChain;
  34325. lodash.prototype.commit = wrapperCommit;
  34326. lodash.prototype.next = wrapperNext;
  34327. lodash.prototype.plant = wrapperPlant;
  34328. lodash.prototype.reverse = wrapperReverse;
  34329. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  34330. // Add lazy aliases.
  34331. lodash.prototype.first = lodash.prototype.head;
  34332. if (symIterator) {
  34333. lodash.prototype[symIterator] = wrapperToIterator;
  34334. }
  34335. return lodash;
  34336. });
  34337. /*--------------------------------------------------------------------------*/
  34338. // Export lodash.
  34339. var _ = runInContext();
  34340. // Some AMD build optimizers, like r.js, check for condition patterns like:
  34341. if (true) {
  34342. // Expose Lodash on the global object to prevent errors when Lodash is
  34343. // loaded by a script tag in the presence of an AMD loader.
  34344. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  34345. // Use `_.noConflict` to remove Lodash from the global object.
  34346. root._ = _;
  34347. // Define as an anonymous module so, through path mapping, it can be
  34348. // referenced as the "underscore" module.
  34349. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  34350. return _;
  34351. }).call(exports, __webpack_require__, exports, module),
  34352. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  34353. }
  34354. // Check for `exports` after `define` in case a build optimizer adds it.
  34355. else {}
  34356. }.call(this));
  34357. /* 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)))
  34358. /***/ }),
  34359. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  34360. /*!***************************************************!*\
  34361. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  34362. \***************************************************/
  34363. /*! exports provided: default */
  34364. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  34365. "use strict";
  34366. __webpack_require__.r(__webpack_exports__);
  34367. /* WEBPACK VAR INJECTION */(function(global) {/**!
  34368. * @fileOverview Kickass library to create and place poppers near their reference elements.
  34369. * @version 1.16.1
  34370. * @license
  34371. * Copyright (c) 2016 Federico Zivolo and contributors
  34372. *
  34373. * Permission is hereby granted, free of charge, to any person obtaining a copy
  34374. * of this software and associated documentation files (the "Software"), to deal
  34375. * in the Software without restriction, including without limitation the rights
  34376. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  34377. * copies of the Software, and to permit persons to whom the Software is
  34378. * furnished to do so, subject to the following conditions:
  34379. *
  34380. * The above copyright notice and this permission notice shall be included in all
  34381. * copies or substantial portions of the Software.
  34382. *
  34383. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  34384. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  34385. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  34386. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  34387. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  34388. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  34389. * SOFTWARE.
  34390. */
  34391. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  34392. var timeoutDuration = function () {
  34393. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  34394. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  34395. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  34396. return 1;
  34397. }
  34398. }
  34399. return 0;
  34400. }();
  34401. function microtaskDebounce(fn) {
  34402. var called = false;
  34403. return function () {
  34404. if (called) {
  34405. return;
  34406. }
  34407. called = true;
  34408. window.Promise.resolve().then(function () {
  34409. called = false;
  34410. fn();
  34411. });
  34412. };
  34413. }
  34414. function taskDebounce(fn) {
  34415. var scheduled = false;
  34416. return function () {
  34417. if (!scheduled) {
  34418. scheduled = true;
  34419. setTimeout(function () {
  34420. scheduled = false;
  34421. fn();
  34422. }, timeoutDuration);
  34423. }
  34424. };
  34425. }
  34426. var supportsMicroTasks = isBrowser && window.Promise;
  34427. /**
  34428. * Create a debounced version of a method, that's asynchronously deferred
  34429. * but called in the minimum time possible.
  34430. *
  34431. * @method
  34432. * @memberof Popper.Utils
  34433. * @argument {Function} fn
  34434. * @returns {Function}
  34435. */
  34436. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  34437. /**
  34438. * Check if the given variable is a function
  34439. * @method
  34440. * @memberof Popper.Utils
  34441. * @argument {Any} functionToCheck - variable to check
  34442. * @returns {Boolean} answer to: is a function?
  34443. */
  34444. function isFunction(functionToCheck) {
  34445. var getType = {};
  34446. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  34447. }
  34448. /**
  34449. * Get CSS computed property of the given element
  34450. * @method
  34451. * @memberof Popper.Utils
  34452. * @argument {Eement} element
  34453. * @argument {String} property
  34454. */
  34455. function getStyleComputedProperty(element, property) {
  34456. if (element.nodeType !== 1) {
  34457. return [];
  34458. }
  34459. // NOTE: 1 DOM access here
  34460. var window = element.ownerDocument.defaultView;
  34461. var css = window.getComputedStyle(element, null);
  34462. return property ? css[property] : css;
  34463. }
  34464. /**
  34465. * Returns the parentNode or the host of the element
  34466. * @method
  34467. * @memberof Popper.Utils
  34468. * @argument {Element} element
  34469. * @returns {Element} parent
  34470. */
  34471. function getParentNode(element) {
  34472. if (element.nodeName === 'HTML') {
  34473. return element;
  34474. }
  34475. return element.parentNode || element.host;
  34476. }
  34477. /**
  34478. * Returns the scrolling parent of the given element
  34479. * @method
  34480. * @memberof Popper.Utils
  34481. * @argument {Element} element
  34482. * @returns {Element} scroll parent
  34483. */
  34484. function getScrollParent(element) {
  34485. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  34486. if (!element) {
  34487. return document.body;
  34488. }
  34489. switch (element.nodeName) {
  34490. case 'HTML':
  34491. case 'BODY':
  34492. return element.ownerDocument.body;
  34493. case '#document':
  34494. return element.body;
  34495. }
  34496. // Firefox want us to check `-x` and `-y` variations as well
  34497. var _getStyleComputedProp = getStyleComputedProperty(element),
  34498. overflow = _getStyleComputedProp.overflow,
  34499. overflowX = _getStyleComputedProp.overflowX,
  34500. overflowY = _getStyleComputedProp.overflowY;
  34501. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  34502. return element;
  34503. }
  34504. return getScrollParent(getParentNode(element));
  34505. }
  34506. /**
  34507. * Returns the reference node of the reference object, or the reference object itself.
  34508. * @method
  34509. * @memberof Popper.Utils
  34510. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  34511. * @returns {Element} parent
  34512. */
  34513. function getReferenceNode(reference) {
  34514. return reference && reference.referenceNode ? reference.referenceNode : reference;
  34515. }
  34516. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  34517. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  34518. /**
  34519. * Determines if the browser is Internet Explorer
  34520. * @method
  34521. * @memberof Popper.Utils
  34522. * @param {Number} version to check
  34523. * @returns {Boolean} isIE
  34524. */
  34525. function isIE(version) {
  34526. if (version === 11) {
  34527. return isIE11;
  34528. }
  34529. if (version === 10) {
  34530. return isIE10;
  34531. }
  34532. return isIE11 || isIE10;
  34533. }
  34534. /**
  34535. * Returns the offset parent of the given element
  34536. * @method
  34537. * @memberof Popper.Utils
  34538. * @argument {Element} element
  34539. * @returns {Element} offset parent
  34540. */
  34541. function getOffsetParent(element) {
  34542. if (!element) {
  34543. return document.documentElement;
  34544. }
  34545. var noOffsetParent = isIE(10) ? document.body : null;
  34546. // NOTE: 1 DOM access here
  34547. var offsetParent = element.offsetParent || null;
  34548. // Skip hidden elements which don't have an offsetParent
  34549. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  34550. offsetParent = (element = element.nextElementSibling).offsetParent;
  34551. }
  34552. var nodeName = offsetParent && offsetParent.nodeName;
  34553. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  34554. return element ? element.ownerDocument.documentElement : document.documentElement;
  34555. }
  34556. // .offsetParent will return the closest TH, TD or TABLE in case
  34557. // no offsetParent is present, I hate this job...
  34558. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  34559. return getOffsetParent(offsetParent);
  34560. }
  34561. return offsetParent;
  34562. }
  34563. function isOffsetContainer(element) {
  34564. var nodeName = element.nodeName;
  34565. if (nodeName === 'BODY') {
  34566. return false;
  34567. }
  34568. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  34569. }
  34570. /**
  34571. * Finds the root node (document, shadowDOM root) of the given element
  34572. * @method
  34573. * @memberof Popper.Utils
  34574. * @argument {Element} node
  34575. * @returns {Element} root node
  34576. */
  34577. function getRoot(node) {
  34578. if (node.parentNode !== null) {
  34579. return getRoot(node.parentNode);
  34580. }
  34581. return node;
  34582. }
  34583. /**
  34584. * Finds the offset parent common to the two provided nodes
  34585. * @method
  34586. * @memberof Popper.Utils
  34587. * @argument {Element} element1
  34588. * @argument {Element} element2
  34589. * @returns {Element} common offset parent
  34590. */
  34591. function findCommonOffsetParent(element1, element2) {
  34592. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34593. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  34594. return document.documentElement;
  34595. }
  34596. // Here we make sure to give as "start" the element that comes first in the DOM
  34597. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  34598. var start = order ? element1 : element2;
  34599. var end = order ? element2 : element1;
  34600. // Get common ancestor container
  34601. var range = document.createRange();
  34602. range.setStart(start, 0);
  34603. range.setEnd(end, 0);
  34604. var commonAncestorContainer = range.commonAncestorContainer;
  34605. // Both nodes are inside #document
  34606. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  34607. if (isOffsetContainer(commonAncestorContainer)) {
  34608. return commonAncestorContainer;
  34609. }
  34610. return getOffsetParent(commonAncestorContainer);
  34611. }
  34612. // one of the nodes is inside shadowDOM, find which one
  34613. var element1root = getRoot(element1);
  34614. if (element1root.host) {
  34615. return findCommonOffsetParent(element1root.host, element2);
  34616. } else {
  34617. return findCommonOffsetParent(element1, getRoot(element2).host);
  34618. }
  34619. }
  34620. /**
  34621. * Gets the scroll value of the given element in the given side (top and left)
  34622. * @method
  34623. * @memberof Popper.Utils
  34624. * @argument {Element} element
  34625. * @argument {String} side `top` or `left`
  34626. * @returns {number} amount of scrolled pixels
  34627. */
  34628. function getScroll(element) {
  34629. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  34630. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  34631. var nodeName = element.nodeName;
  34632. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34633. var html = element.ownerDocument.documentElement;
  34634. var scrollingElement = element.ownerDocument.scrollingElement || html;
  34635. return scrollingElement[upperSide];
  34636. }
  34637. return element[upperSide];
  34638. }
  34639. /*
  34640. * Sum or subtract the element scroll values (left and top) from a given rect object
  34641. * @method
  34642. * @memberof Popper.Utils
  34643. * @param {Object} rect - Rect object you want to change
  34644. * @param {HTMLElement} element - The element from the function reads the scroll values
  34645. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  34646. * @return {Object} rect - The modifier rect object
  34647. */
  34648. function includeScroll(rect, element) {
  34649. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34650. var scrollTop = getScroll(element, 'top');
  34651. var scrollLeft = getScroll(element, 'left');
  34652. var modifier = subtract ? -1 : 1;
  34653. rect.top += scrollTop * modifier;
  34654. rect.bottom += scrollTop * modifier;
  34655. rect.left += scrollLeft * modifier;
  34656. rect.right += scrollLeft * modifier;
  34657. return rect;
  34658. }
  34659. /*
  34660. * Helper to detect borders of a given element
  34661. * @method
  34662. * @memberof Popper.Utils
  34663. * @param {CSSStyleDeclaration} styles
  34664. * Result of `getStyleComputedProperty` on the given element
  34665. * @param {String} axis - `x` or `y`
  34666. * @return {number} borders - The borders size of the given axis
  34667. */
  34668. function getBordersSize(styles, axis) {
  34669. var sideA = axis === 'x' ? 'Left' : 'Top';
  34670. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  34671. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  34672. }
  34673. function getSize(axis, body, html, computedStyle) {
  34674. 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);
  34675. }
  34676. function getWindowSizes(document) {
  34677. var body = document.body;
  34678. var html = document.documentElement;
  34679. var computedStyle = isIE(10) && getComputedStyle(html);
  34680. return {
  34681. height: getSize('Height', body, html, computedStyle),
  34682. width: getSize('Width', body, html, computedStyle)
  34683. };
  34684. }
  34685. var classCallCheck = function (instance, Constructor) {
  34686. if (!(instance instanceof Constructor)) {
  34687. throw new TypeError("Cannot call a class as a function");
  34688. }
  34689. };
  34690. var createClass = function () {
  34691. function defineProperties(target, props) {
  34692. for (var i = 0; i < props.length; i++) {
  34693. var descriptor = props[i];
  34694. descriptor.enumerable = descriptor.enumerable || false;
  34695. descriptor.configurable = true;
  34696. if ("value" in descriptor) descriptor.writable = true;
  34697. Object.defineProperty(target, descriptor.key, descriptor);
  34698. }
  34699. }
  34700. return function (Constructor, protoProps, staticProps) {
  34701. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  34702. if (staticProps) defineProperties(Constructor, staticProps);
  34703. return Constructor;
  34704. };
  34705. }();
  34706. var defineProperty = function (obj, key, value) {
  34707. if (key in obj) {
  34708. Object.defineProperty(obj, key, {
  34709. value: value,
  34710. enumerable: true,
  34711. configurable: true,
  34712. writable: true
  34713. });
  34714. } else {
  34715. obj[key] = value;
  34716. }
  34717. return obj;
  34718. };
  34719. var _extends = Object.assign || function (target) {
  34720. for (var i = 1; i < arguments.length; i++) {
  34721. var source = arguments[i];
  34722. for (var key in source) {
  34723. if (Object.prototype.hasOwnProperty.call(source, key)) {
  34724. target[key] = source[key];
  34725. }
  34726. }
  34727. }
  34728. return target;
  34729. };
  34730. /**
  34731. * Given element offsets, generate an output similar to getBoundingClientRect
  34732. * @method
  34733. * @memberof Popper.Utils
  34734. * @argument {Object} offsets
  34735. * @returns {Object} ClientRect like output
  34736. */
  34737. function getClientRect(offsets) {
  34738. return _extends({}, offsets, {
  34739. right: offsets.left + offsets.width,
  34740. bottom: offsets.top + offsets.height
  34741. });
  34742. }
  34743. /**
  34744. * Get bounding client rect of given element
  34745. * @method
  34746. * @memberof Popper.Utils
  34747. * @param {HTMLElement} element
  34748. * @return {Object} client rect
  34749. */
  34750. function getBoundingClientRect(element) {
  34751. var rect = {};
  34752. // IE10 10 FIX: Please, don't ask, the element isn't
  34753. // considered in DOM in some circumstances...
  34754. // This isn't reproducible in IE10 compatibility mode of IE11
  34755. try {
  34756. if (isIE(10)) {
  34757. rect = element.getBoundingClientRect();
  34758. var scrollTop = getScroll(element, 'top');
  34759. var scrollLeft = getScroll(element, 'left');
  34760. rect.top += scrollTop;
  34761. rect.left += scrollLeft;
  34762. rect.bottom += scrollTop;
  34763. rect.right += scrollLeft;
  34764. } else {
  34765. rect = element.getBoundingClientRect();
  34766. }
  34767. } catch (e) {}
  34768. var result = {
  34769. left: rect.left,
  34770. top: rect.top,
  34771. width: rect.right - rect.left,
  34772. height: rect.bottom - rect.top
  34773. };
  34774. // subtract scrollbar size from sizes
  34775. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  34776. var width = sizes.width || element.clientWidth || result.width;
  34777. var height = sizes.height || element.clientHeight || result.height;
  34778. var horizScrollbar = element.offsetWidth - width;
  34779. var vertScrollbar = element.offsetHeight - height;
  34780. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  34781. // we make this check conditional for performance reasons
  34782. if (horizScrollbar || vertScrollbar) {
  34783. var styles = getStyleComputedProperty(element);
  34784. horizScrollbar -= getBordersSize(styles, 'x');
  34785. vertScrollbar -= getBordersSize(styles, 'y');
  34786. result.width -= horizScrollbar;
  34787. result.height -= vertScrollbar;
  34788. }
  34789. return getClientRect(result);
  34790. }
  34791. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  34792. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34793. var isIE10 = isIE(10);
  34794. var isHTML = parent.nodeName === 'HTML';
  34795. var childrenRect = getBoundingClientRect(children);
  34796. var parentRect = getBoundingClientRect(parent);
  34797. var scrollParent = getScrollParent(children);
  34798. var styles = getStyleComputedProperty(parent);
  34799. var borderTopWidth = parseFloat(styles.borderTopWidth);
  34800. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  34801. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  34802. if (fixedPosition && isHTML) {
  34803. parentRect.top = Math.max(parentRect.top, 0);
  34804. parentRect.left = Math.max(parentRect.left, 0);
  34805. }
  34806. var offsets = getClientRect({
  34807. top: childrenRect.top - parentRect.top - borderTopWidth,
  34808. left: childrenRect.left - parentRect.left - borderLeftWidth,
  34809. width: childrenRect.width,
  34810. height: childrenRect.height
  34811. });
  34812. offsets.marginTop = 0;
  34813. offsets.marginLeft = 0;
  34814. // Subtract margins of documentElement in case it's being used as parent
  34815. // we do this only on HTML because it's the only element that behaves
  34816. // differently when margins are applied to it. The margins are included in
  34817. // the box of the documentElement, in the other cases not.
  34818. if (!isIE10 && isHTML) {
  34819. var marginTop = parseFloat(styles.marginTop);
  34820. var marginLeft = parseFloat(styles.marginLeft);
  34821. offsets.top -= borderTopWidth - marginTop;
  34822. offsets.bottom -= borderTopWidth - marginTop;
  34823. offsets.left -= borderLeftWidth - marginLeft;
  34824. offsets.right -= borderLeftWidth - marginLeft;
  34825. // Attach marginTop and marginLeft because in some circumstances we may need them
  34826. offsets.marginTop = marginTop;
  34827. offsets.marginLeft = marginLeft;
  34828. }
  34829. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  34830. offsets = includeScroll(offsets, parent);
  34831. }
  34832. return offsets;
  34833. }
  34834. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  34835. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  34836. var html = element.ownerDocument.documentElement;
  34837. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  34838. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  34839. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  34840. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  34841. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  34842. var offset = {
  34843. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  34844. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  34845. width: width,
  34846. height: height
  34847. };
  34848. return getClientRect(offset);
  34849. }
  34850. /**
  34851. * Check if the given element is fixed or is inside a fixed parent
  34852. * @method
  34853. * @memberof Popper.Utils
  34854. * @argument {Element} element
  34855. * @argument {Element} customContainer
  34856. * @returns {Boolean} answer to "isFixed?"
  34857. */
  34858. function isFixed(element) {
  34859. var nodeName = element.nodeName;
  34860. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34861. return false;
  34862. }
  34863. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  34864. return true;
  34865. }
  34866. var parentNode = getParentNode(element);
  34867. if (!parentNode) {
  34868. return false;
  34869. }
  34870. return isFixed(parentNode);
  34871. }
  34872. /**
  34873. * Finds the first parent of an element that has a transformed property defined
  34874. * @method
  34875. * @memberof Popper.Utils
  34876. * @argument {Element} element
  34877. * @returns {Element} first transformed parent or documentElement
  34878. */
  34879. function getFixedPositionOffsetParent(element) {
  34880. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34881. if (!element || !element.parentElement || isIE()) {
  34882. return document.documentElement;
  34883. }
  34884. var el = element.parentElement;
  34885. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  34886. el = el.parentElement;
  34887. }
  34888. return el || document.documentElement;
  34889. }
  34890. /**
  34891. * Computed the boundaries limits and return them
  34892. * @method
  34893. * @memberof Popper.Utils
  34894. * @param {HTMLElement} popper
  34895. * @param {HTMLElement} reference
  34896. * @param {number} padding
  34897. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  34898. * @param {Boolean} fixedPosition - Is in fixed position mode
  34899. * @returns {Object} Coordinates of the boundaries
  34900. */
  34901. function getBoundaries(popper, reference, padding, boundariesElement) {
  34902. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  34903. // NOTE: 1 DOM access here
  34904. var boundaries = { top: 0, left: 0 };
  34905. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34906. // Handle viewport case
  34907. if (boundariesElement === 'viewport') {
  34908. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  34909. } else {
  34910. // Handle other cases based on DOM element used as boundaries
  34911. var boundariesNode = void 0;
  34912. if (boundariesElement === 'scrollParent') {
  34913. boundariesNode = getScrollParent(getParentNode(reference));
  34914. if (boundariesNode.nodeName === 'BODY') {
  34915. boundariesNode = popper.ownerDocument.documentElement;
  34916. }
  34917. } else if (boundariesElement === 'window') {
  34918. boundariesNode = popper.ownerDocument.documentElement;
  34919. } else {
  34920. boundariesNode = boundariesElement;
  34921. }
  34922. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  34923. // In case of HTML, we need a different computation
  34924. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  34925. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  34926. height = _getWindowSizes.height,
  34927. width = _getWindowSizes.width;
  34928. boundaries.top += offsets.top - offsets.marginTop;
  34929. boundaries.bottom = height + offsets.top;
  34930. boundaries.left += offsets.left - offsets.marginLeft;
  34931. boundaries.right = width + offsets.left;
  34932. } else {
  34933. // for all the other DOM elements, this one is good
  34934. boundaries = offsets;
  34935. }
  34936. }
  34937. // Add paddings
  34938. padding = padding || 0;
  34939. var isPaddingNumber = typeof padding === 'number';
  34940. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  34941. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  34942. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  34943. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  34944. return boundaries;
  34945. }
  34946. function getArea(_ref) {
  34947. var width = _ref.width,
  34948. height = _ref.height;
  34949. return width * height;
  34950. }
  34951. /**
  34952. * Utility used to transform the `auto` placement to the placement with more
  34953. * available space.
  34954. * @method
  34955. * @memberof Popper.Utils
  34956. * @argument {Object} data - The data object generated by update method
  34957. * @argument {Object} options - Modifiers configuration and options
  34958. * @returns {Object} The data object, properly modified
  34959. */
  34960. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  34961. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  34962. if (placement.indexOf('auto') === -1) {
  34963. return placement;
  34964. }
  34965. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  34966. var rects = {
  34967. top: {
  34968. width: boundaries.width,
  34969. height: refRect.top - boundaries.top
  34970. },
  34971. right: {
  34972. width: boundaries.right - refRect.right,
  34973. height: boundaries.height
  34974. },
  34975. bottom: {
  34976. width: boundaries.width,
  34977. height: boundaries.bottom - refRect.bottom
  34978. },
  34979. left: {
  34980. width: refRect.left - boundaries.left,
  34981. height: boundaries.height
  34982. }
  34983. };
  34984. var sortedAreas = Object.keys(rects).map(function (key) {
  34985. return _extends({
  34986. key: key
  34987. }, rects[key], {
  34988. area: getArea(rects[key])
  34989. });
  34990. }).sort(function (a, b) {
  34991. return b.area - a.area;
  34992. });
  34993. var filteredAreas = sortedAreas.filter(function (_ref2) {
  34994. var width = _ref2.width,
  34995. height = _ref2.height;
  34996. return width >= popper.clientWidth && height >= popper.clientHeight;
  34997. });
  34998. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  34999. var variation = placement.split('-')[1];
  35000. return computedPlacement + (variation ? '-' + variation : '');
  35001. }
  35002. /**
  35003. * Get offsets to the reference element
  35004. * @method
  35005. * @memberof Popper.Utils
  35006. * @param {Object} state
  35007. * @param {Element} popper - the popper element
  35008. * @param {Element} reference - the reference element (the popper will be relative to this)
  35009. * @param {Element} fixedPosition - is in fixed position mode
  35010. * @returns {Object} An object containing the offsets which will be applied to the popper
  35011. */
  35012. function getReferenceOffsets(state, popper, reference) {
  35013. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  35014. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35015. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  35016. }
  35017. /**
  35018. * Get the outer sizes of the given element (offset size + margins)
  35019. * @method
  35020. * @memberof Popper.Utils
  35021. * @argument {Element} element
  35022. * @returns {Object} object containing width and height properties
  35023. */
  35024. function getOuterSizes(element) {
  35025. var window = element.ownerDocument.defaultView;
  35026. var styles = window.getComputedStyle(element);
  35027. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  35028. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  35029. var result = {
  35030. width: element.offsetWidth + y,
  35031. height: element.offsetHeight + x
  35032. };
  35033. return result;
  35034. }
  35035. /**
  35036. * Get the opposite placement of the given one
  35037. * @method
  35038. * @memberof Popper.Utils
  35039. * @argument {String} placement
  35040. * @returns {String} flipped placement
  35041. */
  35042. function getOppositePlacement(placement) {
  35043. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  35044. return placement.replace(/left|right|bottom|top/g, function (matched) {
  35045. return hash[matched];
  35046. });
  35047. }
  35048. /**
  35049. * Get offsets to the popper
  35050. * @method
  35051. * @memberof Popper.Utils
  35052. * @param {Object} position - CSS position the Popper will get applied
  35053. * @param {HTMLElement} popper - the popper element
  35054. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  35055. * @param {String} placement - one of the valid placement options
  35056. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  35057. */
  35058. function getPopperOffsets(popper, referenceOffsets, placement) {
  35059. placement = placement.split('-')[0];
  35060. // Get popper node sizes
  35061. var popperRect = getOuterSizes(popper);
  35062. // Add position, width and height to our offsets object
  35063. var popperOffsets = {
  35064. width: popperRect.width,
  35065. height: popperRect.height
  35066. };
  35067. // depending by the popper placement we have to compute its offsets slightly differently
  35068. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  35069. var mainSide = isHoriz ? 'top' : 'left';
  35070. var secondarySide = isHoriz ? 'left' : 'top';
  35071. var measurement = isHoriz ? 'height' : 'width';
  35072. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  35073. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  35074. if (placement === secondarySide) {
  35075. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  35076. } else {
  35077. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  35078. }
  35079. return popperOffsets;
  35080. }
  35081. /**
  35082. * Mimics the `find` method of Array
  35083. * @method
  35084. * @memberof Popper.Utils
  35085. * @argument {Array} arr
  35086. * @argument prop
  35087. * @argument value
  35088. * @returns index or -1
  35089. */
  35090. function find(arr, check) {
  35091. // use native find if supported
  35092. if (Array.prototype.find) {
  35093. return arr.find(check);
  35094. }
  35095. // use `filter` to obtain the same behavior of `find`
  35096. return arr.filter(check)[0];
  35097. }
  35098. /**
  35099. * Return the index of the matching object
  35100. * @method
  35101. * @memberof Popper.Utils
  35102. * @argument {Array} arr
  35103. * @argument prop
  35104. * @argument value
  35105. * @returns index or -1
  35106. */
  35107. function findIndex(arr, prop, value) {
  35108. // use native findIndex if supported
  35109. if (Array.prototype.findIndex) {
  35110. return arr.findIndex(function (cur) {
  35111. return cur[prop] === value;
  35112. });
  35113. }
  35114. // use `find` + `indexOf` if `findIndex` isn't supported
  35115. var match = find(arr, function (obj) {
  35116. return obj[prop] === value;
  35117. });
  35118. return arr.indexOf(match);
  35119. }
  35120. /**
  35121. * Loop trough the list of modifiers and run them in order,
  35122. * each of them will then edit the data object.
  35123. * @method
  35124. * @memberof Popper.Utils
  35125. * @param {dataObject} data
  35126. * @param {Array} modifiers
  35127. * @param {String} ends - Optional modifier name used as stopper
  35128. * @returns {dataObject}
  35129. */
  35130. function runModifiers(modifiers, data, ends) {
  35131. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  35132. modifiersToRun.forEach(function (modifier) {
  35133. if (modifier['function']) {
  35134. // eslint-disable-line dot-notation
  35135. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  35136. }
  35137. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  35138. if (modifier.enabled && isFunction(fn)) {
  35139. // Add properties to offsets to make them a complete clientRect object
  35140. // we do this before each modifier to make sure the previous one doesn't
  35141. // mess with these values
  35142. data.offsets.popper = getClientRect(data.offsets.popper);
  35143. data.offsets.reference = getClientRect(data.offsets.reference);
  35144. data = fn(data, modifier);
  35145. }
  35146. });
  35147. return data;
  35148. }
  35149. /**
  35150. * Updates the position of the popper, computing the new offsets and applying
  35151. * the new style.<br />
  35152. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  35153. * @method
  35154. * @memberof Popper
  35155. */
  35156. function update() {
  35157. // if popper is destroyed, don't perform any further update
  35158. if (this.state.isDestroyed) {
  35159. return;
  35160. }
  35161. var data = {
  35162. instance: this,
  35163. styles: {},
  35164. arrowStyles: {},
  35165. attributes: {},
  35166. flipped: false,
  35167. offsets: {}
  35168. };
  35169. // compute reference element offsets
  35170. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  35171. // compute auto placement, store placement inside the data object,
  35172. // modifiers will be able to edit `placement` if needed
  35173. // and refer to originalPlacement to know the original value
  35174. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  35175. // store the computed placement inside `originalPlacement`
  35176. data.originalPlacement = data.placement;
  35177. data.positionFixed = this.options.positionFixed;
  35178. // compute the popper offsets
  35179. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  35180. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  35181. // run the modifiers
  35182. data = runModifiers(this.modifiers, data);
  35183. // the first `update` will call `onCreate` callback
  35184. // the other ones will call `onUpdate` callback
  35185. if (!this.state.isCreated) {
  35186. this.state.isCreated = true;
  35187. this.options.onCreate(data);
  35188. } else {
  35189. this.options.onUpdate(data);
  35190. }
  35191. }
  35192. /**
  35193. * Helper used to know if the given modifier is enabled.
  35194. * @method
  35195. * @memberof Popper.Utils
  35196. * @returns {Boolean}
  35197. */
  35198. function isModifierEnabled(modifiers, modifierName) {
  35199. return modifiers.some(function (_ref) {
  35200. var name = _ref.name,
  35201. enabled = _ref.enabled;
  35202. return enabled && name === modifierName;
  35203. });
  35204. }
  35205. /**
  35206. * Get the prefixed supported property name
  35207. * @method
  35208. * @memberof Popper.Utils
  35209. * @argument {String} property (camelCase)
  35210. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  35211. */
  35212. function getSupportedPropertyName(property) {
  35213. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  35214. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  35215. for (var i = 0; i < prefixes.length; i++) {
  35216. var prefix = prefixes[i];
  35217. var toCheck = prefix ? '' + prefix + upperProp : property;
  35218. if (typeof document.body.style[toCheck] !== 'undefined') {
  35219. return toCheck;
  35220. }
  35221. }
  35222. return null;
  35223. }
  35224. /**
  35225. * Destroys the popper.
  35226. * @method
  35227. * @memberof Popper
  35228. */
  35229. function destroy() {
  35230. this.state.isDestroyed = true;
  35231. // touch DOM only if `applyStyle` modifier is enabled
  35232. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  35233. this.popper.removeAttribute('x-placement');
  35234. this.popper.style.position = '';
  35235. this.popper.style.top = '';
  35236. this.popper.style.left = '';
  35237. this.popper.style.right = '';
  35238. this.popper.style.bottom = '';
  35239. this.popper.style.willChange = '';
  35240. this.popper.style[getSupportedPropertyName('transform')] = '';
  35241. }
  35242. this.disableEventListeners();
  35243. // remove the popper if user explicitly asked for the deletion on destroy
  35244. // do not use `remove` because IE11 doesn't support it
  35245. if (this.options.removeOnDestroy) {
  35246. this.popper.parentNode.removeChild(this.popper);
  35247. }
  35248. return this;
  35249. }
  35250. /**
  35251. * Get the window associated with the element
  35252. * @argument {Element} element
  35253. * @returns {Window}
  35254. */
  35255. function getWindow(element) {
  35256. var ownerDocument = element.ownerDocument;
  35257. return ownerDocument ? ownerDocument.defaultView : window;
  35258. }
  35259. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  35260. var isBody = scrollParent.nodeName === 'BODY';
  35261. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  35262. target.addEventListener(event, callback, { passive: true });
  35263. if (!isBody) {
  35264. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  35265. }
  35266. scrollParents.push(target);
  35267. }
  35268. /**
  35269. * Setup needed event listeners used to update the popper position
  35270. * @method
  35271. * @memberof Popper.Utils
  35272. * @private
  35273. */
  35274. function setupEventListeners(reference, options, state, updateBound) {
  35275. // Resize event listener on window
  35276. state.updateBound = updateBound;
  35277. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  35278. // Scroll event listener on scroll parents
  35279. var scrollElement = getScrollParent(reference);
  35280. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  35281. state.scrollElement = scrollElement;
  35282. state.eventsEnabled = true;
  35283. return state;
  35284. }
  35285. /**
  35286. * It will add resize/scroll events and start recalculating
  35287. * position of the popper element when they are triggered.
  35288. * @method
  35289. * @memberof Popper
  35290. */
  35291. function enableEventListeners() {
  35292. if (!this.state.eventsEnabled) {
  35293. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  35294. }
  35295. }
  35296. /**
  35297. * Remove event listeners used to update the popper position
  35298. * @method
  35299. * @memberof Popper.Utils
  35300. * @private
  35301. */
  35302. function removeEventListeners(reference, state) {
  35303. // Remove resize event listener on window
  35304. getWindow(reference).removeEventListener('resize', state.updateBound);
  35305. // Remove scroll event listener on scroll parents
  35306. state.scrollParents.forEach(function (target) {
  35307. target.removeEventListener('scroll', state.updateBound);
  35308. });
  35309. // Reset state
  35310. state.updateBound = null;
  35311. state.scrollParents = [];
  35312. state.scrollElement = null;
  35313. state.eventsEnabled = false;
  35314. return state;
  35315. }
  35316. /**
  35317. * It will remove resize/scroll events and won't recalculate popper position
  35318. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  35319. * unless you call `update` method manually.
  35320. * @method
  35321. * @memberof Popper
  35322. */
  35323. function disableEventListeners() {
  35324. if (this.state.eventsEnabled) {
  35325. cancelAnimationFrame(this.scheduleUpdate);
  35326. this.state = removeEventListeners(this.reference, this.state);
  35327. }
  35328. }
  35329. /**
  35330. * Tells if a given input is a number
  35331. * @method
  35332. * @memberof Popper.Utils
  35333. * @param {*} input to check
  35334. * @return {Boolean}
  35335. */
  35336. function isNumeric(n) {
  35337. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  35338. }
  35339. /**
  35340. * Set the style to the given popper
  35341. * @method
  35342. * @memberof Popper.Utils
  35343. * @argument {Element} element - Element to apply the style to
  35344. * @argument {Object} styles
  35345. * Object with a list of properties and values which will be applied to the element
  35346. */
  35347. function setStyles(element, styles) {
  35348. Object.keys(styles).forEach(function (prop) {
  35349. var unit = '';
  35350. // add unit if the value is numeric and is one of the following
  35351. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  35352. unit = 'px';
  35353. }
  35354. element.style[prop] = styles[prop] + unit;
  35355. });
  35356. }
  35357. /**
  35358. * Set the attributes to the given popper
  35359. * @method
  35360. * @memberof Popper.Utils
  35361. * @argument {Element} element - Element to apply the attributes to
  35362. * @argument {Object} styles
  35363. * Object with a list of properties and values which will be applied to the element
  35364. */
  35365. function setAttributes(element, attributes) {
  35366. Object.keys(attributes).forEach(function (prop) {
  35367. var value = attributes[prop];
  35368. if (value !== false) {
  35369. element.setAttribute(prop, attributes[prop]);
  35370. } else {
  35371. element.removeAttribute(prop);
  35372. }
  35373. });
  35374. }
  35375. /**
  35376. * @function
  35377. * @memberof Modifiers
  35378. * @argument {Object} data - The data object generated by `update` method
  35379. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  35380. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  35381. * @argument {Object} options - Modifiers configuration and options
  35382. * @returns {Object} The same data object
  35383. */
  35384. function applyStyle(data) {
  35385. // any property present in `data.styles` will be applied to the popper,
  35386. // in this way we can make the 3rd party modifiers add custom styles to it
  35387. // Be aware, modifiers could override the properties defined in the previous
  35388. // lines of this modifier!
  35389. setStyles(data.instance.popper, data.styles);
  35390. // any property present in `data.attributes` will be applied to the popper,
  35391. // they will be set as HTML attributes of the element
  35392. setAttributes(data.instance.popper, data.attributes);
  35393. // if arrowElement is defined and arrowStyles has some properties
  35394. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  35395. setStyles(data.arrowElement, data.arrowStyles);
  35396. }
  35397. return data;
  35398. }
  35399. /**
  35400. * Set the x-placement attribute before everything else because it could be used
  35401. * to add margins to the popper margins needs to be calculated to get the
  35402. * correct popper offsets.
  35403. * @method
  35404. * @memberof Popper.modifiers
  35405. * @param {HTMLElement} reference - The reference element used to position the popper
  35406. * @param {HTMLElement} popper - The HTML element used as popper
  35407. * @param {Object} options - Popper.js options
  35408. */
  35409. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  35410. // compute reference element offsets
  35411. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  35412. // compute auto placement, store placement inside the data object,
  35413. // modifiers will be able to edit `placement` if needed
  35414. // and refer to originalPlacement to know the original value
  35415. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  35416. popper.setAttribute('x-placement', placement);
  35417. // Apply `position` to popper before anything else because
  35418. // without the position applied we can't guarantee correct computations
  35419. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  35420. return options;
  35421. }
  35422. /**
  35423. * @function
  35424. * @memberof Popper.Utils
  35425. * @argument {Object} data - The data object generated by `update` method
  35426. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  35427. * @returns {Object} The popper's position offsets rounded
  35428. *
  35429. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  35430. * good as it can be within reason.
  35431. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  35432. *
  35433. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  35434. * as well on High DPI screens).
  35435. *
  35436. * Firefox prefers no rounding for positioning and does not have blurriness on
  35437. * high DPI screens.
  35438. *
  35439. * Only horizontal placement and left/right values need to be considered.
  35440. */
  35441. function getRoundedOffsets(data, shouldRound) {
  35442. var _data$offsets = data.offsets,
  35443. popper = _data$offsets.popper,
  35444. reference = _data$offsets.reference;
  35445. var round = Math.round,
  35446. floor = Math.floor;
  35447. var noRound = function noRound(v) {
  35448. return v;
  35449. };
  35450. var referenceWidth = round(reference.width);
  35451. var popperWidth = round(popper.width);
  35452. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  35453. var isVariation = data.placement.indexOf('-') !== -1;
  35454. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  35455. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  35456. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  35457. var verticalToInteger = !shouldRound ? noRound : round;
  35458. return {
  35459. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  35460. top: verticalToInteger(popper.top),
  35461. bottom: verticalToInteger(popper.bottom),
  35462. right: horizontalToInteger(popper.right)
  35463. };
  35464. }
  35465. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  35466. /**
  35467. * @function
  35468. * @memberof Modifiers
  35469. * @argument {Object} data - The data object generated by `update` method
  35470. * @argument {Object} options - Modifiers configuration and options
  35471. * @returns {Object} The data object, properly modified
  35472. */
  35473. function computeStyle(data, options) {
  35474. var x = options.x,
  35475. y = options.y;
  35476. var popper = data.offsets.popper;
  35477. // Remove this legacy support in Popper.js v2
  35478. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  35479. return modifier.name === 'applyStyle';
  35480. }).gpuAcceleration;
  35481. if (legacyGpuAccelerationOption !== undefined) {
  35482. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  35483. }
  35484. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  35485. var offsetParent = getOffsetParent(data.instance.popper);
  35486. var offsetParentRect = getBoundingClientRect(offsetParent);
  35487. // Styles
  35488. var styles = {
  35489. position: popper.position
  35490. };
  35491. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  35492. var sideA = x === 'bottom' ? 'top' : 'bottom';
  35493. var sideB = y === 'right' ? 'left' : 'right';
  35494. // if gpuAcceleration is set to `true` and transform is supported,
  35495. // we use `translate3d` to apply the position to the popper we
  35496. // automatically use the supported prefixed version if needed
  35497. var prefixedProperty = getSupportedPropertyName('transform');
  35498. // now, let's make a step back and look at this code closely (wtf?)
  35499. // If the content of the popper grows once it's been positioned, it
  35500. // may happen that the popper gets misplaced because of the new content
  35501. // overflowing its reference element
  35502. // To avoid this problem, we provide two options (x and y), which allow
  35503. // the consumer to define the offset origin.
  35504. // If we position a popper on top of a reference element, we can set
  35505. // `x` to `top` to make the popper grow towards its top instead of
  35506. // its bottom.
  35507. var left = void 0,
  35508. top = void 0;
  35509. if (sideA === 'bottom') {
  35510. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  35511. // and not the bottom of the html element
  35512. if (offsetParent.nodeName === 'HTML') {
  35513. top = -offsetParent.clientHeight + offsets.bottom;
  35514. } else {
  35515. top = -offsetParentRect.height + offsets.bottom;
  35516. }
  35517. } else {
  35518. top = offsets.top;
  35519. }
  35520. if (sideB === 'right') {
  35521. if (offsetParent.nodeName === 'HTML') {
  35522. left = -offsetParent.clientWidth + offsets.right;
  35523. } else {
  35524. left = -offsetParentRect.width + offsets.right;
  35525. }
  35526. } else {
  35527. left = offsets.left;
  35528. }
  35529. if (gpuAcceleration && prefixedProperty) {
  35530. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  35531. styles[sideA] = 0;
  35532. styles[sideB] = 0;
  35533. styles.willChange = 'transform';
  35534. } else {
  35535. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  35536. var invertTop = sideA === 'bottom' ? -1 : 1;
  35537. var invertLeft = sideB === 'right' ? -1 : 1;
  35538. styles[sideA] = top * invertTop;
  35539. styles[sideB] = left * invertLeft;
  35540. styles.willChange = sideA + ', ' + sideB;
  35541. }
  35542. // Attributes
  35543. var attributes = {
  35544. 'x-placement': data.placement
  35545. };
  35546. // Update `data` attributes, styles and arrowStyles
  35547. data.attributes = _extends({}, attributes, data.attributes);
  35548. data.styles = _extends({}, styles, data.styles);
  35549. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  35550. return data;
  35551. }
  35552. /**
  35553. * Helper used to know if the given modifier depends from another one.<br />
  35554. * It checks if the needed modifier is listed and enabled.
  35555. * @method
  35556. * @memberof Popper.Utils
  35557. * @param {Array} modifiers - list of modifiers
  35558. * @param {String} requestingName - name of requesting modifier
  35559. * @param {String} requestedName - name of requested modifier
  35560. * @returns {Boolean}
  35561. */
  35562. function isModifierRequired(modifiers, requestingName, requestedName) {
  35563. var requesting = find(modifiers, function (_ref) {
  35564. var name = _ref.name;
  35565. return name === requestingName;
  35566. });
  35567. var isRequired = !!requesting && modifiers.some(function (modifier) {
  35568. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  35569. });
  35570. if (!isRequired) {
  35571. var _requesting = '`' + requestingName + '`';
  35572. var requested = '`' + requestedName + '`';
  35573. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  35574. }
  35575. return isRequired;
  35576. }
  35577. /**
  35578. * @function
  35579. * @memberof Modifiers
  35580. * @argument {Object} data - The data object generated by update method
  35581. * @argument {Object} options - Modifiers configuration and options
  35582. * @returns {Object} The data object, properly modified
  35583. */
  35584. function arrow(data, options) {
  35585. var _data$offsets$arrow;
  35586. // arrow depends on keepTogether in order to work
  35587. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  35588. return data;
  35589. }
  35590. var arrowElement = options.element;
  35591. // if arrowElement is a string, suppose it's a CSS selector
  35592. if (typeof arrowElement === 'string') {
  35593. arrowElement = data.instance.popper.querySelector(arrowElement);
  35594. // if arrowElement is not found, don't run the modifier
  35595. if (!arrowElement) {
  35596. return data;
  35597. }
  35598. } else {
  35599. // if the arrowElement isn't a query selector we must check that the
  35600. // provided DOM node is child of its popper node
  35601. if (!data.instance.popper.contains(arrowElement)) {
  35602. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  35603. return data;
  35604. }
  35605. }
  35606. var placement = data.placement.split('-')[0];
  35607. var _data$offsets = data.offsets,
  35608. popper = _data$offsets.popper,
  35609. reference = _data$offsets.reference;
  35610. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  35611. var len = isVertical ? 'height' : 'width';
  35612. var sideCapitalized = isVertical ? 'Top' : 'Left';
  35613. var side = sideCapitalized.toLowerCase();
  35614. var altSide = isVertical ? 'left' : 'top';
  35615. var opSide = isVertical ? 'bottom' : 'right';
  35616. var arrowElementSize = getOuterSizes(arrowElement)[len];
  35617. //
  35618. // extends keepTogether behavior making sure the popper and its
  35619. // reference have enough pixels in conjunction
  35620. //
  35621. // top/left side
  35622. if (reference[opSide] - arrowElementSize < popper[side]) {
  35623. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  35624. }
  35625. // bottom/right side
  35626. if (reference[side] + arrowElementSize > popper[opSide]) {
  35627. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  35628. }
  35629. data.offsets.popper = getClientRect(data.offsets.popper);
  35630. // compute center of the popper
  35631. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  35632. // Compute the sideValue using the updated popper offsets
  35633. // take popper margin in account because we don't have this info available
  35634. var css = getStyleComputedProperty(data.instance.popper);
  35635. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  35636. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  35637. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  35638. // prevent arrowElement from being placed not contiguously to its popper
  35639. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  35640. data.arrowElement = arrowElement;
  35641. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  35642. return data;
  35643. }
  35644. /**
  35645. * Get the opposite placement variation of the given one
  35646. * @method
  35647. * @memberof Popper.Utils
  35648. * @argument {String} placement variation
  35649. * @returns {String} flipped placement variation
  35650. */
  35651. function getOppositeVariation(variation) {
  35652. if (variation === 'end') {
  35653. return 'start';
  35654. } else if (variation === 'start') {
  35655. return 'end';
  35656. }
  35657. return variation;
  35658. }
  35659. /**
  35660. * List of accepted placements to use as values of the `placement` option.<br />
  35661. * Valid placements are:
  35662. * - `auto`
  35663. * - `top`
  35664. * - `right`
  35665. * - `bottom`
  35666. * - `left`
  35667. *
  35668. * Each placement can have a variation from this list:
  35669. * - `-start`
  35670. * - `-end`
  35671. *
  35672. * Variations are interpreted easily if you think of them as the left to right
  35673. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  35674. * is right.<br />
  35675. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  35676. *
  35677. * Some valid examples are:
  35678. * - `top-end` (on top of reference, right aligned)
  35679. * - `right-start` (on right of reference, top aligned)
  35680. * - `bottom` (on bottom, centered)
  35681. * - `auto-end` (on the side with more space available, alignment depends by placement)
  35682. *
  35683. * @static
  35684. * @type {Array}
  35685. * @enum {String}
  35686. * @readonly
  35687. * @method placements
  35688. * @memberof Popper
  35689. */
  35690. 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'];
  35691. // Get rid of `auto` `auto-start` and `auto-end`
  35692. var validPlacements = placements.slice(3);
  35693. /**
  35694. * Given an initial placement, returns all the subsequent placements
  35695. * clockwise (or counter-clockwise).
  35696. *
  35697. * @method
  35698. * @memberof Popper.Utils
  35699. * @argument {String} placement - A valid placement (it accepts variations)
  35700. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  35701. * @returns {Array} placements including their variations
  35702. */
  35703. function clockwise(placement) {
  35704. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35705. var index = validPlacements.indexOf(placement);
  35706. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  35707. return counter ? arr.reverse() : arr;
  35708. }
  35709. var BEHAVIORS = {
  35710. FLIP: 'flip',
  35711. CLOCKWISE: 'clockwise',
  35712. COUNTERCLOCKWISE: 'counterclockwise'
  35713. };
  35714. /**
  35715. * @function
  35716. * @memberof Modifiers
  35717. * @argument {Object} data - The data object generated by update method
  35718. * @argument {Object} options - Modifiers configuration and options
  35719. * @returns {Object} The data object, properly modified
  35720. */
  35721. function flip(data, options) {
  35722. // if `inner` modifier is enabled, we can't use the `flip` modifier
  35723. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  35724. return data;
  35725. }
  35726. if (data.flipped && data.placement === data.originalPlacement) {
  35727. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  35728. return data;
  35729. }
  35730. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  35731. var placement = data.placement.split('-')[0];
  35732. var placementOpposite = getOppositePlacement(placement);
  35733. var variation = data.placement.split('-')[1] || '';
  35734. var flipOrder = [];
  35735. switch (options.behavior) {
  35736. case BEHAVIORS.FLIP:
  35737. flipOrder = [placement, placementOpposite];
  35738. break;
  35739. case BEHAVIORS.CLOCKWISE:
  35740. flipOrder = clockwise(placement);
  35741. break;
  35742. case BEHAVIORS.COUNTERCLOCKWISE:
  35743. flipOrder = clockwise(placement, true);
  35744. break;
  35745. default:
  35746. flipOrder = options.behavior;
  35747. }
  35748. flipOrder.forEach(function (step, index) {
  35749. if (placement !== step || flipOrder.length === index + 1) {
  35750. return data;
  35751. }
  35752. placement = data.placement.split('-')[0];
  35753. placementOpposite = getOppositePlacement(placement);
  35754. var popperOffsets = data.offsets.popper;
  35755. var refOffsets = data.offsets.reference;
  35756. // using floor because the reference offsets may contain decimals we are not going to consider here
  35757. var floor = Math.floor;
  35758. 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);
  35759. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  35760. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  35761. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  35762. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  35763. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  35764. // flip the variation if required
  35765. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35766. // flips variation if reference element overflows boundaries
  35767. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  35768. // flips variation if popper content overflows boundaries
  35769. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  35770. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  35771. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  35772. // this boolean to detect any flip loop
  35773. data.flipped = true;
  35774. if (overlapsRef || overflowsBoundaries) {
  35775. placement = flipOrder[index + 1];
  35776. }
  35777. if (flippedVariation) {
  35778. variation = getOppositeVariation(variation);
  35779. }
  35780. data.placement = placement + (variation ? '-' + variation : '');
  35781. // this object contains `position`, we want to preserve it along with
  35782. // any additional property we may add in the future
  35783. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  35784. data = runModifiers(data.instance.modifiers, data, 'flip');
  35785. }
  35786. });
  35787. return data;
  35788. }
  35789. /**
  35790. * @function
  35791. * @memberof Modifiers
  35792. * @argument {Object} data - The data object generated by update method
  35793. * @argument {Object} options - Modifiers configuration and options
  35794. * @returns {Object} The data object, properly modified
  35795. */
  35796. function keepTogether(data) {
  35797. var _data$offsets = data.offsets,
  35798. popper = _data$offsets.popper,
  35799. reference = _data$offsets.reference;
  35800. var placement = data.placement.split('-')[0];
  35801. var floor = Math.floor;
  35802. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35803. var side = isVertical ? 'right' : 'bottom';
  35804. var opSide = isVertical ? 'left' : 'top';
  35805. var measurement = isVertical ? 'width' : 'height';
  35806. if (popper[side] < floor(reference[opSide])) {
  35807. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  35808. }
  35809. if (popper[opSide] > floor(reference[side])) {
  35810. data.offsets.popper[opSide] = floor(reference[side]);
  35811. }
  35812. return data;
  35813. }
  35814. /**
  35815. * Converts a string containing value + unit into a px value number
  35816. * @function
  35817. * @memberof {modifiers~offset}
  35818. * @private
  35819. * @argument {String} str - Value + unit string
  35820. * @argument {String} measurement - `height` or `width`
  35821. * @argument {Object} popperOffsets
  35822. * @argument {Object} referenceOffsets
  35823. * @returns {Number|String}
  35824. * Value in pixels, or original string if no values were extracted
  35825. */
  35826. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  35827. // separate value from unit
  35828. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  35829. var value = +split[1];
  35830. var unit = split[2];
  35831. // If it's not a number it's an operator, I guess
  35832. if (!value) {
  35833. return str;
  35834. }
  35835. if (unit.indexOf('%') === 0) {
  35836. var element = void 0;
  35837. switch (unit) {
  35838. case '%p':
  35839. element = popperOffsets;
  35840. break;
  35841. case '%':
  35842. case '%r':
  35843. default:
  35844. element = referenceOffsets;
  35845. }
  35846. var rect = getClientRect(element);
  35847. return rect[measurement] / 100 * value;
  35848. } else if (unit === 'vh' || unit === 'vw') {
  35849. // if is a vh or vw, we calculate the size based on the viewport
  35850. var size = void 0;
  35851. if (unit === 'vh') {
  35852. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  35853. } else {
  35854. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  35855. }
  35856. return size / 100 * value;
  35857. } else {
  35858. // if is an explicit pixel unit, we get rid of the unit and keep the value
  35859. // if is an implicit unit, it's px, and we return just the value
  35860. return value;
  35861. }
  35862. }
  35863. /**
  35864. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  35865. * @function
  35866. * @memberof {modifiers~offset}
  35867. * @private
  35868. * @argument {String} offset
  35869. * @argument {Object} popperOffsets
  35870. * @argument {Object} referenceOffsets
  35871. * @argument {String} basePlacement
  35872. * @returns {Array} a two cells array with x and y offsets in numbers
  35873. */
  35874. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  35875. var offsets = [0, 0];
  35876. // Use height if placement is left or right and index is 0 otherwise use width
  35877. // in this way the first offset will use an axis and the second one
  35878. // will use the other one
  35879. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  35880. // Split the offset string to obtain a list of values and operands
  35881. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  35882. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  35883. return frag.trim();
  35884. });
  35885. // Detect if the offset string contains a pair of values or a single one
  35886. // they could be separated by comma or space
  35887. var divider = fragments.indexOf(find(fragments, function (frag) {
  35888. return frag.search(/,|\s/) !== -1;
  35889. }));
  35890. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  35891. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  35892. }
  35893. // If divider is found, we divide the list of values and operands to divide
  35894. // them by ofset X and Y.
  35895. var splitRegex = /\s*,\s*|\s+/;
  35896. 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];
  35897. // Convert the values with units to absolute pixels to allow our computations
  35898. ops = ops.map(function (op, index) {
  35899. // Most of the units rely on the orientation of the popper
  35900. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  35901. var mergeWithPrevious = false;
  35902. return op
  35903. // This aggregates any `+` or `-` sign that aren't considered operators
  35904. // e.g.: 10 + +5 => [10, +, +5]
  35905. .reduce(function (a, b) {
  35906. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  35907. a[a.length - 1] = b;
  35908. mergeWithPrevious = true;
  35909. return a;
  35910. } else if (mergeWithPrevious) {
  35911. a[a.length - 1] += b;
  35912. mergeWithPrevious = false;
  35913. return a;
  35914. } else {
  35915. return a.concat(b);
  35916. }
  35917. }, [])
  35918. // Here we convert the string values into number values (in px)
  35919. .map(function (str) {
  35920. return toValue(str, measurement, popperOffsets, referenceOffsets);
  35921. });
  35922. });
  35923. // Loop trough the offsets arrays and execute the operations
  35924. ops.forEach(function (op, index) {
  35925. op.forEach(function (frag, index2) {
  35926. if (isNumeric(frag)) {
  35927. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  35928. }
  35929. });
  35930. });
  35931. return offsets;
  35932. }
  35933. /**
  35934. * @function
  35935. * @memberof Modifiers
  35936. * @argument {Object} data - The data object generated by update method
  35937. * @argument {Object} options - Modifiers configuration and options
  35938. * @argument {Number|String} options.offset=0
  35939. * The offset value as described in the modifier description
  35940. * @returns {Object} The data object, properly modified
  35941. */
  35942. function offset(data, _ref) {
  35943. var offset = _ref.offset;
  35944. var placement = data.placement,
  35945. _data$offsets = data.offsets,
  35946. popper = _data$offsets.popper,
  35947. reference = _data$offsets.reference;
  35948. var basePlacement = placement.split('-')[0];
  35949. var offsets = void 0;
  35950. if (isNumeric(+offset)) {
  35951. offsets = [+offset, 0];
  35952. } else {
  35953. offsets = parseOffset(offset, popper, reference, basePlacement);
  35954. }
  35955. if (basePlacement === 'left') {
  35956. popper.top += offsets[0];
  35957. popper.left -= offsets[1];
  35958. } else if (basePlacement === 'right') {
  35959. popper.top += offsets[0];
  35960. popper.left += offsets[1];
  35961. } else if (basePlacement === 'top') {
  35962. popper.left += offsets[0];
  35963. popper.top -= offsets[1];
  35964. } else if (basePlacement === 'bottom') {
  35965. popper.left += offsets[0];
  35966. popper.top += offsets[1];
  35967. }
  35968. data.popper = popper;
  35969. return data;
  35970. }
  35971. /**
  35972. * @function
  35973. * @memberof Modifiers
  35974. * @argument {Object} data - The data object generated by `update` method
  35975. * @argument {Object} options - Modifiers configuration and options
  35976. * @returns {Object} The data object, properly modified
  35977. */
  35978. function preventOverflow(data, options) {
  35979. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  35980. // If offsetParent is the reference element, we really want to
  35981. // go one step up and use the next offsetParent as reference to
  35982. // avoid to make this modifier completely useless and look like broken
  35983. if (data.instance.reference === boundariesElement) {
  35984. boundariesElement = getOffsetParent(boundariesElement);
  35985. }
  35986. // NOTE: DOM access here
  35987. // resets the popper's position so that the document size can be calculated excluding
  35988. // the size of the popper element itself
  35989. var transformProp = getSupportedPropertyName('transform');
  35990. var popperStyles = data.instance.popper.style; // assignment to help minification
  35991. var top = popperStyles.top,
  35992. left = popperStyles.left,
  35993. transform = popperStyles[transformProp];
  35994. popperStyles.top = '';
  35995. popperStyles.left = '';
  35996. popperStyles[transformProp] = '';
  35997. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  35998. // NOTE: DOM access here
  35999. // restores the original style properties after the offsets have been computed
  36000. popperStyles.top = top;
  36001. popperStyles.left = left;
  36002. popperStyles[transformProp] = transform;
  36003. options.boundaries = boundaries;
  36004. var order = options.priority;
  36005. var popper = data.offsets.popper;
  36006. var check = {
  36007. primary: function primary(placement) {
  36008. var value = popper[placement];
  36009. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  36010. value = Math.max(popper[placement], boundaries[placement]);
  36011. }
  36012. return defineProperty({}, placement, value);
  36013. },
  36014. secondary: function secondary(placement) {
  36015. var mainSide = placement === 'right' ? 'left' : 'top';
  36016. var value = popper[mainSide];
  36017. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  36018. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  36019. }
  36020. return defineProperty({}, mainSide, value);
  36021. }
  36022. };
  36023. order.forEach(function (placement) {
  36024. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  36025. popper = _extends({}, popper, check[side](placement));
  36026. });
  36027. data.offsets.popper = popper;
  36028. return data;
  36029. }
  36030. /**
  36031. * @function
  36032. * @memberof Modifiers
  36033. * @argument {Object} data - The data object generated by `update` method
  36034. * @argument {Object} options - Modifiers configuration and options
  36035. * @returns {Object} The data object, properly modified
  36036. */
  36037. function shift(data) {
  36038. var placement = data.placement;
  36039. var basePlacement = placement.split('-')[0];
  36040. var shiftvariation = placement.split('-')[1];
  36041. // if shift shiftvariation is specified, run the modifier
  36042. if (shiftvariation) {
  36043. var _data$offsets = data.offsets,
  36044. reference = _data$offsets.reference,
  36045. popper = _data$offsets.popper;
  36046. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  36047. var side = isVertical ? 'left' : 'top';
  36048. var measurement = isVertical ? 'width' : 'height';
  36049. var shiftOffsets = {
  36050. start: defineProperty({}, side, reference[side]),
  36051. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  36052. };
  36053. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  36054. }
  36055. return data;
  36056. }
  36057. /**
  36058. * @function
  36059. * @memberof Modifiers
  36060. * @argument {Object} data - The data object generated by update method
  36061. * @argument {Object} options - Modifiers configuration and options
  36062. * @returns {Object} The data object, properly modified
  36063. */
  36064. function hide(data) {
  36065. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  36066. return data;
  36067. }
  36068. var refRect = data.offsets.reference;
  36069. var bound = find(data.instance.modifiers, function (modifier) {
  36070. return modifier.name === 'preventOverflow';
  36071. }).boundaries;
  36072. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  36073. // Avoid unnecessary DOM access if visibility hasn't changed
  36074. if (data.hide === true) {
  36075. return data;
  36076. }
  36077. data.hide = true;
  36078. data.attributes['x-out-of-boundaries'] = '';
  36079. } else {
  36080. // Avoid unnecessary DOM access if visibility hasn't changed
  36081. if (data.hide === false) {
  36082. return data;
  36083. }
  36084. data.hide = false;
  36085. data.attributes['x-out-of-boundaries'] = false;
  36086. }
  36087. return data;
  36088. }
  36089. /**
  36090. * @function
  36091. * @memberof Modifiers
  36092. * @argument {Object} data - The data object generated by `update` method
  36093. * @argument {Object} options - Modifiers configuration and options
  36094. * @returns {Object} The data object, properly modified
  36095. */
  36096. function inner(data) {
  36097. var placement = data.placement;
  36098. var basePlacement = placement.split('-')[0];
  36099. var _data$offsets = data.offsets,
  36100. popper = _data$offsets.popper,
  36101. reference = _data$offsets.reference;
  36102. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  36103. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  36104. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  36105. data.placement = getOppositePlacement(placement);
  36106. data.offsets.popper = getClientRect(popper);
  36107. return data;
  36108. }
  36109. /**
  36110. * Modifier function, each modifier can have a function of this type assigned
  36111. * to its `fn` property.<br />
  36112. * These functions will be called on each update, this means that you must
  36113. * make sure they are performant enough to avoid performance bottlenecks.
  36114. *
  36115. * @function ModifierFn
  36116. * @argument {dataObject} data - The data object generated by `update` method
  36117. * @argument {Object} options - Modifiers configuration and options
  36118. * @returns {dataObject} The data object, properly modified
  36119. */
  36120. /**
  36121. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  36122. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  36123. * needed by the library.
  36124. *
  36125. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  36126. * All the other properties are configurations that could be tweaked.
  36127. * @namespace modifiers
  36128. */
  36129. var modifiers = {
  36130. /**
  36131. * Modifier used to shift the popper on the start or end of its reference
  36132. * element.<br />
  36133. * It will read the variation of the `placement` property.<br />
  36134. * It can be one either `-end` or `-start`.
  36135. * @memberof modifiers
  36136. * @inner
  36137. */
  36138. shift: {
  36139. /** @prop {number} order=100 - Index used to define the order of execution */
  36140. order: 100,
  36141. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36142. enabled: true,
  36143. /** @prop {ModifierFn} */
  36144. fn: shift
  36145. },
  36146. /**
  36147. * The `offset` modifier can shift your popper on both its axis.
  36148. *
  36149. * It accepts the following units:
  36150. * - `px` or unit-less, interpreted as pixels
  36151. * - `%` or `%r`, percentage relative to the length of the reference element
  36152. * - `%p`, percentage relative to the length of the popper element
  36153. * - `vw`, CSS viewport width unit
  36154. * - `vh`, CSS viewport height unit
  36155. *
  36156. * For length is intended the main axis relative to the placement of the popper.<br />
  36157. * This means that if the placement is `top` or `bottom`, the length will be the
  36158. * `width`. In case of `left` or `right`, it will be the `height`.
  36159. *
  36160. * You can provide a single value (as `Number` or `String`), or a pair of values
  36161. * as `String` divided by a comma or one (or more) white spaces.<br />
  36162. * The latter is a deprecated method because it leads to confusion and will be
  36163. * removed in v2.<br />
  36164. * Additionally, it accepts additions and subtractions between different units.
  36165. * Note that multiplications and divisions aren't supported.
  36166. *
  36167. * Valid examples are:
  36168. * ```
  36169. * 10
  36170. * '10%'
  36171. * '10, 10'
  36172. * '10%, 10'
  36173. * '10 + 10%'
  36174. * '10 - 5vh + 3%'
  36175. * '-10px + 5vh, 5px - 6%'
  36176. * ```
  36177. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  36178. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  36179. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  36180. *
  36181. * @memberof modifiers
  36182. * @inner
  36183. */
  36184. offset: {
  36185. /** @prop {number} order=200 - Index used to define the order of execution */
  36186. order: 200,
  36187. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36188. enabled: true,
  36189. /** @prop {ModifierFn} */
  36190. fn: offset,
  36191. /** @prop {Number|String} offset=0
  36192. * The offset value as described in the modifier description
  36193. */
  36194. offset: 0
  36195. },
  36196. /**
  36197. * Modifier used to prevent the popper from being positioned outside the boundary.
  36198. *
  36199. * A scenario exists where the reference itself is not within the boundaries.<br />
  36200. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  36201. * In this case we need to decide whether the popper should either:
  36202. *
  36203. * - detach from the reference and remain "trapped" in the boundaries, or
  36204. * - if it should ignore the boundary and "escape with its reference"
  36205. *
  36206. * When `escapeWithReference` is set to`true` and reference is completely
  36207. * outside its boundaries, the popper will overflow (or completely leave)
  36208. * the boundaries in order to remain attached to the edge of the reference.
  36209. *
  36210. * @memberof modifiers
  36211. * @inner
  36212. */
  36213. preventOverflow: {
  36214. /** @prop {number} order=300 - Index used to define the order of execution */
  36215. order: 300,
  36216. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36217. enabled: true,
  36218. /** @prop {ModifierFn} */
  36219. fn: preventOverflow,
  36220. /**
  36221. * @prop {Array} [priority=['left','right','top','bottom']]
  36222. * Popper will try to prevent overflow following these priorities by default,
  36223. * then, it could overflow on the left and on top of the `boundariesElement`
  36224. */
  36225. priority: ['left', 'right', 'top', 'bottom'],
  36226. /**
  36227. * @prop {number} padding=5
  36228. * Amount of pixel used to define a minimum distance between the boundaries
  36229. * and the popper. This makes sure the popper always has a little padding
  36230. * between the edges of its container
  36231. */
  36232. padding: 5,
  36233. /**
  36234. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  36235. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  36236. * `viewport` or any DOM element.
  36237. */
  36238. boundariesElement: 'scrollParent'
  36239. },
  36240. /**
  36241. * Modifier used to make sure the reference and its popper stay near each other
  36242. * without leaving any gap between the two. Especially useful when the arrow is
  36243. * enabled and you want to ensure that it points to its reference element.
  36244. * It cares only about the first axis. You can still have poppers with margin
  36245. * between the popper and its reference element.
  36246. * @memberof modifiers
  36247. * @inner
  36248. */
  36249. keepTogether: {
  36250. /** @prop {number} order=400 - Index used to define the order of execution */
  36251. order: 400,
  36252. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36253. enabled: true,
  36254. /** @prop {ModifierFn} */
  36255. fn: keepTogether
  36256. },
  36257. /**
  36258. * This modifier is used to move the `arrowElement` of the popper to make
  36259. * sure it is positioned between the reference element and its popper element.
  36260. * It will read the outer size of the `arrowElement` node to detect how many
  36261. * pixels of conjunction are needed.
  36262. *
  36263. * It has no effect if no `arrowElement` is provided.
  36264. * @memberof modifiers
  36265. * @inner
  36266. */
  36267. arrow: {
  36268. /** @prop {number} order=500 - Index used to define the order of execution */
  36269. order: 500,
  36270. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36271. enabled: true,
  36272. /** @prop {ModifierFn} */
  36273. fn: arrow,
  36274. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  36275. element: '[x-arrow]'
  36276. },
  36277. /**
  36278. * Modifier used to flip the popper's placement when it starts to overlap its
  36279. * reference element.
  36280. *
  36281. * Requires the `preventOverflow` modifier before it in order to work.
  36282. *
  36283. * **NOTE:** this modifier will interrupt the current update cycle and will
  36284. * restart it if it detects the need to flip the placement.
  36285. * @memberof modifiers
  36286. * @inner
  36287. */
  36288. flip: {
  36289. /** @prop {number} order=600 - Index used to define the order of execution */
  36290. order: 600,
  36291. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36292. enabled: true,
  36293. /** @prop {ModifierFn} */
  36294. fn: flip,
  36295. /**
  36296. * @prop {String|Array} behavior='flip'
  36297. * The behavior used to change the popper's placement. It can be one of
  36298. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  36299. * placements (with optional variations)
  36300. */
  36301. behavior: 'flip',
  36302. /**
  36303. * @prop {number} padding=5
  36304. * The popper will flip if it hits the edges of the `boundariesElement`
  36305. */
  36306. padding: 5,
  36307. /**
  36308. * @prop {String|HTMLElement} boundariesElement='viewport'
  36309. * The element which will define the boundaries of the popper position.
  36310. * The popper will never be placed outside of the defined boundaries
  36311. * (except if `keepTogether` is enabled)
  36312. */
  36313. boundariesElement: 'viewport',
  36314. /**
  36315. * @prop {Boolean} flipVariations=false
  36316. * The popper will switch placement variation between `-start` and `-end` when
  36317. * the reference element overlaps its boundaries.
  36318. *
  36319. * The original placement should have a set variation.
  36320. */
  36321. flipVariations: false,
  36322. /**
  36323. * @prop {Boolean} flipVariationsByContent=false
  36324. * The popper will switch placement variation between `-start` and `-end` when
  36325. * the popper element overlaps its reference boundaries.
  36326. *
  36327. * The original placement should have a set variation.
  36328. */
  36329. flipVariationsByContent: false
  36330. },
  36331. /**
  36332. * Modifier used to make the popper flow toward the inner of the reference element.
  36333. * By default, when this modifier is disabled, the popper will be placed outside
  36334. * the reference element.
  36335. * @memberof modifiers
  36336. * @inner
  36337. */
  36338. inner: {
  36339. /** @prop {number} order=700 - Index used to define the order of execution */
  36340. order: 700,
  36341. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  36342. enabled: false,
  36343. /** @prop {ModifierFn} */
  36344. fn: inner
  36345. },
  36346. /**
  36347. * Modifier used to hide the popper when its reference element is outside of the
  36348. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  36349. * be used to hide with a CSS selector the popper when its reference is
  36350. * out of boundaries.
  36351. *
  36352. * Requires the `preventOverflow` modifier before it in order to work.
  36353. * @memberof modifiers
  36354. * @inner
  36355. */
  36356. hide: {
  36357. /** @prop {number} order=800 - Index used to define the order of execution */
  36358. order: 800,
  36359. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36360. enabled: true,
  36361. /** @prop {ModifierFn} */
  36362. fn: hide
  36363. },
  36364. /**
  36365. * Computes the style that will be applied to the popper element to gets
  36366. * properly positioned.
  36367. *
  36368. * Note that this modifier will not touch the DOM, it just prepares the styles
  36369. * so that `applyStyle` modifier can apply it. This separation is useful
  36370. * in case you need to replace `applyStyle` with a custom implementation.
  36371. *
  36372. * This modifier has `850` as `order` value to maintain backward compatibility
  36373. * with previous versions of Popper.js. Expect the modifiers ordering method
  36374. * to change in future major versions of the library.
  36375. *
  36376. * @memberof modifiers
  36377. * @inner
  36378. */
  36379. computeStyle: {
  36380. /** @prop {number} order=850 - Index used to define the order of execution */
  36381. order: 850,
  36382. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36383. enabled: true,
  36384. /** @prop {ModifierFn} */
  36385. fn: computeStyle,
  36386. /**
  36387. * @prop {Boolean} gpuAcceleration=true
  36388. * If true, it uses the CSS 3D transformation to position the popper.
  36389. * Otherwise, it will use the `top` and `left` properties
  36390. */
  36391. gpuAcceleration: true,
  36392. /**
  36393. * @prop {string} [x='bottom']
  36394. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  36395. * Change this if your popper should grow in a direction different from `bottom`
  36396. */
  36397. x: 'bottom',
  36398. /**
  36399. * @prop {string} [x='left']
  36400. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  36401. * Change this if your popper should grow in a direction different from `right`
  36402. */
  36403. y: 'right'
  36404. },
  36405. /**
  36406. * Applies the computed styles to the popper element.
  36407. *
  36408. * All the DOM manipulations are limited to this modifier. This is useful in case
  36409. * you want to integrate Popper.js inside a framework or view library and you
  36410. * want to delegate all the DOM manipulations to it.
  36411. *
  36412. * Note that if you disable this modifier, you must make sure the popper element
  36413. * has its position set to `absolute` before Popper.js can do its work!
  36414. *
  36415. * Just disable this modifier and define your own to achieve the desired effect.
  36416. *
  36417. * @memberof modifiers
  36418. * @inner
  36419. */
  36420. applyStyle: {
  36421. /** @prop {number} order=900 - Index used to define the order of execution */
  36422. order: 900,
  36423. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36424. enabled: true,
  36425. /** @prop {ModifierFn} */
  36426. fn: applyStyle,
  36427. /** @prop {Function} */
  36428. onLoad: applyStyleOnLoad,
  36429. /**
  36430. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  36431. * @prop {Boolean} gpuAcceleration=true
  36432. * If true, it uses the CSS 3D transformation to position the popper.
  36433. * Otherwise, it will use the `top` and `left` properties
  36434. */
  36435. gpuAcceleration: undefined
  36436. }
  36437. };
  36438. /**
  36439. * The `dataObject` is an object containing all the information used by Popper.js.
  36440. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  36441. * @name dataObject
  36442. * @property {Object} data.instance The Popper.js instance
  36443. * @property {String} data.placement Placement applied to popper
  36444. * @property {String} data.originalPlacement Placement originally defined on init
  36445. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  36446. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  36447. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  36448. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36449. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36450. * @property {Object} data.boundaries Offsets of the popper boundaries
  36451. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  36452. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  36453. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  36454. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  36455. */
  36456. /**
  36457. * Default options provided to Popper.js constructor.<br />
  36458. * These can be overridden using the `options` argument of Popper.js.<br />
  36459. * To override an option, simply pass an object with the same
  36460. * structure of the `options` object, as the 3rd argument. For example:
  36461. * ```
  36462. * new Popper(ref, pop, {
  36463. * modifiers: {
  36464. * preventOverflow: { enabled: false }
  36465. * }
  36466. * })
  36467. * ```
  36468. * @type {Object}
  36469. * @static
  36470. * @memberof Popper
  36471. */
  36472. var Defaults = {
  36473. /**
  36474. * Popper's placement.
  36475. * @prop {Popper.placements} placement='bottom'
  36476. */
  36477. placement: 'bottom',
  36478. /**
  36479. * Set this to true if you want popper to position it self in 'fixed' mode
  36480. * @prop {Boolean} positionFixed=false
  36481. */
  36482. positionFixed: false,
  36483. /**
  36484. * Whether events (resize, scroll) are initially enabled.
  36485. * @prop {Boolean} eventsEnabled=true
  36486. */
  36487. eventsEnabled: true,
  36488. /**
  36489. * Set to true if you want to automatically remove the popper when
  36490. * you call the `destroy` method.
  36491. * @prop {Boolean} removeOnDestroy=false
  36492. */
  36493. removeOnDestroy: false,
  36494. /**
  36495. * Callback called when the popper is created.<br />
  36496. * By default, it is set to no-op.<br />
  36497. * Access Popper.js instance with `data.instance`.
  36498. * @prop {onCreate}
  36499. */
  36500. onCreate: function onCreate() {},
  36501. /**
  36502. * Callback called when the popper is updated. This callback is not called
  36503. * on the initialization/creation of the popper, but only on subsequent
  36504. * updates.<br />
  36505. * By default, it is set to no-op.<br />
  36506. * Access Popper.js instance with `data.instance`.
  36507. * @prop {onUpdate}
  36508. */
  36509. onUpdate: function onUpdate() {},
  36510. /**
  36511. * List of modifiers used to modify the offsets before they are applied to the popper.
  36512. * They provide most of the functionalities of Popper.js.
  36513. * @prop {modifiers}
  36514. */
  36515. modifiers: modifiers
  36516. };
  36517. /**
  36518. * @callback onCreate
  36519. * @param {dataObject} data
  36520. */
  36521. /**
  36522. * @callback onUpdate
  36523. * @param {dataObject} data
  36524. */
  36525. // Utils
  36526. // Methods
  36527. var Popper = function () {
  36528. /**
  36529. * Creates a new Popper.js instance.
  36530. * @class Popper
  36531. * @param {Element|referenceObject} reference - The reference element used to position the popper
  36532. * @param {Element} popper - The HTML / XML element used as the popper
  36533. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  36534. * @return {Object} instance - The generated Popper.js instance
  36535. */
  36536. function Popper(reference, popper) {
  36537. var _this = this;
  36538. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  36539. classCallCheck(this, Popper);
  36540. this.scheduleUpdate = function () {
  36541. return requestAnimationFrame(_this.update);
  36542. };
  36543. // make update() debounced, so that it only runs at most once-per-tick
  36544. this.update = debounce(this.update.bind(this));
  36545. // with {} we create a new object with the options inside it
  36546. this.options = _extends({}, Popper.Defaults, options);
  36547. // init state
  36548. this.state = {
  36549. isDestroyed: false,
  36550. isCreated: false,
  36551. scrollParents: []
  36552. };
  36553. // get reference and popper elements (allow jQuery wrappers)
  36554. this.reference = reference && reference.jquery ? reference[0] : reference;
  36555. this.popper = popper && popper.jquery ? popper[0] : popper;
  36556. // Deep merge modifiers options
  36557. this.options.modifiers = {};
  36558. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  36559. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  36560. });
  36561. // Refactoring modifiers' list (Object => Array)
  36562. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  36563. return _extends({
  36564. name: name
  36565. }, _this.options.modifiers[name]);
  36566. })
  36567. // sort the modifiers by order
  36568. .sort(function (a, b) {
  36569. return a.order - b.order;
  36570. });
  36571. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  36572. // such code is executed in the same order of its modifier
  36573. // they could add new properties to their options configuration
  36574. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  36575. this.modifiers.forEach(function (modifierOptions) {
  36576. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  36577. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  36578. }
  36579. });
  36580. // fire the first update to position the popper in the right place
  36581. this.update();
  36582. var eventsEnabled = this.options.eventsEnabled;
  36583. if (eventsEnabled) {
  36584. // setup event listeners, they will take care of update the position in specific situations
  36585. this.enableEventListeners();
  36586. }
  36587. this.state.eventsEnabled = eventsEnabled;
  36588. }
  36589. // We can't use class properties because they don't get listed in the
  36590. // class prototype and break stuff like Sinon stubs
  36591. createClass(Popper, [{
  36592. key: 'update',
  36593. value: function update$$1() {
  36594. return update.call(this);
  36595. }
  36596. }, {
  36597. key: 'destroy',
  36598. value: function destroy$$1() {
  36599. return destroy.call(this);
  36600. }
  36601. }, {
  36602. key: 'enableEventListeners',
  36603. value: function enableEventListeners$$1() {
  36604. return enableEventListeners.call(this);
  36605. }
  36606. }, {
  36607. key: 'disableEventListeners',
  36608. value: function disableEventListeners$$1() {
  36609. return disableEventListeners.call(this);
  36610. }
  36611. /**
  36612. * Schedules an update. It will run on the next UI update available.
  36613. * @method scheduleUpdate
  36614. * @memberof Popper
  36615. */
  36616. /**
  36617. * Collection of utilities useful when writing custom modifiers.
  36618. * Starting from version 1.7, this method is available only if you
  36619. * include `popper-utils.js` before `popper.js`.
  36620. *
  36621. * **DEPRECATION**: This way to access PopperUtils is deprecated
  36622. * and will be removed in v2! Use the PopperUtils module directly instead.
  36623. * Due to the high instability of the methods contained in Utils, we can't
  36624. * guarantee them to follow semver. Use them at your own risk!
  36625. * @static
  36626. * @private
  36627. * @type {Object}
  36628. * @deprecated since version 1.8
  36629. * @member Utils
  36630. * @memberof Popper
  36631. */
  36632. }]);
  36633. return Popper;
  36634. }();
  36635. /**
  36636. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  36637. * and lets you use it as replacement of a real DOM node.<br />
  36638. * You can use this method to position a popper relatively to a set of coordinates
  36639. * in case you don't have a DOM node to use as reference.
  36640. *
  36641. * ```
  36642. * new Popper(referenceObject, popperNode);
  36643. * ```
  36644. *
  36645. * NB: This feature isn't supported in Internet Explorer 10.
  36646. * @name referenceObject
  36647. * @property {Function} data.getBoundingClientRect
  36648. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  36649. * @property {number} data.clientWidth
  36650. * An ES6 getter that will return the width of the virtual reference element.
  36651. * @property {number} data.clientHeight
  36652. * An ES6 getter that will return the height of the virtual reference element.
  36653. */
  36654. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  36655. Popper.placements = placements;
  36656. Popper.Defaults = Defaults;
  36657. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  36658. //# sourceMappingURL=popper.js.map
  36659. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  36660. /***/ }),
  36661. /***/ "./node_modules/process/browser.js":
  36662. /*!*****************************************!*\
  36663. !*** ./node_modules/process/browser.js ***!
  36664. \*****************************************/
  36665. /*! no static exports found */
  36666. /***/ (function(module, exports) {
  36667. // shim for using process in browser
  36668. var process = module.exports = {};
  36669. // cached from whatever global is present so that test runners that stub it
  36670. // don't break things. But we need to wrap it in a try catch in case it is
  36671. // wrapped in strict mode code which doesn't define any globals. It's inside a
  36672. // function because try/catches deoptimize in certain engines.
  36673. var cachedSetTimeout;
  36674. var cachedClearTimeout;
  36675. function defaultSetTimout() {
  36676. throw new Error('setTimeout has not been defined');
  36677. }
  36678. function defaultClearTimeout () {
  36679. throw new Error('clearTimeout has not been defined');
  36680. }
  36681. (function () {
  36682. try {
  36683. if (typeof setTimeout === 'function') {
  36684. cachedSetTimeout = setTimeout;
  36685. } else {
  36686. cachedSetTimeout = defaultSetTimout;
  36687. }
  36688. } catch (e) {
  36689. cachedSetTimeout = defaultSetTimout;
  36690. }
  36691. try {
  36692. if (typeof clearTimeout === 'function') {
  36693. cachedClearTimeout = clearTimeout;
  36694. } else {
  36695. cachedClearTimeout = defaultClearTimeout;
  36696. }
  36697. } catch (e) {
  36698. cachedClearTimeout = defaultClearTimeout;
  36699. }
  36700. } ())
  36701. function runTimeout(fun) {
  36702. if (cachedSetTimeout === setTimeout) {
  36703. //normal enviroments in sane situations
  36704. return setTimeout(fun, 0);
  36705. }
  36706. // if setTimeout wasn't available but was latter defined
  36707. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  36708. cachedSetTimeout = setTimeout;
  36709. return setTimeout(fun, 0);
  36710. }
  36711. try {
  36712. // when when somebody has screwed with setTimeout but no I.E. maddness
  36713. return cachedSetTimeout(fun, 0);
  36714. } catch(e){
  36715. try {
  36716. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36717. return cachedSetTimeout.call(null, fun, 0);
  36718. } catch(e){
  36719. // 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
  36720. return cachedSetTimeout.call(this, fun, 0);
  36721. }
  36722. }
  36723. }
  36724. function runClearTimeout(marker) {
  36725. if (cachedClearTimeout === clearTimeout) {
  36726. //normal enviroments in sane situations
  36727. return clearTimeout(marker);
  36728. }
  36729. // if clearTimeout wasn't available but was latter defined
  36730. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  36731. cachedClearTimeout = clearTimeout;
  36732. return clearTimeout(marker);
  36733. }
  36734. try {
  36735. // when when somebody has screwed with setTimeout but no I.E. maddness
  36736. return cachedClearTimeout(marker);
  36737. } catch (e){
  36738. try {
  36739. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36740. return cachedClearTimeout.call(null, marker);
  36741. } catch (e){
  36742. // 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.
  36743. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  36744. return cachedClearTimeout.call(this, marker);
  36745. }
  36746. }
  36747. }
  36748. var queue = [];
  36749. var draining = false;
  36750. var currentQueue;
  36751. var queueIndex = -1;
  36752. function cleanUpNextTick() {
  36753. if (!draining || !currentQueue) {
  36754. return;
  36755. }
  36756. draining = false;
  36757. if (currentQueue.length) {
  36758. queue = currentQueue.concat(queue);
  36759. } else {
  36760. queueIndex = -1;
  36761. }
  36762. if (queue.length) {
  36763. drainQueue();
  36764. }
  36765. }
  36766. function drainQueue() {
  36767. if (draining) {
  36768. return;
  36769. }
  36770. var timeout = runTimeout(cleanUpNextTick);
  36771. draining = true;
  36772. var len = queue.length;
  36773. while(len) {
  36774. currentQueue = queue;
  36775. queue = [];
  36776. while (++queueIndex < len) {
  36777. if (currentQueue) {
  36778. currentQueue[queueIndex].run();
  36779. }
  36780. }
  36781. queueIndex = -1;
  36782. len = queue.length;
  36783. }
  36784. currentQueue = null;
  36785. draining = false;
  36786. runClearTimeout(timeout);
  36787. }
  36788. process.nextTick = function (fun) {
  36789. var args = new Array(arguments.length - 1);
  36790. if (arguments.length > 1) {
  36791. for (var i = 1; i < arguments.length; i++) {
  36792. args[i - 1] = arguments[i];
  36793. }
  36794. }
  36795. queue.push(new Item(fun, args));
  36796. if (queue.length === 1 && !draining) {
  36797. runTimeout(drainQueue);
  36798. }
  36799. };
  36800. // v8 likes predictible objects
  36801. function Item(fun, array) {
  36802. this.fun = fun;
  36803. this.array = array;
  36804. }
  36805. Item.prototype.run = function () {
  36806. this.fun.apply(null, this.array);
  36807. };
  36808. process.title = 'browser';
  36809. process.browser = true;
  36810. process.env = {};
  36811. process.argv = [];
  36812. process.version = ''; // empty string to avoid regexp issues
  36813. process.versions = {};
  36814. function noop() {}
  36815. process.on = noop;
  36816. process.addListener = noop;
  36817. process.once = noop;
  36818. process.off = noop;
  36819. process.removeListener = noop;
  36820. process.removeAllListeners = noop;
  36821. process.emit = noop;
  36822. process.prependListener = noop;
  36823. process.prependOnceListener = noop;
  36824. process.listeners = function (name) { return [] }
  36825. process.binding = function (name) {
  36826. throw new Error('process.binding is not supported');
  36827. };
  36828. process.cwd = function () { return '/' };
  36829. process.chdir = function (dir) {
  36830. throw new Error('process.chdir is not supported');
  36831. };
  36832. process.umask = function() { return 0; };
  36833. /***/ }),
  36834. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  36835. /*!***************************************************!*\
  36836. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  36837. \***************************************************/
  36838. /*! no static exports found */
  36839. /***/ (function(module, exports, __webpack_require__) {
  36840. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  36841. * Pusher JavaScript Library v5.0.3
  36842. * https://pusher.com/
  36843. *
  36844. * Copyright 2017, Pusher
  36845. * Released under the MIT licence.
  36846. */
  36847. (function webpackUniversalModuleDefinition(root, factory) {
  36848. if(true)
  36849. module.exports = factory();
  36850. else {}
  36851. })(window, function() {
  36852. return /******/ (function(modules) { // webpackBootstrap
  36853. /******/ // The module cache
  36854. /******/ var installedModules = {};
  36855. /******/
  36856. /******/ // The require function
  36857. /******/ function __webpack_require__(moduleId) {
  36858. /******/
  36859. /******/ // Check if module is in cache
  36860. /******/ if(installedModules[moduleId]) {
  36861. /******/ return installedModules[moduleId].exports;
  36862. /******/ }
  36863. /******/ // Create a new module (and put it into the cache)
  36864. /******/ var module = installedModules[moduleId] = {
  36865. /******/ i: moduleId,
  36866. /******/ l: false,
  36867. /******/ exports: {}
  36868. /******/ };
  36869. /******/
  36870. /******/ // Execute the module function
  36871. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  36872. /******/
  36873. /******/ // Flag the module as loaded
  36874. /******/ module.l = true;
  36875. /******/
  36876. /******/ // Return the exports of the module
  36877. /******/ return module.exports;
  36878. /******/ }
  36879. /******/
  36880. /******/
  36881. /******/ // expose the modules object (__webpack_modules__)
  36882. /******/ __webpack_require__.m = modules;
  36883. /******/
  36884. /******/ // expose the module cache
  36885. /******/ __webpack_require__.c = installedModules;
  36886. /******/
  36887. /******/ // define getter function for harmony exports
  36888. /******/ __webpack_require__.d = function(exports, name, getter) {
  36889. /******/ if(!__webpack_require__.o(exports, name)) {
  36890. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  36891. /******/ }
  36892. /******/ };
  36893. /******/
  36894. /******/ // define __esModule on exports
  36895. /******/ __webpack_require__.r = function(exports) {
  36896. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  36897. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  36898. /******/ }
  36899. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  36900. /******/ };
  36901. /******/
  36902. /******/ // create a fake namespace object
  36903. /******/ // mode & 1: value is a module id, require it
  36904. /******/ // mode & 2: merge all properties of value into the ns
  36905. /******/ // mode & 4: return value when already ns object
  36906. /******/ // mode & 8|1: behave like require
  36907. /******/ __webpack_require__.t = function(value, mode) {
  36908. /******/ if(mode & 1) value = __webpack_require__(value);
  36909. /******/ if(mode & 8) return value;
  36910. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  36911. /******/ var ns = Object.create(null);
  36912. /******/ __webpack_require__.r(ns);
  36913. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  36914. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  36915. /******/ return ns;
  36916. /******/ };
  36917. /******/
  36918. /******/ // getDefaultExport function for compatibility with non-harmony modules
  36919. /******/ __webpack_require__.n = function(module) {
  36920. /******/ var getter = module && module.__esModule ?
  36921. /******/ function getDefault() { return module['default']; } :
  36922. /******/ function getModuleExports() { return module; };
  36923. /******/ __webpack_require__.d(getter, 'a', getter);
  36924. /******/ return getter;
  36925. /******/ };
  36926. /******/
  36927. /******/ // Object.prototype.hasOwnProperty.call
  36928. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  36929. /******/
  36930. /******/ // __webpack_public_path__
  36931. /******/ __webpack_require__.p = "";
  36932. /******/
  36933. /******/
  36934. /******/ // Load entry module and return exports
  36935. /******/ return __webpack_require__(__webpack_require__.s = 2);
  36936. /******/ })
  36937. /************************************************************************/
  36938. /******/ ([
  36939. /* 0 */
  36940. /***/ (function(module, exports, __webpack_require__) {
  36941. (function(nacl) {
  36942. 'use strict';
  36943. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  36944. // Public domain.
  36945. //
  36946. // Implementation derived from TweetNaCl version 20140427.
  36947. // See for details: http://tweetnacl.cr.yp.to/
  36948. var gf = function(init) {
  36949. var i, r = new Float64Array(16);
  36950. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  36951. return r;
  36952. };
  36953. // Pluggable, initialized in high-level API below.
  36954. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  36955. var _0 = new Uint8Array(16);
  36956. var _9 = new Uint8Array(32); _9[0] = 9;
  36957. var gf0 = gf(),
  36958. gf1 = gf([1]),
  36959. _121665 = gf([0xdb41, 1]),
  36960. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  36961. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  36962. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  36963. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  36964. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  36965. function ts64(x, i, h, l) {
  36966. x[i] = (h >> 24) & 0xff;
  36967. x[i+1] = (h >> 16) & 0xff;
  36968. x[i+2] = (h >> 8) & 0xff;
  36969. x[i+3] = h & 0xff;
  36970. x[i+4] = (l >> 24) & 0xff;
  36971. x[i+5] = (l >> 16) & 0xff;
  36972. x[i+6] = (l >> 8) & 0xff;
  36973. x[i+7] = l & 0xff;
  36974. }
  36975. function vn(x, xi, y, yi, n) {
  36976. var i,d = 0;
  36977. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  36978. return (1 & ((d - 1) >>> 8)) - 1;
  36979. }
  36980. function crypto_verify_16(x, xi, y, yi) {
  36981. return vn(x,xi,y,yi,16);
  36982. }
  36983. function crypto_verify_32(x, xi, y, yi) {
  36984. return vn(x,xi,y,yi,32);
  36985. }
  36986. function core_salsa20(o, p, k, c) {
  36987. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  36988. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  36989. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  36990. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  36991. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  36992. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  36993. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  36994. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  36995. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  36996. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  36997. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  36998. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  36999. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37000. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37001. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37002. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37003. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37004. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37005. x15 = j15, u;
  37006. for (var i = 0; i < 20; i += 2) {
  37007. u = x0 + x12 | 0;
  37008. x4 ^= u<<7 | u>>>(32-7);
  37009. u = x4 + x0 | 0;
  37010. x8 ^= u<<9 | u>>>(32-9);
  37011. u = x8 + x4 | 0;
  37012. x12 ^= u<<13 | u>>>(32-13);
  37013. u = x12 + x8 | 0;
  37014. x0 ^= u<<18 | u>>>(32-18);
  37015. u = x5 + x1 | 0;
  37016. x9 ^= u<<7 | u>>>(32-7);
  37017. u = x9 + x5 | 0;
  37018. x13 ^= u<<9 | u>>>(32-9);
  37019. u = x13 + x9 | 0;
  37020. x1 ^= u<<13 | u>>>(32-13);
  37021. u = x1 + x13 | 0;
  37022. x5 ^= u<<18 | u>>>(32-18);
  37023. u = x10 + x6 | 0;
  37024. x14 ^= u<<7 | u>>>(32-7);
  37025. u = x14 + x10 | 0;
  37026. x2 ^= u<<9 | u>>>(32-9);
  37027. u = x2 + x14 | 0;
  37028. x6 ^= u<<13 | u>>>(32-13);
  37029. u = x6 + x2 | 0;
  37030. x10 ^= u<<18 | u>>>(32-18);
  37031. u = x15 + x11 | 0;
  37032. x3 ^= u<<7 | u>>>(32-7);
  37033. u = x3 + x15 | 0;
  37034. x7 ^= u<<9 | u>>>(32-9);
  37035. u = x7 + x3 | 0;
  37036. x11 ^= u<<13 | u>>>(32-13);
  37037. u = x11 + x7 | 0;
  37038. x15 ^= u<<18 | u>>>(32-18);
  37039. u = x0 + x3 | 0;
  37040. x1 ^= u<<7 | u>>>(32-7);
  37041. u = x1 + x0 | 0;
  37042. x2 ^= u<<9 | u>>>(32-9);
  37043. u = x2 + x1 | 0;
  37044. x3 ^= u<<13 | u>>>(32-13);
  37045. u = x3 + x2 | 0;
  37046. x0 ^= u<<18 | u>>>(32-18);
  37047. u = x5 + x4 | 0;
  37048. x6 ^= u<<7 | u>>>(32-7);
  37049. u = x6 + x5 | 0;
  37050. x7 ^= u<<9 | u>>>(32-9);
  37051. u = x7 + x6 | 0;
  37052. x4 ^= u<<13 | u>>>(32-13);
  37053. u = x4 + x7 | 0;
  37054. x5 ^= u<<18 | u>>>(32-18);
  37055. u = x10 + x9 | 0;
  37056. x11 ^= u<<7 | u>>>(32-7);
  37057. u = x11 + x10 | 0;
  37058. x8 ^= u<<9 | u>>>(32-9);
  37059. u = x8 + x11 | 0;
  37060. x9 ^= u<<13 | u>>>(32-13);
  37061. u = x9 + x8 | 0;
  37062. x10 ^= u<<18 | u>>>(32-18);
  37063. u = x15 + x14 | 0;
  37064. x12 ^= u<<7 | u>>>(32-7);
  37065. u = x12 + x15 | 0;
  37066. x13 ^= u<<9 | u>>>(32-9);
  37067. u = x13 + x12 | 0;
  37068. x14 ^= u<<13 | u>>>(32-13);
  37069. u = x14 + x13 | 0;
  37070. x15 ^= u<<18 | u>>>(32-18);
  37071. }
  37072. x0 = x0 + j0 | 0;
  37073. x1 = x1 + j1 | 0;
  37074. x2 = x2 + j2 | 0;
  37075. x3 = x3 + j3 | 0;
  37076. x4 = x4 + j4 | 0;
  37077. x5 = x5 + j5 | 0;
  37078. x6 = x6 + j6 | 0;
  37079. x7 = x7 + j7 | 0;
  37080. x8 = x8 + j8 | 0;
  37081. x9 = x9 + j9 | 0;
  37082. x10 = x10 + j10 | 0;
  37083. x11 = x11 + j11 | 0;
  37084. x12 = x12 + j12 | 0;
  37085. x13 = x13 + j13 | 0;
  37086. x14 = x14 + j14 | 0;
  37087. x15 = x15 + j15 | 0;
  37088. o[ 0] = x0 >>> 0 & 0xff;
  37089. o[ 1] = x0 >>> 8 & 0xff;
  37090. o[ 2] = x0 >>> 16 & 0xff;
  37091. o[ 3] = x0 >>> 24 & 0xff;
  37092. o[ 4] = x1 >>> 0 & 0xff;
  37093. o[ 5] = x1 >>> 8 & 0xff;
  37094. o[ 6] = x1 >>> 16 & 0xff;
  37095. o[ 7] = x1 >>> 24 & 0xff;
  37096. o[ 8] = x2 >>> 0 & 0xff;
  37097. o[ 9] = x2 >>> 8 & 0xff;
  37098. o[10] = x2 >>> 16 & 0xff;
  37099. o[11] = x2 >>> 24 & 0xff;
  37100. o[12] = x3 >>> 0 & 0xff;
  37101. o[13] = x3 >>> 8 & 0xff;
  37102. o[14] = x3 >>> 16 & 0xff;
  37103. o[15] = x3 >>> 24 & 0xff;
  37104. o[16] = x4 >>> 0 & 0xff;
  37105. o[17] = x4 >>> 8 & 0xff;
  37106. o[18] = x4 >>> 16 & 0xff;
  37107. o[19] = x4 >>> 24 & 0xff;
  37108. o[20] = x5 >>> 0 & 0xff;
  37109. o[21] = x5 >>> 8 & 0xff;
  37110. o[22] = x5 >>> 16 & 0xff;
  37111. o[23] = x5 >>> 24 & 0xff;
  37112. o[24] = x6 >>> 0 & 0xff;
  37113. o[25] = x6 >>> 8 & 0xff;
  37114. o[26] = x6 >>> 16 & 0xff;
  37115. o[27] = x6 >>> 24 & 0xff;
  37116. o[28] = x7 >>> 0 & 0xff;
  37117. o[29] = x7 >>> 8 & 0xff;
  37118. o[30] = x7 >>> 16 & 0xff;
  37119. o[31] = x7 >>> 24 & 0xff;
  37120. o[32] = x8 >>> 0 & 0xff;
  37121. o[33] = x8 >>> 8 & 0xff;
  37122. o[34] = x8 >>> 16 & 0xff;
  37123. o[35] = x8 >>> 24 & 0xff;
  37124. o[36] = x9 >>> 0 & 0xff;
  37125. o[37] = x9 >>> 8 & 0xff;
  37126. o[38] = x9 >>> 16 & 0xff;
  37127. o[39] = x9 >>> 24 & 0xff;
  37128. o[40] = x10 >>> 0 & 0xff;
  37129. o[41] = x10 >>> 8 & 0xff;
  37130. o[42] = x10 >>> 16 & 0xff;
  37131. o[43] = x10 >>> 24 & 0xff;
  37132. o[44] = x11 >>> 0 & 0xff;
  37133. o[45] = x11 >>> 8 & 0xff;
  37134. o[46] = x11 >>> 16 & 0xff;
  37135. o[47] = x11 >>> 24 & 0xff;
  37136. o[48] = x12 >>> 0 & 0xff;
  37137. o[49] = x12 >>> 8 & 0xff;
  37138. o[50] = x12 >>> 16 & 0xff;
  37139. o[51] = x12 >>> 24 & 0xff;
  37140. o[52] = x13 >>> 0 & 0xff;
  37141. o[53] = x13 >>> 8 & 0xff;
  37142. o[54] = x13 >>> 16 & 0xff;
  37143. o[55] = x13 >>> 24 & 0xff;
  37144. o[56] = x14 >>> 0 & 0xff;
  37145. o[57] = x14 >>> 8 & 0xff;
  37146. o[58] = x14 >>> 16 & 0xff;
  37147. o[59] = x14 >>> 24 & 0xff;
  37148. o[60] = x15 >>> 0 & 0xff;
  37149. o[61] = x15 >>> 8 & 0xff;
  37150. o[62] = x15 >>> 16 & 0xff;
  37151. o[63] = x15 >>> 24 & 0xff;
  37152. }
  37153. function core_hsalsa20(o,p,k,c) {
  37154. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37155. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37156. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37157. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37158. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37159. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37160. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37161. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37162. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37163. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37164. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37165. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37166. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37167. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37168. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37169. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37170. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37171. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37172. x15 = j15, u;
  37173. for (var i = 0; i < 20; i += 2) {
  37174. u = x0 + x12 | 0;
  37175. x4 ^= u<<7 | u>>>(32-7);
  37176. u = x4 + x0 | 0;
  37177. x8 ^= u<<9 | u>>>(32-9);
  37178. u = x8 + x4 | 0;
  37179. x12 ^= u<<13 | u>>>(32-13);
  37180. u = x12 + x8 | 0;
  37181. x0 ^= u<<18 | u>>>(32-18);
  37182. u = x5 + x1 | 0;
  37183. x9 ^= u<<7 | u>>>(32-7);
  37184. u = x9 + x5 | 0;
  37185. x13 ^= u<<9 | u>>>(32-9);
  37186. u = x13 + x9 | 0;
  37187. x1 ^= u<<13 | u>>>(32-13);
  37188. u = x1 + x13 | 0;
  37189. x5 ^= u<<18 | u>>>(32-18);
  37190. u = x10 + x6 | 0;
  37191. x14 ^= u<<7 | u>>>(32-7);
  37192. u = x14 + x10 | 0;
  37193. x2 ^= u<<9 | u>>>(32-9);
  37194. u = x2 + x14 | 0;
  37195. x6 ^= u<<13 | u>>>(32-13);
  37196. u = x6 + x2 | 0;
  37197. x10 ^= u<<18 | u>>>(32-18);
  37198. u = x15 + x11 | 0;
  37199. x3 ^= u<<7 | u>>>(32-7);
  37200. u = x3 + x15 | 0;
  37201. x7 ^= u<<9 | u>>>(32-9);
  37202. u = x7 + x3 | 0;
  37203. x11 ^= u<<13 | u>>>(32-13);
  37204. u = x11 + x7 | 0;
  37205. x15 ^= u<<18 | u>>>(32-18);
  37206. u = x0 + x3 | 0;
  37207. x1 ^= u<<7 | u>>>(32-7);
  37208. u = x1 + x0 | 0;
  37209. x2 ^= u<<9 | u>>>(32-9);
  37210. u = x2 + x1 | 0;
  37211. x3 ^= u<<13 | u>>>(32-13);
  37212. u = x3 + x2 | 0;
  37213. x0 ^= u<<18 | u>>>(32-18);
  37214. u = x5 + x4 | 0;
  37215. x6 ^= u<<7 | u>>>(32-7);
  37216. u = x6 + x5 | 0;
  37217. x7 ^= u<<9 | u>>>(32-9);
  37218. u = x7 + x6 | 0;
  37219. x4 ^= u<<13 | u>>>(32-13);
  37220. u = x4 + x7 | 0;
  37221. x5 ^= u<<18 | u>>>(32-18);
  37222. u = x10 + x9 | 0;
  37223. x11 ^= u<<7 | u>>>(32-7);
  37224. u = x11 + x10 | 0;
  37225. x8 ^= u<<9 | u>>>(32-9);
  37226. u = x8 + x11 | 0;
  37227. x9 ^= u<<13 | u>>>(32-13);
  37228. u = x9 + x8 | 0;
  37229. x10 ^= u<<18 | u>>>(32-18);
  37230. u = x15 + x14 | 0;
  37231. x12 ^= u<<7 | u>>>(32-7);
  37232. u = x12 + x15 | 0;
  37233. x13 ^= u<<9 | u>>>(32-9);
  37234. u = x13 + x12 | 0;
  37235. x14 ^= u<<13 | u>>>(32-13);
  37236. u = x14 + x13 | 0;
  37237. x15 ^= u<<18 | u>>>(32-18);
  37238. }
  37239. o[ 0] = x0 >>> 0 & 0xff;
  37240. o[ 1] = x0 >>> 8 & 0xff;
  37241. o[ 2] = x0 >>> 16 & 0xff;
  37242. o[ 3] = x0 >>> 24 & 0xff;
  37243. o[ 4] = x5 >>> 0 & 0xff;
  37244. o[ 5] = x5 >>> 8 & 0xff;
  37245. o[ 6] = x5 >>> 16 & 0xff;
  37246. o[ 7] = x5 >>> 24 & 0xff;
  37247. o[ 8] = x10 >>> 0 & 0xff;
  37248. o[ 9] = x10 >>> 8 & 0xff;
  37249. o[10] = x10 >>> 16 & 0xff;
  37250. o[11] = x10 >>> 24 & 0xff;
  37251. o[12] = x15 >>> 0 & 0xff;
  37252. o[13] = x15 >>> 8 & 0xff;
  37253. o[14] = x15 >>> 16 & 0xff;
  37254. o[15] = x15 >>> 24 & 0xff;
  37255. o[16] = x6 >>> 0 & 0xff;
  37256. o[17] = x6 >>> 8 & 0xff;
  37257. o[18] = x6 >>> 16 & 0xff;
  37258. o[19] = x6 >>> 24 & 0xff;
  37259. o[20] = x7 >>> 0 & 0xff;
  37260. o[21] = x7 >>> 8 & 0xff;
  37261. o[22] = x7 >>> 16 & 0xff;
  37262. o[23] = x7 >>> 24 & 0xff;
  37263. o[24] = x8 >>> 0 & 0xff;
  37264. o[25] = x8 >>> 8 & 0xff;
  37265. o[26] = x8 >>> 16 & 0xff;
  37266. o[27] = x8 >>> 24 & 0xff;
  37267. o[28] = x9 >>> 0 & 0xff;
  37268. o[29] = x9 >>> 8 & 0xff;
  37269. o[30] = x9 >>> 16 & 0xff;
  37270. o[31] = x9 >>> 24 & 0xff;
  37271. }
  37272. function crypto_core_salsa20(out,inp,k,c) {
  37273. core_salsa20(out,inp,k,c);
  37274. }
  37275. function crypto_core_hsalsa20(out,inp,k,c) {
  37276. core_hsalsa20(out,inp,k,c);
  37277. }
  37278. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  37279. // "expand 32-byte k"
  37280. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  37281. var z = new Uint8Array(16), x = new Uint8Array(64);
  37282. var u, i;
  37283. for (i = 0; i < 16; i++) z[i] = 0;
  37284. for (i = 0; i < 8; i++) z[i] = n[i];
  37285. while (b >= 64) {
  37286. crypto_core_salsa20(x,z,k,sigma);
  37287. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37288. u = 1;
  37289. for (i = 8; i < 16; i++) {
  37290. u = u + (z[i] & 0xff) | 0;
  37291. z[i] = u & 0xff;
  37292. u >>>= 8;
  37293. }
  37294. b -= 64;
  37295. cpos += 64;
  37296. mpos += 64;
  37297. }
  37298. if (b > 0) {
  37299. crypto_core_salsa20(x,z,k,sigma);
  37300. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37301. }
  37302. return 0;
  37303. }
  37304. function crypto_stream_salsa20(c,cpos,b,n,k) {
  37305. var z = new Uint8Array(16), x = new Uint8Array(64);
  37306. var u, i;
  37307. for (i = 0; i < 16; i++) z[i] = 0;
  37308. for (i = 0; i < 8; i++) z[i] = n[i];
  37309. while (b >= 64) {
  37310. crypto_core_salsa20(x,z,k,sigma);
  37311. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  37312. u = 1;
  37313. for (i = 8; i < 16; i++) {
  37314. u = u + (z[i] & 0xff) | 0;
  37315. z[i] = u & 0xff;
  37316. u >>>= 8;
  37317. }
  37318. b -= 64;
  37319. cpos += 64;
  37320. }
  37321. if (b > 0) {
  37322. crypto_core_salsa20(x,z,k,sigma);
  37323. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  37324. }
  37325. return 0;
  37326. }
  37327. function crypto_stream(c,cpos,d,n,k) {
  37328. var s = new Uint8Array(32);
  37329. crypto_core_hsalsa20(s,n,k,sigma);
  37330. var sn = new Uint8Array(8);
  37331. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37332. return crypto_stream_salsa20(c,cpos,d,sn,s);
  37333. }
  37334. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  37335. var s = new Uint8Array(32);
  37336. crypto_core_hsalsa20(s,n,k,sigma);
  37337. var sn = new Uint8Array(8);
  37338. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37339. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  37340. }
  37341. /*
  37342. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  37343. * https://github.com/floodyberry/poly1305-donna
  37344. */
  37345. var poly1305 = function(key) {
  37346. this.buffer = new Uint8Array(16);
  37347. this.r = new Uint16Array(10);
  37348. this.h = new Uint16Array(10);
  37349. this.pad = new Uint16Array(8);
  37350. this.leftover = 0;
  37351. this.fin = 0;
  37352. var t0, t1, t2, t3, t4, t5, t6, t7;
  37353. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  37354. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37355. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  37356. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37357. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  37358. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  37359. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37360. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  37361. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37362. this.r[9] = ((t7 >>> 5)) & 0x007f;
  37363. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  37364. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  37365. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  37366. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  37367. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  37368. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  37369. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  37370. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  37371. };
  37372. poly1305.prototype.blocks = function(m, mpos, bytes) {
  37373. var hibit = this.fin ? 0 : (1 << 11);
  37374. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  37375. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  37376. var h0 = this.h[0],
  37377. h1 = this.h[1],
  37378. h2 = this.h[2],
  37379. h3 = this.h[3],
  37380. h4 = this.h[4],
  37381. h5 = this.h[5],
  37382. h6 = this.h[6],
  37383. h7 = this.h[7],
  37384. h8 = this.h[8],
  37385. h9 = this.h[9];
  37386. var r0 = this.r[0],
  37387. r1 = this.r[1],
  37388. r2 = this.r[2],
  37389. r3 = this.r[3],
  37390. r4 = this.r[4],
  37391. r5 = this.r[5],
  37392. r6 = this.r[6],
  37393. r7 = this.r[7],
  37394. r8 = this.r[8],
  37395. r9 = this.r[9];
  37396. while (bytes >= 16) {
  37397. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  37398. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37399. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  37400. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37401. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  37402. h5 += ((t4 >>> 1)) & 0x1fff;
  37403. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37404. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  37405. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37406. h9 += ((t7 >>> 5)) | hibit;
  37407. c = 0;
  37408. d0 = c;
  37409. d0 += h0 * r0;
  37410. d0 += h1 * (5 * r9);
  37411. d0 += h2 * (5 * r8);
  37412. d0 += h3 * (5 * r7);
  37413. d0 += h4 * (5 * r6);
  37414. c = (d0 >>> 13); d0 &= 0x1fff;
  37415. d0 += h5 * (5 * r5);
  37416. d0 += h6 * (5 * r4);
  37417. d0 += h7 * (5 * r3);
  37418. d0 += h8 * (5 * r2);
  37419. d0 += h9 * (5 * r1);
  37420. c += (d0 >>> 13); d0 &= 0x1fff;
  37421. d1 = c;
  37422. d1 += h0 * r1;
  37423. d1 += h1 * r0;
  37424. d1 += h2 * (5 * r9);
  37425. d1 += h3 * (5 * r8);
  37426. d1 += h4 * (5 * r7);
  37427. c = (d1 >>> 13); d1 &= 0x1fff;
  37428. d1 += h5 * (5 * r6);
  37429. d1 += h6 * (5 * r5);
  37430. d1 += h7 * (5 * r4);
  37431. d1 += h8 * (5 * r3);
  37432. d1 += h9 * (5 * r2);
  37433. c += (d1 >>> 13); d1 &= 0x1fff;
  37434. d2 = c;
  37435. d2 += h0 * r2;
  37436. d2 += h1 * r1;
  37437. d2 += h2 * r0;
  37438. d2 += h3 * (5 * r9);
  37439. d2 += h4 * (5 * r8);
  37440. c = (d2 >>> 13); d2 &= 0x1fff;
  37441. d2 += h5 * (5 * r7);
  37442. d2 += h6 * (5 * r6);
  37443. d2 += h7 * (5 * r5);
  37444. d2 += h8 * (5 * r4);
  37445. d2 += h9 * (5 * r3);
  37446. c += (d2 >>> 13); d2 &= 0x1fff;
  37447. d3 = c;
  37448. d3 += h0 * r3;
  37449. d3 += h1 * r2;
  37450. d3 += h2 * r1;
  37451. d3 += h3 * r0;
  37452. d3 += h4 * (5 * r9);
  37453. c = (d3 >>> 13); d3 &= 0x1fff;
  37454. d3 += h5 * (5 * r8);
  37455. d3 += h6 * (5 * r7);
  37456. d3 += h7 * (5 * r6);
  37457. d3 += h8 * (5 * r5);
  37458. d3 += h9 * (5 * r4);
  37459. c += (d3 >>> 13); d3 &= 0x1fff;
  37460. d4 = c;
  37461. d4 += h0 * r4;
  37462. d4 += h1 * r3;
  37463. d4 += h2 * r2;
  37464. d4 += h3 * r1;
  37465. d4 += h4 * r0;
  37466. c = (d4 >>> 13); d4 &= 0x1fff;
  37467. d4 += h5 * (5 * r9);
  37468. d4 += h6 * (5 * r8);
  37469. d4 += h7 * (5 * r7);
  37470. d4 += h8 * (5 * r6);
  37471. d4 += h9 * (5 * r5);
  37472. c += (d4 >>> 13); d4 &= 0x1fff;
  37473. d5 = c;
  37474. d5 += h0 * r5;
  37475. d5 += h1 * r4;
  37476. d5 += h2 * r3;
  37477. d5 += h3 * r2;
  37478. d5 += h4 * r1;
  37479. c = (d5 >>> 13); d5 &= 0x1fff;
  37480. d5 += h5 * r0;
  37481. d5 += h6 * (5 * r9);
  37482. d5 += h7 * (5 * r8);
  37483. d5 += h8 * (5 * r7);
  37484. d5 += h9 * (5 * r6);
  37485. c += (d5 >>> 13); d5 &= 0x1fff;
  37486. d6 = c;
  37487. d6 += h0 * r6;
  37488. d6 += h1 * r5;
  37489. d6 += h2 * r4;
  37490. d6 += h3 * r3;
  37491. d6 += h4 * r2;
  37492. c = (d6 >>> 13); d6 &= 0x1fff;
  37493. d6 += h5 * r1;
  37494. d6 += h6 * r0;
  37495. d6 += h7 * (5 * r9);
  37496. d6 += h8 * (5 * r8);
  37497. d6 += h9 * (5 * r7);
  37498. c += (d6 >>> 13); d6 &= 0x1fff;
  37499. d7 = c;
  37500. d7 += h0 * r7;
  37501. d7 += h1 * r6;
  37502. d7 += h2 * r5;
  37503. d7 += h3 * r4;
  37504. d7 += h4 * r3;
  37505. c = (d7 >>> 13); d7 &= 0x1fff;
  37506. d7 += h5 * r2;
  37507. d7 += h6 * r1;
  37508. d7 += h7 * r0;
  37509. d7 += h8 * (5 * r9);
  37510. d7 += h9 * (5 * r8);
  37511. c += (d7 >>> 13); d7 &= 0x1fff;
  37512. d8 = c;
  37513. d8 += h0 * r8;
  37514. d8 += h1 * r7;
  37515. d8 += h2 * r6;
  37516. d8 += h3 * r5;
  37517. d8 += h4 * r4;
  37518. c = (d8 >>> 13); d8 &= 0x1fff;
  37519. d8 += h5 * r3;
  37520. d8 += h6 * r2;
  37521. d8 += h7 * r1;
  37522. d8 += h8 * r0;
  37523. d8 += h9 * (5 * r9);
  37524. c += (d8 >>> 13); d8 &= 0x1fff;
  37525. d9 = c;
  37526. d9 += h0 * r9;
  37527. d9 += h1 * r8;
  37528. d9 += h2 * r7;
  37529. d9 += h3 * r6;
  37530. d9 += h4 * r5;
  37531. c = (d9 >>> 13); d9 &= 0x1fff;
  37532. d9 += h5 * r4;
  37533. d9 += h6 * r3;
  37534. d9 += h7 * r2;
  37535. d9 += h8 * r1;
  37536. d9 += h9 * r0;
  37537. c += (d9 >>> 13); d9 &= 0x1fff;
  37538. c = (((c << 2) + c)) | 0;
  37539. c = (c + d0) | 0;
  37540. d0 = c & 0x1fff;
  37541. c = (c >>> 13);
  37542. d1 += c;
  37543. h0 = d0;
  37544. h1 = d1;
  37545. h2 = d2;
  37546. h3 = d3;
  37547. h4 = d4;
  37548. h5 = d5;
  37549. h6 = d6;
  37550. h7 = d7;
  37551. h8 = d8;
  37552. h9 = d9;
  37553. mpos += 16;
  37554. bytes -= 16;
  37555. }
  37556. this.h[0] = h0;
  37557. this.h[1] = h1;
  37558. this.h[2] = h2;
  37559. this.h[3] = h3;
  37560. this.h[4] = h4;
  37561. this.h[5] = h5;
  37562. this.h[6] = h6;
  37563. this.h[7] = h7;
  37564. this.h[8] = h8;
  37565. this.h[9] = h9;
  37566. };
  37567. poly1305.prototype.finish = function(mac, macpos) {
  37568. var g = new Uint16Array(10);
  37569. var c, mask, f, i;
  37570. if (this.leftover) {
  37571. i = this.leftover;
  37572. this.buffer[i++] = 1;
  37573. for (; i < 16; i++) this.buffer[i] = 0;
  37574. this.fin = 1;
  37575. this.blocks(this.buffer, 0, 16);
  37576. }
  37577. c = this.h[1] >>> 13;
  37578. this.h[1] &= 0x1fff;
  37579. for (i = 2; i < 10; i++) {
  37580. this.h[i] += c;
  37581. c = this.h[i] >>> 13;
  37582. this.h[i] &= 0x1fff;
  37583. }
  37584. this.h[0] += (c * 5);
  37585. c = this.h[0] >>> 13;
  37586. this.h[0] &= 0x1fff;
  37587. this.h[1] += c;
  37588. c = this.h[1] >>> 13;
  37589. this.h[1] &= 0x1fff;
  37590. this.h[2] += c;
  37591. g[0] = this.h[0] + 5;
  37592. c = g[0] >>> 13;
  37593. g[0] &= 0x1fff;
  37594. for (i = 1; i < 10; i++) {
  37595. g[i] = this.h[i] + c;
  37596. c = g[i] >>> 13;
  37597. g[i] &= 0x1fff;
  37598. }
  37599. g[9] -= (1 << 13);
  37600. mask = (c ^ 1) - 1;
  37601. for (i = 0; i < 10; i++) g[i] &= mask;
  37602. mask = ~mask;
  37603. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  37604. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  37605. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  37606. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  37607. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  37608. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  37609. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  37610. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  37611. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  37612. f = this.h[0] + this.pad[0];
  37613. this.h[0] = f & 0xffff;
  37614. for (i = 1; i < 8; i++) {
  37615. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  37616. this.h[i] = f & 0xffff;
  37617. }
  37618. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  37619. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  37620. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  37621. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  37622. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  37623. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  37624. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  37625. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  37626. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  37627. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  37628. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  37629. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  37630. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  37631. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  37632. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  37633. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  37634. };
  37635. poly1305.prototype.update = function(m, mpos, bytes) {
  37636. var i, want;
  37637. if (this.leftover) {
  37638. want = (16 - this.leftover);
  37639. if (want > bytes)
  37640. want = bytes;
  37641. for (i = 0; i < want; i++)
  37642. this.buffer[this.leftover + i] = m[mpos+i];
  37643. bytes -= want;
  37644. mpos += want;
  37645. this.leftover += want;
  37646. if (this.leftover < 16)
  37647. return;
  37648. this.blocks(this.buffer, 0, 16);
  37649. this.leftover = 0;
  37650. }
  37651. if (bytes >= 16) {
  37652. want = bytes - (bytes % 16);
  37653. this.blocks(m, mpos, want);
  37654. mpos += want;
  37655. bytes -= want;
  37656. }
  37657. if (bytes) {
  37658. for (i = 0; i < bytes; i++)
  37659. this.buffer[this.leftover + i] = m[mpos+i];
  37660. this.leftover += bytes;
  37661. }
  37662. };
  37663. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  37664. var s = new poly1305(k);
  37665. s.update(m, mpos, n);
  37666. s.finish(out, outpos);
  37667. return 0;
  37668. }
  37669. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  37670. var x = new Uint8Array(16);
  37671. crypto_onetimeauth(x,0,m,mpos,n,k);
  37672. return crypto_verify_16(h,hpos,x,0);
  37673. }
  37674. function crypto_secretbox(c,m,d,n,k) {
  37675. var i;
  37676. if (d < 32) return -1;
  37677. crypto_stream_xor(c,0,m,0,d,n,k);
  37678. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  37679. for (i = 0; i < 16; i++) c[i] = 0;
  37680. return 0;
  37681. }
  37682. function crypto_secretbox_open(m,c,d,n,k) {
  37683. var i;
  37684. var x = new Uint8Array(32);
  37685. if (d < 32) return -1;
  37686. crypto_stream(x,0,32,n,k);
  37687. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  37688. crypto_stream_xor(m,0,c,0,d,n,k);
  37689. for (i = 0; i < 32; i++) m[i] = 0;
  37690. return 0;
  37691. }
  37692. function set25519(r, a) {
  37693. var i;
  37694. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  37695. }
  37696. function car25519(o) {
  37697. var i, v, c = 1;
  37698. for (i = 0; i < 16; i++) {
  37699. v = o[i] + c + 65535;
  37700. c = Math.floor(v / 65536);
  37701. o[i] = v - c * 65536;
  37702. }
  37703. o[0] += c-1 + 37 * (c-1);
  37704. }
  37705. function sel25519(p, q, b) {
  37706. var t, c = ~(b-1);
  37707. for (var i = 0; i < 16; i++) {
  37708. t = c & (p[i] ^ q[i]);
  37709. p[i] ^= t;
  37710. q[i] ^= t;
  37711. }
  37712. }
  37713. function pack25519(o, n) {
  37714. var i, j, b;
  37715. var m = gf(), t = gf();
  37716. for (i = 0; i < 16; i++) t[i] = n[i];
  37717. car25519(t);
  37718. car25519(t);
  37719. car25519(t);
  37720. for (j = 0; j < 2; j++) {
  37721. m[0] = t[0] - 0xffed;
  37722. for (i = 1; i < 15; i++) {
  37723. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  37724. m[i-1] &= 0xffff;
  37725. }
  37726. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  37727. b = (m[15]>>16) & 1;
  37728. m[14] &= 0xffff;
  37729. sel25519(t, m, 1-b);
  37730. }
  37731. for (i = 0; i < 16; i++) {
  37732. o[2*i] = t[i] & 0xff;
  37733. o[2*i+1] = t[i]>>8;
  37734. }
  37735. }
  37736. function neq25519(a, b) {
  37737. var c = new Uint8Array(32), d = new Uint8Array(32);
  37738. pack25519(c, a);
  37739. pack25519(d, b);
  37740. return crypto_verify_32(c, 0, d, 0);
  37741. }
  37742. function par25519(a) {
  37743. var d = new Uint8Array(32);
  37744. pack25519(d, a);
  37745. return d[0] & 1;
  37746. }
  37747. function unpack25519(o, n) {
  37748. var i;
  37749. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  37750. o[15] &= 0x7fff;
  37751. }
  37752. function A(o, a, b) {
  37753. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  37754. }
  37755. function Z(o, a, b) {
  37756. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  37757. }
  37758. function M(o, a, b) {
  37759. var v, c,
  37760. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  37761. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  37762. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  37763. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  37764. b0 = b[0],
  37765. b1 = b[1],
  37766. b2 = b[2],
  37767. b3 = b[3],
  37768. b4 = b[4],
  37769. b5 = b[5],
  37770. b6 = b[6],
  37771. b7 = b[7],
  37772. b8 = b[8],
  37773. b9 = b[9],
  37774. b10 = b[10],
  37775. b11 = b[11],
  37776. b12 = b[12],
  37777. b13 = b[13],
  37778. b14 = b[14],
  37779. b15 = b[15];
  37780. v = a[0];
  37781. t0 += v * b0;
  37782. t1 += v * b1;
  37783. t2 += v * b2;
  37784. t3 += v * b3;
  37785. t4 += v * b4;
  37786. t5 += v * b5;
  37787. t6 += v * b6;
  37788. t7 += v * b7;
  37789. t8 += v * b8;
  37790. t9 += v * b9;
  37791. t10 += v * b10;
  37792. t11 += v * b11;
  37793. t12 += v * b12;
  37794. t13 += v * b13;
  37795. t14 += v * b14;
  37796. t15 += v * b15;
  37797. v = a[1];
  37798. t1 += v * b0;
  37799. t2 += v * b1;
  37800. t3 += v * b2;
  37801. t4 += v * b3;
  37802. t5 += v * b4;
  37803. t6 += v * b5;
  37804. t7 += v * b6;
  37805. t8 += v * b7;
  37806. t9 += v * b8;
  37807. t10 += v * b9;
  37808. t11 += v * b10;
  37809. t12 += v * b11;
  37810. t13 += v * b12;
  37811. t14 += v * b13;
  37812. t15 += v * b14;
  37813. t16 += v * b15;
  37814. v = a[2];
  37815. t2 += v * b0;
  37816. t3 += v * b1;
  37817. t4 += v * b2;
  37818. t5 += v * b3;
  37819. t6 += v * b4;
  37820. t7 += v * b5;
  37821. t8 += v * b6;
  37822. t9 += v * b7;
  37823. t10 += v * b8;
  37824. t11 += v * b9;
  37825. t12 += v * b10;
  37826. t13 += v * b11;
  37827. t14 += v * b12;
  37828. t15 += v * b13;
  37829. t16 += v * b14;
  37830. t17 += v * b15;
  37831. v = a[3];
  37832. t3 += v * b0;
  37833. t4 += v * b1;
  37834. t5 += v * b2;
  37835. t6 += v * b3;
  37836. t7 += v * b4;
  37837. t8 += v * b5;
  37838. t9 += v * b6;
  37839. t10 += v * b7;
  37840. t11 += v * b8;
  37841. t12 += v * b9;
  37842. t13 += v * b10;
  37843. t14 += v * b11;
  37844. t15 += v * b12;
  37845. t16 += v * b13;
  37846. t17 += v * b14;
  37847. t18 += v * b15;
  37848. v = a[4];
  37849. t4 += v * b0;
  37850. t5 += v * b1;
  37851. t6 += v * b2;
  37852. t7 += v * b3;
  37853. t8 += v * b4;
  37854. t9 += v * b5;
  37855. t10 += v * b6;
  37856. t11 += v * b7;
  37857. t12 += v * b8;
  37858. t13 += v * b9;
  37859. t14 += v * b10;
  37860. t15 += v * b11;
  37861. t16 += v * b12;
  37862. t17 += v * b13;
  37863. t18 += v * b14;
  37864. t19 += v * b15;
  37865. v = a[5];
  37866. t5 += v * b0;
  37867. t6 += v * b1;
  37868. t7 += v * b2;
  37869. t8 += v * b3;
  37870. t9 += v * b4;
  37871. t10 += v * b5;
  37872. t11 += v * b6;
  37873. t12 += v * b7;
  37874. t13 += v * b8;
  37875. t14 += v * b9;
  37876. t15 += v * b10;
  37877. t16 += v * b11;
  37878. t17 += v * b12;
  37879. t18 += v * b13;
  37880. t19 += v * b14;
  37881. t20 += v * b15;
  37882. v = a[6];
  37883. t6 += v * b0;
  37884. t7 += v * b1;
  37885. t8 += v * b2;
  37886. t9 += v * b3;
  37887. t10 += v * b4;
  37888. t11 += v * b5;
  37889. t12 += v * b6;
  37890. t13 += v * b7;
  37891. t14 += v * b8;
  37892. t15 += v * b9;
  37893. t16 += v * b10;
  37894. t17 += v * b11;
  37895. t18 += v * b12;
  37896. t19 += v * b13;
  37897. t20 += v * b14;
  37898. t21 += v * b15;
  37899. v = a[7];
  37900. t7 += v * b0;
  37901. t8 += v * b1;
  37902. t9 += v * b2;
  37903. t10 += v * b3;
  37904. t11 += v * b4;
  37905. t12 += v * b5;
  37906. t13 += v * b6;
  37907. t14 += v * b7;
  37908. t15 += v * b8;
  37909. t16 += v * b9;
  37910. t17 += v * b10;
  37911. t18 += v * b11;
  37912. t19 += v * b12;
  37913. t20 += v * b13;
  37914. t21 += v * b14;
  37915. t22 += v * b15;
  37916. v = a[8];
  37917. t8 += v * b0;
  37918. t9 += v * b1;
  37919. t10 += v * b2;
  37920. t11 += v * b3;
  37921. t12 += v * b4;
  37922. t13 += v * b5;
  37923. t14 += v * b6;
  37924. t15 += v * b7;
  37925. t16 += v * b8;
  37926. t17 += v * b9;
  37927. t18 += v * b10;
  37928. t19 += v * b11;
  37929. t20 += v * b12;
  37930. t21 += v * b13;
  37931. t22 += v * b14;
  37932. t23 += v * b15;
  37933. v = a[9];
  37934. t9 += v * b0;
  37935. t10 += v * b1;
  37936. t11 += v * b2;
  37937. t12 += v * b3;
  37938. t13 += v * b4;
  37939. t14 += v * b5;
  37940. t15 += v * b6;
  37941. t16 += v * b7;
  37942. t17 += v * b8;
  37943. t18 += v * b9;
  37944. t19 += v * b10;
  37945. t20 += v * b11;
  37946. t21 += v * b12;
  37947. t22 += v * b13;
  37948. t23 += v * b14;
  37949. t24 += v * b15;
  37950. v = a[10];
  37951. t10 += v * b0;
  37952. t11 += v * b1;
  37953. t12 += v * b2;
  37954. t13 += v * b3;
  37955. t14 += v * b4;
  37956. t15 += v * b5;
  37957. t16 += v * b6;
  37958. t17 += v * b7;
  37959. t18 += v * b8;
  37960. t19 += v * b9;
  37961. t20 += v * b10;
  37962. t21 += v * b11;
  37963. t22 += v * b12;
  37964. t23 += v * b13;
  37965. t24 += v * b14;
  37966. t25 += v * b15;
  37967. v = a[11];
  37968. t11 += v * b0;
  37969. t12 += v * b1;
  37970. t13 += v * b2;
  37971. t14 += v * b3;
  37972. t15 += v * b4;
  37973. t16 += v * b5;
  37974. t17 += v * b6;
  37975. t18 += v * b7;
  37976. t19 += v * b8;
  37977. t20 += v * b9;
  37978. t21 += v * b10;
  37979. t22 += v * b11;
  37980. t23 += v * b12;
  37981. t24 += v * b13;
  37982. t25 += v * b14;
  37983. t26 += v * b15;
  37984. v = a[12];
  37985. t12 += v * b0;
  37986. t13 += v * b1;
  37987. t14 += v * b2;
  37988. t15 += v * b3;
  37989. t16 += v * b4;
  37990. t17 += v * b5;
  37991. t18 += v * b6;
  37992. t19 += v * b7;
  37993. t20 += v * b8;
  37994. t21 += v * b9;
  37995. t22 += v * b10;
  37996. t23 += v * b11;
  37997. t24 += v * b12;
  37998. t25 += v * b13;
  37999. t26 += v * b14;
  38000. t27 += v * b15;
  38001. v = a[13];
  38002. t13 += v * b0;
  38003. t14 += v * b1;
  38004. t15 += v * b2;
  38005. t16 += v * b3;
  38006. t17 += v * b4;
  38007. t18 += v * b5;
  38008. t19 += v * b6;
  38009. t20 += v * b7;
  38010. t21 += v * b8;
  38011. t22 += v * b9;
  38012. t23 += v * b10;
  38013. t24 += v * b11;
  38014. t25 += v * b12;
  38015. t26 += v * b13;
  38016. t27 += v * b14;
  38017. t28 += v * b15;
  38018. v = a[14];
  38019. t14 += v * b0;
  38020. t15 += v * b1;
  38021. t16 += v * b2;
  38022. t17 += v * b3;
  38023. t18 += v * b4;
  38024. t19 += v * b5;
  38025. t20 += v * b6;
  38026. t21 += v * b7;
  38027. t22 += v * b8;
  38028. t23 += v * b9;
  38029. t24 += v * b10;
  38030. t25 += v * b11;
  38031. t26 += v * b12;
  38032. t27 += v * b13;
  38033. t28 += v * b14;
  38034. t29 += v * b15;
  38035. v = a[15];
  38036. t15 += v * b0;
  38037. t16 += v * b1;
  38038. t17 += v * b2;
  38039. t18 += v * b3;
  38040. t19 += v * b4;
  38041. t20 += v * b5;
  38042. t21 += v * b6;
  38043. t22 += v * b7;
  38044. t23 += v * b8;
  38045. t24 += v * b9;
  38046. t25 += v * b10;
  38047. t26 += v * b11;
  38048. t27 += v * b12;
  38049. t28 += v * b13;
  38050. t29 += v * b14;
  38051. t30 += v * b15;
  38052. t0 += 38 * t16;
  38053. t1 += 38 * t17;
  38054. t2 += 38 * t18;
  38055. t3 += 38 * t19;
  38056. t4 += 38 * t20;
  38057. t5 += 38 * t21;
  38058. t6 += 38 * t22;
  38059. t7 += 38 * t23;
  38060. t8 += 38 * t24;
  38061. t9 += 38 * t25;
  38062. t10 += 38 * t26;
  38063. t11 += 38 * t27;
  38064. t12 += 38 * t28;
  38065. t13 += 38 * t29;
  38066. t14 += 38 * t30;
  38067. // t15 left as is
  38068. // first car
  38069. c = 1;
  38070. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38071. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38072. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38073. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38074. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38075. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38076. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38077. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38078. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38079. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38080. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38081. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38082. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38083. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38084. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38085. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38086. t0 += c-1 + 37 * (c-1);
  38087. // second car
  38088. c = 1;
  38089. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38090. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38091. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38092. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38093. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38094. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38095. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38096. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38097. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38098. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38099. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38100. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38101. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38102. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38103. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38104. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38105. t0 += c-1 + 37 * (c-1);
  38106. o[ 0] = t0;
  38107. o[ 1] = t1;
  38108. o[ 2] = t2;
  38109. o[ 3] = t3;
  38110. o[ 4] = t4;
  38111. o[ 5] = t5;
  38112. o[ 6] = t6;
  38113. o[ 7] = t7;
  38114. o[ 8] = t8;
  38115. o[ 9] = t9;
  38116. o[10] = t10;
  38117. o[11] = t11;
  38118. o[12] = t12;
  38119. o[13] = t13;
  38120. o[14] = t14;
  38121. o[15] = t15;
  38122. }
  38123. function S(o, a) {
  38124. M(o, a, a);
  38125. }
  38126. function inv25519(o, i) {
  38127. var c = gf();
  38128. var a;
  38129. for (a = 0; a < 16; a++) c[a] = i[a];
  38130. for (a = 253; a >= 0; a--) {
  38131. S(c, c);
  38132. if(a !== 2 && a !== 4) M(c, c, i);
  38133. }
  38134. for (a = 0; a < 16; a++) o[a] = c[a];
  38135. }
  38136. function pow2523(o, i) {
  38137. var c = gf();
  38138. var a;
  38139. for (a = 0; a < 16; a++) c[a] = i[a];
  38140. for (a = 250; a >= 0; a--) {
  38141. S(c, c);
  38142. if(a !== 1) M(c, c, i);
  38143. }
  38144. for (a = 0; a < 16; a++) o[a] = c[a];
  38145. }
  38146. function crypto_scalarmult(q, n, p) {
  38147. var z = new Uint8Array(32);
  38148. var x = new Float64Array(80), r, i;
  38149. var a = gf(), b = gf(), c = gf(),
  38150. d = gf(), e = gf(), f = gf();
  38151. for (i = 0; i < 31; i++) z[i] = n[i];
  38152. z[31]=(n[31]&127)|64;
  38153. z[0]&=248;
  38154. unpack25519(x,p);
  38155. for (i = 0; i < 16; i++) {
  38156. b[i]=x[i];
  38157. d[i]=a[i]=c[i]=0;
  38158. }
  38159. a[0]=d[0]=1;
  38160. for (i=254; i>=0; --i) {
  38161. r=(z[i>>>3]>>>(i&7))&1;
  38162. sel25519(a,b,r);
  38163. sel25519(c,d,r);
  38164. A(e,a,c);
  38165. Z(a,a,c);
  38166. A(c,b,d);
  38167. Z(b,b,d);
  38168. S(d,e);
  38169. S(f,a);
  38170. M(a,c,a);
  38171. M(c,b,e);
  38172. A(e,a,c);
  38173. Z(a,a,c);
  38174. S(b,a);
  38175. Z(c,d,f);
  38176. M(a,c,_121665);
  38177. A(a,a,d);
  38178. M(c,c,a);
  38179. M(a,d,f);
  38180. M(d,b,x);
  38181. S(b,e);
  38182. sel25519(a,b,r);
  38183. sel25519(c,d,r);
  38184. }
  38185. for (i = 0; i < 16; i++) {
  38186. x[i+16]=a[i];
  38187. x[i+32]=c[i];
  38188. x[i+48]=b[i];
  38189. x[i+64]=d[i];
  38190. }
  38191. var x32 = x.subarray(32);
  38192. var x16 = x.subarray(16);
  38193. inv25519(x32,x32);
  38194. M(x16,x16,x32);
  38195. pack25519(q,x16);
  38196. return 0;
  38197. }
  38198. function crypto_scalarmult_base(q, n) {
  38199. return crypto_scalarmult(q, n, _9);
  38200. }
  38201. function crypto_box_keypair(y, x) {
  38202. randombytes(x, 32);
  38203. return crypto_scalarmult_base(y, x);
  38204. }
  38205. function crypto_box_beforenm(k, y, x) {
  38206. var s = new Uint8Array(32);
  38207. crypto_scalarmult(s, x, y);
  38208. return crypto_core_hsalsa20(k, _0, s, sigma);
  38209. }
  38210. var crypto_box_afternm = crypto_secretbox;
  38211. var crypto_box_open_afternm = crypto_secretbox_open;
  38212. function crypto_box(c, m, d, n, y, x) {
  38213. var k = new Uint8Array(32);
  38214. crypto_box_beforenm(k, y, x);
  38215. return crypto_box_afternm(c, m, d, n, k);
  38216. }
  38217. function crypto_box_open(m, c, d, n, y, x) {
  38218. var k = new Uint8Array(32);
  38219. crypto_box_beforenm(k, y, x);
  38220. return crypto_box_open_afternm(m, c, d, n, k);
  38221. }
  38222. var K = [
  38223. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  38224. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  38225. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  38226. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  38227. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  38228. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  38229. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  38230. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  38231. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  38232. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  38233. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  38234. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  38235. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  38236. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  38237. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  38238. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  38239. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  38240. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  38241. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  38242. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  38243. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  38244. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  38245. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  38246. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  38247. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  38248. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  38249. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  38250. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  38251. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  38252. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  38253. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  38254. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  38255. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  38256. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  38257. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  38258. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  38259. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  38260. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  38261. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  38262. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  38263. ];
  38264. function crypto_hashblocks_hl(hh, hl, m, n) {
  38265. var wh = new Int32Array(16), wl = new Int32Array(16),
  38266. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  38267. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  38268. th, tl, i, j, h, l, a, b, c, d;
  38269. var ah0 = hh[0],
  38270. ah1 = hh[1],
  38271. ah2 = hh[2],
  38272. ah3 = hh[3],
  38273. ah4 = hh[4],
  38274. ah5 = hh[5],
  38275. ah6 = hh[6],
  38276. ah7 = hh[7],
  38277. al0 = hl[0],
  38278. al1 = hl[1],
  38279. al2 = hl[2],
  38280. al3 = hl[3],
  38281. al4 = hl[4],
  38282. al5 = hl[5],
  38283. al6 = hl[6],
  38284. al7 = hl[7];
  38285. var pos = 0;
  38286. while (n >= 128) {
  38287. for (i = 0; i < 16; i++) {
  38288. j = 8 * i + pos;
  38289. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  38290. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  38291. }
  38292. for (i = 0; i < 80; i++) {
  38293. bh0 = ah0;
  38294. bh1 = ah1;
  38295. bh2 = ah2;
  38296. bh3 = ah3;
  38297. bh4 = ah4;
  38298. bh5 = ah5;
  38299. bh6 = ah6;
  38300. bh7 = ah7;
  38301. bl0 = al0;
  38302. bl1 = al1;
  38303. bl2 = al2;
  38304. bl3 = al3;
  38305. bl4 = al4;
  38306. bl5 = al5;
  38307. bl6 = al6;
  38308. bl7 = al7;
  38309. // add
  38310. h = ah7;
  38311. l = al7;
  38312. a = l & 0xffff; b = l >>> 16;
  38313. c = h & 0xffff; d = h >>> 16;
  38314. // Sigma1
  38315. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  38316. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  38317. a += l & 0xffff; b += l >>> 16;
  38318. c += h & 0xffff; d += h >>> 16;
  38319. // Ch
  38320. h = (ah4 & ah5) ^ (~ah4 & ah6);
  38321. l = (al4 & al5) ^ (~al4 & al6);
  38322. a += l & 0xffff; b += l >>> 16;
  38323. c += h & 0xffff; d += h >>> 16;
  38324. // K
  38325. h = K[i*2];
  38326. l = K[i*2+1];
  38327. a += l & 0xffff; b += l >>> 16;
  38328. c += h & 0xffff; d += h >>> 16;
  38329. // w
  38330. h = wh[i%16];
  38331. l = wl[i%16];
  38332. a += l & 0xffff; b += l >>> 16;
  38333. c += h & 0xffff; d += h >>> 16;
  38334. b += a >>> 16;
  38335. c += b >>> 16;
  38336. d += c >>> 16;
  38337. th = c & 0xffff | d << 16;
  38338. tl = a & 0xffff | b << 16;
  38339. // add
  38340. h = th;
  38341. l = tl;
  38342. a = l & 0xffff; b = l >>> 16;
  38343. c = h & 0xffff; d = h >>> 16;
  38344. // Sigma0
  38345. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  38346. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  38347. a += l & 0xffff; b += l >>> 16;
  38348. c += h & 0xffff; d += h >>> 16;
  38349. // Maj
  38350. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  38351. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  38352. a += l & 0xffff; b += l >>> 16;
  38353. c += h & 0xffff; d += h >>> 16;
  38354. b += a >>> 16;
  38355. c += b >>> 16;
  38356. d += c >>> 16;
  38357. bh7 = (c & 0xffff) | (d << 16);
  38358. bl7 = (a & 0xffff) | (b << 16);
  38359. // add
  38360. h = bh3;
  38361. l = bl3;
  38362. a = l & 0xffff; b = l >>> 16;
  38363. c = h & 0xffff; d = h >>> 16;
  38364. h = th;
  38365. l = tl;
  38366. a += l & 0xffff; b += l >>> 16;
  38367. c += h & 0xffff; d += h >>> 16;
  38368. b += a >>> 16;
  38369. c += b >>> 16;
  38370. d += c >>> 16;
  38371. bh3 = (c & 0xffff) | (d << 16);
  38372. bl3 = (a & 0xffff) | (b << 16);
  38373. ah1 = bh0;
  38374. ah2 = bh1;
  38375. ah3 = bh2;
  38376. ah4 = bh3;
  38377. ah5 = bh4;
  38378. ah6 = bh5;
  38379. ah7 = bh6;
  38380. ah0 = bh7;
  38381. al1 = bl0;
  38382. al2 = bl1;
  38383. al3 = bl2;
  38384. al4 = bl3;
  38385. al5 = bl4;
  38386. al6 = bl5;
  38387. al7 = bl6;
  38388. al0 = bl7;
  38389. if (i%16 === 15) {
  38390. for (j = 0; j < 16; j++) {
  38391. // add
  38392. h = wh[j];
  38393. l = wl[j];
  38394. a = l & 0xffff; b = l >>> 16;
  38395. c = h & 0xffff; d = h >>> 16;
  38396. h = wh[(j+9)%16];
  38397. l = wl[(j+9)%16];
  38398. a += l & 0xffff; b += l >>> 16;
  38399. c += h & 0xffff; d += h >>> 16;
  38400. // sigma0
  38401. th = wh[(j+1)%16];
  38402. tl = wl[(j+1)%16];
  38403. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  38404. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  38405. a += l & 0xffff; b += l >>> 16;
  38406. c += h & 0xffff; d += h >>> 16;
  38407. // sigma1
  38408. th = wh[(j+14)%16];
  38409. tl = wl[(j+14)%16];
  38410. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  38411. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  38412. a += l & 0xffff; b += l >>> 16;
  38413. c += h & 0xffff; d += h >>> 16;
  38414. b += a >>> 16;
  38415. c += b >>> 16;
  38416. d += c >>> 16;
  38417. wh[j] = (c & 0xffff) | (d << 16);
  38418. wl[j] = (a & 0xffff) | (b << 16);
  38419. }
  38420. }
  38421. }
  38422. // add
  38423. h = ah0;
  38424. l = al0;
  38425. a = l & 0xffff; b = l >>> 16;
  38426. c = h & 0xffff; d = h >>> 16;
  38427. h = hh[0];
  38428. l = hl[0];
  38429. a += l & 0xffff; b += l >>> 16;
  38430. c += h & 0xffff; d += h >>> 16;
  38431. b += a >>> 16;
  38432. c += b >>> 16;
  38433. d += c >>> 16;
  38434. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  38435. hl[0] = al0 = (a & 0xffff) | (b << 16);
  38436. h = ah1;
  38437. l = al1;
  38438. a = l & 0xffff; b = l >>> 16;
  38439. c = h & 0xffff; d = h >>> 16;
  38440. h = hh[1];
  38441. l = hl[1];
  38442. a += l & 0xffff; b += l >>> 16;
  38443. c += h & 0xffff; d += h >>> 16;
  38444. b += a >>> 16;
  38445. c += b >>> 16;
  38446. d += c >>> 16;
  38447. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  38448. hl[1] = al1 = (a & 0xffff) | (b << 16);
  38449. h = ah2;
  38450. l = al2;
  38451. a = l & 0xffff; b = l >>> 16;
  38452. c = h & 0xffff; d = h >>> 16;
  38453. h = hh[2];
  38454. l = hl[2];
  38455. a += l & 0xffff; b += l >>> 16;
  38456. c += h & 0xffff; d += h >>> 16;
  38457. b += a >>> 16;
  38458. c += b >>> 16;
  38459. d += c >>> 16;
  38460. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  38461. hl[2] = al2 = (a & 0xffff) | (b << 16);
  38462. h = ah3;
  38463. l = al3;
  38464. a = l & 0xffff; b = l >>> 16;
  38465. c = h & 0xffff; d = h >>> 16;
  38466. h = hh[3];
  38467. l = hl[3];
  38468. a += l & 0xffff; b += l >>> 16;
  38469. c += h & 0xffff; d += h >>> 16;
  38470. b += a >>> 16;
  38471. c += b >>> 16;
  38472. d += c >>> 16;
  38473. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  38474. hl[3] = al3 = (a & 0xffff) | (b << 16);
  38475. h = ah4;
  38476. l = al4;
  38477. a = l & 0xffff; b = l >>> 16;
  38478. c = h & 0xffff; d = h >>> 16;
  38479. h = hh[4];
  38480. l = hl[4];
  38481. a += l & 0xffff; b += l >>> 16;
  38482. c += h & 0xffff; d += h >>> 16;
  38483. b += a >>> 16;
  38484. c += b >>> 16;
  38485. d += c >>> 16;
  38486. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  38487. hl[4] = al4 = (a & 0xffff) | (b << 16);
  38488. h = ah5;
  38489. l = al5;
  38490. a = l & 0xffff; b = l >>> 16;
  38491. c = h & 0xffff; d = h >>> 16;
  38492. h = hh[5];
  38493. l = hl[5];
  38494. a += l & 0xffff; b += l >>> 16;
  38495. c += h & 0xffff; d += h >>> 16;
  38496. b += a >>> 16;
  38497. c += b >>> 16;
  38498. d += c >>> 16;
  38499. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  38500. hl[5] = al5 = (a & 0xffff) | (b << 16);
  38501. h = ah6;
  38502. l = al6;
  38503. a = l & 0xffff; b = l >>> 16;
  38504. c = h & 0xffff; d = h >>> 16;
  38505. h = hh[6];
  38506. l = hl[6];
  38507. a += l & 0xffff; b += l >>> 16;
  38508. c += h & 0xffff; d += h >>> 16;
  38509. b += a >>> 16;
  38510. c += b >>> 16;
  38511. d += c >>> 16;
  38512. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  38513. hl[6] = al6 = (a & 0xffff) | (b << 16);
  38514. h = ah7;
  38515. l = al7;
  38516. a = l & 0xffff; b = l >>> 16;
  38517. c = h & 0xffff; d = h >>> 16;
  38518. h = hh[7];
  38519. l = hl[7];
  38520. a += l & 0xffff; b += l >>> 16;
  38521. c += h & 0xffff; d += h >>> 16;
  38522. b += a >>> 16;
  38523. c += b >>> 16;
  38524. d += c >>> 16;
  38525. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  38526. hl[7] = al7 = (a & 0xffff) | (b << 16);
  38527. pos += 128;
  38528. n -= 128;
  38529. }
  38530. return n;
  38531. }
  38532. function crypto_hash(out, m, n) {
  38533. var hh = new Int32Array(8),
  38534. hl = new Int32Array(8),
  38535. x = new Uint8Array(256),
  38536. i, b = n;
  38537. hh[0] = 0x6a09e667;
  38538. hh[1] = 0xbb67ae85;
  38539. hh[2] = 0x3c6ef372;
  38540. hh[3] = 0xa54ff53a;
  38541. hh[4] = 0x510e527f;
  38542. hh[5] = 0x9b05688c;
  38543. hh[6] = 0x1f83d9ab;
  38544. hh[7] = 0x5be0cd19;
  38545. hl[0] = 0xf3bcc908;
  38546. hl[1] = 0x84caa73b;
  38547. hl[2] = 0xfe94f82b;
  38548. hl[3] = 0x5f1d36f1;
  38549. hl[4] = 0xade682d1;
  38550. hl[5] = 0x2b3e6c1f;
  38551. hl[6] = 0xfb41bd6b;
  38552. hl[7] = 0x137e2179;
  38553. crypto_hashblocks_hl(hh, hl, m, n);
  38554. n %= 128;
  38555. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  38556. x[n] = 128;
  38557. n = 256-128*(n<112?1:0);
  38558. x[n-9] = 0;
  38559. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  38560. crypto_hashblocks_hl(hh, hl, x, n);
  38561. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  38562. return 0;
  38563. }
  38564. function add(p, q) {
  38565. var a = gf(), b = gf(), c = gf(),
  38566. d = gf(), e = gf(), f = gf(),
  38567. g = gf(), h = gf(), t = gf();
  38568. Z(a, p[1], p[0]);
  38569. Z(t, q[1], q[0]);
  38570. M(a, a, t);
  38571. A(b, p[0], p[1]);
  38572. A(t, q[0], q[1]);
  38573. M(b, b, t);
  38574. M(c, p[3], q[3]);
  38575. M(c, c, D2);
  38576. M(d, p[2], q[2]);
  38577. A(d, d, d);
  38578. Z(e, b, a);
  38579. Z(f, d, c);
  38580. A(g, d, c);
  38581. A(h, b, a);
  38582. M(p[0], e, f);
  38583. M(p[1], h, g);
  38584. M(p[2], g, f);
  38585. M(p[3], e, h);
  38586. }
  38587. function cswap(p, q, b) {
  38588. var i;
  38589. for (i = 0; i < 4; i++) {
  38590. sel25519(p[i], q[i], b);
  38591. }
  38592. }
  38593. function pack(r, p) {
  38594. var tx = gf(), ty = gf(), zi = gf();
  38595. inv25519(zi, p[2]);
  38596. M(tx, p[0], zi);
  38597. M(ty, p[1], zi);
  38598. pack25519(r, ty);
  38599. r[31] ^= par25519(tx) << 7;
  38600. }
  38601. function scalarmult(p, q, s) {
  38602. var b, i;
  38603. set25519(p[0], gf0);
  38604. set25519(p[1], gf1);
  38605. set25519(p[2], gf1);
  38606. set25519(p[3], gf0);
  38607. for (i = 255; i >= 0; --i) {
  38608. b = (s[(i/8)|0] >> (i&7)) & 1;
  38609. cswap(p, q, b);
  38610. add(q, p);
  38611. add(p, p);
  38612. cswap(p, q, b);
  38613. }
  38614. }
  38615. function scalarbase(p, s) {
  38616. var q = [gf(), gf(), gf(), gf()];
  38617. set25519(q[0], X);
  38618. set25519(q[1], Y);
  38619. set25519(q[2], gf1);
  38620. M(q[3], X, Y);
  38621. scalarmult(p, q, s);
  38622. }
  38623. function crypto_sign_keypair(pk, sk, seeded) {
  38624. var d = new Uint8Array(64);
  38625. var p = [gf(), gf(), gf(), gf()];
  38626. var i;
  38627. if (!seeded) randombytes(sk, 32);
  38628. crypto_hash(d, sk, 32);
  38629. d[0] &= 248;
  38630. d[31] &= 127;
  38631. d[31] |= 64;
  38632. scalarbase(p, d);
  38633. pack(pk, p);
  38634. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  38635. return 0;
  38636. }
  38637. 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]);
  38638. function modL(r, x) {
  38639. var carry, i, j, k;
  38640. for (i = 63; i >= 32; --i) {
  38641. carry = 0;
  38642. for (j = i - 32, k = i - 12; j < k; ++j) {
  38643. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  38644. carry = (x[j] + 128) >> 8;
  38645. x[j] -= carry * 256;
  38646. }
  38647. x[j] += carry;
  38648. x[i] = 0;
  38649. }
  38650. carry = 0;
  38651. for (j = 0; j < 32; j++) {
  38652. x[j] += carry - (x[31] >> 4) * L[j];
  38653. carry = x[j] >> 8;
  38654. x[j] &= 255;
  38655. }
  38656. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  38657. for (i = 0; i < 32; i++) {
  38658. x[i+1] += x[i] >> 8;
  38659. r[i] = x[i] & 255;
  38660. }
  38661. }
  38662. function reduce(r) {
  38663. var x = new Float64Array(64), i;
  38664. for (i = 0; i < 64; i++) x[i] = r[i];
  38665. for (i = 0; i < 64; i++) r[i] = 0;
  38666. modL(r, x);
  38667. }
  38668. // Note: difference from C - smlen returned, not passed as argument.
  38669. function crypto_sign(sm, m, n, sk) {
  38670. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  38671. var i, j, x = new Float64Array(64);
  38672. var p = [gf(), gf(), gf(), gf()];
  38673. crypto_hash(d, sk, 32);
  38674. d[0] &= 248;
  38675. d[31] &= 127;
  38676. d[31] |= 64;
  38677. var smlen = n + 64;
  38678. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  38679. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  38680. crypto_hash(r, sm.subarray(32), n+32);
  38681. reduce(r);
  38682. scalarbase(p, r);
  38683. pack(sm, p);
  38684. for (i = 32; i < 64; i++) sm[i] = sk[i];
  38685. crypto_hash(h, sm, n + 64);
  38686. reduce(h);
  38687. for (i = 0; i < 64; i++) x[i] = 0;
  38688. for (i = 0; i < 32; i++) x[i] = r[i];
  38689. for (i = 0; i < 32; i++) {
  38690. for (j = 0; j < 32; j++) {
  38691. x[i+j] += h[i] * d[j];
  38692. }
  38693. }
  38694. modL(sm.subarray(32), x);
  38695. return smlen;
  38696. }
  38697. function unpackneg(r, p) {
  38698. var t = gf(), chk = gf(), num = gf(),
  38699. den = gf(), den2 = gf(), den4 = gf(),
  38700. den6 = gf();
  38701. set25519(r[2], gf1);
  38702. unpack25519(r[1], p);
  38703. S(num, r[1]);
  38704. M(den, num, D);
  38705. Z(num, num, r[2]);
  38706. A(den, r[2], den);
  38707. S(den2, den);
  38708. S(den4, den2);
  38709. M(den6, den4, den2);
  38710. M(t, den6, num);
  38711. M(t, t, den);
  38712. pow2523(t, t);
  38713. M(t, t, num);
  38714. M(t, t, den);
  38715. M(t, t, den);
  38716. M(r[0], t, den);
  38717. S(chk, r[0]);
  38718. M(chk, chk, den);
  38719. if (neq25519(chk, num)) M(r[0], r[0], I);
  38720. S(chk, r[0]);
  38721. M(chk, chk, den);
  38722. if (neq25519(chk, num)) return -1;
  38723. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  38724. M(r[3], r[0], r[1]);
  38725. return 0;
  38726. }
  38727. function crypto_sign_open(m, sm, n, pk) {
  38728. var i, mlen;
  38729. var t = new Uint8Array(32), h = new Uint8Array(64);
  38730. var p = [gf(), gf(), gf(), gf()],
  38731. q = [gf(), gf(), gf(), gf()];
  38732. mlen = -1;
  38733. if (n < 64) return -1;
  38734. if (unpackneg(q, pk)) return -1;
  38735. for (i = 0; i < n; i++) m[i] = sm[i];
  38736. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  38737. crypto_hash(h, m, n);
  38738. reduce(h);
  38739. scalarmult(p, q, h);
  38740. scalarbase(q, sm.subarray(32));
  38741. add(p, q);
  38742. pack(t, p);
  38743. n -= 64;
  38744. if (crypto_verify_32(sm, 0, t, 0)) {
  38745. for (i = 0; i < n; i++) m[i] = 0;
  38746. return -1;
  38747. }
  38748. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  38749. mlen = n;
  38750. return mlen;
  38751. }
  38752. var crypto_secretbox_KEYBYTES = 32,
  38753. crypto_secretbox_NONCEBYTES = 24,
  38754. crypto_secretbox_ZEROBYTES = 32,
  38755. crypto_secretbox_BOXZEROBYTES = 16,
  38756. crypto_scalarmult_BYTES = 32,
  38757. crypto_scalarmult_SCALARBYTES = 32,
  38758. crypto_box_PUBLICKEYBYTES = 32,
  38759. crypto_box_SECRETKEYBYTES = 32,
  38760. crypto_box_BEFORENMBYTES = 32,
  38761. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  38762. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  38763. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  38764. crypto_sign_BYTES = 64,
  38765. crypto_sign_PUBLICKEYBYTES = 32,
  38766. crypto_sign_SECRETKEYBYTES = 64,
  38767. crypto_sign_SEEDBYTES = 32,
  38768. crypto_hash_BYTES = 64;
  38769. nacl.lowlevel = {
  38770. crypto_core_hsalsa20: crypto_core_hsalsa20,
  38771. crypto_stream_xor: crypto_stream_xor,
  38772. crypto_stream: crypto_stream,
  38773. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  38774. crypto_stream_salsa20: crypto_stream_salsa20,
  38775. crypto_onetimeauth: crypto_onetimeauth,
  38776. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  38777. crypto_verify_16: crypto_verify_16,
  38778. crypto_verify_32: crypto_verify_32,
  38779. crypto_secretbox: crypto_secretbox,
  38780. crypto_secretbox_open: crypto_secretbox_open,
  38781. crypto_scalarmult: crypto_scalarmult,
  38782. crypto_scalarmult_base: crypto_scalarmult_base,
  38783. crypto_box_beforenm: crypto_box_beforenm,
  38784. crypto_box_afternm: crypto_box_afternm,
  38785. crypto_box: crypto_box,
  38786. crypto_box_open: crypto_box_open,
  38787. crypto_box_keypair: crypto_box_keypair,
  38788. crypto_hash: crypto_hash,
  38789. crypto_sign: crypto_sign,
  38790. crypto_sign_keypair: crypto_sign_keypair,
  38791. crypto_sign_open: crypto_sign_open,
  38792. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  38793. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  38794. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  38795. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  38796. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  38797. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  38798. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  38799. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  38800. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  38801. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  38802. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  38803. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  38804. crypto_sign_BYTES: crypto_sign_BYTES,
  38805. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  38806. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  38807. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  38808. crypto_hash_BYTES: crypto_hash_BYTES
  38809. };
  38810. /* High-level API */
  38811. function checkLengths(k, n) {
  38812. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  38813. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  38814. }
  38815. function checkBoxLengths(pk, sk) {
  38816. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  38817. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  38818. }
  38819. function checkArrayTypes() {
  38820. for (var i = 0; i < arguments.length; i++) {
  38821. if (!(arguments[i] instanceof Uint8Array))
  38822. throw new TypeError('unexpected type, use Uint8Array');
  38823. }
  38824. }
  38825. function cleanup(arr) {
  38826. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  38827. }
  38828. nacl.randomBytes = function(n) {
  38829. var b = new Uint8Array(n);
  38830. randombytes(b, n);
  38831. return b;
  38832. };
  38833. nacl.secretbox = function(msg, nonce, key) {
  38834. checkArrayTypes(msg, nonce, key);
  38835. checkLengths(key, nonce);
  38836. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  38837. var c = new Uint8Array(m.length);
  38838. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  38839. crypto_secretbox(c, m, m.length, nonce, key);
  38840. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  38841. };
  38842. nacl.secretbox.open = function(box, nonce, key) {
  38843. checkArrayTypes(box, nonce, key);
  38844. checkLengths(key, nonce);
  38845. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  38846. var m = new Uint8Array(c.length);
  38847. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  38848. if (c.length < 32) return null;
  38849. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  38850. return m.subarray(crypto_secretbox_ZEROBYTES);
  38851. };
  38852. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  38853. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  38854. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  38855. nacl.scalarMult = function(n, p) {
  38856. checkArrayTypes(n, p);
  38857. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38858. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  38859. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38860. crypto_scalarmult(q, n, p);
  38861. return q;
  38862. };
  38863. nacl.scalarMult.base = function(n) {
  38864. checkArrayTypes(n);
  38865. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38866. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38867. crypto_scalarmult_base(q, n);
  38868. return q;
  38869. };
  38870. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  38871. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  38872. nacl.box = function(msg, nonce, publicKey, secretKey) {
  38873. var k = nacl.box.before(publicKey, secretKey);
  38874. return nacl.secretbox(msg, nonce, k);
  38875. };
  38876. nacl.box.before = function(publicKey, secretKey) {
  38877. checkArrayTypes(publicKey, secretKey);
  38878. checkBoxLengths(publicKey, secretKey);
  38879. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  38880. crypto_box_beforenm(k, publicKey, secretKey);
  38881. return k;
  38882. };
  38883. nacl.box.after = nacl.secretbox;
  38884. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  38885. var k = nacl.box.before(publicKey, secretKey);
  38886. return nacl.secretbox.open(msg, nonce, k);
  38887. };
  38888. nacl.box.open.after = nacl.secretbox.open;
  38889. nacl.box.keyPair = function() {
  38890. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38891. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  38892. crypto_box_keypair(pk, sk);
  38893. return {publicKey: pk, secretKey: sk};
  38894. };
  38895. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  38896. checkArrayTypes(secretKey);
  38897. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  38898. throw new Error('bad secret key size');
  38899. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38900. crypto_scalarmult_base(pk, secretKey);
  38901. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38902. };
  38903. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  38904. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  38905. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  38906. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  38907. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  38908. nacl.sign = function(msg, secretKey) {
  38909. checkArrayTypes(msg, secretKey);
  38910. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38911. throw new Error('bad secret key size');
  38912. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  38913. crypto_sign(signedMsg, msg, msg.length, secretKey);
  38914. return signedMsg;
  38915. };
  38916. nacl.sign.open = function(signedMsg, publicKey) {
  38917. checkArrayTypes(signedMsg, publicKey);
  38918. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38919. throw new Error('bad public key size');
  38920. var tmp = new Uint8Array(signedMsg.length);
  38921. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  38922. if (mlen < 0) return null;
  38923. var m = new Uint8Array(mlen);
  38924. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  38925. return m;
  38926. };
  38927. nacl.sign.detached = function(msg, secretKey) {
  38928. var signedMsg = nacl.sign(msg, secretKey);
  38929. var sig = new Uint8Array(crypto_sign_BYTES);
  38930. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  38931. return sig;
  38932. };
  38933. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  38934. checkArrayTypes(msg, sig, publicKey);
  38935. if (sig.length !== crypto_sign_BYTES)
  38936. throw new Error('bad signature size');
  38937. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38938. throw new Error('bad public key size');
  38939. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  38940. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  38941. var i;
  38942. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  38943. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  38944. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  38945. };
  38946. nacl.sign.keyPair = function() {
  38947. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38948. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38949. crypto_sign_keypair(pk, sk);
  38950. return {publicKey: pk, secretKey: sk};
  38951. };
  38952. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  38953. checkArrayTypes(secretKey);
  38954. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38955. throw new Error('bad secret key size');
  38956. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38957. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  38958. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38959. };
  38960. nacl.sign.keyPair.fromSeed = function(seed) {
  38961. checkArrayTypes(seed);
  38962. if (seed.length !== crypto_sign_SEEDBYTES)
  38963. throw new Error('bad seed size');
  38964. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38965. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38966. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  38967. crypto_sign_keypair(pk, sk, true);
  38968. return {publicKey: pk, secretKey: sk};
  38969. };
  38970. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  38971. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  38972. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  38973. nacl.sign.signatureLength = crypto_sign_BYTES;
  38974. nacl.hash = function(msg) {
  38975. checkArrayTypes(msg);
  38976. var h = new Uint8Array(crypto_hash_BYTES);
  38977. crypto_hash(h, msg, msg.length);
  38978. return h;
  38979. };
  38980. nacl.hash.hashLength = crypto_hash_BYTES;
  38981. nacl.verify = function(x, y) {
  38982. checkArrayTypes(x, y);
  38983. // Zero length arguments are considered not equal.
  38984. if (x.length === 0 || y.length === 0) return false;
  38985. if (x.length !== y.length) return false;
  38986. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  38987. };
  38988. nacl.setPRNG = function(fn) {
  38989. randombytes = fn;
  38990. };
  38991. (function() {
  38992. // Initialize PRNG if environment provides CSPRNG.
  38993. // If not, methods calling randombytes will throw.
  38994. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  38995. if (crypto && crypto.getRandomValues) {
  38996. // Browsers.
  38997. var QUOTA = 65536;
  38998. nacl.setPRNG(function(x, n) {
  38999. var i, v = new Uint8Array(n);
  39000. for (i = 0; i < n; i += QUOTA) {
  39001. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  39002. }
  39003. for (i = 0; i < n; i++) x[i] = v[i];
  39004. cleanup(v);
  39005. });
  39006. } else if (true) {
  39007. // Node.js.
  39008. crypto = __webpack_require__(3);
  39009. if (crypto && crypto.randomBytes) {
  39010. nacl.setPRNG(function(x, n) {
  39011. var i, v = crypto.randomBytes(n);
  39012. for (i = 0; i < n; i++) x[i] = v[i];
  39013. cleanup(v);
  39014. });
  39015. }
  39016. }
  39017. })();
  39018. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  39019. /***/ }),
  39020. /* 1 */
  39021. /***/ (function(module, exports, __webpack_require__) {
  39022. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  39023. // Public domain.
  39024. (function(root, f) {
  39025. 'use strict';
  39026. if ( true && module.exports) module.exports = f();
  39027. else if (root.nacl) root.nacl.util = f();
  39028. else {
  39029. root.nacl = {};
  39030. root.nacl.util = f();
  39031. }
  39032. }(this, function() {
  39033. 'use strict';
  39034. var util = {};
  39035. function validateBase64(s) {
  39036. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  39037. throw new TypeError('invalid encoding');
  39038. }
  39039. }
  39040. util.decodeUTF8 = function(s) {
  39041. if (typeof s !== 'string') throw new TypeError('expected string');
  39042. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  39043. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39044. return b;
  39045. };
  39046. util.encodeUTF8 = function(arr) {
  39047. var i, s = [];
  39048. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  39049. return decodeURIComponent(escape(s.join('')));
  39050. };
  39051. if (typeof atob === 'undefined') {
  39052. // Node.js
  39053. if (typeof Buffer.from !== 'undefined') {
  39054. // Node v6 and later
  39055. util.encodeBase64 = function (arr) { // v6 and later
  39056. return Buffer.from(arr).toString('base64');
  39057. };
  39058. util.decodeBase64 = function (s) {
  39059. validateBase64(s);
  39060. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  39061. };
  39062. } else {
  39063. // Node earlier than v6
  39064. util.encodeBase64 = function (arr) { // v6 and later
  39065. return (new Buffer(arr)).toString('base64');
  39066. };
  39067. util.decodeBase64 = function(s) {
  39068. validateBase64(s);
  39069. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  39070. };
  39071. }
  39072. } else {
  39073. // Browsers
  39074. util.encodeBase64 = function(arr) {
  39075. var i, s = [], len = arr.length;
  39076. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  39077. return btoa(s.join(''));
  39078. };
  39079. util.decodeBase64 = function(s) {
  39080. validateBase64(s);
  39081. var i, d = atob(s), b = new Uint8Array(d.length);
  39082. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39083. return b;
  39084. };
  39085. }
  39086. return util;
  39087. }));
  39088. /***/ }),
  39089. /* 2 */
  39090. /***/ (function(module, exports, __webpack_require__) {
  39091. // required so we don't have to do require('pusher').default etc.
  39092. module.exports = __webpack_require__(4).default;
  39093. /***/ }),
  39094. /* 3 */
  39095. /***/ (function(module, exports) {
  39096. /* (ignored) */
  39097. /***/ }),
  39098. /* 4 */
  39099. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  39100. "use strict";
  39101. __webpack_require__.r(__webpack_exports__);
  39102. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  39103. var ScriptReceiverFactory = (function () {
  39104. function ScriptReceiverFactory(prefix, name) {
  39105. this.lastId = 0;
  39106. this.prefix = prefix;
  39107. this.name = name;
  39108. }
  39109. ScriptReceiverFactory.prototype.create = function (callback) {
  39110. this.lastId++;
  39111. var number = this.lastId;
  39112. var id = this.prefix + number;
  39113. var name = this.name + "[" + number + "]";
  39114. var called = false;
  39115. var callbackWrapper = function () {
  39116. if (!called) {
  39117. callback.apply(null, arguments);
  39118. called = true;
  39119. }
  39120. };
  39121. this[number] = callbackWrapper;
  39122. return { number: number, id: id, name: name, callback: callbackWrapper };
  39123. };
  39124. ScriptReceiverFactory.prototype.remove = function (receiver) {
  39125. delete this[receiver.number];
  39126. };
  39127. return ScriptReceiverFactory;
  39128. }());
  39129. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  39130. // CONCATENATED MODULE: ./src/core/defaults.ts
  39131. var Defaults = {
  39132. VERSION: "5.0.3",
  39133. PROTOCOL: 7,
  39134. host: 'ws.pusherapp.com',
  39135. ws_port: 80,
  39136. wss_port: 443,
  39137. ws_path: '',
  39138. sockjs_host: 'sockjs.pusher.com',
  39139. sockjs_http_port: 80,
  39140. sockjs_https_port: 443,
  39141. sockjs_path: '/pusher',
  39142. stats_host: 'stats.pusher.com',
  39143. channel_auth_endpoint: '/pusher/auth',
  39144. channel_auth_transport: 'ajax',
  39145. activity_timeout: 120000,
  39146. pong_timeout: 30000,
  39147. unavailable_timeout: 10000,
  39148. cdn_http: "http://js.pusher.com",
  39149. cdn_https: "https://js.pusher.com",
  39150. dependency_suffix: ""
  39151. };
  39152. /* harmony default export */ var defaults = (Defaults);
  39153. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  39154. var dependency_loader_DependencyLoader = (function () {
  39155. function DependencyLoader(options) {
  39156. this.options = options;
  39157. this.receivers = options.receivers || ScriptReceivers;
  39158. this.loading = {};
  39159. }
  39160. DependencyLoader.prototype.load = function (name, options, callback) {
  39161. var self = this;
  39162. if (self.loading[name] && self.loading[name].length > 0) {
  39163. self.loading[name].push(callback);
  39164. }
  39165. else {
  39166. self.loading[name] = [callback];
  39167. var request = runtime.createScriptRequest(self.getPath(name, options));
  39168. var receiver = self.receivers.create(function (error) {
  39169. self.receivers.remove(receiver);
  39170. if (self.loading[name]) {
  39171. var callbacks = self.loading[name];
  39172. delete self.loading[name];
  39173. var successCallback = function (wasSuccessful) {
  39174. if (!wasSuccessful) {
  39175. request.cleanup();
  39176. }
  39177. };
  39178. for (var i = 0; i < callbacks.length; i++) {
  39179. callbacks[i](error, successCallback);
  39180. }
  39181. }
  39182. });
  39183. request.send(receiver);
  39184. }
  39185. };
  39186. DependencyLoader.prototype.getRoot = function (options) {
  39187. var cdn;
  39188. var protocol = runtime.getDocument().location.protocol;
  39189. if ((options && options.useTLS) || protocol === "https:") {
  39190. cdn = this.options.cdn_https;
  39191. }
  39192. else {
  39193. cdn = this.options.cdn_http;
  39194. }
  39195. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  39196. };
  39197. DependencyLoader.prototype.getPath = function (name, options) {
  39198. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  39199. };
  39200. ;
  39201. return DependencyLoader;
  39202. }());
  39203. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  39204. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  39205. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  39206. var Dependencies = new dependency_loader({
  39207. cdn_http: defaults.cdn_http,
  39208. cdn_https: defaults.cdn_https,
  39209. version: defaults.VERSION,
  39210. suffix: defaults.dependency_suffix,
  39211. receivers: DependenciesReceivers
  39212. });
  39213. // CONCATENATED MODULE: ./src/core/base64.ts
  39214. function encode(s) {
  39215. return btoa(utob(s));
  39216. }
  39217. var fromCharCode = String.fromCharCode;
  39218. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  39219. var b64tab = {};
  39220. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  39221. b64tab[b64chars.charAt(base64_i)] = base64_i;
  39222. }
  39223. var cb_utob = function (c) {
  39224. var cc = c.charCodeAt(0);
  39225. return cc < 0x80
  39226. ? c
  39227. : cc < 0x800
  39228. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  39229. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  39230. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  39231. fromCharCode(0x80 | (cc & 0x3f));
  39232. };
  39233. var utob = function (u) {
  39234. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  39235. };
  39236. var cb_encode = function (ccc) {
  39237. var padlen = [0, 2, 1][ccc.length % 3];
  39238. var ord = (ccc.charCodeAt(0) << 16) |
  39239. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  39240. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  39241. var chars = [
  39242. b64chars.charAt(ord >>> 18),
  39243. b64chars.charAt((ord >>> 12) & 63),
  39244. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  39245. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  39246. ];
  39247. return chars.join('');
  39248. };
  39249. var btoa = window.btoa ||
  39250. function (b) {
  39251. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  39252. };
  39253. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  39254. var Timer = (function () {
  39255. function Timer(set, clear, delay, callback) {
  39256. var _this = this;
  39257. this.clear = clear;
  39258. this.timer = set(function () {
  39259. if (_this.timer) {
  39260. _this.timer = callback(_this.timer);
  39261. }
  39262. }, delay);
  39263. }
  39264. Timer.prototype.isRunning = function () {
  39265. return this.timer !== null;
  39266. };
  39267. Timer.prototype.ensureAborted = function () {
  39268. if (this.timer) {
  39269. this.clear(this.timer);
  39270. this.timer = null;
  39271. }
  39272. };
  39273. return Timer;
  39274. }());
  39275. /* harmony default export */ var abstract_timer = (Timer);
  39276. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  39277. var __extends = (undefined && undefined.__extends) || (function () {
  39278. var extendStatics = function (d, b) {
  39279. extendStatics = Object.setPrototypeOf ||
  39280. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39281. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39282. return extendStatics(d, b);
  39283. };
  39284. return function (d, b) {
  39285. extendStatics(d, b);
  39286. function __() { this.constructor = d; }
  39287. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39288. };
  39289. })();
  39290. function timers_clearTimeout(timer) {
  39291. window.clearTimeout(timer);
  39292. }
  39293. function timers_clearInterval(timer) {
  39294. window.clearInterval(timer);
  39295. }
  39296. var OneOffTimer = (function (_super) {
  39297. __extends(OneOffTimer, _super);
  39298. function OneOffTimer(delay, callback) {
  39299. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  39300. callback();
  39301. return null;
  39302. }) || this;
  39303. }
  39304. return OneOffTimer;
  39305. }(abstract_timer));
  39306. var PeriodicTimer = (function (_super) {
  39307. __extends(PeriodicTimer, _super);
  39308. function PeriodicTimer(delay, callback) {
  39309. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  39310. callback();
  39311. return timer;
  39312. }) || this;
  39313. }
  39314. return PeriodicTimer;
  39315. }(abstract_timer));
  39316. // CONCATENATED MODULE: ./src/core/util.ts
  39317. var Util = {
  39318. now: function () {
  39319. if (Date.now) {
  39320. return Date.now();
  39321. }
  39322. else {
  39323. return new Date().valueOf();
  39324. }
  39325. },
  39326. defer: function (callback) {
  39327. return new OneOffTimer(0, callback);
  39328. },
  39329. method: function (name) {
  39330. var args = [];
  39331. for (var _i = 1; _i < arguments.length; _i++) {
  39332. args[_i - 1] = arguments[_i];
  39333. }
  39334. var boundArguments = Array.prototype.slice.call(arguments, 1);
  39335. return function (object) {
  39336. return object[name].apply(object, boundArguments.concat(arguments));
  39337. };
  39338. }
  39339. };
  39340. /* harmony default export */ var util = (Util);
  39341. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  39342. function extend(target) {
  39343. var sources = [];
  39344. for (var _i = 1; _i < arguments.length; _i++) {
  39345. sources[_i - 1] = arguments[_i];
  39346. }
  39347. for (var i = 0; i < sources.length; i++) {
  39348. var extensions = sources[i];
  39349. for (var property in extensions) {
  39350. if (extensions[property] && extensions[property].constructor &&
  39351. extensions[property].constructor === Object) {
  39352. target[property] = extend(target[property] || {}, extensions[property]);
  39353. }
  39354. else {
  39355. target[property] = extensions[property];
  39356. }
  39357. }
  39358. }
  39359. return target;
  39360. }
  39361. function stringify() {
  39362. var m = ["Pusher"];
  39363. for (var i = 0; i < arguments.length; i++) {
  39364. if (typeof arguments[i] === "string") {
  39365. m.push(arguments[i]);
  39366. }
  39367. else {
  39368. m.push(safeJSONStringify(arguments[i]));
  39369. }
  39370. }
  39371. return m.join(" : ");
  39372. }
  39373. function arrayIndexOf(array, item) {
  39374. var nativeIndexOf = Array.prototype.indexOf;
  39375. if (array === null) {
  39376. return -1;
  39377. }
  39378. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  39379. return array.indexOf(item);
  39380. }
  39381. for (var i = 0, l = array.length; i < l; i++) {
  39382. if (array[i] === item) {
  39383. return i;
  39384. }
  39385. }
  39386. return -1;
  39387. }
  39388. function objectApply(object, f) {
  39389. for (var key in object) {
  39390. if (Object.prototype.hasOwnProperty.call(object, key)) {
  39391. f(object[key], key, object);
  39392. }
  39393. }
  39394. }
  39395. function keys(object) {
  39396. var keys = [];
  39397. objectApply(object, function (_, key) {
  39398. keys.push(key);
  39399. });
  39400. return keys;
  39401. }
  39402. function values(object) {
  39403. var values = [];
  39404. objectApply(object, function (value) {
  39405. values.push(value);
  39406. });
  39407. return values;
  39408. }
  39409. function apply(array, f, context) {
  39410. for (var i = 0; i < array.length; i++) {
  39411. f.call(context || window, array[i], i, array);
  39412. }
  39413. }
  39414. function map(array, f) {
  39415. var result = [];
  39416. for (var i = 0; i < array.length; i++) {
  39417. result.push(f(array[i], i, array, result));
  39418. }
  39419. return result;
  39420. }
  39421. function mapObject(object, f) {
  39422. var result = {};
  39423. objectApply(object, function (value, key) {
  39424. result[key] = f(value);
  39425. });
  39426. return result;
  39427. }
  39428. function filter(array, test) {
  39429. test = test || function (value) { return !!value; };
  39430. var result = [];
  39431. for (var i = 0; i < array.length; i++) {
  39432. if (test(array[i], i, array, result)) {
  39433. result.push(array[i]);
  39434. }
  39435. }
  39436. return result;
  39437. }
  39438. function filterObject(object, test) {
  39439. var result = {};
  39440. objectApply(object, function (value, key) {
  39441. if ((test && test(value, key, object, result)) || Boolean(value)) {
  39442. result[key] = value;
  39443. }
  39444. });
  39445. return result;
  39446. }
  39447. function flatten(object) {
  39448. var result = [];
  39449. objectApply(object, function (value, key) {
  39450. result.push([key, value]);
  39451. });
  39452. return result;
  39453. }
  39454. function any(array, test) {
  39455. for (var i = 0; i < array.length; i++) {
  39456. if (test(array[i], i, array)) {
  39457. return true;
  39458. }
  39459. }
  39460. return false;
  39461. }
  39462. function collections_all(array, test) {
  39463. for (var i = 0; i < array.length; i++) {
  39464. if (!test(array[i], i, array)) {
  39465. return false;
  39466. }
  39467. }
  39468. return true;
  39469. }
  39470. function encodeParamsObject(data) {
  39471. return mapObject(data, function (value) {
  39472. if (typeof value === "object") {
  39473. value = safeJSONStringify(value);
  39474. }
  39475. return encodeURIComponent(encode(value.toString()));
  39476. });
  39477. }
  39478. function buildQueryString(data) {
  39479. var params = filterObject(data, function (value) {
  39480. return value !== undefined;
  39481. });
  39482. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  39483. return query;
  39484. }
  39485. function decycleObject(object) {
  39486. var objects = [], paths = [];
  39487. return (function derez(value, path) {
  39488. var i, name, nu;
  39489. switch (typeof value) {
  39490. case 'object':
  39491. if (!value) {
  39492. return null;
  39493. }
  39494. for (i = 0; i < objects.length; i += 1) {
  39495. if (objects[i] === value) {
  39496. return { $ref: paths[i] };
  39497. }
  39498. }
  39499. objects.push(value);
  39500. paths.push(path);
  39501. if (Object.prototype.toString.apply(value) === '[object Array]') {
  39502. nu = [];
  39503. for (i = 0; i < value.length; i += 1) {
  39504. nu[i] = derez(value[i], path + '[' + i + ']');
  39505. }
  39506. }
  39507. else {
  39508. nu = {};
  39509. for (name in value) {
  39510. if (Object.prototype.hasOwnProperty.call(value, name)) {
  39511. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  39512. }
  39513. }
  39514. }
  39515. return nu;
  39516. case 'number':
  39517. case 'string':
  39518. case 'boolean':
  39519. return value;
  39520. }
  39521. }(object, '$'));
  39522. }
  39523. function safeJSONStringify(source) {
  39524. try {
  39525. return JSON.stringify(source);
  39526. }
  39527. catch (e) {
  39528. return JSON.stringify(decycleObject(source));
  39529. }
  39530. }
  39531. // CONCATENATED MODULE: ./src/core/logger.ts
  39532. var logger_Logger = (function () {
  39533. function Logger() {
  39534. this.globalLog = function (message) {
  39535. if (window.console && window.console.log) {
  39536. window.console.log(message);
  39537. }
  39538. };
  39539. }
  39540. Logger.prototype.debug = function () {
  39541. var args = [];
  39542. for (var _i = 0; _i < arguments.length; _i++) {
  39543. args[_i] = arguments[_i];
  39544. }
  39545. this.log(this.globalLog, args);
  39546. };
  39547. Logger.prototype.warn = function () {
  39548. var args = [];
  39549. for (var _i = 0; _i < arguments.length; _i++) {
  39550. args[_i] = arguments[_i];
  39551. }
  39552. this.log(this.globalLogWarn, args);
  39553. };
  39554. Logger.prototype.error = function () {
  39555. var args = [];
  39556. for (var _i = 0; _i < arguments.length; _i++) {
  39557. args[_i] = arguments[_i];
  39558. }
  39559. this.log(this.globalLogError, args);
  39560. };
  39561. Logger.prototype.globalLogWarn = function (message) {
  39562. if (window.console && window.console.warn) {
  39563. window.console.warn(message);
  39564. }
  39565. else {
  39566. this.globalLog(message);
  39567. }
  39568. };
  39569. Logger.prototype.globalLogError = function (message) {
  39570. if (window.console && window.console.error) {
  39571. window.console.error(message);
  39572. }
  39573. else {
  39574. this.globalLogWarn(message);
  39575. }
  39576. };
  39577. Logger.prototype.log = function (defaultLoggingFunction) {
  39578. var args = [];
  39579. for (var _i = 1; _i < arguments.length; _i++) {
  39580. args[_i - 1] = arguments[_i];
  39581. }
  39582. var message = stringify.apply(this, arguments);
  39583. if (core_pusher.log) {
  39584. core_pusher.log(message);
  39585. }
  39586. else if (core_pusher.logToConsole) {
  39587. var log = defaultLoggingFunction.bind(this);
  39588. log(message);
  39589. }
  39590. };
  39591. return Logger;
  39592. }());
  39593. /* harmony default export */ var logger = (new logger_Logger());
  39594. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  39595. var urlStore = {
  39596. baseUrl: "https://pusher.com",
  39597. urls: {
  39598. authenticationEndpoint: {
  39599. path: "/docs/authenticating_users",
  39600. },
  39601. javascriptQuickStart: {
  39602. path: "/docs/javascript_quick_start"
  39603. },
  39604. triggeringClientEvents: {
  39605. path: "/docs/client_api_guide/client_events#trigger-events"
  39606. }
  39607. }
  39608. };
  39609. var buildLogSuffix = function (key) {
  39610. var urlPrefix = "See:";
  39611. var urlObj = urlStore.urls[key];
  39612. if (!urlObj)
  39613. return "";
  39614. var url;
  39615. if (urlObj.fullUrl) {
  39616. url = urlObj.fullUrl;
  39617. }
  39618. else if (urlObj.path) {
  39619. url = urlStore.baseUrl + urlObj.path;
  39620. }
  39621. if (!url)
  39622. return "";
  39623. return urlPrefix + " " + url;
  39624. };
  39625. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  39626. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  39627. var ajax = function (context, socketId, callback) {
  39628. var self = this, xhr;
  39629. xhr = runtime.createXHR();
  39630. xhr.open("POST", self.options.authEndpoint, true);
  39631. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  39632. for (var headerName in this.authOptions.headers) {
  39633. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  39634. }
  39635. xhr.onreadystatechange = function () {
  39636. if (xhr.readyState === 4) {
  39637. if (xhr.status === 200) {
  39638. var data, parsed = false;
  39639. try {
  39640. data = JSON.parse(xhr.responseText);
  39641. parsed = true;
  39642. }
  39643. catch (e) {
  39644. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  39645. }
  39646. if (parsed) {
  39647. callback(false, data);
  39648. }
  39649. }
  39650. else {
  39651. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  39652. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  39653. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  39654. ("Clients must be authenticated to join private or presence channels. " + suffix));
  39655. callback(true, xhr.status);
  39656. }
  39657. }
  39658. };
  39659. xhr.send(this.composeQuery(socketId));
  39660. return xhr;
  39661. };
  39662. /* harmony default export */ var xhr_auth = (ajax);
  39663. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  39664. var jsonp = function (context, socketId, callback) {
  39665. if (this.authOptions.headers !== undefined) {
  39666. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  39667. }
  39668. var callbackName = context.nextAuthCallbackID.toString();
  39669. context.nextAuthCallbackID++;
  39670. var document = context.getDocument();
  39671. var script = document.createElement("script");
  39672. context.auth_callbacks[callbackName] = function (data) {
  39673. callback(false, data);
  39674. };
  39675. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  39676. script.src = this.options.authEndpoint +
  39677. '?callback=' +
  39678. encodeURIComponent(callback_name) +
  39679. '&' +
  39680. this.composeQuery(socketId);
  39681. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  39682. head.insertBefore(script, head.firstChild);
  39683. };
  39684. /* harmony default export */ var jsonp_auth = (jsonp);
  39685. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  39686. var ScriptRequest = (function () {
  39687. function ScriptRequest(src) {
  39688. this.src = src;
  39689. }
  39690. ScriptRequest.prototype.send = function (receiver) {
  39691. var self = this;
  39692. var errorString = "Error loading " + self.src;
  39693. self.script = document.createElement("script");
  39694. self.script.id = receiver.id;
  39695. self.script.src = self.src;
  39696. self.script.type = "text/javascript";
  39697. self.script.charset = "UTF-8";
  39698. if (self.script.addEventListener) {
  39699. self.script.onerror = function () {
  39700. receiver.callback(errorString);
  39701. };
  39702. self.script.onload = function () {
  39703. receiver.callback(null);
  39704. };
  39705. }
  39706. else {
  39707. self.script.onreadystatechange = function () {
  39708. if (self.script.readyState === 'loaded' ||
  39709. self.script.readyState === 'complete') {
  39710. receiver.callback(null);
  39711. }
  39712. };
  39713. }
  39714. if (self.script.async === undefined && document.attachEvent &&
  39715. /opera/i.test(navigator.userAgent)) {
  39716. self.errorScript = document.createElement("script");
  39717. self.errorScript.id = receiver.id + "_error";
  39718. self.errorScript.text = receiver.name + "('" + errorString + "');";
  39719. self.script.async = self.errorScript.async = false;
  39720. }
  39721. else {
  39722. self.script.async = true;
  39723. }
  39724. var head = document.getElementsByTagName('head')[0];
  39725. head.insertBefore(self.script, head.firstChild);
  39726. if (self.errorScript) {
  39727. head.insertBefore(self.errorScript, self.script.nextSibling);
  39728. }
  39729. };
  39730. ScriptRequest.prototype.cleanup = function () {
  39731. if (this.script) {
  39732. this.script.onload = this.script.onerror = null;
  39733. this.script.onreadystatechange = null;
  39734. }
  39735. if (this.script && this.script.parentNode) {
  39736. this.script.parentNode.removeChild(this.script);
  39737. }
  39738. if (this.errorScript && this.errorScript.parentNode) {
  39739. this.errorScript.parentNode.removeChild(this.errorScript);
  39740. }
  39741. this.script = null;
  39742. this.errorScript = null;
  39743. };
  39744. return ScriptRequest;
  39745. }());
  39746. /* harmony default export */ var script_request = (ScriptRequest);
  39747. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  39748. var jsonp_request_JSONPRequest = (function () {
  39749. function JSONPRequest(url, data) {
  39750. this.url = url;
  39751. this.data = data;
  39752. }
  39753. JSONPRequest.prototype.send = function (receiver) {
  39754. if (this.request) {
  39755. return;
  39756. }
  39757. var query = buildQueryString(this.data);
  39758. var url = this.url + "/" + receiver.number + "?" + query;
  39759. this.request = runtime.createScriptRequest(url);
  39760. this.request.send(receiver);
  39761. };
  39762. JSONPRequest.prototype.cleanup = function () {
  39763. if (this.request) {
  39764. this.request.cleanup();
  39765. }
  39766. };
  39767. return JSONPRequest;
  39768. }());
  39769. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  39770. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  39771. var getAgent = function (sender, useTLS) {
  39772. return function (data, callback) {
  39773. var scheme = "http" + (useTLS ? "s" : "") + "://";
  39774. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  39775. var request = runtime.createJSONPRequest(url, data);
  39776. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  39777. ScriptReceivers.remove(receiver);
  39778. request.cleanup();
  39779. if (result && result.host) {
  39780. sender.host = result.host;
  39781. }
  39782. if (callback) {
  39783. callback(error, result);
  39784. }
  39785. });
  39786. request.send(receiver);
  39787. };
  39788. };
  39789. var jsonp_timeline_jsonp = {
  39790. name: 'jsonp',
  39791. getAgent: getAgent
  39792. };
  39793. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  39794. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  39795. function getGenericURL(baseScheme, params, path) {
  39796. var scheme = baseScheme + (params.useTLS ? "s" : "");
  39797. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  39798. return scheme + "://" + host + path;
  39799. }
  39800. function getGenericPath(key, queryString) {
  39801. var path = "/app/" + key;
  39802. var query = "?protocol=" + defaults.PROTOCOL +
  39803. "&client=js" +
  39804. "&version=" + defaults.VERSION +
  39805. (queryString ? ("&" + queryString) : "");
  39806. return path + query;
  39807. }
  39808. var ws = {
  39809. getInitial: function (key, params) {
  39810. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  39811. return getGenericURL("ws", params, path);
  39812. }
  39813. };
  39814. var http = {
  39815. getInitial: function (key, params) {
  39816. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  39817. return getGenericURL("http", params, path);
  39818. }
  39819. };
  39820. var sockjs = {
  39821. getInitial: function (key, params) {
  39822. return getGenericURL("http", params, params.httpPath || "/pusher");
  39823. },
  39824. getPath: function (key, params) {
  39825. return getGenericPath(key);
  39826. }
  39827. };
  39828. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  39829. var callback_registry_CallbackRegistry = (function () {
  39830. function CallbackRegistry() {
  39831. this._callbacks = {};
  39832. }
  39833. CallbackRegistry.prototype.get = function (name) {
  39834. return this._callbacks[prefix(name)];
  39835. };
  39836. CallbackRegistry.prototype.add = function (name, callback, context) {
  39837. var prefixedEventName = prefix(name);
  39838. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  39839. this._callbacks[prefixedEventName].push({
  39840. fn: callback,
  39841. context: context
  39842. });
  39843. };
  39844. CallbackRegistry.prototype.remove = function (name, callback, context) {
  39845. if (!name && !callback && !context) {
  39846. this._callbacks = {};
  39847. return;
  39848. }
  39849. var names = name ? [prefix(name)] : keys(this._callbacks);
  39850. if (callback || context) {
  39851. this.removeCallback(names, callback, context);
  39852. }
  39853. else {
  39854. this.removeAllCallbacks(names);
  39855. }
  39856. };
  39857. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  39858. apply(names, function (name) {
  39859. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  39860. return (callback && callback !== binding.fn) ||
  39861. (context && context !== binding.context);
  39862. });
  39863. if (this._callbacks[name].length === 0) {
  39864. delete this._callbacks[name];
  39865. }
  39866. }, this);
  39867. };
  39868. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  39869. apply(names, function (name) {
  39870. delete this._callbacks[name];
  39871. }, this);
  39872. };
  39873. return CallbackRegistry;
  39874. }());
  39875. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  39876. function prefix(name) {
  39877. return "_" + name;
  39878. }
  39879. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  39880. var dispatcher_Dispatcher = (function () {
  39881. function Dispatcher(failThrough) {
  39882. this.callbacks = new callback_registry();
  39883. this.global_callbacks = [];
  39884. this.failThrough = failThrough;
  39885. }
  39886. Dispatcher.prototype.bind = function (eventName, callback, context) {
  39887. this.callbacks.add(eventName, callback, context);
  39888. return this;
  39889. };
  39890. Dispatcher.prototype.bind_global = function (callback) {
  39891. this.global_callbacks.push(callback);
  39892. return this;
  39893. };
  39894. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  39895. this.callbacks.remove(eventName, callback, context);
  39896. return this;
  39897. };
  39898. Dispatcher.prototype.unbind_global = function (callback) {
  39899. if (!callback) {
  39900. this.global_callbacks = [];
  39901. return this;
  39902. }
  39903. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  39904. return this;
  39905. };
  39906. Dispatcher.prototype.unbind_all = function () {
  39907. this.unbind();
  39908. this.unbind_global();
  39909. return this;
  39910. };
  39911. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  39912. for (var i = 0; i < this.global_callbacks.length; i++) {
  39913. this.global_callbacks[i](eventName, data);
  39914. }
  39915. var callbacks = this.callbacks.get(eventName);
  39916. var args = [];
  39917. if (metadata) {
  39918. args.push(data, metadata);
  39919. }
  39920. else if (data) {
  39921. args.push(data);
  39922. }
  39923. if (callbacks && callbacks.length > 0) {
  39924. for (var i = 0; i < callbacks.length; i++) {
  39925. callbacks[i].fn.apply(callbacks[i].context || window, args);
  39926. }
  39927. }
  39928. else if (this.failThrough) {
  39929. this.failThrough(eventName, data);
  39930. }
  39931. return this;
  39932. };
  39933. return Dispatcher;
  39934. }());
  39935. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  39936. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  39937. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  39938. var extendStatics = function (d, b) {
  39939. extendStatics = Object.setPrototypeOf ||
  39940. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39941. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39942. return extendStatics(d, b);
  39943. };
  39944. return function (d, b) {
  39945. extendStatics(d, b);
  39946. function __() { this.constructor = d; }
  39947. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39948. };
  39949. })();
  39950. var transport_connection_TransportConnection = (function (_super) {
  39951. transport_connection_extends(TransportConnection, _super);
  39952. function TransportConnection(hooks, name, priority, key, options) {
  39953. var _this = _super.call(this) || this;
  39954. _this.initialize = runtime.transportConnectionInitializer;
  39955. _this.hooks = hooks;
  39956. _this.name = name;
  39957. _this.priority = priority;
  39958. _this.key = key;
  39959. _this.options = options;
  39960. _this.state = "new";
  39961. _this.timeline = options.timeline;
  39962. _this.activityTimeout = options.activityTimeout;
  39963. _this.id = _this.timeline.generateUniqueID();
  39964. return _this;
  39965. }
  39966. TransportConnection.prototype.handlesActivityChecks = function () {
  39967. return Boolean(this.hooks.handlesActivityChecks);
  39968. };
  39969. TransportConnection.prototype.supportsPing = function () {
  39970. return Boolean(this.hooks.supportsPing);
  39971. };
  39972. TransportConnection.prototype.connect = function () {
  39973. var _this = this;
  39974. if (this.socket || this.state !== "initialized") {
  39975. return false;
  39976. }
  39977. var url = this.hooks.urls.getInitial(this.key, this.options);
  39978. try {
  39979. this.socket = this.hooks.getSocket(url, this.options);
  39980. }
  39981. catch (e) {
  39982. util.defer(function () {
  39983. _this.onError(e);
  39984. _this.changeState("closed");
  39985. });
  39986. return false;
  39987. }
  39988. this.bindListeners();
  39989. logger.debug("Connecting", { transport: this.name, url: url });
  39990. this.changeState("connecting");
  39991. return true;
  39992. };
  39993. TransportConnection.prototype.close = function () {
  39994. if (this.socket) {
  39995. this.socket.close();
  39996. return true;
  39997. }
  39998. else {
  39999. return false;
  40000. }
  40001. };
  40002. TransportConnection.prototype.send = function (data) {
  40003. var _this = this;
  40004. if (this.state === "open") {
  40005. util.defer(function () {
  40006. if (_this.socket) {
  40007. _this.socket.send(data);
  40008. }
  40009. });
  40010. return true;
  40011. }
  40012. else {
  40013. return false;
  40014. }
  40015. };
  40016. TransportConnection.prototype.ping = function () {
  40017. if (this.state === "open" && this.supportsPing()) {
  40018. this.socket.ping();
  40019. }
  40020. };
  40021. TransportConnection.prototype.onOpen = function () {
  40022. if (this.hooks.beforeOpen) {
  40023. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  40024. }
  40025. this.changeState("open");
  40026. this.socket.onopen = undefined;
  40027. };
  40028. TransportConnection.prototype.onError = function (error) {
  40029. this.emit("error", { type: 'WebSocketError', error: error });
  40030. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  40031. };
  40032. TransportConnection.prototype.onClose = function (closeEvent) {
  40033. if (closeEvent) {
  40034. this.changeState("closed", {
  40035. code: closeEvent.code,
  40036. reason: closeEvent.reason,
  40037. wasClean: closeEvent.wasClean
  40038. });
  40039. }
  40040. else {
  40041. this.changeState("closed");
  40042. }
  40043. this.unbindListeners();
  40044. this.socket = undefined;
  40045. };
  40046. TransportConnection.prototype.onMessage = function (message) {
  40047. this.emit("message", message);
  40048. };
  40049. TransportConnection.prototype.onActivity = function () {
  40050. this.emit("activity");
  40051. };
  40052. TransportConnection.prototype.bindListeners = function () {
  40053. var _this = this;
  40054. this.socket.onopen = function () {
  40055. _this.onOpen();
  40056. };
  40057. this.socket.onerror = function (error) {
  40058. _this.onError(error);
  40059. };
  40060. this.socket.onclose = function (closeEvent) {
  40061. _this.onClose(closeEvent);
  40062. };
  40063. this.socket.onmessage = function (message) {
  40064. _this.onMessage(message);
  40065. };
  40066. if (this.supportsPing()) {
  40067. this.socket.onactivity = function () { _this.onActivity(); };
  40068. }
  40069. };
  40070. TransportConnection.prototype.unbindListeners = function () {
  40071. if (this.socket) {
  40072. this.socket.onopen = undefined;
  40073. this.socket.onerror = undefined;
  40074. this.socket.onclose = undefined;
  40075. this.socket.onmessage = undefined;
  40076. if (this.supportsPing()) {
  40077. this.socket.onactivity = undefined;
  40078. }
  40079. }
  40080. };
  40081. TransportConnection.prototype.changeState = function (state, params) {
  40082. this.state = state;
  40083. this.timeline.info(this.buildTimelineMessage({
  40084. state: state,
  40085. params: params
  40086. }));
  40087. this.emit(state, params);
  40088. };
  40089. TransportConnection.prototype.buildTimelineMessage = function (message) {
  40090. return extend({ cid: this.id }, message);
  40091. };
  40092. return TransportConnection;
  40093. }(dispatcher));
  40094. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  40095. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  40096. var transport_Transport = (function () {
  40097. function Transport(hooks) {
  40098. this.hooks = hooks;
  40099. }
  40100. Transport.prototype.isSupported = function (environment) {
  40101. return this.hooks.isSupported(environment);
  40102. };
  40103. Transport.prototype.createConnection = function (name, priority, key, options) {
  40104. return new transport_connection(this.hooks, name, priority, key, options);
  40105. };
  40106. return Transport;
  40107. }());
  40108. /* harmony default export */ var transports_transport = (transport_Transport);
  40109. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  40110. var WSTransport = new transports_transport({
  40111. urls: ws,
  40112. handlesActivityChecks: false,
  40113. supportsPing: false,
  40114. isInitialized: function () {
  40115. return Boolean(runtime.getWebSocketAPI());
  40116. },
  40117. isSupported: function () {
  40118. return Boolean(runtime.getWebSocketAPI());
  40119. },
  40120. getSocket: function (url) {
  40121. return runtime.createWebSocket(url);
  40122. }
  40123. });
  40124. var httpConfiguration = {
  40125. urls: http,
  40126. handlesActivityChecks: false,
  40127. supportsPing: true,
  40128. isInitialized: function () {
  40129. return true;
  40130. }
  40131. };
  40132. var streamingConfiguration = extend({ getSocket: function (url) {
  40133. return runtime.HTTPFactory.createStreamingSocket(url);
  40134. }
  40135. }, httpConfiguration);
  40136. var pollingConfiguration = extend({ getSocket: function (url) {
  40137. return runtime.HTTPFactory.createPollingSocket(url);
  40138. }
  40139. }, httpConfiguration);
  40140. var xhrConfiguration = {
  40141. isSupported: function () {
  40142. return runtime.isXHRSupported();
  40143. }
  40144. };
  40145. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  40146. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  40147. var Transports = {
  40148. ws: WSTransport,
  40149. xhr_streaming: XHRStreamingTransport,
  40150. xhr_polling: XHRPollingTransport
  40151. };
  40152. /* harmony default export */ var transports = (Transports);
  40153. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  40154. var SockJSTransport = new transports_transport({
  40155. file: "sockjs",
  40156. urls: sockjs,
  40157. handlesActivityChecks: true,
  40158. supportsPing: false,
  40159. isSupported: function () {
  40160. return true;
  40161. },
  40162. isInitialized: function () {
  40163. return window.SockJS !== undefined;
  40164. },
  40165. getSocket: function (url, options) {
  40166. return new window.SockJS(url, null, {
  40167. js_path: Dependencies.getPath("sockjs", {
  40168. useTLS: options.useTLS
  40169. }),
  40170. ignore_null_origin: options.ignoreNullOrigin
  40171. });
  40172. },
  40173. beforeOpen: function (socket, path) {
  40174. socket.send(JSON.stringify({
  40175. path: path
  40176. }));
  40177. }
  40178. });
  40179. var xdrConfiguration = {
  40180. isSupported: function (environment) {
  40181. var yes = runtime.isXDRSupported(environment.useTLS);
  40182. return yes;
  40183. }
  40184. };
  40185. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  40186. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  40187. transports.xdr_streaming = XDRStreamingTransport;
  40188. transports.xdr_polling = XDRPollingTransport;
  40189. transports.sockjs = SockJSTransport;
  40190. /* harmony default export */ var transports_transports = (transports);
  40191. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  40192. var net_info_extends = (undefined && undefined.__extends) || (function () {
  40193. var extendStatics = function (d, b) {
  40194. extendStatics = Object.setPrototypeOf ||
  40195. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40196. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40197. return extendStatics(d, b);
  40198. };
  40199. return function (d, b) {
  40200. extendStatics(d, b);
  40201. function __() { this.constructor = d; }
  40202. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40203. };
  40204. })();
  40205. var NetInfo = (function (_super) {
  40206. net_info_extends(NetInfo, _super);
  40207. function NetInfo() {
  40208. var _this = _super.call(this) || this;
  40209. var self = _this;
  40210. if (window.addEventListener !== undefined) {
  40211. window.addEventListener("online", function () {
  40212. self.emit('online');
  40213. }, false);
  40214. window.addEventListener("offline", function () {
  40215. self.emit('offline');
  40216. }, false);
  40217. }
  40218. return _this;
  40219. }
  40220. NetInfo.prototype.isOnline = function () {
  40221. if (window.navigator.onLine === undefined) {
  40222. return true;
  40223. }
  40224. else {
  40225. return window.navigator.onLine;
  40226. }
  40227. };
  40228. return NetInfo;
  40229. }(dispatcher));
  40230. var net_info_Network = new NetInfo();
  40231. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  40232. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  40233. function AssistantToTheTransportManager(manager, transport, options) {
  40234. this.manager = manager;
  40235. this.transport = transport;
  40236. this.minPingDelay = options.minPingDelay;
  40237. this.maxPingDelay = options.maxPingDelay;
  40238. this.pingDelay = undefined;
  40239. }
  40240. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  40241. var _this = this;
  40242. options = extend({}, options, {
  40243. activityTimeout: this.pingDelay
  40244. });
  40245. var connection = this.transport.createConnection(name, priority, key, options);
  40246. var openTimestamp = null;
  40247. var onOpen = function () {
  40248. connection.unbind("open", onOpen);
  40249. connection.bind("closed", onClosed);
  40250. openTimestamp = util.now();
  40251. };
  40252. var onClosed = function (closeEvent) {
  40253. connection.unbind("closed", onClosed);
  40254. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  40255. _this.manager.reportDeath();
  40256. }
  40257. else if (!closeEvent.wasClean && openTimestamp) {
  40258. var lifespan = util.now() - openTimestamp;
  40259. if (lifespan < 2 * _this.maxPingDelay) {
  40260. _this.manager.reportDeath();
  40261. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  40262. }
  40263. }
  40264. };
  40265. connection.bind("open", onOpen);
  40266. return connection;
  40267. };
  40268. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  40269. return this.manager.isAlive() && this.transport.isSupported(environment);
  40270. };
  40271. return AssistantToTheTransportManager;
  40272. }());
  40273. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  40274. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  40275. var Protocol = {
  40276. decodeMessage: function (messageEvent) {
  40277. try {
  40278. var messageData = JSON.parse(messageEvent.data);
  40279. var pusherEventData = messageData.data;
  40280. if (typeof pusherEventData === 'string') {
  40281. try {
  40282. pusherEventData = JSON.parse(messageData.data);
  40283. }
  40284. catch (e) { }
  40285. }
  40286. var pusherEvent = {
  40287. event: messageData.event,
  40288. channel: messageData.channel,
  40289. data: pusherEventData,
  40290. };
  40291. if (messageData.user_id) {
  40292. pusherEvent.user_id = messageData.user_id;
  40293. }
  40294. return pusherEvent;
  40295. }
  40296. catch (e) {
  40297. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  40298. }
  40299. },
  40300. encodeMessage: function (event) {
  40301. return JSON.stringify(event);
  40302. },
  40303. processHandshake: function (messageEvent) {
  40304. var message = Protocol.decodeMessage(messageEvent);
  40305. if (message.event === "pusher:connection_established") {
  40306. if (!message.data.activity_timeout) {
  40307. throw "No activity timeout specified in handshake";
  40308. }
  40309. return {
  40310. action: "connected",
  40311. id: message.data.socket_id,
  40312. activityTimeout: message.data.activity_timeout * 1000
  40313. };
  40314. }
  40315. else if (message.event === "pusher:error") {
  40316. return {
  40317. action: this.getCloseAction(message.data),
  40318. error: this.getCloseError(message.data)
  40319. };
  40320. }
  40321. else {
  40322. throw "Invalid handshake";
  40323. }
  40324. },
  40325. getCloseAction: function (closeEvent) {
  40326. if (closeEvent.code < 4000) {
  40327. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  40328. return "backoff";
  40329. }
  40330. else {
  40331. return null;
  40332. }
  40333. }
  40334. else if (closeEvent.code === 4000) {
  40335. return "tls_only";
  40336. }
  40337. else if (closeEvent.code < 4100) {
  40338. return "refused";
  40339. }
  40340. else if (closeEvent.code < 4200) {
  40341. return "backoff";
  40342. }
  40343. else if (closeEvent.code < 4300) {
  40344. return "retry";
  40345. }
  40346. else {
  40347. return "refused";
  40348. }
  40349. },
  40350. getCloseError: function (closeEvent) {
  40351. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  40352. return {
  40353. type: 'PusherError',
  40354. data: {
  40355. code: closeEvent.code,
  40356. message: closeEvent.reason || closeEvent.message
  40357. }
  40358. };
  40359. }
  40360. else {
  40361. return null;
  40362. }
  40363. }
  40364. };
  40365. /* harmony default export */ var protocol_protocol = (Protocol);
  40366. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  40367. var connection_extends = (undefined && undefined.__extends) || (function () {
  40368. var extendStatics = function (d, b) {
  40369. extendStatics = Object.setPrototypeOf ||
  40370. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40371. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40372. return extendStatics(d, b);
  40373. };
  40374. return function (d, b) {
  40375. extendStatics(d, b);
  40376. function __() { this.constructor = d; }
  40377. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40378. };
  40379. })();
  40380. var connection_Connection = (function (_super) {
  40381. connection_extends(Connection, _super);
  40382. function Connection(id, transport) {
  40383. var _this = _super.call(this) || this;
  40384. _this.id = id;
  40385. _this.transport = transport;
  40386. _this.activityTimeout = transport.activityTimeout;
  40387. _this.bindListeners();
  40388. return _this;
  40389. }
  40390. Connection.prototype.handlesActivityChecks = function () {
  40391. return this.transport.handlesActivityChecks();
  40392. };
  40393. Connection.prototype.send = function (data) {
  40394. return this.transport.send(data);
  40395. };
  40396. Connection.prototype.send_event = function (name, data, channel) {
  40397. var event = { event: name, data: data };
  40398. if (channel) {
  40399. event.channel = channel;
  40400. }
  40401. logger.debug('Event sent', event);
  40402. return this.send(protocol_protocol.encodeMessage(event));
  40403. };
  40404. Connection.prototype.ping = function () {
  40405. if (this.transport.supportsPing()) {
  40406. this.transport.ping();
  40407. }
  40408. else {
  40409. this.send_event('pusher:ping', {});
  40410. }
  40411. };
  40412. Connection.prototype.close = function () {
  40413. this.transport.close();
  40414. };
  40415. Connection.prototype.bindListeners = function () {
  40416. var _this = this;
  40417. var listeners = {
  40418. message: function (messageEvent) {
  40419. var pusherEvent;
  40420. try {
  40421. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  40422. }
  40423. catch (e) {
  40424. _this.emit('error', {
  40425. type: 'MessageParseError',
  40426. error: e,
  40427. data: messageEvent.data
  40428. });
  40429. }
  40430. if (pusherEvent !== undefined) {
  40431. logger.debug('Event recd', pusherEvent);
  40432. switch (pusherEvent.event) {
  40433. case 'pusher:error':
  40434. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  40435. break;
  40436. case 'pusher:ping':
  40437. _this.emit("ping");
  40438. break;
  40439. case 'pusher:pong':
  40440. _this.emit("pong");
  40441. break;
  40442. }
  40443. _this.emit('message', pusherEvent);
  40444. }
  40445. },
  40446. activity: function () {
  40447. _this.emit("activity");
  40448. },
  40449. error: function (error) {
  40450. _this.emit("error", { type: "WebSocketError", error: error });
  40451. },
  40452. closed: function (closeEvent) {
  40453. unbindListeners();
  40454. if (closeEvent && closeEvent.code) {
  40455. _this.handleCloseEvent(closeEvent);
  40456. }
  40457. _this.transport = null;
  40458. _this.emit("closed");
  40459. }
  40460. };
  40461. var unbindListeners = function () {
  40462. objectApply(listeners, function (listener, event) {
  40463. _this.transport.unbind(event, listener);
  40464. });
  40465. };
  40466. objectApply(listeners, function (listener, event) {
  40467. _this.transport.bind(event, listener);
  40468. });
  40469. };
  40470. Connection.prototype.handleCloseEvent = function (closeEvent) {
  40471. var action = protocol_protocol.getCloseAction(closeEvent);
  40472. var error = protocol_protocol.getCloseError(closeEvent);
  40473. if (error) {
  40474. this.emit('error', error);
  40475. }
  40476. if (action) {
  40477. this.emit(action, { action: action, error: error });
  40478. }
  40479. };
  40480. return Connection;
  40481. }(dispatcher));
  40482. /* harmony default export */ var connection_connection = (connection_Connection);
  40483. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  40484. var handshake_Handshake = (function () {
  40485. function Handshake(transport, callback) {
  40486. this.transport = transport;
  40487. this.callback = callback;
  40488. this.bindListeners();
  40489. }
  40490. Handshake.prototype.close = function () {
  40491. this.unbindListeners();
  40492. this.transport.close();
  40493. };
  40494. Handshake.prototype.bindListeners = function () {
  40495. var _this = this;
  40496. this.onMessage = function (m) {
  40497. _this.unbindListeners();
  40498. var result;
  40499. try {
  40500. result = protocol_protocol.processHandshake(m);
  40501. }
  40502. catch (e) {
  40503. _this.finish("error", { error: e });
  40504. _this.transport.close();
  40505. return;
  40506. }
  40507. if (result.action === "connected") {
  40508. _this.finish("connected", {
  40509. connection: new connection_connection(result.id, _this.transport),
  40510. activityTimeout: result.activityTimeout
  40511. });
  40512. }
  40513. else {
  40514. _this.finish(result.action, { error: result.error });
  40515. _this.transport.close();
  40516. }
  40517. };
  40518. this.onClosed = function (closeEvent) {
  40519. _this.unbindListeners();
  40520. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  40521. var error = protocol_protocol.getCloseError(closeEvent);
  40522. _this.finish(action, { error: error });
  40523. };
  40524. this.transport.bind("message", this.onMessage);
  40525. this.transport.bind("closed", this.onClosed);
  40526. };
  40527. Handshake.prototype.unbindListeners = function () {
  40528. this.transport.unbind("message", this.onMessage);
  40529. this.transport.unbind("closed", this.onClosed);
  40530. };
  40531. Handshake.prototype.finish = function (action, params) {
  40532. this.callback(extend({ transport: this.transport, action: action }, params));
  40533. };
  40534. return Handshake;
  40535. }());
  40536. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  40537. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  40538. var pusher_authorizer_PusherAuthorizer = (function () {
  40539. function PusherAuthorizer(channel, options) {
  40540. this.channel = channel;
  40541. var authTransport = options.authTransport;
  40542. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  40543. throw "'" + authTransport + "' is not a recognized auth transport";
  40544. }
  40545. this.type = authTransport;
  40546. this.options = options;
  40547. this.authOptions = (options || {}).auth || {};
  40548. }
  40549. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  40550. var query = 'socket_id=' + encodeURIComponent(socketId) +
  40551. '&channel_name=' + encodeURIComponent(this.channel.name);
  40552. for (var i in this.authOptions.params) {
  40553. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  40554. }
  40555. return query;
  40556. };
  40557. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  40558. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  40559. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  40560. };
  40561. return PusherAuthorizer;
  40562. }());
  40563. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  40564. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  40565. var timeline_sender_TimelineSender = (function () {
  40566. function TimelineSender(timeline, options) {
  40567. this.timeline = timeline;
  40568. this.options = options || {};
  40569. }
  40570. TimelineSender.prototype.send = function (useTLS, callback) {
  40571. if (this.timeline.isEmpty()) {
  40572. return;
  40573. }
  40574. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  40575. };
  40576. return TimelineSender;
  40577. }());
  40578. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  40579. // CONCATENATED MODULE: ./src/core/errors.ts
  40580. var errors_extends = (undefined && undefined.__extends) || (function () {
  40581. var extendStatics = function (d, b) {
  40582. extendStatics = Object.setPrototypeOf ||
  40583. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40584. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40585. return extendStatics(d, b);
  40586. };
  40587. return function (d, b) {
  40588. extendStatics(d, b);
  40589. function __() { this.constructor = d; }
  40590. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40591. };
  40592. })();
  40593. var BadEventName = (function (_super) {
  40594. errors_extends(BadEventName, _super);
  40595. function BadEventName(msg) {
  40596. var _newTarget = this.constructor;
  40597. var _this = _super.call(this, msg) || this;
  40598. Object.setPrototypeOf(_this, _newTarget.prototype);
  40599. return _this;
  40600. }
  40601. return BadEventName;
  40602. }(Error));
  40603. var RequestTimedOut = (function (_super) {
  40604. errors_extends(RequestTimedOut, _super);
  40605. function RequestTimedOut(msg) {
  40606. var _newTarget = this.constructor;
  40607. var _this = _super.call(this, msg) || this;
  40608. Object.setPrototypeOf(_this, _newTarget.prototype);
  40609. return _this;
  40610. }
  40611. return RequestTimedOut;
  40612. }(Error));
  40613. var TransportPriorityTooLow = (function (_super) {
  40614. errors_extends(TransportPriorityTooLow, _super);
  40615. function TransportPriorityTooLow(msg) {
  40616. var _newTarget = this.constructor;
  40617. var _this = _super.call(this, msg) || this;
  40618. Object.setPrototypeOf(_this, _newTarget.prototype);
  40619. return _this;
  40620. }
  40621. return TransportPriorityTooLow;
  40622. }(Error));
  40623. var TransportClosed = (function (_super) {
  40624. errors_extends(TransportClosed, _super);
  40625. function TransportClosed(msg) {
  40626. var _newTarget = this.constructor;
  40627. var _this = _super.call(this, msg) || this;
  40628. Object.setPrototypeOf(_this, _newTarget.prototype);
  40629. return _this;
  40630. }
  40631. return TransportClosed;
  40632. }(Error));
  40633. var UnsupportedFeature = (function (_super) {
  40634. errors_extends(UnsupportedFeature, _super);
  40635. function UnsupportedFeature(msg) {
  40636. var _newTarget = this.constructor;
  40637. var _this = _super.call(this, msg) || this;
  40638. Object.setPrototypeOf(_this, _newTarget.prototype);
  40639. return _this;
  40640. }
  40641. return UnsupportedFeature;
  40642. }(Error));
  40643. var UnsupportedTransport = (function (_super) {
  40644. errors_extends(UnsupportedTransport, _super);
  40645. function UnsupportedTransport(msg) {
  40646. var _newTarget = this.constructor;
  40647. var _this = _super.call(this, msg) || this;
  40648. Object.setPrototypeOf(_this, _newTarget.prototype);
  40649. return _this;
  40650. }
  40651. return UnsupportedTransport;
  40652. }(Error));
  40653. var UnsupportedStrategy = (function (_super) {
  40654. errors_extends(UnsupportedStrategy, _super);
  40655. function UnsupportedStrategy(msg) {
  40656. var _newTarget = this.constructor;
  40657. var _this = _super.call(this, msg) || this;
  40658. Object.setPrototypeOf(_this, _newTarget.prototype);
  40659. return _this;
  40660. }
  40661. return UnsupportedStrategy;
  40662. }(Error));
  40663. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  40664. var channel_extends = (undefined && undefined.__extends) || (function () {
  40665. var extendStatics = function (d, b) {
  40666. extendStatics = Object.setPrototypeOf ||
  40667. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40668. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40669. return extendStatics(d, b);
  40670. };
  40671. return function (d, b) {
  40672. extendStatics(d, b);
  40673. function __() { this.constructor = d; }
  40674. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40675. };
  40676. })();
  40677. var channel_Channel = (function (_super) {
  40678. channel_extends(Channel, _super);
  40679. function Channel(name, pusher) {
  40680. var _this = _super.call(this, function (event, data) {
  40681. logger.debug('No callbacks on ' + name + ' for ' + event);
  40682. }) || this;
  40683. _this.name = name;
  40684. _this.pusher = pusher;
  40685. _this.subscribed = false;
  40686. _this.subscriptionPending = false;
  40687. _this.subscriptionCancelled = false;
  40688. return _this;
  40689. }
  40690. Channel.prototype.authorize = function (socketId, callback) {
  40691. return callback(false, {});
  40692. };
  40693. Channel.prototype.trigger = function (event, data) {
  40694. if (event.indexOf("client-") !== 0) {
  40695. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  40696. }
  40697. if (!this.subscribed) {
  40698. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  40699. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  40700. }
  40701. return this.pusher.send_event(event, data, this.name);
  40702. };
  40703. Channel.prototype.disconnect = function () {
  40704. this.subscribed = false;
  40705. this.subscriptionPending = false;
  40706. };
  40707. Channel.prototype.handleEvent = function (event) {
  40708. var eventName = event.event;
  40709. var data = event.data;
  40710. if (eventName === "pusher_internal:subscription_succeeded") {
  40711. this.handleSubscriptionSucceededEvent(event);
  40712. }
  40713. else if (eventName.indexOf("pusher_internal:") !== 0) {
  40714. var metadata = {};
  40715. this.emit(eventName, data, metadata);
  40716. }
  40717. };
  40718. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40719. this.subscriptionPending = false;
  40720. this.subscribed = true;
  40721. if (this.subscriptionCancelled) {
  40722. this.pusher.unsubscribe(this.name);
  40723. }
  40724. else {
  40725. this.emit("pusher:subscription_succeeded", event.data);
  40726. }
  40727. };
  40728. Channel.prototype.subscribe = function () {
  40729. var _this = this;
  40730. if (this.subscribed) {
  40731. return;
  40732. }
  40733. this.subscriptionPending = true;
  40734. this.subscriptionCancelled = false;
  40735. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  40736. if (error) {
  40737. logger.error(data);
  40738. _this.emit('pusher:subscription_error', data);
  40739. }
  40740. else {
  40741. _this.pusher.send_event('pusher:subscribe', {
  40742. auth: data.auth,
  40743. channel_data: data.channel_data,
  40744. channel: _this.name
  40745. });
  40746. }
  40747. });
  40748. };
  40749. Channel.prototype.unsubscribe = function () {
  40750. this.subscribed = false;
  40751. this.pusher.send_event('pusher:unsubscribe', {
  40752. channel: this.name
  40753. });
  40754. };
  40755. Channel.prototype.cancelSubscription = function () {
  40756. this.subscriptionCancelled = true;
  40757. };
  40758. Channel.prototype.reinstateSubscription = function () {
  40759. this.subscriptionCancelled = false;
  40760. };
  40761. return Channel;
  40762. }(dispatcher));
  40763. /* harmony default export */ var channels_channel = (channel_Channel);
  40764. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  40765. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  40766. var extendStatics = function (d, b) {
  40767. extendStatics = Object.setPrototypeOf ||
  40768. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40769. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40770. return extendStatics(d, b);
  40771. };
  40772. return function (d, b) {
  40773. extendStatics(d, b);
  40774. function __() { this.constructor = d; }
  40775. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40776. };
  40777. })();
  40778. var private_channel_PrivateChannel = (function (_super) {
  40779. private_channel_extends(PrivateChannel, _super);
  40780. function PrivateChannel() {
  40781. return _super !== null && _super.apply(this, arguments) || this;
  40782. }
  40783. PrivateChannel.prototype.authorize = function (socketId, callback) {
  40784. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  40785. return authorizer.authorize(socketId, callback);
  40786. };
  40787. return PrivateChannel;
  40788. }(channels_channel));
  40789. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  40790. // CONCATENATED MODULE: ./src/core/channels/members.ts
  40791. var members_Members = (function () {
  40792. function Members() {
  40793. this.reset();
  40794. }
  40795. Members.prototype.get = function (id) {
  40796. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  40797. return {
  40798. id: id,
  40799. info: this.members[id]
  40800. };
  40801. }
  40802. else {
  40803. return null;
  40804. }
  40805. };
  40806. Members.prototype.each = function (callback) {
  40807. var _this = this;
  40808. objectApply(this.members, function (member, id) {
  40809. callback(_this.get(id));
  40810. });
  40811. };
  40812. Members.prototype.setMyID = function (id) {
  40813. this.myID = id;
  40814. };
  40815. Members.prototype.onSubscription = function (subscriptionData) {
  40816. this.members = subscriptionData.presence.hash;
  40817. this.count = subscriptionData.presence.count;
  40818. this.me = this.get(this.myID);
  40819. };
  40820. Members.prototype.addMember = function (memberData) {
  40821. if (this.get(memberData.user_id) === null) {
  40822. this.count++;
  40823. }
  40824. this.members[memberData.user_id] = memberData.user_info;
  40825. return this.get(memberData.user_id);
  40826. };
  40827. Members.prototype.removeMember = function (memberData) {
  40828. var member = this.get(memberData.user_id);
  40829. if (member) {
  40830. delete this.members[memberData.user_id];
  40831. this.count--;
  40832. }
  40833. return member;
  40834. };
  40835. Members.prototype.reset = function () {
  40836. this.members = {};
  40837. this.count = 0;
  40838. this.myID = null;
  40839. this.me = null;
  40840. };
  40841. return Members;
  40842. }());
  40843. /* harmony default export */ var members = (members_Members);
  40844. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  40845. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  40846. var extendStatics = function (d, b) {
  40847. extendStatics = Object.setPrototypeOf ||
  40848. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40849. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40850. return extendStatics(d, b);
  40851. };
  40852. return function (d, b) {
  40853. extendStatics(d, b);
  40854. function __() { this.constructor = d; }
  40855. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40856. };
  40857. })();
  40858. var presence_channel_PresenceChannel = (function (_super) {
  40859. presence_channel_extends(PresenceChannel, _super);
  40860. function PresenceChannel(name, pusher) {
  40861. var _this = _super.call(this, name, pusher) || this;
  40862. _this.members = new members();
  40863. return _this;
  40864. }
  40865. PresenceChannel.prototype.authorize = function (socketId, callback) {
  40866. var _this = this;
  40867. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40868. if (!error) {
  40869. if (authData.channel_data === undefined) {
  40870. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40871. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  40872. ("expected 'channel_data' field. " + suffix));
  40873. callback("Invalid auth response");
  40874. return;
  40875. }
  40876. var channelData = JSON.parse(authData.channel_data);
  40877. _this.members.setMyID(channelData.user_id);
  40878. }
  40879. callback(error, authData);
  40880. });
  40881. };
  40882. PresenceChannel.prototype.handleEvent = function (event) {
  40883. var eventName = event.event;
  40884. if (eventName.indexOf("pusher_internal:") === 0) {
  40885. this.handleInternalEvent(event);
  40886. }
  40887. else {
  40888. var data = event.data;
  40889. var metadata = {};
  40890. if (event.user_id) {
  40891. metadata.user_id = event.user_id;
  40892. }
  40893. this.emit(eventName, data, metadata);
  40894. }
  40895. };
  40896. PresenceChannel.prototype.handleInternalEvent = function (event) {
  40897. var eventName = event.event;
  40898. var data = event.data;
  40899. switch (eventName) {
  40900. case "pusher_internal:subscription_succeeded":
  40901. this.handleSubscriptionSucceededEvent(event);
  40902. break;
  40903. case "pusher_internal:member_added":
  40904. var addedMember = this.members.addMember(data);
  40905. this.emit('pusher:member_added', addedMember);
  40906. break;
  40907. case "pusher_internal:member_removed":
  40908. var removedMember = this.members.removeMember(data);
  40909. if (removedMember) {
  40910. this.emit('pusher:member_removed', removedMember);
  40911. }
  40912. break;
  40913. }
  40914. };
  40915. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40916. this.subscriptionPending = false;
  40917. this.subscribed = true;
  40918. if (this.subscriptionCancelled) {
  40919. this.pusher.unsubscribe(this.name);
  40920. }
  40921. else {
  40922. this.members.onSubscription(event.data);
  40923. this.emit("pusher:subscription_succeeded", this.members);
  40924. }
  40925. };
  40926. PresenceChannel.prototype.disconnect = function () {
  40927. this.members.reset();
  40928. _super.prototype.disconnect.call(this);
  40929. };
  40930. return PresenceChannel;
  40931. }(private_channel));
  40932. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  40933. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  40934. var nacl_fast = __webpack_require__(0);
  40935. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  40936. var nacl_util = __webpack_require__(1);
  40937. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  40938. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  40939. var extendStatics = function (d, b) {
  40940. extendStatics = Object.setPrototypeOf ||
  40941. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40942. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40943. return extendStatics(d, b);
  40944. };
  40945. return function (d, b) {
  40946. extendStatics(d, b);
  40947. function __() { this.constructor = d; }
  40948. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40949. };
  40950. })();
  40951. var encrypted_channel_EncryptedChannel = (function (_super) {
  40952. encrypted_channel_extends(EncryptedChannel, _super);
  40953. function EncryptedChannel() {
  40954. var _this = _super !== null && _super.apply(this, arguments) || this;
  40955. _this.key = null;
  40956. return _this;
  40957. }
  40958. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  40959. var _this = this;
  40960. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40961. if (error) {
  40962. callback(true, authData);
  40963. return;
  40964. }
  40965. var sharedSecret = authData["shared_secret"];
  40966. if (!sharedSecret) {
  40967. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  40968. callback(true, errorMsg);
  40969. return;
  40970. }
  40971. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  40972. delete authData["shared_secret"];
  40973. callback(false, authData);
  40974. });
  40975. };
  40976. EncryptedChannel.prototype.trigger = function (event, data) {
  40977. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  40978. };
  40979. EncryptedChannel.prototype.handleEvent = function (event) {
  40980. var eventName = event.event;
  40981. var data = event.data;
  40982. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  40983. _super.prototype.handleEvent.call(this, event);
  40984. return;
  40985. }
  40986. this.handleEncryptedEvent(eventName, data);
  40987. };
  40988. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  40989. var _this = this;
  40990. if (!this.key) {
  40991. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  40992. return;
  40993. }
  40994. if (!data.ciphertext || !data.nonce) {
  40995. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  40996. return;
  40997. }
  40998. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  40999. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  41000. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  41001. return;
  41002. }
  41003. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  41004. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  41005. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  41006. return;
  41007. }
  41008. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  41009. if (bytes === null) {
  41010. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  41011. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  41012. if (error) {
  41013. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  41014. return;
  41015. }
  41016. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  41017. if (bytes === null) {
  41018. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  41019. return;
  41020. }
  41021. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41022. return;
  41023. });
  41024. return;
  41025. }
  41026. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41027. };
  41028. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  41029. try {
  41030. this.emit(eventName, JSON.parse(data));
  41031. }
  41032. catch (e) {
  41033. this.emit(eventName, data);
  41034. }
  41035. return this;
  41036. };
  41037. return EncryptedChannel;
  41038. }(private_channel));
  41039. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  41040. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  41041. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  41042. var extendStatics = function (d, b) {
  41043. extendStatics = Object.setPrototypeOf ||
  41044. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41045. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41046. return extendStatics(d, b);
  41047. };
  41048. return function (d, b) {
  41049. extendStatics(d, b);
  41050. function __() { this.constructor = d; }
  41051. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41052. };
  41053. })();
  41054. var connection_manager_ConnectionManager = (function (_super) {
  41055. connection_manager_extends(ConnectionManager, _super);
  41056. function ConnectionManager(key, options) {
  41057. var _this = _super.call(this) || this;
  41058. _this.key = key;
  41059. _this.options = options || {};
  41060. _this.state = "initialized";
  41061. _this.connection = null;
  41062. _this.usingTLS = !!options.useTLS;
  41063. _this.timeline = _this.options.timeline;
  41064. _this.errorCallbacks = _this.buildErrorCallbacks();
  41065. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  41066. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  41067. var Network = runtime.getNetwork();
  41068. Network.bind("online", function () {
  41069. _this.timeline.info({ netinfo: "online" });
  41070. if (_this.state === "connecting" || _this.state === "unavailable") {
  41071. _this.retryIn(0);
  41072. }
  41073. });
  41074. Network.bind("offline", function () {
  41075. _this.timeline.info({ netinfo: "offline" });
  41076. if (_this.connection) {
  41077. _this.sendActivityCheck();
  41078. }
  41079. });
  41080. _this.updateStrategy();
  41081. return _this;
  41082. }
  41083. ConnectionManager.prototype.connect = function () {
  41084. if (this.connection || this.runner) {
  41085. return;
  41086. }
  41087. if (!this.strategy.isSupported()) {
  41088. this.updateState("failed");
  41089. return;
  41090. }
  41091. this.updateState("connecting");
  41092. this.startConnecting();
  41093. this.setUnavailableTimer();
  41094. };
  41095. ;
  41096. ConnectionManager.prototype.send = function (data) {
  41097. if (this.connection) {
  41098. return this.connection.send(data);
  41099. }
  41100. else {
  41101. return false;
  41102. }
  41103. };
  41104. ;
  41105. ConnectionManager.prototype.send_event = function (name, data, channel) {
  41106. if (this.connection) {
  41107. return this.connection.send_event(name, data, channel);
  41108. }
  41109. else {
  41110. return false;
  41111. }
  41112. };
  41113. ;
  41114. ConnectionManager.prototype.disconnect = function () {
  41115. this.disconnectInternally();
  41116. this.updateState("disconnected");
  41117. };
  41118. ;
  41119. ConnectionManager.prototype.isUsingTLS = function () {
  41120. return this.usingTLS;
  41121. };
  41122. ;
  41123. ConnectionManager.prototype.startConnecting = function () {
  41124. var _this = this;
  41125. var callback = function (error, handshake) {
  41126. if (error) {
  41127. _this.runner = _this.strategy.connect(0, callback);
  41128. }
  41129. else {
  41130. if (handshake.action === "error") {
  41131. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  41132. _this.timeline.error({ handshakeError: handshake.error });
  41133. }
  41134. else {
  41135. _this.abortConnecting();
  41136. _this.handshakeCallbacks[handshake.action](handshake);
  41137. }
  41138. }
  41139. };
  41140. this.runner = this.strategy.connect(0, callback);
  41141. };
  41142. ;
  41143. ConnectionManager.prototype.abortConnecting = function () {
  41144. if (this.runner) {
  41145. this.runner.abort();
  41146. this.runner = null;
  41147. }
  41148. };
  41149. ;
  41150. ConnectionManager.prototype.disconnectInternally = function () {
  41151. this.abortConnecting();
  41152. this.clearRetryTimer();
  41153. this.clearUnavailableTimer();
  41154. if (this.connection) {
  41155. var connection = this.abandonConnection();
  41156. connection.close();
  41157. }
  41158. };
  41159. ;
  41160. ConnectionManager.prototype.updateStrategy = function () {
  41161. this.strategy = this.options.getStrategy({
  41162. key: this.key,
  41163. timeline: this.timeline,
  41164. useTLS: this.usingTLS
  41165. });
  41166. };
  41167. ;
  41168. ConnectionManager.prototype.retryIn = function (delay) {
  41169. var _this = this;
  41170. this.timeline.info({ action: "retry", delay: delay });
  41171. if (delay > 0) {
  41172. this.emit("connecting_in", Math.round(delay / 1000));
  41173. }
  41174. this.retryTimer = new OneOffTimer(delay || 0, function () {
  41175. _this.disconnectInternally();
  41176. _this.connect();
  41177. });
  41178. };
  41179. ;
  41180. ConnectionManager.prototype.clearRetryTimer = function () {
  41181. if (this.retryTimer) {
  41182. this.retryTimer.ensureAborted();
  41183. this.retryTimer = null;
  41184. }
  41185. };
  41186. ;
  41187. ConnectionManager.prototype.setUnavailableTimer = function () {
  41188. var _this = this;
  41189. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  41190. _this.updateState("unavailable");
  41191. });
  41192. };
  41193. ;
  41194. ConnectionManager.prototype.clearUnavailableTimer = function () {
  41195. if (this.unavailableTimer) {
  41196. this.unavailableTimer.ensureAborted();
  41197. }
  41198. };
  41199. ;
  41200. ConnectionManager.prototype.sendActivityCheck = function () {
  41201. var _this = this;
  41202. this.stopActivityCheck();
  41203. this.connection.ping();
  41204. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  41205. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  41206. _this.retryIn(0);
  41207. });
  41208. };
  41209. ;
  41210. ConnectionManager.prototype.resetActivityCheck = function () {
  41211. var _this = this;
  41212. this.stopActivityCheck();
  41213. if (this.connection && !this.connection.handlesActivityChecks()) {
  41214. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  41215. _this.sendActivityCheck();
  41216. });
  41217. }
  41218. };
  41219. ;
  41220. ConnectionManager.prototype.stopActivityCheck = function () {
  41221. if (this.activityTimer) {
  41222. this.activityTimer.ensureAborted();
  41223. }
  41224. };
  41225. ;
  41226. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  41227. var _this = this;
  41228. return extend({}, errorCallbacks, {
  41229. message: function (message) {
  41230. _this.resetActivityCheck();
  41231. _this.emit('message', message);
  41232. },
  41233. ping: function () {
  41234. _this.send_event('pusher:pong', {});
  41235. },
  41236. activity: function () {
  41237. _this.resetActivityCheck();
  41238. },
  41239. error: function (error) {
  41240. _this.emit("error", { type: "WebSocketError", error: error });
  41241. },
  41242. closed: function () {
  41243. _this.abandonConnection();
  41244. if (_this.shouldRetry()) {
  41245. _this.retryIn(1000);
  41246. }
  41247. }
  41248. });
  41249. };
  41250. ;
  41251. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  41252. var _this = this;
  41253. return extend({}, errorCallbacks, {
  41254. connected: function (handshake) {
  41255. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  41256. _this.clearUnavailableTimer();
  41257. _this.setConnection(handshake.connection);
  41258. _this.socket_id = _this.connection.id;
  41259. _this.updateState("connected", { socket_id: _this.socket_id });
  41260. }
  41261. });
  41262. };
  41263. ;
  41264. ConnectionManager.prototype.buildErrorCallbacks = function () {
  41265. var _this = this;
  41266. var withErrorEmitted = function (callback) {
  41267. return function (result) {
  41268. if (result.error) {
  41269. _this.emit("error", { type: "WebSocketError", error: result.error });
  41270. }
  41271. callback(result);
  41272. };
  41273. };
  41274. return {
  41275. tls_only: withErrorEmitted(function () {
  41276. _this.usingTLS = true;
  41277. _this.updateStrategy();
  41278. _this.retryIn(0);
  41279. }),
  41280. refused: withErrorEmitted(function () {
  41281. _this.disconnect();
  41282. }),
  41283. backoff: withErrorEmitted(function () {
  41284. _this.retryIn(1000);
  41285. }),
  41286. retry: withErrorEmitted(function () {
  41287. _this.retryIn(0);
  41288. })
  41289. };
  41290. };
  41291. ;
  41292. ConnectionManager.prototype.setConnection = function (connection) {
  41293. this.connection = connection;
  41294. for (var event in this.connectionCallbacks) {
  41295. this.connection.bind(event, this.connectionCallbacks[event]);
  41296. }
  41297. this.resetActivityCheck();
  41298. };
  41299. ;
  41300. ConnectionManager.prototype.abandonConnection = function () {
  41301. if (!this.connection) {
  41302. return;
  41303. }
  41304. this.stopActivityCheck();
  41305. for (var event in this.connectionCallbacks) {
  41306. this.connection.unbind(event, this.connectionCallbacks[event]);
  41307. }
  41308. var connection = this.connection;
  41309. this.connection = null;
  41310. return connection;
  41311. };
  41312. ConnectionManager.prototype.updateState = function (newState, data) {
  41313. var previousState = this.state;
  41314. this.state = newState;
  41315. if (previousState !== newState) {
  41316. var newStateDescription = newState;
  41317. if (newStateDescription === "connected") {
  41318. newStateDescription += " with new socket ID " + data.socket_id;
  41319. }
  41320. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  41321. this.timeline.info({ state: newState, params: data });
  41322. this.emit('state_change', { previous: previousState, current: newState });
  41323. this.emit(newState, data);
  41324. }
  41325. };
  41326. ConnectionManager.prototype.shouldRetry = function () {
  41327. return this.state === "connecting" || this.state === "connected";
  41328. };
  41329. return ConnectionManager;
  41330. }(dispatcher));
  41331. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  41332. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  41333. var channels_Channels = (function () {
  41334. function Channels() {
  41335. this.channels = {};
  41336. }
  41337. Channels.prototype.add = function (name, pusher) {
  41338. if (!this.channels[name]) {
  41339. this.channels[name] = createChannel(name, pusher);
  41340. }
  41341. return this.channels[name];
  41342. };
  41343. Channels.prototype.all = function () {
  41344. return values(this.channels);
  41345. };
  41346. Channels.prototype.find = function (name) {
  41347. return this.channels[name];
  41348. };
  41349. Channels.prototype.remove = function (name) {
  41350. var channel = this.channels[name];
  41351. delete this.channels[name];
  41352. return channel;
  41353. };
  41354. Channels.prototype.disconnect = function () {
  41355. objectApply(this.channels, function (channel) {
  41356. channel.disconnect();
  41357. });
  41358. };
  41359. return Channels;
  41360. }());
  41361. /* harmony default export */ var channels = (channels_Channels);
  41362. function createChannel(name, pusher) {
  41363. if (name.indexOf('private-encrypted-') === 0) {
  41364. if (false) { var errorMsg; }
  41365. return factory.createEncryptedChannel(name, pusher);
  41366. }
  41367. else if (name.indexOf('private-') === 0) {
  41368. return factory.createPrivateChannel(name, pusher);
  41369. }
  41370. else if (name.indexOf('presence-') === 0) {
  41371. return factory.createPresenceChannel(name, pusher);
  41372. }
  41373. else {
  41374. return factory.createChannel(name, pusher);
  41375. }
  41376. }
  41377. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  41378. var Factory = {
  41379. createChannels: function () {
  41380. return new channels();
  41381. },
  41382. createConnectionManager: function (key, options) {
  41383. return new connection_manager(key, options);
  41384. },
  41385. createChannel: function (name, pusher) {
  41386. return new channels_channel(name, pusher);
  41387. },
  41388. createPrivateChannel: function (name, pusher) {
  41389. return new private_channel(name, pusher);
  41390. },
  41391. createPresenceChannel: function (name, pusher) {
  41392. return new presence_channel(name, pusher);
  41393. },
  41394. createEncryptedChannel: function (name, pusher) {
  41395. return new encrypted_channel(name, pusher);
  41396. },
  41397. createTimelineSender: function (timeline, options) {
  41398. return new timeline_sender(timeline, options);
  41399. },
  41400. createAuthorizer: function (channel, options) {
  41401. if (options.authorizer) {
  41402. return options.authorizer(channel, options);
  41403. }
  41404. return new pusher_authorizer(channel, options);
  41405. },
  41406. createHandshake: function (transport, callback) {
  41407. return new connection_handshake(transport, callback);
  41408. },
  41409. createAssistantToTheTransportManager: function (manager, transport, options) {
  41410. return new assistant_to_the_transport_manager(manager, transport, options);
  41411. }
  41412. };
  41413. /* harmony default export */ var factory = (Factory);
  41414. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  41415. var transport_manager_TransportManager = (function () {
  41416. function TransportManager(options) {
  41417. this.options = options || {};
  41418. this.livesLeft = this.options.lives || Infinity;
  41419. }
  41420. TransportManager.prototype.getAssistant = function (transport) {
  41421. return factory.createAssistantToTheTransportManager(this, transport, {
  41422. minPingDelay: this.options.minPingDelay,
  41423. maxPingDelay: this.options.maxPingDelay
  41424. });
  41425. };
  41426. TransportManager.prototype.isAlive = function () {
  41427. return this.livesLeft > 0;
  41428. };
  41429. TransportManager.prototype.reportDeath = function () {
  41430. this.livesLeft -= 1;
  41431. };
  41432. return TransportManager;
  41433. }());
  41434. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  41435. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  41436. var sequential_strategy_SequentialStrategy = (function () {
  41437. function SequentialStrategy(strategies, options) {
  41438. this.strategies = strategies;
  41439. this.loop = Boolean(options.loop);
  41440. this.failFast = Boolean(options.failFast);
  41441. this.timeout = options.timeout;
  41442. this.timeoutLimit = options.timeoutLimit;
  41443. }
  41444. SequentialStrategy.prototype.isSupported = function () {
  41445. return any(this.strategies, util.method("isSupported"));
  41446. };
  41447. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  41448. var _this = this;
  41449. var strategies = this.strategies;
  41450. var current = 0;
  41451. var timeout = this.timeout;
  41452. var runner = null;
  41453. var tryNextStrategy = function (error, handshake) {
  41454. if (handshake) {
  41455. callback(null, handshake);
  41456. }
  41457. else {
  41458. current = current + 1;
  41459. if (_this.loop) {
  41460. current = current % strategies.length;
  41461. }
  41462. if (current < strategies.length) {
  41463. if (timeout) {
  41464. timeout = timeout * 2;
  41465. if (_this.timeoutLimit) {
  41466. timeout = Math.min(timeout, _this.timeoutLimit);
  41467. }
  41468. }
  41469. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  41470. }
  41471. else {
  41472. callback(true);
  41473. }
  41474. }
  41475. };
  41476. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  41477. return {
  41478. abort: function () {
  41479. runner.abort();
  41480. },
  41481. forceMinPriority: function (p) {
  41482. minPriority = p;
  41483. if (runner) {
  41484. runner.forceMinPriority(p);
  41485. }
  41486. }
  41487. };
  41488. };
  41489. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  41490. var timer = null;
  41491. var runner = null;
  41492. if (options.timeout > 0) {
  41493. timer = new OneOffTimer(options.timeout, function () {
  41494. runner.abort();
  41495. callback(true);
  41496. });
  41497. }
  41498. runner = strategy.connect(minPriority, function (error, handshake) {
  41499. if (error && timer && timer.isRunning() && !options.failFast) {
  41500. return;
  41501. }
  41502. if (timer) {
  41503. timer.ensureAborted();
  41504. }
  41505. callback(error, handshake);
  41506. });
  41507. return {
  41508. abort: function () {
  41509. if (timer) {
  41510. timer.ensureAborted();
  41511. }
  41512. runner.abort();
  41513. },
  41514. forceMinPriority: function (p) {
  41515. runner.forceMinPriority(p);
  41516. }
  41517. };
  41518. };
  41519. return SequentialStrategy;
  41520. }());
  41521. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  41522. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  41523. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  41524. function BestConnectedEverStrategy(strategies) {
  41525. this.strategies = strategies;
  41526. }
  41527. BestConnectedEverStrategy.prototype.isSupported = function () {
  41528. return any(this.strategies, util.method("isSupported"));
  41529. };
  41530. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  41531. return connect(this.strategies, minPriority, function (i, runners) {
  41532. return function (error, handshake) {
  41533. runners[i].error = error;
  41534. if (error) {
  41535. if (allRunnersFailed(runners)) {
  41536. callback(true);
  41537. }
  41538. return;
  41539. }
  41540. apply(runners, function (runner) {
  41541. runner.forceMinPriority(handshake.transport.priority);
  41542. });
  41543. callback(null, handshake);
  41544. };
  41545. });
  41546. };
  41547. return BestConnectedEverStrategy;
  41548. }());
  41549. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  41550. function connect(strategies, minPriority, callbackBuilder) {
  41551. var runners = map(strategies, function (strategy, i, _, rs) {
  41552. return strategy.connect(minPriority, callbackBuilder(i, rs));
  41553. });
  41554. return {
  41555. abort: function () {
  41556. apply(runners, abortRunner);
  41557. },
  41558. forceMinPriority: function (p) {
  41559. apply(runners, function (runner) {
  41560. runner.forceMinPriority(p);
  41561. });
  41562. }
  41563. };
  41564. }
  41565. function allRunnersFailed(runners) {
  41566. return collections_all(runners, function (runner) {
  41567. return Boolean(runner.error);
  41568. });
  41569. }
  41570. function abortRunner(runner) {
  41571. if (!runner.error && !runner.aborted) {
  41572. runner.abort();
  41573. runner.aborted = true;
  41574. }
  41575. }
  41576. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  41577. var cached_strategy_CachedStrategy = (function () {
  41578. function CachedStrategy(strategy, transports, options) {
  41579. this.strategy = strategy;
  41580. this.transports = transports;
  41581. this.ttl = options.ttl || 1800 * 1000;
  41582. this.usingTLS = options.useTLS;
  41583. this.timeline = options.timeline;
  41584. }
  41585. CachedStrategy.prototype.isSupported = function () {
  41586. return this.strategy.isSupported();
  41587. };
  41588. CachedStrategy.prototype.connect = function (minPriority, callback) {
  41589. var usingTLS = this.usingTLS;
  41590. var info = fetchTransportCache(usingTLS);
  41591. var strategies = [this.strategy];
  41592. if (info && info.timestamp + this.ttl >= util.now()) {
  41593. var transport = this.transports[info.transport];
  41594. if (transport) {
  41595. this.timeline.info({
  41596. cached: true,
  41597. transport: info.transport,
  41598. latency: info.latency
  41599. });
  41600. strategies.push(new sequential_strategy([transport], {
  41601. timeout: info.latency * 2 + 1000,
  41602. failFast: true
  41603. }));
  41604. }
  41605. }
  41606. var startTimestamp = util.now();
  41607. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  41608. if (error) {
  41609. flushTransportCache(usingTLS);
  41610. if (strategies.length > 0) {
  41611. startTimestamp = util.now();
  41612. runner = strategies.pop().connect(minPriority, cb);
  41613. }
  41614. else {
  41615. callback(error);
  41616. }
  41617. }
  41618. else {
  41619. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  41620. callback(null, handshake);
  41621. }
  41622. });
  41623. return {
  41624. abort: function () {
  41625. runner.abort();
  41626. },
  41627. forceMinPriority: function (p) {
  41628. minPriority = p;
  41629. if (runner) {
  41630. runner.forceMinPriority(p);
  41631. }
  41632. }
  41633. };
  41634. };
  41635. return CachedStrategy;
  41636. }());
  41637. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  41638. function getTransportCacheKey(usingTLS) {
  41639. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  41640. }
  41641. function fetchTransportCache(usingTLS) {
  41642. var storage = runtime.getLocalStorage();
  41643. if (storage) {
  41644. try {
  41645. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  41646. if (serializedCache) {
  41647. return JSON.parse(serializedCache);
  41648. }
  41649. }
  41650. catch (e) {
  41651. flushTransportCache(usingTLS);
  41652. }
  41653. }
  41654. return null;
  41655. }
  41656. function storeTransportCache(usingTLS, transport, latency) {
  41657. var storage = runtime.getLocalStorage();
  41658. if (storage) {
  41659. try {
  41660. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  41661. timestamp: util.now(),
  41662. transport: transport,
  41663. latency: latency
  41664. });
  41665. }
  41666. catch (e) {
  41667. }
  41668. }
  41669. }
  41670. function flushTransportCache(usingTLS) {
  41671. var storage = runtime.getLocalStorage();
  41672. if (storage) {
  41673. try {
  41674. delete storage[getTransportCacheKey(usingTLS)];
  41675. }
  41676. catch (e) {
  41677. }
  41678. }
  41679. }
  41680. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  41681. var delayed_strategy_DelayedStrategy = (function () {
  41682. function DelayedStrategy(strategy, _a) {
  41683. var number = _a.delay;
  41684. this.strategy = strategy;
  41685. this.options = { delay: number };
  41686. }
  41687. DelayedStrategy.prototype.isSupported = function () {
  41688. return this.strategy.isSupported();
  41689. };
  41690. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  41691. var strategy = this.strategy;
  41692. var runner;
  41693. var timer = new OneOffTimer(this.options.delay, function () {
  41694. runner = strategy.connect(minPriority, callback);
  41695. });
  41696. return {
  41697. abort: function () {
  41698. timer.ensureAborted();
  41699. if (runner) {
  41700. runner.abort();
  41701. }
  41702. },
  41703. forceMinPriority: function (p) {
  41704. minPriority = p;
  41705. if (runner) {
  41706. runner.forceMinPriority(p);
  41707. }
  41708. }
  41709. };
  41710. };
  41711. return DelayedStrategy;
  41712. }());
  41713. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  41714. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  41715. var IfStrategy = (function () {
  41716. function IfStrategy(test, trueBranch, falseBranch) {
  41717. this.test = test;
  41718. this.trueBranch = trueBranch;
  41719. this.falseBranch = falseBranch;
  41720. }
  41721. IfStrategy.prototype.isSupported = function () {
  41722. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41723. return branch.isSupported();
  41724. };
  41725. IfStrategy.prototype.connect = function (minPriority, callback) {
  41726. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41727. return branch.connect(minPriority, callback);
  41728. };
  41729. return IfStrategy;
  41730. }());
  41731. /* harmony default export */ var if_strategy = (IfStrategy);
  41732. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  41733. var FirstConnectedStrategy = (function () {
  41734. function FirstConnectedStrategy(strategy) {
  41735. this.strategy = strategy;
  41736. }
  41737. FirstConnectedStrategy.prototype.isSupported = function () {
  41738. return this.strategy.isSupported();
  41739. };
  41740. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  41741. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  41742. if (handshake) {
  41743. runner.abort();
  41744. }
  41745. callback(error, handshake);
  41746. });
  41747. return runner;
  41748. };
  41749. return FirstConnectedStrategy;
  41750. }());
  41751. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  41752. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  41753. function testSupportsStrategy(strategy) {
  41754. return function () {
  41755. return strategy.isSupported();
  41756. };
  41757. }
  41758. var getDefaultStrategy = function (config, defineTransport) {
  41759. var definedTransports = {};
  41760. function defineTransportStrategy(name, type, priority, options, manager) {
  41761. var transport = defineTransport(config, name, type, priority, options, manager);
  41762. definedTransports[name] = transport;
  41763. return transport;
  41764. }
  41765. var ws_options = {
  41766. hostNonTLS: config.wsHost + ":" + config.wsPort,
  41767. hostTLS: config.wsHost + ":" + config.wssPort,
  41768. httpPath: config.wsPath
  41769. };
  41770. var wss_options = extend({}, ws_options, {
  41771. useTLS: true
  41772. });
  41773. var sockjs_options = {
  41774. hostNonTLS: config.httpHost + ":" + config.httpPort,
  41775. hostTLS: config.httpHost + ":" + config.httpsPort,
  41776. httpPath: config.httpPath
  41777. };
  41778. var timeouts = {
  41779. loop: true,
  41780. timeout: 15000,
  41781. timeoutLimit: 60000
  41782. };
  41783. var ws_manager = new transport_manager({
  41784. lives: 2,
  41785. minPingDelay: 10000,
  41786. maxPingDelay: config.activity_timeout
  41787. });
  41788. var streaming_manager = new transport_manager({
  41789. lives: 2,
  41790. minPingDelay: 10000,
  41791. maxPingDelay: config.activity_timeout
  41792. });
  41793. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  41794. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  41795. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  41796. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  41797. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  41798. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  41799. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  41800. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  41801. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  41802. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  41803. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  41804. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  41805. 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);
  41806. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  41807. var wsStrategy;
  41808. if (config.useTLS) {
  41809. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  41810. }
  41811. else {
  41812. wsStrategy = new best_connected_ever_strategy([
  41813. ws_loop,
  41814. new delayed_strategy(wss_loop, { delay: 2000 }),
  41815. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  41816. ]);
  41817. }
  41818. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  41819. ttl: 1800000,
  41820. timeline: config.timeline,
  41821. useTLS: config.useTLS
  41822. });
  41823. };
  41824. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  41825. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  41826. /* harmony default export */ var transport_connection_initializer = (function () {
  41827. var self = this;
  41828. self.timeline.info(self.buildTimelineMessage({
  41829. transport: self.name + (self.options.useTLS ? "s" : "")
  41830. }));
  41831. if (self.hooks.isInitialized()) {
  41832. self.changeState("initialized");
  41833. }
  41834. else if (self.hooks.file) {
  41835. self.changeState("initializing");
  41836. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  41837. if (self.hooks.isInitialized()) {
  41838. self.changeState("initialized");
  41839. callback(true);
  41840. }
  41841. else {
  41842. if (error) {
  41843. self.onError(error);
  41844. }
  41845. self.onClose();
  41846. callback(false);
  41847. }
  41848. });
  41849. }
  41850. else {
  41851. self.onClose();
  41852. }
  41853. });
  41854. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  41855. var http_xdomain_request_hooks = {
  41856. getRequest: function (socket) {
  41857. var xdr = new window.XDomainRequest();
  41858. xdr.ontimeout = function () {
  41859. socket.emit("error", new RequestTimedOut());
  41860. socket.close();
  41861. };
  41862. xdr.onerror = function (e) {
  41863. socket.emit("error", e);
  41864. socket.close();
  41865. };
  41866. xdr.onprogress = function () {
  41867. if (xdr.responseText && xdr.responseText.length > 0) {
  41868. socket.onChunk(200, xdr.responseText);
  41869. }
  41870. };
  41871. xdr.onload = function () {
  41872. if (xdr.responseText && xdr.responseText.length > 0) {
  41873. socket.onChunk(200, xdr.responseText);
  41874. }
  41875. socket.emit("finished", 200);
  41876. socket.close();
  41877. };
  41878. return xdr;
  41879. },
  41880. abortRequest: function (xdr) {
  41881. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  41882. xdr.abort();
  41883. }
  41884. };
  41885. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  41886. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  41887. var http_request_extends = (undefined && undefined.__extends) || (function () {
  41888. var extendStatics = function (d, b) {
  41889. extendStatics = Object.setPrototypeOf ||
  41890. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41891. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41892. return extendStatics(d, b);
  41893. };
  41894. return function (d, b) {
  41895. extendStatics(d, b);
  41896. function __() { this.constructor = d; }
  41897. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41898. };
  41899. })();
  41900. var MAX_BUFFER_LENGTH = 256 * 1024;
  41901. var http_request_HTTPRequest = (function (_super) {
  41902. http_request_extends(HTTPRequest, _super);
  41903. function HTTPRequest(hooks, method, url) {
  41904. var _this = _super.call(this) || this;
  41905. _this.hooks = hooks;
  41906. _this.method = method;
  41907. _this.url = url;
  41908. return _this;
  41909. }
  41910. HTTPRequest.prototype.start = function (payload) {
  41911. var _this = this;
  41912. this.position = 0;
  41913. this.xhr = this.hooks.getRequest(this);
  41914. this.unloader = function () {
  41915. _this.close();
  41916. };
  41917. runtime.addUnloadListener(this.unloader);
  41918. this.xhr.open(this.method, this.url, true);
  41919. if (this.xhr.setRequestHeader) {
  41920. this.xhr.setRequestHeader("Content-Type", "application/json");
  41921. }
  41922. this.xhr.send(payload);
  41923. };
  41924. HTTPRequest.prototype.close = function () {
  41925. if (this.unloader) {
  41926. runtime.removeUnloadListener(this.unloader);
  41927. this.unloader = null;
  41928. }
  41929. if (this.xhr) {
  41930. this.hooks.abortRequest(this.xhr);
  41931. this.xhr = null;
  41932. }
  41933. };
  41934. HTTPRequest.prototype.onChunk = function (status, data) {
  41935. while (true) {
  41936. var chunk = this.advanceBuffer(data);
  41937. if (chunk) {
  41938. this.emit("chunk", { status: status, data: chunk });
  41939. }
  41940. else {
  41941. break;
  41942. }
  41943. }
  41944. if (this.isBufferTooLong(data)) {
  41945. this.emit("buffer_too_long");
  41946. }
  41947. };
  41948. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  41949. var unreadData = buffer.slice(this.position);
  41950. var endOfLinePosition = unreadData.indexOf("\n");
  41951. if (endOfLinePosition !== -1) {
  41952. this.position += endOfLinePosition + 1;
  41953. return unreadData.slice(0, endOfLinePosition);
  41954. }
  41955. else {
  41956. return null;
  41957. }
  41958. };
  41959. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  41960. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  41961. };
  41962. return HTTPRequest;
  41963. }(dispatcher));
  41964. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  41965. // CONCATENATED MODULE: ./src/core/http/state.ts
  41966. var State;
  41967. (function (State) {
  41968. State[State["CONNECTING"] = 0] = "CONNECTING";
  41969. State[State["OPEN"] = 1] = "OPEN";
  41970. State[State["CLOSED"] = 3] = "CLOSED";
  41971. })(State || (State = {}));
  41972. /* harmony default export */ var state = (State);
  41973. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  41974. var autoIncrement = 1;
  41975. var http_socket_HTTPSocket = (function () {
  41976. function HTTPSocket(hooks, url) {
  41977. this.hooks = hooks;
  41978. this.session = randomNumber(1000) + "/" + randomString(8);
  41979. this.location = getLocation(url);
  41980. this.readyState = state.CONNECTING;
  41981. this.openStream();
  41982. }
  41983. HTTPSocket.prototype.send = function (payload) {
  41984. return this.sendRaw(JSON.stringify([payload]));
  41985. };
  41986. HTTPSocket.prototype.ping = function () {
  41987. this.hooks.sendHeartbeat(this);
  41988. };
  41989. HTTPSocket.prototype.close = function (code, reason) {
  41990. this.onClose(code, reason, true);
  41991. };
  41992. HTTPSocket.prototype.sendRaw = function (payload) {
  41993. if (this.readyState === state.OPEN) {
  41994. try {
  41995. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  41996. return true;
  41997. }
  41998. catch (e) {
  41999. return false;
  42000. }
  42001. }
  42002. else {
  42003. return false;
  42004. }
  42005. };
  42006. HTTPSocket.prototype.reconnect = function () {
  42007. this.closeStream();
  42008. this.openStream();
  42009. };
  42010. ;
  42011. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  42012. this.closeStream();
  42013. this.readyState = state.CLOSED;
  42014. if (this.onclose) {
  42015. this.onclose({
  42016. code: code,
  42017. reason: reason,
  42018. wasClean: wasClean
  42019. });
  42020. }
  42021. };
  42022. HTTPSocket.prototype.onChunk = function (chunk) {
  42023. if (chunk.status !== 200) {
  42024. return;
  42025. }
  42026. if (this.readyState === state.OPEN) {
  42027. this.onActivity();
  42028. }
  42029. var payload;
  42030. var type = chunk.data.slice(0, 1);
  42031. switch (type) {
  42032. case 'o':
  42033. payload = JSON.parse(chunk.data.slice(1) || '{}');
  42034. this.onOpen(payload);
  42035. break;
  42036. case 'a':
  42037. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42038. for (var i = 0; i < payload.length; i++) {
  42039. this.onEvent(payload[i]);
  42040. }
  42041. break;
  42042. case 'm':
  42043. payload = JSON.parse(chunk.data.slice(1) || 'null');
  42044. this.onEvent(payload);
  42045. break;
  42046. case 'h':
  42047. this.hooks.onHeartbeat(this);
  42048. break;
  42049. case 'c':
  42050. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42051. this.onClose(payload[0], payload[1], true);
  42052. break;
  42053. }
  42054. };
  42055. HTTPSocket.prototype.onOpen = function (options) {
  42056. if (this.readyState === state.CONNECTING) {
  42057. if (options && options.hostname) {
  42058. this.location.base = replaceHost(this.location.base, options.hostname);
  42059. }
  42060. this.readyState = state.OPEN;
  42061. if (this.onopen) {
  42062. this.onopen();
  42063. }
  42064. }
  42065. else {
  42066. this.onClose(1006, "Server lost session", true);
  42067. }
  42068. };
  42069. HTTPSocket.prototype.onEvent = function (event) {
  42070. if (this.readyState === state.OPEN && this.onmessage) {
  42071. this.onmessage({ data: event });
  42072. }
  42073. };
  42074. HTTPSocket.prototype.onActivity = function () {
  42075. if (this.onactivity) {
  42076. this.onactivity();
  42077. }
  42078. };
  42079. HTTPSocket.prototype.onError = function (error) {
  42080. if (this.onerror) {
  42081. this.onerror(error);
  42082. }
  42083. };
  42084. HTTPSocket.prototype.openStream = function () {
  42085. var _this = this;
  42086. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  42087. this.stream.bind("chunk", function (chunk) {
  42088. _this.onChunk(chunk);
  42089. });
  42090. this.stream.bind("finished", function (status) {
  42091. _this.hooks.onFinished(_this, status);
  42092. });
  42093. this.stream.bind("buffer_too_long", function () {
  42094. _this.reconnect();
  42095. });
  42096. try {
  42097. this.stream.start();
  42098. }
  42099. catch (error) {
  42100. util.defer(function () {
  42101. _this.onError(error);
  42102. _this.onClose(1006, "Could not start streaming", false);
  42103. });
  42104. }
  42105. };
  42106. HTTPSocket.prototype.closeStream = function () {
  42107. if (this.stream) {
  42108. this.stream.unbind_all();
  42109. this.stream.close();
  42110. this.stream = null;
  42111. }
  42112. };
  42113. return HTTPSocket;
  42114. }());
  42115. function getLocation(url) {
  42116. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  42117. return {
  42118. base: parts[1],
  42119. queryString: parts[2]
  42120. };
  42121. }
  42122. function getSendURL(url, session) {
  42123. return url.base + "/" + session + "/xhr_send";
  42124. }
  42125. function getUniqueURL(url) {
  42126. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  42127. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  42128. }
  42129. function replaceHost(url, hostname) {
  42130. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  42131. return urlParts[1] + hostname + urlParts[3];
  42132. }
  42133. function randomNumber(max) {
  42134. return Math.floor(Math.random() * max);
  42135. }
  42136. function randomString(length) {
  42137. var result = [];
  42138. for (var i = 0; i < length; i++) {
  42139. result.push(randomNumber(32).toString(32));
  42140. }
  42141. return result.join('');
  42142. }
  42143. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  42144. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  42145. var http_streaming_socket_hooks = {
  42146. getReceiveURL: function (url, session) {
  42147. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  42148. },
  42149. onHeartbeat: function (socket) {
  42150. socket.sendRaw("[]");
  42151. },
  42152. sendHeartbeat: function (socket) {
  42153. socket.sendRaw("[]");
  42154. },
  42155. onFinished: function (socket, status) {
  42156. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42157. }
  42158. };
  42159. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  42160. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  42161. var http_polling_socket_hooks = {
  42162. getReceiveURL: function (url, session) {
  42163. return url.base + "/" + session + "/xhr" + url.queryString;
  42164. },
  42165. onHeartbeat: function () {
  42166. },
  42167. sendHeartbeat: function (socket) {
  42168. socket.sendRaw("[]");
  42169. },
  42170. onFinished: function (socket, status) {
  42171. if (status === 200) {
  42172. socket.reconnect();
  42173. }
  42174. else {
  42175. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42176. }
  42177. }
  42178. };
  42179. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  42180. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  42181. var http_xhr_request_hooks = {
  42182. getRequest: function (socket) {
  42183. var Constructor = runtime.getXHRAPI();
  42184. var xhr = new Constructor();
  42185. xhr.onreadystatechange = xhr.onprogress = function () {
  42186. switch (xhr.readyState) {
  42187. case 3:
  42188. if (xhr.responseText && xhr.responseText.length > 0) {
  42189. socket.onChunk(xhr.status, xhr.responseText);
  42190. }
  42191. break;
  42192. case 4:
  42193. if (xhr.responseText && xhr.responseText.length > 0) {
  42194. socket.onChunk(xhr.status, xhr.responseText);
  42195. }
  42196. socket.emit("finished", xhr.status);
  42197. socket.close();
  42198. break;
  42199. }
  42200. };
  42201. return xhr;
  42202. },
  42203. abortRequest: function (xhr) {
  42204. xhr.onreadystatechange = null;
  42205. xhr.abort();
  42206. }
  42207. };
  42208. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  42209. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  42210. var HTTP = {
  42211. createStreamingSocket: function (url) {
  42212. return this.createSocket(http_streaming_socket, url);
  42213. },
  42214. createPollingSocket: function (url) {
  42215. return this.createSocket(http_polling_socket, url);
  42216. },
  42217. createSocket: function (hooks, url) {
  42218. return new http_socket(hooks, url);
  42219. },
  42220. createXHR: function (method, url) {
  42221. return this.createRequest(http_xhr_request, method, url);
  42222. },
  42223. createRequest: function (hooks, method, url) {
  42224. return new http_request(hooks, method, url);
  42225. }
  42226. };
  42227. /* harmony default export */ var http_http = (HTTP);
  42228. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  42229. http_http.createXDR = function (method, url) {
  42230. return this.createRequest(http_xdomain_request, method, url);
  42231. };
  42232. /* harmony default export */ var web_http_http = (http_http);
  42233. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  42234. var Runtime = {
  42235. nextAuthCallbackID: 1,
  42236. auth_callbacks: {},
  42237. ScriptReceivers: ScriptReceivers,
  42238. DependenciesReceivers: DependenciesReceivers,
  42239. getDefaultStrategy: default_strategy,
  42240. Transports: transports_transports,
  42241. transportConnectionInitializer: transport_connection_initializer,
  42242. HTTPFactory: web_http_http,
  42243. TimelineTransport: jsonp_timeline,
  42244. getXHRAPI: function () {
  42245. return window.XMLHttpRequest;
  42246. },
  42247. getWebSocketAPI: function () {
  42248. return window.WebSocket || window.MozWebSocket;
  42249. },
  42250. setup: function (PusherClass) {
  42251. var _this = this;
  42252. window.Pusher = PusherClass;
  42253. var initializeOnDocumentBody = function () {
  42254. _this.onDocumentBody(PusherClass.ready);
  42255. };
  42256. if (!window.JSON) {
  42257. Dependencies.load("json2", {}, initializeOnDocumentBody);
  42258. }
  42259. else {
  42260. initializeOnDocumentBody();
  42261. }
  42262. },
  42263. getDocument: function () {
  42264. return document;
  42265. },
  42266. getProtocol: function () {
  42267. return this.getDocument().location.protocol;
  42268. },
  42269. getAuthorizers: function () {
  42270. return { ajax: xhr_auth, jsonp: jsonp_auth };
  42271. },
  42272. onDocumentBody: function (callback) {
  42273. var _this = this;
  42274. if (document.body) {
  42275. callback();
  42276. }
  42277. else {
  42278. setTimeout(function () {
  42279. _this.onDocumentBody(callback);
  42280. }, 0);
  42281. }
  42282. },
  42283. createJSONPRequest: function (url, data) {
  42284. return new jsonp_request(url, data);
  42285. },
  42286. createScriptRequest: function (src) {
  42287. return new script_request(src);
  42288. },
  42289. getLocalStorage: function () {
  42290. try {
  42291. return window.localStorage;
  42292. }
  42293. catch (e) {
  42294. return undefined;
  42295. }
  42296. },
  42297. createXHR: function () {
  42298. if (this.getXHRAPI()) {
  42299. return this.createXMLHttpRequest();
  42300. }
  42301. else {
  42302. return this.createMicrosoftXHR();
  42303. }
  42304. },
  42305. createXMLHttpRequest: function () {
  42306. var Constructor = this.getXHRAPI();
  42307. return new Constructor();
  42308. },
  42309. createMicrosoftXHR: function () {
  42310. return new ActiveXObject("Microsoft.XMLHTTP");
  42311. },
  42312. getNetwork: function () {
  42313. return net_info_Network;
  42314. },
  42315. createWebSocket: function (url) {
  42316. var Constructor = this.getWebSocketAPI();
  42317. return new Constructor(url);
  42318. },
  42319. createSocketRequest: function (method, url) {
  42320. if (this.isXHRSupported()) {
  42321. return this.HTTPFactory.createXHR(method, url);
  42322. }
  42323. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  42324. return this.HTTPFactory.createXDR(method, url);
  42325. }
  42326. else {
  42327. throw "Cross-origin HTTP requests are not supported";
  42328. }
  42329. },
  42330. isXHRSupported: function () {
  42331. var Constructor = this.getXHRAPI();
  42332. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  42333. },
  42334. isXDRSupported: function (useTLS) {
  42335. var protocol = useTLS ? "https:" : "http:";
  42336. var documentProtocol = this.getProtocol();
  42337. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  42338. },
  42339. addUnloadListener: function (listener) {
  42340. if (window.addEventListener !== undefined) {
  42341. window.addEventListener("unload", listener, false);
  42342. }
  42343. else if (window.attachEvent !== undefined) {
  42344. window.attachEvent("onunload", listener);
  42345. }
  42346. },
  42347. removeUnloadListener: function (listener) {
  42348. if (window.addEventListener !== undefined) {
  42349. window.removeEventListener("unload", listener, false);
  42350. }
  42351. else if (window.detachEvent !== undefined) {
  42352. window.detachEvent("onunload", listener);
  42353. }
  42354. }
  42355. };
  42356. /* harmony default export */ var runtime = (Runtime);
  42357. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  42358. var TimelineLevel;
  42359. (function (TimelineLevel) {
  42360. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  42361. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  42362. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  42363. })(TimelineLevel || (TimelineLevel = {}));
  42364. /* harmony default export */ var timeline_level = (TimelineLevel);
  42365. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  42366. var timeline_Timeline = (function () {
  42367. function Timeline(key, session, options) {
  42368. this.key = key;
  42369. this.session = session;
  42370. this.events = [];
  42371. this.options = options || {};
  42372. this.sent = 0;
  42373. this.uniqueID = 0;
  42374. }
  42375. Timeline.prototype.log = function (level, event) {
  42376. if (level <= this.options.level) {
  42377. this.events.push(extend({}, event, { timestamp: util.now() }));
  42378. if (this.options.limit && this.events.length > this.options.limit) {
  42379. this.events.shift();
  42380. }
  42381. }
  42382. };
  42383. Timeline.prototype.error = function (event) {
  42384. this.log(timeline_level.ERROR, event);
  42385. };
  42386. Timeline.prototype.info = function (event) {
  42387. this.log(timeline_level.INFO, event);
  42388. };
  42389. Timeline.prototype.debug = function (event) {
  42390. this.log(timeline_level.DEBUG, event);
  42391. };
  42392. Timeline.prototype.isEmpty = function () {
  42393. return this.events.length === 0;
  42394. };
  42395. Timeline.prototype.send = function (sendfn, callback) {
  42396. var _this = this;
  42397. var data = extend({
  42398. session: this.session,
  42399. bundle: this.sent + 1,
  42400. key: this.key,
  42401. lib: "js",
  42402. version: this.options.version,
  42403. cluster: this.options.cluster,
  42404. features: this.options.features,
  42405. timeline: this.events
  42406. }, this.options.params);
  42407. this.events = [];
  42408. sendfn(data, function (error, result) {
  42409. if (!error) {
  42410. _this.sent++;
  42411. }
  42412. if (callback) {
  42413. callback(error, result);
  42414. }
  42415. });
  42416. return true;
  42417. };
  42418. Timeline.prototype.generateUniqueID = function () {
  42419. this.uniqueID++;
  42420. return this.uniqueID;
  42421. };
  42422. return Timeline;
  42423. }());
  42424. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  42425. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  42426. var transport_strategy_TransportStrategy = (function () {
  42427. function TransportStrategy(name, priority, transport, options) {
  42428. this.name = name;
  42429. this.priority = priority;
  42430. this.transport = transport;
  42431. this.options = options || {};
  42432. }
  42433. TransportStrategy.prototype.isSupported = function () {
  42434. return this.transport.isSupported({
  42435. useTLS: this.options.useTLS
  42436. });
  42437. };
  42438. TransportStrategy.prototype.connect = function (minPriority, callback) {
  42439. var _this = this;
  42440. if (!this.isSupported()) {
  42441. return failAttempt(new UnsupportedStrategy(), callback);
  42442. }
  42443. else if (this.priority < minPriority) {
  42444. return failAttempt(new TransportPriorityTooLow(), callback);
  42445. }
  42446. var connected = false;
  42447. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  42448. var handshake = null;
  42449. var onInitialized = function () {
  42450. transport.unbind("initialized", onInitialized);
  42451. transport.connect();
  42452. };
  42453. var onOpen = function () {
  42454. handshake = factory.createHandshake(transport, function (result) {
  42455. connected = true;
  42456. unbindListeners();
  42457. callback(null, result);
  42458. });
  42459. };
  42460. var onError = function (error) {
  42461. unbindListeners();
  42462. callback(error);
  42463. };
  42464. var onClosed = function () {
  42465. unbindListeners();
  42466. var serializedTransport;
  42467. serializedTransport = safeJSONStringify(transport);
  42468. callback(new TransportClosed(serializedTransport));
  42469. };
  42470. var unbindListeners = function () {
  42471. transport.unbind("initialized", onInitialized);
  42472. transport.unbind("open", onOpen);
  42473. transport.unbind("error", onError);
  42474. transport.unbind("closed", onClosed);
  42475. };
  42476. transport.bind("initialized", onInitialized);
  42477. transport.bind("open", onOpen);
  42478. transport.bind("error", onError);
  42479. transport.bind("closed", onClosed);
  42480. transport.initialize();
  42481. return {
  42482. abort: function () {
  42483. if (connected) {
  42484. return;
  42485. }
  42486. unbindListeners();
  42487. if (handshake) {
  42488. handshake.close();
  42489. }
  42490. else {
  42491. transport.close();
  42492. }
  42493. },
  42494. forceMinPriority: function (p) {
  42495. if (connected) {
  42496. return;
  42497. }
  42498. if (_this.priority < p) {
  42499. if (handshake) {
  42500. handshake.close();
  42501. }
  42502. else {
  42503. transport.close();
  42504. }
  42505. }
  42506. }
  42507. };
  42508. };
  42509. return TransportStrategy;
  42510. }());
  42511. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  42512. function failAttempt(error, callback) {
  42513. util.defer(function () {
  42514. callback(error);
  42515. });
  42516. return {
  42517. abort: function () { },
  42518. forceMinPriority: function () { }
  42519. };
  42520. }
  42521. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  42522. var strategy_builder_Transports = runtime.Transports;
  42523. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  42524. var transportClass = strategy_builder_Transports[type];
  42525. if (!transportClass) {
  42526. throw new UnsupportedTransport(type);
  42527. }
  42528. var enabled = (!config.enabledTransports ||
  42529. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  42530. (!config.disabledTransports ||
  42531. arrayIndexOf(config.disabledTransports, name) === -1);
  42532. var transport;
  42533. if (enabled) {
  42534. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  42535. key: config.key,
  42536. useTLS: config.useTLS,
  42537. timeline: config.timeline,
  42538. ignoreNullOrigin: config.ignoreNullOrigin
  42539. }, options));
  42540. }
  42541. else {
  42542. transport = strategy_builder_UnsupportedStrategy;
  42543. }
  42544. return transport;
  42545. };
  42546. var strategy_builder_UnsupportedStrategy = {
  42547. isSupported: function () {
  42548. return false;
  42549. },
  42550. connect: function (_, callback) {
  42551. var deferred = util.defer(function () {
  42552. callback(new UnsupportedStrategy());
  42553. });
  42554. return {
  42555. abort: function () {
  42556. deferred.ensureAborted();
  42557. },
  42558. forceMinPriority: function () { }
  42559. };
  42560. }
  42561. };
  42562. // CONCATENATED MODULE: ./src/core/config.ts
  42563. var getGlobalConfig = function () {
  42564. return {
  42565. wsHost: defaults.host,
  42566. wsPort: defaults.ws_port,
  42567. wssPort: defaults.wss_port,
  42568. wsPath: defaults.ws_path,
  42569. httpHost: defaults.sockjs_host,
  42570. httpPort: defaults.sockjs_http_port,
  42571. httpsPort: defaults.sockjs_https_port,
  42572. httpPath: defaults.sockjs_path,
  42573. statsHost: defaults.stats_host,
  42574. authEndpoint: defaults.channel_auth_endpoint,
  42575. authTransport: defaults.channel_auth_transport,
  42576. activity_timeout: defaults.activity_timeout,
  42577. pong_timeout: defaults.pong_timeout,
  42578. unavailable_timeout: defaults.unavailable_timeout
  42579. };
  42580. };
  42581. var getClusterConfig = function (clusterName) {
  42582. return {
  42583. wsHost: 'ws-' + clusterName + '.pusher.com',
  42584. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  42585. };
  42586. };
  42587. // CONCATENATED MODULE: ./src/core/pusher.ts
  42588. var pusher_Pusher = (function () {
  42589. function Pusher(app_key, options) {
  42590. var _this = this;
  42591. checkAppKey(app_key);
  42592. options = options || {};
  42593. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  42594. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  42595. logger.warn("You should always specify a cluster when connecting. " + suffix);
  42596. }
  42597. this.key = app_key;
  42598. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  42599. this.channels = factory.createChannels();
  42600. this.global_emitter = new dispatcher();
  42601. this.sessionID = Math.floor(Math.random() * 1000000000);
  42602. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  42603. cluster: this.config.cluster,
  42604. features: Pusher.getClientFeatures(),
  42605. params: this.config.timelineParams || {},
  42606. limit: 50,
  42607. level: timeline_level.INFO,
  42608. version: defaults.VERSION
  42609. });
  42610. if (!this.config.disableStats) {
  42611. this.timelineSender = factory.createTimelineSender(this.timeline, {
  42612. host: this.config.statsHost,
  42613. path: '/timeline/v2/' + runtime.TimelineTransport.name
  42614. });
  42615. }
  42616. var getStrategy = function (options) {
  42617. var config = extend({}, _this.config, options);
  42618. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  42619. };
  42620. this.connection = factory.createConnectionManager(this.key, extend({
  42621. getStrategy: getStrategy,
  42622. timeline: this.timeline,
  42623. activityTimeout: this.config.activity_timeout,
  42624. pongTimeout: this.config.pong_timeout,
  42625. unavailableTimeout: this.config.unavailable_timeout
  42626. }, this.config, { useTLS: this.shouldUseTLS() }));
  42627. this.connection.bind('connected', function () {
  42628. _this.subscribeAll();
  42629. if (_this.timelineSender) {
  42630. _this.timelineSender.send(_this.connection.isUsingTLS());
  42631. }
  42632. });
  42633. this.connection.bind('message', function (event) {
  42634. var eventName = event.event;
  42635. var internal = eventName.indexOf('pusher_internal:') === 0;
  42636. if (event.channel) {
  42637. var channel = _this.channel(event.channel);
  42638. if (channel) {
  42639. channel.handleEvent(event);
  42640. }
  42641. }
  42642. if (!internal) {
  42643. _this.global_emitter.emit(event.event, event.data);
  42644. }
  42645. });
  42646. this.connection.bind('connecting', function () {
  42647. _this.channels.disconnect();
  42648. });
  42649. this.connection.bind('disconnected', function () {
  42650. _this.channels.disconnect();
  42651. });
  42652. this.connection.bind('error', function (err) {
  42653. logger.warn(err);
  42654. });
  42655. Pusher.instances.push(this);
  42656. this.timeline.info({ instances: Pusher.instances.length });
  42657. if (Pusher.isReady) {
  42658. this.connect();
  42659. }
  42660. }
  42661. Pusher.ready = function () {
  42662. Pusher.isReady = true;
  42663. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  42664. Pusher.instances[i].connect();
  42665. }
  42666. };
  42667. Pusher.getClientFeatures = function () {
  42668. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  42669. return t.isSupported({});
  42670. }));
  42671. };
  42672. Pusher.prototype.channel = function (name) {
  42673. return this.channels.find(name);
  42674. };
  42675. Pusher.prototype.allChannels = function () {
  42676. return this.channels.all();
  42677. };
  42678. Pusher.prototype.connect = function () {
  42679. this.connection.connect();
  42680. if (this.timelineSender) {
  42681. if (!this.timelineSenderTimer) {
  42682. var usingTLS = this.connection.isUsingTLS();
  42683. var timelineSender = this.timelineSender;
  42684. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  42685. timelineSender.send(usingTLS);
  42686. });
  42687. }
  42688. }
  42689. };
  42690. Pusher.prototype.disconnect = function () {
  42691. this.connection.disconnect();
  42692. if (this.timelineSenderTimer) {
  42693. this.timelineSenderTimer.ensureAborted();
  42694. this.timelineSenderTimer = null;
  42695. }
  42696. };
  42697. Pusher.prototype.bind = function (event_name, callback, context) {
  42698. this.global_emitter.bind(event_name, callback, context);
  42699. return this;
  42700. };
  42701. Pusher.prototype.unbind = function (event_name, callback, context) {
  42702. this.global_emitter.unbind(event_name, callback, context);
  42703. return this;
  42704. };
  42705. Pusher.prototype.bind_global = function (callback) {
  42706. this.global_emitter.bind_global(callback);
  42707. return this;
  42708. };
  42709. Pusher.prototype.unbind_global = function (callback) {
  42710. this.global_emitter.unbind_global(callback);
  42711. return this;
  42712. };
  42713. Pusher.prototype.unbind_all = function (callback) {
  42714. this.global_emitter.unbind_all();
  42715. return this;
  42716. };
  42717. Pusher.prototype.subscribeAll = function () {
  42718. var channelName;
  42719. for (channelName in this.channels.channels) {
  42720. if (this.channels.channels.hasOwnProperty(channelName)) {
  42721. this.subscribe(channelName);
  42722. }
  42723. }
  42724. };
  42725. Pusher.prototype.subscribe = function (channel_name) {
  42726. var channel = this.channels.add(channel_name, this);
  42727. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  42728. channel.reinstateSubscription();
  42729. }
  42730. else if (!channel.subscriptionPending &&
  42731. this.connection.state === 'connected') {
  42732. channel.subscribe();
  42733. }
  42734. return channel;
  42735. };
  42736. Pusher.prototype.unsubscribe = function (channel_name) {
  42737. var channel = this.channels.find(channel_name);
  42738. if (channel && channel.subscriptionPending) {
  42739. channel.cancelSubscription();
  42740. }
  42741. else {
  42742. channel = this.channels.remove(channel_name);
  42743. if (channel && this.connection.state === 'connected') {
  42744. channel.unsubscribe();
  42745. }
  42746. }
  42747. };
  42748. Pusher.prototype.send_event = function (event_name, data, channel) {
  42749. return this.connection.send_event(event_name, data, channel);
  42750. };
  42751. Pusher.prototype.shouldUseTLS = function () {
  42752. if (runtime.getProtocol() === 'https:') {
  42753. return true;
  42754. }
  42755. else if (this.config.forceTLS === true) {
  42756. return true;
  42757. }
  42758. else {
  42759. return Boolean(this.config.encrypted);
  42760. }
  42761. };
  42762. Pusher.instances = [];
  42763. Pusher.isReady = false;
  42764. Pusher.logToConsole = false;
  42765. Pusher.Runtime = runtime;
  42766. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  42767. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  42768. Pusher.auth_callbacks = runtime.auth_callbacks;
  42769. return Pusher;
  42770. }());
  42771. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  42772. function checkAppKey(key) {
  42773. if (key === null || key === undefined) {
  42774. throw 'You must pass your app key when you instantiate Pusher.';
  42775. }
  42776. }
  42777. runtime.setup(pusher_Pusher);
  42778. /***/ })
  42779. /******/ ]);
  42780. });
  42781. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  42782. /***/ }),
  42783. /***/ "./node_modules/setimmediate/setImmediate.js":
  42784. /*!***************************************************!*\
  42785. !*** ./node_modules/setimmediate/setImmediate.js ***!
  42786. \***************************************************/
  42787. /*! no static exports found */
  42788. /***/ (function(module, exports, __webpack_require__) {
  42789. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  42790. "use strict";
  42791. if (global.setImmediate) {
  42792. return;
  42793. }
  42794. var nextHandle = 1; // Spec says greater than zero
  42795. var tasksByHandle = {};
  42796. var currentlyRunningATask = false;
  42797. var doc = global.document;
  42798. var registerImmediate;
  42799. function setImmediate(callback) {
  42800. // Callback can either be a function or a string
  42801. if (typeof callback !== "function") {
  42802. callback = new Function("" + callback);
  42803. }
  42804. // Copy function arguments
  42805. var args = new Array(arguments.length - 1);
  42806. for (var i = 0; i < args.length; i++) {
  42807. args[i] = arguments[i + 1];
  42808. }
  42809. // Store and register the task
  42810. var task = { callback: callback, args: args };
  42811. tasksByHandle[nextHandle] = task;
  42812. registerImmediate(nextHandle);
  42813. return nextHandle++;
  42814. }
  42815. function clearImmediate(handle) {
  42816. delete tasksByHandle[handle];
  42817. }
  42818. function run(task) {
  42819. var callback = task.callback;
  42820. var args = task.args;
  42821. switch (args.length) {
  42822. case 0:
  42823. callback();
  42824. break;
  42825. case 1:
  42826. callback(args[0]);
  42827. break;
  42828. case 2:
  42829. callback(args[0], args[1]);
  42830. break;
  42831. case 3:
  42832. callback(args[0], args[1], args[2]);
  42833. break;
  42834. default:
  42835. callback.apply(undefined, args);
  42836. break;
  42837. }
  42838. }
  42839. function runIfPresent(handle) {
  42840. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  42841. // So if we're currently running a task, we'll need to delay this invocation.
  42842. if (currentlyRunningATask) {
  42843. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  42844. // "too much recursion" error.
  42845. setTimeout(runIfPresent, 0, handle);
  42846. } else {
  42847. var task = tasksByHandle[handle];
  42848. if (task) {
  42849. currentlyRunningATask = true;
  42850. try {
  42851. run(task);
  42852. } finally {
  42853. clearImmediate(handle);
  42854. currentlyRunningATask = false;
  42855. }
  42856. }
  42857. }
  42858. }
  42859. function installNextTickImplementation() {
  42860. registerImmediate = function(handle) {
  42861. process.nextTick(function () { runIfPresent(handle); });
  42862. };
  42863. }
  42864. function canUsePostMessage() {
  42865. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  42866. // where `global.postMessage` means something completely different and can't be used for this purpose.
  42867. if (global.postMessage && !global.importScripts) {
  42868. var postMessageIsAsynchronous = true;
  42869. var oldOnMessage = global.onmessage;
  42870. global.onmessage = function() {
  42871. postMessageIsAsynchronous = false;
  42872. };
  42873. global.postMessage("", "*");
  42874. global.onmessage = oldOnMessage;
  42875. return postMessageIsAsynchronous;
  42876. }
  42877. }
  42878. function installPostMessageImplementation() {
  42879. // Installs an event handler on `global` for the `message` event: see
  42880. // * https://developer.mozilla.org/en/DOM/window.postMessage
  42881. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  42882. var messagePrefix = "setImmediate$" + Math.random() + "$";
  42883. var onGlobalMessage = function(event) {
  42884. if (event.source === global &&
  42885. typeof event.data === "string" &&
  42886. event.data.indexOf(messagePrefix) === 0) {
  42887. runIfPresent(+event.data.slice(messagePrefix.length));
  42888. }
  42889. };
  42890. if (global.addEventListener) {
  42891. global.addEventListener("message", onGlobalMessage, false);
  42892. } else {
  42893. global.attachEvent("onmessage", onGlobalMessage);
  42894. }
  42895. registerImmediate = function(handle) {
  42896. global.postMessage(messagePrefix + handle, "*");
  42897. };
  42898. }
  42899. function installMessageChannelImplementation() {
  42900. var channel = new MessageChannel();
  42901. channel.port1.onmessage = function(event) {
  42902. var handle = event.data;
  42903. runIfPresent(handle);
  42904. };
  42905. registerImmediate = function(handle) {
  42906. channel.port2.postMessage(handle);
  42907. };
  42908. }
  42909. function installReadyStateChangeImplementation() {
  42910. var html = doc.documentElement;
  42911. registerImmediate = function(handle) {
  42912. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  42913. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  42914. var script = doc.createElement("script");
  42915. script.onreadystatechange = function () {
  42916. runIfPresent(handle);
  42917. script.onreadystatechange = null;
  42918. html.removeChild(script);
  42919. script = null;
  42920. };
  42921. html.appendChild(script);
  42922. };
  42923. }
  42924. function installSetTimeoutImplementation() {
  42925. registerImmediate = function(handle) {
  42926. setTimeout(runIfPresent, 0, handle);
  42927. };
  42928. }
  42929. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  42930. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  42931. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  42932. // Don't get fooled by e.g. browserify environments.
  42933. if ({}.toString.call(global.process) === "[object process]") {
  42934. // For Node.js before 0.9
  42935. installNextTickImplementation();
  42936. } else if (canUsePostMessage()) {
  42937. // For non-IE10 modern browsers
  42938. installPostMessageImplementation();
  42939. } else if (global.MessageChannel) {
  42940. // For web workers, where supported
  42941. installMessageChannelImplementation();
  42942. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  42943. // For IE 6–8
  42944. installReadyStateChangeImplementation();
  42945. } else {
  42946. // For older browsers
  42947. installSetTimeoutImplementation();
  42948. }
  42949. attachTo.setImmediate = setImmediate;
  42950. attachTo.clearImmediate = clearImmediate;
  42951. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  42952. /* 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")))
  42953. /***/ }),
  42954. /***/ "./node_modules/timers-browserify/main.js":
  42955. /*!************************************************!*\
  42956. !*** ./node_modules/timers-browserify/main.js ***!
  42957. \************************************************/
  42958. /*! no static exports found */
  42959. /***/ (function(module, exports, __webpack_require__) {
  42960. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  42961. (typeof self !== "undefined" && self) ||
  42962. window;
  42963. var apply = Function.prototype.apply;
  42964. // DOM APIs, for completeness
  42965. exports.setTimeout = function() {
  42966. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  42967. };
  42968. exports.setInterval = function() {
  42969. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  42970. };
  42971. exports.clearTimeout =
  42972. exports.clearInterval = function(timeout) {
  42973. if (timeout) {
  42974. timeout.close();
  42975. }
  42976. };
  42977. function Timeout(id, clearFn) {
  42978. this._id = id;
  42979. this._clearFn = clearFn;
  42980. }
  42981. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  42982. Timeout.prototype.close = function() {
  42983. this._clearFn.call(scope, this._id);
  42984. };
  42985. // Does not start the time, just sets up the members needed.
  42986. exports.enroll = function(item, msecs) {
  42987. clearTimeout(item._idleTimeoutId);
  42988. item._idleTimeout = msecs;
  42989. };
  42990. exports.unenroll = function(item) {
  42991. clearTimeout(item._idleTimeoutId);
  42992. item._idleTimeout = -1;
  42993. };
  42994. exports._unrefActive = exports.active = function(item) {
  42995. clearTimeout(item._idleTimeoutId);
  42996. var msecs = item._idleTimeout;
  42997. if (msecs >= 0) {
  42998. item._idleTimeoutId = setTimeout(function onTimeout() {
  42999. if (item._onTimeout)
  43000. item._onTimeout();
  43001. }, msecs);
  43002. }
  43003. };
  43004. // setimmediate attaches itself to the global object
  43005. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  43006. // On some exotic environments, it's not clear which object `setimmediate` was
  43007. // able to install onto. Search each possibility in the same order as the
  43008. // `setimmediate` library.
  43009. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  43010. (typeof global !== "undefined" && global.setImmediate) ||
  43011. (this && this.setImmediate);
  43012. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  43013. (typeof global !== "undefined" && global.clearImmediate) ||
  43014. (this && this.clearImmediate);
  43015. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  43016. /***/ }),
  43017. /***/ "./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&":
  43018. /*!*******************************************************************************************************************************************************************************************************************!*\
  43019. !*** ./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& ***!
  43020. \*******************************************************************************************************************************************************************************************************************/
  43021. /*! exports provided: render, staticRenderFns */
  43022. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43023. "use strict";
  43024. __webpack_require__.r(__webpack_exports__);
  43025. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43026. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43027. var render = function() {
  43028. var _vm = this
  43029. var _h = _vm.$createElement
  43030. var _c = _vm._self._c || _h
  43031. return _vm._m(0)
  43032. }
  43033. var staticRenderFns = [
  43034. function() {
  43035. var _vm = this
  43036. var _h = _vm.$createElement
  43037. var _c = _vm._self._c || _h
  43038. return _c("div", { staticClass: "container" }, [
  43039. _c("div", { staticClass: "row justify-content-center" }, [
  43040. _c("div", { staticClass: "col-md-8" }, [
  43041. _c("div", { staticClass: "card" }, [
  43042. _c("div", { staticClass: "card-header" }, [
  43043. _vm._v("Example Component")
  43044. ]),
  43045. _vm._v(" "),
  43046. _c("div", { staticClass: "card-body" }, [
  43047. _vm._v(
  43048. "\n I'm an example component.\n "
  43049. )
  43050. ])
  43051. ])
  43052. ])
  43053. ])
  43054. ])
  43055. }
  43056. ]
  43057. render._withStripped = true
  43058. /***/ }),
  43059. /***/ "./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&":
  43060. /*!************************************************************************************************************************************************************************************************************!*\
  43061. !*** ./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& ***!
  43062. \************************************************************************************************************************************************************************************************************/
  43063. /*! exports provided: render, staticRenderFns */
  43064. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43065. "use strict";
  43066. __webpack_require__.r(__webpack_exports__);
  43067. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43068. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43069. var render = function() {
  43070. var _vm = this
  43071. var _h = _vm.$createElement
  43072. var _c = _vm._self._c || _h
  43073. return _c(
  43074. "div",
  43075. [
  43076. _c(
  43077. "modal",
  43078. {
  43079. attrs: {
  43080. id: "asseteditModal",
  43081. tabindex: "-1",
  43082. role: "dialog",
  43083. "aria-labelledby": "asseteditModalLabel"
  43084. }
  43085. },
  43086. [
  43087. _c(
  43088. "h5",
  43089. {
  43090. staticClass: "modal-title",
  43091. attrs: { slot: "header", id: "asseteditModalLabel" },
  43092. slot: "header"
  43093. },
  43094. [_vm._v("\n Edit Work Order Information\n ")]
  43095. ),
  43096. _vm._v(" "),
  43097. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43098. _c("div", { staticClass: "form-group" }, [
  43099. _c("label", { attrs: { for: "manufacturer" } }, [
  43100. _vm._v("Manufacturer")
  43101. ]),
  43102. _vm._v(" "),
  43103. _c("input", {
  43104. directives: [
  43105. {
  43106. name: "model",
  43107. rawName: "v-model.lazy",
  43108. value: _vm.data.pcmanu,
  43109. expression: "data.pcmanu",
  43110. modifiers: { lazy: true }
  43111. }
  43112. ],
  43113. staticClass: "form-control",
  43114. attrs: {
  43115. type: "text",
  43116. name: "manufacturer",
  43117. id: "manufacturer"
  43118. },
  43119. domProps: { value: _vm.data.pcmanu },
  43120. on: {
  43121. change: function($event) {
  43122. return _vm.$set(_vm.data, "pcmanu", $event.target.value)
  43123. }
  43124. }
  43125. })
  43126. ]),
  43127. _vm._v(" "),
  43128. _c("div", { staticClass: "form-group" }, [
  43129. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  43130. _vm._v(" "),
  43131. _c("input", {
  43132. directives: [
  43133. {
  43134. name: "model",
  43135. rawName: "v-model.lazy",
  43136. value: _vm.data.pcmake,
  43137. expression: "data.pcmake",
  43138. modifiers: { lazy: true }
  43139. }
  43140. ],
  43141. staticClass: "form-control",
  43142. attrs: { type: "text", name: "make", id: "make" },
  43143. domProps: { value: _vm.data.pcmake },
  43144. on: {
  43145. change: function($event) {
  43146. return _vm.$set(_vm.data, "pcmake", $event.target.value)
  43147. }
  43148. }
  43149. })
  43150. ]),
  43151. _vm._v(" "),
  43152. _c("div", { staticClass: "form-group" }, [
  43153. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  43154. _vm._v(" "),
  43155. _c("input", {
  43156. directives: [
  43157. {
  43158. name: "model",
  43159. rawName: "v-model.lazy",
  43160. value: _vm.data.pcnickname,
  43161. expression: "data.pcnickname",
  43162. modifiers: { lazy: true }
  43163. }
  43164. ],
  43165. staticClass: "form-control",
  43166. attrs: { type: "text", name: "nickname", id: "nickname" },
  43167. domProps: { value: _vm.data.pcnickname },
  43168. on: {
  43169. change: function($event) {
  43170. return _vm.$set(_vm.data, "pcnickname", $event.target.value)
  43171. }
  43172. }
  43173. })
  43174. ]),
  43175. _vm._v(" "),
  43176. _c("div", { staticClass: "form-group" }, [
  43177. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  43178. _vm._v(" "),
  43179. _c("input", {
  43180. directives: [
  43181. {
  43182. name: "model",
  43183. rawName: "v-model.lazy",
  43184. value: _vm.pcextra[2],
  43185. expression: "pcextra[2]",
  43186. modifiers: { lazy: true }
  43187. }
  43188. ],
  43189. staticClass: "form-control",
  43190. attrs: { type: "text", name: "os", id: "os" },
  43191. domProps: { value: _vm.pcextra[2] },
  43192. on: {
  43193. change: function($event) {
  43194. return _vm.$set(_vm.pcextra, 2, $event.target.value)
  43195. }
  43196. }
  43197. })
  43198. ]),
  43199. _vm._v(" "),
  43200. _c("div", { staticClass: "form-group" }, [
  43201. _c("label", { attrs: { for: "serial" } }, [
  43202. _vm._v("Serial Number")
  43203. ]),
  43204. _vm._v(" "),
  43205. _c("input", {
  43206. directives: [
  43207. {
  43208. name: "model",
  43209. rawName: "v-model.lazy",
  43210. value: _vm.pcextra[104],
  43211. expression: "pcextra[104]",
  43212. modifiers: { lazy: true }
  43213. }
  43214. ],
  43215. staticClass: "form-control",
  43216. attrs: { type: "text", id: "serial", name: "serial" },
  43217. domProps: { value: _vm.pcextra[104] },
  43218. on: {
  43219. change: function($event) {
  43220. return _vm.$set(_vm.pcextra, 104, $event.target.value)
  43221. }
  43222. }
  43223. })
  43224. ]),
  43225. _vm._v(" "),
  43226. _c("div", { staticClass: "form-group" }, [
  43227. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  43228. _vm._v(" "),
  43229. _c("input", {
  43230. directives: [
  43231. {
  43232. name: "model",
  43233. rawName: "v-model.lazy",
  43234. value: _vm.pcextra[101],
  43235. expression: "pcextra[101]",
  43236. modifiers: { lazy: true }
  43237. }
  43238. ],
  43239. staticClass: "form-control",
  43240. attrs: { type: "text", id: "cpu", name: "cpu" },
  43241. domProps: { value: _vm.pcextra[101] },
  43242. on: {
  43243. change: function($event) {
  43244. return _vm.$set(_vm.pcextra, 101, $event.target.value)
  43245. }
  43246. }
  43247. })
  43248. ]),
  43249. _vm._v(" "),
  43250. _c("div", { staticClass: "form-group" }, [
  43251. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  43252. _vm._v(" "),
  43253. _c("input", {
  43254. directives: [
  43255. {
  43256. name: "model",
  43257. rawName: "v-model.lazy",
  43258. value: _vm.pcextra[100],
  43259. expression: "pcextra[100]",
  43260. modifiers: { lazy: true }
  43261. }
  43262. ],
  43263. staticClass: "form-control",
  43264. attrs: { type: "text", name: "ram", id: "ram" },
  43265. domProps: { value: _vm.pcextra[100] },
  43266. on: {
  43267. change: function($event) {
  43268. return _vm.$set(_vm.pcextra, 100, $event.target.value)
  43269. }
  43270. }
  43271. })
  43272. ]),
  43273. _vm._v(" "),
  43274. _c("div", { staticClass: "form-group" }, [
  43275. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  43276. _vm._v(" "),
  43277. _c("input", {
  43278. directives: [
  43279. {
  43280. name: "model",
  43281. rawName: "v-model.lazy",
  43282. value: _vm.pcextra[4],
  43283. expression: "pcextra[4]",
  43284. modifiers: { lazy: true }
  43285. }
  43286. ],
  43287. staticClass: "form-control",
  43288. attrs: { type: "text", name: "graphics", id: "grapics" },
  43289. domProps: { value: _vm.pcextra[4] },
  43290. on: {
  43291. change: function($event) {
  43292. return _vm.$set(_vm.pcextra, 4, $event.target.value)
  43293. }
  43294. }
  43295. })
  43296. ])
  43297. ]),
  43298. _vm._v(" "),
  43299. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43300. _c(
  43301. "button",
  43302. {
  43303. staticClass: "btn btn-secondary",
  43304. attrs: { type: "button", "data-dismiss": "modal" }
  43305. },
  43306. [_vm._v("Close")]
  43307. ),
  43308. _vm._v(" "),
  43309. _c(
  43310. "button",
  43311. {
  43312. staticClass: "btn btn-primary",
  43313. attrs: { type: "button" },
  43314. on: {
  43315. click: function($event) {
  43316. return _vm.updateAsset()
  43317. }
  43318. }
  43319. },
  43320. [_vm._v("Save")]
  43321. )
  43322. ])
  43323. ]
  43324. ),
  43325. _vm._v(" "),
  43326. _c("h4", { staticClass: "text-center" }, [
  43327. _vm._v(
  43328. _vm._s(this.data.pcmanu) + " " + _vm._s(this.data.pcmake) + " - "
  43329. ),
  43330. _c("small", { staticClass: "text-muted" }, [
  43331. _vm._v(_vm._s(this.data.pcnickname))
  43332. ])
  43333. ]),
  43334. _vm._v(" "),
  43335. _c("p", [_vm._v("OS: " + _vm._s(this.pcextra[2]))]),
  43336. _vm._v(" "),
  43337. _c("p", [_vm._v("S/N: " + _vm._s(this.pcextra[104]))]),
  43338. _vm._v(" "),
  43339. _c("p", [_vm._v("CPU: " + _vm._s(this.pcextra[101]))]),
  43340. _vm._v(" "),
  43341. _c("p", [_vm._v("RAM: " + _vm._s(this.pcextra[100]))]),
  43342. _vm._v(" "),
  43343. _c("p", [_vm._v("Graphics: " + _vm._s(this.pcextra[4]))]),
  43344. _vm._v(" "),
  43345. _c(
  43346. "button",
  43347. {
  43348. staticClass: "btn btn-primary",
  43349. attrs: {
  43350. type: "button",
  43351. "data-toggle": "modal",
  43352. "data-target": "#asseteditModal"
  43353. }
  43354. },
  43355. [_vm._v("Edit")]
  43356. )
  43357. ],
  43358. 1
  43359. )
  43360. }
  43361. var staticRenderFns = []
  43362. render._withStripped = true
  43363. /***/ }),
  43364. /***/ "./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&":
  43365. /*!*******************************************************************************************************************************************************************************************************************************!*\
  43366. !*** ./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& ***!
  43367. \*******************************************************************************************************************************************************************************************************************************/
  43368. /*! exports provided: render, staticRenderFns */
  43369. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43370. "use strict";
  43371. __webpack_require__.r(__webpack_exports__);
  43372. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43373. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43374. var render = function() {
  43375. var _vm = this
  43376. var _h = _vm.$createElement
  43377. var _c = _vm._self._c || _h
  43378. return _c("div", { staticClass: "dropdown", class: { open: _vm.open } }, [
  43379. _c("div", { staticClass: "input-group" }, [
  43380. _c("input", {
  43381. directives: [
  43382. {
  43383. name: "model",
  43384. rawName: "v-model",
  43385. value: _vm.searchText,
  43386. expression: "searchText"
  43387. }
  43388. ],
  43389. staticClass: "form-control",
  43390. attrs: { type: "text" },
  43391. domProps: { value: _vm.searchText },
  43392. on: {
  43393. input: [
  43394. function($event) {
  43395. if ($event.target.composing) {
  43396. return
  43397. }
  43398. _vm.searchText = $event.target.value
  43399. },
  43400. _vm.searchChanged
  43401. ]
  43402. }
  43403. }),
  43404. _vm._v(" "),
  43405. _c("div", { staticClass: "form-group-append" }, [
  43406. _c(
  43407. "a",
  43408. {
  43409. staticClass: "toggle input-group-text bg-primary text-light",
  43410. on: {
  43411. mousedown: function($event) {
  43412. $event.preventDefault()
  43413. },
  43414. click: function($event) {
  43415. return _vm.setOpen(!_vm.open)
  43416. }
  43417. }
  43418. },
  43419. [
  43420. _c("span", { staticClass: "arrow-up" }, [_vm._v("▲")]),
  43421. _vm._v(" "),
  43422. _c("span", { staticClass: "arrow-down" }, [_vm._v("▼")])
  43423. ]
  43424. )
  43425. ])
  43426. ]),
  43427. _vm._v(" "),
  43428. _c(
  43429. "ul",
  43430. { staticClass: "suggestion-list list-unstyled" },
  43431. _vm._l(_vm.matches, function(suggestion, index) {
  43432. return _c(
  43433. "li",
  43434. {
  43435. key: index,
  43436. on: {
  43437. mousedown: function($event) {
  43438. $event.preventDefault()
  43439. },
  43440. click: function($event) {
  43441. return _vm.suggestionSelected(suggestion)
  43442. }
  43443. }
  43444. },
  43445. [_vm._v("\n " + _vm._s(suggestion[1]) + "\n ")]
  43446. )
  43447. }),
  43448. 0
  43449. )
  43450. ])
  43451. }
  43452. var staticRenderFns = []
  43453. render._withStripped = true
  43454. /***/ }),
  43455. /***/ "./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&":
  43456. /*!************************************************************************************************************************************************************************************************************************!*\
  43457. !*** ./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& ***!
  43458. \************************************************************************************************************************************************************************************************************************/
  43459. /*! exports provided: render, staticRenderFns */
  43460. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43461. "use strict";
  43462. __webpack_require__.r(__webpack_exports__);
  43463. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43464. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43465. var render = function() {
  43466. var _vm = this
  43467. var _h = _vm.$createElement
  43468. var _c = _vm._self._c || _h
  43469. return _c(
  43470. "modal",
  43471. {
  43472. attrs: {
  43473. id: _vm.id,
  43474. tabindex: "-1",
  43475. role: "dialog",
  43476. "aria-labelledby": _vm.id + "Label"
  43477. }
  43478. },
  43479. [
  43480. _c(
  43481. "h5",
  43482. {
  43483. staticClass: "modal-title",
  43484. attrs: { slot: "header", id: _vm.id + "Label" },
  43485. slot: "header"
  43486. },
  43487. [_vm._v("\n Edit Credential\n ")]
  43488. ),
  43489. _vm._v(" "),
  43490. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43491. _c(
  43492. "div",
  43493. { staticClass: "form" },
  43494. [
  43495. _c("autocomplete-custom-dropdown", {
  43496. attrs: {
  43497. options: _vm.descriptions,
  43498. value: _vm.creddesc,
  43499. "allow-custom": true
  43500. },
  43501. model: {
  43502. value: _vm.creddesc,
  43503. callback: function($$v) {
  43504. _vm.creddesc = $$v
  43505. },
  43506. expression: "creddesc"
  43507. }
  43508. })
  43509. ],
  43510. 1
  43511. ),
  43512. _vm._v(" "),
  43513. _c("div", { staticClass: "form-group" }, [
  43514. _c("label", { attrs: { for: "newusername" } }, [_vm._v("Username")]),
  43515. _vm._v(" "),
  43516. _c("input", {
  43517. directives: [
  43518. {
  43519. name: "model",
  43520. rawName: "v-model",
  43521. value: _vm.data.creduser,
  43522. expression: "data.creduser"
  43523. }
  43524. ],
  43525. staticClass: "form-control credential",
  43526. attrs: {
  43527. type: "text",
  43528. name: "newusername" + _vm.data.credid,
  43529. id: "newusername" + _vm.data.credid
  43530. },
  43531. domProps: { value: _vm.data.creduser },
  43532. on: {
  43533. input: function($event) {
  43534. if ($event.target.composing) {
  43535. return
  43536. }
  43537. _vm.$set(_vm.data, "creduser", $event.target.value)
  43538. }
  43539. }
  43540. })
  43541. ]),
  43542. _vm._v(" "),
  43543. _c("div", { staticClass: "form-group" }, [
  43544. _c("label", { attrs: { for: "newpassword" } }, [_vm._v("Password")]),
  43545. _vm._v(" "),
  43546. _c("input", {
  43547. directives: [
  43548. {
  43549. name: "model",
  43550. rawName: "v-model",
  43551. value: _vm.data.credpass,
  43552. expression: "data.credpass"
  43553. }
  43554. ],
  43555. staticClass: "form-control credential",
  43556. attrs: {
  43557. type: "text",
  43558. name: "newpassword" + _vm.data.credid,
  43559. id: "newpassword" + _vm.data.credid
  43560. },
  43561. domProps: { value: _vm.data.credpass },
  43562. on: {
  43563. input: function($event) {
  43564. if ($event.target.composing) {
  43565. return
  43566. }
  43567. _vm.$set(_vm.data, "credpass", $event.target.value)
  43568. }
  43569. }
  43570. }),
  43571. _vm._v(" "),
  43572. _c(
  43573. "button",
  43574. {
  43575. staticClass: "btn btn-secondary",
  43576. attrs: { type: "button" },
  43577. on: {
  43578. click: function($event) {
  43579. return _vm.getRandomPassword(_vm.data.credid)
  43580. }
  43581. }
  43582. },
  43583. [_vm._v("Generate Random")]
  43584. )
  43585. ]),
  43586. _vm._v(" "),
  43587. _c("div", { staticClass: "form-group" })
  43588. ]),
  43589. _vm._v(" "),
  43590. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43591. _c(
  43592. "button",
  43593. {
  43594. staticClass: "btn btn-secondary",
  43595. attrs: { type: "button", "data-dismiss": "modal" }
  43596. },
  43597. [_vm._v("Close")]
  43598. ),
  43599. _vm._v(" "),
  43600. _c(
  43601. "button",
  43602. {
  43603. staticClass: "btn btn-primary",
  43604. attrs: { type: "button" },
  43605. on: {
  43606. click: function($event) {
  43607. return _vm.updateCredential()
  43608. }
  43609. }
  43610. },
  43611. [_vm._v("Save")]
  43612. )
  43613. ])
  43614. ]
  43615. )
  43616. }
  43617. var staticRenderFns = []
  43618. render._withStripped = true
  43619. /***/ }),
  43620. /***/ "./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&":
  43621. /*!******************************************************************************************************************************************************************************************************************!*\
  43622. !*** ./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& ***!
  43623. \******************************************************************************************************************************************************************************************************************/
  43624. /*! exports provided: render, staticRenderFns */
  43625. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43626. "use strict";
  43627. __webpack_require__.r(__webpack_exports__);
  43628. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43629. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43630. var render = function() {
  43631. var _vm = this
  43632. var _h = _vm.$createElement
  43633. var _c = _vm._self._c || _h
  43634. return _c(
  43635. "div",
  43636. [
  43637. _c("credential-form-modal", {
  43638. attrs: {
  43639. "modal-id": "newCredentialModal",
  43640. descriptions: _vm.creddescList,
  43641. create: true,
  43642. pcid: _vm.pcid
  43643. }
  43644. }),
  43645. _vm._v(" "),
  43646. _c(
  43647. "button",
  43648. {
  43649. staticClass: "btn btn-primary",
  43650. attrs: {
  43651. type: "button",
  43652. "data-toggle": "modal",
  43653. "data-target": "#newCredentialModal"
  43654. }
  43655. },
  43656. [_vm._v("New Credential")]
  43657. ),
  43658. _vm._v(" "),
  43659. _vm._l(_vm.credentials, function(credential) {
  43660. return _c(
  43661. "div",
  43662. { key: credential.credid },
  43663. [
  43664. _c("credential", {
  43665. attrs: { credential: credential, descriptions: _vm.creddescList }
  43666. })
  43667. ],
  43668. 1
  43669. )
  43670. })
  43671. ],
  43672. 2
  43673. )
  43674. }
  43675. var staticRenderFns = []
  43676. render._withStripped = true
  43677. /***/ }),
  43678. /***/ "./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&":
  43679. /*!*************************************************************************************************************************************************************************************************************!*\
  43680. !*** ./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& ***!
  43681. \*************************************************************************************************************************************************************************************************************/
  43682. /*! exports provided: render, staticRenderFns */
  43683. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43684. "use strict";
  43685. __webpack_require__.r(__webpack_exports__);
  43686. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43687. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43688. var render = function() {
  43689. var _vm = this
  43690. var _h = _vm.$createElement
  43691. var _c = _vm._self._c || _h
  43692. return _c(
  43693. "div",
  43694. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  43695. [
  43696. _c("credential-form-modal", {
  43697. attrs: {
  43698. descriptions: _vm.creddescList,
  43699. "modal-id": "credential" + this.data.credid + "editModal",
  43700. populateWith: this.data
  43701. }
  43702. }),
  43703. _vm._v(" "),
  43704. _c(
  43705. "modal",
  43706. {
  43707. attrs: {
  43708. id: "credential" + this.data.credid + "deleteModal",
  43709. tabindex: "-1"
  43710. }
  43711. },
  43712. [
  43713. _c(
  43714. "h5",
  43715. {
  43716. staticClass: "modal-title",
  43717. attrs: {
  43718. slot: "header",
  43719. id: "credential" + this.data.credid + "deleteModalLabel"
  43720. },
  43721. slot: "header"
  43722. },
  43723. [_vm._v("\r\n Delete Credential\r\n ")]
  43724. ),
  43725. _vm._v(" "),
  43726. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43727. _vm._v("\r\n Are you sure?\r\n ")
  43728. ]),
  43729. _vm._v(" "),
  43730. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43731. _c(
  43732. "button",
  43733. {
  43734. staticClass: "btn btn-secondary",
  43735. attrs: { type: "button", "data-dismiss": "modal" }
  43736. },
  43737. [_vm._v("Cancel")]
  43738. ),
  43739. _vm._v(" "),
  43740. _c(
  43741. "button",
  43742. {
  43743. staticClass: "btn btn-danger",
  43744. attrs: { type: "button" },
  43745. on: {
  43746. click: function($event) {
  43747. return _vm.deleteCredential()
  43748. }
  43749. }
  43750. },
  43751. [_vm._v("Confirm")]
  43752. )
  43753. ])
  43754. ]
  43755. ),
  43756. _vm._v(" "),
  43757. _c("div", { staticClass: "row no-gutters" }, [
  43758. _c("div", { staticClass: "h5 col-3 text-left" }, [
  43759. _vm._v(_vm._s(this.data.creddesc))
  43760. ]),
  43761. _vm._v(" "),
  43762. _c("div", { staticClass: "col-9 text-right" }, [
  43763. _vm._v(_vm._s(this.data.creddate))
  43764. ])
  43765. ]),
  43766. _vm._v(" "),
  43767. _c("div", { staticClass: "row" }, [
  43768. _c("div", { staticClass: "col-lg-9" }, [
  43769. _c("div", [
  43770. _vm._m(0),
  43771. _vm._v(" "),
  43772. _c("input", {
  43773. staticClass: "border-0 credential",
  43774. attrs: {
  43775. type: "text",
  43776. id: "username" + this.data.credid,
  43777. readonly: ""
  43778. },
  43779. domProps: { value: this.data.creduser }
  43780. }),
  43781. _vm._v(" "),
  43782. _c(
  43783. "button",
  43784. {
  43785. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43786. attrs: {
  43787. id: "btn-username" + this.data.credid,
  43788. "data-clipboard-target": "#username" + this.data.credid
  43789. }
  43790. },
  43791. [_c("i", { staticClass: "far fa-clone" })]
  43792. )
  43793. ]),
  43794. _vm._v(" "),
  43795. _c("div", [
  43796. _vm._m(1),
  43797. _vm._v(" "),
  43798. _c("input", {
  43799. staticClass: "border-0 credential",
  43800. attrs: {
  43801. type: "text",
  43802. id: "password" + this.data.credid,
  43803. readonly: ""
  43804. },
  43805. domProps: { value: this.data.credpass }
  43806. }),
  43807. _vm._v(" "),
  43808. _c(
  43809. "button",
  43810. {
  43811. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43812. attrs: {
  43813. id: "btn-password" + this.data.credid,
  43814. "data-clipboard-target": "#password" + this.data.credid
  43815. }
  43816. },
  43817. [_c("i", { staticClass: "far fa-clone" })]
  43818. )
  43819. ])
  43820. ]),
  43821. _vm._v(" "),
  43822. _c(
  43823. "div",
  43824. {
  43825. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  43826. attrs: { role: "group", "aria-label": "Edit and Delete" }
  43827. },
  43828. [
  43829. _c(
  43830. "button",
  43831. {
  43832. staticClass: "btn btn-sm btn-secondary p-lg-1",
  43833. attrs: {
  43834. type: "button",
  43835. "data-toggle": "modal",
  43836. "data-target": "#credential" + this.data.credid + "editModal"
  43837. }
  43838. },
  43839. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  43840. ),
  43841. _vm._v(" "),
  43842. _c(
  43843. "button",
  43844. {
  43845. staticClass: "btn btn-sm btn-danger p-lg-1",
  43846. attrs: {
  43847. type: "button",
  43848. "data-toggle": "modal",
  43849. "data-target":
  43850. "#credential" + this.data.credid + "deleteModal"
  43851. }
  43852. },
  43853. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  43854. )
  43855. ]
  43856. )
  43857. ])
  43858. ],
  43859. 1
  43860. )
  43861. }
  43862. var staticRenderFns = [
  43863. function() {
  43864. var _vm = this
  43865. var _h = _vm.$createElement
  43866. var _c = _vm._self._c || _h
  43867. return _c("label", { attrs: { for: "username" } }, [
  43868. _c("i", { staticClass: "fas fa-fw fa-user" })
  43869. ])
  43870. },
  43871. function() {
  43872. var _vm = this
  43873. var _h = _vm.$createElement
  43874. var _c = _vm._self._c || _h
  43875. return _c("label", { attrs: { for: "password" } }, [
  43876. _c("i", { staticClass: "fas fa-fw fa-key" })
  43877. ])
  43878. }
  43879. ]
  43880. render._withStripped = true
  43881. /***/ }),
  43882. /***/ "./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&":
  43883. /*!************************************************************************************************************************************************************************************************************!*\
  43884. !*** ./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& ***!
  43885. \************************************************************************************************************************************************************************************************************/
  43886. /*! exports provided: render, staticRenderFns */
  43887. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43888. "use strict";
  43889. __webpack_require__.r(__webpack_exports__);
  43890. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43891. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43892. var render = function() {
  43893. var _vm = this
  43894. var _h = _vm.$createElement
  43895. var _c = _vm._self._c || _h
  43896. return _c(
  43897. "ul",
  43898. { staticClass: "list-unstyled" },
  43899. _vm._l(_vm.errorList, function(error) {
  43900. return _c("li", { key: error, staticClass: "text-danger" }, [
  43901. _vm._v(" " + _vm._s(error) + " ")
  43902. ])
  43903. }),
  43904. 0
  43905. )
  43906. }
  43907. var staticRenderFns = []
  43908. render._withStripped = true
  43909. /***/ }),
  43910. /***/ "./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&":
  43911. /*!********************************************************************************************************************************************************************************************************!*\
  43912. !*** ./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& ***!
  43913. \********************************************************************************************************************************************************************************************************/
  43914. /*! exports provided: render, staticRenderFns */
  43915. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43916. "use strict";
  43917. __webpack_require__.r(__webpack_exports__);
  43918. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43919. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43920. var render = function() {
  43921. var _vm = this
  43922. var _h = _vm.$createElement
  43923. var _c = _vm._self._c || _h
  43924. return _c("div", { staticClass: "modal fade" }, [
  43925. _c(
  43926. "div",
  43927. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  43928. [
  43929. _c("div", { staticClass: "modal-content" }, [
  43930. _c(
  43931. "div",
  43932. { staticClass: "modal-header" },
  43933. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  43934. 2
  43935. ),
  43936. _vm._v(" "),
  43937. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  43938. _vm._v(" "),
  43939. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  43940. ])
  43941. ]
  43942. )
  43943. ])
  43944. }
  43945. var staticRenderFns = [
  43946. function() {
  43947. var _vm = this
  43948. var _h = _vm.$createElement
  43949. var _c = _vm._self._c || _h
  43950. return _c(
  43951. "button",
  43952. {
  43953. staticClass: "close",
  43954. attrs: {
  43955. type: "button",
  43956. "data-dismiss": "modal",
  43957. "aria-label": "Close"
  43958. }
  43959. },
  43960. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  43961. )
  43962. }
  43963. ]
  43964. render._withStripped = true
  43965. /***/ }),
  43966. /***/ "./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&":
  43967. /*!********************************************************************************************************************************************************************************************************!*\
  43968. !*** ./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& ***!
  43969. \********************************************************************************************************************************************************************************************************/
  43970. /*! exports provided: render, staticRenderFns */
  43971. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43972. "use strict";
  43973. __webpack_require__.r(__webpack_exports__);
  43974. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43975. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43976. var render = function() {
  43977. var _vm = this
  43978. var _h = _vm.$createElement
  43979. var _c = _vm._self._c || _h
  43980. return _c(
  43981. "ul",
  43982. { staticClass: "list-unstyled" },
  43983. _vm._l(this.notes, function(note, index) {
  43984. return _c(
  43985. "li",
  43986. { key: note.noteid, staticClass: "row no-gutters mb-2" },
  43987. [
  43988. _c(
  43989. "modal",
  43990. {
  43991. attrs: {
  43992. id: "note" + note.noteid + "editModal",
  43993. tabindex: "-1",
  43994. role: "dialog",
  43995. "aria-labelledby": "note" + note.noteid + "editModalLabel"
  43996. }
  43997. },
  43998. [
  43999. _c(
  44000. "h5",
  44001. {
  44002. staticClass: "modal-title",
  44003. attrs: {
  44004. slot: "header",
  44005. id: "note" + note.noteid + "editModalLabel"
  44006. },
  44007. slot: "header"
  44008. },
  44009. [_vm._v("\n Edit Note\n ")]
  44010. ),
  44011. _vm._v(" "),
  44012. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44013. _c("div", { staticClass: "form-group" }, [
  44014. _c("label", { attrs: { for: "content" } }, [
  44015. _vm._v("Content")
  44016. ]),
  44017. _vm._v(" "),
  44018. _c("textarea", {
  44019. directives: [
  44020. {
  44021. name: "model",
  44022. rawName: "v-model",
  44023. value: note.thenote,
  44024. expression: "note.thenote"
  44025. }
  44026. ],
  44027. staticClass: "form-control",
  44028. attrs: {
  44029. name: "content" + note.noteid,
  44030. id: "content" + note.noteid
  44031. },
  44032. domProps: { value: note.thenote },
  44033. on: {
  44034. input: function($event) {
  44035. if ($event.target.composing) {
  44036. return
  44037. }
  44038. _vm.$set(note, "thenote", $event.target.value)
  44039. }
  44040. }
  44041. })
  44042. ])
  44043. ]),
  44044. _vm._v(" "),
  44045. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44046. _c(
  44047. "button",
  44048. {
  44049. staticClass: "btn btn-secondary",
  44050. attrs: { type: "button", "data-dismiss": "modal" }
  44051. },
  44052. [_vm._v("Close")]
  44053. ),
  44054. _vm._v(" "),
  44055. _c(
  44056. "button",
  44057. {
  44058. staticClass: "btn btn-primary",
  44059. attrs: { type: "button" },
  44060. on: {
  44061. click: function($event) {
  44062. return _vm.updateNote(note.noteid)
  44063. }
  44064. }
  44065. },
  44066. [_vm._v("Save")]
  44067. )
  44068. ])
  44069. ]
  44070. ),
  44071. _vm._v(" "),
  44072. _c(
  44073. "div",
  44074. {
  44075. staticClass: "col-md-1 d-flex flex-column mx-md-3",
  44076. class: { "order-last": _vm.userChanged(index) }
  44077. },
  44078. [
  44079. _c("div", { staticClass: "text-center p-0 m-0" }, [
  44080. _vm._v(_vm._s(note.noteuser))
  44081. ]),
  44082. _vm._v(" "),
  44083. _c(
  44084. "div",
  44085. { staticClass: "text-muted text-small text-center p-0 m-0" },
  44086. [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
  44087. ),
  44088. _vm._v(" "),
  44089. _c(
  44090. "div",
  44091. { staticClass: "btn-group justify-content-center p-0 m-0" },
  44092. [
  44093. _vm.authusername === note.noteuser ||
  44094. _vm.authusername === "admin"
  44095. ? [
  44096. _c(
  44097. "button",
  44098. {
  44099. staticClass: "btn btn-sm btn-primary m-1",
  44100. attrs: {
  44101. "data-toggle": "modal",
  44102. "data-target": "#note" + note.noteid + "editModal"
  44103. }
  44104. },
  44105. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  44106. ),
  44107. _vm._v(" "),
  44108. _vm._m(0, true),
  44109. _vm._v(" "),
  44110. _vm._m(1, true)
  44111. ]
  44112. : _vm._e()
  44113. ],
  44114. 2
  44115. )
  44116. ]
  44117. ),
  44118. _vm._v(" "),
  44119. _c("div", { staticClass: "col-md-10" }, [
  44120. _c("div", { staticClass: "card m-2" }, [
  44121. _c("div", { staticClass: "card-body p-2" }, [
  44122. _vm._v(
  44123. "\n " +
  44124. _vm._s(note.thenote) +
  44125. "\n "
  44126. )
  44127. ])
  44128. ])
  44129. ])
  44130. ],
  44131. 1
  44132. )
  44133. }),
  44134. 0
  44135. )
  44136. }
  44137. var staticRenderFns = [
  44138. function() {
  44139. var _vm = this
  44140. var _h = _vm.$createElement
  44141. var _c = _vm._self._c || _h
  44142. return _c("button", { staticClass: "btn btn-sm btn-danger m-1" }, [
  44143. _c("i", { staticClass: "fas fa-fw fa-trash-alt" })
  44144. ])
  44145. },
  44146. function() {
  44147. var _vm = this
  44148. var _h = _vm.$createElement
  44149. var _c = _vm._self._c || _h
  44150. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  44151. _c("i", { staticClass: "fa fa-fw fa-random" })
  44152. ])
  44153. }
  44154. ]
  44155. render._withStripped = true
  44156. /***/ }),
  44157. /***/ "./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&":
  44158. /*!********************************************************************************************************************************************************************************************************************!*\
  44159. !*** ./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& ***!
  44160. \********************************************************************************************************************************************************************************************************************/
  44161. /*! exports provided: render, staticRenderFns */
  44162. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44163. "use strict";
  44164. __webpack_require__.r(__webpack_exports__);
  44165. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44166. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44167. var render = function() {
  44168. var _vm = this
  44169. var _h = _vm.$createElement
  44170. var _c = _vm._self._c || _h
  44171. return _c(
  44172. "modal",
  44173. {
  44174. attrs: {
  44175. id: _vm.id,
  44176. tabindex: "-1",
  44177. role: "dialog",
  44178. "aria-labelledby": _vm.id + "Label"
  44179. }
  44180. },
  44181. [
  44182. _c(
  44183. "h5",
  44184. {
  44185. staticClass: "modal-title",
  44186. attrs: { slot: "header", id: _vm.id + "Label" },
  44187. slot: "header"
  44188. },
  44189. [_vm._v("\r\n Edit Work Order Information\r\n ")]
  44190. ),
  44191. _vm._v(" "),
  44192. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44193. _c(
  44194. "div",
  44195. { staticClass: "form-group" },
  44196. [
  44197. _c("label", { attrs: { for: "probdesc" } }, [
  44198. _vm._v("Problem Description")
  44199. ]),
  44200. _vm._v(" "),
  44201. _c("textarea", {
  44202. directives: [
  44203. {
  44204. name: "model",
  44205. rawName: "v-model",
  44206. value: _vm.data.probdesc,
  44207. expression: "data.probdesc"
  44208. }
  44209. ],
  44210. class: {
  44211. "form-control": true,
  44212. "is-invalid": _vm.errors.probdesc
  44213. },
  44214. attrs: { id: "probdesc", name: "probdesc" },
  44215. domProps: { value: _vm.data.probdesc },
  44216. on: {
  44217. input: function($event) {
  44218. if ($event.target.composing) {
  44219. return
  44220. }
  44221. _vm.$set(_vm.data, "probdesc", $event.target.value)
  44222. }
  44223. }
  44224. }),
  44225. _vm._v(" "),
  44226. _c("errorlist", { attrs: { errors: _vm.errors.probdesc } })
  44227. ],
  44228. 1
  44229. ),
  44230. _vm._v(" "),
  44231. _c(
  44232. "div",
  44233. { staticClass: "form-group" },
  44234. [
  44235. _c("label", { attrs: { for: "suggested" } }, [
  44236. _vm._v("Suggested Solution")
  44237. ]),
  44238. _vm._v(" "),
  44239. _c("textarea", {
  44240. directives: [
  44241. {
  44242. name: "model",
  44243. rawName: "v-model",
  44244. value: _vm.data.suggested,
  44245. expression: "data.suggested"
  44246. }
  44247. ],
  44248. class: {
  44249. "form-control": true,
  44250. "is-invalid": _vm.errors.suggested
  44251. },
  44252. attrs: { id: "suggested", name: "suggested" },
  44253. domProps: { value: _vm.data.suggested },
  44254. on: {
  44255. input: function($event) {
  44256. if ($event.target.composing) {
  44257. return
  44258. }
  44259. _vm.$set(_vm.data, "suggested", $event.target.value)
  44260. }
  44261. }
  44262. }),
  44263. _vm._v(" "),
  44264. _c("errorlist", { attrs: { errors: _vm.errors.suggested } })
  44265. ],
  44266. 1
  44267. ),
  44268. _vm._v(" "),
  44269. _c(
  44270. "div",
  44271. { staticClass: "form-group" },
  44272. [
  44273. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  44274. _vm._v(" "),
  44275. _c("autocomplete-custom-dropdown", {
  44276. attrs: { options: _vm.storeList, value: this.store },
  44277. model: {
  44278. value: _vm.store,
  44279. callback: function($$v) {
  44280. _vm.store = $$v
  44281. },
  44282. expression: "store"
  44283. }
  44284. })
  44285. ],
  44286. 1
  44287. )
  44288. ]),
  44289. _vm._v(" "),
  44290. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44291. _c(
  44292. "button",
  44293. {
  44294. staticClass: "btn btn-secondary",
  44295. attrs: { type: "button", "data-dismiss": "modal" }
  44296. },
  44297. [_vm._v("Close")]
  44298. ),
  44299. _vm._v(" "),
  44300. _c(
  44301. "button",
  44302. {
  44303. staticClass: "btn btn-primary",
  44304. attrs: { type: "button" },
  44305. on: {
  44306. click: function($event) {
  44307. return _vm.updateWorkOrder()
  44308. }
  44309. }
  44310. },
  44311. [_vm._v("Save")]
  44312. )
  44313. ])
  44314. ]
  44315. )
  44316. }
  44317. var staticRenderFns = []
  44318. render._withStripped = true
  44319. /***/ }),
  44320. /***/ "./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&":
  44321. /*!*********************************************************************************************************************************************************************************************************!*\
  44322. !*** ./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& ***!
  44323. \*********************************************************************************************************************************************************************************************************/
  44324. /*! exports provided: render, staticRenderFns */
  44325. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44326. "use strict";
  44327. __webpack_require__.r(__webpack_exports__);
  44328. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44329. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44330. var render = function() {
  44331. var _vm = this
  44332. var _h = _vm.$createElement
  44333. var _c = _vm._self._c || _h
  44334. return _c(
  44335. "div",
  44336. [
  44337. _c("woinfo-edit-modal", {
  44338. attrs: {
  44339. "modal-id": "workordereditModal",
  44340. "populate-with": this.data,
  44341. "store-list": this.storeList
  44342. }
  44343. }),
  44344. _vm._v(" "),
  44345. _c("p", [
  44346. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  44347. _vm._v(" "),
  44348. _c("span", { domProps: { textContent: _vm._s(this.data.probdesc) } })
  44349. ]),
  44350. _vm._v(" "),
  44351. _c("p", [
  44352. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  44353. _vm._v(" "),
  44354. _c("span", { domProps: { textContent: _vm._s(this.data.suggested) } })
  44355. ]),
  44356. _vm._v(" "),
  44357. _c("p", [
  44358. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  44359. _vm._v(" "),
  44360. _c("span", { domProps: { textContent: _vm._s(this.data.woid) } })
  44361. ]),
  44362. _vm._v(" "),
  44363. _c("p", [
  44364. _c("i", { staticClass: "fas fa-fw fa-building" }),
  44365. _vm._v(" "),
  44366. _c("span", [_vm._v(_vm._s(_vm.storeList[_vm.data.storeid]))])
  44367. ]),
  44368. _vm._v(" "),
  44369. _c("p", [
  44370. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  44371. _vm._v(" "),
  44372. _c(
  44373. "span",
  44374. {
  44375. staticClass: "dashed-underline",
  44376. attrs: {
  44377. "data-toggle": "tooltip",
  44378. "data-placement": "bottom",
  44379. title: this.getHRDate(this.data.dropdate)
  44380. }
  44381. },
  44382. [
  44383. _vm._v(
  44384. "\n " +
  44385. _vm._s(Math.floor(this.daysSinceToday(this.data.dropdate))) +
  44386. " days ago\n "
  44387. )
  44388. ]
  44389. )
  44390. ]),
  44391. _vm._v(" "),
  44392. _c("p", [
  44393. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  44394. _vm._v(" "),
  44395. !this.isZero(this.data.pickupdate)
  44396. ? _c(
  44397. "span",
  44398. {
  44399. staticClass: "dashed-underline",
  44400. attrs: {
  44401. "data-toggle": "tooltip",
  44402. "data-placement": "bottom",
  44403. title: this.getHRDate(this.data.pickupdate)
  44404. }
  44405. },
  44406. [
  44407. _vm._v(
  44408. "\n " +
  44409. _vm._s(
  44410. Math.floor(this.daysSinceToday(this.data.pickupdate))
  44411. ) +
  44412. " days ago\n "
  44413. )
  44414. ]
  44415. )
  44416. : _vm._e()
  44417. ]),
  44418. _vm._v(" "),
  44419. _c(
  44420. "button",
  44421. {
  44422. staticClass: "btn btn-primary",
  44423. attrs: {
  44424. type: "button",
  44425. "data-toggle": "modal",
  44426. "data-target": "#workordereditModal"
  44427. }
  44428. },
  44429. [_vm._v("Edit")]
  44430. )
  44431. ],
  44432. 1
  44433. )
  44434. }
  44435. var staticRenderFns = []
  44436. render._withStripped = true
  44437. /***/ }),
  44438. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  44439. /*!********************************************************************!*\
  44440. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  44441. \********************************************************************/
  44442. /*! exports provided: default */
  44443. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44444. "use strict";
  44445. __webpack_require__.r(__webpack_exports__);
  44446. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  44447. /* globals __VUE_SSR_CONTEXT__ */
  44448. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  44449. // This module is a runtime utility for cleaner component module output and will
  44450. // be included in the final webpack user bundle.
  44451. function normalizeComponent (
  44452. scriptExports,
  44453. render,
  44454. staticRenderFns,
  44455. functionalTemplate,
  44456. injectStyles,
  44457. scopeId,
  44458. moduleIdentifier, /* server only */
  44459. shadowMode /* vue-cli only */
  44460. ) {
  44461. // Vue.extend constructor export interop
  44462. var options = typeof scriptExports === 'function'
  44463. ? scriptExports.options
  44464. : scriptExports
  44465. // render functions
  44466. if (render) {
  44467. options.render = render
  44468. options.staticRenderFns = staticRenderFns
  44469. options._compiled = true
  44470. }
  44471. // functional template
  44472. if (functionalTemplate) {
  44473. options.functional = true
  44474. }
  44475. // scopedId
  44476. if (scopeId) {
  44477. options._scopeId = 'data-v-' + scopeId
  44478. }
  44479. var hook
  44480. if (moduleIdentifier) { // server build
  44481. hook = function (context) {
  44482. // 2.3 injection
  44483. context =
  44484. context || // cached call
  44485. (this.$vnode && this.$vnode.ssrContext) || // stateful
  44486. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  44487. // 2.2 with runInNewContext: true
  44488. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  44489. context = __VUE_SSR_CONTEXT__
  44490. }
  44491. // inject component styles
  44492. if (injectStyles) {
  44493. injectStyles.call(this, context)
  44494. }
  44495. // register component module identifier for async chunk inferrence
  44496. if (context && context._registeredComponents) {
  44497. context._registeredComponents.add(moduleIdentifier)
  44498. }
  44499. }
  44500. // used by ssr in case component is cached and beforeCreate
  44501. // never gets called
  44502. options._ssrRegister = hook
  44503. } else if (injectStyles) {
  44504. hook = shadowMode
  44505. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  44506. : injectStyles
  44507. }
  44508. if (hook) {
  44509. if (options.functional) {
  44510. // for template-only hot-reload because in that case the render fn doesn't
  44511. // go through the normalizer
  44512. options._injectStyles = hook
  44513. // register for functioal component in vue file
  44514. var originalRender = options.render
  44515. options.render = function renderWithStyleInjection (h, context) {
  44516. hook.call(context)
  44517. return originalRender(h, context)
  44518. }
  44519. } else {
  44520. // inject component registration as beforeCreate hook
  44521. var existing = options.beforeCreate
  44522. options.beforeCreate = existing
  44523. ? [].concat(existing, hook)
  44524. : [hook]
  44525. }
  44526. }
  44527. return {
  44528. exports: scriptExports,
  44529. options: options
  44530. }
  44531. }
  44532. /***/ }),
  44533. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  44534. /*!*************************************************!*\
  44535. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  44536. \*************************************************/
  44537. /*! no static exports found */
  44538. /***/ (function(module, exports, __webpack_require__) {
  44539. "use strict";
  44540. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  44541. * Vue.js v2.6.11
  44542. * (c) 2014-2019 Evan You
  44543. * Released under the MIT License.
  44544. */
  44545. /* */
  44546. var emptyObject = Object.freeze({});
  44547. // These helpers produce better VM code in JS engines due to their
  44548. // explicitness and function inlining.
  44549. function isUndef (v) {
  44550. return v === undefined || v === null
  44551. }
  44552. function isDef (v) {
  44553. return v !== undefined && v !== null
  44554. }
  44555. function isTrue (v) {
  44556. return v === true
  44557. }
  44558. function isFalse (v) {
  44559. return v === false
  44560. }
  44561. /**
  44562. * Check if value is primitive.
  44563. */
  44564. function isPrimitive (value) {
  44565. return (
  44566. typeof value === 'string' ||
  44567. typeof value === 'number' ||
  44568. // $flow-disable-line
  44569. typeof value === 'symbol' ||
  44570. typeof value === 'boolean'
  44571. )
  44572. }
  44573. /**
  44574. * Quick object check - this is primarily used to tell
  44575. * Objects from primitive values when we know the value
  44576. * is a JSON-compliant type.
  44577. */
  44578. function isObject (obj) {
  44579. return obj !== null && typeof obj === 'object'
  44580. }
  44581. /**
  44582. * Get the raw type string of a value, e.g., [object Object].
  44583. */
  44584. var _toString = Object.prototype.toString;
  44585. function toRawType (value) {
  44586. return _toString.call(value).slice(8, -1)
  44587. }
  44588. /**
  44589. * Strict object type check. Only returns true
  44590. * for plain JavaScript objects.
  44591. */
  44592. function isPlainObject (obj) {
  44593. return _toString.call(obj) === '[object Object]'
  44594. }
  44595. function isRegExp (v) {
  44596. return _toString.call(v) === '[object RegExp]'
  44597. }
  44598. /**
  44599. * Check if val is a valid array index.
  44600. */
  44601. function isValidArrayIndex (val) {
  44602. var n = parseFloat(String(val));
  44603. return n >= 0 && Math.floor(n) === n && isFinite(val)
  44604. }
  44605. function isPromise (val) {
  44606. return (
  44607. isDef(val) &&
  44608. typeof val.then === 'function' &&
  44609. typeof val.catch === 'function'
  44610. )
  44611. }
  44612. /**
  44613. * Convert a value to a string that is actually rendered.
  44614. */
  44615. function toString (val) {
  44616. return val == null
  44617. ? ''
  44618. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  44619. ? JSON.stringify(val, null, 2)
  44620. : String(val)
  44621. }
  44622. /**
  44623. * Convert an input value to a number for persistence.
  44624. * If the conversion fails, return original string.
  44625. */
  44626. function toNumber (val) {
  44627. var n = parseFloat(val);
  44628. return isNaN(n) ? val : n
  44629. }
  44630. /**
  44631. * Make a map and return a function for checking if a key
  44632. * is in that map.
  44633. */
  44634. function makeMap (
  44635. str,
  44636. expectsLowerCase
  44637. ) {
  44638. var map = Object.create(null);
  44639. var list = str.split(',');
  44640. for (var i = 0; i < list.length; i++) {
  44641. map[list[i]] = true;
  44642. }
  44643. return expectsLowerCase
  44644. ? function (val) { return map[val.toLowerCase()]; }
  44645. : function (val) { return map[val]; }
  44646. }
  44647. /**
  44648. * Check if a tag is a built-in tag.
  44649. */
  44650. var isBuiltInTag = makeMap('slot,component', true);
  44651. /**
  44652. * Check if an attribute is a reserved attribute.
  44653. */
  44654. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  44655. /**
  44656. * Remove an item from an array.
  44657. */
  44658. function remove (arr, item) {
  44659. if (arr.length) {
  44660. var index = arr.indexOf(item);
  44661. if (index > -1) {
  44662. return arr.splice(index, 1)
  44663. }
  44664. }
  44665. }
  44666. /**
  44667. * Check whether an object has the property.
  44668. */
  44669. var hasOwnProperty = Object.prototype.hasOwnProperty;
  44670. function hasOwn (obj, key) {
  44671. return hasOwnProperty.call(obj, key)
  44672. }
  44673. /**
  44674. * Create a cached version of a pure function.
  44675. */
  44676. function cached (fn) {
  44677. var cache = Object.create(null);
  44678. return (function cachedFn (str) {
  44679. var hit = cache[str];
  44680. return hit || (cache[str] = fn(str))
  44681. })
  44682. }
  44683. /**
  44684. * Camelize a hyphen-delimited string.
  44685. */
  44686. var camelizeRE = /-(\w)/g;
  44687. var camelize = cached(function (str) {
  44688. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  44689. });
  44690. /**
  44691. * Capitalize a string.
  44692. */
  44693. var capitalize = cached(function (str) {
  44694. return str.charAt(0).toUpperCase() + str.slice(1)
  44695. });
  44696. /**
  44697. * Hyphenate a camelCase string.
  44698. */
  44699. var hyphenateRE = /\B([A-Z])/g;
  44700. var hyphenate = cached(function (str) {
  44701. return str.replace(hyphenateRE, '-$1').toLowerCase()
  44702. });
  44703. /**
  44704. * Simple bind polyfill for environments that do not support it,
  44705. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  44706. * since native bind is now performant enough in most browsers.
  44707. * But removing it would mean breaking code that was able to run in
  44708. * PhantomJS 1.x, so this must be kept for backward compatibility.
  44709. */
  44710. /* istanbul ignore next */
  44711. function polyfillBind (fn, ctx) {
  44712. function boundFn (a) {
  44713. var l = arguments.length;
  44714. return l
  44715. ? l > 1
  44716. ? fn.apply(ctx, arguments)
  44717. : fn.call(ctx, a)
  44718. : fn.call(ctx)
  44719. }
  44720. boundFn._length = fn.length;
  44721. return boundFn
  44722. }
  44723. function nativeBind (fn, ctx) {
  44724. return fn.bind(ctx)
  44725. }
  44726. var bind = Function.prototype.bind
  44727. ? nativeBind
  44728. : polyfillBind;
  44729. /**
  44730. * Convert an Array-like object to a real Array.
  44731. */
  44732. function toArray (list, start) {
  44733. start = start || 0;
  44734. var i = list.length - start;
  44735. var ret = new Array(i);
  44736. while (i--) {
  44737. ret[i] = list[i + start];
  44738. }
  44739. return ret
  44740. }
  44741. /**
  44742. * Mix properties into target object.
  44743. */
  44744. function extend (to, _from) {
  44745. for (var key in _from) {
  44746. to[key] = _from[key];
  44747. }
  44748. return to
  44749. }
  44750. /**
  44751. * Merge an Array of Objects into a single Object.
  44752. */
  44753. function toObject (arr) {
  44754. var res = {};
  44755. for (var i = 0; i < arr.length; i++) {
  44756. if (arr[i]) {
  44757. extend(res, arr[i]);
  44758. }
  44759. }
  44760. return res
  44761. }
  44762. /* eslint-disable no-unused-vars */
  44763. /**
  44764. * Perform no operation.
  44765. * Stubbing args to make Flow happy without leaving useless transpiled code
  44766. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  44767. */
  44768. function noop (a, b, c) {}
  44769. /**
  44770. * Always return false.
  44771. */
  44772. var no = function (a, b, c) { return false; };
  44773. /* eslint-enable no-unused-vars */
  44774. /**
  44775. * Return the same value.
  44776. */
  44777. var identity = function (_) { return _; };
  44778. /**
  44779. * Generate a string containing static keys from compiler modules.
  44780. */
  44781. function genStaticKeys (modules) {
  44782. return modules.reduce(function (keys, m) {
  44783. return keys.concat(m.staticKeys || [])
  44784. }, []).join(',')
  44785. }
  44786. /**
  44787. * Check if two values are loosely equal - that is,
  44788. * if they are plain objects, do they have the same shape?
  44789. */
  44790. function looseEqual (a, b) {
  44791. if (a === b) { return true }
  44792. var isObjectA = isObject(a);
  44793. var isObjectB = isObject(b);
  44794. if (isObjectA && isObjectB) {
  44795. try {
  44796. var isArrayA = Array.isArray(a);
  44797. var isArrayB = Array.isArray(b);
  44798. if (isArrayA && isArrayB) {
  44799. return a.length === b.length && a.every(function (e, i) {
  44800. return looseEqual(e, b[i])
  44801. })
  44802. } else if (a instanceof Date && b instanceof Date) {
  44803. return a.getTime() === b.getTime()
  44804. } else if (!isArrayA && !isArrayB) {
  44805. var keysA = Object.keys(a);
  44806. var keysB = Object.keys(b);
  44807. return keysA.length === keysB.length && keysA.every(function (key) {
  44808. return looseEqual(a[key], b[key])
  44809. })
  44810. } else {
  44811. /* istanbul ignore next */
  44812. return false
  44813. }
  44814. } catch (e) {
  44815. /* istanbul ignore next */
  44816. return false
  44817. }
  44818. } else if (!isObjectA && !isObjectB) {
  44819. return String(a) === String(b)
  44820. } else {
  44821. return false
  44822. }
  44823. }
  44824. /**
  44825. * Return the first index at which a loosely equal value can be
  44826. * found in the array (if value is a plain object, the array must
  44827. * contain an object of the same shape), or -1 if it is not present.
  44828. */
  44829. function looseIndexOf (arr, val) {
  44830. for (var i = 0; i < arr.length; i++) {
  44831. if (looseEqual(arr[i], val)) { return i }
  44832. }
  44833. return -1
  44834. }
  44835. /**
  44836. * Ensure a function is called only once.
  44837. */
  44838. function once (fn) {
  44839. var called = false;
  44840. return function () {
  44841. if (!called) {
  44842. called = true;
  44843. fn.apply(this, arguments);
  44844. }
  44845. }
  44846. }
  44847. var SSR_ATTR = 'data-server-rendered';
  44848. var ASSET_TYPES = [
  44849. 'component',
  44850. 'directive',
  44851. 'filter'
  44852. ];
  44853. var LIFECYCLE_HOOKS = [
  44854. 'beforeCreate',
  44855. 'created',
  44856. 'beforeMount',
  44857. 'mounted',
  44858. 'beforeUpdate',
  44859. 'updated',
  44860. 'beforeDestroy',
  44861. 'destroyed',
  44862. 'activated',
  44863. 'deactivated',
  44864. 'errorCaptured',
  44865. 'serverPrefetch'
  44866. ];
  44867. /* */
  44868. var config = ({
  44869. /**
  44870. * Option merge strategies (used in core/util/options)
  44871. */
  44872. // $flow-disable-line
  44873. optionMergeStrategies: Object.create(null),
  44874. /**
  44875. * Whether to suppress warnings.
  44876. */
  44877. silent: false,
  44878. /**
  44879. * Show production mode tip message on boot?
  44880. */
  44881. productionTip: "development" !== 'production',
  44882. /**
  44883. * Whether to enable devtools
  44884. */
  44885. devtools: "development" !== 'production',
  44886. /**
  44887. * Whether to record perf
  44888. */
  44889. performance: false,
  44890. /**
  44891. * Error handler for watcher errors
  44892. */
  44893. errorHandler: null,
  44894. /**
  44895. * Warn handler for watcher warns
  44896. */
  44897. warnHandler: null,
  44898. /**
  44899. * Ignore certain custom elements
  44900. */
  44901. ignoredElements: [],
  44902. /**
  44903. * Custom user key aliases for v-on
  44904. */
  44905. // $flow-disable-line
  44906. keyCodes: Object.create(null),
  44907. /**
  44908. * Check if a tag is reserved so that it cannot be registered as a
  44909. * component. This is platform-dependent and may be overwritten.
  44910. */
  44911. isReservedTag: no,
  44912. /**
  44913. * Check if an attribute is reserved so that it cannot be used as a component
  44914. * prop. This is platform-dependent and may be overwritten.
  44915. */
  44916. isReservedAttr: no,
  44917. /**
  44918. * Check if a tag is an unknown element.
  44919. * Platform-dependent.
  44920. */
  44921. isUnknownElement: no,
  44922. /**
  44923. * Get the namespace of an element
  44924. */
  44925. getTagNamespace: noop,
  44926. /**
  44927. * Parse the real tag name for the specific platform.
  44928. */
  44929. parsePlatformTagName: identity,
  44930. /**
  44931. * Check if an attribute must be bound using property, e.g. value
  44932. * Platform-dependent.
  44933. */
  44934. mustUseProp: no,
  44935. /**
  44936. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  44937. * This will significantly reduce performance if set to false.
  44938. */
  44939. async: true,
  44940. /**
  44941. * Exposed for legacy reasons
  44942. */
  44943. _lifecycleHooks: LIFECYCLE_HOOKS
  44944. });
  44945. /* */
  44946. /**
  44947. * unicode letters used for parsing html tags, component names and property paths.
  44948. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  44949. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  44950. */
  44951. 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/;
  44952. /**
  44953. * Check if a string starts with $ or _
  44954. */
  44955. function isReserved (str) {
  44956. var c = (str + '').charCodeAt(0);
  44957. return c === 0x24 || c === 0x5F
  44958. }
  44959. /**
  44960. * Define a property.
  44961. */
  44962. function def (obj, key, val, enumerable) {
  44963. Object.defineProperty(obj, key, {
  44964. value: val,
  44965. enumerable: !!enumerable,
  44966. writable: true,
  44967. configurable: true
  44968. });
  44969. }
  44970. /**
  44971. * Parse simple path.
  44972. */
  44973. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  44974. function parsePath (path) {
  44975. if (bailRE.test(path)) {
  44976. return
  44977. }
  44978. var segments = path.split('.');
  44979. return function (obj) {
  44980. for (var i = 0; i < segments.length; i++) {
  44981. if (!obj) { return }
  44982. obj = obj[segments[i]];
  44983. }
  44984. return obj
  44985. }
  44986. }
  44987. /* */
  44988. // can we use __proto__?
  44989. var hasProto = '__proto__' in {};
  44990. // Browser environment sniffing
  44991. var inBrowser = typeof window !== 'undefined';
  44992. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  44993. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  44994. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  44995. var isIE = UA && /msie|trident/.test(UA);
  44996. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  44997. var isEdge = UA && UA.indexOf('edge/') > 0;
  44998. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  44999. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  45000. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  45001. var isPhantomJS = UA && /phantomjs/.test(UA);
  45002. var isFF = UA && UA.match(/firefox\/(\d+)/);
  45003. // Firefox has a "watch" function on Object.prototype...
  45004. var nativeWatch = ({}).watch;
  45005. var supportsPassive = false;
  45006. if (inBrowser) {
  45007. try {
  45008. var opts = {};
  45009. Object.defineProperty(opts, 'passive', ({
  45010. get: function get () {
  45011. /* istanbul ignore next */
  45012. supportsPassive = true;
  45013. }
  45014. })); // https://github.com/facebook/flow/issues/285
  45015. window.addEventListener('test-passive', null, opts);
  45016. } catch (e) {}
  45017. }
  45018. // this needs to be lazy-evaled because vue may be required before
  45019. // vue-server-renderer can set VUE_ENV
  45020. var _isServer;
  45021. var isServerRendering = function () {
  45022. if (_isServer === undefined) {
  45023. /* istanbul ignore if */
  45024. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  45025. // detect presence of vue-server-renderer and avoid
  45026. // Webpack shimming the process
  45027. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  45028. } else {
  45029. _isServer = false;
  45030. }
  45031. }
  45032. return _isServer
  45033. };
  45034. // detect devtools
  45035. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  45036. /* istanbul ignore next */
  45037. function isNative (Ctor) {
  45038. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  45039. }
  45040. var hasSymbol =
  45041. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  45042. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  45043. var _Set;
  45044. /* istanbul ignore if */ // $flow-disable-line
  45045. if (typeof Set !== 'undefined' && isNative(Set)) {
  45046. // use native Set when available.
  45047. _Set = Set;
  45048. } else {
  45049. // a non-standard Set polyfill that only works with primitive keys.
  45050. _Set = /*@__PURE__*/(function () {
  45051. function Set () {
  45052. this.set = Object.create(null);
  45053. }
  45054. Set.prototype.has = function has (key) {
  45055. return this.set[key] === true
  45056. };
  45057. Set.prototype.add = function add (key) {
  45058. this.set[key] = true;
  45059. };
  45060. Set.prototype.clear = function clear () {
  45061. this.set = Object.create(null);
  45062. };
  45063. return Set;
  45064. }());
  45065. }
  45066. /* */
  45067. var warn = noop;
  45068. var tip = noop;
  45069. var generateComponentTrace = (noop); // work around flow check
  45070. var formatComponentName = (noop);
  45071. {
  45072. var hasConsole = typeof console !== 'undefined';
  45073. var classifyRE = /(?:^|[-_])(\w)/g;
  45074. var classify = function (str) { return str
  45075. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  45076. .replace(/[-_]/g, ''); };
  45077. warn = function (msg, vm) {
  45078. var trace = vm ? generateComponentTrace(vm) : '';
  45079. if (config.warnHandler) {
  45080. config.warnHandler.call(null, msg, vm, trace);
  45081. } else if (hasConsole && (!config.silent)) {
  45082. console.error(("[Vue warn]: " + msg + trace));
  45083. }
  45084. };
  45085. tip = function (msg, vm) {
  45086. if (hasConsole && (!config.silent)) {
  45087. console.warn("[Vue tip]: " + msg + (
  45088. vm ? generateComponentTrace(vm) : ''
  45089. ));
  45090. }
  45091. };
  45092. formatComponentName = function (vm, includeFile) {
  45093. if (vm.$root === vm) {
  45094. return '<Root>'
  45095. }
  45096. var options = typeof vm === 'function' && vm.cid != null
  45097. ? vm.options
  45098. : vm._isVue
  45099. ? vm.$options || vm.constructor.options
  45100. : vm;
  45101. var name = options.name || options._componentTag;
  45102. var file = options.__file;
  45103. if (!name && file) {
  45104. var match = file.match(/([^/\\]+)\.vue$/);
  45105. name = match && match[1];
  45106. }
  45107. return (
  45108. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  45109. (file && includeFile !== false ? (" at " + file) : '')
  45110. )
  45111. };
  45112. var repeat = function (str, n) {
  45113. var res = '';
  45114. while (n) {
  45115. if (n % 2 === 1) { res += str; }
  45116. if (n > 1) { str += str; }
  45117. n >>= 1;
  45118. }
  45119. return res
  45120. };
  45121. generateComponentTrace = function (vm) {
  45122. if (vm._isVue && vm.$parent) {
  45123. var tree = [];
  45124. var currentRecursiveSequence = 0;
  45125. while (vm) {
  45126. if (tree.length > 0) {
  45127. var last = tree[tree.length - 1];
  45128. if (last.constructor === vm.constructor) {
  45129. currentRecursiveSequence++;
  45130. vm = vm.$parent;
  45131. continue
  45132. } else if (currentRecursiveSequence > 0) {
  45133. tree[tree.length - 1] = [last, currentRecursiveSequence];
  45134. currentRecursiveSequence = 0;
  45135. }
  45136. }
  45137. tree.push(vm);
  45138. vm = vm.$parent;
  45139. }
  45140. return '\n\nfound in\n\n' + tree
  45141. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  45142. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  45143. : formatComponentName(vm))); })
  45144. .join('\n')
  45145. } else {
  45146. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  45147. }
  45148. };
  45149. }
  45150. /* */
  45151. var uid = 0;
  45152. /**
  45153. * A dep is an observable that can have multiple
  45154. * directives subscribing to it.
  45155. */
  45156. var Dep = function Dep () {
  45157. this.id = uid++;
  45158. this.subs = [];
  45159. };
  45160. Dep.prototype.addSub = function addSub (sub) {
  45161. this.subs.push(sub);
  45162. };
  45163. Dep.prototype.removeSub = function removeSub (sub) {
  45164. remove(this.subs, sub);
  45165. };
  45166. Dep.prototype.depend = function depend () {
  45167. if (Dep.target) {
  45168. Dep.target.addDep(this);
  45169. }
  45170. };
  45171. Dep.prototype.notify = function notify () {
  45172. // stabilize the subscriber list first
  45173. var subs = this.subs.slice();
  45174. if (!config.async) {
  45175. // subs aren't sorted in scheduler if not running async
  45176. // we need to sort them now to make sure they fire in correct
  45177. // order
  45178. subs.sort(function (a, b) { return a.id - b.id; });
  45179. }
  45180. for (var i = 0, l = subs.length; i < l; i++) {
  45181. subs[i].update();
  45182. }
  45183. };
  45184. // The current target watcher being evaluated.
  45185. // This is globally unique because only one watcher
  45186. // can be evaluated at a time.
  45187. Dep.target = null;
  45188. var targetStack = [];
  45189. function pushTarget (target) {
  45190. targetStack.push(target);
  45191. Dep.target = target;
  45192. }
  45193. function popTarget () {
  45194. targetStack.pop();
  45195. Dep.target = targetStack[targetStack.length - 1];
  45196. }
  45197. /* */
  45198. var VNode = function VNode (
  45199. tag,
  45200. data,
  45201. children,
  45202. text,
  45203. elm,
  45204. context,
  45205. componentOptions,
  45206. asyncFactory
  45207. ) {
  45208. this.tag = tag;
  45209. this.data = data;
  45210. this.children = children;
  45211. this.text = text;
  45212. this.elm = elm;
  45213. this.ns = undefined;
  45214. this.context = context;
  45215. this.fnContext = undefined;
  45216. this.fnOptions = undefined;
  45217. this.fnScopeId = undefined;
  45218. this.key = data && data.key;
  45219. this.componentOptions = componentOptions;
  45220. this.componentInstance = undefined;
  45221. this.parent = undefined;
  45222. this.raw = false;
  45223. this.isStatic = false;
  45224. this.isRootInsert = true;
  45225. this.isComment = false;
  45226. this.isCloned = false;
  45227. this.isOnce = false;
  45228. this.asyncFactory = asyncFactory;
  45229. this.asyncMeta = undefined;
  45230. this.isAsyncPlaceholder = false;
  45231. };
  45232. var prototypeAccessors = { child: { configurable: true } };
  45233. // DEPRECATED: alias for componentInstance for backwards compat.
  45234. /* istanbul ignore next */
  45235. prototypeAccessors.child.get = function () {
  45236. return this.componentInstance
  45237. };
  45238. Object.defineProperties( VNode.prototype, prototypeAccessors );
  45239. var createEmptyVNode = function (text) {
  45240. if ( text === void 0 ) text = '';
  45241. var node = new VNode();
  45242. node.text = text;
  45243. node.isComment = true;
  45244. return node
  45245. };
  45246. function createTextVNode (val) {
  45247. return new VNode(undefined, undefined, undefined, String(val))
  45248. }
  45249. // optimized shallow clone
  45250. // used for static nodes and slot nodes because they may be reused across
  45251. // multiple renders, cloning them avoids errors when DOM manipulations rely
  45252. // on their elm reference.
  45253. function cloneVNode (vnode) {
  45254. var cloned = new VNode(
  45255. vnode.tag,
  45256. vnode.data,
  45257. // #7975
  45258. // clone children array to avoid mutating original in case of cloning
  45259. // a child.
  45260. vnode.children && vnode.children.slice(),
  45261. vnode.text,
  45262. vnode.elm,
  45263. vnode.context,
  45264. vnode.componentOptions,
  45265. vnode.asyncFactory
  45266. );
  45267. cloned.ns = vnode.ns;
  45268. cloned.isStatic = vnode.isStatic;
  45269. cloned.key = vnode.key;
  45270. cloned.isComment = vnode.isComment;
  45271. cloned.fnContext = vnode.fnContext;
  45272. cloned.fnOptions = vnode.fnOptions;
  45273. cloned.fnScopeId = vnode.fnScopeId;
  45274. cloned.asyncMeta = vnode.asyncMeta;
  45275. cloned.isCloned = true;
  45276. return cloned
  45277. }
  45278. /*
  45279. * not type checking this file because flow doesn't play well with
  45280. * dynamically accessing methods on Array prototype
  45281. */
  45282. var arrayProto = Array.prototype;
  45283. var arrayMethods = Object.create(arrayProto);
  45284. var methodsToPatch = [
  45285. 'push',
  45286. 'pop',
  45287. 'shift',
  45288. 'unshift',
  45289. 'splice',
  45290. 'sort',
  45291. 'reverse'
  45292. ];
  45293. /**
  45294. * Intercept mutating methods and emit events
  45295. */
  45296. methodsToPatch.forEach(function (method) {
  45297. // cache original method
  45298. var original = arrayProto[method];
  45299. def(arrayMethods, method, function mutator () {
  45300. var args = [], len = arguments.length;
  45301. while ( len-- ) args[ len ] = arguments[ len ];
  45302. var result = original.apply(this, args);
  45303. var ob = this.__ob__;
  45304. var inserted;
  45305. switch (method) {
  45306. case 'push':
  45307. case 'unshift':
  45308. inserted = args;
  45309. break
  45310. case 'splice':
  45311. inserted = args.slice(2);
  45312. break
  45313. }
  45314. if (inserted) { ob.observeArray(inserted); }
  45315. // notify change
  45316. ob.dep.notify();
  45317. return result
  45318. });
  45319. });
  45320. /* */
  45321. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  45322. /**
  45323. * In some cases we may want to disable observation inside a component's
  45324. * update computation.
  45325. */
  45326. var shouldObserve = true;
  45327. function toggleObserving (value) {
  45328. shouldObserve = value;
  45329. }
  45330. /**
  45331. * Observer class that is attached to each observed
  45332. * object. Once attached, the observer converts the target
  45333. * object's property keys into getter/setters that
  45334. * collect dependencies and dispatch updates.
  45335. */
  45336. var Observer = function Observer (value) {
  45337. this.value = value;
  45338. this.dep = new Dep();
  45339. this.vmCount = 0;
  45340. def(value, '__ob__', this);
  45341. if (Array.isArray(value)) {
  45342. if (hasProto) {
  45343. protoAugment(value, arrayMethods);
  45344. } else {
  45345. copyAugment(value, arrayMethods, arrayKeys);
  45346. }
  45347. this.observeArray(value);
  45348. } else {
  45349. this.walk(value);
  45350. }
  45351. };
  45352. /**
  45353. * Walk through all properties and convert them into
  45354. * getter/setters. This method should only be called when
  45355. * value type is Object.
  45356. */
  45357. Observer.prototype.walk = function walk (obj) {
  45358. var keys = Object.keys(obj);
  45359. for (var i = 0; i < keys.length; i++) {
  45360. defineReactive$$1(obj, keys[i]);
  45361. }
  45362. };
  45363. /**
  45364. * Observe a list of Array items.
  45365. */
  45366. Observer.prototype.observeArray = function observeArray (items) {
  45367. for (var i = 0, l = items.length; i < l; i++) {
  45368. observe(items[i]);
  45369. }
  45370. };
  45371. // helpers
  45372. /**
  45373. * Augment a target Object or Array by intercepting
  45374. * the prototype chain using __proto__
  45375. */
  45376. function protoAugment (target, src) {
  45377. /* eslint-disable no-proto */
  45378. target.__proto__ = src;
  45379. /* eslint-enable no-proto */
  45380. }
  45381. /**
  45382. * Augment a target Object or Array by defining
  45383. * hidden properties.
  45384. */
  45385. /* istanbul ignore next */
  45386. function copyAugment (target, src, keys) {
  45387. for (var i = 0, l = keys.length; i < l; i++) {
  45388. var key = keys[i];
  45389. def(target, key, src[key]);
  45390. }
  45391. }
  45392. /**
  45393. * Attempt to create an observer instance for a value,
  45394. * returns the new observer if successfully observed,
  45395. * or the existing observer if the value already has one.
  45396. */
  45397. function observe (value, asRootData) {
  45398. if (!isObject(value) || value instanceof VNode) {
  45399. return
  45400. }
  45401. var ob;
  45402. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  45403. ob = value.__ob__;
  45404. } else if (
  45405. shouldObserve &&
  45406. !isServerRendering() &&
  45407. (Array.isArray(value) || isPlainObject(value)) &&
  45408. Object.isExtensible(value) &&
  45409. !value._isVue
  45410. ) {
  45411. ob = new Observer(value);
  45412. }
  45413. if (asRootData && ob) {
  45414. ob.vmCount++;
  45415. }
  45416. return ob
  45417. }
  45418. /**
  45419. * Define a reactive property on an Object.
  45420. */
  45421. function defineReactive$$1 (
  45422. obj,
  45423. key,
  45424. val,
  45425. customSetter,
  45426. shallow
  45427. ) {
  45428. var dep = new Dep();
  45429. var property = Object.getOwnPropertyDescriptor(obj, key);
  45430. if (property && property.configurable === false) {
  45431. return
  45432. }
  45433. // cater for pre-defined getter/setters
  45434. var getter = property && property.get;
  45435. var setter = property && property.set;
  45436. if ((!getter || setter) && arguments.length === 2) {
  45437. val = obj[key];
  45438. }
  45439. var childOb = !shallow && observe(val);
  45440. Object.defineProperty(obj, key, {
  45441. enumerable: true,
  45442. configurable: true,
  45443. get: function reactiveGetter () {
  45444. var value = getter ? getter.call(obj) : val;
  45445. if (Dep.target) {
  45446. dep.depend();
  45447. if (childOb) {
  45448. childOb.dep.depend();
  45449. if (Array.isArray(value)) {
  45450. dependArray(value);
  45451. }
  45452. }
  45453. }
  45454. return value
  45455. },
  45456. set: function reactiveSetter (newVal) {
  45457. var value = getter ? getter.call(obj) : val;
  45458. /* eslint-disable no-self-compare */
  45459. if (newVal === value || (newVal !== newVal && value !== value)) {
  45460. return
  45461. }
  45462. /* eslint-enable no-self-compare */
  45463. if (customSetter) {
  45464. customSetter();
  45465. }
  45466. // #7981: for accessor properties without setter
  45467. if (getter && !setter) { return }
  45468. if (setter) {
  45469. setter.call(obj, newVal);
  45470. } else {
  45471. val = newVal;
  45472. }
  45473. childOb = !shallow && observe(newVal);
  45474. dep.notify();
  45475. }
  45476. });
  45477. }
  45478. /**
  45479. * Set a property on an object. Adds the new property and
  45480. * triggers change notification if the property doesn't
  45481. * already exist.
  45482. */
  45483. function set (target, key, val) {
  45484. if (isUndef(target) || isPrimitive(target)
  45485. ) {
  45486. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  45487. }
  45488. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45489. target.length = Math.max(target.length, key);
  45490. target.splice(key, 1, val);
  45491. return val
  45492. }
  45493. if (key in target && !(key in Object.prototype)) {
  45494. target[key] = val;
  45495. return val
  45496. }
  45497. var ob = (target).__ob__;
  45498. if (target._isVue || (ob && ob.vmCount)) {
  45499. warn(
  45500. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  45501. 'at runtime - declare it upfront in the data option.'
  45502. );
  45503. return val
  45504. }
  45505. if (!ob) {
  45506. target[key] = val;
  45507. return val
  45508. }
  45509. defineReactive$$1(ob.value, key, val);
  45510. ob.dep.notify();
  45511. return val
  45512. }
  45513. /**
  45514. * Delete a property and trigger change if necessary.
  45515. */
  45516. function del (target, key) {
  45517. if (isUndef(target) || isPrimitive(target)
  45518. ) {
  45519. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  45520. }
  45521. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45522. target.splice(key, 1);
  45523. return
  45524. }
  45525. var ob = (target).__ob__;
  45526. if (target._isVue || (ob && ob.vmCount)) {
  45527. warn(
  45528. 'Avoid deleting properties on a Vue instance or its root $data ' +
  45529. '- just set it to null.'
  45530. );
  45531. return
  45532. }
  45533. if (!hasOwn(target, key)) {
  45534. return
  45535. }
  45536. delete target[key];
  45537. if (!ob) {
  45538. return
  45539. }
  45540. ob.dep.notify();
  45541. }
  45542. /**
  45543. * Collect dependencies on array elements when the array is touched, since
  45544. * we cannot intercept array element access like property getters.
  45545. */
  45546. function dependArray (value) {
  45547. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  45548. e = value[i];
  45549. e && e.__ob__ && e.__ob__.dep.depend();
  45550. if (Array.isArray(e)) {
  45551. dependArray(e);
  45552. }
  45553. }
  45554. }
  45555. /* */
  45556. /**
  45557. * Option overwriting strategies are functions that handle
  45558. * how to merge a parent option value and a child option
  45559. * value into the final value.
  45560. */
  45561. var strats = config.optionMergeStrategies;
  45562. /**
  45563. * Options with restrictions
  45564. */
  45565. {
  45566. strats.el = strats.propsData = function (parent, child, vm, key) {
  45567. if (!vm) {
  45568. warn(
  45569. "option \"" + key + "\" can only be used during instance " +
  45570. 'creation with the `new` keyword.'
  45571. );
  45572. }
  45573. return defaultStrat(parent, child)
  45574. };
  45575. }
  45576. /**
  45577. * Helper that recursively merges two data objects together.
  45578. */
  45579. function mergeData (to, from) {
  45580. if (!from) { return to }
  45581. var key, toVal, fromVal;
  45582. var keys = hasSymbol
  45583. ? Reflect.ownKeys(from)
  45584. : Object.keys(from);
  45585. for (var i = 0; i < keys.length; i++) {
  45586. key = keys[i];
  45587. // in case the object is already observed...
  45588. if (key === '__ob__') { continue }
  45589. toVal = to[key];
  45590. fromVal = from[key];
  45591. if (!hasOwn(to, key)) {
  45592. set(to, key, fromVal);
  45593. } else if (
  45594. toVal !== fromVal &&
  45595. isPlainObject(toVal) &&
  45596. isPlainObject(fromVal)
  45597. ) {
  45598. mergeData(toVal, fromVal);
  45599. }
  45600. }
  45601. return to
  45602. }
  45603. /**
  45604. * Data
  45605. */
  45606. function mergeDataOrFn (
  45607. parentVal,
  45608. childVal,
  45609. vm
  45610. ) {
  45611. if (!vm) {
  45612. // in a Vue.extend merge, both should be functions
  45613. if (!childVal) {
  45614. return parentVal
  45615. }
  45616. if (!parentVal) {
  45617. return childVal
  45618. }
  45619. // when parentVal & childVal are both present,
  45620. // we need to return a function that returns the
  45621. // merged result of both functions... no need to
  45622. // check if parentVal is a function here because
  45623. // it has to be a function to pass previous merges.
  45624. return function mergedDataFn () {
  45625. return mergeData(
  45626. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  45627. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  45628. )
  45629. }
  45630. } else {
  45631. return function mergedInstanceDataFn () {
  45632. // instance merge
  45633. var instanceData = typeof childVal === 'function'
  45634. ? childVal.call(vm, vm)
  45635. : childVal;
  45636. var defaultData = typeof parentVal === 'function'
  45637. ? parentVal.call(vm, vm)
  45638. : parentVal;
  45639. if (instanceData) {
  45640. return mergeData(instanceData, defaultData)
  45641. } else {
  45642. return defaultData
  45643. }
  45644. }
  45645. }
  45646. }
  45647. strats.data = function (
  45648. parentVal,
  45649. childVal,
  45650. vm
  45651. ) {
  45652. if (!vm) {
  45653. if (childVal && typeof childVal !== 'function') {
  45654. warn(
  45655. 'The "data" option should be a function ' +
  45656. 'that returns a per-instance value in component ' +
  45657. 'definitions.',
  45658. vm
  45659. );
  45660. return parentVal
  45661. }
  45662. return mergeDataOrFn(parentVal, childVal)
  45663. }
  45664. return mergeDataOrFn(parentVal, childVal, vm)
  45665. };
  45666. /**
  45667. * Hooks and props are merged as arrays.
  45668. */
  45669. function mergeHook (
  45670. parentVal,
  45671. childVal
  45672. ) {
  45673. var res = childVal
  45674. ? parentVal
  45675. ? parentVal.concat(childVal)
  45676. : Array.isArray(childVal)
  45677. ? childVal
  45678. : [childVal]
  45679. : parentVal;
  45680. return res
  45681. ? dedupeHooks(res)
  45682. : res
  45683. }
  45684. function dedupeHooks (hooks) {
  45685. var res = [];
  45686. for (var i = 0; i < hooks.length; i++) {
  45687. if (res.indexOf(hooks[i]) === -1) {
  45688. res.push(hooks[i]);
  45689. }
  45690. }
  45691. return res
  45692. }
  45693. LIFECYCLE_HOOKS.forEach(function (hook) {
  45694. strats[hook] = mergeHook;
  45695. });
  45696. /**
  45697. * Assets
  45698. *
  45699. * When a vm is present (instance creation), we need to do
  45700. * a three-way merge between constructor options, instance
  45701. * options and parent options.
  45702. */
  45703. function mergeAssets (
  45704. parentVal,
  45705. childVal,
  45706. vm,
  45707. key
  45708. ) {
  45709. var res = Object.create(parentVal || null);
  45710. if (childVal) {
  45711. assertObjectType(key, childVal, vm);
  45712. return extend(res, childVal)
  45713. } else {
  45714. return res
  45715. }
  45716. }
  45717. ASSET_TYPES.forEach(function (type) {
  45718. strats[type + 's'] = mergeAssets;
  45719. });
  45720. /**
  45721. * Watchers.
  45722. *
  45723. * Watchers hashes should not overwrite one
  45724. * another, so we merge them as arrays.
  45725. */
  45726. strats.watch = function (
  45727. parentVal,
  45728. childVal,
  45729. vm,
  45730. key
  45731. ) {
  45732. // work around Firefox's Object.prototype.watch...
  45733. if (parentVal === nativeWatch) { parentVal = undefined; }
  45734. if (childVal === nativeWatch) { childVal = undefined; }
  45735. /* istanbul ignore if */
  45736. if (!childVal) { return Object.create(parentVal || null) }
  45737. {
  45738. assertObjectType(key, childVal, vm);
  45739. }
  45740. if (!parentVal) { return childVal }
  45741. var ret = {};
  45742. extend(ret, parentVal);
  45743. for (var key$1 in childVal) {
  45744. var parent = ret[key$1];
  45745. var child = childVal[key$1];
  45746. if (parent && !Array.isArray(parent)) {
  45747. parent = [parent];
  45748. }
  45749. ret[key$1] = parent
  45750. ? parent.concat(child)
  45751. : Array.isArray(child) ? child : [child];
  45752. }
  45753. return ret
  45754. };
  45755. /**
  45756. * Other object hashes.
  45757. */
  45758. strats.props =
  45759. strats.methods =
  45760. strats.inject =
  45761. strats.computed = function (
  45762. parentVal,
  45763. childVal,
  45764. vm,
  45765. key
  45766. ) {
  45767. if (childVal && "development" !== 'production') {
  45768. assertObjectType(key, childVal, vm);
  45769. }
  45770. if (!parentVal) { return childVal }
  45771. var ret = Object.create(null);
  45772. extend(ret, parentVal);
  45773. if (childVal) { extend(ret, childVal); }
  45774. return ret
  45775. };
  45776. strats.provide = mergeDataOrFn;
  45777. /**
  45778. * Default strategy.
  45779. */
  45780. var defaultStrat = function (parentVal, childVal) {
  45781. return childVal === undefined
  45782. ? parentVal
  45783. : childVal
  45784. };
  45785. /**
  45786. * Validate component names
  45787. */
  45788. function checkComponents (options) {
  45789. for (var key in options.components) {
  45790. validateComponentName(key);
  45791. }
  45792. }
  45793. function validateComponentName (name) {
  45794. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  45795. warn(
  45796. 'Invalid component name: "' + name + '". Component names ' +
  45797. 'should conform to valid custom element name in html5 specification.'
  45798. );
  45799. }
  45800. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  45801. warn(
  45802. 'Do not use built-in or reserved HTML elements as component ' +
  45803. 'id: ' + name
  45804. );
  45805. }
  45806. }
  45807. /**
  45808. * Ensure all props option syntax are normalized into the
  45809. * Object-based format.
  45810. */
  45811. function normalizeProps (options, vm) {
  45812. var props = options.props;
  45813. if (!props) { return }
  45814. var res = {};
  45815. var i, val, name;
  45816. if (Array.isArray(props)) {
  45817. i = props.length;
  45818. while (i--) {
  45819. val = props[i];
  45820. if (typeof val === 'string') {
  45821. name = camelize(val);
  45822. res[name] = { type: null };
  45823. } else {
  45824. warn('props must be strings when using array syntax.');
  45825. }
  45826. }
  45827. } else if (isPlainObject(props)) {
  45828. for (var key in props) {
  45829. val = props[key];
  45830. name = camelize(key);
  45831. res[name] = isPlainObject(val)
  45832. ? val
  45833. : { type: val };
  45834. }
  45835. } else {
  45836. warn(
  45837. "Invalid value for option \"props\": expected an Array or an Object, " +
  45838. "but got " + (toRawType(props)) + ".",
  45839. vm
  45840. );
  45841. }
  45842. options.props = res;
  45843. }
  45844. /**
  45845. * Normalize all injections into Object-based format
  45846. */
  45847. function normalizeInject (options, vm) {
  45848. var inject = options.inject;
  45849. if (!inject) { return }
  45850. var normalized = options.inject = {};
  45851. if (Array.isArray(inject)) {
  45852. for (var i = 0; i < inject.length; i++) {
  45853. normalized[inject[i]] = { from: inject[i] };
  45854. }
  45855. } else if (isPlainObject(inject)) {
  45856. for (var key in inject) {
  45857. var val = inject[key];
  45858. normalized[key] = isPlainObject(val)
  45859. ? extend({ from: key }, val)
  45860. : { from: val };
  45861. }
  45862. } else {
  45863. warn(
  45864. "Invalid value for option \"inject\": expected an Array or an Object, " +
  45865. "but got " + (toRawType(inject)) + ".",
  45866. vm
  45867. );
  45868. }
  45869. }
  45870. /**
  45871. * Normalize raw function directives into object format.
  45872. */
  45873. function normalizeDirectives (options) {
  45874. var dirs = options.directives;
  45875. if (dirs) {
  45876. for (var key in dirs) {
  45877. var def$$1 = dirs[key];
  45878. if (typeof def$$1 === 'function') {
  45879. dirs[key] = { bind: def$$1, update: def$$1 };
  45880. }
  45881. }
  45882. }
  45883. }
  45884. function assertObjectType (name, value, vm) {
  45885. if (!isPlainObject(value)) {
  45886. warn(
  45887. "Invalid value for option \"" + name + "\": expected an Object, " +
  45888. "but got " + (toRawType(value)) + ".",
  45889. vm
  45890. );
  45891. }
  45892. }
  45893. /**
  45894. * Merge two option objects into a new one.
  45895. * Core utility used in both instantiation and inheritance.
  45896. */
  45897. function mergeOptions (
  45898. parent,
  45899. child,
  45900. vm
  45901. ) {
  45902. {
  45903. checkComponents(child);
  45904. }
  45905. if (typeof child === 'function') {
  45906. child = child.options;
  45907. }
  45908. normalizeProps(child, vm);
  45909. normalizeInject(child, vm);
  45910. normalizeDirectives(child);
  45911. // Apply extends and mixins on the child options,
  45912. // but only if it is a raw options object that isn't
  45913. // the result of another mergeOptions call.
  45914. // Only merged options has the _base property.
  45915. if (!child._base) {
  45916. if (child.extends) {
  45917. parent = mergeOptions(parent, child.extends, vm);
  45918. }
  45919. if (child.mixins) {
  45920. for (var i = 0, l = child.mixins.length; i < l; i++) {
  45921. parent = mergeOptions(parent, child.mixins[i], vm);
  45922. }
  45923. }
  45924. }
  45925. var options = {};
  45926. var key;
  45927. for (key in parent) {
  45928. mergeField(key);
  45929. }
  45930. for (key in child) {
  45931. if (!hasOwn(parent, key)) {
  45932. mergeField(key);
  45933. }
  45934. }
  45935. function mergeField (key) {
  45936. var strat = strats[key] || defaultStrat;
  45937. options[key] = strat(parent[key], child[key], vm, key);
  45938. }
  45939. return options
  45940. }
  45941. /**
  45942. * Resolve an asset.
  45943. * This function is used because child instances need access
  45944. * to assets defined in its ancestor chain.
  45945. */
  45946. function resolveAsset (
  45947. options,
  45948. type,
  45949. id,
  45950. warnMissing
  45951. ) {
  45952. /* istanbul ignore if */
  45953. if (typeof id !== 'string') {
  45954. return
  45955. }
  45956. var assets = options[type];
  45957. // check local registration variations first
  45958. if (hasOwn(assets, id)) { return assets[id] }
  45959. var camelizedId = camelize(id);
  45960. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  45961. var PascalCaseId = capitalize(camelizedId);
  45962. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  45963. // fallback to prototype chain
  45964. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  45965. if (warnMissing && !res) {
  45966. warn(
  45967. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  45968. options
  45969. );
  45970. }
  45971. return res
  45972. }
  45973. /* */
  45974. function validateProp (
  45975. key,
  45976. propOptions,
  45977. propsData,
  45978. vm
  45979. ) {
  45980. var prop = propOptions[key];
  45981. var absent = !hasOwn(propsData, key);
  45982. var value = propsData[key];
  45983. // boolean casting
  45984. var booleanIndex = getTypeIndex(Boolean, prop.type);
  45985. if (booleanIndex > -1) {
  45986. if (absent && !hasOwn(prop, 'default')) {
  45987. value = false;
  45988. } else if (value === '' || value === hyphenate(key)) {
  45989. // only cast empty string / same name to boolean if
  45990. // boolean has higher priority
  45991. var stringIndex = getTypeIndex(String, prop.type);
  45992. if (stringIndex < 0 || booleanIndex < stringIndex) {
  45993. value = true;
  45994. }
  45995. }
  45996. }
  45997. // check default value
  45998. if (value === undefined) {
  45999. value = getPropDefaultValue(vm, prop, key);
  46000. // since the default value is a fresh copy,
  46001. // make sure to observe it.
  46002. var prevShouldObserve = shouldObserve;
  46003. toggleObserving(true);
  46004. observe(value);
  46005. toggleObserving(prevShouldObserve);
  46006. }
  46007. {
  46008. assertProp(prop, key, value, vm, absent);
  46009. }
  46010. return value
  46011. }
  46012. /**
  46013. * Get the default value of a prop.
  46014. */
  46015. function getPropDefaultValue (vm, prop, key) {
  46016. // no default, return undefined
  46017. if (!hasOwn(prop, 'default')) {
  46018. return undefined
  46019. }
  46020. var def = prop.default;
  46021. // warn against non-factory defaults for Object & Array
  46022. if (isObject(def)) {
  46023. warn(
  46024. 'Invalid default value for prop "' + key + '": ' +
  46025. 'Props with type Object/Array must use a factory function ' +
  46026. 'to return the default value.',
  46027. vm
  46028. );
  46029. }
  46030. // the raw prop value was also undefined from previous render,
  46031. // return previous default value to avoid unnecessary watcher trigger
  46032. if (vm && vm.$options.propsData &&
  46033. vm.$options.propsData[key] === undefined &&
  46034. vm._props[key] !== undefined
  46035. ) {
  46036. return vm._props[key]
  46037. }
  46038. // call factory function for non-Function types
  46039. // a value is Function if its prototype is function even across different execution context
  46040. return typeof def === 'function' && getType(prop.type) !== 'Function'
  46041. ? def.call(vm)
  46042. : def
  46043. }
  46044. /**
  46045. * Assert whether a prop is valid.
  46046. */
  46047. function assertProp (
  46048. prop,
  46049. name,
  46050. value,
  46051. vm,
  46052. absent
  46053. ) {
  46054. if (prop.required && absent) {
  46055. warn(
  46056. 'Missing required prop: "' + name + '"',
  46057. vm
  46058. );
  46059. return
  46060. }
  46061. if (value == null && !prop.required) {
  46062. return
  46063. }
  46064. var type = prop.type;
  46065. var valid = !type || type === true;
  46066. var expectedTypes = [];
  46067. if (type) {
  46068. if (!Array.isArray(type)) {
  46069. type = [type];
  46070. }
  46071. for (var i = 0; i < type.length && !valid; i++) {
  46072. var assertedType = assertType(value, type[i]);
  46073. expectedTypes.push(assertedType.expectedType || '');
  46074. valid = assertedType.valid;
  46075. }
  46076. }
  46077. if (!valid) {
  46078. warn(
  46079. getInvalidTypeMessage(name, value, expectedTypes),
  46080. vm
  46081. );
  46082. return
  46083. }
  46084. var validator = prop.validator;
  46085. if (validator) {
  46086. if (!validator(value)) {
  46087. warn(
  46088. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  46089. vm
  46090. );
  46091. }
  46092. }
  46093. }
  46094. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  46095. function assertType (value, type) {
  46096. var valid;
  46097. var expectedType = getType(type);
  46098. if (simpleCheckRE.test(expectedType)) {
  46099. var t = typeof value;
  46100. valid = t === expectedType.toLowerCase();
  46101. // for primitive wrapper objects
  46102. if (!valid && t === 'object') {
  46103. valid = value instanceof type;
  46104. }
  46105. } else if (expectedType === 'Object') {
  46106. valid = isPlainObject(value);
  46107. } else if (expectedType === 'Array') {
  46108. valid = Array.isArray(value);
  46109. } else {
  46110. valid = value instanceof type;
  46111. }
  46112. return {
  46113. valid: valid,
  46114. expectedType: expectedType
  46115. }
  46116. }
  46117. /**
  46118. * Use function string name to check built-in types,
  46119. * because a simple equality check will fail when running
  46120. * across different vms / iframes.
  46121. */
  46122. function getType (fn) {
  46123. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  46124. return match ? match[1] : ''
  46125. }
  46126. function isSameType (a, b) {
  46127. return getType(a) === getType(b)
  46128. }
  46129. function getTypeIndex (type, expectedTypes) {
  46130. if (!Array.isArray(expectedTypes)) {
  46131. return isSameType(expectedTypes, type) ? 0 : -1
  46132. }
  46133. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  46134. if (isSameType(expectedTypes[i], type)) {
  46135. return i
  46136. }
  46137. }
  46138. return -1
  46139. }
  46140. function getInvalidTypeMessage (name, value, expectedTypes) {
  46141. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  46142. " Expected " + (expectedTypes.map(capitalize).join(', '));
  46143. var expectedType = expectedTypes[0];
  46144. var receivedType = toRawType(value);
  46145. var expectedValue = styleValue(value, expectedType);
  46146. var receivedValue = styleValue(value, receivedType);
  46147. // check if we need to specify expected value
  46148. if (expectedTypes.length === 1 &&
  46149. isExplicable(expectedType) &&
  46150. !isBoolean(expectedType, receivedType)) {
  46151. message += " with value " + expectedValue;
  46152. }
  46153. message += ", got " + receivedType + " ";
  46154. // check if we need to specify received value
  46155. if (isExplicable(receivedType)) {
  46156. message += "with value " + receivedValue + ".";
  46157. }
  46158. return message
  46159. }
  46160. function styleValue (value, type) {
  46161. if (type === 'String') {
  46162. return ("\"" + value + "\"")
  46163. } else if (type === 'Number') {
  46164. return ("" + (Number(value)))
  46165. } else {
  46166. return ("" + value)
  46167. }
  46168. }
  46169. function isExplicable (value) {
  46170. var explicitTypes = ['string', 'number', 'boolean'];
  46171. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  46172. }
  46173. function isBoolean () {
  46174. var args = [], len = arguments.length;
  46175. while ( len-- ) args[ len ] = arguments[ len ];
  46176. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  46177. }
  46178. /* */
  46179. function handleError (err, vm, info) {
  46180. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  46181. // See: https://github.com/vuejs/vuex/issues/1505
  46182. pushTarget();
  46183. try {
  46184. if (vm) {
  46185. var cur = vm;
  46186. while ((cur = cur.$parent)) {
  46187. var hooks = cur.$options.errorCaptured;
  46188. if (hooks) {
  46189. for (var i = 0; i < hooks.length; i++) {
  46190. try {
  46191. var capture = hooks[i].call(cur, err, vm, info) === false;
  46192. if (capture) { return }
  46193. } catch (e) {
  46194. globalHandleError(e, cur, 'errorCaptured hook');
  46195. }
  46196. }
  46197. }
  46198. }
  46199. }
  46200. globalHandleError(err, vm, info);
  46201. } finally {
  46202. popTarget();
  46203. }
  46204. }
  46205. function invokeWithErrorHandling (
  46206. handler,
  46207. context,
  46208. args,
  46209. vm,
  46210. info
  46211. ) {
  46212. var res;
  46213. try {
  46214. res = args ? handler.apply(context, args) : handler.call(context);
  46215. if (res && !res._isVue && isPromise(res) && !res._handled) {
  46216. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  46217. // issue #9511
  46218. // avoid catch triggering multiple times when nested calls
  46219. res._handled = true;
  46220. }
  46221. } catch (e) {
  46222. handleError(e, vm, info);
  46223. }
  46224. return res
  46225. }
  46226. function globalHandleError (err, vm, info) {
  46227. if (config.errorHandler) {
  46228. try {
  46229. return config.errorHandler.call(null, err, vm, info)
  46230. } catch (e) {
  46231. // if the user intentionally throws the original error in the handler,
  46232. // do not log it twice
  46233. if (e !== err) {
  46234. logError(e, null, 'config.errorHandler');
  46235. }
  46236. }
  46237. }
  46238. logError(err, vm, info);
  46239. }
  46240. function logError (err, vm, info) {
  46241. {
  46242. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  46243. }
  46244. /* istanbul ignore else */
  46245. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  46246. console.error(err);
  46247. } else {
  46248. throw err
  46249. }
  46250. }
  46251. /* */
  46252. var isUsingMicroTask = false;
  46253. var callbacks = [];
  46254. var pending = false;
  46255. function flushCallbacks () {
  46256. pending = false;
  46257. var copies = callbacks.slice(0);
  46258. callbacks.length = 0;
  46259. for (var i = 0; i < copies.length; i++) {
  46260. copies[i]();
  46261. }
  46262. }
  46263. // Here we have async deferring wrappers using microtasks.
  46264. // In 2.5 we used (macro) tasks (in combination with microtasks).
  46265. // However, it has subtle problems when state is changed right before repaint
  46266. // (e.g. #6813, out-in transitions).
  46267. // Also, using (macro) tasks in event handler would cause some weird behaviors
  46268. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  46269. // So we now use microtasks everywhere, again.
  46270. // A major drawback of this tradeoff is that there are some scenarios
  46271. // where microtasks have too high a priority and fire in between supposedly
  46272. // sequential events (e.g. #4521, #6690, which have workarounds)
  46273. // or even between bubbling of the same event (#6566).
  46274. var timerFunc;
  46275. // The nextTick behavior leverages the microtask queue, which can be accessed
  46276. // via either native Promise.then or MutationObserver.
  46277. // MutationObserver has wider support, however it is seriously bugged in
  46278. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  46279. // completely stops working after triggering a few times... so, if native
  46280. // Promise is available, we will use it:
  46281. /* istanbul ignore next, $flow-disable-line */
  46282. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  46283. var p = Promise.resolve();
  46284. timerFunc = function () {
  46285. p.then(flushCallbacks);
  46286. // In problematic UIWebViews, Promise.then doesn't completely break, but
  46287. // it can get stuck in a weird state where callbacks are pushed into the
  46288. // microtask queue but the queue isn't being flushed, until the browser
  46289. // needs to do some other work, e.g. handle a timer. Therefore we can
  46290. // "force" the microtask queue to be flushed by adding an empty timer.
  46291. if (isIOS) { setTimeout(noop); }
  46292. };
  46293. isUsingMicroTask = true;
  46294. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  46295. isNative(MutationObserver) ||
  46296. // PhantomJS and iOS 7.x
  46297. MutationObserver.toString() === '[object MutationObserverConstructor]'
  46298. )) {
  46299. // Use MutationObserver where native Promise is not available,
  46300. // e.g. PhantomJS, iOS7, Android 4.4
  46301. // (#6466 MutationObserver is unreliable in IE11)
  46302. var counter = 1;
  46303. var observer = new MutationObserver(flushCallbacks);
  46304. var textNode = document.createTextNode(String(counter));
  46305. observer.observe(textNode, {
  46306. characterData: true
  46307. });
  46308. timerFunc = function () {
  46309. counter = (counter + 1) % 2;
  46310. textNode.data = String(counter);
  46311. };
  46312. isUsingMicroTask = true;
  46313. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  46314. // Fallback to setImmediate.
  46315. // Technically it leverages the (macro) task queue,
  46316. // but it is still a better choice than setTimeout.
  46317. timerFunc = function () {
  46318. setImmediate(flushCallbacks);
  46319. };
  46320. } else {
  46321. // Fallback to setTimeout.
  46322. timerFunc = function () {
  46323. setTimeout(flushCallbacks, 0);
  46324. };
  46325. }
  46326. function nextTick (cb, ctx) {
  46327. var _resolve;
  46328. callbacks.push(function () {
  46329. if (cb) {
  46330. try {
  46331. cb.call(ctx);
  46332. } catch (e) {
  46333. handleError(e, ctx, 'nextTick');
  46334. }
  46335. } else if (_resolve) {
  46336. _resolve(ctx);
  46337. }
  46338. });
  46339. if (!pending) {
  46340. pending = true;
  46341. timerFunc();
  46342. }
  46343. // $flow-disable-line
  46344. if (!cb && typeof Promise !== 'undefined') {
  46345. return new Promise(function (resolve) {
  46346. _resolve = resolve;
  46347. })
  46348. }
  46349. }
  46350. /* */
  46351. var mark;
  46352. var measure;
  46353. {
  46354. var perf = inBrowser && window.performance;
  46355. /* istanbul ignore if */
  46356. if (
  46357. perf &&
  46358. perf.mark &&
  46359. perf.measure &&
  46360. perf.clearMarks &&
  46361. perf.clearMeasures
  46362. ) {
  46363. mark = function (tag) { return perf.mark(tag); };
  46364. measure = function (name, startTag, endTag) {
  46365. perf.measure(name, startTag, endTag);
  46366. perf.clearMarks(startTag);
  46367. perf.clearMarks(endTag);
  46368. // perf.clearMeasures(name)
  46369. };
  46370. }
  46371. }
  46372. /* not type checking this file because flow doesn't play well with Proxy */
  46373. var initProxy;
  46374. {
  46375. var allowedGlobals = makeMap(
  46376. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  46377. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  46378. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  46379. 'require' // for Webpack/Browserify
  46380. );
  46381. var warnNonPresent = function (target, key) {
  46382. warn(
  46383. "Property or method \"" + key + "\" is not defined on the instance but " +
  46384. 'referenced during render. Make sure that this property is reactive, ' +
  46385. 'either in the data option, or for class-based components, by ' +
  46386. 'initializing the property. ' +
  46387. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  46388. target
  46389. );
  46390. };
  46391. var warnReservedPrefix = function (target, key) {
  46392. warn(
  46393. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  46394. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  46395. 'prevent conflicts with Vue internals. ' +
  46396. 'See: https://vuejs.org/v2/api/#data',
  46397. target
  46398. );
  46399. };
  46400. var hasProxy =
  46401. typeof Proxy !== 'undefined' && isNative(Proxy);
  46402. if (hasProxy) {
  46403. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  46404. config.keyCodes = new Proxy(config.keyCodes, {
  46405. set: function set (target, key, value) {
  46406. if (isBuiltInModifier(key)) {
  46407. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  46408. return false
  46409. } else {
  46410. target[key] = value;
  46411. return true
  46412. }
  46413. }
  46414. });
  46415. }
  46416. var hasHandler = {
  46417. has: function has (target, key) {
  46418. var has = key in target;
  46419. var isAllowed = allowedGlobals(key) ||
  46420. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  46421. if (!has && !isAllowed) {
  46422. if (key in target.$data) { warnReservedPrefix(target, key); }
  46423. else { warnNonPresent(target, key); }
  46424. }
  46425. return has || !isAllowed
  46426. }
  46427. };
  46428. var getHandler = {
  46429. get: function get (target, key) {
  46430. if (typeof key === 'string' && !(key in target)) {
  46431. if (key in target.$data) { warnReservedPrefix(target, key); }
  46432. else { warnNonPresent(target, key); }
  46433. }
  46434. return target[key]
  46435. }
  46436. };
  46437. initProxy = function initProxy (vm) {
  46438. if (hasProxy) {
  46439. // determine which proxy handler to use
  46440. var options = vm.$options;
  46441. var handlers = options.render && options.render._withStripped
  46442. ? getHandler
  46443. : hasHandler;
  46444. vm._renderProxy = new Proxy(vm, handlers);
  46445. } else {
  46446. vm._renderProxy = vm;
  46447. }
  46448. };
  46449. }
  46450. /* */
  46451. var seenObjects = new _Set();
  46452. /**
  46453. * Recursively traverse an object to evoke all converted
  46454. * getters, so that every nested property inside the object
  46455. * is collected as a "deep" dependency.
  46456. */
  46457. function traverse (val) {
  46458. _traverse(val, seenObjects);
  46459. seenObjects.clear();
  46460. }
  46461. function _traverse (val, seen) {
  46462. var i, keys;
  46463. var isA = Array.isArray(val);
  46464. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  46465. return
  46466. }
  46467. if (val.__ob__) {
  46468. var depId = val.__ob__.dep.id;
  46469. if (seen.has(depId)) {
  46470. return
  46471. }
  46472. seen.add(depId);
  46473. }
  46474. if (isA) {
  46475. i = val.length;
  46476. while (i--) { _traverse(val[i], seen); }
  46477. } else {
  46478. keys = Object.keys(val);
  46479. i = keys.length;
  46480. while (i--) { _traverse(val[keys[i]], seen); }
  46481. }
  46482. }
  46483. /* */
  46484. var normalizeEvent = cached(function (name) {
  46485. var passive = name.charAt(0) === '&';
  46486. name = passive ? name.slice(1) : name;
  46487. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  46488. name = once$$1 ? name.slice(1) : name;
  46489. var capture = name.charAt(0) === '!';
  46490. name = capture ? name.slice(1) : name;
  46491. return {
  46492. name: name,
  46493. once: once$$1,
  46494. capture: capture,
  46495. passive: passive
  46496. }
  46497. });
  46498. function createFnInvoker (fns, vm) {
  46499. function invoker () {
  46500. var arguments$1 = arguments;
  46501. var fns = invoker.fns;
  46502. if (Array.isArray(fns)) {
  46503. var cloned = fns.slice();
  46504. for (var i = 0; i < cloned.length; i++) {
  46505. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  46506. }
  46507. } else {
  46508. // return handler return value for single handlers
  46509. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  46510. }
  46511. }
  46512. invoker.fns = fns;
  46513. return invoker
  46514. }
  46515. function updateListeners (
  46516. on,
  46517. oldOn,
  46518. add,
  46519. remove$$1,
  46520. createOnceHandler,
  46521. vm
  46522. ) {
  46523. var name, def$$1, cur, old, event;
  46524. for (name in on) {
  46525. def$$1 = cur = on[name];
  46526. old = oldOn[name];
  46527. event = normalizeEvent(name);
  46528. if (isUndef(cur)) {
  46529. warn(
  46530. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  46531. vm
  46532. );
  46533. } else if (isUndef(old)) {
  46534. if (isUndef(cur.fns)) {
  46535. cur = on[name] = createFnInvoker(cur, vm);
  46536. }
  46537. if (isTrue(event.once)) {
  46538. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  46539. }
  46540. add(event.name, cur, event.capture, event.passive, event.params);
  46541. } else if (cur !== old) {
  46542. old.fns = cur;
  46543. on[name] = old;
  46544. }
  46545. }
  46546. for (name in oldOn) {
  46547. if (isUndef(on[name])) {
  46548. event = normalizeEvent(name);
  46549. remove$$1(event.name, oldOn[name], event.capture);
  46550. }
  46551. }
  46552. }
  46553. /* */
  46554. function mergeVNodeHook (def, hookKey, hook) {
  46555. if (def instanceof VNode) {
  46556. def = def.data.hook || (def.data.hook = {});
  46557. }
  46558. var invoker;
  46559. var oldHook = def[hookKey];
  46560. function wrappedHook () {
  46561. hook.apply(this, arguments);
  46562. // important: remove merged hook to ensure it's called only once
  46563. // and prevent memory leak
  46564. remove(invoker.fns, wrappedHook);
  46565. }
  46566. if (isUndef(oldHook)) {
  46567. // no existing hook
  46568. invoker = createFnInvoker([wrappedHook]);
  46569. } else {
  46570. /* istanbul ignore if */
  46571. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  46572. // already a merged invoker
  46573. invoker = oldHook;
  46574. invoker.fns.push(wrappedHook);
  46575. } else {
  46576. // existing plain hook
  46577. invoker = createFnInvoker([oldHook, wrappedHook]);
  46578. }
  46579. }
  46580. invoker.merged = true;
  46581. def[hookKey] = invoker;
  46582. }
  46583. /* */
  46584. function extractPropsFromVNodeData (
  46585. data,
  46586. Ctor,
  46587. tag
  46588. ) {
  46589. // we are only extracting raw values here.
  46590. // validation and default values are handled in the child
  46591. // component itself.
  46592. var propOptions = Ctor.options.props;
  46593. if (isUndef(propOptions)) {
  46594. return
  46595. }
  46596. var res = {};
  46597. var attrs = data.attrs;
  46598. var props = data.props;
  46599. if (isDef(attrs) || isDef(props)) {
  46600. for (var key in propOptions) {
  46601. var altKey = hyphenate(key);
  46602. {
  46603. var keyInLowerCase = key.toLowerCase();
  46604. if (
  46605. key !== keyInLowerCase &&
  46606. attrs && hasOwn(attrs, keyInLowerCase)
  46607. ) {
  46608. tip(
  46609. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  46610. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  46611. " \"" + key + "\". " +
  46612. "Note that HTML attributes are case-insensitive and camelCased " +
  46613. "props need to use their kebab-case equivalents when using in-DOM " +
  46614. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  46615. );
  46616. }
  46617. }
  46618. checkProp(res, props, key, altKey, true) ||
  46619. checkProp(res, attrs, key, altKey, false);
  46620. }
  46621. }
  46622. return res
  46623. }
  46624. function checkProp (
  46625. res,
  46626. hash,
  46627. key,
  46628. altKey,
  46629. preserve
  46630. ) {
  46631. if (isDef(hash)) {
  46632. if (hasOwn(hash, key)) {
  46633. res[key] = hash[key];
  46634. if (!preserve) {
  46635. delete hash[key];
  46636. }
  46637. return true
  46638. } else if (hasOwn(hash, altKey)) {
  46639. res[key] = hash[altKey];
  46640. if (!preserve) {
  46641. delete hash[altKey];
  46642. }
  46643. return true
  46644. }
  46645. }
  46646. return false
  46647. }
  46648. /* */
  46649. // The template compiler attempts to minimize the need for normalization by
  46650. // statically analyzing the template at compile time.
  46651. //
  46652. // For plain HTML markup, normalization can be completely skipped because the
  46653. // generated render function is guaranteed to return Array<VNode>. There are
  46654. // two cases where extra normalization is needed:
  46655. // 1. When the children contains components - because a functional component
  46656. // may return an Array instead of a single root. In this case, just a simple
  46657. // normalization is needed - if any child is an Array, we flatten the whole
  46658. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  46659. // because functional components already normalize their own children.
  46660. function simpleNormalizeChildren (children) {
  46661. for (var i = 0; i < children.length; i++) {
  46662. if (Array.isArray(children[i])) {
  46663. return Array.prototype.concat.apply([], children)
  46664. }
  46665. }
  46666. return children
  46667. }
  46668. // 2. When the children contains constructs that always generated nested Arrays,
  46669. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  46670. // with hand-written render functions / JSX. In such cases a full normalization
  46671. // is needed to cater to all possible types of children values.
  46672. function normalizeChildren (children) {
  46673. return isPrimitive(children)
  46674. ? [createTextVNode(children)]
  46675. : Array.isArray(children)
  46676. ? normalizeArrayChildren(children)
  46677. : undefined
  46678. }
  46679. function isTextNode (node) {
  46680. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  46681. }
  46682. function normalizeArrayChildren (children, nestedIndex) {
  46683. var res = [];
  46684. var i, c, lastIndex, last;
  46685. for (i = 0; i < children.length; i++) {
  46686. c = children[i];
  46687. if (isUndef(c) || typeof c === 'boolean') { continue }
  46688. lastIndex = res.length - 1;
  46689. last = res[lastIndex];
  46690. // nested
  46691. if (Array.isArray(c)) {
  46692. if (c.length > 0) {
  46693. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  46694. // merge adjacent text nodes
  46695. if (isTextNode(c[0]) && isTextNode(last)) {
  46696. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  46697. c.shift();
  46698. }
  46699. res.push.apply(res, c);
  46700. }
  46701. } else if (isPrimitive(c)) {
  46702. if (isTextNode(last)) {
  46703. // merge adjacent text nodes
  46704. // this is necessary for SSR hydration because text nodes are
  46705. // essentially merged when rendered to HTML strings
  46706. res[lastIndex] = createTextVNode(last.text + c);
  46707. } else if (c !== '') {
  46708. // convert primitive to vnode
  46709. res.push(createTextVNode(c));
  46710. }
  46711. } else {
  46712. if (isTextNode(c) && isTextNode(last)) {
  46713. // merge adjacent text nodes
  46714. res[lastIndex] = createTextVNode(last.text + c.text);
  46715. } else {
  46716. // default key for nested array children (likely generated by v-for)
  46717. if (isTrue(children._isVList) &&
  46718. isDef(c.tag) &&
  46719. isUndef(c.key) &&
  46720. isDef(nestedIndex)) {
  46721. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  46722. }
  46723. res.push(c);
  46724. }
  46725. }
  46726. }
  46727. return res
  46728. }
  46729. /* */
  46730. function initProvide (vm) {
  46731. var provide = vm.$options.provide;
  46732. if (provide) {
  46733. vm._provided = typeof provide === 'function'
  46734. ? provide.call(vm)
  46735. : provide;
  46736. }
  46737. }
  46738. function initInjections (vm) {
  46739. var result = resolveInject(vm.$options.inject, vm);
  46740. if (result) {
  46741. toggleObserving(false);
  46742. Object.keys(result).forEach(function (key) {
  46743. /* istanbul ignore else */
  46744. {
  46745. defineReactive$$1(vm, key, result[key], function () {
  46746. warn(
  46747. "Avoid mutating an injected value directly since the changes will be " +
  46748. "overwritten whenever the provided component re-renders. " +
  46749. "injection being mutated: \"" + key + "\"",
  46750. vm
  46751. );
  46752. });
  46753. }
  46754. });
  46755. toggleObserving(true);
  46756. }
  46757. }
  46758. function resolveInject (inject, vm) {
  46759. if (inject) {
  46760. // inject is :any because flow is not smart enough to figure out cached
  46761. var result = Object.create(null);
  46762. var keys = hasSymbol
  46763. ? Reflect.ownKeys(inject)
  46764. : Object.keys(inject);
  46765. for (var i = 0; i < keys.length; i++) {
  46766. var key = keys[i];
  46767. // #6574 in case the inject object is observed...
  46768. if (key === '__ob__') { continue }
  46769. var provideKey = inject[key].from;
  46770. var source = vm;
  46771. while (source) {
  46772. if (source._provided && hasOwn(source._provided, provideKey)) {
  46773. result[key] = source._provided[provideKey];
  46774. break
  46775. }
  46776. source = source.$parent;
  46777. }
  46778. if (!source) {
  46779. if ('default' in inject[key]) {
  46780. var provideDefault = inject[key].default;
  46781. result[key] = typeof provideDefault === 'function'
  46782. ? provideDefault.call(vm)
  46783. : provideDefault;
  46784. } else {
  46785. warn(("Injection \"" + key + "\" not found"), vm);
  46786. }
  46787. }
  46788. }
  46789. return result
  46790. }
  46791. }
  46792. /* */
  46793. /**
  46794. * Runtime helper for resolving raw children VNodes into a slot object.
  46795. */
  46796. function resolveSlots (
  46797. children,
  46798. context
  46799. ) {
  46800. if (!children || !children.length) {
  46801. return {}
  46802. }
  46803. var slots = {};
  46804. for (var i = 0, l = children.length; i < l; i++) {
  46805. var child = children[i];
  46806. var data = child.data;
  46807. // remove slot attribute if the node is resolved as a Vue slot node
  46808. if (data && data.attrs && data.attrs.slot) {
  46809. delete data.attrs.slot;
  46810. }
  46811. // named slots should only be respected if the vnode was rendered in the
  46812. // same context.
  46813. if ((child.context === context || child.fnContext === context) &&
  46814. data && data.slot != null
  46815. ) {
  46816. var name = data.slot;
  46817. var slot = (slots[name] || (slots[name] = []));
  46818. if (child.tag === 'template') {
  46819. slot.push.apply(slot, child.children || []);
  46820. } else {
  46821. slot.push(child);
  46822. }
  46823. } else {
  46824. (slots.default || (slots.default = [])).push(child);
  46825. }
  46826. }
  46827. // ignore slots that contains only whitespace
  46828. for (var name$1 in slots) {
  46829. if (slots[name$1].every(isWhitespace)) {
  46830. delete slots[name$1];
  46831. }
  46832. }
  46833. return slots
  46834. }
  46835. function isWhitespace (node) {
  46836. return (node.isComment && !node.asyncFactory) || node.text === ' '
  46837. }
  46838. /* */
  46839. function normalizeScopedSlots (
  46840. slots,
  46841. normalSlots,
  46842. prevSlots
  46843. ) {
  46844. var res;
  46845. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  46846. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  46847. var key = slots && slots.$key;
  46848. if (!slots) {
  46849. res = {};
  46850. } else if (slots._normalized) {
  46851. // fast path 1: child component re-render only, parent did not change
  46852. return slots._normalized
  46853. } else if (
  46854. isStable &&
  46855. prevSlots &&
  46856. prevSlots !== emptyObject &&
  46857. key === prevSlots.$key &&
  46858. !hasNormalSlots &&
  46859. !prevSlots.$hasNormal
  46860. ) {
  46861. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  46862. // only need to normalize once
  46863. return prevSlots
  46864. } else {
  46865. res = {};
  46866. for (var key$1 in slots) {
  46867. if (slots[key$1] && key$1[0] !== '$') {
  46868. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  46869. }
  46870. }
  46871. }
  46872. // expose normal slots on scopedSlots
  46873. for (var key$2 in normalSlots) {
  46874. if (!(key$2 in res)) {
  46875. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  46876. }
  46877. }
  46878. // avoriaz seems to mock a non-extensible $scopedSlots object
  46879. // and when that is passed down this would cause an error
  46880. if (slots && Object.isExtensible(slots)) {
  46881. (slots)._normalized = res;
  46882. }
  46883. def(res, '$stable', isStable);
  46884. def(res, '$key', key);
  46885. def(res, '$hasNormal', hasNormalSlots);
  46886. return res
  46887. }
  46888. function normalizeScopedSlot(normalSlots, key, fn) {
  46889. var normalized = function () {
  46890. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  46891. res = res && typeof res === 'object' && !Array.isArray(res)
  46892. ? [res] // single vnode
  46893. : normalizeChildren(res);
  46894. return res && (
  46895. res.length === 0 ||
  46896. (res.length === 1 && res[0].isComment) // #9658
  46897. ) ? undefined
  46898. : res
  46899. };
  46900. // this is a slot using the new v-slot syntax without scope. although it is
  46901. // compiled as a scoped slot, render fn users would expect it to be present
  46902. // on this.$slots because the usage is semantically a normal slot.
  46903. if (fn.proxy) {
  46904. Object.defineProperty(normalSlots, key, {
  46905. get: normalized,
  46906. enumerable: true,
  46907. configurable: true
  46908. });
  46909. }
  46910. return normalized
  46911. }
  46912. function proxyNormalSlot(slots, key) {
  46913. return function () { return slots[key]; }
  46914. }
  46915. /* */
  46916. /**
  46917. * Runtime helper for rendering v-for lists.
  46918. */
  46919. function renderList (
  46920. val,
  46921. render
  46922. ) {
  46923. var ret, i, l, keys, key;
  46924. if (Array.isArray(val) || typeof val === 'string') {
  46925. ret = new Array(val.length);
  46926. for (i = 0, l = val.length; i < l; i++) {
  46927. ret[i] = render(val[i], i);
  46928. }
  46929. } else if (typeof val === 'number') {
  46930. ret = new Array(val);
  46931. for (i = 0; i < val; i++) {
  46932. ret[i] = render(i + 1, i);
  46933. }
  46934. } else if (isObject(val)) {
  46935. if (hasSymbol && val[Symbol.iterator]) {
  46936. ret = [];
  46937. var iterator = val[Symbol.iterator]();
  46938. var result = iterator.next();
  46939. while (!result.done) {
  46940. ret.push(render(result.value, ret.length));
  46941. result = iterator.next();
  46942. }
  46943. } else {
  46944. keys = Object.keys(val);
  46945. ret = new Array(keys.length);
  46946. for (i = 0, l = keys.length; i < l; i++) {
  46947. key = keys[i];
  46948. ret[i] = render(val[key], key, i);
  46949. }
  46950. }
  46951. }
  46952. if (!isDef(ret)) {
  46953. ret = [];
  46954. }
  46955. (ret)._isVList = true;
  46956. return ret
  46957. }
  46958. /* */
  46959. /**
  46960. * Runtime helper for rendering <slot>
  46961. */
  46962. function renderSlot (
  46963. name,
  46964. fallback,
  46965. props,
  46966. bindObject
  46967. ) {
  46968. var scopedSlotFn = this.$scopedSlots[name];
  46969. var nodes;
  46970. if (scopedSlotFn) { // scoped slot
  46971. props = props || {};
  46972. if (bindObject) {
  46973. if (!isObject(bindObject)) {
  46974. warn(
  46975. 'slot v-bind without argument expects an Object',
  46976. this
  46977. );
  46978. }
  46979. props = extend(extend({}, bindObject), props);
  46980. }
  46981. nodes = scopedSlotFn(props) || fallback;
  46982. } else {
  46983. nodes = this.$slots[name] || fallback;
  46984. }
  46985. var target = props && props.slot;
  46986. if (target) {
  46987. return this.$createElement('template', { slot: target }, nodes)
  46988. } else {
  46989. return nodes
  46990. }
  46991. }
  46992. /* */
  46993. /**
  46994. * Runtime helper for resolving filters
  46995. */
  46996. function resolveFilter (id) {
  46997. return resolveAsset(this.$options, 'filters', id, true) || identity
  46998. }
  46999. /* */
  47000. function isKeyNotMatch (expect, actual) {
  47001. if (Array.isArray(expect)) {
  47002. return expect.indexOf(actual) === -1
  47003. } else {
  47004. return expect !== actual
  47005. }
  47006. }
  47007. /**
  47008. * Runtime helper for checking keyCodes from config.
  47009. * exposed as Vue.prototype._k
  47010. * passing in eventKeyName as last argument separately for backwards compat
  47011. */
  47012. function checkKeyCodes (
  47013. eventKeyCode,
  47014. key,
  47015. builtInKeyCode,
  47016. eventKeyName,
  47017. builtInKeyName
  47018. ) {
  47019. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  47020. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  47021. return isKeyNotMatch(builtInKeyName, eventKeyName)
  47022. } else if (mappedKeyCode) {
  47023. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  47024. } else if (eventKeyName) {
  47025. return hyphenate(eventKeyName) !== key
  47026. }
  47027. }
  47028. /* */
  47029. /**
  47030. * Runtime helper for merging v-bind="object" into a VNode's data.
  47031. */
  47032. function bindObjectProps (
  47033. data,
  47034. tag,
  47035. value,
  47036. asProp,
  47037. isSync
  47038. ) {
  47039. if (value) {
  47040. if (!isObject(value)) {
  47041. warn(
  47042. 'v-bind without argument expects an Object or Array value',
  47043. this
  47044. );
  47045. } else {
  47046. if (Array.isArray(value)) {
  47047. value = toObject(value);
  47048. }
  47049. var hash;
  47050. var loop = function ( key ) {
  47051. if (
  47052. key === 'class' ||
  47053. key === 'style' ||
  47054. isReservedAttribute(key)
  47055. ) {
  47056. hash = data;
  47057. } else {
  47058. var type = data.attrs && data.attrs.type;
  47059. hash = asProp || config.mustUseProp(tag, type, key)
  47060. ? data.domProps || (data.domProps = {})
  47061. : data.attrs || (data.attrs = {});
  47062. }
  47063. var camelizedKey = camelize(key);
  47064. var hyphenatedKey = hyphenate(key);
  47065. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  47066. hash[key] = value[key];
  47067. if (isSync) {
  47068. var on = data.on || (data.on = {});
  47069. on[("update:" + key)] = function ($event) {
  47070. value[key] = $event;
  47071. };
  47072. }
  47073. }
  47074. };
  47075. for (var key in value) loop( key );
  47076. }
  47077. }
  47078. return data
  47079. }
  47080. /* */
  47081. /**
  47082. * Runtime helper for rendering static trees.
  47083. */
  47084. function renderStatic (
  47085. index,
  47086. isInFor
  47087. ) {
  47088. var cached = this._staticTrees || (this._staticTrees = []);
  47089. var tree = cached[index];
  47090. // if has already-rendered static tree and not inside v-for,
  47091. // we can reuse the same tree.
  47092. if (tree && !isInFor) {
  47093. return tree
  47094. }
  47095. // otherwise, render a fresh tree.
  47096. tree = cached[index] = this.$options.staticRenderFns[index].call(
  47097. this._renderProxy,
  47098. null,
  47099. this // for render fns generated for functional component templates
  47100. );
  47101. markStatic(tree, ("__static__" + index), false);
  47102. return tree
  47103. }
  47104. /**
  47105. * Runtime helper for v-once.
  47106. * Effectively it means marking the node as static with a unique key.
  47107. */
  47108. function markOnce (
  47109. tree,
  47110. index,
  47111. key
  47112. ) {
  47113. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  47114. return tree
  47115. }
  47116. function markStatic (
  47117. tree,
  47118. key,
  47119. isOnce
  47120. ) {
  47121. if (Array.isArray(tree)) {
  47122. for (var i = 0; i < tree.length; i++) {
  47123. if (tree[i] && typeof tree[i] !== 'string') {
  47124. markStaticNode(tree[i], (key + "_" + i), isOnce);
  47125. }
  47126. }
  47127. } else {
  47128. markStaticNode(tree, key, isOnce);
  47129. }
  47130. }
  47131. function markStaticNode (node, key, isOnce) {
  47132. node.isStatic = true;
  47133. node.key = key;
  47134. node.isOnce = isOnce;
  47135. }
  47136. /* */
  47137. function bindObjectListeners (data, value) {
  47138. if (value) {
  47139. if (!isPlainObject(value)) {
  47140. warn(
  47141. 'v-on without argument expects an Object value',
  47142. this
  47143. );
  47144. } else {
  47145. var on = data.on = data.on ? extend({}, data.on) : {};
  47146. for (var key in value) {
  47147. var existing = on[key];
  47148. var ours = value[key];
  47149. on[key] = existing ? [].concat(existing, ours) : ours;
  47150. }
  47151. }
  47152. }
  47153. return data
  47154. }
  47155. /* */
  47156. function resolveScopedSlots (
  47157. fns, // see flow/vnode
  47158. res,
  47159. // the following are added in 2.6
  47160. hasDynamicKeys,
  47161. contentHashKey
  47162. ) {
  47163. res = res || { $stable: !hasDynamicKeys };
  47164. for (var i = 0; i < fns.length; i++) {
  47165. var slot = fns[i];
  47166. if (Array.isArray(slot)) {
  47167. resolveScopedSlots(slot, res, hasDynamicKeys);
  47168. } else if (slot) {
  47169. // marker for reverse proxying v-slot without scope on this.$slots
  47170. if (slot.proxy) {
  47171. slot.fn.proxy = true;
  47172. }
  47173. res[slot.key] = slot.fn;
  47174. }
  47175. }
  47176. if (contentHashKey) {
  47177. (res).$key = contentHashKey;
  47178. }
  47179. return res
  47180. }
  47181. /* */
  47182. function bindDynamicKeys (baseObj, values) {
  47183. for (var i = 0; i < values.length; i += 2) {
  47184. var key = values[i];
  47185. if (typeof key === 'string' && key) {
  47186. baseObj[values[i]] = values[i + 1];
  47187. } else if (key !== '' && key !== null) {
  47188. // null is a special value for explicitly removing a binding
  47189. warn(
  47190. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  47191. this
  47192. );
  47193. }
  47194. }
  47195. return baseObj
  47196. }
  47197. // helper to dynamically append modifier runtime markers to event names.
  47198. // ensure only append when value is already string, otherwise it will be cast
  47199. // to string and cause the type check to miss.
  47200. function prependModifier (value, symbol) {
  47201. return typeof value === 'string' ? symbol + value : value
  47202. }
  47203. /* */
  47204. function installRenderHelpers (target) {
  47205. target._o = markOnce;
  47206. target._n = toNumber;
  47207. target._s = toString;
  47208. target._l = renderList;
  47209. target._t = renderSlot;
  47210. target._q = looseEqual;
  47211. target._i = looseIndexOf;
  47212. target._m = renderStatic;
  47213. target._f = resolveFilter;
  47214. target._k = checkKeyCodes;
  47215. target._b = bindObjectProps;
  47216. target._v = createTextVNode;
  47217. target._e = createEmptyVNode;
  47218. target._u = resolveScopedSlots;
  47219. target._g = bindObjectListeners;
  47220. target._d = bindDynamicKeys;
  47221. target._p = prependModifier;
  47222. }
  47223. /* */
  47224. function FunctionalRenderContext (
  47225. data,
  47226. props,
  47227. children,
  47228. parent,
  47229. Ctor
  47230. ) {
  47231. var this$1 = this;
  47232. var options = Ctor.options;
  47233. // ensure the createElement function in functional components
  47234. // gets a unique context - this is necessary for correct named slot check
  47235. var contextVm;
  47236. if (hasOwn(parent, '_uid')) {
  47237. contextVm = Object.create(parent);
  47238. // $flow-disable-line
  47239. contextVm._original = parent;
  47240. } else {
  47241. // the context vm passed in is a functional context as well.
  47242. // in this case we want to make sure we are able to get a hold to the
  47243. // real context instance.
  47244. contextVm = parent;
  47245. // $flow-disable-line
  47246. parent = parent._original;
  47247. }
  47248. var isCompiled = isTrue(options._compiled);
  47249. var needNormalization = !isCompiled;
  47250. this.data = data;
  47251. this.props = props;
  47252. this.children = children;
  47253. this.parent = parent;
  47254. this.listeners = data.on || emptyObject;
  47255. this.injections = resolveInject(options.inject, parent);
  47256. this.slots = function () {
  47257. if (!this$1.$slots) {
  47258. normalizeScopedSlots(
  47259. data.scopedSlots,
  47260. this$1.$slots = resolveSlots(children, parent)
  47261. );
  47262. }
  47263. return this$1.$slots
  47264. };
  47265. Object.defineProperty(this, 'scopedSlots', ({
  47266. enumerable: true,
  47267. get: function get () {
  47268. return normalizeScopedSlots(data.scopedSlots, this.slots())
  47269. }
  47270. }));
  47271. // support for compiled functional template
  47272. if (isCompiled) {
  47273. // exposing $options for renderStatic()
  47274. this.$options = options;
  47275. // pre-resolve slots for renderSlot()
  47276. this.$slots = this.slots();
  47277. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  47278. }
  47279. if (options._scopeId) {
  47280. this._c = function (a, b, c, d) {
  47281. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  47282. if (vnode && !Array.isArray(vnode)) {
  47283. vnode.fnScopeId = options._scopeId;
  47284. vnode.fnContext = parent;
  47285. }
  47286. return vnode
  47287. };
  47288. } else {
  47289. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  47290. }
  47291. }
  47292. installRenderHelpers(FunctionalRenderContext.prototype);
  47293. function createFunctionalComponent (
  47294. Ctor,
  47295. propsData,
  47296. data,
  47297. contextVm,
  47298. children
  47299. ) {
  47300. var options = Ctor.options;
  47301. var props = {};
  47302. var propOptions = options.props;
  47303. if (isDef(propOptions)) {
  47304. for (var key in propOptions) {
  47305. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  47306. }
  47307. } else {
  47308. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  47309. if (isDef(data.props)) { mergeProps(props, data.props); }
  47310. }
  47311. var renderContext = new FunctionalRenderContext(
  47312. data,
  47313. props,
  47314. children,
  47315. contextVm,
  47316. Ctor
  47317. );
  47318. var vnode = options.render.call(null, renderContext._c, renderContext);
  47319. if (vnode instanceof VNode) {
  47320. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  47321. } else if (Array.isArray(vnode)) {
  47322. var vnodes = normalizeChildren(vnode) || [];
  47323. var res = new Array(vnodes.length);
  47324. for (var i = 0; i < vnodes.length; i++) {
  47325. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  47326. }
  47327. return res
  47328. }
  47329. }
  47330. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  47331. // #7817 clone node before setting fnContext, otherwise if the node is reused
  47332. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  47333. // that should not be matched to match.
  47334. var clone = cloneVNode(vnode);
  47335. clone.fnContext = contextVm;
  47336. clone.fnOptions = options;
  47337. {
  47338. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  47339. }
  47340. if (data.slot) {
  47341. (clone.data || (clone.data = {})).slot = data.slot;
  47342. }
  47343. return clone
  47344. }
  47345. function mergeProps (to, from) {
  47346. for (var key in from) {
  47347. to[camelize(key)] = from[key];
  47348. }
  47349. }
  47350. /* */
  47351. /* */
  47352. /* */
  47353. /* */
  47354. // inline hooks to be invoked on component VNodes during patch
  47355. var componentVNodeHooks = {
  47356. init: function init (vnode, hydrating) {
  47357. if (
  47358. vnode.componentInstance &&
  47359. !vnode.componentInstance._isDestroyed &&
  47360. vnode.data.keepAlive
  47361. ) {
  47362. // kept-alive components, treat as a patch
  47363. var mountedNode = vnode; // work around flow
  47364. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  47365. } else {
  47366. var child = vnode.componentInstance = createComponentInstanceForVnode(
  47367. vnode,
  47368. activeInstance
  47369. );
  47370. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  47371. }
  47372. },
  47373. prepatch: function prepatch (oldVnode, vnode) {
  47374. var options = vnode.componentOptions;
  47375. var child = vnode.componentInstance = oldVnode.componentInstance;
  47376. updateChildComponent(
  47377. child,
  47378. options.propsData, // updated props
  47379. options.listeners, // updated listeners
  47380. vnode, // new parent vnode
  47381. options.children // new children
  47382. );
  47383. },
  47384. insert: function insert (vnode) {
  47385. var context = vnode.context;
  47386. var componentInstance = vnode.componentInstance;
  47387. if (!componentInstance._isMounted) {
  47388. componentInstance._isMounted = true;
  47389. callHook(componentInstance, 'mounted');
  47390. }
  47391. if (vnode.data.keepAlive) {
  47392. if (context._isMounted) {
  47393. // vue-router#1212
  47394. // During updates, a kept-alive component's child components may
  47395. // change, so directly walking the tree here may call activated hooks
  47396. // on incorrect children. Instead we push them into a queue which will
  47397. // be processed after the whole patch process ended.
  47398. queueActivatedComponent(componentInstance);
  47399. } else {
  47400. activateChildComponent(componentInstance, true /* direct */);
  47401. }
  47402. }
  47403. },
  47404. destroy: function destroy (vnode) {
  47405. var componentInstance = vnode.componentInstance;
  47406. if (!componentInstance._isDestroyed) {
  47407. if (!vnode.data.keepAlive) {
  47408. componentInstance.$destroy();
  47409. } else {
  47410. deactivateChildComponent(componentInstance, true /* direct */);
  47411. }
  47412. }
  47413. }
  47414. };
  47415. var hooksToMerge = Object.keys(componentVNodeHooks);
  47416. function createComponent (
  47417. Ctor,
  47418. data,
  47419. context,
  47420. children,
  47421. tag
  47422. ) {
  47423. if (isUndef(Ctor)) {
  47424. return
  47425. }
  47426. var baseCtor = context.$options._base;
  47427. // plain options object: turn it into a constructor
  47428. if (isObject(Ctor)) {
  47429. Ctor = baseCtor.extend(Ctor);
  47430. }
  47431. // if at this stage it's not a constructor or an async component factory,
  47432. // reject.
  47433. if (typeof Ctor !== 'function') {
  47434. {
  47435. warn(("Invalid Component definition: " + (String(Ctor))), context);
  47436. }
  47437. return
  47438. }
  47439. // async component
  47440. var asyncFactory;
  47441. if (isUndef(Ctor.cid)) {
  47442. asyncFactory = Ctor;
  47443. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  47444. if (Ctor === undefined) {
  47445. // return a placeholder node for async component, which is rendered
  47446. // as a comment node but preserves all the raw information for the node.
  47447. // the information will be used for async server-rendering and hydration.
  47448. return createAsyncPlaceholder(
  47449. asyncFactory,
  47450. data,
  47451. context,
  47452. children,
  47453. tag
  47454. )
  47455. }
  47456. }
  47457. data = data || {};
  47458. // resolve constructor options in case global mixins are applied after
  47459. // component constructor creation
  47460. resolveConstructorOptions(Ctor);
  47461. // transform component v-model data into props & events
  47462. if (isDef(data.model)) {
  47463. transformModel(Ctor.options, data);
  47464. }
  47465. // extract props
  47466. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  47467. // functional component
  47468. if (isTrue(Ctor.options.functional)) {
  47469. return createFunctionalComponent(Ctor, propsData, data, context, children)
  47470. }
  47471. // extract listeners, since these needs to be treated as
  47472. // child component listeners instead of DOM listeners
  47473. var listeners = data.on;
  47474. // replace with listeners with .native modifier
  47475. // so it gets processed during parent component patch.
  47476. data.on = data.nativeOn;
  47477. if (isTrue(Ctor.options.abstract)) {
  47478. // abstract components do not keep anything
  47479. // other than props & listeners & slot
  47480. // work around flow
  47481. var slot = data.slot;
  47482. data = {};
  47483. if (slot) {
  47484. data.slot = slot;
  47485. }
  47486. }
  47487. // install component management hooks onto the placeholder node
  47488. installComponentHooks(data);
  47489. // return a placeholder vnode
  47490. var name = Ctor.options.name || tag;
  47491. var vnode = new VNode(
  47492. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  47493. data, undefined, undefined, undefined, context,
  47494. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  47495. asyncFactory
  47496. );
  47497. return vnode
  47498. }
  47499. function createComponentInstanceForVnode (
  47500. vnode, // we know it's MountedComponentVNode but flow doesn't
  47501. parent // activeInstance in lifecycle state
  47502. ) {
  47503. var options = {
  47504. _isComponent: true,
  47505. _parentVnode: vnode,
  47506. parent: parent
  47507. };
  47508. // check inline-template render functions
  47509. var inlineTemplate = vnode.data.inlineTemplate;
  47510. if (isDef(inlineTemplate)) {
  47511. options.render = inlineTemplate.render;
  47512. options.staticRenderFns = inlineTemplate.staticRenderFns;
  47513. }
  47514. return new vnode.componentOptions.Ctor(options)
  47515. }
  47516. function installComponentHooks (data) {
  47517. var hooks = data.hook || (data.hook = {});
  47518. for (var i = 0; i < hooksToMerge.length; i++) {
  47519. var key = hooksToMerge[i];
  47520. var existing = hooks[key];
  47521. var toMerge = componentVNodeHooks[key];
  47522. if (existing !== toMerge && !(existing && existing._merged)) {
  47523. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  47524. }
  47525. }
  47526. }
  47527. function mergeHook$1 (f1, f2) {
  47528. var merged = function (a, b) {
  47529. // flow complains about extra args which is why we use any
  47530. f1(a, b);
  47531. f2(a, b);
  47532. };
  47533. merged._merged = true;
  47534. return merged
  47535. }
  47536. // transform component v-model info (value and callback) into
  47537. // prop and event handler respectively.
  47538. function transformModel (options, data) {
  47539. var prop = (options.model && options.model.prop) || 'value';
  47540. var event = (options.model && options.model.event) || 'input'
  47541. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  47542. var on = data.on || (data.on = {});
  47543. var existing = on[event];
  47544. var callback = data.model.callback;
  47545. if (isDef(existing)) {
  47546. if (
  47547. Array.isArray(existing)
  47548. ? existing.indexOf(callback) === -1
  47549. : existing !== callback
  47550. ) {
  47551. on[event] = [callback].concat(existing);
  47552. }
  47553. } else {
  47554. on[event] = callback;
  47555. }
  47556. }
  47557. /* */
  47558. var SIMPLE_NORMALIZE = 1;
  47559. var ALWAYS_NORMALIZE = 2;
  47560. // wrapper function for providing a more flexible interface
  47561. // without getting yelled at by flow
  47562. function createElement (
  47563. context,
  47564. tag,
  47565. data,
  47566. children,
  47567. normalizationType,
  47568. alwaysNormalize
  47569. ) {
  47570. if (Array.isArray(data) || isPrimitive(data)) {
  47571. normalizationType = children;
  47572. children = data;
  47573. data = undefined;
  47574. }
  47575. if (isTrue(alwaysNormalize)) {
  47576. normalizationType = ALWAYS_NORMALIZE;
  47577. }
  47578. return _createElement(context, tag, data, children, normalizationType)
  47579. }
  47580. function _createElement (
  47581. context,
  47582. tag,
  47583. data,
  47584. children,
  47585. normalizationType
  47586. ) {
  47587. if (isDef(data) && isDef((data).__ob__)) {
  47588. warn(
  47589. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  47590. 'Always create fresh vnode data objects in each render!',
  47591. context
  47592. );
  47593. return createEmptyVNode()
  47594. }
  47595. // object syntax in v-bind
  47596. if (isDef(data) && isDef(data.is)) {
  47597. tag = data.is;
  47598. }
  47599. if (!tag) {
  47600. // in case of component :is set to falsy value
  47601. return createEmptyVNode()
  47602. }
  47603. // warn against non-primitive key
  47604. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  47605. ) {
  47606. {
  47607. warn(
  47608. 'Avoid using non-primitive value as key, ' +
  47609. 'use string/number value instead.',
  47610. context
  47611. );
  47612. }
  47613. }
  47614. // support single function children as default scoped slot
  47615. if (Array.isArray(children) &&
  47616. typeof children[0] === 'function'
  47617. ) {
  47618. data = data || {};
  47619. data.scopedSlots = { default: children[0] };
  47620. children.length = 0;
  47621. }
  47622. if (normalizationType === ALWAYS_NORMALIZE) {
  47623. children = normalizeChildren(children);
  47624. } else if (normalizationType === SIMPLE_NORMALIZE) {
  47625. children = simpleNormalizeChildren(children);
  47626. }
  47627. var vnode, ns;
  47628. if (typeof tag === 'string') {
  47629. var Ctor;
  47630. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  47631. if (config.isReservedTag(tag)) {
  47632. // platform built-in elements
  47633. if (isDef(data) && isDef(data.nativeOn)) {
  47634. warn(
  47635. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  47636. context
  47637. );
  47638. }
  47639. vnode = new VNode(
  47640. config.parsePlatformTagName(tag), data, children,
  47641. undefined, undefined, context
  47642. );
  47643. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  47644. // component
  47645. vnode = createComponent(Ctor, data, context, children, tag);
  47646. } else {
  47647. // unknown or unlisted namespaced elements
  47648. // check at runtime because it may get assigned a namespace when its
  47649. // parent normalizes children
  47650. vnode = new VNode(
  47651. tag, data, children,
  47652. undefined, undefined, context
  47653. );
  47654. }
  47655. } else {
  47656. // direct component options / constructor
  47657. vnode = createComponent(tag, data, context, children);
  47658. }
  47659. if (Array.isArray(vnode)) {
  47660. return vnode
  47661. } else if (isDef(vnode)) {
  47662. if (isDef(ns)) { applyNS(vnode, ns); }
  47663. if (isDef(data)) { registerDeepBindings(data); }
  47664. return vnode
  47665. } else {
  47666. return createEmptyVNode()
  47667. }
  47668. }
  47669. function applyNS (vnode, ns, force) {
  47670. vnode.ns = ns;
  47671. if (vnode.tag === 'foreignObject') {
  47672. // use default namespace inside foreignObject
  47673. ns = undefined;
  47674. force = true;
  47675. }
  47676. if (isDef(vnode.children)) {
  47677. for (var i = 0, l = vnode.children.length; i < l; i++) {
  47678. var child = vnode.children[i];
  47679. if (isDef(child.tag) && (
  47680. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  47681. applyNS(child, ns, force);
  47682. }
  47683. }
  47684. }
  47685. }
  47686. // ref #5318
  47687. // necessary to ensure parent re-render when deep bindings like :style and
  47688. // :class are used on slot nodes
  47689. function registerDeepBindings (data) {
  47690. if (isObject(data.style)) {
  47691. traverse(data.style);
  47692. }
  47693. if (isObject(data.class)) {
  47694. traverse(data.class);
  47695. }
  47696. }
  47697. /* */
  47698. function initRender (vm) {
  47699. vm._vnode = null; // the root of the child tree
  47700. vm._staticTrees = null; // v-once cached trees
  47701. var options = vm.$options;
  47702. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  47703. var renderContext = parentVnode && parentVnode.context;
  47704. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  47705. vm.$scopedSlots = emptyObject;
  47706. // bind the createElement fn to this instance
  47707. // so that we get proper render context inside it.
  47708. // args order: tag, data, children, normalizationType, alwaysNormalize
  47709. // internal version is used by render functions compiled from templates
  47710. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  47711. // normalization is always applied for the public version, used in
  47712. // user-written render functions.
  47713. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  47714. // $attrs & $listeners are exposed for easier HOC creation.
  47715. // they need to be reactive so that HOCs using them are always updated
  47716. var parentData = parentVnode && parentVnode.data;
  47717. /* istanbul ignore else */
  47718. {
  47719. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  47720. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  47721. }, true);
  47722. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  47723. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  47724. }, true);
  47725. }
  47726. }
  47727. var currentRenderingInstance = null;
  47728. function renderMixin (Vue) {
  47729. // install runtime convenience helpers
  47730. installRenderHelpers(Vue.prototype);
  47731. Vue.prototype.$nextTick = function (fn) {
  47732. return nextTick(fn, this)
  47733. };
  47734. Vue.prototype._render = function () {
  47735. var vm = this;
  47736. var ref = vm.$options;
  47737. var render = ref.render;
  47738. var _parentVnode = ref._parentVnode;
  47739. if (_parentVnode) {
  47740. vm.$scopedSlots = normalizeScopedSlots(
  47741. _parentVnode.data.scopedSlots,
  47742. vm.$slots,
  47743. vm.$scopedSlots
  47744. );
  47745. }
  47746. // set parent vnode. this allows render functions to have access
  47747. // to the data on the placeholder node.
  47748. vm.$vnode = _parentVnode;
  47749. // render self
  47750. var vnode;
  47751. try {
  47752. // There's no need to maintain a stack because all render fns are called
  47753. // separately from one another. Nested component's render fns are called
  47754. // when parent component is patched.
  47755. currentRenderingInstance = vm;
  47756. vnode = render.call(vm._renderProxy, vm.$createElement);
  47757. } catch (e) {
  47758. handleError(e, vm, "render");
  47759. // return error render result,
  47760. // or previous vnode to prevent render error causing blank component
  47761. /* istanbul ignore else */
  47762. if (vm.$options.renderError) {
  47763. try {
  47764. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  47765. } catch (e) {
  47766. handleError(e, vm, "renderError");
  47767. vnode = vm._vnode;
  47768. }
  47769. } else {
  47770. vnode = vm._vnode;
  47771. }
  47772. } finally {
  47773. currentRenderingInstance = null;
  47774. }
  47775. // if the returned array contains only a single node, allow it
  47776. if (Array.isArray(vnode) && vnode.length === 1) {
  47777. vnode = vnode[0];
  47778. }
  47779. // return empty vnode in case the render function errored out
  47780. if (!(vnode instanceof VNode)) {
  47781. if (Array.isArray(vnode)) {
  47782. warn(
  47783. 'Multiple root nodes returned from render function. Render function ' +
  47784. 'should return a single root node.',
  47785. vm
  47786. );
  47787. }
  47788. vnode = createEmptyVNode();
  47789. }
  47790. // set parent
  47791. vnode.parent = _parentVnode;
  47792. return vnode
  47793. };
  47794. }
  47795. /* */
  47796. function ensureCtor (comp, base) {
  47797. if (
  47798. comp.__esModule ||
  47799. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  47800. ) {
  47801. comp = comp.default;
  47802. }
  47803. return isObject(comp)
  47804. ? base.extend(comp)
  47805. : comp
  47806. }
  47807. function createAsyncPlaceholder (
  47808. factory,
  47809. data,
  47810. context,
  47811. children,
  47812. tag
  47813. ) {
  47814. var node = createEmptyVNode();
  47815. node.asyncFactory = factory;
  47816. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  47817. return node
  47818. }
  47819. function resolveAsyncComponent (
  47820. factory,
  47821. baseCtor
  47822. ) {
  47823. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  47824. return factory.errorComp
  47825. }
  47826. if (isDef(factory.resolved)) {
  47827. return factory.resolved
  47828. }
  47829. var owner = currentRenderingInstance;
  47830. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  47831. // already pending
  47832. factory.owners.push(owner);
  47833. }
  47834. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  47835. return factory.loadingComp
  47836. }
  47837. if (owner && !isDef(factory.owners)) {
  47838. var owners = factory.owners = [owner];
  47839. var sync = true;
  47840. var timerLoading = null;
  47841. var timerTimeout = null
  47842. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  47843. var forceRender = function (renderCompleted) {
  47844. for (var i = 0, l = owners.length; i < l; i++) {
  47845. (owners[i]).$forceUpdate();
  47846. }
  47847. if (renderCompleted) {
  47848. owners.length = 0;
  47849. if (timerLoading !== null) {
  47850. clearTimeout(timerLoading);
  47851. timerLoading = null;
  47852. }
  47853. if (timerTimeout !== null) {
  47854. clearTimeout(timerTimeout);
  47855. timerTimeout = null;
  47856. }
  47857. }
  47858. };
  47859. var resolve = once(function (res) {
  47860. // cache resolved
  47861. factory.resolved = ensureCtor(res, baseCtor);
  47862. // invoke callbacks only if this is not a synchronous resolve
  47863. // (async resolves are shimmed as synchronous during SSR)
  47864. if (!sync) {
  47865. forceRender(true);
  47866. } else {
  47867. owners.length = 0;
  47868. }
  47869. });
  47870. var reject = once(function (reason) {
  47871. warn(
  47872. "Failed to resolve async component: " + (String(factory)) +
  47873. (reason ? ("\nReason: " + reason) : '')
  47874. );
  47875. if (isDef(factory.errorComp)) {
  47876. factory.error = true;
  47877. forceRender(true);
  47878. }
  47879. });
  47880. var res = factory(resolve, reject);
  47881. if (isObject(res)) {
  47882. if (isPromise(res)) {
  47883. // () => Promise
  47884. if (isUndef(factory.resolved)) {
  47885. res.then(resolve, reject);
  47886. }
  47887. } else if (isPromise(res.component)) {
  47888. res.component.then(resolve, reject);
  47889. if (isDef(res.error)) {
  47890. factory.errorComp = ensureCtor(res.error, baseCtor);
  47891. }
  47892. if (isDef(res.loading)) {
  47893. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  47894. if (res.delay === 0) {
  47895. factory.loading = true;
  47896. } else {
  47897. timerLoading = setTimeout(function () {
  47898. timerLoading = null;
  47899. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  47900. factory.loading = true;
  47901. forceRender(false);
  47902. }
  47903. }, res.delay || 200);
  47904. }
  47905. }
  47906. if (isDef(res.timeout)) {
  47907. timerTimeout = setTimeout(function () {
  47908. timerTimeout = null;
  47909. if (isUndef(factory.resolved)) {
  47910. reject(
  47911. "timeout (" + (res.timeout) + "ms)"
  47912. );
  47913. }
  47914. }, res.timeout);
  47915. }
  47916. }
  47917. }
  47918. sync = false;
  47919. // return in case resolved synchronously
  47920. return factory.loading
  47921. ? factory.loadingComp
  47922. : factory.resolved
  47923. }
  47924. }
  47925. /* */
  47926. function isAsyncPlaceholder (node) {
  47927. return node.isComment && node.asyncFactory
  47928. }
  47929. /* */
  47930. function getFirstComponentChild (children) {
  47931. if (Array.isArray(children)) {
  47932. for (var i = 0; i < children.length; i++) {
  47933. var c = children[i];
  47934. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  47935. return c
  47936. }
  47937. }
  47938. }
  47939. }
  47940. /* */
  47941. /* */
  47942. function initEvents (vm) {
  47943. vm._events = Object.create(null);
  47944. vm._hasHookEvent = false;
  47945. // init parent attached events
  47946. var listeners = vm.$options._parentListeners;
  47947. if (listeners) {
  47948. updateComponentListeners(vm, listeners);
  47949. }
  47950. }
  47951. var target;
  47952. function add (event, fn) {
  47953. target.$on(event, fn);
  47954. }
  47955. function remove$1 (event, fn) {
  47956. target.$off(event, fn);
  47957. }
  47958. function createOnceHandler (event, fn) {
  47959. var _target = target;
  47960. return function onceHandler () {
  47961. var res = fn.apply(null, arguments);
  47962. if (res !== null) {
  47963. _target.$off(event, onceHandler);
  47964. }
  47965. }
  47966. }
  47967. function updateComponentListeners (
  47968. vm,
  47969. listeners,
  47970. oldListeners
  47971. ) {
  47972. target = vm;
  47973. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  47974. target = undefined;
  47975. }
  47976. function eventsMixin (Vue) {
  47977. var hookRE = /^hook:/;
  47978. Vue.prototype.$on = function (event, fn) {
  47979. var vm = this;
  47980. if (Array.isArray(event)) {
  47981. for (var i = 0, l = event.length; i < l; i++) {
  47982. vm.$on(event[i], fn);
  47983. }
  47984. } else {
  47985. (vm._events[event] || (vm._events[event] = [])).push(fn);
  47986. // optimize hook:event cost by using a boolean flag marked at registration
  47987. // instead of a hash lookup
  47988. if (hookRE.test(event)) {
  47989. vm._hasHookEvent = true;
  47990. }
  47991. }
  47992. return vm
  47993. };
  47994. Vue.prototype.$once = function (event, fn) {
  47995. var vm = this;
  47996. function on () {
  47997. vm.$off(event, on);
  47998. fn.apply(vm, arguments);
  47999. }
  48000. on.fn = fn;
  48001. vm.$on(event, on);
  48002. return vm
  48003. };
  48004. Vue.prototype.$off = function (event, fn) {
  48005. var vm = this;
  48006. // all
  48007. if (!arguments.length) {
  48008. vm._events = Object.create(null);
  48009. return vm
  48010. }
  48011. // array of events
  48012. if (Array.isArray(event)) {
  48013. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  48014. vm.$off(event[i$1], fn);
  48015. }
  48016. return vm
  48017. }
  48018. // specific event
  48019. var cbs = vm._events[event];
  48020. if (!cbs) {
  48021. return vm
  48022. }
  48023. if (!fn) {
  48024. vm._events[event] = null;
  48025. return vm
  48026. }
  48027. // specific handler
  48028. var cb;
  48029. var i = cbs.length;
  48030. while (i--) {
  48031. cb = cbs[i];
  48032. if (cb === fn || cb.fn === fn) {
  48033. cbs.splice(i, 1);
  48034. break
  48035. }
  48036. }
  48037. return vm
  48038. };
  48039. Vue.prototype.$emit = function (event) {
  48040. var vm = this;
  48041. {
  48042. var lowerCaseEvent = event.toLowerCase();
  48043. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  48044. tip(
  48045. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  48046. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  48047. "Note that HTML attributes are case-insensitive and you cannot use " +
  48048. "v-on to listen to camelCase events when using in-DOM templates. " +
  48049. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  48050. );
  48051. }
  48052. }
  48053. var cbs = vm._events[event];
  48054. if (cbs) {
  48055. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  48056. var args = toArray(arguments, 1);
  48057. var info = "event handler for \"" + event + "\"";
  48058. for (var i = 0, l = cbs.length; i < l; i++) {
  48059. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  48060. }
  48061. }
  48062. return vm
  48063. };
  48064. }
  48065. /* */
  48066. var activeInstance = null;
  48067. var isUpdatingChildComponent = false;
  48068. function setActiveInstance(vm) {
  48069. var prevActiveInstance = activeInstance;
  48070. activeInstance = vm;
  48071. return function () {
  48072. activeInstance = prevActiveInstance;
  48073. }
  48074. }
  48075. function initLifecycle (vm) {
  48076. var options = vm.$options;
  48077. // locate first non-abstract parent
  48078. var parent = options.parent;
  48079. if (parent && !options.abstract) {
  48080. while (parent.$options.abstract && parent.$parent) {
  48081. parent = parent.$parent;
  48082. }
  48083. parent.$children.push(vm);
  48084. }
  48085. vm.$parent = parent;
  48086. vm.$root = parent ? parent.$root : vm;
  48087. vm.$children = [];
  48088. vm.$refs = {};
  48089. vm._watcher = null;
  48090. vm._inactive = null;
  48091. vm._directInactive = false;
  48092. vm._isMounted = false;
  48093. vm._isDestroyed = false;
  48094. vm._isBeingDestroyed = false;
  48095. }
  48096. function lifecycleMixin (Vue) {
  48097. Vue.prototype._update = function (vnode, hydrating) {
  48098. var vm = this;
  48099. var prevEl = vm.$el;
  48100. var prevVnode = vm._vnode;
  48101. var restoreActiveInstance = setActiveInstance(vm);
  48102. vm._vnode = vnode;
  48103. // Vue.prototype.__patch__ is injected in entry points
  48104. // based on the rendering backend used.
  48105. if (!prevVnode) {
  48106. // initial render
  48107. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  48108. } else {
  48109. // updates
  48110. vm.$el = vm.__patch__(prevVnode, vnode);
  48111. }
  48112. restoreActiveInstance();
  48113. // update __vue__ reference
  48114. if (prevEl) {
  48115. prevEl.__vue__ = null;
  48116. }
  48117. if (vm.$el) {
  48118. vm.$el.__vue__ = vm;
  48119. }
  48120. // if parent is an HOC, update its $el as well
  48121. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  48122. vm.$parent.$el = vm.$el;
  48123. }
  48124. // updated hook is called by the scheduler to ensure that children are
  48125. // updated in a parent's updated hook.
  48126. };
  48127. Vue.prototype.$forceUpdate = function () {
  48128. var vm = this;
  48129. if (vm._watcher) {
  48130. vm._watcher.update();
  48131. }
  48132. };
  48133. Vue.prototype.$destroy = function () {
  48134. var vm = this;
  48135. if (vm._isBeingDestroyed) {
  48136. return
  48137. }
  48138. callHook(vm, 'beforeDestroy');
  48139. vm._isBeingDestroyed = true;
  48140. // remove self from parent
  48141. var parent = vm.$parent;
  48142. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  48143. remove(parent.$children, vm);
  48144. }
  48145. // teardown watchers
  48146. if (vm._watcher) {
  48147. vm._watcher.teardown();
  48148. }
  48149. var i = vm._watchers.length;
  48150. while (i--) {
  48151. vm._watchers[i].teardown();
  48152. }
  48153. // remove reference from data ob
  48154. // frozen object may not have observer.
  48155. if (vm._data.__ob__) {
  48156. vm._data.__ob__.vmCount--;
  48157. }
  48158. // call the last hook...
  48159. vm._isDestroyed = true;
  48160. // invoke destroy hooks on current rendered tree
  48161. vm.__patch__(vm._vnode, null);
  48162. // fire destroyed hook
  48163. callHook(vm, 'destroyed');
  48164. // turn off all instance listeners.
  48165. vm.$off();
  48166. // remove __vue__ reference
  48167. if (vm.$el) {
  48168. vm.$el.__vue__ = null;
  48169. }
  48170. // release circular reference (#6759)
  48171. if (vm.$vnode) {
  48172. vm.$vnode.parent = null;
  48173. }
  48174. };
  48175. }
  48176. function mountComponent (
  48177. vm,
  48178. el,
  48179. hydrating
  48180. ) {
  48181. vm.$el = el;
  48182. if (!vm.$options.render) {
  48183. vm.$options.render = createEmptyVNode;
  48184. {
  48185. /* istanbul ignore if */
  48186. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  48187. vm.$options.el || el) {
  48188. warn(
  48189. 'You are using the runtime-only build of Vue where the template ' +
  48190. 'compiler is not available. Either pre-compile the templates into ' +
  48191. 'render functions, or use the compiler-included build.',
  48192. vm
  48193. );
  48194. } else {
  48195. warn(
  48196. 'Failed to mount component: template or render function not defined.',
  48197. vm
  48198. );
  48199. }
  48200. }
  48201. }
  48202. callHook(vm, 'beforeMount');
  48203. var updateComponent;
  48204. /* istanbul ignore if */
  48205. if (config.performance && mark) {
  48206. updateComponent = function () {
  48207. var name = vm._name;
  48208. var id = vm._uid;
  48209. var startTag = "vue-perf-start:" + id;
  48210. var endTag = "vue-perf-end:" + id;
  48211. mark(startTag);
  48212. var vnode = vm._render();
  48213. mark(endTag);
  48214. measure(("vue " + name + " render"), startTag, endTag);
  48215. mark(startTag);
  48216. vm._update(vnode, hydrating);
  48217. mark(endTag);
  48218. measure(("vue " + name + " patch"), startTag, endTag);
  48219. };
  48220. } else {
  48221. updateComponent = function () {
  48222. vm._update(vm._render(), hydrating);
  48223. };
  48224. }
  48225. // we set this to vm._watcher inside the watcher's constructor
  48226. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  48227. // component's mounted hook), which relies on vm._watcher being already defined
  48228. new Watcher(vm, updateComponent, noop, {
  48229. before: function before () {
  48230. if (vm._isMounted && !vm._isDestroyed) {
  48231. callHook(vm, 'beforeUpdate');
  48232. }
  48233. }
  48234. }, true /* isRenderWatcher */);
  48235. hydrating = false;
  48236. // manually mounted instance, call mounted on self
  48237. // mounted is called for render-created child components in its inserted hook
  48238. if (vm.$vnode == null) {
  48239. vm._isMounted = true;
  48240. callHook(vm, 'mounted');
  48241. }
  48242. return vm
  48243. }
  48244. function updateChildComponent (
  48245. vm,
  48246. propsData,
  48247. listeners,
  48248. parentVnode,
  48249. renderChildren
  48250. ) {
  48251. {
  48252. isUpdatingChildComponent = true;
  48253. }
  48254. // determine whether component has slot children
  48255. // we need to do this before overwriting $options._renderChildren.
  48256. // check if there are dynamic scopedSlots (hand-written or compiled but with
  48257. // dynamic slot names). Static scoped slots compiled from template has the
  48258. // "$stable" marker.
  48259. var newScopedSlots = parentVnode.data.scopedSlots;
  48260. var oldScopedSlots = vm.$scopedSlots;
  48261. var hasDynamicScopedSlot = !!(
  48262. (newScopedSlots && !newScopedSlots.$stable) ||
  48263. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  48264. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  48265. );
  48266. // Any static slot children from the parent may have changed during parent's
  48267. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  48268. // update is necessary to ensure correctness.
  48269. var needsForceUpdate = !!(
  48270. renderChildren || // has new static slots
  48271. vm.$options._renderChildren || // has old static slots
  48272. hasDynamicScopedSlot
  48273. );
  48274. vm.$options._parentVnode = parentVnode;
  48275. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  48276. if (vm._vnode) { // update child tree's parent
  48277. vm._vnode.parent = parentVnode;
  48278. }
  48279. vm.$options._renderChildren = renderChildren;
  48280. // update $attrs and $listeners hash
  48281. // these are also reactive so they may trigger child update if the child
  48282. // used them during render
  48283. vm.$attrs = parentVnode.data.attrs || emptyObject;
  48284. vm.$listeners = listeners || emptyObject;
  48285. // update props
  48286. if (propsData && vm.$options.props) {
  48287. toggleObserving(false);
  48288. var props = vm._props;
  48289. var propKeys = vm.$options._propKeys || [];
  48290. for (var i = 0; i < propKeys.length; i++) {
  48291. var key = propKeys[i];
  48292. var propOptions = vm.$options.props; // wtf flow?
  48293. props[key] = validateProp(key, propOptions, propsData, vm);
  48294. }
  48295. toggleObserving(true);
  48296. // keep a copy of raw propsData
  48297. vm.$options.propsData = propsData;
  48298. }
  48299. // update listeners
  48300. listeners = listeners || emptyObject;
  48301. var oldListeners = vm.$options._parentListeners;
  48302. vm.$options._parentListeners = listeners;
  48303. updateComponentListeners(vm, listeners, oldListeners);
  48304. // resolve slots + force update if has children
  48305. if (needsForceUpdate) {
  48306. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  48307. vm.$forceUpdate();
  48308. }
  48309. {
  48310. isUpdatingChildComponent = false;
  48311. }
  48312. }
  48313. function isInInactiveTree (vm) {
  48314. while (vm && (vm = vm.$parent)) {
  48315. if (vm._inactive) { return true }
  48316. }
  48317. return false
  48318. }
  48319. function activateChildComponent (vm, direct) {
  48320. if (direct) {
  48321. vm._directInactive = false;
  48322. if (isInInactiveTree(vm)) {
  48323. return
  48324. }
  48325. } else if (vm._directInactive) {
  48326. return
  48327. }
  48328. if (vm._inactive || vm._inactive === null) {
  48329. vm._inactive = false;
  48330. for (var i = 0; i < vm.$children.length; i++) {
  48331. activateChildComponent(vm.$children[i]);
  48332. }
  48333. callHook(vm, 'activated');
  48334. }
  48335. }
  48336. function deactivateChildComponent (vm, direct) {
  48337. if (direct) {
  48338. vm._directInactive = true;
  48339. if (isInInactiveTree(vm)) {
  48340. return
  48341. }
  48342. }
  48343. if (!vm._inactive) {
  48344. vm._inactive = true;
  48345. for (var i = 0; i < vm.$children.length; i++) {
  48346. deactivateChildComponent(vm.$children[i]);
  48347. }
  48348. callHook(vm, 'deactivated');
  48349. }
  48350. }
  48351. function callHook (vm, hook) {
  48352. // #7573 disable dep collection when invoking lifecycle hooks
  48353. pushTarget();
  48354. var handlers = vm.$options[hook];
  48355. var info = hook + " hook";
  48356. if (handlers) {
  48357. for (var i = 0, j = handlers.length; i < j; i++) {
  48358. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  48359. }
  48360. }
  48361. if (vm._hasHookEvent) {
  48362. vm.$emit('hook:' + hook);
  48363. }
  48364. popTarget();
  48365. }
  48366. /* */
  48367. var MAX_UPDATE_COUNT = 100;
  48368. var queue = [];
  48369. var activatedChildren = [];
  48370. var has = {};
  48371. var circular = {};
  48372. var waiting = false;
  48373. var flushing = false;
  48374. var index = 0;
  48375. /**
  48376. * Reset the scheduler's state.
  48377. */
  48378. function resetSchedulerState () {
  48379. index = queue.length = activatedChildren.length = 0;
  48380. has = {};
  48381. {
  48382. circular = {};
  48383. }
  48384. waiting = flushing = false;
  48385. }
  48386. // Async edge case #6566 requires saving the timestamp when event listeners are
  48387. // attached. However, calling performance.now() has a perf overhead especially
  48388. // if the page has thousands of event listeners. Instead, we take a timestamp
  48389. // every time the scheduler flushes and use that for all event listeners
  48390. // attached during that flush.
  48391. var currentFlushTimestamp = 0;
  48392. // Async edge case fix requires storing an event listener's attach timestamp.
  48393. var getNow = Date.now;
  48394. // Determine what event timestamp the browser is using. Annoyingly, the
  48395. // timestamp can either be hi-res (relative to page load) or low-res
  48396. // (relative to UNIX epoch), so in order to compare time we have to use the
  48397. // same timestamp type when saving the flush timestamp.
  48398. // All IE versions use low-res event timestamps, and have problematic clock
  48399. // implementations (#9632)
  48400. if (inBrowser && !isIE) {
  48401. var performance = window.performance;
  48402. if (
  48403. performance &&
  48404. typeof performance.now === 'function' &&
  48405. getNow() > document.createEvent('Event').timeStamp
  48406. ) {
  48407. // if the event timestamp, although evaluated AFTER the Date.now(), is
  48408. // smaller than it, it means the event is using a hi-res timestamp,
  48409. // and we need to use the hi-res version for event listener timestamps as
  48410. // well.
  48411. getNow = function () { return performance.now(); };
  48412. }
  48413. }
  48414. /**
  48415. * Flush both queues and run the watchers.
  48416. */
  48417. function flushSchedulerQueue () {
  48418. currentFlushTimestamp = getNow();
  48419. flushing = true;
  48420. var watcher, id;
  48421. // Sort queue before flush.
  48422. // This ensures that:
  48423. // 1. Components are updated from parent to child. (because parent is always
  48424. // created before the child)
  48425. // 2. A component's user watchers are run before its render watcher (because
  48426. // user watchers are created before the render watcher)
  48427. // 3. If a component is destroyed during a parent component's watcher run,
  48428. // its watchers can be skipped.
  48429. queue.sort(function (a, b) { return a.id - b.id; });
  48430. // do not cache length because more watchers might be pushed
  48431. // as we run existing watchers
  48432. for (index = 0; index < queue.length; index++) {
  48433. watcher = queue[index];
  48434. if (watcher.before) {
  48435. watcher.before();
  48436. }
  48437. id = watcher.id;
  48438. has[id] = null;
  48439. watcher.run();
  48440. // in dev build, check and stop circular updates.
  48441. if (has[id] != null) {
  48442. circular[id] = (circular[id] || 0) + 1;
  48443. if (circular[id] > MAX_UPDATE_COUNT) {
  48444. warn(
  48445. 'You may have an infinite update loop ' + (
  48446. watcher.user
  48447. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  48448. : "in a component render function."
  48449. ),
  48450. watcher.vm
  48451. );
  48452. break
  48453. }
  48454. }
  48455. }
  48456. // keep copies of post queues before resetting state
  48457. var activatedQueue = activatedChildren.slice();
  48458. var updatedQueue = queue.slice();
  48459. resetSchedulerState();
  48460. // call component updated and activated hooks
  48461. callActivatedHooks(activatedQueue);
  48462. callUpdatedHooks(updatedQueue);
  48463. // devtool hook
  48464. /* istanbul ignore if */
  48465. if (devtools && config.devtools) {
  48466. devtools.emit('flush');
  48467. }
  48468. }
  48469. function callUpdatedHooks (queue) {
  48470. var i = queue.length;
  48471. while (i--) {
  48472. var watcher = queue[i];
  48473. var vm = watcher.vm;
  48474. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  48475. callHook(vm, 'updated');
  48476. }
  48477. }
  48478. }
  48479. /**
  48480. * Queue a kept-alive component that was activated during patch.
  48481. * The queue will be processed after the entire tree has been patched.
  48482. */
  48483. function queueActivatedComponent (vm) {
  48484. // setting _inactive to false here so that a render function can
  48485. // rely on checking whether it's in an inactive tree (e.g. router-view)
  48486. vm._inactive = false;
  48487. activatedChildren.push(vm);
  48488. }
  48489. function callActivatedHooks (queue) {
  48490. for (var i = 0; i < queue.length; i++) {
  48491. queue[i]._inactive = true;
  48492. activateChildComponent(queue[i], true /* true */);
  48493. }
  48494. }
  48495. /**
  48496. * Push a watcher into the watcher queue.
  48497. * Jobs with duplicate IDs will be skipped unless it's
  48498. * pushed when the queue is being flushed.
  48499. */
  48500. function queueWatcher (watcher) {
  48501. var id = watcher.id;
  48502. if (has[id] == null) {
  48503. has[id] = true;
  48504. if (!flushing) {
  48505. queue.push(watcher);
  48506. } else {
  48507. // if already flushing, splice the watcher based on its id
  48508. // if already past its id, it will be run next immediately.
  48509. var i = queue.length - 1;
  48510. while (i > index && queue[i].id > watcher.id) {
  48511. i--;
  48512. }
  48513. queue.splice(i + 1, 0, watcher);
  48514. }
  48515. // queue the flush
  48516. if (!waiting) {
  48517. waiting = true;
  48518. if (!config.async) {
  48519. flushSchedulerQueue();
  48520. return
  48521. }
  48522. nextTick(flushSchedulerQueue);
  48523. }
  48524. }
  48525. }
  48526. /* */
  48527. var uid$2 = 0;
  48528. /**
  48529. * A watcher parses an expression, collects dependencies,
  48530. * and fires callback when the expression value changes.
  48531. * This is used for both the $watch() api and directives.
  48532. */
  48533. var Watcher = function Watcher (
  48534. vm,
  48535. expOrFn,
  48536. cb,
  48537. options,
  48538. isRenderWatcher
  48539. ) {
  48540. this.vm = vm;
  48541. if (isRenderWatcher) {
  48542. vm._watcher = this;
  48543. }
  48544. vm._watchers.push(this);
  48545. // options
  48546. if (options) {
  48547. this.deep = !!options.deep;
  48548. this.user = !!options.user;
  48549. this.lazy = !!options.lazy;
  48550. this.sync = !!options.sync;
  48551. this.before = options.before;
  48552. } else {
  48553. this.deep = this.user = this.lazy = this.sync = false;
  48554. }
  48555. this.cb = cb;
  48556. this.id = ++uid$2; // uid for batching
  48557. this.active = true;
  48558. this.dirty = this.lazy; // for lazy watchers
  48559. this.deps = [];
  48560. this.newDeps = [];
  48561. this.depIds = new _Set();
  48562. this.newDepIds = new _Set();
  48563. this.expression = expOrFn.toString();
  48564. // parse expression for getter
  48565. if (typeof expOrFn === 'function') {
  48566. this.getter = expOrFn;
  48567. } else {
  48568. this.getter = parsePath(expOrFn);
  48569. if (!this.getter) {
  48570. this.getter = noop;
  48571. warn(
  48572. "Failed watching path: \"" + expOrFn + "\" " +
  48573. 'Watcher only accepts simple dot-delimited paths. ' +
  48574. 'For full control, use a function instead.',
  48575. vm
  48576. );
  48577. }
  48578. }
  48579. this.value = this.lazy
  48580. ? undefined
  48581. : this.get();
  48582. };
  48583. /**
  48584. * Evaluate the getter, and re-collect dependencies.
  48585. */
  48586. Watcher.prototype.get = function get () {
  48587. pushTarget(this);
  48588. var value;
  48589. var vm = this.vm;
  48590. try {
  48591. value = this.getter.call(vm, vm);
  48592. } catch (e) {
  48593. if (this.user) {
  48594. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  48595. } else {
  48596. throw e
  48597. }
  48598. } finally {
  48599. // "touch" every property so they are all tracked as
  48600. // dependencies for deep watching
  48601. if (this.deep) {
  48602. traverse(value);
  48603. }
  48604. popTarget();
  48605. this.cleanupDeps();
  48606. }
  48607. return value
  48608. };
  48609. /**
  48610. * Add a dependency to this directive.
  48611. */
  48612. Watcher.prototype.addDep = function addDep (dep) {
  48613. var id = dep.id;
  48614. if (!this.newDepIds.has(id)) {
  48615. this.newDepIds.add(id);
  48616. this.newDeps.push(dep);
  48617. if (!this.depIds.has(id)) {
  48618. dep.addSub(this);
  48619. }
  48620. }
  48621. };
  48622. /**
  48623. * Clean up for dependency collection.
  48624. */
  48625. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  48626. var i = this.deps.length;
  48627. while (i--) {
  48628. var dep = this.deps[i];
  48629. if (!this.newDepIds.has(dep.id)) {
  48630. dep.removeSub(this);
  48631. }
  48632. }
  48633. var tmp = this.depIds;
  48634. this.depIds = this.newDepIds;
  48635. this.newDepIds = tmp;
  48636. this.newDepIds.clear();
  48637. tmp = this.deps;
  48638. this.deps = this.newDeps;
  48639. this.newDeps = tmp;
  48640. this.newDeps.length = 0;
  48641. };
  48642. /**
  48643. * Subscriber interface.
  48644. * Will be called when a dependency changes.
  48645. */
  48646. Watcher.prototype.update = function update () {
  48647. /* istanbul ignore else */
  48648. if (this.lazy) {
  48649. this.dirty = true;
  48650. } else if (this.sync) {
  48651. this.run();
  48652. } else {
  48653. queueWatcher(this);
  48654. }
  48655. };
  48656. /**
  48657. * Scheduler job interface.
  48658. * Will be called by the scheduler.
  48659. */
  48660. Watcher.prototype.run = function run () {
  48661. if (this.active) {
  48662. var value = this.get();
  48663. if (
  48664. value !== this.value ||
  48665. // Deep watchers and watchers on Object/Arrays should fire even
  48666. // when the value is the same, because the value may
  48667. // have mutated.
  48668. isObject(value) ||
  48669. this.deep
  48670. ) {
  48671. // set new value
  48672. var oldValue = this.value;
  48673. this.value = value;
  48674. if (this.user) {
  48675. try {
  48676. this.cb.call(this.vm, value, oldValue);
  48677. } catch (e) {
  48678. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  48679. }
  48680. } else {
  48681. this.cb.call(this.vm, value, oldValue);
  48682. }
  48683. }
  48684. }
  48685. };
  48686. /**
  48687. * Evaluate the value of the watcher.
  48688. * This only gets called for lazy watchers.
  48689. */
  48690. Watcher.prototype.evaluate = function evaluate () {
  48691. this.value = this.get();
  48692. this.dirty = false;
  48693. };
  48694. /**
  48695. * Depend on all deps collected by this watcher.
  48696. */
  48697. Watcher.prototype.depend = function depend () {
  48698. var i = this.deps.length;
  48699. while (i--) {
  48700. this.deps[i].depend();
  48701. }
  48702. };
  48703. /**
  48704. * Remove self from all dependencies' subscriber list.
  48705. */
  48706. Watcher.prototype.teardown = function teardown () {
  48707. if (this.active) {
  48708. // remove self from vm's watcher list
  48709. // this is a somewhat expensive operation so we skip it
  48710. // if the vm is being destroyed.
  48711. if (!this.vm._isBeingDestroyed) {
  48712. remove(this.vm._watchers, this);
  48713. }
  48714. var i = this.deps.length;
  48715. while (i--) {
  48716. this.deps[i].removeSub(this);
  48717. }
  48718. this.active = false;
  48719. }
  48720. };
  48721. /* */
  48722. var sharedPropertyDefinition = {
  48723. enumerable: true,
  48724. configurable: true,
  48725. get: noop,
  48726. set: noop
  48727. };
  48728. function proxy (target, sourceKey, key) {
  48729. sharedPropertyDefinition.get = function proxyGetter () {
  48730. return this[sourceKey][key]
  48731. };
  48732. sharedPropertyDefinition.set = function proxySetter (val) {
  48733. this[sourceKey][key] = val;
  48734. };
  48735. Object.defineProperty(target, key, sharedPropertyDefinition);
  48736. }
  48737. function initState (vm) {
  48738. vm._watchers = [];
  48739. var opts = vm.$options;
  48740. if (opts.props) { initProps(vm, opts.props); }
  48741. if (opts.methods) { initMethods(vm, opts.methods); }
  48742. if (opts.data) {
  48743. initData(vm);
  48744. } else {
  48745. observe(vm._data = {}, true /* asRootData */);
  48746. }
  48747. if (opts.computed) { initComputed(vm, opts.computed); }
  48748. if (opts.watch && opts.watch !== nativeWatch) {
  48749. initWatch(vm, opts.watch);
  48750. }
  48751. }
  48752. function initProps (vm, propsOptions) {
  48753. var propsData = vm.$options.propsData || {};
  48754. var props = vm._props = {};
  48755. // cache prop keys so that future props updates can iterate using Array
  48756. // instead of dynamic object key enumeration.
  48757. var keys = vm.$options._propKeys = [];
  48758. var isRoot = !vm.$parent;
  48759. // root instance props should be converted
  48760. if (!isRoot) {
  48761. toggleObserving(false);
  48762. }
  48763. var loop = function ( key ) {
  48764. keys.push(key);
  48765. var value = validateProp(key, propsOptions, propsData, vm);
  48766. /* istanbul ignore else */
  48767. {
  48768. var hyphenatedKey = hyphenate(key);
  48769. if (isReservedAttribute(hyphenatedKey) ||
  48770. config.isReservedAttr(hyphenatedKey)) {
  48771. warn(
  48772. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  48773. vm
  48774. );
  48775. }
  48776. defineReactive$$1(props, key, value, function () {
  48777. if (!isRoot && !isUpdatingChildComponent) {
  48778. warn(
  48779. "Avoid mutating a prop directly since the value will be " +
  48780. "overwritten whenever the parent component re-renders. " +
  48781. "Instead, use a data or computed property based on the prop's " +
  48782. "value. Prop being mutated: \"" + key + "\"",
  48783. vm
  48784. );
  48785. }
  48786. });
  48787. }
  48788. // static props are already proxied on the component's prototype
  48789. // during Vue.extend(). We only need to proxy props defined at
  48790. // instantiation here.
  48791. if (!(key in vm)) {
  48792. proxy(vm, "_props", key);
  48793. }
  48794. };
  48795. for (var key in propsOptions) loop( key );
  48796. toggleObserving(true);
  48797. }
  48798. function initData (vm) {
  48799. var data = vm.$options.data;
  48800. data = vm._data = typeof data === 'function'
  48801. ? getData(data, vm)
  48802. : data || {};
  48803. if (!isPlainObject(data)) {
  48804. data = {};
  48805. warn(
  48806. 'data functions should return an object:\n' +
  48807. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  48808. vm
  48809. );
  48810. }
  48811. // proxy data on instance
  48812. var keys = Object.keys(data);
  48813. var props = vm.$options.props;
  48814. var methods = vm.$options.methods;
  48815. var i = keys.length;
  48816. while (i--) {
  48817. var key = keys[i];
  48818. {
  48819. if (methods && hasOwn(methods, key)) {
  48820. warn(
  48821. ("Method \"" + key + "\" has already been defined as a data property."),
  48822. vm
  48823. );
  48824. }
  48825. }
  48826. if (props && hasOwn(props, key)) {
  48827. warn(
  48828. "The data property \"" + key + "\" is already declared as a prop. " +
  48829. "Use prop default value instead.",
  48830. vm
  48831. );
  48832. } else if (!isReserved(key)) {
  48833. proxy(vm, "_data", key);
  48834. }
  48835. }
  48836. // observe data
  48837. observe(data, true /* asRootData */);
  48838. }
  48839. function getData (data, vm) {
  48840. // #7573 disable dep collection when invoking data getters
  48841. pushTarget();
  48842. try {
  48843. return data.call(vm, vm)
  48844. } catch (e) {
  48845. handleError(e, vm, "data()");
  48846. return {}
  48847. } finally {
  48848. popTarget();
  48849. }
  48850. }
  48851. var computedWatcherOptions = { lazy: true };
  48852. function initComputed (vm, computed) {
  48853. // $flow-disable-line
  48854. var watchers = vm._computedWatchers = Object.create(null);
  48855. // computed properties are just getters during SSR
  48856. var isSSR = isServerRendering();
  48857. for (var key in computed) {
  48858. var userDef = computed[key];
  48859. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  48860. if (getter == null) {
  48861. warn(
  48862. ("Getter is missing for computed property \"" + key + "\"."),
  48863. vm
  48864. );
  48865. }
  48866. if (!isSSR) {
  48867. // create internal watcher for the computed property.
  48868. watchers[key] = new Watcher(
  48869. vm,
  48870. getter || noop,
  48871. noop,
  48872. computedWatcherOptions
  48873. );
  48874. }
  48875. // component-defined computed properties are already defined on the
  48876. // component prototype. We only need to define computed properties defined
  48877. // at instantiation here.
  48878. if (!(key in vm)) {
  48879. defineComputed(vm, key, userDef);
  48880. } else {
  48881. if (key in vm.$data) {
  48882. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  48883. } else if (vm.$options.props && key in vm.$options.props) {
  48884. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  48885. }
  48886. }
  48887. }
  48888. }
  48889. function defineComputed (
  48890. target,
  48891. key,
  48892. userDef
  48893. ) {
  48894. var shouldCache = !isServerRendering();
  48895. if (typeof userDef === 'function') {
  48896. sharedPropertyDefinition.get = shouldCache
  48897. ? createComputedGetter(key)
  48898. : createGetterInvoker(userDef);
  48899. sharedPropertyDefinition.set = noop;
  48900. } else {
  48901. sharedPropertyDefinition.get = userDef.get
  48902. ? shouldCache && userDef.cache !== false
  48903. ? createComputedGetter(key)
  48904. : createGetterInvoker(userDef.get)
  48905. : noop;
  48906. sharedPropertyDefinition.set = userDef.set || noop;
  48907. }
  48908. if (sharedPropertyDefinition.set === noop) {
  48909. sharedPropertyDefinition.set = function () {
  48910. warn(
  48911. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  48912. this
  48913. );
  48914. };
  48915. }
  48916. Object.defineProperty(target, key, sharedPropertyDefinition);
  48917. }
  48918. function createComputedGetter (key) {
  48919. return function computedGetter () {
  48920. var watcher = this._computedWatchers && this._computedWatchers[key];
  48921. if (watcher) {
  48922. if (watcher.dirty) {
  48923. watcher.evaluate();
  48924. }
  48925. if (Dep.target) {
  48926. watcher.depend();
  48927. }
  48928. return watcher.value
  48929. }
  48930. }
  48931. }
  48932. function createGetterInvoker(fn) {
  48933. return function computedGetter () {
  48934. return fn.call(this, this)
  48935. }
  48936. }
  48937. function initMethods (vm, methods) {
  48938. var props = vm.$options.props;
  48939. for (var key in methods) {
  48940. {
  48941. if (typeof methods[key] !== 'function') {
  48942. warn(
  48943. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  48944. "Did you reference the function correctly?",
  48945. vm
  48946. );
  48947. }
  48948. if (props && hasOwn(props, key)) {
  48949. warn(
  48950. ("Method \"" + key + "\" has already been defined as a prop."),
  48951. vm
  48952. );
  48953. }
  48954. if ((key in vm) && isReserved(key)) {
  48955. warn(
  48956. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  48957. "Avoid defining component methods that start with _ or $."
  48958. );
  48959. }
  48960. }
  48961. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  48962. }
  48963. }
  48964. function initWatch (vm, watch) {
  48965. for (var key in watch) {
  48966. var handler = watch[key];
  48967. if (Array.isArray(handler)) {
  48968. for (var i = 0; i < handler.length; i++) {
  48969. createWatcher(vm, key, handler[i]);
  48970. }
  48971. } else {
  48972. createWatcher(vm, key, handler);
  48973. }
  48974. }
  48975. }
  48976. function createWatcher (
  48977. vm,
  48978. expOrFn,
  48979. handler,
  48980. options
  48981. ) {
  48982. if (isPlainObject(handler)) {
  48983. options = handler;
  48984. handler = handler.handler;
  48985. }
  48986. if (typeof handler === 'string') {
  48987. handler = vm[handler];
  48988. }
  48989. return vm.$watch(expOrFn, handler, options)
  48990. }
  48991. function stateMixin (Vue) {
  48992. // flow somehow has problems with directly declared definition object
  48993. // when using Object.defineProperty, so we have to procedurally build up
  48994. // the object here.
  48995. var dataDef = {};
  48996. dataDef.get = function () { return this._data };
  48997. var propsDef = {};
  48998. propsDef.get = function () { return this._props };
  48999. {
  49000. dataDef.set = function () {
  49001. warn(
  49002. 'Avoid replacing instance root $data. ' +
  49003. 'Use nested data properties instead.',
  49004. this
  49005. );
  49006. };
  49007. propsDef.set = function () {
  49008. warn("$props is readonly.", this);
  49009. };
  49010. }
  49011. Object.defineProperty(Vue.prototype, '$data', dataDef);
  49012. Object.defineProperty(Vue.prototype, '$props', propsDef);
  49013. Vue.prototype.$set = set;
  49014. Vue.prototype.$delete = del;
  49015. Vue.prototype.$watch = function (
  49016. expOrFn,
  49017. cb,
  49018. options
  49019. ) {
  49020. var vm = this;
  49021. if (isPlainObject(cb)) {
  49022. return createWatcher(vm, expOrFn, cb, options)
  49023. }
  49024. options = options || {};
  49025. options.user = true;
  49026. var watcher = new Watcher(vm, expOrFn, cb, options);
  49027. if (options.immediate) {
  49028. try {
  49029. cb.call(vm, watcher.value);
  49030. } catch (error) {
  49031. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  49032. }
  49033. }
  49034. return function unwatchFn () {
  49035. watcher.teardown();
  49036. }
  49037. };
  49038. }
  49039. /* */
  49040. var uid$3 = 0;
  49041. function initMixin (Vue) {
  49042. Vue.prototype._init = function (options) {
  49043. var vm = this;
  49044. // a uid
  49045. vm._uid = uid$3++;
  49046. var startTag, endTag;
  49047. /* istanbul ignore if */
  49048. if (config.performance && mark) {
  49049. startTag = "vue-perf-start:" + (vm._uid);
  49050. endTag = "vue-perf-end:" + (vm._uid);
  49051. mark(startTag);
  49052. }
  49053. // a flag to avoid this being observed
  49054. vm._isVue = true;
  49055. // merge options
  49056. if (options && options._isComponent) {
  49057. // optimize internal component instantiation
  49058. // since dynamic options merging is pretty slow, and none of the
  49059. // internal component options needs special treatment.
  49060. initInternalComponent(vm, options);
  49061. } else {
  49062. vm.$options = mergeOptions(
  49063. resolveConstructorOptions(vm.constructor),
  49064. options || {},
  49065. vm
  49066. );
  49067. }
  49068. /* istanbul ignore else */
  49069. {
  49070. initProxy(vm);
  49071. }
  49072. // expose real self
  49073. vm._self = vm;
  49074. initLifecycle(vm);
  49075. initEvents(vm);
  49076. initRender(vm);
  49077. callHook(vm, 'beforeCreate');
  49078. initInjections(vm); // resolve injections before data/props
  49079. initState(vm);
  49080. initProvide(vm); // resolve provide after data/props
  49081. callHook(vm, 'created');
  49082. /* istanbul ignore if */
  49083. if (config.performance && mark) {
  49084. vm._name = formatComponentName(vm, false);
  49085. mark(endTag);
  49086. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  49087. }
  49088. if (vm.$options.el) {
  49089. vm.$mount(vm.$options.el);
  49090. }
  49091. };
  49092. }
  49093. function initInternalComponent (vm, options) {
  49094. var opts = vm.$options = Object.create(vm.constructor.options);
  49095. // doing this because it's faster than dynamic enumeration.
  49096. var parentVnode = options._parentVnode;
  49097. opts.parent = options.parent;
  49098. opts._parentVnode = parentVnode;
  49099. var vnodeComponentOptions = parentVnode.componentOptions;
  49100. opts.propsData = vnodeComponentOptions.propsData;
  49101. opts._parentListeners = vnodeComponentOptions.listeners;
  49102. opts._renderChildren = vnodeComponentOptions.children;
  49103. opts._componentTag = vnodeComponentOptions.tag;
  49104. if (options.render) {
  49105. opts.render = options.render;
  49106. opts.staticRenderFns = options.staticRenderFns;
  49107. }
  49108. }
  49109. function resolveConstructorOptions (Ctor) {
  49110. var options = Ctor.options;
  49111. if (Ctor.super) {
  49112. var superOptions = resolveConstructorOptions(Ctor.super);
  49113. var cachedSuperOptions = Ctor.superOptions;
  49114. if (superOptions !== cachedSuperOptions) {
  49115. // super option changed,
  49116. // need to resolve new options.
  49117. Ctor.superOptions = superOptions;
  49118. // check if there are any late-modified/attached options (#4976)
  49119. var modifiedOptions = resolveModifiedOptions(Ctor);
  49120. // update base extend options
  49121. if (modifiedOptions) {
  49122. extend(Ctor.extendOptions, modifiedOptions);
  49123. }
  49124. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  49125. if (options.name) {
  49126. options.components[options.name] = Ctor;
  49127. }
  49128. }
  49129. }
  49130. return options
  49131. }
  49132. function resolveModifiedOptions (Ctor) {
  49133. var modified;
  49134. var latest = Ctor.options;
  49135. var sealed = Ctor.sealedOptions;
  49136. for (var key in latest) {
  49137. if (latest[key] !== sealed[key]) {
  49138. if (!modified) { modified = {}; }
  49139. modified[key] = latest[key];
  49140. }
  49141. }
  49142. return modified
  49143. }
  49144. function Vue (options) {
  49145. if (!(this instanceof Vue)
  49146. ) {
  49147. warn('Vue is a constructor and should be called with the `new` keyword');
  49148. }
  49149. this._init(options);
  49150. }
  49151. initMixin(Vue);
  49152. stateMixin(Vue);
  49153. eventsMixin(Vue);
  49154. lifecycleMixin(Vue);
  49155. renderMixin(Vue);
  49156. /* */
  49157. function initUse (Vue) {
  49158. Vue.use = function (plugin) {
  49159. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  49160. if (installedPlugins.indexOf(plugin) > -1) {
  49161. return this
  49162. }
  49163. // additional parameters
  49164. var args = toArray(arguments, 1);
  49165. args.unshift(this);
  49166. if (typeof plugin.install === 'function') {
  49167. plugin.install.apply(plugin, args);
  49168. } else if (typeof plugin === 'function') {
  49169. plugin.apply(null, args);
  49170. }
  49171. installedPlugins.push(plugin);
  49172. return this
  49173. };
  49174. }
  49175. /* */
  49176. function initMixin$1 (Vue) {
  49177. Vue.mixin = function (mixin) {
  49178. this.options = mergeOptions(this.options, mixin);
  49179. return this
  49180. };
  49181. }
  49182. /* */
  49183. function initExtend (Vue) {
  49184. /**
  49185. * Each instance constructor, including Vue, has a unique
  49186. * cid. This enables us to create wrapped "child
  49187. * constructors" for prototypal inheritance and cache them.
  49188. */
  49189. Vue.cid = 0;
  49190. var cid = 1;
  49191. /**
  49192. * Class inheritance
  49193. */
  49194. Vue.extend = function (extendOptions) {
  49195. extendOptions = extendOptions || {};
  49196. var Super = this;
  49197. var SuperId = Super.cid;
  49198. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  49199. if (cachedCtors[SuperId]) {
  49200. return cachedCtors[SuperId]
  49201. }
  49202. var name = extendOptions.name || Super.options.name;
  49203. if (name) {
  49204. validateComponentName(name);
  49205. }
  49206. var Sub = function VueComponent (options) {
  49207. this._init(options);
  49208. };
  49209. Sub.prototype = Object.create(Super.prototype);
  49210. Sub.prototype.constructor = Sub;
  49211. Sub.cid = cid++;
  49212. Sub.options = mergeOptions(
  49213. Super.options,
  49214. extendOptions
  49215. );
  49216. Sub['super'] = Super;
  49217. // For props and computed properties, we define the proxy getters on
  49218. // the Vue instances at extension time, on the extended prototype. This
  49219. // avoids Object.defineProperty calls for each instance created.
  49220. if (Sub.options.props) {
  49221. initProps$1(Sub);
  49222. }
  49223. if (Sub.options.computed) {
  49224. initComputed$1(Sub);
  49225. }
  49226. // allow further extension/mixin/plugin usage
  49227. Sub.extend = Super.extend;
  49228. Sub.mixin = Super.mixin;
  49229. Sub.use = Super.use;
  49230. // create asset registers, so extended classes
  49231. // can have their private assets too.
  49232. ASSET_TYPES.forEach(function (type) {
  49233. Sub[type] = Super[type];
  49234. });
  49235. // enable recursive self-lookup
  49236. if (name) {
  49237. Sub.options.components[name] = Sub;
  49238. }
  49239. // keep a reference to the super options at extension time.
  49240. // later at instantiation we can check if Super's options have
  49241. // been updated.
  49242. Sub.superOptions = Super.options;
  49243. Sub.extendOptions = extendOptions;
  49244. Sub.sealedOptions = extend({}, Sub.options);
  49245. // cache constructor
  49246. cachedCtors[SuperId] = Sub;
  49247. return Sub
  49248. };
  49249. }
  49250. function initProps$1 (Comp) {
  49251. var props = Comp.options.props;
  49252. for (var key in props) {
  49253. proxy(Comp.prototype, "_props", key);
  49254. }
  49255. }
  49256. function initComputed$1 (Comp) {
  49257. var computed = Comp.options.computed;
  49258. for (var key in computed) {
  49259. defineComputed(Comp.prototype, key, computed[key]);
  49260. }
  49261. }
  49262. /* */
  49263. function initAssetRegisters (Vue) {
  49264. /**
  49265. * Create asset registration methods.
  49266. */
  49267. ASSET_TYPES.forEach(function (type) {
  49268. Vue[type] = function (
  49269. id,
  49270. definition
  49271. ) {
  49272. if (!definition) {
  49273. return this.options[type + 's'][id]
  49274. } else {
  49275. /* istanbul ignore if */
  49276. if (type === 'component') {
  49277. validateComponentName(id);
  49278. }
  49279. if (type === 'component' && isPlainObject(definition)) {
  49280. definition.name = definition.name || id;
  49281. definition = this.options._base.extend(definition);
  49282. }
  49283. if (type === 'directive' && typeof definition === 'function') {
  49284. definition = { bind: definition, update: definition };
  49285. }
  49286. this.options[type + 's'][id] = definition;
  49287. return definition
  49288. }
  49289. };
  49290. });
  49291. }
  49292. /* */
  49293. function getComponentName (opts) {
  49294. return opts && (opts.Ctor.options.name || opts.tag)
  49295. }
  49296. function matches (pattern, name) {
  49297. if (Array.isArray(pattern)) {
  49298. return pattern.indexOf(name) > -1
  49299. } else if (typeof pattern === 'string') {
  49300. return pattern.split(',').indexOf(name) > -1
  49301. } else if (isRegExp(pattern)) {
  49302. return pattern.test(name)
  49303. }
  49304. /* istanbul ignore next */
  49305. return false
  49306. }
  49307. function pruneCache (keepAliveInstance, filter) {
  49308. var cache = keepAliveInstance.cache;
  49309. var keys = keepAliveInstance.keys;
  49310. var _vnode = keepAliveInstance._vnode;
  49311. for (var key in cache) {
  49312. var cachedNode = cache[key];
  49313. if (cachedNode) {
  49314. var name = getComponentName(cachedNode.componentOptions);
  49315. if (name && !filter(name)) {
  49316. pruneCacheEntry(cache, key, keys, _vnode);
  49317. }
  49318. }
  49319. }
  49320. }
  49321. function pruneCacheEntry (
  49322. cache,
  49323. key,
  49324. keys,
  49325. current
  49326. ) {
  49327. var cached$$1 = cache[key];
  49328. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  49329. cached$$1.componentInstance.$destroy();
  49330. }
  49331. cache[key] = null;
  49332. remove(keys, key);
  49333. }
  49334. var patternTypes = [String, RegExp, Array];
  49335. var KeepAlive = {
  49336. name: 'keep-alive',
  49337. abstract: true,
  49338. props: {
  49339. include: patternTypes,
  49340. exclude: patternTypes,
  49341. max: [String, Number]
  49342. },
  49343. created: function created () {
  49344. this.cache = Object.create(null);
  49345. this.keys = [];
  49346. },
  49347. destroyed: function destroyed () {
  49348. for (var key in this.cache) {
  49349. pruneCacheEntry(this.cache, key, this.keys);
  49350. }
  49351. },
  49352. mounted: function mounted () {
  49353. var this$1 = this;
  49354. this.$watch('include', function (val) {
  49355. pruneCache(this$1, function (name) { return matches(val, name); });
  49356. });
  49357. this.$watch('exclude', function (val) {
  49358. pruneCache(this$1, function (name) { return !matches(val, name); });
  49359. });
  49360. },
  49361. render: function render () {
  49362. var slot = this.$slots.default;
  49363. var vnode = getFirstComponentChild(slot);
  49364. var componentOptions = vnode && vnode.componentOptions;
  49365. if (componentOptions) {
  49366. // check pattern
  49367. var name = getComponentName(componentOptions);
  49368. var ref = this;
  49369. var include = ref.include;
  49370. var exclude = ref.exclude;
  49371. if (
  49372. // not included
  49373. (include && (!name || !matches(include, name))) ||
  49374. // excluded
  49375. (exclude && name && matches(exclude, name))
  49376. ) {
  49377. return vnode
  49378. }
  49379. var ref$1 = this;
  49380. var cache = ref$1.cache;
  49381. var keys = ref$1.keys;
  49382. var key = vnode.key == null
  49383. // same constructor may get registered as different local components
  49384. // so cid alone is not enough (#3269)
  49385. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  49386. : vnode.key;
  49387. if (cache[key]) {
  49388. vnode.componentInstance = cache[key].componentInstance;
  49389. // make current key freshest
  49390. remove(keys, key);
  49391. keys.push(key);
  49392. } else {
  49393. cache[key] = vnode;
  49394. keys.push(key);
  49395. // prune oldest entry
  49396. if (this.max && keys.length > parseInt(this.max)) {
  49397. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  49398. }
  49399. }
  49400. vnode.data.keepAlive = true;
  49401. }
  49402. return vnode || (slot && slot[0])
  49403. }
  49404. };
  49405. var builtInComponents = {
  49406. KeepAlive: KeepAlive
  49407. };
  49408. /* */
  49409. function initGlobalAPI (Vue) {
  49410. // config
  49411. var configDef = {};
  49412. configDef.get = function () { return config; };
  49413. {
  49414. configDef.set = function () {
  49415. warn(
  49416. 'Do not replace the Vue.config object, set individual fields instead.'
  49417. );
  49418. };
  49419. }
  49420. Object.defineProperty(Vue, 'config', configDef);
  49421. // exposed util methods.
  49422. // NOTE: these are not considered part of the public API - avoid relying on
  49423. // them unless you are aware of the risk.
  49424. Vue.util = {
  49425. warn: warn,
  49426. extend: extend,
  49427. mergeOptions: mergeOptions,
  49428. defineReactive: defineReactive$$1
  49429. };
  49430. Vue.set = set;
  49431. Vue.delete = del;
  49432. Vue.nextTick = nextTick;
  49433. // 2.6 explicit observable API
  49434. Vue.observable = function (obj) {
  49435. observe(obj);
  49436. return obj
  49437. };
  49438. Vue.options = Object.create(null);
  49439. ASSET_TYPES.forEach(function (type) {
  49440. Vue.options[type + 's'] = Object.create(null);
  49441. });
  49442. // this is used to identify the "base" constructor to extend all plain-object
  49443. // components with in Weex's multi-instance scenarios.
  49444. Vue.options._base = Vue;
  49445. extend(Vue.options.components, builtInComponents);
  49446. initUse(Vue);
  49447. initMixin$1(Vue);
  49448. initExtend(Vue);
  49449. initAssetRegisters(Vue);
  49450. }
  49451. initGlobalAPI(Vue);
  49452. Object.defineProperty(Vue.prototype, '$isServer', {
  49453. get: isServerRendering
  49454. });
  49455. Object.defineProperty(Vue.prototype, '$ssrContext', {
  49456. get: function get () {
  49457. /* istanbul ignore next */
  49458. return this.$vnode && this.$vnode.ssrContext
  49459. }
  49460. });
  49461. // expose FunctionalRenderContext for ssr runtime helper installation
  49462. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  49463. value: FunctionalRenderContext
  49464. });
  49465. Vue.version = '2.6.11';
  49466. /* */
  49467. // these are reserved for web because they are directly compiled away
  49468. // during template compilation
  49469. var isReservedAttr = makeMap('style,class');
  49470. // attributes that should be using props for binding
  49471. var acceptValue = makeMap('input,textarea,option,select,progress');
  49472. var mustUseProp = function (tag, type, attr) {
  49473. return (
  49474. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  49475. (attr === 'selected' && tag === 'option') ||
  49476. (attr === 'checked' && tag === 'input') ||
  49477. (attr === 'muted' && tag === 'video')
  49478. )
  49479. };
  49480. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  49481. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  49482. var convertEnumeratedValue = function (key, value) {
  49483. return isFalsyAttrValue(value) || value === 'false'
  49484. ? 'false'
  49485. // allow arbitrary string value for contenteditable
  49486. : key === 'contenteditable' && isValidContentEditableValue(value)
  49487. ? value
  49488. : 'true'
  49489. };
  49490. var isBooleanAttr = makeMap(
  49491. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  49492. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  49493. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  49494. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  49495. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  49496. 'truespeed,typemustmatch,visible'
  49497. );
  49498. var xlinkNS = 'http://www.w3.org/1999/xlink';
  49499. var isXlink = function (name) {
  49500. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  49501. };
  49502. var getXlinkProp = function (name) {
  49503. return isXlink(name) ? name.slice(6, name.length) : ''
  49504. };
  49505. var isFalsyAttrValue = function (val) {
  49506. return val == null || val === false
  49507. };
  49508. /* */
  49509. function genClassForVnode (vnode) {
  49510. var data = vnode.data;
  49511. var parentNode = vnode;
  49512. var childNode = vnode;
  49513. while (isDef(childNode.componentInstance)) {
  49514. childNode = childNode.componentInstance._vnode;
  49515. if (childNode && childNode.data) {
  49516. data = mergeClassData(childNode.data, data);
  49517. }
  49518. }
  49519. while (isDef(parentNode = parentNode.parent)) {
  49520. if (parentNode && parentNode.data) {
  49521. data = mergeClassData(data, parentNode.data);
  49522. }
  49523. }
  49524. return renderClass(data.staticClass, data.class)
  49525. }
  49526. function mergeClassData (child, parent) {
  49527. return {
  49528. staticClass: concat(child.staticClass, parent.staticClass),
  49529. class: isDef(child.class)
  49530. ? [child.class, parent.class]
  49531. : parent.class
  49532. }
  49533. }
  49534. function renderClass (
  49535. staticClass,
  49536. dynamicClass
  49537. ) {
  49538. if (isDef(staticClass) || isDef(dynamicClass)) {
  49539. return concat(staticClass, stringifyClass(dynamicClass))
  49540. }
  49541. /* istanbul ignore next */
  49542. return ''
  49543. }
  49544. function concat (a, b) {
  49545. return a ? b ? (a + ' ' + b) : a : (b || '')
  49546. }
  49547. function stringifyClass (value) {
  49548. if (Array.isArray(value)) {
  49549. return stringifyArray(value)
  49550. }
  49551. if (isObject(value)) {
  49552. return stringifyObject(value)
  49553. }
  49554. if (typeof value === 'string') {
  49555. return value
  49556. }
  49557. /* istanbul ignore next */
  49558. return ''
  49559. }
  49560. function stringifyArray (value) {
  49561. var res = '';
  49562. var stringified;
  49563. for (var i = 0, l = value.length; i < l; i++) {
  49564. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  49565. if (res) { res += ' '; }
  49566. res += stringified;
  49567. }
  49568. }
  49569. return res
  49570. }
  49571. function stringifyObject (value) {
  49572. var res = '';
  49573. for (var key in value) {
  49574. if (value[key]) {
  49575. if (res) { res += ' '; }
  49576. res += key;
  49577. }
  49578. }
  49579. return res
  49580. }
  49581. /* */
  49582. var namespaceMap = {
  49583. svg: 'http://www.w3.org/2000/svg',
  49584. math: 'http://www.w3.org/1998/Math/MathML'
  49585. };
  49586. var isHTMLTag = makeMap(
  49587. 'html,body,base,head,link,meta,style,title,' +
  49588. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  49589. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  49590. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  49591. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  49592. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  49593. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  49594. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  49595. 'output,progress,select,textarea,' +
  49596. 'details,dialog,menu,menuitem,summary,' +
  49597. 'content,element,shadow,template,blockquote,iframe,tfoot'
  49598. );
  49599. // this map is intentionally selective, only covering SVG elements that may
  49600. // contain child elements.
  49601. var isSVG = makeMap(
  49602. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  49603. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  49604. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  49605. true
  49606. );
  49607. var isPreTag = function (tag) { return tag === 'pre'; };
  49608. var isReservedTag = function (tag) {
  49609. return isHTMLTag(tag) || isSVG(tag)
  49610. };
  49611. function getTagNamespace (tag) {
  49612. if (isSVG(tag)) {
  49613. return 'svg'
  49614. }
  49615. // basic support for MathML
  49616. // note it doesn't support other MathML elements being component roots
  49617. if (tag === 'math') {
  49618. return 'math'
  49619. }
  49620. }
  49621. var unknownElementCache = Object.create(null);
  49622. function isUnknownElement (tag) {
  49623. /* istanbul ignore if */
  49624. if (!inBrowser) {
  49625. return true
  49626. }
  49627. if (isReservedTag(tag)) {
  49628. return false
  49629. }
  49630. tag = tag.toLowerCase();
  49631. /* istanbul ignore if */
  49632. if (unknownElementCache[tag] != null) {
  49633. return unknownElementCache[tag]
  49634. }
  49635. var el = document.createElement(tag);
  49636. if (tag.indexOf('-') > -1) {
  49637. // http://stackoverflow.com/a/28210364/1070244
  49638. return (unknownElementCache[tag] = (
  49639. el.constructor === window.HTMLUnknownElement ||
  49640. el.constructor === window.HTMLElement
  49641. ))
  49642. } else {
  49643. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  49644. }
  49645. }
  49646. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  49647. /* */
  49648. /**
  49649. * Query an element selector if it's not an element already.
  49650. */
  49651. function query (el) {
  49652. if (typeof el === 'string') {
  49653. var selected = document.querySelector(el);
  49654. if (!selected) {
  49655. warn(
  49656. 'Cannot find element: ' + el
  49657. );
  49658. return document.createElement('div')
  49659. }
  49660. return selected
  49661. } else {
  49662. return el
  49663. }
  49664. }
  49665. /* */
  49666. function createElement$1 (tagName, vnode) {
  49667. var elm = document.createElement(tagName);
  49668. if (tagName !== 'select') {
  49669. return elm
  49670. }
  49671. // false or null will remove the attribute but undefined will not
  49672. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  49673. elm.setAttribute('multiple', 'multiple');
  49674. }
  49675. return elm
  49676. }
  49677. function createElementNS (namespace, tagName) {
  49678. return document.createElementNS(namespaceMap[namespace], tagName)
  49679. }
  49680. function createTextNode (text) {
  49681. return document.createTextNode(text)
  49682. }
  49683. function createComment (text) {
  49684. return document.createComment(text)
  49685. }
  49686. function insertBefore (parentNode, newNode, referenceNode) {
  49687. parentNode.insertBefore(newNode, referenceNode);
  49688. }
  49689. function removeChild (node, child) {
  49690. node.removeChild(child);
  49691. }
  49692. function appendChild (node, child) {
  49693. node.appendChild(child);
  49694. }
  49695. function parentNode (node) {
  49696. return node.parentNode
  49697. }
  49698. function nextSibling (node) {
  49699. return node.nextSibling
  49700. }
  49701. function tagName (node) {
  49702. return node.tagName
  49703. }
  49704. function setTextContent (node, text) {
  49705. node.textContent = text;
  49706. }
  49707. function setStyleScope (node, scopeId) {
  49708. node.setAttribute(scopeId, '');
  49709. }
  49710. var nodeOps = /*#__PURE__*/Object.freeze({
  49711. createElement: createElement$1,
  49712. createElementNS: createElementNS,
  49713. createTextNode: createTextNode,
  49714. createComment: createComment,
  49715. insertBefore: insertBefore,
  49716. removeChild: removeChild,
  49717. appendChild: appendChild,
  49718. parentNode: parentNode,
  49719. nextSibling: nextSibling,
  49720. tagName: tagName,
  49721. setTextContent: setTextContent,
  49722. setStyleScope: setStyleScope
  49723. });
  49724. /* */
  49725. var ref = {
  49726. create: function create (_, vnode) {
  49727. registerRef(vnode);
  49728. },
  49729. update: function update (oldVnode, vnode) {
  49730. if (oldVnode.data.ref !== vnode.data.ref) {
  49731. registerRef(oldVnode, true);
  49732. registerRef(vnode);
  49733. }
  49734. },
  49735. destroy: function destroy (vnode) {
  49736. registerRef(vnode, true);
  49737. }
  49738. };
  49739. function registerRef (vnode, isRemoval) {
  49740. var key = vnode.data.ref;
  49741. if (!isDef(key)) { return }
  49742. var vm = vnode.context;
  49743. var ref = vnode.componentInstance || vnode.elm;
  49744. var refs = vm.$refs;
  49745. if (isRemoval) {
  49746. if (Array.isArray(refs[key])) {
  49747. remove(refs[key], ref);
  49748. } else if (refs[key] === ref) {
  49749. refs[key] = undefined;
  49750. }
  49751. } else {
  49752. if (vnode.data.refInFor) {
  49753. if (!Array.isArray(refs[key])) {
  49754. refs[key] = [ref];
  49755. } else if (refs[key].indexOf(ref) < 0) {
  49756. // $flow-disable-line
  49757. refs[key].push(ref);
  49758. }
  49759. } else {
  49760. refs[key] = ref;
  49761. }
  49762. }
  49763. }
  49764. /**
  49765. * Virtual DOM patching algorithm based on Snabbdom by
  49766. * Simon Friis Vindum (@paldepind)
  49767. * Licensed under the MIT License
  49768. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  49769. *
  49770. * modified by Evan You (@yyx990803)
  49771. *
  49772. * Not type-checking this because this file is perf-critical and the cost
  49773. * of making flow understand it is not worth it.
  49774. */
  49775. var emptyNode = new VNode('', {}, []);
  49776. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  49777. function sameVnode (a, b) {
  49778. return (
  49779. a.key === b.key && (
  49780. (
  49781. a.tag === b.tag &&
  49782. a.isComment === b.isComment &&
  49783. isDef(a.data) === isDef(b.data) &&
  49784. sameInputType(a, b)
  49785. ) || (
  49786. isTrue(a.isAsyncPlaceholder) &&
  49787. a.asyncFactory === b.asyncFactory &&
  49788. isUndef(b.asyncFactory.error)
  49789. )
  49790. )
  49791. )
  49792. }
  49793. function sameInputType (a, b) {
  49794. if (a.tag !== 'input') { return true }
  49795. var i;
  49796. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  49797. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  49798. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  49799. }
  49800. function createKeyToOldIdx (children, beginIdx, endIdx) {
  49801. var i, key;
  49802. var map = {};
  49803. for (i = beginIdx; i <= endIdx; ++i) {
  49804. key = children[i].key;
  49805. if (isDef(key)) { map[key] = i; }
  49806. }
  49807. return map
  49808. }
  49809. function createPatchFunction (backend) {
  49810. var i, j;
  49811. var cbs = {};
  49812. var modules = backend.modules;
  49813. var nodeOps = backend.nodeOps;
  49814. for (i = 0; i < hooks.length; ++i) {
  49815. cbs[hooks[i]] = [];
  49816. for (j = 0; j < modules.length; ++j) {
  49817. if (isDef(modules[j][hooks[i]])) {
  49818. cbs[hooks[i]].push(modules[j][hooks[i]]);
  49819. }
  49820. }
  49821. }
  49822. function emptyNodeAt (elm) {
  49823. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  49824. }
  49825. function createRmCb (childElm, listeners) {
  49826. function remove$$1 () {
  49827. if (--remove$$1.listeners === 0) {
  49828. removeNode(childElm);
  49829. }
  49830. }
  49831. remove$$1.listeners = listeners;
  49832. return remove$$1
  49833. }
  49834. function removeNode (el) {
  49835. var parent = nodeOps.parentNode(el);
  49836. // element may have already been removed due to v-html / v-text
  49837. if (isDef(parent)) {
  49838. nodeOps.removeChild(parent, el);
  49839. }
  49840. }
  49841. function isUnknownElement$$1 (vnode, inVPre) {
  49842. return (
  49843. !inVPre &&
  49844. !vnode.ns &&
  49845. !(
  49846. config.ignoredElements.length &&
  49847. config.ignoredElements.some(function (ignore) {
  49848. return isRegExp(ignore)
  49849. ? ignore.test(vnode.tag)
  49850. : ignore === vnode.tag
  49851. })
  49852. ) &&
  49853. config.isUnknownElement(vnode.tag)
  49854. )
  49855. }
  49856. var creatingElmInVPre = 0;
  49857. function createElm (
  49858. vnode,
  49859. insertedVnodeQueue,
  49860. parentElm,
  49861. refElm,
  49862. nested,
  49863. ownerArray,
  49864. index
  49865. ) {
  49866. if (isDef(vnode.elm) && isDef(ownerArray)) {
  49867. // This vnode was used in a previous render!
  49868. // now it's used as a new node, overwriting its elm would cause
  49869. // potential patch errors down the road when it's used as an insertion
  49870. // reference node. Instead, we clone the node on-demand before creating
  49871. // associated DOM element for it.
  49872. vnode = ownerArray[index] = cloneVNode(vnode);
  49873. }
  49874. vnode.isRootInsert = !nested; // for transition enter check
  49875. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  49876. return
  49877. }
  49878. var data = vnode.data;
  49879. var children = vnode.children;
  49880. var tag = vnode.tag;
  49881. if (isDef(tag)) {
  49882. {
  49883. if (data && data.pre) {
  49884. creatingElmInVPre++;
  49885. }
  49886. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  49887. warn(
  49888. 'Unknown custom element: <' + tag + '> - did you ' +
  49889. 'register the component correctly? For recursive components, ' +
  49890. 'make sure to provide the "name" option.',
  49891. vnode.context
  49892. );
  49893. }
  49894. }
  49895. vnode.elm = vnode.ns
  49896. ? nodeOps.createElementNS(vnode.ns, tag)
  49897. : nodeOps.createElement(tag, vnode);
  49898. setScope(vnode);
  49899. /* istanbul ignore if */
  49900. {
  49901. createChildren(vnode, children, insertedVnodeQueue);
  49902. if (isDef(data)) {
  49903. invokeCreateHooks(vnode, insertedVnodeQueue);
  49904. }
  49905. insert(parentElm, vnode.elm, refElm);
  49906. }
  49907. if (data && data.pre) {
  49908. creatingElmInVPre--;
  49909. }
  49910. } else if (isTrue(vnode.isComment)) {
  49911. vnode.elm = nodeOps.createComment(vnode.text);
  49912. insert(parentElm, vnode.elm, refElm);
  49913. } else {
  49914. vnode.elm = nodeOps.createTextNode(vnode.text);
  49915. insert(parentElm, vnode.elm, refElm);
  49916. }
  49917. }
  49918. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  49919. var i = vnode.data;
  49920. if (isDef(i)) {
  49921. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  49922. if (isDef(i = i.hook) && isDef(i = i.init)) {
  49923. i(vnode, false /* hydrating */);
  49924. }
  49925. // after calling the init hook, if the vnode is a child component
  49926. // it should've created a child instance and mounted it. the child
  49927. // component also has set the placeholder vnode's elm.
  49928. // in that case we can just return the element and be done.
  49929. if (isDef(vnode.componentInstance)) {
  49930. initComponent(vnode, insertedVnodeQueue);
  49931. insert(parentElm, vnode.elm, refElm);
  49932. if (isTrue(isReactivated)) {
  49933. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  49934. }
  49935. return true
  49936. }
  49937. }
  49938. }
  49939. function initComponent (vnode, insertedVnodeQueue) {
  49940. if (isDef(vnode.data.pendingInsert)) {
  49941. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  49942. vnode.data.pendingInsert = null;
  49943. }
  49944. vnode.elm = vnode.componentInstance.$el;
  49945. if (isPatchable(vnode)) {
  49946. invokeCreateHooks(vnode, insertedVnodeQueue);
  49947. setScope(vnode);
  49948. } else {
  49949. // empty component root.
  49950. // skip all element-related modules except for ref (#3455)
  49951. registerRef(vnode);
  49952. // make sure to invoke the insert hook
  49953. insertedVnodeQueue.push(vnode);
  49954. }
  49955. }
  49956. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  49957. var i;
  49958. // hack for #4339: a reactivated component with inner transition
  49959. // does not trigger because the inner node's created hooks are not called
  49960. // again. It's not ideal to involve module-specific logic in here but
  49961. // there doesn't seem to be a better way to do it.
  49962. var innerNode = vnode;
  49963. while (innerNode.componentInstance) {
  49964. innerNode = innerNode.componentInstance._vnode;
  49965. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  49966. for (i = 0; i < cbs.activate.length; ++i) {
  49967. cbs.activate[i](emptyNode, innerNode);
  49968. }
  49969. insertedVnodeQueue.push(innerNode);
  49970. break
  49971. }
  49972. }
  49973. // unlike a newly created component,
  49974. // a reactivated keep-alive component doesn't insert itself
  49975. insert(parentElm, vnode.elm, refElm);
  49976. }
  49977. function insert (parent, elm, ref$$1) {
  49978. if (isDef(parent)) {
  49979. if (isDef(ref$$1)) {
  49980. if (nodeOps.parentNode(ref$$1) === parent) {
  49981. nodeOps.insertBefore(parent, elm, ref$$1);
  49982. }
  49983. } else {
  49984. nodeOps.appendChild(parent, elm);
  49985. }
  49986. }
  49987. }
  49988. function createChildren (vnode, children, insertedVnodeQueue) {
  49989. if (Array.isArray(children)) {
  49990. {
  49991. checkDuplicateKeys(children);
  49992. }
  49993. for (var i = 0; i < children.length; ++i) {
  49994. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  49995. }
  49996. } else if (isPrimitive(vnode.text)) {
  49997. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  49998. }
  49999. }
  50000. function isPatchable (vnode) {
  50001. while (vnode.componentInstance) {
  50002. vnode = vnode.componentInstance._vnode;
  50003. }
  50004. return isDef(vnode.tag)
  50005. }
  50006. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  50007. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  50008. cbs.create[i$1](emptyNode, vnode);
  50009. }
  50010. i = vnode.data.hook; // Reuse variable
  50011. if (isDef(i)) {
  50012. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  50013. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  50014. }
  50015. }
  50016. // set scope id attribute for scoped CSS.
  50017. // this is implemented as a special case to avoid the overhead
  50018. // of going through the normal attribute patching process.
  50019. function setScope (vnode) {
  50020. var i;
  50021. if (isDef(i = vnode.fnScopeId)) {
  50022. nodeOps.setStyleScope(vnode.elm, i);
  50023. } else {
  50024. var ancestor = vnode;
  50025. while (ancestor) {
  50026. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  50027. nodeOps.setStyleScope(vnode.elm, i);
  50028. }
  50029. ancestor = ancestor.parent;
  50030. }
  50031. }
  50032. // for slot content they should also get the scopeId from the host instance.
  50033. if (isDef(i = activeInstance) &&
  50034. i !== vnode.context &&
  50035. i !== vnode.fnContext &&
  50036. isDef(i = i.$options._scopeId)
  50037. ) {
  50038. nodeOps.setStyleScope(vnode.elm, i);
  50039. }
  50040. }
  50041. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  50042. for (; startIdx <= endIdx; ++startIdx) {
  50043. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  50044. }
  50045. }
  50046. function invokeDestroyHook (vnode) {
  50047. var i, j;
  50048. var data = vnode.data;
  50049. if (isDef(data)) {
  50050. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  50051. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  50052. }
  50053. if (isDef(i = vnode.children)) {
  50054. for (j = 0; j < vnode.children.length; ++j) {
  50055. invokeDestroyHook(vnode.children[j]);
  50056. }
  50057. }
  50058. }
  50059. function removeVnodes (vnodes, startIdx, endIdx) {
  50060. for (; startIdx <= endIdx; ++startIdx) {
  50061. var ch = vnodes[startIdx];
  50062. if (isDef(ch)) {
  50063. if (isDef(ch.tag)) {
  50064. removeAndInvokeRemoveHook(ch);
  50065. invokeDestroyHook(ch);
  50066. } else { // Text node
  50067. removeNode(ch.elm);
  50068. }
  50069. }
  50070. }
  50071. }
  50072. function removeAndInvokeRemoveHook (vnode, rm) {
  50073. if (isDef(rm) || isDef(vnode.data)) {
  50074. var i;
  50075. var listeners = cbs.remove.length + 1;
  50076. if (isDef(rm)) {
  50077. // we have a recursively passed down rm callback
  50078. // increase the listeners count
  50079. rm.listeners += listeners;
  50080. } else {
  50081. // directly removing
  50082. rm = createRmCb(vnode.elm, listeners);
  50083. }
  50084. // recursively invoke hooks on child component root node
  50085. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  50086. removeAndInvokeRemoveHook(i, rm);
  50087. }
  50088. for (i = 0; i < cbs.remove.length; ++i) {
  50089. cbs.remove[i](vnode, rm);
  50090. }
  50091. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  50092. i(vnode, rm);
  50093. } else {
  50094. rm();
  50095. }
  50096. } else {
  50097. removeNode(vnode.elm);
  50098. }
  50099. }
  50100. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  50101. var oldStartIdx = 0;
  50102. var newStartIdx = 0;
  50103. var oldEndIdx = oldCh.length - 1;
  50104. var oldStartVnode = oldCh[0];
  50105. var oldEndVnode = oldCh[oldEndIdx];
  50106. var newEndIdx = newCh.length - 1;
  50107. var newStartVnode = newCh[0];
  50108. var newEndVnode = newCh[newEndIdx];
  50109. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  50110. // removeOnly is a special flag used only by <transition-group>
  50111. // to ensure removed elements stay in correct relative positions
  50112. // during leaving transitions
  50113. var canMove = !removeOnly;
  50114. {
  50115. checkDuplicateKeys(newCh);
  50116. }
  50117. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  50118. if (isUndef(oldStartVnode)) {
  50119. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  50120. } else if (isUndef(oldEndVnode)) {
  50121. oldEndVnode = oldCh[--oldEndIdx];
  50122. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  50123. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50124. oldStartVnode = oldCh[++oldStartIdx];
  50125. newStartVnode = newCh[++newStartIdx];
  50126. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  50127. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  50128. oldEndVnode = oldCh[--oldEndIdx];
  50129. newEndVnode = newCh[--newEndIdx];
  50130. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  50131. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  50132. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  50133. oldStartVnode = oldCh[++oldStartIdx];
  50134. newEndVnode = newCh[--newEndIdx];
  50135. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  50136. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50137. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  50138. oldEndVnode = oldCh[--oldEndIdx];
  50139. newStartVnode = newCh[++newStartIdx];
  50140. } else {
  50141. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  50142. idxInOld = isDef(newStartVnode.key)
  50143. ? oldKeyToIdx[newStartVnode.key]
  50144. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  50145. if (isUndef(idxInOld)) { // New element
  50146. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  50147. } else {
  50148. vnodeToMove = oldCh[idxInOld];
  50149. if (sameVnode(vnodeToMove, newStartVnode)) {
  50150. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50151. oldCh[idxInOld] = undefined;
  50152. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  50153. } else {
  50154. // same key but different element. treat as new element
  50155. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  50156. }
  50157. }
  50158. newStartVnode = newCh[++newStartIdx];
  50159. }
  50160. }
  50161. if (oldStartIdx > oldEndIdx) {
  50162. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  50163. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  50164. } else if (newStartIdx > newEndIdx) {
  50165. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  50166. }
  50167. }
  50168. function checkDuplicateKeys (children) {
  50169. var seenKeys = {};
  50170. for (var i = 0; i < children.length; i++) {
  50171. var vnode = children[i];
  50172. var key = vnode.key;
  50173. if (isDef(key)) {
  50174. if (seenKeys[key]) {
  50175. warn(
  50176. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  50177. vnode.context
  50178. );
  50179. } else {
  50180. seenKeys[key] = true;
  50181. }
  50182. }
  50183. }
  50184. }
  50185. function findIdxInOld (node, oldCh, start, end) {
  50186. for (var i = start; i < end; i++) {
  50187. var c = oldCh[i];
  50188. if (isDef(c) && sameVnode(node, c)) { return i }
  50189. }
  50190. }
  50191. function patchVnode (
  50192. oldVnode,
  50193. vnode,
  50194. insertedVnodeQueue,
  50195. ownerArray,
  50196. index,
  50197. removeOnly
  50198. ) {
  50199. if (oldVnode === vnode) {
  50200. return
  50201. }
  50202. if (isDef(vnode.elm) && isDef(ownerArray)) {
  50203. // clone reused vnode
  50204. vnode = ownerArray[index] = cloneVNode(vnode);
  50205. }
  50206. var elm = vnode.elm = oldVnode.elm;
  50207. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  50208. if (isDef(vnode.asyncFactory.resolved)) {
  50209. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  50210. } else {
  50211. vnode.isAsyncPlaceholder = true;
  50212. }
  50213. return
  50214. }
  50215. // reuse element for static trees.
  50216. // note we only do this if the vnode is cloned -
  50217. // if the new node is not cloned it means the render functions have been
  50218. // reset by the hot-reload-api and we need to do a proper re-render.
  50219. if (isTrue(vnode.isStatic) &&
  50220. isTrue(oldVnode.isStatic) &&
  50221. vnode.key === oldVnode.key &&
  50222. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  50223. ) {
  50224. vnode.componentInstance = oldVnode.componentInstance;
  50225. return
  50226. }
  50227. var i;
  50228. var data = vnode.data;
  50229. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  50230. i(oldVnode, vnode);
  50231. }
  50232. var oldCh = oldVnode.children;
  50233. var ch = vnode.children;
  50234. if (isDef(data) && isPatchable(vnode)) {
  50235. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  50236. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  50237. }
  50238. if (isUndef(vnode.text)) {
  50239. if (isDef(oldCh) && isDef(ch)) {
  50240. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  50241. } else if (isDef(ch)) {
  50242. {
  50243. checkDuplicateKeys(ch);
  50244. }
  50245. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  50246. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  50247. } else if (isDef(oldCh)) {
  50248. removeVnodes(oldCh, 0, oldCh.length - 1);
  50249. } else if (isDef(oldVnode.text)) {
  50250. nodeOps.setTextContent(elm, '');
  50251. }
  50252. } else if (oldVnode.text !== vnode.text) {
  50253. nodeOps.setTextContent(elm, vnode.text);
  50254. }
  50255. if (isDef(data)) {
  50256. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  50257. }
  50258. }
  50259. function invokeInsertHook (vnode, queue, initial) {
  50260. // delay insert hooks for component root nodes, invoke them after the
  50261. // element is really inserted
  50262. if (isTrue(initial) && isDef(vnode.parent)) {
  50263. vnode.parent.data.pendingInsert = queue;
  50264. } else {
  50265. for (var i = 0; i < queue.length; ++i) {
  50266. queue[i].data.hook.insert(queue[i]);
  50267. }
  50268. }
  50269. }
  50270. var hydrationBailed = false;
  50271. // list of modules that can skip create hook during hydration because they
  50272. // are already rendered on the client or has no need for initialization
  50273. // Note: style is excluded because it relies on initial clone for future
  50274. // deep updates (#7063).
  50275. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  50276. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  50277. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  50278. var i;
  50279. var tag = vnode.tag;
  50280. var data = vnode.data;
  50281. var children = vnode.children;
  50282. inVPre = inVPre || (data && data.pre);
  50283. vnode.elm = elm;
  50284. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  50285. vnode.isAsyncPlaceholder = true;
  50286. return true
  50287. }
  50288. // assert node match
  50289. {
  50290. if (!assertNodeMatch(elm, vnode, inVPre)) {
  50291. return false
  50292. }
  50293. }
  50294. if (isDef(data)) {
  50295. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  50296. if (isDef(i = vnode.componentInstance)) {
  50297. // child component. it should have hydrated its own tree.
  50298. initComponent(vnode, insertedVnodeQueue);
  50299. return true
  50300. }
  50301. }
  50302. if (isDef(tag)) {
  50303. if (isDef(children)) {
  50304. // empty element, allow client to pick up and populate children
  50305. if (!elm.hasChildNodes()) {
  50306. createChildren(vnode, children, insertedVnodeQueue);
  50307. } else {
  50308. // v-html and domProps: innerHTML
  50309. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  50310. if (i !== elm.innerHTML) {
  50311. /* istanbul ignore if */
  50312. if (typeof console !== 'undefined' &&
  50313. !hydrationBailed
  50314. ) {
  50315. hydrationBailed = true;
  50316. console.warn('Parent: ', elm);
  50317. console.warn('server innerHTML: ', i);
  50318. console.warn('client innerHTML: ', elm.innerHTML);
  50319. }
  50320. return false
  50321. }
  50322. } else {
  50323. // iterate and compare children lists
  50324. var childrenMatch = true;
  50325. var childNode = elm.firstChild;
  50326. for (var i$1 = 0; i$1 < children.length; i$1++) {
  50327. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  50328. childrenMatch = false;
  50329. break
  50330. }
  50331. childNode = childNode.nextSibling;
  50332. }
  50333. // if childNode is not null, it means the actual childNodes list is
  50334. // longer than the virtual children list.
  50335. if (!childrenMatch || childNode) {
  50336. /* istanbul ignore if */
  50337. if (typeof console !== 'undefined' &&
  50338. !hydrationBailed
  50339. ) {
  50340. hydrationBailed = true;
  50341. console.warn('Parent: ', elm);
  50342. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  50343. }
  50344. return false
  50345. }
  50346. }
  50347. }
  50348. }
  50349. if (isDef(data)) {
  50350. var fullInvoke = false;
  50351. for (var key in data) {
  50352. if (!isRenderedModule(key)) {
  50353. fullInvoke = true;
  50354. invokeCreateHooks(vnode, insertedVnodeQueue);
  50355. break
  50356. }
  50357. }
  50358. if (!fullInvoke && data['class']) {
  50359. // ensure collecting deps for deep class bindings for future updates
  50360. traverse(data['class']);
  50361. }
  50362. }
  50363. } else if (elm.data !== vnode.text) {
  50364. elm.data = vnode.text;
  50365. }
  50366. return true
  50367. }
  50368. function assertNodeMatch (node, vnode, inVPre) {
  50369. if (isDef(vnode.tag)) {
  50370. return vnode.tag.indexOf('vue-component') === 0 || (
  50371. !isUnknownElement$$1(vnode, inVPre) &&
  50372. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  50373. )
  50374. } else {
  50375. return node.nodeType === (vnode.isComment ? 8 : 3)
  50376. }
  50377. }
  50378. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  50379. if (isUndef(vnode)) {
  50380. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  50381. return
  50382. }
  50383. var isInitialPatch = false;
  50384. var insertedVnodeQueue = [];
  50385. if (isUndef(oldVnode)) {
  50386. // empty mount (likely as component), create new root element
  50387. isInitialPatch = true;
  50388. createElm(vnode, insertedVnodeQueue);
  50389. } else {
  50390. var isRealElement = isDef(oldVnode.nodeType);
  50391. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  50392. // patch existing root node
  50393. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  50394. } else {
  50395. if (isRealElement) {
  50396. // mounting to a real element
  50397. // check if this is server-rendered content and if we can perform
  50398. // a successful hydration.
  50399. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  50400. oldVnode.removeAttribute(SSR_ATTR);
  50401. hydrating = true;
  50402. }
  50403. if (isTrue(hydrating)) {
  50404. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  50405. invokeInsertHook(vnode, insertedVnodeQueue, true);
  50406. return oldVnode
  50407. } else {
  50408. warn(
  50409. 'The client-side rendered virtual DOM tree is not matching ' +
  50410. 'server-rendered content. This is likely caused by incorrect ' +
  50411. 'HTML markup, for example nesting block-level elements inside ' +
  50412. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  50413. 'full client-side render.'
  50414. );
  50415. }
  50416. }
  50417. // either not server-rendered, or hydration failed.
  50418. // create an empty node and replace it
  50419. oldVnode = emptyNodeAt(oldVnode);
  50420. }
  50421. // replacing existing element
  50422. var oldElm = oldVnode.elm;
  50423. var parentElm = nodeOps.parentNode(oldElm);
  50424. // create new node
  50425. createElm(
  50426. vnode,
  50427. insertedVnodeQueue,
  50428. // extremely rare edge case: do not insert if old element is in a
  50429. // leaving transition. Only happens when combining transition +
  50430. // keep-alive + HOCs. (#4590)
  50431. oldElm._leaveCb ? null : parentElm,
  50432. nodeOps.nextSibling(oldElm)
  50433. );
  50434. // update parent placeholder node element, recursively
  50435. if (isDef(vnode.parent)) {
  50436. var ancestor = vnode.parent;
  50437. var patchable = isPatchable(vnode);
  50438. while (ancestor) {
  50439. for (var i = 0; i < cbs.destroy.length; ++i) {
  50440. cbs.destroy[i](ancestor);
  50441. }
  50442. ancestor.elm = vnode.elm;
  50443. if (patchable) {
  50444. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  50445. cbs.create[i$1](emptyNode, ancestor);
  50446. }
  50447. // #6513
  50448. // invoke insert hooks that may have been merged by create hooks.
  50449. // e.g. for directives that uses the "inserted" hook.
  50450. var insert = ancestor.data.hook.insert;
  50451. if (insert.merged) {
  50452. // start at index 1 to avoid re-invoking component mounted hook
  50453. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  50454. insert.fns[i$2]();
  50455. }
  50456. }
  50457. } else {
  50458. registerRef(ancestor);
  50459. }
  50460. ancestor = ancestor.parent;
  50461. }
  50462. }
  50463. // destroy old node
  50464. if (isDef(parentElm)) {
  50465. removeVnodes([oldVnode], 0, 0);
  50466. } else if (isDef(oldVnode.tag)) {
  50467. invokeDestroyHook(oldVnode);
  50468. }
  50469. }
  50470. }
  50471. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  50472. return vnode.elm
  50473. }
  50474. }
  50475. /* */
  50476. var directives = {
  50477. create: updateDirectives,
  50478. update: updateDirectives,
  50479. destroy: function unbindDirectives (vnode) {
  50480. updateDirectives(vnode, emptyNode);
  50481. }
  50482. };
  50483. function updateDirectives (oldVnode, vnode) {
  50484. if (oldVnode.data.directives || vnode.data.directives) {
  50485. _update(oldVnode, vnode);
  50486. }
  50487. }
  50488. function _update (oldVnode, vnode) {
  50489. var isCreate = oldVnode === emptyNode;
  50490. var isDestroy = vnode === emptyNode;
  50491. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  50492. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  50493. var dirsWithInsert = [];
  50494. var dirsWithPostpatch = [];
  50495. var key, oldDir, dir;
  50496. for (key in newDirs) {
  50497. oldDir = oldDirs[key];
  50498. dir = newDirs[key];
  50499. if (!oldDir) {
  50500. // new directive, bind
  50501. callHook$1(dir, 'bind', vnode, oldVnode);
  50502. if (dir.def && dir.def.inserted) {
  50503. dirsWithInsert.push(dir);
  50504. }
  50505. } else {
  50506. // existing directive, update
  50507. dir.oldValue = oldDir.value;
  50508. dir.oldArg = oldDir.arg;
  50509. callHook$1(dir, 'update', vnode, oldVnode);
  50510. if (dir.def && dir.def.componentUpdated) {
  50511. dirsWithPostpatch.push(dir);
  50512. }
  50513. }
  50514. }
  50515. if (dirsWithInsert.length) {
  50516. var callInsert = function () {
  50517. for (var i = 0; i < dirsWithInsert.length; i++) {
  50518. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  50519. }
  50520. };
  50521. if (isCreate) {
  50522. mergeVNodeHook(vnode, 'insert', callInsert);
  50523. } else {
  50524. callInsert();
  50525. }
  50526. }
  50527. if (dirsWithPostpatch.length) {
  50528. mergeVNodeHook(vnode, 'postpatch', function () {
  50529. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  50530. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  50531. }
  50532. });
  50533. }
  50534. if (!isCreate) {
  50535. for (key in oldDirs) {
  50536. if (!newDirs[key]) {
  50537. // no longer present, unbind
  50538. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  50539. }
  50540. }
  50541. }
  50542. }
  50543. var emptyModifiers = Object.create(null);
  50544. function normalizeDirectives$1 (
  50545. dirs,
  50546. vm
  50547. ) {
  50548. var res = Object.create(null);
  50549. if (!dirs) {
  50550. // $flow-disable-line
  50551. return res
  50552. }
  50553. var i, dir;
  50554. for (i = 0; i < dirs.length; i++) {
  50555. dir = dirs[i];
  50556. if (!dir.modifiers) {
  50557. // $flow-disable-line
  50558. dir.modifiers = emptyModifiers;
  50559. }
  50560. res[getRawDirName(dir)] = dir;
  50561. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  50562. }
  50563. // $flow-disable-line
  50564. return res
  50565. }
  50566. function getRawDirName (dir) {
  50567. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  50568. }
  50569. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  50570. var fn = dir.def && dir.def[hook];
  50571. if (fn) {
  50572. try {
  50573. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  50574. } catch (e) {
  50575. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  50576. }
  50577. }
  50578. }
  50579. var baseModules = [
  50580. ref,
  50581. directives
  50582. ];
  50583. /* */
  50584. function updateAttrs (oldVnode, vnode) {
  50585. var opts = vnode.componentOptions;
  50586. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  50587. return
  50588. }
  50589. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  50590. return
  50591. }
  50592. var key, cur, old;
  50593. var elm = vnode.elm;
  50594. var oldAttrs = oldVnode.data.attrs || {};
  50595. var attrs = vnode.data.attrs || {};
  50596. // clone observed objects, as the user probably wants to mutate it
  50597. if (isDef(attrs.__ob__)) {
  50598. attrs = vnode.data.attrs = extend({}, attrs);
  50599. }
  50600. for (key in attrs) {
  50601. cur = attrs[key];
  50602. old = oldAttrs[key];
  50603. if (old !== cur) {
  50604. setAttr(elm, key, cur);
  50605. }
  50606. }
  50607. // #4391: in IE9, setting type can reset value for input[type=radio]
  50608. // #6666: IE/Edge forces progress value down to 1 before setting a max
  50609. /* istanbul ignore if */
  50610. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  50611. setAttr(elm, 'value', attrs.value);
  50612. }
  50613. for (key in oldAttrs) {
  50614. if (isUndef(attrs[key])) {
  50615. if (isXlink(key)) {
  50616. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50617. } else if (!isEnumeratedAttr(key)) {
  50618. elm.removeAttribute(key);
  50619. }
  50620. }
  50621. }
  50622. }
  50623. function setAttr (el, key, value) {
  50624. if (el.tagName.indexOf('-') > -1) {
  50625. baseSetAttr(el, key, value);
  50626. } else if (isBooleanAttr(key)) {
  50627. // set attribute for blank value
  50628. // e.g. <option disabled>Select one</option>
  50629. if (isFalsyAttrValue(value)) {
  50630. el.removeAttribute(key);
  50631. } else {
  50632. // technically allowfullscreen is a boolean attribute for <iframe>,
  50633. // but Flash expects a value of "true" when used on <embed> tag
  50634. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  50635. ? 'true'
  50636. : key;
  50637. el.setAttribute(key, value);
  50638. }
  50639. } else if (isEnumeratedAttr(key)) {
  50640. el.setAttribute(key, convertEnumeratedValue(key, value));
  50641. } else if (isXlink(key)) {
  50642. if (isFalsyAttrValue(value)) {
  50643. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50644. } else {
  50645. el.setAttributeNS(xlinkNS, key, value);
  50646. }
  50647. } else {
  50648. baseSetAttr(el, key, value);
  50649. }
  50650. }
  50651. function baseSetAttr (el, key, value) {
  50652. if (isFalsyAttrValue(value)) {
  50653. el.removeAttribute(key);
  50654. } else {
  50655. // #7138: IE10 & 11 fires input event when setting placeholder on
  50656. // <textarea>... block the first input event and remove the blocker
  50657. // immediately.
  50658. /* istanbul ignore if */
  50659. if (
  50660. isIE && !isIE9 &&
  50661. el.tagName === 'TEXTAREA' &&
  50662. key === 'placeholder' && value !== '' && !el.__ieph
  50663. ) {
  50664. var blocker = function (e) {
  50665. e.stopImmediatePropagation();
  50666. el.removeEventListener('input', blocker);
  50667. };
  50668. el.addEventListener('input', blocker);
  50669. // $flow-disable-line
  50670. el.__ieph = true; /* IE placeholder patched */
  50671. }
  50672. el.setAttribute(key, value);
  50673. }
  50674. }
  50675. var attrs = {
  50676. create: updateAttrs,
  50677. update: updateAttrs
  50678. };
  50679. /* */
  50680. function updateClass (oldVnode, vnode) {
  50681. var el = vnode.elm;
  50682. var data = vnode.data;
  50683. var oldData = oldVnode.data;
  50684. if (
  50685. isUndef(data.staticClass) &&
  50686. isUndef(data.class) && (
  50687. isUndef(oldData) || (
  50688. isUndef(oldData.staticClass) &&
  50689. isUndef(oldData.class)
  50690. )
  50691. )
  50692. ) {
  50693. return
  50694. }
  50695. var cls = genClassForVnode(vnode);
  50696. // handle transition classes
  50697. var transitionClass = el._transitionClasses;
  50698. if (isDef(transitionClass)) {
  50699. cls = concat(cls, stringifyClass(transitionClass));
  50700. }
  50701. // set the class
  50702. if (cls !== el._prevClass) {
  50703. el.setAttribute('class', cls);
  50704. el._prevClass = cls;
  50705. }
  50706. }
  50707. var klass = {
  50708. create: updateClass,
  50709. update: updateClass
  50710. };
  50711. /* */
  50712. var validDivisionCharRE = /[\w).+\-_$\]]/;
  50713. function parseFilters (exp) {
  50714. var inSingle = false;
  50715. var inDouble = false;
  50716. var inTemplateString = false;
  50717. var inRegex = false;
  50718. var curly = 0;
  50719. var square = 0;
  50720. var paren = 0;
  50721. var lastFilterIndex = 0;
  50722. var c, prev, i, expression, filters;
  50723. for (i = 0; i < exp.length; i++) {
  50724. prev = c;
  50725. c = exp.charCodeAt(i);
  50726. if (inSingle) {
  50727. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  50728. } else if (inDouble) {
  50729. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  50730. } else if (inTemplateString) {
  50731. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  50732. } else if (inRegex) {
  50733. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  50734. } else if (
  50735. c === 0x7C && // pipe
  50736. exp.charCodeAt(i + 1) !== 0x7C &&
  50737. exp.charCodeAt(i - 1) !== 0x7C &&
  50738. !curly && !square && !paren
  50739. ) {
  50740. if (expression === undefined) {
  50741. // first filter, end of expression
  50742. lastFilterIndex = i + 1;
  50743. expression = exp.slice(0, i).trim();
  50744. } else {
  50745. pushFilter();
  50746. }
  50747. } else {
  50748. switch (c) {
  50749. case 0x22: inDouble = true; break // "
  50750. case 0x27: inSingle = true; break // '
  50751. case 0x60: inTemplateString = true; break // `
  50752. case 0x28: paren++; break // (
  50753. case 0x29: paren--; break // )
  50754. case 0x5B: square++; break // [
  50755. case 0x5D: square--; break // ]
  50756. case 0x7B: curly++; break // {
  50757. case 0x7D: curly--; break // }
  50758. }
  50759. if (c === 0x2f) { // /
  50760. var j = i - 1;
  50761. var p = (void 0);
  50762. // find first non-whitespace prev char
  50763. for (; j >= 0; j--) {
  50764. p = exp.charAt(j);
  50765. if (p !== ' ') { break }
  50766. }
  50767. if (!p || !validDivisionCharRE.test(p)) {
  50768. inRegex = true;
  50769. }
  50770. }
  50771. }
  50772. }
  50773. if (expression === undefined) {
  50774. expression = exp.slice(0, i).trim();
  50775. } else if (lastFilterIndex !== 0) {
  50776. pushFilter();
  50777. }
  50778. function pushFilter () {
  50779. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  50780. lastFilterIndex = i + 1;
  50781. }
  50782. if (filters) {
  50783. for (i = 0; i < filters.length; i++) {
  50784. expression = wrapFilter(expression, filters[i]);
  50785. }
  50786. }
  50787. return expression
  50788. }
  50789. function wrapFilter (exp, filter) {
  50790. var i = filter.indexOf('(');
  50791. if (i < 0) {
  50792. // _f: resolveFilter
  50793. return ("_f(\"" + filter + "\")(" + exp + ")")
  50794. } else {
  50795. var name = filter.slice(0, i);
  50796. var args = filter.slice(i + 1);
  50797. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  50798. }
  50799. }
  50800. /* */
  50801. /* eslint-disable no-unused-vars */
  50802. function baseWarn (msg, range) {
  50803. console.error(("[Vue compiler]: " + msg));
  50804. }
  50805. /* eslint-enable no-unused-vars */
  50806. function pluckModuleFunction (
  50807. modules,
  50808. key
  50809. ) {
  50810. return modules
  50811. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  50812. : []
  50813. }
  50814. function addProp (el, name, value, range, dynamic) {
  50815. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50816. el.plain = false;
  50817. }
  50818. function addAttr (el, name, value, range, dynamic) {
  50819. var attrs = dynamic
  50820. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  50821. : (el.attrs || (el.attrs = []));
  50822. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50823. el.plain = false;
  50824. }
  50825. // add a raw attr (use this in preTransforms)
  50826. function addRawAttr (el, name, value, range) {
  50827. el.attrsMap[name] = value;
  50828. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  50829. }
  50830. function addDirective (
  50831. el,
  50832. name,
  50833. rawName,
  50834. value,
  50835. arg,
  50836. isDynamicArg,
  50837. modifiers,
  50838. range
  50839. ) {
  50840. (el.directives || (el.directives = [])).push(rangeSetItem({
  50841. name: name,
  50842. rawName: rawName,
  50843. value: value,
  50844. arg: arg,
  50845. isDynamicArg: isDynamicArg,
  50846. modifiers: modifiers
  50847. }, range));
  50848. el.plain = false;
  50849. }
  50850. function prependModifierMarker (symbol, name, dynamic) {
  50851. return dynamic
  50852. ? ("_p(" + name + ",\"" + symbol + "\")")
  50853. : symbol + name // mark the event as captured
  50854. }
  50855. function addHandler (
  50856. el,
  50857. name,
  50858. value,
  50859. modifiers,
  50860. important,
  50861. warn,
  50862. range,
  50863. dynamic
  50864. ) {
  50865. modifiers = modifiers || emptyObject;
  50866. // warn prevent and passive modifier
  50867. /* istanbul ignore if */
  50868. if (
  50869. warn &&
  50870. modifiers.prevent && modifiers.passive
  50871. ) {
  50872. warn(
  50873. 'passive and prevent can\'t be used together. ' +
  50874. 'Passive handler can\'t prevent default event.',
  50875. range
  50876. );
  50877. }
  50878. // normalize click.right and click.middle since they don't actually fire
  50879. // this is technically browser-specific, but at least for now browsers are
  50880. // the only target envs that have right/middle clicks.
  50881. if (modifiers.right) {
  50882. if (dynamic) {
  50883. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  50884. } else if (name === 'click') {
  50885. name = 'contextmenu';
  50886. delete modifiers.right;
  50887. }
  50888. } else if (modifiers.middle) {
  50889. if (dynamic) {
  50890. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  50891. } else if (name === 'click') {
  50892. name = 'mouseup';
  50893. }
  50894. }
  50895. // check capture modifier
  50896. if (modifiers.capture) {
  50897. delete modifiers.capture;
  50898. name = prependModifierMarker('!', name, dynamic);
  50899. }
  50900. if (modifiers.once) {
  50901. delete modifiers.once;
  50902. name = prependModifierMarker('~', name, dynamic);
  50903. }
  50904. /* istanbul ignore if */
  50905. if (modifiers.passive) {
  50906. delete modifiers.passive;
  50907. name = prependModifierMarker('&', name, dynamic);
  50908. }
  50909. var events;
  50910. if (modifiers.native) {
  50911. delete modifiers.native;
  50912. events = el.nativeEvents || (el.nativeEvents = {});
  50913. } else {
  50914. events = el.events || (el.events = {});
  50915. }
  50916. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  50917. if (modifiers !== emptyObject) {
  50918. newHandler.modifiers = modifiers;
  50919. }
  50920. var handlers = events[name];
  50921. /* istanbul ignore if */
  50922. if (Array.isArray(handlers)) {
  50923. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  50924. } else if (handlers) {
  50925. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  50926. } else {
  50927. events[name] = newHandler;
  50928. }
  50929. el.plain = false;
  50930. }
  50931. function getRawBindingAttr (
  50932. el,
  50933. name
  50934. ) {
  50935. return el.rawAttrsMap[':' + name] ||
  50936. el.rawAttrsMap['v-bind:' + name] ||
  50937. el.rawAttrsMap[name]
  50938. }
  50939. function getBindingAttr (
  50940. el,
  50941. name,
  50942. getStatic
  50943. ) {
  50944. var dynamicValue =
  50945. getAndRemoveAttr(el, ':' + name) ||
  50946. getAndRemoveAttr(el, 'v-bind:' + name);
  50947. if (dynamicValue != null) {
  50948. return parseFilters(dynamicValue)
  50949. } else if (getStatic !== false) {
  50950. var staticValue = getAndRemoveAttr(el, name);
  50951. if (staticValue != null) {
  50952. return JSON.stringify(staticValue)
  50953. }
  50954. }
  50955. }
  50956. // note: this only removes the attr from the Array (attrsList) so that it
  50957. // doesn't get processed by processAttrs.
  50958. // By default it does NOT remove it from the map (attrsMap) because the map is
  50959. // needed during codegen.
  50960. function getAndRemoveAttr (
  50961. el,
  50962. name,
  50963. removeFromMap
  50964. ) {
  50965. var val;
  50966. if ((val = el.attrsMap[name]) != null) {
  50967. var list = el.attrsList;
  50968. for (var i = 0, l = list.length; i < l; i++) {
  50969. if (list[i].name === name) {
  50970. list.splice(i, 1);
  50971. break
  50972. }
  50973. }
  50974. }
  50975. if (removeFromMap) {
  50976. delete el.attrsMap[name];
  50977. }
  50978. return val
  50979. }
  50980. function getAndRemoveAttrByRegex (
  50981. el,
  50982. name
  50983. ) {
  50984. var list = el.attrsList;
  50985. for (var i = 0, l = list.length; i < l; i++) {
  50986. var attr = list[i];
  50987. if (name.test(attr.name)) {
  50988. list.splice(i, 1);
  50989. return attr
  50990. }
  50991. }
  50992. }
  50993. function rangeSetItem (
  50994. item,
  50995. range
  50996. ) {
  50997. if (range) {
  50998. if (range.start != null) {
  50999. item.start = range.start;
  51000. }
  51001. if (range.end != null) {
  51002. item.end = range.end;
  51003. }
  51004. }
  51005. return item
  51006. }
  51007. /* */
  51008. /**
  51009. * Cross-platform code generation for component v-model
  51010. */
  51011. function genComponentModel (
  51012. el,
  51013. value,
  51014. modifiers
  51015. ) {
  51016. var ref = modifiers || {};
  51017. var number = ref.number;
  51018. var trim = ref.trim;
  51019. var baseValueExpression = '$$v';
  51020. var valueExpression = baseValueExpression;
  51021. if (trim) {
  51022. valueExpression =
  51023. "(typeof " + baseValueExpression + " === 'string'" +
  51024. "? " + baseValueExpression + ".trim()" +
  51025. ": " + baseValueExpression + ")";
  51026. }
  51027. if (number) {
  51028. valueExpression = "_n(" + valueExpression + ")";
  51029. }
  51030. var assignment = genAssignmentCode(value, valueExpression);
  51031. el.model = {
  51032. value: ("(" + value + ")"),
  51033. expression: JSON.stringify(value),
  51034. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  51035. };
  51036. }
  51037. /**
  51038. * Cross-platform codegen helper for generating v-model value assignment code.
  51039. */
  51040. function genAssignmentCode (
  51041. value,
  51042. assignment
  51043. ) {
  51044. var res = parseModel(value);
  51045. if (res.key === null) {
  51046. return (value + "=" + assignment)
  51047. } else {
  51048. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  51049. }
  51050. }
  51051. /**
  51052. * Parse a v-model expression into a base path and a final key segment.
  51053. * Handles both dot-path and possible square brackets.
  51054. *
  51055. * Possible cases:
  51056. *
  51057. * - test
  51058. * - test[key]
  51059. * - test[test1[key]]
  51060. * - test["a"][key]
  51061. * - xxx.test[a[a].test1[key]]
  51062. * - test.xxx.a["asa"][test1[key]]
  51063. *
  51064. */
  51065. var len, str, chr, index$1, expressionPos, expressionEndPos;
  51066. function parseModel (val) {
  51067. // Fix https://github.com/vuejs/vue/pull/7730
  51068. // allow v-model="obj.val " (trailing whitespace)
  51069. val = val.trim();
  51070. len = val.length;
  51071. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  51072. index$1 = val.lastIndexOf('.');
  51073. if (index$1 > -1) {
  51074. return {
  51075. exp: val.slice(0, index$1),
  51076. key: '"' + val.slice(index$1 + 1) + '"'
  51077. }
  51078. } else {
  51079. return {
  51080. exp: val,
  51081. key: null
  51082. }
  51083. }
  51084. }
  51085. str = val;
  51086. index$1 = expressionPos = expressionEndPos = 0;
  51087. while (!eof()) {
  51088. chr = next();
  51089. /* istanbul ignore if */
  51090. if (isStringStart(chr)) {
  51091. parseString(chr);
  51092. } else if (chr === 0x5B) {
  51093. parseBracket(chr);
  51094. }
  51095. }
  51096. return {
  51097. exp: val.slice(0, expressionPos),
  51098. key: val.slice(expressionPos + 1, expressionEndPos)
  51099. }
  51100. }
  51101. function next () {
  51102. return str.charCodeAt(++index$1)
  51103. }
  51104. function eof () {
  51105. return index$1 >= len
  51106. }
  51107. function isStringStart (chr) {
  51108. return chr === 0x22 || chr === 0x27
  51109. }
  51110. function parseBracket (chr) {
  51111. var inBracket = 1;
  51112. expressionPos = index$1;
  51113. while (!eof()) {
  51114. chr = next();
  51115. if (isStringStart(chr)) {
  51116. parseString(chr);
  51117. continue
  51118. }
  51119. if (chr === 0x5B) { inBracket++; }
  51120. if (chr === 0x5D) { inBracket--; }
  51121. if (inBracket === 0) {
  51122. expressionEndPos = index$1;
  51123. break
  51124. }
  51125. }
  51126. }
  51127. function parseString (chr) {
  51128. var stringQuote = chr;
  51129. while (!eof()) {
  51130. chr = next();
  51131. if (chr === stringQuote) {
  51132. break
  51133. }
  51134. }
  51135. }
  51136. /* */
  51137. var warn$1;
  51138. // in some cases, the event used has to be determined at runtime
  51139. // so we used some reserved tokens during compile.
  51140. var RANGE_TOKEN = '__r';
  51141. var CHECKBOX_RADIO_TOKEN = '__c';
  51142. function model (
  51143. el,
  51144. dir,
  51145. _warn
  51146. ) {
  51147. warn$1 = _warn;
  51148. var value = dir.value;
  51149. var modifiers = dir.modifiers;
  51150. var tag = el.tag;
  51151. var type = el.attrsMap.type;
  51152. {
  51153. // inputs with type="file" are read only and setting the input's
  51154. // value will throw an error.
  51155. if (tag === 'input' && type === 'file') {
  51156. warn$1(
  51157. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  51158. "File inputs are read only. Use a v-on:change listener instead.",
  51159. el.rawAttrsMap['v-model']
  51160. );
  51161. }
  51162. }
  51163. if (el.component) {
  51164. genComponentModel(el, value, modifiers);
  51165. // component v-model doesn't need extra runtime
  51166. return false
  51167. } else if (tag === 'select') {
  51168. genSelect(el, value, modifiers);
  51169. } else if (tag === 'input' && type === 'checkbox') {
  51170. genCheckboxModel(el, value, modifiers);
  51171. } else if (tag === 'input' && type === 'radio') {
  51172. genRadioModel(el, value, modifiers);
  51173. } else if (tag === 'input' || tag === 'textarea') {
  51174. genDefaultModel(el, value, modifiers);
  51175. } else if (!config.isReservedTag(tag)) {
  51176. genComponentModel(el, value, modifiers);
  51177. // component v-model doesn't need extra runtime
  51178. return false
  51179. } else {
  51180. warn$1(
  51181. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  51182. "v-model is not supported on this element type. " +
  51183. 'If you are working with contenteditable, it\'s recommended to ' +
  51184. 'wrap a library dedicated for that purpose inside a custom component.',
  51185. el.rawAttrsMap['v-model']
  51186. );
  51187. }
  51188. // ensure runtime directive metadata
  51189. return true
  51190. }
  51191. function genCheckboxModel (
  51192. el,
  51193. value,
  51194. modifiers
  51195. ) {
  51196. var number = modifiers && modifiers.number;
  51197. var valueBinding = getBindingAttr(el, 'value') || 'null';
  51198. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  51199. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  51200. addProp(el, 'checked',
  51201. "Array.isArray(" + value + ")" +
  51202. "?_i(" + value + "," + valueBinding + ")>-1" + (
  51203. trueValueBinding === 'true'
  51204. ? (":(" + value + ")")
  51205. : (":_q(" + value + "," + trueValueBinding + ")")
  51206. )
  51207. );
  51208. addHandler(el, 'change',
  51209. "var $$a=" + value + "," +
  51210. '$$el=$event.target,' +
  51211. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  51212. 'if(Array.isArray($$a)){' +
  51213. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  51214. '$$i=_i($$a,$$v);' +
  51215. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  51216. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  51217. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  51218. null, true
  51219. );
  51220. }
  51221. function genRadioModel (
  51222. el,
  51223. value,
  51224. modifiers
  51225. ) {
  51226. var number = modifiers && modifiers.number;
  51227. var valueBinding = getBindingAttr(el, 'value') || 'null';
  51228. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  51229. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  51230. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  51231. }
  51232. function genSelect (
  51233. el,
  51234. value,
  51235. modifiers
  51236. ) {
  51237. var number = modifiers && modifiers.number;
  51238. var selectedVal = "Array.prototype.filter" +
  51239. ".call($event.target.options,function(o){return o.selected})" +
  51240. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  51241. "return " + (number ? '_n(val)' : 'val') + "})";
  51242. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  51243. var code = "var $$selectedVal = " + selectedVal + ";";
  51244. code = code + " " + (genAssignmentCode(value, assignment));
  51245. addHandler(el, 'change', code, null, true);
  51246. }
  51247. function genDefaultModel (
  51248. el,
  51249. value,
  51250. modifiers
  51251. ) {
  51252. var type = el.attrsMap.type;
  51253. // warn if v-bind:value conflicts with v-model
  51254. // except for inputs with v-bind:type
  51255. {
  51256. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  51257. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  51258. if (value$1 && !typeBinding) {
  51259. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  51260. warn$1(
  51261. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  51262. 'because the latter already expands to a value binding internally',
  51263. el.rawAttrsMap[binding]
  51264. );
  51265. }
  51266. }
  51267. var ref = modifiers || {};
  51268. var lazy = ref.lazy;
  51269. var number = ref.number;
  51270. var trim = ref.trim;
  51271. var needCompositionGuard = !lazy && type !== 'range';
  51272. var event = lazy
  51273. ? 'change'
  51274. : type === 'range'
  51275. ? RANGE_TOKEN
  51276. : 'input';
  51277. var valueExpression = '$event.target.value';
  51278. if (trim) {
  51279. valueExpression = "$event.target.value.trim()";
  51280. }
  51281. if (number) {
  51282. valueExpression = "_n(" + valueExpression + ")";
  51283. }
  51284. var code = genAssignmentCode(value, valueExpression);
  51285. if (needCompositionGuard) {
  51286. code = "if($event.target.composing)return;" + code;
  51287. }
  51288. addProp(el, 'value', ("(" + value + ")"));
  51289. addHandler(el, event, code, null, true);
  51290. if (trim || number) {
  51291. addHandler(el, 'blur', '$forceUpdate()');
  51292. }
  51293. }
  51294. /* */
  51295. // normalize v-model event tokens that can only be determined at runtime.
  51296. // it's important to place the event as the first in the array because
  51297. // the whole point is ensuring the v-model callback gets called before
  51298. // user-attached handlers.
  51299. function normalizeEvents (on) {
  51300. /* istanbul ignore if */
  51301. if (isDef(on[RANGE_TOKEN])) {
  51302. // IE input[type=range] only supports `change` event
  51303. var event = isIE ? 'change' : 'input';
  51304. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  51305. delete on[RANGE_TOKEN];
  51306. }
  51307. // This was originally intended to fix #4521 but no longer necessary
  51308. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  51309. /* istanbul ignore if */
  51310. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  51311. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  51312. delete on[CHECKBOX_RADIO_TOKEN];
  51313. }
  51314. }
  51315. var target$1;
  51316. function createOnceHandler$1 (event, handler, capture) {
  51317. var _target = target$1; // save current target element in closure
  51318. return function onceHandler () {
  51319. var res = handler.apply(null, arguments);
  51320. if (res !== null) {
  51321. remove$2(event, onceHandler, capture, _target);
  51322. }
  51323. }
  51324. }
  51325. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  51326. // implementation and does not fire microtasks in between event propagation, so
  51327. // safe to exclude.
  51328. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  51329. function add$1 (
  51330. name,
  51331. handler,
  51332. capture,
  51333. passive
  51334. ) {
  51335. // async edge case #6566: inner click event triggers patch, event handler
  51336. // attached to outer element during patch, and triggered again. This
  51337. // happens because browsers fire microtask ticks between event propagation.
  51338. // the solution is simple: we save the timestamp when a handler is attached,
  51339. // and the handler would only fire if the event passed to it was fired
  51340. // AFTER it was attached.
  51341. if (useMicrotaskFix) {
  51342. var attachedTimestamp = currentFlushTimestamp;
  51343. var original = handler;
  51344. handler = original._wrapper = function (e) {
  51345. if (
  51346. // no bubbling, should always fire.
  51347. // this is just a safety net in case event.timeStamp is unreliable in
  51348. // certain weird environments...
  51349. e.target === e.currentTarget ||
  51350. // event is fired after handler attachment
  51351. e.timeStamp >= attachedTimestamp ||
  51352. // bail for environments that have buggy event.timeStamp implementations
  51353. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  51354. // #9681 QtWebEngine event.timeStamp is negative value
  51355. e.timeStamp <= 0 ||
  51356. // #9448 bail if event is fired in another document in a multi-page
  51357. // electron/nw.js app, since event.timeStamp will be using a different
  51358. // starting reference
  51359. e.target.ownerDocument !== document
  51360. ) {
  51361. return original.apply(this, arguments)
  51362. }
  51363. };
  51364. }
  51365. target$1.addEventListener(
  51366. name,
  51367. handler,
  51368. supportsPassive
  51369. ? { capture: capture, passive: passive }
  51370. : capture
  51371. );
  51372. }
  51373. function remove$2 (
  51374. name,
  51375. handler,
  51376. capture,
  51377. _target
  51378. ) {
  51379. (_target || target$1).removeEventListener(
  51380. name,
  51381. handler._wrapper || handler,
  51382. capture
  51383. );
  51384. }
  51385. function updateDOMListeners (oldVnode, vnode) {
  51386. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  51387. return
  51388. }
  51389. var on = vnode.data.on || {};
  51390. var oldOn = oldVnode.data.on || {};
  51391. target$1 = vnode.elm;
  51392. normalizeEvents(on);
  51393. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  51394. target$1 = undefined;
  51395. }
  51396. var events = {
  51397. create: updateDOMListeners,
  51398. update: updateDOMListeners
  51399. };
  51400. /* */
  51401. var svgContainer;
  51402. function updateDOMProps (oldVnode, vnode) {
  51403. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  51404. return
  51405. }
  51406. var key, cur;
  51407. var elm = vnode.elm;
  51408. var oldProps = oldVnode.data.domProps || {};
  51409. var props = vnode.data.domProps || {};
  51410. // clone observed objects, as the user probably wants to mutate it
  51411. if (isDef(props.__ob__)) {
  51412. props = vnode.data.domProps = extend({}, props);
  51413. }
  51414. for (key in oldProps) {
  51415. if (!(key in props)) {
  51416. elm[key] = '';
  51417. }
  51418. }
  51419. for (key in props) {
  51420. cur = props[key];
  51421. // ignore children if the node has textContent or innerHTML,
  51422. // as these will throw away existing DOM nodes and cause removal errors
  51423. // on subsequent patches (#3360)
  51424. if (key === 'textContent' || key === 'innerHTML') {
  51425. if (vnode.children) { vnode.children.length = 0; }
  51426. if (cur === oldProps[key]) { continue }
  51427. // #6601 work around Chrome version <= 55 bug where single textNode
  51428. // replaced by innerHTML/textContent retains its parentNode property
  51429. if (elm.childNodes.length === 1) {
  51430. elm.removeChild(elm.childNodes[0]);
  51431. }
  51432. }
  51433. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  51434. // store value as _value as well since
  51435. // non-string values will be stringified
  51436. elm._value = cur;
  51437. // avoid resetting cursor position when value is the same
  51438. var strCur = isUndef(cur) ? '' : String(cur);
  51439. if (shouldUpdateValue(elm, strCur)) {
  51440. elm.value = strCur;
  51441. }
  51442. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  51443. // IE doesn't support innerHTML for SVG elements
  51444. svgContainer = svgContainer || document.createElement('div');
  51445. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  51446. var svg = svgContainer.firstChild;
  51447. while (elm.firstChild) {
  51448. elm.removeChild(elm.firstChild);
  51449. }
  51450. while (svg.firstChild) {
  51451. elm.appendChild(svg.firstChild);
  51452. }
  51453. } else if (
  51454. // skip the update if old and new VDOM state is the same.
  51455. // `value` is handled separately because the DOM value may be temporarily
  51456. // out of sync with VDOM state due to focus, composition and modifiers.
  51457. // This #4521 by skipping the unnecesarry `checked` update.
  51458. cur !== oldProps[key]
  51459. ) {
  51460. // some property updates can throw
  51461. // e.g. `value` on <progress> w/ non-finite value
  51462. try {
  51463. elm[key] = cur;
  51464. } catch (e) {}
  51465. }
  51466. }
  51467. }
  51468. // check platforms/web/util/attrs.js acceptValue
  51469. function shouldUpdateValue (elm, checkVal) {
  51470. return (!elm.composing && (
  51471. elm.tagName === 'OPTION' ||
  51472. isNotInFocusAndDirty(elm, checkVal) ||
  51473. isDirtyWithModifiers(elm, checkVal)
  51474. ))
  51475. }
  51476. function isNotInFocusAndDirty (elm, checkVal) {
  51477. // return true when textbox (.number and .trim) loses focus and its value is
  51478. // not equal to the updated value
  51479. var notInFocus = true;
  51480. // #6157
  51481. // work around IE bug when accessing document.activeElement in an iframe
  51482. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  51483. return notInFocus && elm.value !== checkVal
  51484. }
  51485. function isDirtyWithModifiers (elm, newVal) {
  51486. var value = elm.value;
  51487. var modifiers = elm._vModifiers; // injected by v-model runtime
  51488. if (isDef(modifiers)) {
  51489. if (modifiers.number) {
  51490. return toNumber(value) !== toNumber(newVal)
  51491. }
  51492. if (modifiers.trim) {
  51493. return value.trim() !== newVal.trim()
  51494. }
  51495. }
  51496. return value !== newVal
  51497. }
  51498. var domProps = {
  51499. create: updateDOMProps,
  51500. update: updateDOMProps
  51501. };
  51502. /* */
  51503. var parseStyleText = cached(function (cssText) {
  51504. var res = {};
  51505. var listDelimiter = /;(?![^(]*\))/g;
  51506. var propertyDelimiter = /:(.+)/;
  51507. cssText.split(listDelimiter).forEach(function (item) {
  51508. if (item) {
  51509. var tmp = item.split(propertyDelimiter);
  51510. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  51511. }
  51512. });
  51513. return res
  51514. });
  51515. // merge static and dynamic style data on the same vnode
  51516. function normalizeStyleData (data) {
  51517. var style = normalizeStyleBinding(data.style);
  51518. // static style is pre-processed into an object during compilation
  51519. // and is always a fresh object, so it's safe to merge into it
  51520. return data.staticStyle
  51521. ? extend(data.staticStyle, style)
  51522. : style
  51523. }
  51524. // normalize possible array / string values into Object
  51525. function normalizeStyleBinding (bindingStyle) {
  51526. if (Array.isArray(bindingStyle)) {
  51527. return toObject(bindingStyle)
  51528. }
  51529. if (typeof bindingStyle === 'string') {
  51530. return parseStyleText(bindingStyle)
  51531. }
  51532. return bindingStyle
  51533. }
  51534. /**
  51535. * parent component style should be after child's
  51536. * so that parent component's style could override it
  51537. */
  51538. function getStyle (vnode, checkChild) {
  51539. var res = {};
  51540. var styleData;
  51541. if (checkChild) {
  51542. var childNode = vnode;
  51543. while (childNode.componentInstance) {
  51544. childNode = childNode.componentInstance._vnode;
  51545. if (
  51546. childNode && childNode.data &&
  51547. (styleData = normalizeStyleData(childNode.data))
  51548. ) {
  51549. extend(res, styleData);
  51550. }
  51551. }
  51552. }
  51553. if ((styleData = normalizeStyleData(vnode.data))) {
  51554. extend(res, styleData);
  51555. }
  51556. var parentNode = vnode;
  51557. while ((parentNode = parentNode.parent)) {
  51558. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  51559. extend(res, styleData);
  51560. }
  51561. }
  51562. return res
  51563. }
  51564. /* */
  51565. var cssVarRE = /^--/;
  51566. var importantRE = /\s*!important$/;
  51567. var setProp = function (el, name, val) {
  51568. /* istanbul ignore if */
  51569. if (cssVarRE.test(name)) {
  51570. el.style.setProperty(name, val);
  51571. } else if (importantRE.test(val)) {
  51572. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  51573. } else {
  51574. var normalizedName = normalize(name);
  51575. if (Array.isArray(val)) {
  51576. // Support values array created by autoprefixer, e.g.
  51577. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  51578. // Set them one by one, and the browser will only set those it can recognize
  51579. for (var i = 0, len = val.length; i < len; i++) {
  51580. el.style[normalizedName] = val[i];
  51581. }
  51582. } else {
  51583. el.style[normalizedName] = val;
  51584. }
  51585. }
  51586. };
  51587. var vendorNames = ['Webkit', 'Moz', 'ms'];
  51588. var emptyStyle;
  51589. var normalize = cached(function (prop) {
  51590. emptyStyle = emptyStyle || document.createElement('div').style;
  51591. prop = camelize(prop);
  51592. if (prop !== 'filter' && (prop in emptyStyle)) {
  51593. return prop
  51594. }
  51595. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  51596. for (var i = 0; i < vendorNames.length; i++) {
  51597. var name = vendorNames[i] + capName;
  51598. if (name in emptyStyle) {
  51599. return name
  51600. }
  51601. }
  51602. });
  51603. function updateStyle (oldVnode, vnode) {
  51604. var data = vnode.data;
  51605. var oldData = oldVnode.data;
  51606. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  51607. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  51608. ) {
  51609. return
  51610. }
  51611. var cur, name;
  51612. var el = vnode.elm;
  51613. var oldStaticStyle = oldData.staticStyle;
  51614. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  51615. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  51616. var oldStyle = oldStaticStyle || oldStyleBinding;
  51617. var style = normalizeStyleBinding(vnode.data.style) || {};
  51618. // store normalized style under a different key for next diff
  51619. // make sure to clone it if it's reactive, since the user likely wants
  51620. // to mutate it.
  51621. vnode.data.normalizedStyle = isDef(style.__ob__)
  51622. ? extend({}, style)
  51623. : style;
  51624. var newStyle = getStyle(vnode, true);
  51625. for (name in oldStyle) {
  51626. if (isUndef(newStyle[name])) {
  51627. setProp(el, name, '');
  51628. }
  51629. }
  51630. for (name in newStyle) {
  51631. cur = newStyle[name];
  51632. if (cur !== oldStyle[name]) {
  51633. // ie9 setting to null has no effect, must use empty string
  51634. setProp(el, name, cur == null ? '' : cur);
  51635. }
  51636. }
  51637. }
  51638. var style = {
  51639. create: updateStyle,
  51640. update: updateStyle
  51641. };
  51642. /* */
  51643. var whitespaceRE = /\s+/;
  51644. /**
  51645. * Add class with compatibility for SVG since classList is not supported on
  51646. * SVG elements in IE
  51647. */
  51648. function addClass (el, cls) {
  51649. /* istanbul ignore if */
  51650. if (!cls || !(cls = cls.trim())) {
  51651. return
  51652. }
  51653. /* istanbul ignore else */
  51654. if (el.classList) {
  51655. if (cls.indexOf(' ') > -1) {
  51656. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  51657. } else {
  51658. el.classList.add(cls);
  51659. }
  51660. } else {
  51661. var cur = " " + (el.getAttribute('class') || '') + " ";
  51662. if (cur.indexOf(' ' + cls + ' ') < 0) {
  51663. el.setAttribute('class', (cur + cls).trim());
  51664. }
  51665. }
  51666. }
  51667. /**
  51668. * Remove class with compatibility for SVG since classList is not supported on
  51669. * SVG elements in IE
  51670. */
  51671. function removeClass (el, cls) {
  51672. /* istanbul ignore if */
  51673. if (!cls || !(cls = cls.trim())) {
  51674. return
  51675. }
  51676. /* istanbul ignore else */
  51677. if (el.classList) {
  51678. if (cls.indexOf(' ') > -1) {
  51679. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  51680. } else {
  51681. el.classList.remove(cls);
  51682. }
  51683. if (!el.classList.length) {
  51684. el.removeAttribute('class');
  51685. }
  51686. } else {
  51687. var cur = " " + (el.getAttribute('class') || '') + " ";
  51688. var tar = ' ' + cls + ' ';
  51689. while (cur.indexOf(tar) >= 0) {
  51690. cur = cur.replace(tar, ' ');
  51691. }
  51692. cur = cur.trim();
  51693. if (cur) {
  51694. el.setAttribute('class', cur);
  51695. } else {
  51696. el.removeAttribute('class');
  51697. }
  51698. }
  51699. }
  51700. /* */
  51701. function resolveTransition (def$$1) {
  51702. if (!def$$1) {
  51703. return
  51704. }
  51705. /* istanbul ignore else */
  51706. if (typeof def$$1 === 'object') {
  51707. var res = {};
  51708. if (def$$1.css !== false) {
  51709. extend(res, autoCssTransition(def$$1.name || 'v'));
  51710. }
  51711. extend(res, def$$1);
  51712. return res
  51713. } else if (typeof def$$1 === 'string') {
  51714. return autoCssTransition(def$$1)
  51715. }
  51716. }
  51717. var autoCssTransition = cached(function (name) {
  51718. return {
  51719. enterClass: (name + "-enter"),
  51720. enterToClass: (name + "-enter-to"),
  51721. enterActiveClass: (name + "-enter-active"),
  51722. leaveClass: (name + "-leave"),
  51723. leaveToClass: (name + "-leave-to"),
  51724. leaveActiveClass: (name + "-leave-active")
  51725. }
  51726. });
  51727. var hasTransition = inBrowser && !isIE9;
  51728. var TRANSITION = 'transition';
  51729. var ANIMATION = 'animation';
  51730. // Transition property/event sniffing
  51731. var transitionProp = 'transition';
  51732. var transitionEndEvent = 'transitionend';
  51733. var animationProp = 'animation';
  51734. var animationEndEvent = 'animationend';
  51735. if (hasTransition) {
  51736. /* istanbul ignore if */
  51737. if (window.ontransitionend === undefined &&
  51738. window.onwebkittransitionend !== undefined
  51739. ) {
  51740. transitionProp = 'WebkitTransition';
  51741. transitionEndEvent = 'webkitTransitionEnd';
  51742. }
  51743. if (window.onanimationend === undefined &&
  51744. window.onwebkitanimationend !== undefined
  51745. ) {
  51746. animationProp = 'WebkitAnimation';
  51747. animationEndEvent = 'webkitAnimationEnd';
  51748. }
  51749. }
  51750. // binding to window is necessary to make hot reload work in IE in strict mode
  51751. var raf = inBrowser
  51752. ? window.requestAnimationFrame
  51753. ? window.requestAnimationFrame.bind(window)
  51754. : setTimeout
  51755. : /* istanbul ignore next */ function (fn) { return fn(); };
  51756. function nextFrame (fn) {
  51757. raf(function () {
  51758. raf(fn);
  51759. });
  51760. }
  51761. function addTransitionClass (el, cls) {
  51762. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  51763. if (transitionClasses.indexOf(cls) < 0) {
  51764. transitionClasses.push(cls);
  51765. addClass(el, cls);
  51766. }
  51767. }
  51768. function removeTransitionClass (el, cls) {
  51769. if (el._transitionClasses) {
  51770. remove(el._transitionClasses, cls);
  51771. }
  51772. removeClass(el, cls);
  51773. }
  51774. function whenTransitionEnds (
  51775. el,
  51776. expectedType,
  51777. cb
  51778. ) {
  51779. var ref = getTransitionInfo(el, expectedType);
  51780. var type = ref.type;
  51781. var timeout = ref.timeout;
  51782. var propCount = ref.propCount;
  51783. if (!type) { return cb() }
  51784. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  51785. var ended = 0;
  51786. var end = function () {
  51787. el.removeEventListener(event, onEnd);
  51788. cb();
  51789. };
  51790. var onEnd = function (e) {
  51791. if (e.target === el) {
  51792. if (++ended >= propCount) {
  51793. end();
  51794. }
  51795. }
  51796. };
  51797. setTimeout(function () {
  51798. if (ended < propCount) {
  51799. end();
  51800. }
  51801. }, timeout + 1);
  51802. el.addEventListener(event, onEnd);
  51803. }
  51804. var transformRE = /\b(transform|all)(,|$)/;
  51805. function getTransitionInfo (el, expectedType) {
  51806. var styles = window.getComputedStyle(el);
  51807. // JSDOM may return undefined for transition properties
  51808. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  51809. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  51810. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  51811. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  51812. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  51813. var animationTimeout = getTimeout(animationDelays, animationDurations);
  51814. var type;
  51815. var timeout = 0;
  51816. var propCount = 0;
  51817. /* istanbul ignore if */
  51818. if (expectedType === TRANSITION) {
  51819. if (transitionTimeout > 0) {
  51820. type = TRANSITION;
  51821. timeout = transitionTimeout;
  51822. propCount = transitionDurations.length;
  51823. }
  51824. } else if (expectedType === ANIMATION) {
  51825. if (animationTimeout > 0) {
  51826. type = ANIMATION;
  51827. timeout = animationTimeout;
  51828. propCount = animationDurations.length;
  51829. }
  51830. } else {
  51831. timeout = Math.max(transitionTimeout, animationTimeout);
  51832. type = timeout > 0
  51833. ? transitionTimeout > animationTimeout
  51834. ? TRANSITION
  51835. : ANIMATION
  51836. : null;
  51837. propCount = type
  51838. ? type === TRANSITION
  51839. ? transitionDurations.length
  51840. : animationDurations.length
  51841. : 0;
  51842. }
  51843. var hasTransform =
  51844. type === TRANSITION &&
  51845. transformRE.test(styles[transitionProp + 'Property']);
  51846. return {
  51847. type: type,
  51848. timeout: timeout,
  51849. propCount: propCount,
  51850. hasTransform: hasTransform
  51851. }
  51852. }
  51853. function getTimeout (delays, durations) {
  51854. /* istanbul ignore next */
  51855. while (delays.length < durations.length) {
  51856. delays = delays.concat(delays);
  51857. }
  51858. return Math.max.apply(null, durations.map(function (d, i) {
  51859. return toMs(d) + toMs(delays[i])
  51860. }))
  51861. }
  51862. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  51863. // in a locale-dependent way, using a comma instead of a dot.
  51864. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  51865. // as a floor function) causing unexpected behaviors
  51866. function toMs (s) {
  51867. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  51868. }
  51869. /* */
  51870. function enter (vnode, toggleDisplay) {
  51871. var el = vnode.elm;
  51872. // call leave callback now
  51873. if (isDef(el._leaveCb)) {
  51874. el._leaveCb.cancelled = true;
  51875. el._leaveCb();
  51876. }
  51877. var data = resolveTransition(vnode.data.transition);
  51878. if (isUndef(data)) {
  51879. return
  51880. }
  51881. /* istanbul ignore if */
  51882. if (isDef(el._enterCb) || el.nodeType !== 1) {
  51883. return
  51884. }
  51885. var css = data.css;
  51886. var type = data.type;
  51887. var enterClass = data.enterClass;
  51888. var enterToClass = data.enterToClass;
  51889. var enterActiveClass = data.enterActiveClass;
  51890. var appearClass = data.appearClass;
  51891. var appearToClass = data.appearToClass;
  51892. var appearActiveClass = data.appearActiveClass;
  51893. var beforeEnter = data.beforeEnter;
  51894. var enter = data.enter;
  51895. var afterEnter = data.afterEnter;
  51896. var enterCancelled = data.enterCancelled;
  51897. var beforeAppear = data.beforeAppear;
  51898. var appear = data.appear;
  51899. var afterAppear = data.afterAppear;
  51900. var appearCancelled = data.appearCancelled;
  51901. var duration = data.duration;
  51902. // activeInstance will always be the <transition> component managing this
  51903. // transition. One edge case to check is when the <transition> is placed
  51904. // as the root node of a child component. In that case we need to check
  51905. // <transition>'s parent for appear check.
  51906. var context = activeInstance;
  51907. var transitionNode = activeInstance.$vnode;
  51908. while (transitionNode && transitionNode.parent) {
  51909. context = transitionNode.context;
  51910. transitionNode = transitionNode.parent;
  51911. }
  51912. var isAppear = !context._isMounted || !vnode.isRootInsert;
  51913. if (isAppear && !appear && appear !== '') {
  51914. return
  51915. }
  51916. var startClass = isAppear && appearClass
  51917. ? appearClass
  51918. : enterClass;
  51919. var activeClass = isAppear && appearActiveClass
  51920. ? appearActiveClass
  51921. : enterActiveClass;
  51922. var toClass = isAppear && appearToClass
  51923. ? appearToClass
  51924. : enterToClass;
  51925. var beforeEnterHook = isAppear
  51926. ? (beforeAppear || beforeEnter)
  51927. : beforeEnter;
  51928. var enterHook = isAppear
  51929. ? (typeof appear === 'function' ? appear : enter)
  51930. : enter;
  51931. var afterEnterHook = isAppear
  51932. ? (afterAppear || afterEnter)
  51933. : afterEnter;
  51934. var enterCancelledHook = isAppear
  51935. ? (appearCancelled || enterCancelled)
  51936. : enterCancelled;
  51937. var explicitEnterDuration = toNumber(
  51938. isObject(duration)
  51939. ? duration.enter
  51940. : duration
  51941. );
  51942. if (explicitEnterDuration != null) {
  51943. checkDuration(explicitEnterDuration, 'enter', vnode);
  51944. }
  51945. var expectsCSS = css !== false && !isIE9;
  51946. var userWantsControl = getHookArgumentsLength(enterHook);
  51947. var cb = el._enterCb = once(function () {
  51948. if (expectsCSS) {
  51949. removeTransitionClass(el, toClass);
  51950. removeTransitionClass(el, activeClass);
  51951. }
  51952. if (cb.cancelled) {
  51953. if (expectsCSS) {
  51954. removeTransitionClass(el, startClass);
  51955. }
  51956. enterCancelledHook && enterCancelledHook(el);
  51957. } else {
  51958. afterEnterHook && afterEnterHook(el);
  51959. }
  51960. el._enterCb = null;
  51961. });
  51962. if (!vnode.data.show) {
  51963. // remove pending leave element on enter by injecting an insert hook
  51964. mergeVNodeHook(vnode, 'insert', function () {
  51965. var parent = el.parentNode;
  51966. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  51967. if (pendingNode &&
  51968. pendingNode.tag === vnode.tag &&
  51969. pendingNode.elm._leaveCb
  51970. ) {
  51971. pendingNode.elm._leaveCb();
  51972. }
  51973. enterHook && enterHook(el, cb);
  51974. });
  51975. }
  51976. // start enter transition
  51977. beforeEnterHook && beforeEnterHook(el);
  51978. if (expectsCSS) {
  51979. addTransitionClass(el, startClass);
  51980. addTransitionClass(el, activeClass);
  51981. nextFrame(function () {
  51982. removeTransitionClass(el, startClass);
  51983. if (!cb.cancelled) {
  51984. addTransitionClass(el, toClass);
  51985. if (!userWantsControl) {
  51986. if (isValidDuration(explicitEnterDuration)) {
  51987. setTimeout(cb, explicitEnterDuration);
  51988. } else {
  51989. whenTransitionEnds(el, type, cb);
  51990. }
  51991. }
  51992. }
  51993. });
  51994. }
  51995. if (vnode.data.show) {
  51996. toggleDisplay && toggleDisplay();
  51997. enterHook && enterHook(el, cb);
  51998. }
  51999. if (!expectsCSS && !userWantsControl) {
  52000. cb();
  52001. }
  52002. }
  52003. function leave (vnode, rm) {
  52004. var el = vnode.elm;
  52005. // call enter callback now
  52006. if (isDef(el._enterCb)) {
  52007. el._enterCb.cancelled = true;
  52008. el._enterCb();
  52009. }
  52010. var data = resolveTransition(vnode.data.transition);
  52011. if (isUndef(data) || el.nodeType !== 1) {
  52012. return rm()
  52013. }
  52014. /* istanbul ignore if */
  52015. if (isDef(el._leaveCb)) {
  52016. return
  52017. }
  52018. var css = data.css;
  52019. var type = data.type;
  52020. var leaveClass = data.leaveClass;
  52021. var leaveToClass = data.leaveToClass;
  52022. var leaveActiveClass = data.leaveActiveClass;
  52023. var beforeLeave = data.beforeLeave;
  52024. var leave = data.leave;
  52025. var afterLeave = data.afterLeave;
  52026. var leaveCancelled = data.leaveCancelled;
  52027. var delayLeave = data.delayLeave;
  52028. var duration = data.duration;
  52029. var expectsCSS = css !== false && !isIE9;
  52030. var userWantsControl = getHookArgumentsLength(leave);
  52031. var explicitLeaveDuration = toNumber(
  52032. isObject(duration)
  52033. ? duration.leave
  52034. : duration
  52035. );
  52036. if (isDef(explicitLeaveDuration)) {
  52037. checkDuration(explicitLeaveDuration, 'leave', vnode);
  52038. }
  52039. var cb = el._leaveCb = once(function () {
  52040. if (el.parentNode && el.parentNode._pending) {
  52041. el.parentNode._pending[vnode.key] = null;
  52042. }
  52043. if (expectsCSS) {
  52044. removeTransitionClass(el, leaveToClass);
  52045. removeTransitionClass(el, leaveActiveClass);
  52046. }
  52047. if (cb.cancelled) {
  52048. if (expectsCSS) {
  52049. removeTransitionClass(el, leaveClass);
  52050. }
  52051. leaveCancelled && leaveCancelled(el);
  52052. } else {
  52053. rm();
  52054. afterLeave && afterLeave(el);
  52055. }
  52056. el._leaveCb = null;
  52057. });
  52058. if (delayLeave) {
  52059. delayLeave(performLeave);
  52060. } else {
  52061. performLeave();
  52062. }
  52063. function performLeave () {
  52064. // the delayed leave may have already been cancelled
  52065. if (cb.cancelled) {
  52066. return
  52067. }
  52068. // record leaving element
  52069. if (!vnode.data.show && el.parentNode) {
  52070. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  52071. }
  52072. beforeLeave && beforeLeave(el);
  52073. if (expectsCSS) {
  52074. addTransitionClass(el, leaveClass);
  52075. addTransitionClass(el, leaveActiveClass);
  52076. nextFrame(function () {
  52077. removeTransitionClass(el, leaveClass);
  52078. if (!cb.cancelled) {
  52079. addTransitionClass(el, leaveToClass);
  52080. if (!userWantsControl) {
  52081. if (isValidDuration(explicitLeaveDuration)) {
  52082. setTimeout(cb, explicitLeaveDuration);
  52083. } else {
  52084. whenTransitionEnds(el, type, cb);
  52085. }
  52086. }
  52087. }
  52088. });
  52089. }
  52090. leave && leave(el, cb);
  52091. if (!expectsCSS && !userWantsControl) {
  52092. cb();
  52093. }
  52094. }
  52095. }
  52096. // only used in dev mode
  52097. function checkDuration (val, name, vnode) {
  52098. if (typeof val !== 'number') {
  52099. warn(
  52100. "<transition> explicit " + name + " duration is not a valid number - " +
  52101. "got " + (JSON.stringify(val)) + ".",
  52102. vnode.context
  52103. );
  52104. } else if (isNaN(val)) {
  52105. warn(
  52106. "<transition> explicit " + name + " duration is NaN - " +
  52107. 'the duration expression might be incorrect.',
  52108. vnode.context
  52109. );
  52110. }
  52111. }
  52112. function isValidDuration (val) {
  52113. return typeof val === 'number' && !isNaN(val)
  52114. }
  52115. /**
  52116. * Normalize a transition hook's argument length. The hook may be:
  52117. * - a merged hook (invoker) with the original in .fns
  52118. * - a wrapped component method (check ._length)
  52119. * - a plain function (.length)
  52120. */
  52121. function getHookArgumentsLength (fn) {
  52122. if (isUndef(fn)) {
  52123. return false
  52124. }
  52125. var invokerFns = fn.fns;
  52126. if (isDef(invokerFns)) {
  52127. // invoker
  52128. return getHookArgumentsLength(
  52129. Array.isArray(invokerFns)
  52130. ? invokerFns[0]
  52131. : invokerFns
  52132. )
  52133. } else {
  52134. return (fn._length || fn.length) > 1
  52135. }
  52136. }
  52137. function _enter (_, vnode) {
  52138. if (vnode.data.show !== true) {
  52139. enter(vnode);
  52140. }
  52141. }
  52142. var transition = inBrowser ? {
  52143. create: _enter,
  52144. activate: _enter,
  52145. remove: function remove$$1 (vnode, rm) {
  52146. /* istanbul ignore else */
  52147. if (vnode.data.show !== true) {
  52148. leave(vnode, rm);
  52149. } else {
  52150. rm();
  52151. }
  52152. }
  52153. } : {};
  52154. var platformModules = [
  52155. attrs,
  52156. klass,
  52157. events,
  52158. domProps,
  52159. style,
  52160. transition
  52161. ];
  52162. /* */
  52163. // the directive module should be applied last, after all
  52164. // built-in modules have been applied.
  52165. var modules = platformModules.concat(baseModules);
  52166. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  52167. /**
  52168. * Not type checking this file because flow doesn't like attaching
  52169. * properties to Elements.
  52170. */
  52171. /* istanbul ignore if */
  52172. if (isIE9) {
  52173. // http://www.matts411.com/post/internet-explorer-9-oninput/
  52174. document.addEventListener('selectionchange', function () {
  52175. var el = document.activeElement;
  52176. if (el && el.vmodel) {
  52177. trigger(el, 'input');
  52178. }
  52179. });
  52180. }
  52181. var directive = {
  52182. inserted: function inserted (el, binding, vnode, oldVnode) {
  52183. if (vnode.tag === 'select') {
  52184. // #6903
  52185. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  52186. mergeVNodeHook(vnode, 'postpatch', function () {
  52187. directive.componentUpdated(el, binding, vnode);
  52188. });
  52189. } else {
  52190. setSelected(el, binding, vnode.context);
  52191. }
  52192. el._vOptions = [].map.call(el.options, getValue);
  52193. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  52194. el._vModifiers = binding.modifiers;
  52195. if (!binding.modifiers.lazy) {
  52196. el.addEventListener('compositionstart', onCompositionStart);
  52197. el.addEventListener('compositionend', onCompositionEnd);
  52198. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  52199. // switching focus before confirming composition choice
  52200. // this also fixes the issue where some browsers e.g. iOS Chrome
  52201. // fires "change" instead of "input" on autocomplete.
  52202. el.addEventListener('change', onCompositionEnd);
  52203. /* istanbul ignore if */
  52204. if (isIE9) {
  52205. el.vmodel = true;
  52206. }
  52207. }
  52208. }
  52209. },
  52210. componentUpdated: function componentUpdated (el, binding, vnode) {
  52211. if (vnode.tag === 'select') {
  52212. setSelected(el, binding, vnode.context);
  52213. // in case the options rendered by v-for have changed,
  52214. // it's possible that the value is out-of-sync with the rendered options.
  52215. // detect such cases and filter out values that no longer has a matching
  52216. // option in the DOM.
  52217. var prevOptions = el._vOptions;
  52218. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  52219. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  52220. // trigger change event if
  52221. // no matching option found for at least one value
  52222. var needReset = el.multiple
  52223. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  52224. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  52225. if (needReset) {
  52226. trigger(el, 'change');
  52227. }
  52228. }
  52229. }
  52230. }
  52231. };
  52232. function setSelected (el, binding, vm) {
  52233. actuallySetSelected(el, binding, vm);
  52234. /* istanbul ignore if */
  52235. if (isIE || isEdge) {
  52236. setTimeout(function () {
  52237. actuallySetSelected(el, binding, vm);
  52238. }, 0);
  52239. }
  52240. }
  52241. function actuallySetSelected (el, binding, vm) {
  52242. var value = binding.value;
  52243. var isMultiple = el.multiple;
  52244. if (isMultiple && !Array.isArray(value)) {
  52245. warn(
  52246. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  52247. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  52248. vm
  52249. );
  52250. return
  52251. }
  52252. var selected, option;
  52253. for (var i = 0, l = el.options.length; i < l; i++) {
  52254. option = el.options[i];
  52255. if (isMultiple) {
  52256. selected = looseIndexOf(value, getValue(option)) > -1;
  52257. if (option.selected !== selected) {
  52258. option.selected = selected;
  52259. }
  52260. } else {
  52261. if (looseEqual(getValue(option), value)) {
  52262. if (el.selectedIndex !== i) {
  52263. el.selectedIndex = i;
  52264. }
  52265. return
  52266. }
  52267. }
  52268. }
  52269. if (!isMultiple) {
  52270. el.selectedIndex = -1;
  52271. }
  52272. }
  52273. function hasNoMatchingOption (value, options) {
  52274. return options.every(function (o) { return !looseEqual(o, value); })
  52275. }
  52276. function getValue (option) {
  52277. return '_value' in option
  52278. ? option._value
  52279. : option.value
  52280. }
  52281. function onCompositionStart (e) {
  52282. e.target.composing = true;
  52283. }
  52284. function onCompositionEnd (e) {
  52285. // prevent triggering an input event for no reason
  52286. if (!e.target.composing) { return }
  52287. e.target.composing = false;
  52288. trigger(e.target, 'input');
  52289. }
  52290. function trigger (el, type) {
  52291. var e = document.createEvent('HTMLEvents');
  52292. e.initEvent(type, true, true);
  52293. el.dispatchEvent(e);
  52294. }
  52295. /* */
  52296. // recursively search for possible transition defined inside the component root
  52297. function locateNode (vnode) {
  52298. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  52299. ? locateNode(vnode.componentInstance._vnode)
  52300. : vnode
  52301. }
  52302. var show = {
  52303. bind: function bind (el, ref, vnode) {
  52304. var value = ref.value;
  52305. vnode = locateNode(vnode);
  52306. var transition$$1 = vnode.data && vnode.data.transition;
  52307. var originalDisplay = el.__vOriginalDisplay =
  52308. el.style.display === 'none' ? '' : el.style.display;
  52309. if (value && transition$$1) {
  52310. vnode.data.show = true;
  52311. enter(vnode, function () {
  52312. el.style.display = originalDisplay;
  52313. });
  52314. } else {
  52315. el.style.display = value ? originalDisplay : 'none';
  52316. }
  52317. },
  52318. update: function update (el, ref, vnode) {
  52319. var value = ref.value;
  52320. var oldValue = ref.oldValue;
  52321. /* istanbul ignore if */
  52322. if (!value === !oldValue) { return }
  52323. vnode = locateNode(vnode);
  52324. var transition$$1 = vnode.data && vnode.data.transition;
  52325. if (transition$$1) {
  52326. vnode.data.show = true;
  52327. if (value) {
  52328. enter(vnode, function () {
  52329. el.style.display = el.__vOriginalDisplay;
  52330. });
  52331. } else {
  52332. leave(vnode, function () {
  52333. el.style.display = 'none';
  52334. });
  52335. }
  52336. } else {
  52337. el.style.display = value ? el.__vOriginalDisplay : 'none';
  52338. }
  52339. },
  52340. unbind: function unbind (
  52341. el,
  52342. binding,
  52343. vnode,
  52344. oldVnode,
  52345. isDestroy
  52346. ) {
  52347. if (!isDestroy) {
  52348. el.style.display = el.__vOriginalDisplay;
  52349. }
  52350. }
  52351. };
  52352. var platformDirectives = {
  52353. model: directive,
  52354. show: show
  52355. };
  52356. /* */
  52357. var transitionProps = {
  52358. name: String,
  52359. appear: Boolean,
  52360. css: Boolean,
  52361. mode: String,
  52362. type: String,
  52363. enterClass: String,
  52364. leaveClass: String,
  52365. enterToClass: String,
  52366. leaveToClass: String,
  52367. enterActiveClass: String,
  52368. leaveActiveClass: String,
  52369. appearClass: String,
  52370. appearActiveClass: String,
  52371. appearToClass: String,
  52372. duration: [Number, String, Object]
  52373. };
  52374. // in case the child is also an abstract component, e.g. <keep-alive>
  52375. // we want to recursively retrieve the real component to be rendered
  52376. function getRealChild (vnode) {
  52377. var compOptions = vnode && vnode.componentOptions;
  52378. if (compOptions && compOptions.Ctor.options.abstract) {
  52379. return getRealChild(getFirstComponentChild(compOptions.children))
  52380. } else {
  52381. return vnode
  52382. }
  52383. }
  52384. function extractTransitionData (comp) {
  52385. var data = {};
  52386. var options = comp.$options;
  52387. // props
  52388. for (var key in options.propsData) {
  52389. data[key] = comp[key];
  52390. }
  52391. // events.
  52392. // extract listeners and pass them directly to the transition methods
  52393. var listeners = options._parentListeners;
  52394. for (var key$1 in listeners) {
  52395. data[camelize(key$1)] = listeners[key$1];
  52396. }
  52397. return data
  52398. }
  52399. function placeholder (h, rawChild) {
  52400. if (/\d-keep-alive$/.test(rawChild.tag)) {
  52401. return h('keep-alive', {
  52402. props: rawChild.componentOptions.propsData
  52403. })
  52404. }
  52405. }
  52406. function hasParentTransition (vnode) {
  52407. while ((vnode = vnode.parent)) {
  52408. if (vnode.data.transition) {
  52409. return true
  52410. }
  52411. }
  52412. }
  52413. function isSameChild (child, oldChild) {
  52414. return oldChild.key === child.key && oldChild.tag === child.tag
  52415. }
  52416. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  52417. var isVShowDirective = function (d) { return d.name === 'show'; };
  52418. var Transition = {
  52419. name: 'transition',
  52420. props: transitionProps,
  52421. abstract: true,
  52422. render: function render (h) {
  52423. var this$1 = this;
  52424. var children = this.$slots.default;
  52425. if (!children) {
  52426. return
  52427. }
  52428. // filter out text nodes (possible whitespaces)
  52429. children = children.filter(isNotTextNode);
  52430. /* istanbul ignore if */
  52431. if (!children.length) {
  52432. return
  52433. }
  52434. // warn multiple elements
  52435. if (children.length > 1) {
  52436. warn(
  52437. '<transition> can only be used on a single element. Use ' +
  52438. '<transition-group> for lists.',
  52439. this.$parent
  52440. );
  52441. }
  52442. var mode = this.mode;
  52443. // warn invalid mode
  52444. if (mode && mode !== 'in-out' && mode !== 'out-in'
  52445. ) {
  52446. warn(
  52447. 'invalid <transition> mode: ' + mode,
  52448. this.$parent
  52449. );
  52450. }
  52451. var rawChild = children[0];
  52452. // if this is a component root node and the component's
  52453. // parent container node also has transition, skip.
  52454. if (hasParentTransition(this.$vnode)) {
  52455. return rawChild
  52456. }
  52457. // apply transition data to child
  52458. // use getRealChild() to ignore abstract components e.g. keep-alive
  52459. var child = getRealChild(rawChild);
  52460. /* istanbul ignore if */
  52461. if (!child) {
  52462. return rawChild
  52463. }
  52464. if (this._leaving) {
  52465. return placeholder(h, rawChild)
  52466. }
  52467. // ensure a key that is unique to the vnode type and to this transition
  52468. // component instance. This key will be used to remove pending leaving nodes
  52469. // during entering.
  52470. var id = "__transition-" + (this._uid) + "-";
  52471. child.key = child.key == null
  52472. ? child.isComment
  52473. ? id + 'comment'
  52474. : id + child.tag
  52475. : isPrimitive(child.key)
  52476. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  52477. : child.key;
  52478. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  52479. var oldRawChild = this._vnode;
  52480. var oldChild = getRealChild(oldRawChild);
  52481. // mark v-show
  52482. // so that the transition module can hand over the control to the directive
  52483. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  52484. child.data.show = true;
  52485. }
  52486. if (
  52487. oldChild &&
  52488. oldChild.data &&
  52489. !isSameChild(child, oldChild) &&
  52490. !isAsyncPlaceholder(oldChild) &&
  52491. // #6687 component root is a comment node
  52492. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  52493. ) {
  52494. // replace old child transition data with fresh one
  52495. // important for dynamic transitions!
  52496. var oldData = oldChild.data.transition = extend({}, data);
  52497. // handle transition mode
  52498. if (mode === 'out-in') {
  52499. // return placeholder node and queue update when leave finishes
  52500. this._leaving = true;
  52501. mergeVNodeHook(oldData, 'afterLeave', function () {
  52502. this$1._leaving = false;
  52503. this$1.$forceUpdate();
  52504. });
  52505. return placeholder(h, rawChild)
  52506. } else if (mode === 'in-out') {
  52507. if (isAsyncPlaceholder(child)) {
  52508. return oldRawChild
  52509. }
  52510. var delayedLeave;
  52511. var performLeave = function () { delayedLeave(); };
  52512. mergeVNodeHook(data, 'afterEnter', performLeave);
  52513. mergeVNodeHook(data, 'enterCancelled', performLeave);
  52514. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  52515. }
  52516. }
  52517. return rawChild
  52518. }
  52519. };
  52520. /* */
  52521. var props = extend({
  52522. tag: String,
  52523. moveClass: String
  52524. }, transitionProps);
  52525. delete props.mode;
  52526. var TransitionGroup = {
  52527. props: props,
  52528. beforeMount: function beforeMount () {
  52529. var this$1 = this;
  52530. var update = this._update;
  52531. this._update = function (vnode, hydrating) {
  52532. var restoreActiveInstance = setActiveInstance(this$1);
  52533. // force removing pass
  52534. this$1.__patch__(
  52535. this$1._vnode,
  52536. this$1.kept,
  52537. false, // hydrating
  52538. true // removeOnly (!important, avoids unnecessary moves)
  52539. );
  52540. this$1._vnode = this$1.kept;
  52541. restoreActiveInstance();
  52542. update.call(this$1, vnode, hydrating);
  52543. };
  52544. },
  52545. render: function render (h) {
  52546. var tag = this.tag || this.$vnode.data.tag || 'span';
  52547. var map = Object.create(null);
  52548. var prevChildren = this.prevChildren = this.children;
  52549. var rawChildren = this.$slots.default || [];
  52550. var children = this.children = [];
  52551. var transitionData = extractTransitionData(this);
  52552. for (var i = 0; i < rawChildren.length; i++) {
  52553. var c = rawChildren[i];
  52554. if (c.tag) {
  52555. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  52556. children.push(c);
  52557. map[c.key] = c
  52558. ;(c.data || (c.data = {})).transition = transitionData;
  52559. } else {
  52560. var opts = c.componentOptions;
  52561. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  52562. warn(("<transition-group> children must be keyed: <" + name + ">"));
  52563. }
  52564. }
  52565. }
  52566. if (prevChildren) {
  52567. var kept = [];
  52568. var removed = [];
  52569. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  52570. var c$1 = prevChildren[i$1];
  52571. c$1.data.transition = transitionData;
  52572. c$1.data.pos = c$1.elm.getBoundingClientRect();
  52573. if (map[c$1.key]) {
  52574. kept.push(c$1);
  52575. } else {
  52576. removed.push(c$1);
  52577. }
  52578. }
  52579. this.kept = h(tag, null, kept);
  52580. this.removed = removed;
  52581. }
  52582. return h(tag, null, children)
  52583. },
  52584. updated: function updated () {
  52585. var children = this.prevChildren;
  52586. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  52587. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  52588. return
  52589. }
  52590. // we divide the work into three loops to avoid mixing DOM reads and writes
  52591. // in each iteration - which helps prevent layout thrashing.
  52592. children.forEach(callPendingCbs);
  52593. children.forEach(recordPosition);
  52594. children.forEach(applyTranslation);
  52595. // force reflow to put everything in position
  52596. // assign to this to avoid being removed in tree-shaking
  52597. // $flow-disable-line
  52598. this._reflow = document.body.offsetHeight;
  52599. children.forEach(function (c) {
  52600. if (c.data.moved) {
  52601. var el = c.elm;
  52602. var s = el.style;
  52603. addTransitionClass(el, moveClass);
  52604. s.transform = s.WebkitTransform = s.transitionDuration = '';
  52605. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  52606. if (e && e.target !== el) {
  52607. return
  52608. }
  52609. if (!e || /transform$/.test(e.propertyName)) {
  52610. el.removeEventListener(transitionEndEvent, cb);
  52611. el._moveCb = null;
  52612. removeTransitionClass(el, moveClass);
  52613. }
  52614. });
  52615. }
  52616. });
  52617. },
  52618. methods: {
  52619. hasMove: function hasMove (el, moveClass) {
  52620. /* istanbul ignore if */
  52621. if (!hasTransition) {
  52622. return false
  52623. }
  52624. /* istanbul ignore if */
  52625. if (this._hasMove) {
  52626. return this._hasMove
  52627. }
  52628. // Detect whether an element with the move class applied has
  52629. // CSS transitions. Since the element may be inside an entering
  52630. // transition at this very moment, we make a clone of it and remove
  52631. // all other transition classes applied to ensure only the move class
  52632. // is applied.
  52633. var clone = el.cloneNode();
  52634. if (el._transitionClasses) {
  52635. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  52636. }
  52637. addClass(clone, moveClass);
  52638. clone.style.display = 'none';
  52639. this.$el.appendChild(clone);
  52640. var info = getTransitionInfo(clone);
  52641. this.$el.removeChild(clone);
  52642. return (this._hasMove = info.hasTransform)
  52643. }
  52644. }
  52645. };
  52646. function callPendingCbs (c) {
  52647. /* istanbul ignore if */
  52648. if (c.elm._moveCb) {
  52649. c.elm._moveCb();
  52650. }
  52651. /* istanbul ignore if */
  52652. if (c.elm._enterCb) {
  52653. c.elm._enterCb();
  52654. }
  52655. }
  52656. function recordPosition (c) {
  52657. c.data.newPos = c.elm.getBoundingClientRect();
  52658. }
  52659. function applyTranslation (c) {
  52660. var oldPos = c.data.pos;
  52661. var newPos = c.data.newPos;
  52662. var dx = oldPos.left - newPos.left;
  52663. var dy = oldPos.top - newPos.top;
  52664. if (dx || dy) {
  52665. c.data.moved = true;
  52666. var s = c.elm.style;
  52667. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  52668. s.transitionDuration = '0s';
  52669. }
  52670. }
  52671. var platformComponents = {
  52672. Transition: Transition,
  52673. TransitionGroup: TransitionGroup
  52674. };
  52675. /* */
  52676. // install platform specific utils
  52677. Vue.config.mustUseProp = mustUseProp;
  52678. Vue.config.isReservedTag = isReservedTag;
  52679. Vue.config.isReservedAttr = isReservedAttr;
  52680. Vue.config.getTagNamespace = getTagNamespace;
  52681. Vue.config.isUnknownElement = isUnknownElement;
  52682. // install platform runtime directives & components
  52683. extend(Vue.options.directives, platformDirectives);
  52684. extend(Vue.options.components, platformComponents);
  52685. // install platform patch function
  52686. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  52687. // public mount method
  52688. Vue.prototype.$mount = function (
  52689. el,
  52690. hydrating
  52691. ) {
  52692. el = el && inBrowser ? query(el) : undefined;
  52693. return mountComponent(this, el, hydrating)
  52694. };
  52695. // devtools global hook
  52696. /* istanbul ignore next */
  52697. if (inBrowser) {
  52698. setTimeout(function () {
  52699. if (config.devtools) {
  52700. if (devtools) {
  52701. devtools.emit('init', Vue);
  52702. } else {
  52703. console[console.info ? 'info' : 'log'](
  52704. 'Download the Vue Devtools extension for a better development experience:\n' +
  52705. 'https://github.com/vuejs/vue-devtools'
  52706. );
  52707. }
  52708. }
  52709. if (config.productionTip !== false &&
  52710. typeof console !== 'undefined'
  52711. ) {
  52712. console[console.info ? 'info' : 'log'](
  52713. "You are running Vue in development mode.\n" +
  52714. "Make sure to turn on production mode when deploying for production.\n" +
  52715. "See more tips at https://vuejs.org/guide/deployment.html"
  52716. );
  52717. }
  52718. }, 0);
  52719. }
  52720. /* */
  52721. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  52722. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  52723. var buildRegex = cached(function (delimiters) {
  52724. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  52725. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  52726. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  52727. });
  52728. function parseText (
  52729. text,
  52730. delimiters
  52731. ) {
  52732. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  52733. if (!tagRE.test(text)) {
  52734. return
  52735. }
  52736. var tokens = [];
  52737. var rawTokens = [];
  52738. var lastIndex = tagRE.lastIndex = 0;
  52739. var match, index, tokenValue;
  52740. while ((match = tagRE.exec(text))) {
  52741. index = match.index;
  52742. // push text token
  52743. if (index > lastIndex) {
  52744. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  52745. tokens.push(JSON.stringify(tokenValue));
  52746. }
  52747. // tag token
  52748. var exp = parseFilters(match[1].trim());
  52749. tokens.push(("_s(" + exp + ")"));
  52750. rawTokens.push({ '@binding': exp });
  52751. lastIndex = index + match[0].length;
  52752. }
  52753. if (lastIndex < text.length) {
  52754. rawTokens.push(tokenValue = text.slice(lastIndex));
  52755. tokens.push(JSON.stringify(tokenValue));
  52756. }
  52757. return {
  52758. expression: tokens.join('+'),
  52759. tokens: rawTokens
  52760. }
  52761. }
  52762. /* */
  52763. function transformNode (el, options) {
  52764. var warn = options.warn || baseWarn;
  52765. var staticClass = getAndRemoveAttr(el, 'class');
  52766. if (staticClass) {
  52767. var res = parseText(staticClass, options.delimiters);
  52768. if (res) {
  52769. warn(
  52770. "class=\"" + staticClass + "\": " +
  52771. 'Interpolation inside attributes has been removed. ' +
  52772. 'Use v-bind or the colon shorthand instead. For example, ' +
  52773. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  52774. el.rawAttrsMap['class']
  52775. );
  52776. }
  52777. }
  52778. if (staticClass) {
  52779. el.staticClass = JSON.stringify(staticClass);
  52780. }
  52781. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  52782. if (classBinding) {
  52783. el.classBinding = classBinding;
  52784. }
  52785. }
  52786. function genData (el) {
  52787. var data = '';
  52788. if (el.staticClass) {
  52789. data += "staticClass:" + (el.staticClass) + ",";
  52790. }
  52791. if (el.classBinding) {
  52792. data += "class:" + (el.classBinding) + ",";
  52793. }
  52794. return data
  52795. }
  52796. var klass$1 = {
  52797. staticKeys: ['staticClass'],
  52798. transformNode: transformNode,
  52799. genData: genData
  52800. };
  52801. /* */
  52802. function transformNode$1 (el, options) {
  52803. var warn = options.warn || baseWarn;
  52804. var staticStyle = getAndRemoveAttr(el, 'style');
  52805. if (staticStyle) {
  52806. /* istanbul ignore if */
  52807. {
  52808. var res = parseText(staticStyle, options.delimiters);
  52809. if (res) {
  52810. warn(
  52811. "style=\"" + staticStyle + "\": " +
  52812. 'Interpolation inside attributes has been removed. ' +
  52813. 'Use v-bind or the colon shorthand instead. For example, ' +
  52814. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  52815. el.rawAttrsMap['style']
  52816. );
  52817. }
  52818. }
  52819. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  52820. }
  52821. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  52822. if (styleBinding) {
  52823. el.styleBinding = styleBinding;
  52824. }
  52825. }
  52826. function genData$1 (el) {
  52827. var data = '';
  52828. if (el.staticStyle) {
  52829. data += "staticStyle:" + (el.staticStyle) + ",";
  52830. }
  52831. if (el.styleBinding) {
  52832. data += "style:(" + (el.styleBinding) + "),";
  52833. }
  52834. return data
  52835. }
  52836. var style$1 = {
  52837. staticKeys: ['staticStyle'],
  52838. transformNode: transformNode$1,
  52839. genData: genData$1
  52840. };
  52841. /* */
  52842. var decoder;
  52843. var he = {
  52844. decode: function decode (html) {
  52845. decoder = decoder || document.createElement('div');
  52846. decoder.innerHTML = html;
  52847. return decoder.textContent
  52848. }
  52849. };
  52850. /* */
  52851. var isUnaryTag = makeMap(
  52852. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  52853. 'link,meta,param,source,track,wbr'
  52854. );
  52855. // Elements that you can, intentionally, leave open
  52856. // (and which close themselves)
  52857. var canBeLeftOpenTag = makeMap(
  52858. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  52859. );
  52860. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  52861. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  52862. var isNonPhrasingTag = makeMap(
  52863. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  52864. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  52865. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  52866. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  52867. 'title,tr,track'
  52868. );
  52869. /**
  52870. * Not type-checking this file because it's mostly vendor code.
  52871. */
  52872. // Regular Expressions for parsing tags and attributes
  52873. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52874. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52875. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  52876. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  52877. var startTagOpen = new RegExp(("^<" + qnameCapture));
  52878. var startTagClose = /^\s*(\/?)>/;
  52879. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  52880. var doctype = /^<!DOCTYPE [^>]+>/i;
  52881. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  52882. var comment = /^<!\--/;
  52883. var conditionalComment = /^<!\[/;
  52884. // Special Elements (can contain anything)
  52885. var isPlainTextElement = makeMap('script,style,textarea', true);
  52886. var reCache = {};
  52887. var decodingMap = {
  52888. '&lt;': '<',
  52889. '&gt;': '>',
  52890. '&quot;': '"',
  52891. '&amp;': '&',
  52892. '&#10;': '\n',
  52893. '&#9;': '\t',
  52894. '&#39;': "'"
  52895. };
  52896. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  52897. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  52898. // #5992
  52899. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  52900. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  52901. function decodeAttr (value, shouldDecodeNewlines) {
  52902. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  52903. return value.replace(re, function (match) { return decodingMap[match]; })
  52904. }
  52905. function parseHTML (html, options) {
  52906. var stack = [];
  52907. var expectHTML = options.expectHTML;
  52908. var isUnaryTag$$1 = options.isUnaryTag || no;
  52909. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  52910. var index = 0;
  52911. var last, lastTag;
  52912. while (html) {
  52913. last = html;
  52914. // Make sure we're not in a plaintext content element like script/style
  52915. if (!lastTag || !isPlainTextElement(lastTag)) {
  52916. var textEnd = html.indexOf('<');
  52917. if (textEnd === 0) {
  52918. // Comment:
  52919. if (comment.test(html)) {
  52920. var commentEnd = html.indexOf('-->');
  52921. if (commentEnd >= 0) {
  52922. if (options.shouldKeepComment) {
  52923. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  52924. }
  52925. advance(commentEnd + 3);
  52926. continue
  52927. }
  52928. }
  52929. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  52930. if (conditionalComment.test(html)) {
  52931. var conditionalEnd = html.indexOf(']>');
  52932. if (conditionalEnd >= 0) {
  52933. advance(conditionalEnd + 2);
  52934. continue
  52935. }
  52936. }
  52937. // Doctype:
  52938. var doctypeMatch = html.match(doctype);
  52939. if (doctypeMatch) {
  52940. advance(doctypeMatch[0].length);
  52941. continue
  52942. }
  52943. // End tag:
  52944. var endTagMatch = html.match(endTag);
  52945. if (endTagMatch) {
  52946. var curIndex = index;
  52947. advance(endTagMatch[0].length);
  52948. parseEndTag(endTagMatch[1], curIndex, index);
  52949. continue
  52950. }
  52951. // Start tag:
  52952. var startTagMatch = parseStartTag();
  52953. if (startTagMatch) {
  52954. handleStartTag(startTagMatch);
  52955. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  52956. advance(1);
  52957. }
  52958. continue
  52959. }
  52960. }
  52961. var text = (void 0), rest = (void 0), next = (void 0);
  52962. if (textEnd >= 0) {
  52963. rest = html.slice(textEnd);
  52964. while (
  52965. !endTag.test(rest) &&
  52966. !startTagOpen.test(rest) &&
  52967. !comment.test(rest) &&
  52968. !conditionalComment.test(rest)
  52969. ) {
  52970. // < in plain text, be forgiving and treat it as text
  52971. next = rest.indexOf('<', 1);
  52972. if (next < 0) { break }
  52973. textEnd += next;
  52974. rest = html.slice(textEnd);
  52975. }
  52976. text = html.substring(0, textEnd);
  52977. }
  52978. if (textEnd < 0) {
  52979. text = html;
  52980. }
  52981. if (text) {
  52982. advance(text.length);
  52983. }
  52984. if (options.chars && text) {
  52985. options.chars(text, index - text.length, index);
  52986. }
  52987. } else {
  52988. var endTagLength = 0;
  52989. var stackedTag = lastTag.toLowerCase();
  52990. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  52991. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  52992. endTagLength = endTag.length;
  52993. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  52994. text = text
  52995. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  52996. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  52997. }
  52998. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  52999. text = text.slice(1);
  53000. }
  53001. if (options.chars) {
  53002. options.chars(text);
  53003. }
  53004. return ''
  53005. });
  53006. index += html.length - rest$1.length;
  53007. html = rest$1;
  53008. parseEndTag(stackedTag, index - endTagLength, index);
  53009. }
  53010. if (html === last) {
  53011. options.chars && options.chars(html);
  53012. if (!stack.length && options.warn) {
  53013. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  53014. }
  53015. break
  53016. }
  53017. }
  53018. // Clean up any remaining tags
  53019. parseEndTag();
  53020. function advance (n) {
  53021. index += n;
  53022. html = html.substring(n);
  53023. }
  53024. function parseStartTag () {
  53025. var start = html.match(startTagOpen);
  53026. if (start) {
  53027. var match = {
  53028. tagName: start[1],
  53029. attrs: [],
  53030. start: index
  53031. };
  53032. advance(start[0].length);
  53033. var end, attr;
  53034. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  53035. attr.start = index;
  53036. advance(attr[0].length);
  53037. attr.end = index;
  53038. match.attrs.push(attr);
  53039. }
  53040. if (end) {
  53041. match.unarySlash = end[1];
  53042. advance(end[0].length);
  53043. match.end = index;
  53044. return match
  53045. }
  53046. }
  53047. }
  53048. function handleStartTag (match) {
  53049. var tagName = match.tagName;
  53050. var unarySlash = match.unarySlash;
  53051. if (expectHTML) {
  53052. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  53053. parseEndTag(lastTag);
  53054. }
  53055. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  53056. parseEndTag(tagName);
  53057. }
  53058. }
  53059. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  53060. var l = match.attrs.length;
  53061. var attrs = new Array(l);
  53062. for (var i = 0; i < l; i++) {
  53063. var args = match.attrs[i];
  53064. var value = args[3] || args[4] || args[5] || '';
  53065. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  53066. ? options.shouldDecodeNewlinesForHref
  53067. : options.shouldDecodeNewlines;
  53068. attrs[i] = {
  53069. name: args[1],
  53070. value: decodeAttr(value, shouldDecodeNewlines)
  53071. };
  53072. if (options.outputSourceRange) {
  53073. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  53074. attrs[i].end = args.end;
  53075. }
  53076. }
  53077. if (!unary) {
  53078. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  53079. lastTag = tagName;
  53080. }
  53081. if (options.start) {
  53082. options.start(tagName, attrs, unary, match.start, match.end);
  53083. }
  53084. }
  53085. function parseEndTag (tagName, start, end) {
  53086. var pos, lowerCasedTagName;
  53087. if (start == null) { start = index; }
  53088. if (end == null) { end = index; }
  53089. // Find the closest opened tag of the same type
  53090. if (tagName) {
  53091. lowerCasedTagName = tagName.toLowerCase();
  53092. for (pos = stack.length - 1; pos >= 0; pos--) {
  53093. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  53094. break
  53095. }
  53096. }
  53097. } else {
  53098. // If no tag name is provided, clean shop
  53099. pos = 0;
  53100. }
  53101. if (pos >= 0) {
  53102. // Close all the open elements, up the stack
  53103. for (var i = stack.length - 1; i >= pos; i--) {
  53104. if (i > pos || !tagName &&
  53105. options.warn
  53106. ) {
  53107. options.warn(
  53108. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  53109. { start: stack[i].start, end: stack[i].end }
  53110. );
  53111. }
  53112. if (options.end) {
  53113. options.end(stack[i].tag, start, end);
  53114. }
  53115. }
  53116. // Remove the open elements from the stack
  53117. stack.length = pos;
  53118. lastTag = pos && stack[pos - 1].tag;
  53119. } else if (lowerCasedTagName === 'br') {
  53120. if (options.start) {
  53121. options.start(tagName, [], true, start, end);
  53122. }
  53123. } else if (lowerCasedTagName === 'p') {
  53124. if (options.start) {
  53125. options.start(tagName, [], false, start, end);
  53126. }
  53127. if (options.end) {
  53128. options.end(tagName, start, end);
  53129. }
  53130. }
  53131. }
  53132. }
  53133. /* */
  53134. var onRE = /^@|^v-on:/;
  53135. var dirRE = /^v-|^@|^:|^#/;
  53136. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  53137. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  53138. var stripParensRE = /^\(|\)$/g;
  53139. var dynamicArgRE = /^\[.*\]$/;
  53140. var argRE = /:(.*)$/;
  53141. var bindRE = /^:|^\.|^v-bind:/;
  53142. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  53143. var slotRE = /^v-slot(:|$)|^#/;
  53144. var lineBreakRE = /[\r\n]/;
  53145. var whitespaceRE$1 = /\s+/g;
  53146. var invalidAttributeRE = /[\s"'<>\/=]/;
  53147. var decodeHTMLCached = cached(he.decode);
  53148. var emptySlotScopeToken = "_empty_";
  53149. // configurable state
  53150. var warn$2;
  53151. var delimiters;
  53152. var transforms;
  53153. var preTransforms;
  53154. var postTransforms;
  53155. var platformIsPreTag;
  53156. var platformMustUseProp;
  53157. var platformGetTagNamespace;
  53158. var maybeComponent;
  53159. function createASTElement (
  53160. tag,
  53161. attrs,
  53162. parent
  53163. ) {
  53164. return {
  53165. type: 1,
  53166. tag: tag,
  53167. attrsList: attrs,
  53168. attrsMap: makeAttrsMap(attrs),
  53169. rawAttrsMap: {},
  53170. parent: parent,
  53171. children: []
  53172. }
  53173. }
  53174. /**
  53175. * Convert HTML string to AST.
  53176. */
  53177. function parse (
  53178. template,
  53179. options
  53180. ) {
  53181. warn$2 = options.warn || baseWarn;
  53182. platformIsPreTag = options.isPreTag || no;
  53183. platformMustUseProp = options.mustUseProp || no;
  53184. platformGetTagNamespace = options.getTagNamespace || no;
  53185. var isReservedTag = options.isReservedTag || no;
  53186. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  53187. transforms = pluckModuleFunction(options.modules, 'transformNode');
  53188. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  53189. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  53190. delimiters = options.delimiters;
  53191. var stack = [];
  53192. var preserveWhitespace = options.preserveWhitespace !== false;
  53193. var whitespaceOption = options.whitespace;
  53194. var root;
  53195. var currentParent;
  53196. var inVPre = false;
  53197. var inPre = false;
  53198. var warned = false;
  53199. function warnOnce (msg, range) {
  53200. if (!warned) {
  53201. warned = true;
  53202. warn$2(msg, range);
  53203. }
  53204. }
  53205. function closeElement (element) {
  53206. trimEndingWhitespace(element);
  53207. if (!inVPre && !element.processed) {
  53208. element = processElement(element, options);
  53209. }
  53210. // tree management
  53211. if (!stack.length && element !== root) {
  53212. // allow root elements with v-if, v-else-if and v-else
  53213. if (root.if && (element.elseif || element.else)) {
  53214. {
  53215. checkRootConstraints(element);
  53216. }
  53217. addIfCondition(root, {
  53218. exp: element.elseif,
  53219. block: element
  53220. });
  53221. } else {
  53222. warnOnce(
  53223. "Component template should contain exactly one root element. " +
  53224. "If you are using v-if on multiple elements, " +
  53225. "use v-else-if to chain them instead.",
  53226. { start: element.start }
  53227. );
  53228. }
  53229. }
  53230. if (currentParent && !element.forbidden) {
  53231. if (element.elseif || element.else) {
  53232. processIfConditions(element, currentParent);
  53233. } else {
  53234. if (element.slotScope) {
  53235. // scoped slot
  53236. // keep it in the children list so that v-else(-if) conditions can
  53237. // find it as the prev node.
  53238. var name = element.slotTarget || '"default"'
  53239. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  53240. }
  53241. currentParent.children.push(element);
  53242. element.parent = currentParent;
  53243. }
  53244. }
  53245. // final children cleanup
  53246. // filter out scoped slots
  53247. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  53248. // remove trailing whitespace node again
  53249. trimEndingWhitespace(element);
  53250. // check pre state
  53251. if (element.pre) {
  53252. inVPre = false;
  53253. }
  53254. if (platformIsPreTag(element.tag)) {
  53255. inPre = false;
  53256. }
  53257. // apply post-transforms
  53258. for (var i = 0; i < postTransforms.length; i++) {
  53259. postTransforms[i](element, options);
  53260. }
  53261. }
  53262. function trimEndingWhitespace (el) {
  53263. // remove trailing whitespace node
  53264. if (!inPre) {
  53265. var lastNode;
  53266. while (
  53267. (lastNode = el.children[el.children.length - 1]) &&
  53268. lastNode.type === 3 &&
  53269. lastNode.text === ' '
  53270. ) {
  53271. el.children.pop();
  53272. }
  53273. }
  53274. }
  53275. function checkRootConstraints (el) {
  53276. if (el.tag === 'slot' || el.tag === 'template') {
  53277. warnOnce(
  53278. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  53279. 'contain multiple nodes.',
  53280. { start: el.start }
  53281. );
  53282. }
  53283. if (el.attrsMap.hasOwnProperty('v-for')) {
  53284. warnOnce(
  53285. 'Cannot use v-for on stateful component root element because ' +
  53286. 'it renders multiple elements.',
  53287. el.rawAttrsMap['v-for']
  53288. );
  53289. }
  53290. }
  53291. parseHTML(template, {
  53292. warn: warn$2,
  53293. expectHTML: options.expectHTML,
  53294. isUnaryTag: options.isUnaryTag,
  53295. canBeLeftOpenTag: options.canBeLeftOpenTag,
  53296. shouldDecodeNewlines: options.shouldDecodeNewlines,
  53297. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  53298. shouldKeepComment: options.comments,
  53299. outputSourceRange: options.outputSourceRange,
  53300. start: function start (tag, attrs, unary, start$1, end) {
  53301. // check namespace.
  53302. // inherit parent ns if there is one
  53303. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  53304. // handle IE svg bug
  53305. /* istanbul ignore if */
  53306. if (isIE && ns === 'svg') {
  53307. attrs = guardIESVGBug(attrs);
  53308. }
  53309. var element = createASTElement(tag, attrs, currentParent);
  53310. if (ns) {
  53311. element.ns = ns;
  53312. }
  53313. {
  53314. if (options.outputSourceRange) {
  53315. element.start = start$1;
  53316. element.end = end;
  53317. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  53318. cumulated[attr.name] = attr;
  53319. return cumulated
  53320. }, {});
  53321. }
  53322. attrs.forEach(function (attr) {
  53323. if (invalidAttributeRE.test(attr.name)) {
  53324. warn$2(
  53325. "Invalid dynamic argument expression: attribute names cannot contain " +
  53326. "spaces, quotes, <, >, / or =.",
  53327. {
  53328. start: attr.start + attr.name.indexOf("["),
  53329. end: attr.start + attr.name.length
  53330. }
  53331. );
  53332. }
  53333. });
  53334. }
  53335. if (isForbiddenTag(element) && !isServerRendering()) {
  53336. element.forbidden = true;
  53337. warn$2(
  53338. 'Templates should only be responsible for mapping the state to the ' +
  53339. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  53340. "<" + tag + ">" + ', as they will not be parsed.',
  53341. { start: element.start }
  53342. );
  53343. }
  53344. // apply pre-transforms
  53345. for (var i = 0; i < preTransforms.length; i++) {
  53346. element = preTransforms[i](element, options) || element;
  53347. }
  53348. if (!inVPre) {
  53349. processPre(element);
  53350. if (element.pre) {
  53351. inVPre = true;
  53352. }
  53353. }
  53354. if (platformIsPreTag(element.tag)) {
  53355. inPre = true;
  53356. }
  53357. if (inVPre) {
  53358. processRawAttrs(element);
  53359. } else if (!element.processed) {
  53360. // structural directives
  53361. processFor(element);
  53362. processIf(element);
  53363. processOnce(element);
  53364. }
  53365. if (!root) {
  53366. root = element;
  53367. {
  53368. checkRootConstraints(root);
  53369. }
  53370. }
  53371. if (!unary) {
  53372. currentParent = element;
  53373. stack.push(element);
  53374. } else {
  53375. closeElement(element);
  53376. }
  53377. },
  53378. end: function end (tag, start, end$1) {
  53379. var element = stack[stack.length - 1];
  53380. // pop stack
  53381. stack.length -= 1;
  53382. currentParent = stack[stack.length - 1];
  53383. if (options.outputSourceRange) {
  53384. element.end = end$1;
  53385. }
  53386. closeElement(element);
  53387. },
  53388. chars: function chars (text, start, end) {
  53389. if (!currentParent) {
  53390. {
  53391. if (text === template) {
  53392. warnOnce(
  53393. 'Component template requires a root element, rather than just text.',
  53394. { start: start }
  53395. );
  53396. } else if ((text = text.trim())) {
  53397. warnOnce(
  53398. ("text \"" + text + "\" outside root element will be ignored."),
  53399. { start: start }
  53400. );
  53401. }
  53402. }
  53403. return
  53404. }
  53405. // IE textarea placeholder bug
  53406. /* istanbul ignore if */
  53407. if (isIE &&
  53408. currentParent.tag === 'textarea' &&
  53409. currentParent.attrsMap.placeholder === text
  53410. ) {
  53411. return
  53412. }
  53413. var children = currentParent.children;
  53414. if (inPre || text.trim()) {
  53415. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  53416. } else if (!children.length) {
  53417. // remove the whitespace-only node right after an opening tag
  53418. text = '';
  53419. } else if (whitespaceOption) {
  53420. if (whitespaceOption === 'condense') {
  53421. // in condense mode, remove the whitespace node if it contains
  53422. // line break, otherwise condense to a single space
  53423. text = lineBreakRE.test(text) ? '' : ' ';
  53424. } else {
  53425. text = ' ';
  53426. }
  53427. } else {
  53428. text = preserveWhitespace ? ' ' : '';
  53429. }
  53430. if (text) {
  53431. if (!inPre && whitespaceOption === 'condense') {
  53432. // condense consecutive whitespaces into single space
  53433. text = text.replace(whitespaceRE$1, ' ');
  53434. }
  53435. var res;
  53436. var child;
  53437. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  53438. child = {
  53439. type: 2,
  53440. expression: res.expression,
  53441. tokens: res.tokens,
  53442. text: text
  53443. };
  53444. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  53445. child = {
  53446. type: 3,
  53447. text: text
  53448. };
  53449. }
  53450. if (child) {
  53451. if (options.outputSourceRange) {
  53452. child.start = start;
  53453. child.end = end;
  53454. }
  53455. children.push(child);
  53456. }
  53457. }
  53458. },
  53459. comment: function comment (text, start, end) {
  53460. // adding anyting as a sibling to the root node is forbidden
  53461. // comments should still be allowed, but ignored
  53462. if (currentParent) {
  53463. var child = {
  53464. type: 3,
  53465. text: text,
  53466. isComment: true
  53467. };
  53468. if (options.outputSourceRange) {
  53469. child.start = start;
  53470. child.end = end;
  53471. }
  53472. currentParent.children.push(child);
  53473. }
  53474. }
  53475. });
  53476. return root
  53477. }
  53478. function processPre (el) {
  53479. if (getAndRemoveAttr(el, 'v-pre') != null) {
  53480. el.pre = true;
  53481. }
  53482. }
  53483. function processRawAttrs (el) {
  53484. var list = el.attrsList;
  53485. var len = list.length;
  53486. if (len) {
  53487. var attrs = el.attrs = new Array(len);
  53488. for (var i = 0; i < len; i++) {
  53489. attrs[i] = {
  53490. name: list[i].name,
  53491. value: JSON.stringify(list[i].value)
  53492. };
  53493. if (list[i].start != null) {
  53494. attrs[i].start = list[i].start;
  53495. attrs[i].end = list[i].end;
  53496. }
  53497. }
  53498. } else if (!el.pre) {
  53499. // non root node in pre blocks with no attributes
  53500. el.plain = true;
  53501. }
  53502. }
  53503. function processElement (
  53504. element,
  53505. options
  53506. ) {
  53507. processKey(element);
  53508. // determine whether this is a plain element after
  53509. // removing structural attributes
  53510. element.plain = (
  53511. !element.key &&
  53512. !element.scopedSlots &&
  53513. !element.attrsList.length
  53514. );
  53515. processRef(element);
  53516. processSlotContent(element);
  53517. processSlotOutlet(element);
  53518. processComponent(element);
  53519. for (var i = 0; i < transforms.length; i++) {
  53520. element = transforms[i](element, options) || element;
  53521. }
  53522. processAttrs(element);
  53523. return element
  53524. }
  53525. function processKey (el) {
  53526. var exp = getBindingAttr(el, 'key');
  53527. if (exp) {
  53528. {
  53529. if (el.tag === 'template') {
  53530. warn$2(
  53531. "<template> cannot be keyed. Place the key on real elements instead.",
  53532. getRawBindingAttr(el, 'key')
  53533. );
  53534. }
  53535. if (el.for) {
  53536. var iterator = el.iterator2 || el.iterator1;
  53537. var parent = el.parent;
  53538. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  53539. warn$2(
  53540. "Do not use v-for index as key on <transition-group> children, " +
  53541. "this is the same as not using keys.",
  53542. getRawBindingAttr(el, 'key'),
  53543. true /* tip */
  53544. );
  53545. }
  53546. }
  53547. }
  53548. el.key = exp;
  53549. }
  53550. }
  53551. function processRef (el) {
  53552. var ref = getBindingAttr(el, 'ref');
  53553. if (ref) {
  53554. el.ref = ref;
  53555. el.refInFor = checkInFor(el);
  53556. }
  53557. }
  53558. function processFor (el) {
  53559. var exp;
  53560. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  53561. var res = parseFor(exp);
  53562. if (res) {
  53563. extend(el, res);
  53564. } else {
  53565. warn$2(
  53566. ("Invalid v-for expression: " + exp),
  53567. el.rawAttrsMap['v-for']
  53568. );
  53569. }
  53570. }
  53571. }
  53572. function parseFor (exp) {
  53573. var inMatch = exp.match(forAliasRE);
  53574. if (!inMatch) { return }
  53575. var res = {};
  53576. res.for = inMatch[2].trim();
  53577. var alias = inMatch[1].trim().replace(stripParensRE, '');
  53578. var iteratorMatch = alias.match(forIteratorRE);
  53579. if (iteratorMatch) {
  53580. res.alias = alias.replace(forIteratorRE, '').trim();
  53581. res.iterator1 = iteratorMatch[1].trim();
  53582. if (iteratorMatch[2]) {
  53583. res.iterator2 = iteratorMatch[2].trim();
  53584. }
  53585. } else {
  53586. res.alias = alias;
  53587. }
  53588. return res
  53589. }
  53590. function processIf (el) {
  53591. var exp = getAndRemoveAttr(el, 'v-if');
  53592. if (exp) {
  53593. el.if = exp;
  53594. addIfCondition(el, {
  53595. exp: exp,
  53596. block: el
  53597. });
  53598. } else {
  53599. if (getAndRemoveAttr(el, 'v-else') != null) {
  53600. el.else = true;
  53601. }
  53602. var elseif = getAndRemoveAttr(el, 'v-else-if');
  53603. if (elseif) {
  53604. el.elseif = elseif;
  53605. }
  53606. }
  53607. }
  53608. function processIfConditions (el, parent) {
  53609. var prev = findPrevElement(parent.children);
  53610. if (prev && prev.if) {
  53611. addIfCondition(prev, {
  53612. exp: el.elseif,
  53613. block: el
  53614. });
  53615. } else {
  53616. warn$2(
  53617. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  53618. "used on element <" + (el.tag) + "> without corresponding v-if.",
  53619. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  53620. );
  53621. }
  53622. }
  53623. function findPrevElement (children) {
  53624. var i = children.length;
  53625. while (i--) {
  53626. if (children[i].type === 1) {
  53627. return children[i]
  53628. } else {
  53629. if (children[i].text !== ' ') {
  53630. warn$2(
  53631. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  53632. "will be ignored.",
  53633. children[i]
  53634. );
  53635. }
  53636. children.pop();
  53637. }
  53638. }
  53639. }
  53640. function addIfCondition (el, condition) {
  53641. if (!el.ifConditions) {
  53642. el.ifConditions = [];
  53643. }
  53644. el.ifConditions.push(condition);
  53645. }
  53646. function processOnce (el) {
  53647. var once$$1 = getAndRemoveAttr(el, 'v-once');
  53648. if (once$$1 != null) {
  53649. el.once = true;
  53650. }
  53651. }
  53652. // handle content being passed to a component as slot,
  53653. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  53654. function processSlotContent (el) {
  53655. var slotScope;
  53656. if (el.tag === 'template') {
  53657. slotScope = getAndRemoveAttr(el, 'scope');
  53658. /* istanbul ignore if */
  53659. if (slotScope) {
  53660. warn$2(
  53661. "the \"scope\" attribute for scoped slots have been deprecated and " +
  53662. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  53663. "can also be used on plain elements in addition to <template> to " +
  53664. "denote scoped slots.",
  53665. el.rawAttrsMap['scope'],
  53666. true
  53667. );
  53668. }
  53669. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  53670. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  53671. /* istanbul ignore if */
  53672. if (el.attrsMap['v-for']) {
  53673. warn$2(
  53674. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  53675. "(v-for takes higher priority). Use a wrapper <template> for the " +
  53676. "scoped slot to make it clearer.",
  53677. el.rawAttrsMap['slot-scope'],
  53678. true
  53679. );
  53680. }
  53681. el.slotScope = slotScope;
  53682. }
  53683. // slot="xxx"
  53684. var slotTarget = getBindingAttr(el, 'slot');
  53685. if (slotTarget) {
  53686. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  53687. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  53688. // preserve slot as an attribute for native shadow DOM compat
  53689. // only for non-scoped slots.
  53690. if (el.tag !== 'template' && !el.slotScope) {
  53691. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  53692. }
  53693. }
  53694. // 2.6 v-slot syntax
  53695. {
  53696. if (el.tag === 'template') {
  53697. // v-slot on <template>
  53698. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  53699. if (slotBinding) {
  53700. {
  53701. if (el.slotTarget || el.slotScope) {
  53702. warn$2(
  53703. "Unexpected mixed usage of different slot syntaxes.",
  53704. el
  53705. );
  53706. }
  53707. if (el.parent && !maybeComponent(el.parent)) {
  53708. warn$2(
  53709. "<template v-slot> can only appear at the root level inside " +
  53710. "the receiving component",
  53711. el
  53712. );
  53713. }
  53714. }
  53715. var ref = getSlotName(slotBinding);
  53716. var name = ref.name;
  53717. var dynamic = ref.dynamic;
  53718. el.slotTarget = name;
  53719. el.slotTargetDynamic = dynamic;
  53720. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  53721. }
  53722. } else {
  53723. // v-slot on component, denotes default slot
  53724. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  53725. if (slotBinding$1) {
  53726. {
  53727. if (!maybeComponent(el)) {
  53728. warn$2(
  53729. "v-slot can only be used on components or <template>.",
  53730. slotBinding$1
  53731. );
  53732. }
  53733. if (el.slotScope || el.slotTarget) {
  53734. warn$2(
  53735. "Unexpected mixed usage of different slot syntaxes.",
  53736. el
  53737. );
  53738. }
  53739. if (el.scopedSlots) {
  53740. warn$2(
  53741. "To avoid scope ambiguity, the default slot should also use " +
  53742. "<template> syntax when there are other named slots.",
  53743. slotBinding$1
  53744. );
  53745. }
  53746. }
  53747. // add the component's children to its default slot
  53748. var slots = el.scopedSlots || (el.scopedSlots = {});
  53749. var ref$1 = getSlotName(slotBinding$1);
  53750. var name$1 = ref$1.name;
  53751. var dynamic$1 = ref$1.dynamic;
  53752. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  53753. slotContainer.slotTarget = name$1;
  53754. slotContainer.slotTargetDynamic = dynamic$1;
  53755. slotContainer.children = el.children.filter(function (c) {
  53756. if (!c.slotScope) {
  53757. c.parent = slotContainer;
  53758. return true
  53759. }
  53760. });
  53761. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  53762. // remove children as they are returned from scopedSlots now
  53763. el.children = [];
  53764. // mark el non-plain so data gets generated
  53765. el.plain = false;
  53766. }
  53767. }
  53768. }
  53769. }
  53770. function getSlotName (binding) {
  53771. var name = binding.name.replace(slotRE, '');
  53772. if (!name) {
  53773. if (binding.name[0] !== '#') {
  53774. name = 'default';
  53775. } else {
  53776. warn$2(
  53777. "v-slot shorthand syntax requires a slot name.",
  53778. binding
  53779. );
  53780. }
  53781. }
  53782. return dynamicArgRE.test(name)
  53783. // dynamic [name]
  53784. ? { name: name.slice(1, -1), dynamic: true }
  53785. // static name
  53786. : { name: ("\"" + name + "\""), dynamic: false }
  53787. }
  53788. // handle <slot/> outlets
  53789. function processSlotOutlet (el) {
  53790. if (el.tag === 'slot') {
  53791. el.slotName = getBindingAttr(el, 'name');
  53792. if (el.key) {
  53793. warn$2(
  53794. "`key` does not work on <slot> because slots are abstract outlets " +
  53795. "and can possibly expand into multiple elements. " +
  53796. "Use the key on a wrapping element instead.",
  53797. getRawBindingAttr(el, 'key')
  53798. );
  53799. }
  53800. }
  53801. }
  53802. function processComponent (el) {
  53803. var binding;
  53804. if ((binding = getBindingAttr(el, 'is'))) {
  53805. el.component = binding;
  53806. }
  53807. if (getAndRemoveAttr(el, 'inline-template') != null) {
  53808. el.inlineTemplate = true;
  53809. }
  53810. }
  53811. function processAttrs (el) {
  53812. var list = el.attrsList;
  53813. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  53814. for (i = 0, l = list.length; i < l; i++) {
  53815. name = rawName = list[i].name;
  53816. value = list[i].value;
  53817. if (dirRE.test(name)) {
  53818. // mark element as dynamic
  53819. el.hasBindings = true;
  53820. // modifiers
  53821. modifiers = parseModifiers(name.replace(dirRE, ''));
  53822. // support .foo shorthand syntax for the .prop modifier
  53823. if (modifiers) {
  53824. name = name.replace(modifierRE, '');
  53825. }
  53826. if (bindRE.test(name)) { // v-bind
  53827. name = name.replace(bindRE, '');
  53828. value = parseFilters(value);
  53829. isDynamic = dynamicArgRE.test(name);
  53830. if (isDynamic) {
  53831. name = name.slice(1, -1);
  53832. }
  53833. if (
  53834. value.trim().length === 0
  53835. ) {
  53836. warn$2(
  53837. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  53838. );
  53839. }
  53840. if (modifiers) {
  53841. if (modifiers.prop && !isDynamic) {
  53842. name = camelize(name);
  53843. if (name === 'innerHtml') { name = 'innerHTML'; }
  53844. }
  53845. if (modifiers.camel && !isDynamic) {
  53846. name = camelize(name);
  53847. }
  53848. if (modifiers.sync) {
  53849. syncGen = genAssignmentCode(value, "$event");
  53850. if (!isDynamic) {
  53851. addHandler(
  53852. el,
  53853. ("update:" + (camelize(name))),
  53854. syncGen,
  53855. null,
  53856. false,
  53857. warn$2,
  53858. list[i]
  53859. );
  53860. if (hyphenate(name) !== camelize(name)) {
  53861. addHandler(
  53862. el,
  53863. ("update:" + (hyphenate(name))),
  53864. syncGen,
  53865. null,
  53866. false,
  53867. warn$2,
  53868. list[i]
  53869. );
  53870. }
  53871. } else {
  53872. // handler w/ dynamic event name
  53873. addHandler(
  53874. el,
  53875. ("\"update:\"+(" + name + ")"),
  53876. syncGen,
  53877. null,
  53878. false,
  53879. warn$2,
  53880. list[i],
  53881. true // dynamic
  53882. );
  53883. }
  53884. }
  53885. }
  53886. if ((modifiers && modifiers.prop) || (
  53887. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  53888. )) {
  53889. addProp(el, name, value, list[i], isDynamic);
  53890. } else {
  53891. addAttr(el, name, value, list[i], isDynamic);
  53892. }
  53893. } else if (onRE.test(name)) { // v-on
  53894. name = name.replace(onRE, '');
  53895. isDynamic = dynamicArgRE.test(name);
  53896. if (isDynamic) {
  53897. name = name.slice(1, -1);
  53898. }
  53899. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  53900. } else { // normal directives
  53901. name = name.replace(dirRE, '');
  53902. // parse arg
  53903. var argMatch = name.match(argRE);
  53904. var arg = argMatch && argMatch[1];
  53905. isDynamic = false;
  53906. if (arg) {
  53907. name = name.slice(0, -(arg.length + 1));
  53908. if (dynamicArgRE.test(arg)) {
  53909. arg = arg.slice(1, -1);
  53910. isDynamic = true;
  53911. }
  53912. }
  53913. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  53914. if (name === 'model') {
  53915. checkForAliasModel(el, value);
  53916. }
  53917. }
  53918. } else {
  53919. // literal attribute
  53920. {
  53921. var res = parseText(value, delimiters);
  53922. if (res) {
  53923. warn$2(
  53924. name + "=\"" + value + "\": " +
  53925. 'Interpolation inside attributes has been removed. ' +
  53926. 'Use v-bind or the colon shorthand instead. For example, ' +
  53927. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  53928. list[i]
  53929. );
  53930. }
  53931. }
  53932. addAttr(el, name, JSON.stringify(value), list[i]);
  53933. // #6887 firefox doesn't update muted state if set via attribute
  53934. // even immediately after element creation
  53935. if (!el.component &&
  53936. name === 'muted' &&
  53937. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  53938. addProp(el, name, 'true', list[i]);
  53939. }
  53940. }
  53941. }
  53942. }
  53943. function checkInFor (el) {
  53944. var parent = el;
  53945. while (parent) {
  53946. if (parent.for !== undefined) {
  53947. return true
  53948. }
  53949. parent = parent.parent;
  53950. }
  53951. return false
  53952. }
  53953. function parseModifiers (name) {
  53954. var match = name.match(modifierRE);
  53955. if (match) {
  53956. var ret = {};
  53957. match.forEach(function (m) { ret[m.slice(1)] = true; });
  53958. return ret
  53959. }
  53960. }
  53961. function makeAttrsMap (attrs) {
  53962. var map = {};
  53963. for (var i = 0, l = attrs.length; i < l; i++) {
  53964. if (
  53965. map[attrs[i].name] && !isIE && !isEdge
  53966. ) {
  53967. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  53968. }
  53969. map[attrs[i].name] = attrs[i].value;
  53970. }
  53971. return map
  53972. }
  53973. // for script (e.g. type="x/template") or style, do not decode content
  53974. function isTextTag (el) {
  53975. return el.tag === 'script' || el.tag === 'style'
  53976. }
  53977. function isForbiddenTag (el) {
  53978. return (
  53979. el.tag === 'style' ||
  53980. (el.tag === 'script' && (
  53981. !el.attrsMap.type ||
  53982. el.attrsMap.type === 'text/javascript'
  53983. ))
  53984. )
  53985. }
  53986. var ieNSBug = /^xmlns:NS\d+/;
  53987. var ieNSPrefix = /^NS\d+:/;
  53988. /* istanbul ignore next */
  53989. function guardIESVGBug (attrs) {
  53990. var res = [];
  53991. for (var i = 0; i < attrs.length; i++) {
  53992. var attr = attrs[i];
  53993. if (!ieNSBug.test(attr.name)) {
  53994. attr.name = attr.name.replace(ieNSPrefix, '');
  53995. res.push(attr);
  53996. }
  53997. }
  53998. return res
  53999. }
  54000. function checkForAliasModel (el, value) {
  54001. var _el = el;
  54002. while (_el) {
  54003. if (_el.for && _el.alias === value) {
  54004. warn$2(
  54005. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  54006. "You are binding v-model directly to a v-for iteration alias. " +
  54007. "This will not be able to modify the v-for source array because " +
  54008. "writing to the alias is like modifying a function local variable. " +
  54009. "Consider using an array of objects and use v-model on an object property instead.",
  54010. el.rawAttrsMap['v-model']
  54011. );
  54012. }
  54013. _el = _el.parent;
  54014. }
  54015. }
  54016. /* */
  54017. function preTransformNode (el, options) {
  54018. if (el.tag === 'input') {
  54019. var map = el.attrsMap;
  54020. if (!map['v-model']) {
  54021. return
  54022. }
  54023. var typeBinding;
  54024. if (map[':type'] || map['v-bind:type']) {
  54025. typeBinding = getBindingAttr(el, 'type');
  54026. }
  54027. if (!map.type && !typeBinding && map['v-bind']) {
  54028. typeBinding = "(" + (map['v-bind']) + ").type";
  54029. }
  54030. if (typeBinding) {
  54031. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  54032. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  54033. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  54034. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  54035. // 1. checkbox
  54036. var branch0 = cloneASTElement(el);
  54037. // process for on the main node
  54038. processFor(branch0);
  54039. addRawAttr(branch0, 'type', 'checkbox');
  54040. processElement(branch0, options);
  54041. branch0.processed = true; // prevent it from double-processed
  54042. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  54043. addIfCondition(branch0, {
  54044. exp: branch0.if,
  54045. block: branch0
  54046. });
  54047. // 2. add radio else-if condition
  54048. var branch1 = cloneASTElement(el);
  54049. getAndRemoveAttr(branch1, 'v-for', true);
  54050. addRawAttr(branch1, 'type', 'radio');
  54051. processElement(branch1, options);
  54052. addIfCondition(branch0, {
  54053. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  54054. block: branch1
  54055. });
  54056. // 3. other
  54057. var branch2 = cloneASTElement(el);
  54058. getAndRemoveAttr(branch2, 'v-for', true);
  54059. addRawAttr(branch2, ':type', typeBinding);
  54060. processElement(branch2, options);
  54061. addIfCondition(branch0, {
  54062. exp: ifCondition,
  54063. block: branch2
  54064. });
  54065. if (hasElse) {
  54066. branch0.else = true;
  54067. } else if (elseIfCondition) {
  54068. branch0.elseif = elseIfCondition;
  54069. }
  54070. return branch0
  54071. }
  54072. }
  54073. }
  54074. function cloneASTElement (el) {
  54075. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  54076. }
  54077. var model$1 = {
  54078. preTransformNode: preTransformNode
  54079. };
  54080. var modules$1 = [
  54081. klass$1,
  54082. style$1,
  54083. model$1
  54084. ];
  54085. /* */
  54086. function text (el, dir) {
  54087. if (dir.value) {
  54088. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  54089. }
  54090. }
  54091. /* */
  54092. function html (el, dir) {
  54093. if (dir.value) {
  54094. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  54095. }
  54096. }
  54097. var directives$1 = {
  54098. model: model,
  54099. text: text,
  54100. html: html
  54101. };
  54102. /* */
  54103. var baseOptions = {
  54104. expectHTML: true,
  54105. modules: modules$1,
  54106. directives: directives$1,
  54107. isPreTag: isPreTag,
  54108. isUnaryTag: isUnaryTag,
  54109. mustUseProp: mustUseProp,
  54110. canBeLeftOpenTag: canBeLeftOpenTag,
  54111. isReservedTag: isReservedTag,
  54112. getTagNamespace: getTagNamespace,
  54113. staticKeys: genStaticKeys(modules$1)
  54114. };
  54115. /* */
  54116. var isStaticKey;
  54117. var isPlatformReservedTag;
  54118. var genStaticKeysCached = cached(genStaticKeys$1);
  54119. /**
  54120. * Goal of the optimizer: walk the generated template AST tree
  54121. * and detect sub-trees that are purely static, i.e. parts of
  54122. * the DOM that never needs to change.
  54123. *
  54124. * Once we detect these sub-trees, we can:
  54125. *
  54126. * 1. Hoist them into constants, so that we no longer need to
  54127. * create fresh nodes for them on each re-render;
  54128. * 2. Completely skip them in the patching process.
  54129. */
  54130. function optimize (root, options) {
  54131. if (!root) { return }
  54132. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  54133. isPlatformReservedTag = options.isReservedTag || no;
  54134. // first pass: mark all non-static nodes.
  54135. markStatic$1(root);
  54136. // second pass: mark static roots.
  54137. markStaticRoots(root, false);
  54138. }
  54139. function genStaticKeys$1 (keys) {
  54140. return makeMap(
  54141. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  54142. (keys ? ',' + keys : '')
  54143. )
  54144. }
  54145. function markStatic$1 (node) {
  54146. node.static = isStatic(node);
  54147. if (node.type === 1) {
  54148. // do not make component slot content static. this avoids
  54149. // 1. components not able to mutate slot nodes
  54150. // 2. static slot content fails for hot-reloading
  54151. if (
  54152. !isPlatformReservedTag(node.tag) &&
  54153. node.tag !== 'slot' &&
  54154. node.attrsMap['inline-template'] == null
  54155. ) {
  54156. return
  54157. }
  54158. for (var i = 0, l = node.children.length; i < l; i++) {
  54159. var child = node.children[i];
  54160. markStatic$1(child);
  54161. if (!child.static) {
  54162. node.static = false;
  54163. }
  54164. }
  54165. if (node.ifConditions) {
  54166. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  54167. var block = node.ifConditions[i$1].block;
  54168. markStatic$1(block);
  54169. if (!block.static) {
  54170. node.static = false;
  54171. }
  54172. }
  54173. }
  54174. }
  54175. }
  54176. function markStaticRoots (node, isInFor) {
  54177. if (node.type === 1) {
  54178. if (node.static || node.once) {
  54179. node.staticInFor = isInFor;
  54180. }
  54181. // For a node to qualify as a static root, it should have children that
  54182. // are not just static text. Otherwise the cost of hoisting out will
  54183. // outweigh the benefits and it's better off to just always render it fresh.
  54184. if (node.static && node.children.length && !(
  54185. node.children.length === 1 &&
  54186. node.children[0].type === 3
  54187. )) {
  54188. node.staticRoot = true;
  54189. return
  54190. } else {
  54191. node.staticRoot = false;
  54192. }
  54193. if (node.children) {
  54194. for (var i = 0, l = node.children.length; i < l; i++) {
  54195. markStaticRoots(node.children[i], isInFor || !!node.for);
  54196. }
  54197. }
  54198. if (node.ifConditions) {
  54199. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  54200. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  54201. }
  54202. }
  54203. }
  54204. }
  54205. function isStatic (node) {
  54206. if (node.type === 2) { // expression
  54207. return false
  54208. }
  54209. if (node.type === 3) { // text
  54210. return true
  54211. }
  54212. return !!(node.pre || (
  54213. !node.hasBindings && // no dynamic bindings
  54214. !node.if && !node.for && // not v-if or v-for or v-else
  54215. !isBuiltInTag(node.tag) && // not a built-in
  54216. isPlatformReservedTag(node.tag) && // not a component
  54217. !isDirectChildOfTemplateFor(node) &&
  54218. Object.keys(node).every(isStaticKey)
  54219. ))
  54220. }
  54221. function isDirectChildOfTemplateFor (node) {
  54222. while (node.parent) {
  54223. node = node.parent;
  54224. if (node.tag !== 'template') {
  54225. return false
  54226. }
  54227. if (node.for) {
  54228. return true
  54229. }
  54230. }
  54231. return false
  54232. }
  54233. /* */
  54234. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  54235. var fnInvokeRE = /\([^)]*?\);*$/;
  54236. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  54237. // KeyboardEvent.keyCode aliases
  54238. var keyCodes = {
  54239. esc: 27,
  54240. tab: 9,
  54241. enter: 13,
  54242. space: 32,
  54243. up: 38,
  54244. left: 37,
  54245. right: 39,
  54246. down: 40,
  54247. 'delete': [8, 46]
  54248. };
  54249. // KeyboardEvent.key aliases
  54250. var keyNames = {
  54251. // #7880: IE11 and Edge use `Esc` for Escape key name.
  54252. esc: ['Esc', 'Escape'],
  54253. tab: 'Tab',
  54254. enter: 'Enter',
  54255. // #9112: IE11 uses `Spacebar` for Space key name.
  54256. space: [' ', 'Spacebar'],
  54257. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  54258. up: ['Up', 'ArrowUp'],
  54259. left: ['Left', 'ArrowLeft'],
  54260. right: ['Right', 'ArrowRight'],
  54261. down: ['Down', 'ArrowDown'],
  54262. // #9112: IE11 uses `Del` for Delete key name.
  54263. 'delete': ['Backspace', 'Delete', 'Del']
  54264. };
  54265. // #4868: modifiers that prevent the execution of the listener
  54266. // need to explicitly return null so that we can determine whether to remove
  54267. // the listener for .once
  54268. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  54269. var modifierCode = {
  54270. stop: '$event.stopPropagation();',
  54271. prevent: '$event.preventDefault();',
  54272. self: genGuard("$event.target !== $event.currentTarget"),
  54273. ctrl: genGuard("!$event.ctrlKey"),
  54274. shift: genGuard("!$event.shiftKey"),
  54275. alt: genGuard("!$event.altKey"),
  54276. meta: genGuard("!$event.metaKey"),
  54277. left: genGuard("'button' in $event && $event.button !== 0"),
  54278. middle: genGuard("'button' in $event && $event.button !== 1"),
  54279. right: genGuard("'button' in $event && $event.button !== 2")
  54280. };
  54281. function genHandlers (
  54282. events,
  54283. isNative
  54284. ) {
  54285. var prefix = isNative ? 'nativeOn:' : 'on:';
  54286. var staticHandlers = "";
  54287. var dynamicHandlers = "";
  54288. for (var name in events) {
  54289. var handlerCode = genHandler(events[name]);
  54290. if (events[name] && events[name].dynamic) {
  54291. dynamicHandlers += name + "," + handlerCode + ",";
  54292. } else {
  54293. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  54294. }
  54295. }
  54296. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  54297. if (dynamicHandlers) {
  54298. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  54299. } else {
  54300. return prefix + staticHandlers
  54301. }
  54302. }
  54303. function genHandler (handler) {
  54304. if (!handler) {
  54305. return 'function(){}'
  54306. }
  54307. if (Array.isArray(handler)) {
  54308. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  54309. }
  54310. var isMethodPath = simplePathRE.test(handler.value);
  54311. var isFunctionExpression = fnExpRE.test(handler.value);
  54312. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  54313. if (!handler.modifiers) {
  54314. if (isMethodPath || isFunctionExpression) {
  54315. return handler.value
  54316. }
  54317. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  54318. } else {
  54319. var code = '';
  54320. var genModifierCode = '';
  54321. var keys = [];
  54322. for (var key in handler.modifiers) {
  54323. if (modifierCode[key]) {
  54324. genModifierCode += modifierCode[key];
  54325. // left/right
  54326. if (keyCodes[key]) {
  54327. keys.push(key);
  54328. }
  54329. } else if (key === 'exact') {
  54330. var modifiers = (handler.modifiers);
  54331. genModifierCode += genGuard(
  54332. ['ctrl', 'shift', 'alt', 'meta']
  54333. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  54334. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  54335. .join('||')
  54336. );
  54337. } else {
  54338. keys.push(key);
  54339. }
  54340. }
  54341. if (keys.length) {
  54342. code += genKeyFilter(keys);
  54343. }
  54344. // Make sure modifiers like prevent and stop get executed after key filtering
  54345. if (genModifierCode) {
  54346. code += genModifierCode;
  54347. }
  54348. var handlerCode = isMethodPath
  54349. ? ("return " + (handler.value) + "($event)")
  54350. : isFunctionExpression
  54351. ? ("return (" + (handler.value) + ")($event)")
  54352. : isFunctionInvocation
  54353. ? ("return " + (handler.value))
  54354. : handler.value;
  54355. return ("function($event){" + code + handlerCode + "}")
  54356. }
  54357. }
  54358. function genKeyFilter (keys) {
  54359. return (
  54360. // make sure the key filters only apply to KeyboardEvents
  54361. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  54362. // key events that do not have keyCode property...
  54363. "if(!$event.type.indexOf('key')&&" +
  54364. (keys.map(genFilterCode).join('&&')) + ")return null;"
  54365. )
  54366. }
  54367. function genFilterCode (key) {
  54368. var keyVal = parseInt(key, 10);
  54369. if (keyVal) {
  54370. return ("$event.keyCode!==" + keyVal)
  54371. }
  54372. var keyCode = keyCodes[key];
  54373. var keyName = keyNames[key];
  54374. return (
  54375. "_k($event.keyCode," +
  54376. (JSON.stringify(key)) + "," +
  54377. (JSON.stringify(keyCode)) + "," +
  54378. "$event.key," +
  54379. "" + (JSON.stringify(keyName)) +
  54380. ")"
  54381. )
  54382. }
  54383. /* */
  54384. function on (el, dir) {
  54385. if (dir.modifiers) {
  54386. warn("v-on without argument does not support modifiers.");
  54387. }
  54388. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  54389. }
  54390. /* */
  54391. function bind$1 (el, dir) {
  54392. el.wrapData = function (code) {
  54393. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  54394. };
  54395. }
  54396. /* */
  54397. var baseDirectives = {
  54398. on: on,
  54399. bind: bind$1,
  54400. cloak: noop
  54401. };
  54402. /* */
  54403. var CodegenState = function CodegenState (options) {
  54404. this.options = options;
  54405. this.warn = options.warn || baseWarn;
  54406. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  54407. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  54408. this.directives = extend(extend({}, baseDirectives), options.directives);
  54409. var isReservedTag = options.isReservedTag || no;
  54410. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  54411. this.onceId = 0;
  54412. this.staticRenderFns = [];
  54413. this.pre = false;
  54414. };
  54415. function generate (
  54416. ast,
  54417. options
  54418. ) {
  54419. var state = new CodegenState(options);
  54420. var code = ast ? genElement(ast, state) : '_c("div")';
  54421. return {
  54422. render: ("with(this){return " + code + "}"),
  54423. staticRenderFns: state.staticRenderFns
  54424. }
  54425. }
  54426. function genElement (el, state) {
  54427. if (el.parent) {
  54428. el.pre = el.pre || el.parent.pre;
  54429. }
  54430. if (el.staticRoot && !el.staticProcessed) {
  54431. return genStatic(el, state)
  54432. } else if (el.once && !el.onceProcessed) {
  54433. return genOnce(el, state)
  54434. } else if (el.for && !el.forProcessed) {
  54435. return genFor(el, state)
  54436. } else if (el.if && !el.ifProcessed) {
  54437. return genIf(el, state)
  54438. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  54439. return genChildren(el, state) || 'void 0'
  54440. } else if (el.tag === 'slot') {
  54441. return genSlot(el, state)
  54442. } else {
  54443. // component or element
  54444. var code;
  54445. if (el.component) {
  54446. code = genComponent(el.component, el, state);
  54447. } else {
  54448. var data;
  54449. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  54450. data = genData$2(el, state);
  54451. }
  54452. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54453. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  54454. }
  54455. // module transforms
  54456. for (var i = 0; i < state.transforms.length; i++) {
  54457. code = state.transforms[i](el, code);
  54458. }
  54459. return code
  54460. }
  54461. }
  54462. // hoist static sub-trees out
  54463. function genStatic (el, state) {
  54464. el.staticProcessed = true;
  54465. // Some elements (templates) need to behave differently inside of a v-pre
  54466. // node. All pre nodes are static roots, so we can use this as a location to
  54467. // wrap a state change and reset it upon exiting the pre node.
  54468. var originalPreState = state.pre;
  54469. if (el.pre) {
  54470. state.pre = el.pre;
  54471. }
  54472. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  54473. state.pre = originalPreState;
  54474. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  54475. }
  54476. // v-once
  54477. function genOnce (el, state) {
  54478. el.onceProcessed = true;
  54479. if (el.if && !el.ifProcessed) {
  54480. return genIf(el, state)
  54481. } else if (el.staticInFor) {
  54482. var key = '';
  54483. var parent = el.parent;
  54484. while (parent) {
  54485. if (parent.for) {
  54486. key = parent.key;
  54487. break
  54488. }
  54489. parent = parent.parent;
  54490. }
  54491. if (!key) {
  54492. state.warn(
  54493. "v-once can only be used inside v-for that is keyed. ",
  54494. el.rawAttrsMap['v-once']
  54495. );
  54496. return genElement(el, state)
  54497. }
  54498. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  54499. } else {
  54500. return genStatic(el, state)
  54501. }
  54502. }
  54503. function genIf (
  54504. el,
  54505. state,
  54506. altGen,
  54507. altEmpty
  54508. ) {
  54509. el.ifProcessed = true; // avoid recursion
  54510. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  54511. }
  54512. function genIfConditions (
  54513. conditions,
  54514. state,
  54515. altGen,
  54516. altEmpty
  54517. ) {
  54518. if (!conditions.length) {
  54519. return altEmpty || '_e()'
  54520. }
  54521. var condition = conditions.shift();
  54522. if (condition.exp) {
  54523. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  54524. } else {
  54525. return ("" + (genTernaryExp(condition.block)))
  54526. }
  54527. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  54528. function genTernaryExp (el) {
  54529. return altGen
  54530. ? altGen(el, state)
  54531. : el.once
  54532. ? genOnce(el, state)
  54533. : genElement(el, state)
  54534. }
  54535. }
  54536. function genFor (
  54537. el,
  54538. state,
  54539. altGen,
  54540. altHelper
  54541. ) {
  54542. var exp = el.for;
  54543. var alias = el.alias;
  54544. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  54545. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  54546. if (state.maybeComponent(el) &&
  54547. el.tag !== 'slot' &&
  54548. el.tag !== 'template' &&
  54549. !el.key
  54550. ) {
  54551. state.warn(
  54552. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  54553. "v-for should have explicit keys. " +
  54554. "See https://vuejs.org/guide/list.html#key for more info.",
  54555. el.rawAttrsMap['v-for'],
  54556. true /* tip */
  54557. );
  54558. }
  54559. el.forProcessed = true; // avoid recursion
  54560. return (altHelper || '_l') + "((" + exp + ")," +
  54561. "function(" + alias + iterator1 + iterator2 + "){" +
  54562. "return " + ((altGen || genElement)(el, state)) +
  54563. '})'
  54564. }
  54565. function genData$2 (el, state) {
  54566. var data = '{';
  54567. // directives first.
  54568. // directives may mutate the el's other properties before they are generated.
  54569. var dirs = genDirectives(el, state);
  54570. if (dirs) { data += dirs + ','; }
  54571. // key
  54572. if (el.key) {
  54573. data += "key:" + (el.key) + ",";
  54574. }
  54575. // ref
  54576. if (el.ref) {
  54577. data += "ref:" + (el.ref) + ",";
  54578. }
  54579. if (el.refInFor) {
  54580. data += "refInFor:true,";
  54581. }
  54582. // pre
  54583. if (el.pre) {
  54584. data += "pre:true,";
  54585. }
  54586. // record original tag name for components using "is" attribute
  54587. if (el.component) {
  54588. data += "tag:\"" + (el.tag) + "\",";
  54589. }
  54590. // module data generation functions
  54591. for (var i = 0; i < state.dataGenFns.length; i++) {
  54592. data += state.dataGenFns[i](el);
  54593. }
  54594. // attributes
  54595. if (el.attrs) {
  54596. data += "attrs:" + (genProps(el.attrs)) + ",";
  54597. }
  54598. // DOM props
  54599. if (el.props) {
  54600. data += "domProps:" + (genProps(el.props)) + ",";
  54601. }
  54602. // event handlers
  54603. if (el.events) {
  54604. data += (genHandlers(el.events, false)) + ",";
  54605. }
  54606. if (el.nativeEvents) {
  54607. data += (genHandlers(el.nativeEvents, true)) + ",";
  54608. }
  54609. // slot target
  54610. // only for non-scoped slots
  54611. if (el.slotTarget && !el.slotScope) {
  54612. data += "slot:" + (el.slotTarget) + ",";
  54613. }
  54614. // scoped slots
  54615. if (el.scopedSlots) {
  54616. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  54617. }
  54618. // component v-model
  54619. if (el.model) {
  54620. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  54621. }
  54622. // inline-template
  54623. if (el.inlineTemplate) {
  54624. var inlineTemplate = genInlineTemplate(el, state);
  54625. if (inlineTemplate) {
  54626. data += inlineTemplate + ",";
  54627. }
  54628. }
  54629. data = data.replace(/,$/, '') + '}';
  54630. // v-bind dynamic argument wrap
  54631. // v-bind with dynamic arguments must be applied using the same v-bind object
  54632. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  54633. if (el.dynamicAttrs) {
  54634. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  54635. }
  54636. // v-bind data wrap
  54637. if (el.wrapData) {
  54638. data = el.wrapData(data);
  54639. }
  54640. // v-on data wrap
  54641. if (el.wrapListeners) {
  54642. data = el.wrapListeners(data);
  54643. }
  54644. return data
  54645. }
  54646. function genDirectives (el, state) {
  54647. var dirs = el.directives;
  54648. if (!dirs) { return }
  54649. var res = 'directives:[';
  54650. var hasRuntime = false;
  54651. var i, l, dir, needRuntime;
  54652. for (i = 0, l = dirs.length; i < l; i++) {
  54653. dir = dirs[i];
  54654. needRuntime = true;
  54655. var gen = state.directives[dir.name];
  54656. if (gen) {
  54657. // compile-time directive that manipulates AST.
  54658. // returns true if it also needs a runtime counterpart.
  54659. needRuntime = !!gen(el, dir, state.warn);
  54660. }
  54661. if (needRuntime) {
  54662. hasRuntime = true;
  54663. 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))) : '') + "},";
  54664. }
  54665. }
  54666. if (hasRuntime) {
  54667. return res.slice(0, -1) + ']'
  54668. }
  54669. }
  54670. function genInlineTemplate (el, state) {
  54671. var ast = el.children[0];
  54672. if (el.children.length !== 1 || ast.type !== 1) {
  54673. state.warn(
  54674. 'Inline-template components must have exactly one child element.',
  54675. { start: el.start }
  54676. );
  54677. }
  54678. if (ast && ast.type === 1) {
  54679. var inlineRenderFns = generate(ast, state.options);
  54680. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  54681. }
  54682. }
  54683. function genScopedSlots (
  54684. el,
  54685. slots,
  54686. state
  54687. ) {
  54688. // by default scoped slots are considered "stable", this allows child
  54689. // components with only scoped slots to skip forced updates from parent.
  54690. // but in some cases we have to bail-out of this optimization
  54691. // for example if the slot contains dynamic names, has v-if or v-for on them...
  54692. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  54693. var slot = slots[key];
  54694. return (
  54695. slot.slotTargetDynamic ||
  54696. slot.if ||
  54697. slot.for ||
  54698. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  54699. )
  54700. });
  54701. // #9534: if a component with scoped slots is inside a conditional branch,
  54702. // it's possible for the same component to be reused but with different
  54703. // compiled slot content. To avoid that, we generate a unique key based on
  54704. // the generated code of all the slot contents.
  54705. var needsKey = !!el.if;
  54706. // OR when it is inside another scoped slot or v-for (the reactivity may be
  54707. // disconnected due to the intermediate scope variable)
  54708. // #9438, #9506
  54709. // TODO: this can be further optimized by properly analyzing in-scope bindings
  54710. // and skip force updating ones that do not actually use scope variables.
  54711. if (!needsForceUpdate) {
  54712. var parent = el.parent;
  54713. while (parent) {
  54714. if (
  54715. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  54716. parent.for
  54717. ) {
  54718. needsForceUpdate = true;
  54719. break
  54720. }
  54721. if (parent.if) {
  54722. needsKey = true;
  54723. }
  54724. parent = parent.parent;
  54725. }
  54726. }
  54727. var generatedSlots = Object.keys(slots)
  54728. .map(function (key) { return genScopedSlot(slots[key], state); })
  54729. .join(',');
  54730. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  54731. }
  54732. function hash(str) {
  54733. var hash = 5381;
  54734. var i = str.length;
  54735. while(i) {
  54736. hash = (hash * 33) ^ str.charCodeAt(--i);
  54737. }
  54738. return hash >>> 0
  54739. }
  54740. function containsSlotChild (el) {
  54741. if (el.type === 1) {
  54742. if (el.tag === 'slot') {
  54743. return true
  54744. }
  54745. return el.children.some(containsSlotChild)
  54746. }
  54747. return false
  54748. }
  54749. function genScopedSlot (
  54750. el,
  54751. state
  54752. ) {
  54753. var isLegacySyntax = el.attrsMap['slot-scope'];
  54754. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  54755. return genIf(el, state, genScopedSlot, "null")
  54756. }
  54757. if (el.for && !el.forProcessed) {
  54758. return genFor(el, state, genScopedSlot)
  54759. }
  54760. var slotScope = el.slotScope === emptySlotScopeToken
  54761. ? ""
  54762. : String(el.slotScope);
  54763. var fn = "function(" + slotScope + "){" +
  54764. "return " + (el.tag === 'template'
  54765. ? el.if && isLegacySyntax
  54766. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  54767. : genChildren(el, state) || 'undefined'
  54768. : genElement(el, state)) + "}";
  54769. // reverse proxy v-slot without scope on this.$slots
  54770. var reverseProxy = slotScope ? "" : ",proxy:true";
  54771. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  54772. }
  54773. function genChildren (
  54774. el,
  54775. state,
  54776. checkSkip,
  54777. altGenElement,
  54778. altGenNode
  54779. ) {
  54780. var children = el.children;
  54781. if (children.length) {
  54782. var el$1 = children[0];
  54783. // optimize single v-for
  54784. if (children.length === 1 &&
  54785. el$1.for &&
  54786. el$1.tag !== 'template' &&
  54787. el$1.tag !== 'slot'
  54788. ) {
  54789. var normalizationType = checkSkip
  54790. ? state.maybeComponent(el$1) ? ",1" : ",0"
  54791. : "";
  54792. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  54793. }
  54794. var normalizationType$1 = checkSkip
  54795. ? getNormalizationType(children, state.maybeComponent)
  54796. : 0;
  54797. var gen = altGenNode || genNode;
  54798. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  54799. }
  54800. }
  54801. // determine the normalization needed for the children array.
  54802. // 0: no normalization needed
  54803. // 1: simple normalization needed (possible 1-level deep nested array)
  54804. // 2: full normalization needed
  54805. function getNormalizationType (
  54806. children,
  54807. maybeComponent
  54808. ) {
  54809. var res = 0;
  54810. for (var i = 0; i < children.length; i++) {
  54811. var el = children[i];
  54812. if (el.type !== 1) {
  54813. continue
  54814. }
  54815. if (needsNormalization(el) ||
  54816. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  54817. res = 2;
  54818. break
  54819. }
  54820. if (maybeComponent(el) ||
  54821. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  54822. res = 1;
  54823. }
  54824. }
  54825. return res
  54826. }
  54827. function needsNormalization (el) {
  54828. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  54829. }
  54830. function genNode (node, state) {
  54831. if (node.type === 1) {
  54832. return genElement(node, state)
  54833. } else if (node.type === 3 && node.isComment) {
  54834. return genComment(node)
  54835. } else {
  54836. return genText(node)
  54837. }
  54838. }
  54839. function genText (text) {
  54840. return ("_v(" + (text.type === 2
  54841. ? text.expression // no need for () because already wrapped in _s()
  54842. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  54843. }
  54844. function genComment (comment) {
  54845. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  54846. }
  54847. function genSlot (el, state) {
  54848. var slotName = el.slotName || '"default"';
  54849. var children = genChildren(el, state);
  54850. var res = "_t(" + slotName + (children ? ("," + children) : '');
  54851. var attrs = el.attrs || el.dynamicAttrs
  54852. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  54853. // slot props are camelized
  54854. name: camelize(attr.name),
  54855. value: attr.value,
  54856. dynamic: attr.dynamic
  54857. }); }))
  54858. : null;
  54859. var bind$$1 = el.attrsMap['v-bind'];
  54860. if ((attrs || bind$$1) && !children) {
  54861. res += ",null";
  54862. }
  54863. if (attrs) {
  54864. res += "," + attrs;
  54865. }
  54866. if (bind$$1) {
  54867. res += (attrs ? '' : ',null') + "," + bind$$1;
  54868. }
  54869. return res + ')'
  54870. }
  54871. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  54872. function genComponent (
  54873. componentName,
  54874. el,
  54875. state
  54876. ) {
  54877. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54878. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  54879. }
  54880. function genProps (props) {
  54881. var staticProps = "";
  54882. var dynamicProps = "";
  54883. for (var i = 0; i < props.length; i++) {
  54884. var prop = props[i];
  54885. var value = transformSpecialNewlines(prop.value);
  54886. if (prop.dynamic) {
  54887. dynamicProps += (prop.name) + "," + value + ",";
  54888. } else {
  54889. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  54890. }
  54891. }
  54892. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  54893. if (dynamicProps) {
  54894. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  54895. } else {
  54896. return staticProps
  54897. }
  54898. }
  54899. // #3895, #4268
  54900. function transformSpecialNewlines (text) {
  54901. return text
  54902. .replace(/\u2028/g, '\\u2028')
  54903. .replace(/\u2029/g, '\\u2029')
  54904. }
  54905. /* */
  54906. // these keywords should not appear inside expressions, but operators like
  54907. // typeof, instanceof and in are allowed
  54908. var prohibitedKeywordRE = new RegExp('\\b' + (
  54909. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  54910. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  54911. 'extends,finally,continue,debugger,function,arguments'
  54912. ).split(',').join('\\b|\\b') + '\\b');
  54913. // these unary operators should not be used as property/method names
  54914. var unaryOperatorsRE = new RegExp('\\b' + (
  54915. 'delete,typeof,void'
  54916. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  54917. // strip strings in expressions
  54918. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  54919. // detect problematic expressions in a template
  54920. function detectErrors (ast, warn) {
  54921. if (ast) {
  54922. checkNode(ast, warn);
  54923. }
  54924. }
  54925. function checkNode (node, warn) {
  54926. if (node.type === 1) {
  54927. for (var name in node.attrsMap) {
  54928. if (dirRE.test(name)) {
  54929. var value = node.attrsMap[name];
  54930. if (value) {
  54931. var range = node.rawAttrsMap[name];
  54932. if (name === 'v-for') {
  54933. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  54934. } else if (name === 'v-slot' || name[0] === '#') {
  54935. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  54936. } else if (onRE.test(name)) {
  54937. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  54938. } else {
  54939. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  54940. }
  54941. }
  54942. }
  54943. }
  54944. if (node.children) {
  54945. for (var i = 0; i < node.children.length; i++) {
  54946. checkNode(node.children[i], warn);
  54947. }
  54948. }
  54949. } else if (node.type === 2) {
  54950. checkExpression(node.expression, node.text, warn, node);
  54951. }
  54952. }
  54953. function checkEvent (exp, text, warn, range) {
  54954. var stripped = exp.replace(stripStringRE, '');
  54955. var keywordMatch = stripped.match(unaryOperatorsRE);
  54956. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  54957. warn(
  54958. "avoid using JavaScript unary operator as property name: " +
  54959. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  54960. range
  54961. );
  54962. }
  54963. checkExpression(exp, text, warn, range);
  54964. }
  54965. function checkFor (node, text, warn, range) {
  54966. checkExpression(node.for || '', text, warn, range);
  54967. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  54968. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  54969. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  54970. }
  54971. function checkIdentifier (
  54972. ident,
  54973. type,
  54974. text,
  54975. warn,
  54976. range
  54977. ) {
  54978. if (typeof ident === 'string') {
  54979. try {
  54980. new Function(("var " + ident + "=_"));
  54981. } catch (e) {
  54982. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  54983. }
  54984. }
  54985. }
  54986. function checkExpression (exp, text, warn, range) {
  54987. try {
  54988. new Function(("return " + exp));
  54989. } catch (e) {
  54990. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  54991. if (keywordMatch) {
  54992. warn(
  54993. "avoid using JavaScript keyword as property name: " +
  54994. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  54995. range
  54996. );
  54997. } else {
  54998. warn(
  54999. "invalid expression: " + (e.message) + " in\n\n" +
  55000. " " + exp + "\n\n" +
  55001. " Raw expression: " + (text.trim()) + "\n",
  55002. range
  55003. );
  55004. }
  55005. }
  55006. }
  55007. function checkFunctionParameterExpression (exp, text, warn, range) {
  55008. try {
  55009. new Function(exp, '');
  55010. } catch (e) {
  55011. warn(
  55012. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  55013. " " + exp + "\n\n" +
  55014. " Raw expression: " + (text.trim()) + "\n",
  55015. range
  55016. );
  55017. }
  55018. }
  55019. /* */
  55020. var range = 2;
  55021. function generateCodeFrame (
  55022. source,
  55023. start,
  55024. end
  55025. ) {
  55026. if ( start === void 0 ) start = 0;
  55027. if ( end === void 0 ) end = source.length;
  55028. var lines = source.split(/\r?\n/);
  55029. var count = 0;
  55030. var res = [];
  55031. for (var i = 0; i < lines.length; i++) {
  55032. count += lines[i].length + 1;
  55033. if (count >= start) {
  55034. for (var j = i - range; j <= i + range || end > count; j++) {
  55035. if (j < 0 || j >= lines.length) { continue }
  55036. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  55037. var lineLength = lines[j].length;
  55038. if (j === i) {
  55039. // push underline
  55040. var pad = start - (count - lineLength) + 1;
  55041. var length = end > count ? lineLength - pad : end - start;
  55042. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  55043. } else if (j > i) {
  55044. if (end > count) {
  55045. var length$1 = Math.min(end - count, lineLength);
  55046. res.push(" | " + repeat$1("^", length$1));
  55047. }
  55048. count += lineLength + 1;
  55049. }
  55050. }
  55051. break
  55052. }
  55053. }
  55054. return res.join('\n')
  55055. }
  55056. function repeat$1 (str, n) {
  55057. var result = '';
  55058. if (n > 0) {
  55059. while (true) { // eslint-disable-line
  55060. if (n & 1) { result += str; }
  55061. n >>>= 1;
  55062. if (n <= 0) { break }
  55063. str += str;
  55064. }
  55065. }
  55066. return result
  55067. }
  55068. /* */
  55069. function createFunction (code, errors) {
  55070. try {
  55071. return new Function(code)
  55072. } catch (err) {
  55073. errors.push({ err: err, code: code });
  55074. return noop
  55075. }
  55076. }
  55077. function createCompileToFunctionFn (compile) {
  55078. var cache = Object.create(null);
  55079. return function compileToFunctions (
  55080. template,
  55081. options,
  55082. vm
  55083. ) {
  55084. options = extend({}, options);
  55085. var warn$$1 = options.warn || warn;
  55086. delete options.warn;
  55087. /* istanbul ignore if */
  55088. {
  55089. // detect possible CSP restriction
  55090. try {
  55091. new Function('return 1');
  55092. } catch (e) {
  55093. if (e.toString().match(/unsafe-eval|CSP/)) {
  55094. warn$$1(
  55095. 'It seems you are using the standalone build of Vue.js in an ' +
  55096. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  55097. 'The template compiler cannot work in this environment. Consider ' +
  55098. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  55099. 'templates into render functions.'
  55100. );
  55101. }
  55102. }
  55103. }
  55104. // check cache
  55105. var key = options.delimiters
  55106. ? String(options.delimiters) + template
  55107. : template;
  55108. if (cache[key]) {
  55109. return cache[key]
  55110. }
  55111. // compile
  55112. var compiled = compile(template, options);
  55113. // check compilation errors/tips
  55114. {
  55115. if (compiled.errors && compiled.errors.length) {
  55116. if (options.outputSourceRange) {
  55117. compiled.errors.forEach(function (e) {
  55118. warn$$1(
  55119. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  55120. generateCodeFrame(template, e.start, e.end),
  55121. vm
  55122. );
  55123. });
  55124. } else {
  55125. warn$$1(
  55126. "Error compiling template:\n\n" + template + "\n\n" +
  55127. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  55128. vm
  55129. );
  55130. }
  55131. }
  55132. if (compiled.tips && compiled.tips.length) {
  55133. if (options.outputSourceRange) {
  55134. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  55135. } else {
  55136. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  55137. }
  55138. }
  55139. }
  55140. // turn code into functions
  55141. var res = {};
  55142. var fnGenErrors = [];
  55143. res.render = createFunction(compiled.render, fnGenErrors);
  55144. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  55145. return createFunction(code, fnGenErrors)
  55146. });
  55147. // check function generation errors.
  55148. // this should only happen if there is a bug in the compiler itself.
  55149. // mostly for codegen development use
  55150. /* istanbul ignore if */
  55151. {
  55152. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  55153. warn$$1(
  55154. "Failed to generate render function:\n\n" +
  55155. fnGenErrors.map(function (ref) {
  55156. var err = ref.err;
  55157. var code = ref.code;
  55158. return ((err.toString()) + " in\n\n" + code + "\n");
  55159. }).join('\n'),
  55160. vm
  55161. );
  55162. }
  55163. }
  55164. return (cache[key] = res)
  55165. }
  55166. }
  55167. /* */
  55168. function createCompilerCreator (baseCompile) {
  55169. return function createCompiler (baseOptions) {
  55170. function compile (
  55171. template,
  55172. options
  55173. ) {
  55174. var finalOptions = Object.create(baseOptions);
  55175. var errors = [];
  55176. var tips = [];
  55177. var warn = function (msg, range, tip) {
  55178. (tip ? tips : errors).push(msg);
  55179. };
  55180. if (options) {
  55181. if (options.outputSourceRange) {
  55182. // $flow-disable-line
  55183. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  55184. warn = function (msg, range, tip) {
  55185. var data = { msg: msg };
  55186. if (range) {
  55187. if (range.start != null) {
  55188. data.start = range.start + leadingSpaceLength;
  55189. }
  55190. if (range.end != null) {
  55191. data.end = range.end + leadingSpaceLength;
  55192. }
  55193. }
  55194. (tip ? tips : errors).push(data);
  55195. };
  55196. }
  55197. // merge custom modules
  55198. if (options.modules) {
  55199. finalOptions.modules =
  55200. (baseOptions.modules || []).concat(options.modules);
  55201. }
  55202. // merge custom directives
  55203. if (options.directives) {
  55204. finalOptions.directives = extend(
  55205. Object.create(baseOptions.directives || null),
  55206. options.directives
  55207. );
  55208. }
  55209. // copy other options
  55210. for (var key in options) {
  55211. if (key !== 'modules' && key !== 'directives') {
  55212. finalOptions[key] = options[key];
  55213. }
  55214. }
  55215. }
  55216. finalOptions.warn = warn;
  55217. var compiled = baseCompile(template.trim(), finalOptions);
  55218. {
  55219. detectErrors(compiled.ast, warn);
  55220. }
  55221. compiled.errors = errors;
  55222. compiled.tips = tips;
  55223. return compiled
  55224. }
  55225. return {
  55226. compile: compile,
  55227. compileToFunctions: createCompileToFunctionFn(compile)
  55228. }
  55229. }
  55230. }
  55231. /* */
  55232. // `createCompilerCreator` allows creating compilers that use alternative
  55233. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  55234. // Here we just export a default compiler using the default parts.
  55235. var createCompiler = createCompilerCreator(function baseCompile (
  55236. template,
  55237. options
  55238. ) {
  55239. var ast = parse(template.trim(), options);
  55240. if (options.optimize !== false) {
  55241. optimize(ast, options);
  55242. }
  55243. var code = generate(ast, options);
  55244. return {
  55245. ast: ast,
  55246. render: code.render,
  55247. staticRenderFns: code.staticRenderFns
  55248. }
  55249. });
  55250. /* */
  55251. var ref$1 = createCompiler(baseOptions);
  55252. var compile = ref$1.compile;
  55253. var compileToFunctions = ref$1.compileToFunctions;
  55254. /* */
  55255. // check whether current browser encodes a char inside attribute values
  55256. var div;
  55257. function getShouldDecode (href) {
  55258. div = div || document.createElement('div');
  55259. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  55260. return div.innerHTML.indexOf('&#10;') > 0
  55261. }
  55262. // #3663: IE encodes newlines inside attribute values while other browsers don't
  55263. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  55264. // #6828: chrome encodes content in a[href]
  55265. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  55266. /* */
  55267. var idToTemplate = cached(function (id) {
  55268. var el = query(id);
  55269. return el && el.innerHTML
  55270. });
  55271. var mount = Vue.prototype.$mount;
  55272. Vue.prototype.$mount = function (
  55273. el,
  55274. hydrating
  55275. ) {
  55276. el = el && query(el);
  55277. /* istanbul ignore if */
  55278. if (el === document.body || el === document.documentElement) {
  55279. warn(
  55280. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  55281. );
  55282. return this
  55283. }
  55284. var options = this.$options;
  55285. // resolve template/el and convert to render function
  55286. if (!options.render) {
  55287. var template = options.template;
  55288. if (template) {
  55289. if (typeof template === 'string') {
  55290. if (template.charAt(0) === '#') {
  55291. template = idToTemplate(template);
  55292. /* istanbul ignore if */
  55293. if (!template) {
  55294. warn(
  55295. ("Template element not found or is empty: " + (options.template)),
  55296. this
  55297. );
  55298. }
  55299. }
  55300. } else if (template.nodeType) {
  55301. template = template.innerHTML;
  55302. } else {
  55303. {
  55304. warn('invalid template option:' + template, this);
  55305. }
  55306. return this
  55307. }
  55308. } else if (el) {
  55309. template = getOuterHTML(el);
  55310. }
  55311. if (template) {
  55312. /* istanbul ignore if */
  55313. if (config.performance && mark) {
  55314. mark('compile');
  55315. }
  55316. var ref = compileToFunctions(template, {
  55317. outputSourceRange: "development" !== 'production',
  55318. shouldDecodeNewlines: shouldDecodeNewlines,
  55319. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  55320. delimiters: options.delimiters,
  55321. comments: options.comments
  55322. }, this);
  55323. var render = ref.render;
  55324. var staticRenderFns = ref.staticRenderFns;
  55325. options.render = render;
  55326. options.staticRenderFns = staticRenderFns;
  55327. /* istanbul ignore if */
  55328. if (config.performance && mark) {
  55329. mark('compile end');
  55330. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  55331. }
  55332. }
  55333. }
  55334. return mount.call(this, el, hydrating)
  55335. };
  55336. /**
  55337. * Get outerHTML of elements, taking care
  55338. * of SVG elements in IE as well.
  55339. */
  55340. function getOuterHTML (el) {
  55341. if (el.outerHTML) {
  55342. return el.outerHTML
  55343. } else {
  55344. var container = document.createElement('div');
  55345. container.appendChild(el.cloneNode(true));
  55346. return container.innerHTML
  55347. }
  55348. }
  55349. Vue.compile = compileToFunctions;
  55350. module.exports = Vue;
  55351. /* 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))
  55352. /***/ }),
  55353. /***/ "./node_modules/vue/dist/vue.common.js":
  55354. /*!*********************************************!*\
  55355. !*** ./node_modules/vue/dist/vue.common.js ***!
  55356. \*********************************************/
  55357. /*! no static exports found */
  55358. /***/ (function(module, exports, __webpack_require__) {
  55359. if (false) {} else {
  55360. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  55361. }
  55362. /***/ }),
  55363. /***/ "./node_modules/webpack/buildin/global.js":
  55364. /*!***********************************!*\
  55365. !*** (webpack)/buildin/global.js ***!
  55366. \***********************************/
  55367. /*! no static exports found */
  55368. /***/ (function(module, exports) {
  55369. var g;
  55370. // This works in non-strict mode
  55371. g = (function() {
  55372. return this;
  55373. })();
  55374. try {
  55375. // This works if eval is allowed (see CSP)
  55376. g = g || new Function("return this")();
  55377. } catch (e) {
  55378. // This works if the window reference is available
  55379. if (typeof window === "object") g = window;
  55380. }
  55381. // g can still be undefined, but nothing to do about it...
  55382. // We return undefined, instead of nothing here, so it's
  55383. // easier to handle this case. if(!global) { ...}
  55384. module.exports = g;
  55385. /***/ }),
  55386. /***/ "./node_modules/webpack/buildin/module.js":
  55387. /*!***********************************!*\
  55388. !*** (webpack)/buildin/module.js ***!
  55389. \***********************************/
  55390. /*! no static exports found */
  55391. /***/ (function(module, exports) {
  55392. module.exports = function(module) {
  55393. if (!module.webpackPolyfill) {
  55394. module.deprecate = function() {};
  55395. module.paths = [];
  55396. // module.parent = undefined by default
  55397. if (!module.children) module.children = [];
  55398. Object.defineProperty(module, "loaded", {
  55399. enumerable: true,
  55400. get: function() {
  55401. return module.l;
  55402. }
  55403. });
  55404. Object.defineProperty(module, "id", {
  55405. enumerable: true,
  55406. get: function() {
  55407. return module.i;
  55408. }
  55409. });
  55410. module.webpackPolyfill = 1;
  55411. }
  55412. return module;
  55413. };
  55414. /***/ }),
  55415. /***/ "./resources/js/app.js":
  55416. /*!*****************************!*\
  55417. !*** ./resources/js/app.js ***!
  55418. \*****************************/
  55419. /*! no static exports found */
  55420. /***/ (function(module, exports, __webpack_require__) {
  55421. /**
  55422. * First we will load all of this project's JavaScript dependencies which
  55423. * includes Vue and other libraries. It is a great starting point when
  55424. * building robust, powerful web applications using Vue and Laravel.
  55425. */
  55426. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  55427. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  55428. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  55429. window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  55430. /**
  55431. * The following block of code may be used to automatically register your
  55432. * Vue components. It will recursively scan this directory for the Vue
  55433. * components and automatically register them with their "basename".
  55434. *
  55435. * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
  55436. */
  55437. // const files = require.context('./', true, /\.vue$/i)
  55438. // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
  55439. Vue.component('example-component', __webpack_require__(/*! ./components/ExampleComponent.vue */ "./resources/js/components/ExampleComponent.vue")["default"]);
  55440. Vue.component('woinfo', __webpack_require__(/*! ./components/woinfo.vue */ "./resources/js/components/woinfo.vue")["default"]);
  55441. Vue.component('assetinfo', __webpack_require__(/*! ./components/assetinfo.vue */ "./resources/js/components/assetinfo.vue")["default"]);
  55442. Vue.component('credential', __webpack_require__(/*! ./components/credential.vue */ "./resources/js/components/credential.vue")["default"]);
  55443. Vue.component('notes', __webpack_require__(/*! ./components/notes.vue */ "./resources/js/components/notes.vue")["default"]);
  55444. Vue.component('modal', __webpack_require__(/*! ./components/modal.vue */ "./resources/js/components/modal.vue")["default"]);
  55445. Vue.component('woinfo-edit-modal', __webpack_require__(/*! ./components/woinfo-edit-modal.vue */ "./resources/js/components/woinfo-edit-modal.vue")["default"]);
  55446. Vue.component('errorlist', __webpack_require__(/*! ./components/errorlist.vue */ "./resources/js/components/errorlist.vue")["default"]);
  55447. Vue.component('credential-form-modal', __webpack_require__(/*! ./components/credential-form-modal.vue */ "./resources/js/components/credential-form-modal.vue")["default"]);
  55448. Vue.component('autocomplete-custom-dropdown', __webpack_require__(/*! ./components/autocomplete-custom-dropdown.vue */ "./resources/js/components/autocomplete-custom-dropdown.vue")["default"]);
  55449. Vue.component('credential-list', __webpack_require__(/*! ./components/credential-list.vue */ "./resources/js/components/credential-list.vue")["default"]);
  55450. /**
  55451. * Next, we will create a fresh Vue application instance and attach it to
  55452. * the page. Then, you may begin adding components to this application
  55453. * or customize the JavaScript scaffolding to fit your unique needs.
  55454. */
  55455. var app = new Vue({
  55456. el: '#app'
  55457. });
  55458. $(function () {
  55459. $('[data-toggle="tooltip"]').tooltip();
  55460. });
  55461. var clipboard = new Clipboard('.btn-clip');
  55462. clipboard.on('success', function (e) {
  55463. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  55464. position: "right",
  55465. className: 'success'
  55466. });
  55467. e.clearSelection();
  55468. });
  55469. /***/ }),
  55470. /***/ "./resources/js/bootstrap.js":
  55471. /*!***********************************!*\
  55472. !*** ./resources/js/bootstrap.js ***!
  55473. \***********************************/
  55474. /*! no exports provided */
  55475. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55476. "use strict";
  55477. __webpack_require__.r(__webpack_exports__);
  55478. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  55479. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  55480. /**
  55481. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  55482. * for JavaScript based Bootstrap features such as modals and tabs. This
  55483. * code may be modified to fit the specific needs of your application.
  55484. */
  55485. try {
  55486. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  55487. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  55488. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  55489. } catch (e) {}
  55490. /**
  55491. * We'll load the axios HTTP library which allows us to easily issue requests
  55492. * to our Laravel back-end. This library automatically handles sending the
  55493. * CSRF token as a header based on the value of the "XSRF" token cookie.
  55494. */
  55495. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  55496. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  55497. /**
  55498. * Echo exposes an expressive API for subscribing to channels and listening
  55499. * for events that are broadcast by Laravel. Echo and event broadcasting
  55500. * allows your team to easily build robust real-time web applications.
  55501. */
  55502. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  55503. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  55504. broadcaster: 'pusher',
  55505. key: "upccrt",
  55506. authEndpoint: '/broadcasting/auth',
  55507. wsHost: window.location.hostname,
  55508. wsPort: 6001,
  55509. disableStats: true
  55510. });
  55511. /***/ }),
  55512. /***/ "./resources/js/components/ExampleComponent.vue":
  55513. /*!******************************************************!*\
  55514. !*** ./resources/js/components/ExampleComponent.vue ***!
  55515. \******************************************************/
  55516. /*! exports provided: default */
  55517. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55518. "use strict";
  55519. __webpack_require__.r(__webpack_exports__);
  55520. /* 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&");
  55521. /* 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&");
  55522. /* 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");
  55523. /* normalize component */
  55524. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55525. _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55526. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55527. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55528. false,
  55529. null,
  55530. null,
  55531. null
  55532. )
  55533. /* hot reload */
  55534. if (false) { var api; }
  55535. component.options.__file = "resources/js/components/ExampleComponent.vue"
  55536. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55537. /***/ }),
  55538. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  55539. /*!*******************************************************************************!*\
  55540. !*** ./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  55541. \*******************************************************************************/
  55542. /*! exports provided: default */
  55543. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55544. "use strict";
  55545. __webpack_require__.r(__webpack_exports__);
  55546. /* 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&");
  55547. /* 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"]);
  55548. /***/ }),
  55549. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  55550. /*!*************************************************************************************!*\
  55551. !*** ./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  55552. \*************************************************************************************/
  55553. /*! exports provided: render, staticRenderFns */
  55554. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55555. "use strict";
  55556. __webpack_require__.r(__webpack_exports__);
  55557. /* 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&");
  55558. /* 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"]; });
  55559. /* 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"]; });
  55560. /***/ }),
  55561. /***/ "./resources/js/components/assetinfo.vue":
  55562. /*!***********************************************!*\
  55563. !*** ./resources/js/components/assetinfo.vue ***!
  55564. \***********************************************/
  55565. /*! exports provided: default */
  55566. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55567. "use strict";
  55568. __webpack_require__.r(__webpack_exports__);
  55569. /* 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&");
  55570. /* 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&");
  55571. /* 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");
  55572. /* normalize component */
  55573. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55574. _assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55575. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["render"],
  55576. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55577. false,
  55578. null,
  55579. null,
  55580. null
  55581. )
  55582. /* hot reload */
  55583. if (false) { var api; }
  55584. component.options.__file = "resources/js/components/assetinfo.vue"
  55585. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55586. /***/ }),
  55587. /***/ "./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  55588. /*!************************************************************************!*\
  55589. !*** ./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  55590. \************************************************************************/
  55591. /*! exports provided: default */
  55592. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55593. "use strict";
  55594. __webpack_require__.r(__webpack_exports__);
  55595. /* 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&");
  55596. /* 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"]);
  55597. /***/ }),
  55598. /***/ "./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&":
  55599. /*!******************************************************************************!*\
  55600. !*** ./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3& ***!
  55601. \******************************************************************************/
  55602. /*! exports provided: render, staticRenderFns */
  55603. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55604. "use strict";
  55605. __webpack_require__.r(__webpack_exports__);
  55606. /* 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&");
  55607. /* 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"]; });
  55608. /* 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"]; });
  55609. /***/ }),
  55610. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue":
  55611. /*!******************************************************************!*\
  55612. !*** ./resources/js/components/autocomplete-custom-dropdown.vue ***!
  55613. \******************************************************************/
  55614. /*! exports provided: default */
  55615. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55616. "use strict";
  55617. __webpack_require__.r(__webpack_exports__);
  55618. /* 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&");
  55619. /* 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&");
  55620. /* 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");
  55621. /* normalize component */
  55622. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55623. _autocomplete_custom_dropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55624. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["render"],
  55625. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55626. false,
  55627. null,
  55628. null,
  55629. null
  55630. )
  55631. /* hot reload */
  55632. if (false) { var api; }
  55633. component.options.__file = "resources/js/components/autocomplete-custom-dropdown.vue"
  55634. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55635. /***/ }),
  55636. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&":
  55637. /*!*******************************************************************************************!*\
  55638. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js& ***!
  55639. \*******************************************************************************************/
  55640. /*! exports provided: default */
  55641. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55642. "use strict";
  55643. __webpack_require__.r(__webpack_exports__);
  55644. /* 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&");
  55645. /* 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"]);
  55646. /***/ }),
  55647. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a&":
  55648. /*!*************************************************************************************************!*\
  55649. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a& ***!
  55650. \*************************************************************************************************/
  55651. /*! exports provided: render, staticRenderFns */
  55652. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55653. "use strict";
  55654. __webpack_require__.r(__webpack_exports__);
  55655. /* 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&");
  55656. /* 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"]; });
  55657. /* 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"]; });
  55658. /***/ }),
  55659. /***/ "./resources/js/components/credential-form-modal.vue":
  55660. /*!***********************************************************!*\
  55661. !*** ./resources/js/components/credential-form-modal.vue ***!
  55662. \***********************************************************/
  55663. /*! exports provided: default */
  55664. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55665. "use strict";
  55666. __webpack_require__.r(__webpack_exports__);
  55667. /* 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&");
  55668. /* 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&");
  55669. /* 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");
  55670. /* normalize component */
  55671. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55672. _credential_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55673. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["render"],
  55674. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55675. false,
  55676. null,
  55677. null,
  55678. null
  55679. )
  55680. /* hot reload */
  55681. if (false) { var api; }
  55682. component.options.__file = "resources/js/components/credential-form-modal.vue"
  55683. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55684. /***/ }),
  55685. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&":
  55686. /*!************************************************************************************!*\
  55687. !*** ./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js& ***!
  55688. \************************************************************************************/
  55689. /*! exports provided: default */
  55690. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55691. "use strict";
  55692. __webpack_require__.r(__webpack_exports__);
  55693. /* 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&");
  55694. /* 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"]);
  55695. /***/ }),
  55696. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42&":
  55697. /*!******************************************************************************************!*\
  55698. !*** ./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42& ***!
  55699. \******************************************************************************************/
  55700. /*! exports provided: render, staticRenderFns */
  55701. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55702. "use strict";
  55703. __webpack_require__.r(__webpack_exports__);
  55704. /* 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&");
  55705. /* 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"]; });
  55706. /* 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"]; });
  55707. /***/ }),
  55708. /***/ "./resources/js/components/credential-list.vue":
  55709. /*!*****************************************************!*\
  55710. !*** ./resources/js/components/credential-list.vue ***!
  55711. \*****************************************************/
  55712. /*! exports provided: default */
  55713. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55714. "use strict";
  55715. __webpack_require__.r(__webpack_exports__);
  55716. /* 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&");
  55717. /* 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&");
  55718. /* 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");
  55719. /* normalize component */
  55720. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55721. _credential_list_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55722. _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55723. _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55724. false,
  55725. null,
  55726. null,
  55727. null
  55728. )
  55729. /* hot reload */
  55730. if (false) { var api; }
  55731. component.options.__file = "resources/js/components/credential-list.vue"
  55732. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55733. /***/ }),
  55734. /***/ "./resources/js/components/credential-list.vue?vue&type=script&lang=js&":
  55735. /*!******************************************************************************!*\
  55736. !*** ./resources/js/components/credential-list.vue?vue&type=script&lang=js& ***!
  55737. \******************************************************************************/
  55738. /*! exports provided: default */
  55739. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55740. "use strict";
  55741. __webpack_require__.r(__webpack_exports__);
  55742. /* 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&");
  55743. /* 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"]);
  55744. /***/ }),
  55745. /***/ "./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&":
  55746. /*!************************************************************************************!*\
  55747. !*** ./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e& ***!
  55748. \************************************************************************************/
  55749. /*! exports provided: render, staticRenderFns */
  55750. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55751. "use strict";
  55752. __webpack_require__.r(__webpack_exports__);
  55753. /* 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&");
  55754. /* 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"]; });
  55755. /* 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"]; });
  55756. /***/ }),
  55757. /***/ "./resources/js/components/credential.vue":
  55758. /*!************************************************!*\
  55759. !*** ./resources/js/components/credential.vue ***!
  55760. \************************************************/
  55761. /*! exports provided: default */
  55762. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55763. "use strict";
  55764. __webpack_require__.r(__webpack_exports__);
  55765. /* 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&");
  55766. /* 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&");
  55767. /* 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");
  55768. /* normalize component */
  55769. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55770. _credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55771. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["render"],
  55772. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55773. false,
  55774. null,
  55775. null,
  55776. null
  55777. )
  55778. /* hot reload */
  55779. if (false) { var api; }
  55780. component.options.__file = "resources/js/components/credential.vue"
  55781. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55782. /***/ }),
  55783. /***/ "./resources/js/components/credential.vue?vue&type=script&lang=js&":
  55784. /*!*************************************************************************!*\
  55785. !*** ./resources/js/components/credential.vue?vue&type=script&lang=js& ***!
  55786. \*************************************************************************/
  55787. /*! exports provided: default */
  55788. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55789. "use strict";
  55790. __webpack_require__.r(__webpack_exports__);
  55791. /* 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&");
  55792. /* 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"]);
  55793. /***/ }),
  55794. /***/ "./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&":
  55795. /*!*******************************************************************************!*\
  55796. !*** ./resources/js/components/credential.vue?vue&type=template&id=0f5cc562& ***!
  55797. \*******************************************************************************/
  55798. /*! exports provided: render, staticRenderFns */
  55799. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55800. "use strict";
  55801. __webpack_require__.r(__webpack_exports__);
  55802. /* 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&");
  55803. /* 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"]; });
  55804. /* 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"]; });
  55805. /***/ }),
  55806. /***/ "./resources/js/components/errorlist.vue":
  55807. /*!***********************************************!*\
  55808. !*** ./resources/js/components/errorlist.vue ***!
  55809. \***********************************************/
  55810. /*! exports provided: default */
  55811. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55812. "use strict";
  55813. __webpack_require__.r(__webpack_exports__);
  55814. /* 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&");
  55815. /* 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&");
  55816. /* 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");
  55817. /* normalize component */
  55818. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55819. _errorlist_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55820. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["render"],
  55821. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55822. false,
  55823. null,
  55824. null,
  55825. null
  55826. )
  55827. /* hot reload */
  55828. if (false) { var api; }
  55829. component.options.__file = "resources/js/components/errorlist.vue"
  55830. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55831. /***/ }),
  55832. /***/ "./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  55833. /*!************************************************************************!*\
  55834. !*** ./resources/js/components/errorlist.vue?vue&type=script&lang=js& ***!
  55835. \************************************************************************/
  55836. /*! exports provided: default */
  55837. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55838. "use strict";
  55839. __webpack_require__.r(__webpack_exports__);
  55840. /* 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&");
  55841. /* 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"]);
  55842. /***/ }),
  55843. /***/ "./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb&":
  55844. /*!******************************************************************************!*\
  55845. !*** ./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb& ***!
  55846. \******************************************************************************/
  55847. /*! exports provided: render, staticRenderFns */
  55848. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55849. "use strict";
  55850. __webpack_require__.r(__webpack_exports__);
  55851. /* 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&");
  55852. /* 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"]; });
  55853. /* 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"]; });
  55854. /***/ }),
  55855. /***/ "./resources/js/components/modal.vue":
  55856. /*!*******************************************!*\
  55857. !*** ./resources/js/components/modal.vue ***!
  55858. \*******************************************/
  55859. /*! exports provided: default */
  55860. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55861. "use strict";
  55862. __webpack_require__.r(__webpack_exports__);
  55863. /* 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&");
  55864. /* 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");
  55865. var script = {}
  55866. /* normalize component */
  55867. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  55868. script,
  55869. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["render"],
  55870. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55871. false,
  55872. null,
  55873. null,
  55874. null
  55875. )
  55876. /* hot reload */
  55877. if (false) { var api; }
  55878. component.options.__file = "resources/js/components/modal.vue"
  55879. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55880. /***/ }),
  55881. /***/ "./resources/js/components/modal.vue?vue&type=template&id=478d961c&":
  55882. /*!**************************************************************************!*\
  55883. !*** ./resources/js/components/modal.vue?vue&type=template&id=478d961c& ***!
  55884. \**************************************************************************/
  55885. /*! exports provided: render, staticRenderFns */
  55886. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55887. "use strict";
  55888. __webpack_require__.r(__webpack_exports__);
  55889. /* 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&");
  55890. /* 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"]; });
  55891. /* 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"]; });
  55892. /***/ }),
  55893. /***/ "./resources/js/components/notes.vue":
  55894. /*!*******************************************!*\
  55895. !*** ./resources/js/components/notes.vue ***!
  55896. \*******************************************/
  55897. /*! exports provided: default */
  55898. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55899. "use strict";
  55900. __webpack_require__.r(__webpack_exports__);
  55901. /* 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&");
  55902. /* 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&");
  55903. /* 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");
  55904. /* normalize component */
  55905. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55906. _notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55907. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["render"],
  55908. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55909. false,
  55910. null,
  55911. null,
  55912. null
  55913. )
  55914. /* hot reload */
  55915. if (false) { var api; }
  55916. component.options.__file = "resources/js/components/notes.vue"
  55917. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55918. /***/ }),
  55919. /***/ "./resources/js/components/notes.vue?vue&type=script&lang=js&":
  55920. /*!********************************************************************!*\
  55921. !*** ./resources/js/components/notes.vue?vue&type=script&lang=js& ***!
  55922. \********************************************************************/
  55923. /*! exports provided: default */
  55924. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55925. "use strict";
  55926. __webpack_require__.r(__webpack_exports__);
  55927. /* 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&");
  55928. /* 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"]);
  55929. /***/ }),
  55930. /***/ "./resources/js/components/notes.vue?vue&type=template&id=73d141f4&":
  55931. /*!**************************************************************************!*\
  55932. !*** ./resources/js/components/notes.vue?vue&type=template&id=73d141f4& ***!
  55933. \**************************************************************************/
  55934. /*! exports provided: render, staticRenderFns */
  55935. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55936. "use strict";
  55937. __webpack_require__.r(__webpack_exports__);
  55938. /* 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&");
  55939. /* 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"]; });
  55940. /* 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"]; });
  55941. /***/ }),
  55942. /***/ "./resources/js/components/woinfo-edit-modal.vue":
  55943. /*!*******************************************************!*\
  55944. !*** ./resources/js/components/woinfo-edit-modal.vue ***!
  55945. \*******************************************************/
  55946. /*! exports provided: default */
  55947. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55948. "use strict";
  55949. __webpack_require__.r(__webpack_exports__);
  55950. /* 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&");
  55951. /* 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&");
  55952. /* 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");
  55953. /* normalize component */
  55954. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55955. _woinfo_edit_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55956. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["render"],
  55957. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55958. false,
  55959. null,
  55960. null,
  55961. null
  55962. )
  55963. /* hot reload */
  55964. if (false) { var api; }
  55965. component.options.__file = "resources/js/components/woinfo-edit-modal.vue"
  55966. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55967. /***/ }),
  55968. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js&":
  55969. /*!********************************************************************************!*\
  55970. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js& ***!
  55971. \********************************************************************************/
  55972. /*! exports provided: default */
  55973. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55974. "use strict";
  55975. __webpack_require__.r(__webpack_exports__);
  55976. /* 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&");
  55977. /* 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"]);
  55978. /***/ }),
  55979. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4&":
  55980. /*!**************************************************************************************!*\
  55981. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4& ***!
  55982. \**************************************************************************************/
  55983. /*! exports provided: render, staticRenderFns */
  55984. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55985. "use strict";
  55986. __webpack_require__.r(__webpack_exports__);
  55987. /* 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&");
  55988. /* 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"]; });
  55989. /* 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"]; });
  55990. /***/ }),
  55991. /***/ "./resources/js/components/woinfo.vue":
  55992. /*!********************************************!*\
  55993. !*** ./resources/js/components/woinfo.vue ***!
  55994. \********************************************/
  55995. /*! exports provided: default */
  55996. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55997. "use strict";
  55998. __webpack_require__.r(__webpack_exports__);
  55999. /* 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&");
  56000. /* 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&");
  56001. /* 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");
  56002. /* normalize component */
  56003. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56004. _woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56005. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["render"],
  56006. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56007. false,
  56008. null,
  56009. null,
  56010. null
  56011. )
  56012. /* hot reload */
  56013. if (false) { var api; }
  56014. component.options.__file = "resources/js/components/woinfo.vue"
  56015. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56016. /***/ }),
  56017. /***/ "./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  56018. /*!*********************************************************************!*\
  56019. !*** ./resources/js/components/woinfo.vue?vue&type=script&lang=js& ***!
  56020. \*********************************************************************/
  56021. /*! exports provided: default */
  56022. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56023. "use strict";
  56024. __webpack_require__.r(__webpack_exports__);
  56025. /* 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&");
  56026. /* 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"]);
  56027. /***/ }),
  56028. /***/ "./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&":
  56029. /*!***************************************************************************!*\
  56030. !*** ./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de& ***!
  56031. \***************************************************************************/
  56032. /*! exports provided: render, staticRenderFns */
  56033. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56034. "use strict";
  56035. __webpack_require__.r(__webpack_exports__);
  56036. /* 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&");
  56037. /* 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"]; });
  56038. /* 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"]; });
  56039. /***/ }),
  56040. /***/ "./resources/js/mixins/dateMixin.js":
  56041. /*!******************************************!*\
  56042. !*** ./resources/js/mixins/dateMixin.js ***!
  56043. \******************************************/
  56044. /*! exports provided: default */
  56045. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56046. "use strict";
  56047. __webpack_require__.r(__webpack_exports__);
  56048. /* harmony default export */ __webpack_exports__["default"] = ({
  56049. methods: {
  56050. treatAsUTC: function treatAsUTC(date) {
  56051. var result = new Date(date);
  56052. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  56053. return result;
  56054. },
  56055. daysSinceToday: function daysSinceToday(date) {
  56056. var currentDate = new Date();
  56057. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  56058. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  56059. },
  56060. getHRDate: function getHRDate(dateString) {
  56061. var date = new Date(dateString);
  56062. return date.toLocaleString('default', {
  56063. month: 'short',
  56064. day: 'numeric',
  56065. year: 'numeric',
  56066. hour: 'numeric',
  56067. minute: 'numeric'
  56068. });
  56069. },
  56070. isZero: function isZero(dateString) {
  56071. return dateString === '0000-00-00 00:00:00';
  56072. }
  56073. }
  56074. });
  56075. /***/ }),
  56076. /***/ "./resources/js/notify.min.js":
  56077. /*!************************************!*\
  56078. !*** ./resources/js/notify.min.js ***!
  56079. \************************************/
  56080. /*! no static exports found */
  56081. /***/ (function(module, exports, __webpack_require__) {
  56082. 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); }
  56083. (function (e) {
  56084. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  56085. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  56086. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  56087. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  56088. })(function (e) {
  56089. function A(t, n, i) {
  56090. typeof i == "string" && (i = {
  56091. className: i
  56092. }), 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);
  56093. }
  56094. var t = [].indexOf || function (e) {
  56095. for (var t = 0, n = this.length; t < n; t++) {
  56096. if (t in this && this[t] === e) return t;
  56097. }
  56098. return -1;
  56099. },
  56100. n = "notify",
  56101. r = n + "js",
  56102. i = n + "!blank",
  56103. s = {
  56104. t: "top",
  56105. m: "middle",
  56106. b: "bottom",
  56107. l: "left",
  56108. c: "center",
  56109. r: "right"
  56110. },
  56111. o = ["l", "c", "r"],
  56112. u = ["t", "m", "b"],
  56113. a = ["t", "b", "l", "r"],
  56114. f = {
  56115. t: "b",
  56116. m: null,
  56117. b: "t",
  56118. l: "r",
  56119. c: null,
  56120. r: "l"
  56121. },
  56122. l = function l(t) {
  56123. var n;
  56124. return n = [], e.each(t.split(/\W+/), function (e, t) {
  56125. var r;
  56126. r = t.toLowerCase().charAt(0);
  56127. if (s[r]) return n.push(r);
  56128. }), n;
  56129. },
  56130. c = {},
  56131. h = {
  56132. name: "core",
  56133. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  56134. 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}"
  56135. },
  56136. p = {
  56137. "border-radius": ["-webkit-", "-moz-"]
  56138. },
  56139. d = function d(e) {
  56140. return c[e];
  56141. },
  56142. v = function v(e) {
  56143. if (!e) throw "Missing Style name";
  56144. c[e] && delete c[e];
  56145. },
  56146. m = function m(t, i) {
  56147. if (!t) throw "Missing Style name";
  56148. if (!i) throw "Missing Style definition";
  56149. if (!i.html) throw "Missing Style HTML";
  56150. var s = c[t];
  56151. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  56152. var o = "";
  56153. i.classes && e.each(i.classes, function (t, n) {
  56154. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  56155. return p[t] && e.each(p[t], function (e, r) {
  56156. return o += " " + r + t + ": " + n + ";\n";
  56157. }), o += " " + t + ": " + n + ";\n";
  56158. }), o += "}\n";
  56159. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  56160. var u = {},
  56161. a = e(i.html);
  56162. y("html", a, u), y("text", a, u), i.fields = u;
  56163. },
  56164. g = function g(t) {
  56165. var n, r, i;
  56166. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  56167. try {
  56168. r.html(t);
  56169. } catch (s) {
  56170. r[0].styleSheet.cssText = t;
  56171. }
  56172. return r;
  56173. },
  56174. y = function y(t, n, r) {
  56175. var s;
  56176. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  56177. var n;
  56178. n = e(this).attr(s), n || (n = i), r[n] = t;
  56179. });
  56180. },
  56181. b = function b(e, t) {
  56182. return e.is(t) ? e : e.find(t);
  56183. },
  56184. w = {
  56185. clickToHide: !0,
  56186. autoHide: !0,
  56187. autoHideDelay: 5e3,
  56188. arrowShow: !0,
  56189. arrowSize: 5,
  56190. breakNewLines: !0,
  56191. elementPosition: "bottom",
  56192. globalPosition: "top right",
  56193. style: "bootstrap",
  56194. className: "error",
  56195. showAnimation: "slideDown",
  56196. showDuration: 400,
  56197. hideAnimation: "slideUp",
  56198. hideDuration: 200,
  56199. gap: 5
  56200. },
  56201. E = function E(t, n) {
  56202. var r;
  56203. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  56204. },
  56205. S = function S(t) {
  56206. return e.extend(w, t);
  56207. },
  56208. x = function x(t) {
  56209. return e("<" + t + "></" + t + ">");
  56210. },
  56211. T = {},
  56212. N = function N(t) {
  56213. var n;
  56214. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  56215. return e(r).attr("name") === t.attr("name");
  56216. }), t = n.first()), t;
  56217. },
  56218. C = function C(e, t, n) {
  56219. var r, i;
  56220. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  56221. if (isNaN(n)) return;
  56222. 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;
  56223. },
  56224. k = function k(e, t, n) {
  56225. if (e === "l" || e === "t") return 0;
  56226. if (e === "c" || e === "m") return n / 2 - t / 2;
  56227. if (e === "r" || e === "b") return n - t;
  56228. throw "Invalid alignment";
  56229. },
  56230. L = function L(e) {
  56231. return L.e = L.e || x("div"), L.e.text(e).html();
  56232. };
  56233. A.prototype.loadHTML = function () {
  56234. var t;
  56235. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  56236. }, A.prototype.show = function (e, t) {
  56237. var n, r, i, s, o;
  56238. r = function (n) {
  56239. return function () {
  56240. !e && !n.elem && n.destroy();
  56241. if (t) return t();
  56242. };
  56243. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  56244. 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 {
  56245. if (!!o || !!e) return r();
  56246. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  56247. }
  56248. return n.push(r), i[s].apply(i, n);
  56249. }, A.prototype.setGlobalPosition = function () {
  56250. var t = this.getPosition(),
  56251. n = t[0],
  56252. i = t[1],
  56253. o = s[n],
  56254. u = s[i],
  56255. a = n + "|" + i,
  56256. f = T[a];
  56257. if (!f || !document.body.contains(f[0])) {
  56258. f = T[a] = x("div");
  56259. var l = {};
  56260. 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);
  56261. }
  56262. return f.prepend(this.wrapper);
  56263. }, A.prototype.setElementPosition = function () {
  56264. 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;
  56265. 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"];
  56266. for (w = 0, S = B.length; w < S; w++) {
  56267. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  56268. }
  56269. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  56270. if (!this.options.arrowShow) this.arrow.hide();else {
  56271. 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";
  56272. for (E = 0, x = a.length; E < x; E++) {
  56273. D = a[E], P = s[D];
  56274. if (D === L) continue;
  56275. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  56276. }
  56277. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  56278. }
  56279. 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);
  56280. if (r) return this.arrow.removeAttr("style").css(r);
  56281. }, A.prototype.getPosition = function () {
  56282. var e, n, r, i, s, f, c, h;
  56283. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  56284. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  56285. 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";
  56286. return e.length === 2 && (e[2] = e[1]), e;
  56287. }, A.prototype.getStyle = function (e) {
  56288. var t;
  56289. e || (e = this.options.style), e || (e = "default"), t = c[e];
  56290. if (!t) throw "Missing style: " + e;
  56291. return t;
  56292. }, A.prototype.updateClasses = function () {
  56293. var t, n;
  56294. 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) {
  56295. return r + "-" + n.name + "-" + e;
  56296. }).join(" "), this.userContainer.attr("class", t);
  56297. }, A.prototype.run = function (t, n) {
  56298. var r, s, o, u, a;
  56299. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  56300. if (this.container && !t) {
  56301. this.show(!1);
  56302. return;
  56303. }
  56304. if (!this.container && !t) return;
  56305. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  56306. for (o in s) {
  56307. r = s[o], u = this.userFields[o];
  56308. if (!u) continue;
  56309. 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);
  56310. }
  56311. 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));
  56312. }, A.prototype.destroy = function () {
  56313. this.wrapper.data(r, null), this.wrapper.remove();
  56314. }, e[n] = function (t, r, i) {
  56315. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  56316. }, e.fn[n] = function (t, n) {
  56317. return e(this).each(function () {
  56318. var i = N(e(this)).data(r);
  56319. i && i.destroy();
  56320. var s = new A(e(this), t, n);
  56321. }), this;
  56322. }, e.extend(e[n], {
  56323. defaults: S,
  56324. addStyle: m,
  56325. removeStyle: v,
  56326. pluginOptions: w,
  56327. getStyle: d,
  56328. insertCSS: g
  56329. }), m("bootstrap", {
  56330. html: "<div>\n<span data-notify-text></span>\n</div>",
  56331. classes: {
  56332. base: {
  56333. "font-weight": "bold",
  56334. padding: "8px 15px 8px 14px",
  56335. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  56336. "background-color": "#fcf8e3",
  56337. border: "1px solid #fbeed5",
  56338. "border-radius": "4px",
  56339. "white-space": "nowrap",
  56340. "padding-left": "25px",
  56341. "background-repeat": "no-repeat",
  56342. "background-position": "3px 7px"
  56343. },
  56344. error: {
  56345. color: "#B94A48",
  56346. "background-color": "#F2DEDE",
  56347. "border-color": "#EED3D7",
  56348. "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=)"
  56349. },
  56350. success: {
  56351. color: "#468847",
  56352. "background-color": "#DFF0D8",
  56353. "border-color": "#D6E9C6",
  56354. "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==)"
  56355. },
  56356. info: {
  56357. color: "#3A87AD",
  56358. "background-color": "#D9EDF7",
  56359. "border-color": "#BCE8F1",
  56360. "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=)"
  56361. },
  56362. warn: {
  56363. color: "#C09853",
  56364. "background-color": "#FCF8E3",
  56365. "border-color": "#FBEED5",
  56366. "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)"
  56367. }
  56368. }
  56369. }), e(function () {
  56370. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  56371. e(this).trigger("notify-hide");
  56372. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  56373. var n = e(this).data(r);
  56374. n && n.show(!1);
  56375. });
  56376. });
  56377. });
  56378. /***/ }),
  56379. /***/ "./resources/sass/app.scss":
  56380. /*!*********************************!*\
  56381. !*** ./resources/sass/app.scss ***!
  56382. \*********************************/
  56383. /*! no static exports found */
  56384. /***/ (function(module, exports) {
  56385. // removed by extract-text-webpack-plugin
  56386. /***/ }),
  56387. /***/ 0:
  56388. /*!*************************************************************!*\
  56389. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  56390. \*************************************************************/
  56391. /*! no static exports found */
  56392. /***/ (function(module, exports, __webpack_require__) {
  56393. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  56394. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  56395. /***/ })
  56396. /******/ });